Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
build geo database to `api/assets/geolite`
async function buildGeoLite() { // init geolite database url let url = 'https://cdn.jsdelivr.net/gh/GitSquared/node-geolite2-redist@master/redist/GeoLite2-Country.tar.gz'; if (process.env.MAXMIND_LICENSE_KEY) { url = 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=' + process.env.MAXMIND_LICENSE_KEY + '&suffix=tar.gz'; } // file infos const folder = path.resolve(__dirname, '../api/assets'); if (!fs.existsSync(folder)) { fs.mkdirSync(folder); } const zippedFile = path.join(folder, 'GeoLite2-Country.tar.gz'); // fetch database from remote await new Promise((resolve, reject) => { // file write stream const zippedFileStream = fs.createWriteStream(zippedFile); zippedFileStream.on('finish', () => { resolve(); }); // https request const request = https.get(url, (response) => { if (response.statusCode !== 200) { reject(new Error('failed to fetch geo database')); } response.pipe(zippedFileStream); }); // error handler const handleFailure = () => { fs.unlinkSync(zippedFile); reject(new Error('failed to write geo database file')); }; zippedFileStream.on('error', handleFailure); request.on('error', handleFailure); }); if (!fs.existsSync(zippedFile)) { throw new Error('failed to fetch geo database'); } // extract file await new Promise((resolve, reject) => { const zippedFileStream = fs .createReadStream(zippedFile) .pipe(zlib.createGunzip()) .pipe(tar.t()); zippedFileStream.on('error', () => { reject(new Error('failed to read compressed geo database')); }); zippedFileStream.on('entry', (entry) => { if (entry.path.endsWith('.mmdb')) { const file = path.join(folder, path.basename(entry.path)); const extractedFileStream = fs.createWriteStream(file); entry.pipe(extractedFileStream); extractedFileStream.on('error', () => { fs.unlinkSync(file); reject(new Error('failed to write extracted geo database')); }); extractedFileStream.on('finish', () => { resolve(); }); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function geoWrite(config, geoData) {\n // mongoose.connect(config.db);\n // var db = mongoose.connection;\n // var collection = db.collection('geo');\n // console.log(\"about to update\")\n // console.log(geoData);\n // collection.update({ _id: ObjectId(\"5773497a893c69e9b7a86dad\") }, { $push: { $each: geoData}}, function(err, result){\n // if (err){\n // console.log(err);\n // }\n // else{\n // console.log('inserted %d into the \"geo\" collection. The documents inserted with \"_id\" are: ', result.length, result);\n // }\n // db.close();\n // });\n \n jsonfile.writeFile(\"./public/geo.geojson\", geoData, {spaces: 2}, function(err){\n if (err){\n console.error(err)\n }\n });\n \n}", "async function seedGeoJ(){\n\ttry{\n\t\tawait new Promise((resolve,reject) => {\n\t\t\tlet files = fs.readdirSync(pubDir).filter(fn => fn.endsWith('.GeoJSON'));\n\n\t\t\tfiles.forEach((file) => {\n\t\t\t\tlet id = file.match(/\\d+(?=\\.)/)[0];\n\t\t\t\tlet stream = fs.createReadStream(pubDir+file)\n\t\t\t\t\t.on('error', reject)\n\t\t\t\t\t.on('data', (data) => {\n\t\t\t\t\t\tstream.pause();\n\t\t\t\t\t\tlet gj = JSON.parse(data);\n \t\t\t\t\t\tFarm.findOneAndUpdate(\n\t\t\t\t\t\t\t{farm_id: id},\n\t\t\t\t\t\t\t{geojson: gj},\n\t\t\t\t\t\t\t{useFindAndModify: false}\n\t\t\t\t\t\t).then(doc => {})\n\t\t\t\t\t\t\t.catch(err => {\treturn err })\n\t\t\t\t\t\tstream.resume();\n\t\t\t\t\t}).on('end', async (res) => {\n\t\t\t\t\t\tresolve();\n\t \t\t\t\t});\n\t\t\t})\n\t\t});\n\t}catch (e){\n\t\tconsole.log('error: ' + e)\n\t} finally {\n\t\tconsole.log('SEED GEOJ');\n\t}\n}", "function getData(req, res) {\n\n var coords = req,\n sql_poly = [],\n points = [];\n\n for (var i in coords) {\n sql_poly.push(coords[i].lng);\n sql_poly.push(coords[i].lat);\n };\n\n // close the polygon\n sql_poly.push(coords[0].lng);\n sql_poly.push(coords[0].lat);\n\n // write the correct number of st_point functions\n for (var j=1; j<=sql_poly.length; j+=2) {\n points.push('ST_SetSRID(ST_Point($' + j + ',' + '$' +(j+1) + '), 4326)');\n }\n\n var sql = \"SELECT address, zipcode, borough, borocode, block, lot, cd, ownername, ownertype,\"+\n \"numfloors, yearbuilt, zonedist1, zonedist2, zonedist3,\" +\n \"zoning_style, \" +\n \" ST_AsGeoJSON(geom)\" + \n \" AS geom FROM map_pluto2014v2 WHERE \" +\n \" ST_Intersects(geom, ST_MakePolygon(ST_MakeLine( ARRAY[\" + \n points.join() +\n \" ] )));\";\n \n console.log('the sql: ', sql);\n\n var fc = {\n \"type\" : \"FeatureCollection\",\n \"features\" : []\n };\n\n\n client.query(sql, sql_poly, function(err, result) {\n \n if (err) { \n console.log(\"error: \", err);\n return;\n }\n\n // console.log('client query sql res: ', result);\n \n result.rows.forEach(function(feature) {\n\n var f = {\n \"type\" : \"Feature\",\n \"geometry\" : JSON.parse(feature.geom),\n \"properties\" : {\n \"borough\" : feature.borough,\n \"boroughcode\" : feature.borocode,\n \"block\": feature.block,\n \"lot\": feature.lot,\n \"address\": feature.address,\n \"zipcode\": feature.zipcode,\n \"communitydistrict\": feature.cd,\n \"ownername\" : feature.ownername,\n \"ownertype\" : feature.ownertype,\n \"numberfloors\" : feature.numfloors,\n \"yearbuilt\" : feature.yearbuilt,\n \"zoningprimary\" : feature.zonedist1,\n \"zoningsecondary\" : feature.zonedist2,\n \"zoningtertiary\" : feature.zonedist3,\n \"zonestyle\" : feature.zoning_style\n }\n };\n fc.features.push(f);\n });\n\n res.setHeader(\"Access-Control-Allow-Origin\", \"*\")\n res.send(fc);\n //client.end(); \n // console.log('queried data: ', fc);\n });\n\n}", "async function getData(){\r\n\r\n //Fetch the data from the geojson file\r\n fetch(\"BEWES_Building_Data.geojson\").then(response => response.json()).then(data => {addToTable(data);});\r\n\r\n }", "static newGeo() { return { vertices: [], normals: [], indices: [], texcoord: [] }; }", "function build_map_comp() {\r\n\r\n var overlayMaps = {};\r\n d3.json(\"/assets/data/data_upd.geojson\")\r\n .then(function(data) {\r\n createFeatures(data.features)\r\n }) \r\n .catch(function(error){\r\n console.log(error)\r\n });\r\n}", "function buildMaps(countrys_info) {\n\n d3.json(\"/static/data/countries.geo.json\", function (countryMapData) {\n updataJsonData(countryMapData, countrys_info);\n createFeatures(countryMapData);\n });\n }", "static get DATABASE_URL() {\r\n\t\tconst port = 8000; // Change this to your server port\r\n\t\treturn `http://localhost:${port}/data/restaurants.json`;\r\n\t}", "static get DATABASE_URL() {\n const port = 8000; // Change this to your server port\n return `http://localhost:${port}/data/restaurants.json`;\n }", "get DATABASE_URL() {\r\n const domain = `https://mws-pwa.appspot.com`;\r\n // const domain = 'http://localhost:'\r\n const port = 1337; // Change this to your server port\r\n // const origin = `${domain}${port}`;\r\n const origin = `${domain}`\r\n return {\r\n restaurants: `${origin}/restaurants/`, // GET: All restaurants, or 1 with ID\r\n restaurantsFavorites: `${origin}/restaurants/?is_favorite=true`, // GET: All favorited restaurants\r\n restaurantReviews: `${origin}/reviews/?restaurant_id=`, // GET: All reviews by restaurant ID\r\n reviews: `${origin}/reviews/`, // GET: All reviews, or 1 with ID\r\n faveRestaurant: id => `${origin}/restaurants/${id}/?is_favorite=true`, // PUT: Favorite a restaurant by ID\r\n unfaveRestaurant: id => `${origin}/restaurants/${id}/?is_favorite=false`, // PUT: Unfavorite a restaurant by ID\r\n editReview: id => `${origin}/reviews/${id}` // PUT = update, DELETE = delete review\r\n };\r\n }", "function devAdd() {\n // use Fetch API to send request\n fetch(`https://rofor8.carto.com/api/v2/sql?q=\n INSERT INTO dep (loc, the_geom, tag, mac, mods)\nVALUES\n(\n '${loc}',\n St_SetSRID(St_GeomFromGeoJSON('${geom}'), 4326),\n '${assetTag}',\n(SELECT mac FROM dev WHERE tag='${assetTag}'),\n(SELECT mods FROM dev WHERE tag='${assetTag}')\n)\n&api_key='606dccebf8b13efcc2a36201730087365a82ab1c`, {\n headers: new Headers({\n 'Content-Type': 'application/json',\n 'Access-Control-Allow-Headers': 'Content-Type',\n 'Access-Control-Allow-Origin': '*',\n }),\n method: 'get',\n mode: 'no-cors',\n }).then(function (response) {\n\n }).catch(function (err) {\n console.log(err);\n });\n\n client._reload(source);\n console.log('Add marker has been run');\n populateDropDownLocation();\n}", "function main() {\n var mapOptions = {\n zoom: 10,\n center: [19.39, -99.14] //Mexico\n };\n map = new L.Map('map', mapOptions);\n\n// Add a basemap to the map object just created\nL.tileLayer('http://s.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {\n attribution: 'Stamen'\n}).addTo(map);\n\ncartodb.createLayer(map, {\n type: 'cartodb',\n user_name: 'edublancas',\n sublayers: [{\n //Dont include an SQL statement here, the map should be empty when\n //the user opens the webpage\n //sql: 'SELECT * FROM colonias WHERE objectid=12893',\n cartocss: '#colonias{polygon-fill: #5CA2D1;polygon-opacity: 0.7;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'\n }]\n})\n.addTo(map)\n.on('done', function(layer_) {\n layer = layer_\n})\n\n}", "async function geoLocate(ip) {\n const api = await fetch(`https://ipgeolocation.abstractapi.com/v1/?api_key=${GeoLocateKey}&ip_address=${ip}`);\n const jsonData = await api.json();\n databaseJSON.insert(jsonData);\n }", "static get DATABASE_URL() {\r\n const port = 8000 // Change this to your server port\r\n return `http://localhost:${port}/data/restaurants.json`;\r\n }", "static get DATABASE_URL () {\r\n const port = 1337 // Change this to your server port\r\n return `http://localhost:${port}/data/restaurants.json`\r\n }", "function buildApi(currentLon, currentLat) {\n apiUrl += currentLat + \"&lon=\" + currentLon + currentFormat + localWeatherKey;\n sunApiUrl += currentLat + \"&lng=\" + currentLon + \"&date=today&formatted=0\";\n loadJSON(apiUrl);\n makeTheSun(sunApiUrl);\n\n }", "updatePointsOnGlobe() {\n const globeseries = [['peers', []]];\n let geoiplookup = '';\n\n if (process.env.NODE_ENV === 'development') {\n geoiplookup = maxmind.openSync(\n path.join(__dirname, 'GeoLite2-City', 'GeoLite2-City.mmdb')\n );\n } else {\n geoiplookup = maxmind.openSync(\n path.join(\n configuration.GetAppResourceDir(),\n 'GeoLite2-City',\n 'GeoLite2-City.mmdb'\n )\n );\n }\n\n RPC.PROMISE('getpeerinfo', []).then(payload => {\n var tmp = {};\n var ip = {};\n let maxnodestoadd = payload.length;\n if (maxnodestoadd > 20) {\n maxnodestoadd = 20;\n }\n for (var i = 0; i < maxnodestoadd; i++) {\n ip = payload[i].addr;\n ip = ip.split(':')[0];\n var tmp = geoiplookup.get(ip);\n globeseries[0][1].push(tmp.location.latitude);\n globeseries[0][1].push(tmp.location.longitude);\n globeseries[0][1].push(0.1); //temporary magnitude.\n }\n\n globeseries[0][1].push(myIP[0]);\n globeseries[0][1].push(myIP[1]);\n globeseries[0][1].push(0.1); //temporary magnitude.\n // console.log(myIP);\n if (myIP[1]) {\n glb.removePoints();\n glb.addData(globeseries[0][1], {\n format: 'magnitude',\n name: globeseries[0][0],\n });\n glb.createPoints();\n }\n });\n }", "static get DATABASE_URL() {\n const protocol = location.protocol;\n const host = location.host;\n return `${protocol}//${host}/data/restaurants.json`;\n }", "function updateCoords(){\n storage.write('coords.json', coords);\n}", "static get DATABASE_URL() {\r\n const port = 8081 // Change this to your server port\r\n // return `http://localhost:${port}/data/restaurants.json`;\r\n return `http://localhost:1337/restaurants`;\r\n }", "async function getIso(coords) {\n\n var lon = coords[0];\n var lat = coords[1];\n\n\n const query = await fetch(\n `${urlBase}${profile}/${lon},${lat}?contours_minutes=${minutes}&polygons=true&access_token=${mapboxgl.accessToken}`,\n { method: 'GET' }\n );\n const data = await query.json();\n console.log(data);\n\n\n\n if(map.getLayer('iso')) {\n map.removeLayer('iso');\n map.removeLayer('iso')\n }\n\n\n map.addSource('iso', {\n type: 'geojson',\n data: {\n 'type': 'FeatureCollection',\n 'features': []\n }\n });\n \n map.addLayer(\n {\n 'id': 'iso',\n 'type': 'fill',\n 'source': 'iso',\n 'layout': {},\n 'paint': {\n 'fill-color': '#5a3fc0',\n 'fill-opacity': 0.7\n }\n },\n 'poi-label'\n );\n\n map.getSource('iso').setData(data);\n\n console.log(turf.bbox(data))\n\n\n map.fitBounds(turf.bbox(data), {\n linear: true,\n padding: 100\n })\n\n\n\n}", "function init() {\n createMap(\"./json/map-style.json\");\n\n}", "static get DATABASE_URL() {\n // const port = 8000 // Change this to your server port\n const port = 1337 // Change this to your server port\n const path = `http://localhost:${port}/`;\n \n // return `${path}data/restaurants.json`;\n return `${path}`;\n }", "function updateLocalData(serverData) {\n\n if (!fs.existsSync(dataBasePath)) createMissingDir(dataBasePath);\n\n const trail = serverData.trail;\n\n // Trail path (GeoJsonFeature)\n const pathFeature = turf.feature(trail.geometry, _.omit(trail, 'geometry'));\n // const pathFeature = apiResourceToGeoJsonFeature(_.pick(trail, 'geometry'), _.pick(trail, 'length'));\n savePathInFile(pathFeature);\n\n // Zones\n //\n // {\n // type: 'FeatureCollection',\n // features: [ GeoJsonFeature, GeoJsonFeature, ... ]\n // }\n // const zonesFeatureCollection = {\n // name : 'zone',\n // type : 'FeatureCollection',\n // features: serverData.zones.map(zone => apiResourceToGeoJsonFeature(zone))\n // };\n const zonesFeatures = serverData.zones.map(zone => {\n zone.points.start = turf.feature(zone.points.start.geometry, _.assign(_.omit(zone.points.start, 'geometry'), {theme: 'extremity', type: 'start'}));\n zone.points.end = turf.feature(zone.points.end.geometry, _.assign(_.omit(zone.points.end, 'geometry'), {theme: 'extremity', type: 'end'}));\n return turf.feature(zone.geometry, _.omit(zone, 'geometry'))\n });\n const zonesFeatureCollection = turf.featureCollection(zonesFeatures);\n saveZonesInFile(zonesFeatureCollection);\n\n // Species map by theme\n //\n // {\n // bird: [ speciesObject, speciesObject, speciesObject, ... ],\n // butterfly: [ speciesObject, speciesObject, speciesObject, ... ],\n // ...\n // }\n const speciesByTheme = _.reduce(serverData.species, (memo, species) => {\n memo[species.theme] = memo[species.theme] || [];\n memo[species.theme].push(species);\n return memo;\n }, {});\n savePoiDetailsInFiles(speciesByTheme);\n\n // POIS map by theme\n //\n // {\n // bird: {\n // type: 'FeatureCollection',\n // features: [ GeoJsonFeature, GeoJsonFeature, ... ]\n // },\n // butterfly: {\n // type: 'FeatureCollection',\n // features: [ GeoJsonFeature, GeoJsonFeature, ... ]\n // },\n // ...\n // }\n const poiFeatureCollectionsByTheme = _.reduce(serverData.pois, (memo, poi) => {\n memo[poi.theme] = memo[poi.theme] || {name: poi.theme, type: 'FeatureCollection', features: []};\n\n const species = serverData.species.find(species => species.id == poi.speciesId);\n if (!species) {\n throw new Error(`Could not find species for POI ${poi.id} (species ID ${poi.speciesId})`);\n }\n\n const extraSpeciesProperties = _.pick(species, 'commonName', 'periodStart', 'periodEnd');\n memo[poi.theme].features.push(apiResourceToGeoJsonFeature(poi, extraSpeciesProperties));\n\n return memo;\n }, {});\n savePoiGeoJsonInFile(poiFeatureCollectionsByTheme);\n}", "function getData2() {\n let url = \"geocode_data_animal.json\";\n }", "function buildDatabase() {\n\t\t\n\tvar pos0 = {\n\t\tlatitude: 37.42512,\n\t\tlongitude: -122.16074\n\t};\n\tsnd0 = new Audio('InsideOut.mp3');\n\tsnd0.play();\n\tsnd0.pause();\n\t\n\taddToDatabase(pos0, snd0, 0);\n\t\n\n\tvar pos1 = {\n\t\tlatitude: 37.425226,\n\t\tlongitude: -122.160792\n\t};\t\n\tsnd1 = new Audio('WakeBakeSkate.mp3');\n\tsnd1.play();\n\tsnd1.pause();\n\t\n\taddToDatabase(pos1, snd1, 1);\n\t\n}", "function dbInitilization(){\n \n // Queries scheduled will be serialized.\n db.serialize(function() {\n \n // Queries scheduled will run in parallel.\n db.parallelize(function() {\n\n db.run('CREATE TABLE IF NOT EXISTS countries (id integer primary key autoincrement unique, name)')\n db.run('CREATE TABLE IF NOT EXISTS recipes (id integer primary key autoincrement unique, name, type, time, ingredient, method, id_Country)')\n })\n }) \n}", "static get DATABASE_URL() {\r\n const port = 1337 // Change this to your server port\r\n //return `http://localhost:${port}/data/restaurants.json`;\r\n return `http://localhost:${port}`;\r\n }", "constructor(options) {\n super(options);\n\n this.location = options.location;\n\n this.db = bdb.create({\n location: this.location,\n cacheSize: options.cacheSize,\n compression: false,\n memory: options.memory\n });\n }", "function populateDb() {\n fs.writeFile(\"db/db.json\", JSON.stringify(notes, \"\\t\"), (err) => {\n if (err) throw err;\n });\n }", "populateDB_with_tempData() {\n let url = `http://api.apixu.com/v1/current.json?key=b2bd4bdcb0124f36bec75135191104&q=London`\n request.get(url, (error, response, body) => {\n const arg = JSON.parse(body)\n // console.log(arg)\n this.saveCityToDB(arg)\n });\n\n url = `http://api.apixu.com/v1/current.json?key=b2bd4bdcb0124f36bec75135191104&q=Berlin`\n request.get(url, (error, response, body) => {\n const arg = JSON.parse(body)\n // console.log(arg)\n this.saveCityToDB(arg)\n });\n\n url = `http://api.apixu.com/v1/current.json?key=b2bd4bdcb0124f36bec75135191104&q=Tokyo`\n request.get(url, (error, response, body) => {\n const arg = JSON.parse(body)\n // console.log(arg)\n this.saveCityToDB(arg)\n });\n\n url = `http://api.apixu.com/v1/current.json?key=b2bd4bdcb0124f36bec75135191104&q=Moscow`\n request.get(url, (error, response, body) => {\n const arg = JSON.parse(body)\n // console.log(arg)\n this.saveCityToDB(arg)\n });\n console.log(\"populated the collection City with some cities got from api\")\n }", "function fetchGeoData(){\n $.ajax({\n dataType: \"json\",\n url: \"data/map.geojson\",\n success: function(data) {\n $(data.features).each(function(key, data) {\n geoDataLocations.push(data);\n });\n startMap();\n },\n error: function(error){\n console.log(error);\n return error;\n }\n });\n }", "function initMap() {\n //The api is loaded at this step\n //L'api est chargée à cette étape\n\n // add translations\n translate();\n\n //options for creating viewer:\n var options= {\n // default value\n // valeur par défaut\n //mode:'normal',\n // default value\n // valeur par défaut\n //territory:'FXX',\n // default value\n // valeur par défaut\n //displayProjection:'IGNF:RGF93G'\n // only usefull when loading external resources\n // utile uniquement pour charger des resources externes\n //proxy:'/geoportail/api/xmlproxy'+'?url='\n };\n\n // viewer creation of type <Geoportal.Viewer>\n // création du visualiseur du type <Geoportal.Viewer>\n // HTML div id, options\n viewer= new Geoportal.Viewer.Simple('viewerDiv', OpenLayers.Util.extend(\n options,\n // API keys configuration variable set by\n // <Geoportal.GeoRMHandler.getConfig>\n // variable contenant la configuration des clefs API remplie par\n // <Geoportal.GeoRMHandler.getConfig>\n window.gGEOPORTALRIGHTSMANAGEMENT===undefined? {'apiKey':'nhf8wztv3m9wglcda6n6cbuf'} : gGEOPORTALRIGHTSMANAGEMENT)\n );\n if (!viewer) {\n // problem ...\n OpenLayers.Console.error(OpenLayers.i18n('new.instance.failed'));\n return;\n }\n\n //Loading of data layers\n //Chargement des couches de données\n viewer.addGeoportalLayers([\n 'ORTHOIMAGERY.ORTHOPHOTOS'\n ], {});\n\n viewer.getMap().setCenterAtLonLat(0.00, 0.00, 1);\n\n //Adding a Vector layer: each feature will hold a well known graphic.\n //Ajout d'une couche vectorielle : chaque objet portera un symbole\n //pré-défini.\n var gs= [];\n for (var g in OpenLayers.Renderer.symbol) {\n gs.push(g);\n }\n var n= gs.length;\n var fs= new Array(n);\n var l= 0, c= 0, d= 100000.0;\n for (var i= 0; i<n; i++) {\n fs[i]= new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(d*c, -d*l), { type: gs[i] });\n if (c++ > 12) { c= 0; l++; }\n }\n\n //Create a style map: the graphicName property is evaluated against the\n //type attribute\n //Créé une symbolisation cartographique: la propriété graphicName est\n //évaluée au travers de l'attribut type\n var styles= new OpenLayers.StyleMap({\n \"default\": new OpenLayers.Style({\n graphicName:\"${type}\",\n fillColor:\"lime\",\n fillOpacity:\"${getOpacity}\",\n strokeColor:\"lime\",\n strokeWidth:\"${getWidth}\",\n pointRadius:10\n }, {\n context:{ // Stroke or not stroke\n getWidth: function(f) {\n var s= f.attributes.type;\n return (s.charAt(0)=='_' && s.charAt(s.length-1)=='_'? 0 : 2);\n },\n // Opacity\n getOpacity: function(f) {\n var s= f.attributes.type;\n return (s.charAt(0)=='_' && s.charAt(s.length-1)=='_' ? 1 : 0.7);\n }\n }\n }),\n \"select\": new OpenLayers.Style({\n graphicName:\"${type}\",\n fillColor:\"fuchsia\",\n fillOpacity:1.0,\n strokeColor:\"fuchsia\",\n strokeWidth:\"${getWidth}\",\n label:\"${type}\",\n labelXOffset:0,\n labelYOffset:50,\n labelBackgroundColor:\"black\",\n fontColor:\"yellow\",\n pointRadius:20\n }, {\n context:{ // Stroke or not stroke\n getWidth: function(f) {\n var s= f.attributes.type;\n return (s.charAt(0)=='_' && s.charAt(s.length-1)=='_'? 0 : 2);\n }\n }\n })\n });\n\n //Create new layer\n //Création de la couche vectorielle\n var symbols= new OpenLayers.Layer.Vector(\"Symbols\", {\n styleMap:styles,\n opacity:1.0,\n visibility:true\n });\n symbols.addFeatures(fs);\n viewer.getMap().addLayer(symbols);\n\n //Create a hover selector to display symbol's name\n //Création d'un sélecteur par survol pour afficher le nom du symbole\n var hoverCtrl= new OpenLayers.Control.SelectFeature(symbols, {\n autoActivate: true,\n hover: true\n });\n viewer.getMap().addControl(hoverCtrl);\n\n viewer.getMap().zoomToExtent(symbols.getDataExtent(), true);\n\n // cache la patience - hide loading image\n viewer.div.style[OpenLayers.String.camelize('background-image')]= 'none';\n}", "constructor() {\n this.#database = new Datastore({\n filename: \"./server/database/rooms.db\",\n autoload: true,\n });\n }", "static get DATABASE_URL() {\r\n const port = 1337; // Change this to your server port\r\n const url = window.location.href;\r\n if(url.startsWith('https')) {\r\n return `https://amroaly.github.io/mws-restaurant-stage-1/data/restaurants.json`;\r\n } \r\n // for dev it shoud be http://localhost:${port}\r\n // instead of https://amroaly.github.io/mws-restaurant-stage-1/\r\n return `http://localhost:${port}/restaurants`;\r\n }", "static mk_geo( g ){\n\t\t\tlet geo = new THREE.BufferGeometry();\n\t\t\tgeo.setAttribute( \"position\", new THREE.BufferAttribute( g.vertices.data, g.vertices.comp_len ) );\n\n\t\t\t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\t\t\tif( g.indices )\n\t\t\t\tgeo.setIndex( new THREE.BufferAttribute( g.indices.data, 1 ) );\n\n\t\t\tif( g.normal )\n\t\t\t\tgeo.setAttribute( \"normal\", new THREE.BufferAttribute( g.normal.data, g.normal.comp_len ) );\n\n\t\t\tif( g.uv )\n\t\t\t\tgeo.setAttribute( \"uv\", new THREE.BufferAttribute( g.uv.data, g.uv.comp_len ) );\n\n\t\t\t//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\t\t\tgeo.name = g.name;\n\t\t\treturn geo;\n\t\t}", "static get DATABASE_URL() {\r\n // const port = 8000 // Change this to your server port\r\n // return `http://localhost:${port}/data/restaurants.json`;\r\n return `http://localhost:${DBHelper.port}/restaurants`;\r\n }", "function createMap(){\n //Initialize the map\n var map = L.map('map').setView([20, 0], 2);\n //add OSM base tilelayer\n //L.tileLayer('http://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.{ext}', {\n\t // attribution: 'Map tiles by <a href=\"http://stamen.com\">Stamen Design</a>, <a href=\"http://creativecommons.org/licenses/by/3.0\">CC BY 3.0</a> &mdash; Map data &copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>',\n\t // subdomains: 'abcd',\n L.tileLayer('http://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.{ext}', {\n\t attribution: 'Map tiles by <a href=\"http://stamen.com\">Stamen Design</a>, <a href=\"http://creativecommons.org/licenses/by/3.0\">CC BY 3.0</a> &mdash; Map data &copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>',\n\t subdomains: 'abcd',\n\t minZoom: 0,\n\t maxZoom: 20,\n\t ext: 'png'\n }).addTo(map);\n\n //call the getData function to load MegaCities data\n getData(map);\n}", "async init(){\n if(this.state.id == undefined)\n this.state.id = await this.genID();\n await mkdirp(`../maps/${this.state.id}`);\n if(this.state.partial == undefined)\n this.state.partial = false;\n this.state.sectors = await this.genSectors(this.state.partial);\n this.save();\n }", "function createMap(){\n\t//create the map and zoom in order to grab the entire US\n\tvar map = L.map('mapid',{\n\t\tmaxZoom: 7,\n\t\tminZoom:4,\n\t\t//maxBounds: bounds\n\t}).setView([38,-102],5);\n\n\tvar CartoDB_Positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {\n attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors &copy; <a href=\"https://carto.com/attributions\">CARTO</a>',\n subdomains: 'abcd',\n\tminZoom: 0,\n\tmaxZoom: 20,\n}).addTo(map);\n\n\t//unique basemap by stamen, also adding zillow data info \n// \tvar Stamen_Toner = L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}{r}.{ext}', {\n// \tattribution: 'Map tiles by <a href=\"http://stamen.com\">Stamen Design</a>, <a href=\"http://creativecommons.org/licenses/by/3.0\">CC BY 3.0</a> &mdash; Map data &copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors',\n// \tsubdomains: 'abcd',\n// \tminZoom: 0,\n// \tmaxZoom: 20,\n// \text: 'png'\n// }).addTo(map);\n\n getData(map);\n}", "function preload(){\n //load world map data and contacts data\n url = \"https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/world.geojson\";\n geographies = loadJSON(url);\n url2 = \"https://raw.githubusercontent.com/awhite2/CreativeCoding/main/contacts.geojson\";\n contacts = loadJSON(url2);\n \n}", "function getGEO(input){\n // grab 2018 cencus data\n d3.json(`/sqlsearch/${input}`).then(function(data){\n\n var info2 = data\n // get lat and lon out of Json and then group for Weather api\n globalLat = info2.lat[0]\n globalLon = info2.lng[0]\n var both = globalLat+\",\"+ globalLon\n // send to weather api\n getWeather(both)\n })\n}", "function LoadGEOJsonSources() {\n map.addSource('Scotland-Foto', {\n \"type\": \"geojson\",\n \"data\": \"https://daanvr.github.io/Schotland/geojson/Scotrip-FotoDataFile-RichOnly-Live.geojson\"\n });\n map.addSource('Scotland-Routes', {\n \"type\": \"geojson\",\n \"data\": \"https://daanvr.github.io/Schotland/geojson/Routes.geojson\"\n });\n\n var data = JSON.parse('{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[-5.096936,57.149319]},\"properties\":{\"FileName\":\"IMG_8571\",\"type\":\"Foto\",\"FileTypeExtension\":\"jpg\",\"SourceFile\":\"/Users/daan/Downloads/Schotlandexpiriment/IMG_8571.JPG\",\"CreateDate\":\"2018-04-13\",\"CreateTime\":\"15:15:34\",\"Make\":\"Apple\",\"Model\":\"iPhoneSE\",\"ImageSize\":\"16382x3914\",\"Duration\":\"\",\"Altitude\":\"276\",\"URL\":\"https://farm1.staticflickr.com/823/26804084787_f45be76bc3_o.jpg\",\"URLsmall\":\"https://farm1.staticflickr.com/823/26804084787_939dd60ebc.jpg\"}}]}');\n map.addSource('SelectedMapLocationSource', {\n type: \"geojson\",\n data: data,\n });\n\n AddMapIcon(); // add img to be used as icon for layer\n}", "CreateGeo() {\n // DEBUG: b2.Assert(FrackerSettings.k_dirtProbability +\n // DEBUG: FrackerSettings.k_emptyProbability +\n // DEBUG: FrackerSettings.k_oilProbability +\n // DEBUG: FrackerSettings.k_waterProbability === 100);\n for (let x = 0; x < FrackerSettings.k_worldWidthTiles; x++) {\n for (let y = 0; y < FrackerSettings.k_worldHeightTiles; y++) {\n if (this.GetMaterial(x, y) !== Fracker_Material.EMPTY) {\n continue;\n }\n // Choose a tile at random.\n const chance = Math.random() * 100.0;\n // Create dirt if this is the bottom row or chance dictates it.\n if (chance < FrackerSettings.k_dirtProbability || y === 0) {\n this.CreateDirtBlock(x, y);\n }\n else if (chance < FrackerSettings.k_dirtProbability +\n FrackerSettings.k_emptyProbability) {\n this.SetMaterial(x, y, Fracker_Material.EMPTY);\n }\n else if (chance < FrackerSettings.k_dirtProbability +\n FrackerSettings.k_emptyProbability +\n FrackerSettings.k_oilProbability) {\n this.CreateReservoirBlock(x, y, Fracker_Material.OIL);\n }\n else {\n this.CreateReservoirBlock(x, y, Fracker_Material.WATER);\n }\n }\n }\n }", "function geojsonGen(dataset, style) {\r\n return L.geoJson(dataset, {\r\n style: style\r\n }).addTo(map);\r\n}", "function loadGeoJSON() {\n const geojsonMap = JSON.parse(fs.readFileSync('/Users/hm20160509/codes/1.working/updis/UpdisWeb/tests/data.json'))\n\n const geojson = {\n 'type': 'FeatureCollection',\n 'features': []\n }\n\n for (const layer in geojsonMap) {\n const newFeatures = JSON.parse(JSON.stringify(geojsonMap[layer]['features']))\n _.each(newFeatures, feature => {\n feature['businessType'] = layer\n })\n geojson['features'] = geojson['features'].concat(newFeatures)\n }\n return geojson\n}", "function getMapData() {\n TIME && console.time(\"createMapData\");\n\n const date = new Date();\n const dateString = date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate();\n const license = \"File can be loaded in azgaar.github.io/Fantasy-Map-Generator\";\n const params = [version, license, dateString, seed, graphWidth, graphHeight, mapId].join(\"|\");\n const settings = [\n distanceUnitInput.value,\n distanceScaleInput.value,\n areaUnit.value,\n heightUnit.value,\n heightExponentInput.value,\n temperatureScale.value,\n barSizeInput.value,\n barLabel.value,\n barBackOpacity.value,\n barBackColor.value,\n barPosX.value,\n barPosY.value,\n populationRate,\n urbanization,\n mapSizeOutput.value,\n latitudeOutput.value,\n temperatureEquatorOutput.value,\n temperaturePoleOutput.value,\n precOutput.value,\n JSON.stringify(options),\n mapName.value,\n +hideLabels.checked,\n stylePreset.value,\n +rescaleLabels.checked,\n urbanDensity\n ].join(\"|\");\n const coords = JSON.stringify(mapCoordinates);\n const biomes = [biomesData.color, biomesData.habitability, biomesData.name].join(\"|\");\n const notesData = JSON.stringify(notes);\n const rulersString = rulers.toString();\n const fonts = JSON.stringify(getUsedFonts(svg.node()));\n\n // save svg\n const cloneEl = document.getElementById(\"map\").cloneNode(true);\n\n // reset transform values to default\n cloneEl.setAttribute(\"width\", graphWidth);\n cloneEl.setAttribute(\"height\", graphHeight);\n cloneEl.querySelector(\"#viewbox\").removeAttribute(\"transform\");\n\n cloneEl.querySelector(\"#ruler\").innerHTML = \"\"; // always remove rulers\n\n const serializedSVG = new XMLSerializer().serializeToString(cloneEl);\n\n const {spacing, cellsX, cellsY, boundary, points, features, cellsDesired} = grid;\n const gridGeneral = JSON.stringify({spacing, cellsX, cellsY, boundary, points, features, cellsDesired});\n const packFeatures = JSON.stringify(pack.features);\n const cultures = JSON.stringify(pack.cultures);\n const states = JSON.stringify(pack.states);\n const burgs = JSON.stringify(pack.burgs);\n const religions = JSON.stringify(pack.religions);\n const provinces = JSON.stringify(pack.provinces);\n const rivers = JSON.stringify(pack.rivers);\n const markers = JSON.stringify(pack.markers);\n\n // store name array only if not the same as default\n const defaultNB = Names.getNameBases();\n const namesData = nameBases\n .map((b, i) => {\n const names = defaultNB[i] && defaultNB[i].b === b.b ? \"\" : b.b;\n return `${b.name}|${b.min}|${b.max}|${b.d}|${b.m}|${names}`;\n })\n .join(\"/\");\n\n // round population to save space\n const pop = Array.from(pack.cells.pop).map(p => rn(p, 4));\n\n // data format as below\n const mapData = [\n params,\n settings,\n coords,\n biomes,\n notesData,\n serializedSVG,\n gridGeneral,\n grid.cells.h,\n grid.cells.prec,\n grid.cells.f,\n grid.cells.t,\n grid.cells.temp,\n packFeatures,\n cultures,\n states,\n burgs,\n pack.cells.biome,\n pack.cells.burg,\n pack.cells.conf,\n pack.cells.culture,\n pack.cells.fl,\n pop,\n pack.cells.r,\n pack.cells.road,\n pack.cells.s,\n pack.cells.state,\n pack.cells.religion,\n pack.cells.province,\n pack.cells.crossroad,\n religions,\n provinces,\n namesData,\n rivers,\n rulersString,\n fonts,\n markers\n ].join(\"\\r\\n\");\n TIME && console.timeEnd(\"createMapData\");\n return mapData;\n}", "constructor() {\n this.db = new Dexie('ProjectTrackerDB');\n // This means it creates a projects table with\n // an id primary key and an indexed title column\n this.db.version(1).stores({ \n projects: \"++id,title\",\n nodes: \"++id,projectId\"\n });\n this.db.open().catch(e => {\n console.error(\"Opening the db '\" + this.db.name + \"' failed: \" + e);\n });\n\n this.seedData();\n }", "function getGeoJSON(){\r\n $.getJSON(\"https://\"+cartoDBusername+\".cartodb.com/api/v2/sql?format=GeoJSON&q=\"+sqlQuery, function(data) {\r\n cartoDBPoints = L.geoJson(data,{\r\n pointToLayer: function(feature,latlng){\r\n var marker = L.marker(latlng);\r\n marker.bindPopup('' +'Info: '+ feature.properties.description + '<br>Contact: ' + feature.properties.email + '<br>Date: ' + feature.properties.date +'');\r\n return marker;\r\n }\r\n }).addTo(map);\r\n });\r\n}", "async function initializeDatabase() {\n return new Promise((resolve, reject) => {\n let database = new sqlite3.Database(\"data.sqlite\");\n database.serialize(() => {\n database.run(\"create table if not exists [data] ([council_reference] text primary key, [address] text, [description] text, [info_url] text, [comment_url] text, [date_scraped] text, [date_received] text)\");\n resolve(database);\n });\n });\n}", "function createMap(){\n //create the map\n map = L.map('map', {\n \t//set geographic center\n center: [41.4, -90],\n //set initial zoom level\n zoom: 6,\n });\n\n\n//add OSM base tilelayer\n L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {\n\tattribution: '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a> &copy; <a href=\"http://cartodb.com/attributions\">CartoDB</a>',\n\tsubdomains: 'abcd',\n\tmaxZoom: 8,\n\tminZoom: 6\n}).addTo(map);\n\ngetData(map);\nreturn map;\n}", "function init() {\r\n var vectorsrc = new ol.source.GeoJSON({\r\n projection: 'EPSG:3857',\r\n url: '/data'\r\n });\r\n var vectorLayer = new ol.layer.Vector({\r\n source: vectorsrc\r\n });\r\n map = new ol.Map({\r\n target: 'map',\r\n layers: [\r\n new ol.layer.Tile({\r\n source: new ol.source.OSM()\r\n }),\r\n vectorLayer\r\n ],\r\n view: new ol.View({\r\n center: ol.proj.transform([7.613053321838379, 51.96359873687842], 'EPSG:4326', 'EPSG:3857'),\r\n zoom: 2\r\n })\r\n });\r\n\r\n animiere();\r\n // reload new data every 15 seconds\r\n setInterval(reloadData, 15000);\r\n}", "async function initializeDatabase() {\n return new Promise((resolve, reject) => {\n let database = new sqlite3.Database(\"data.sqlite\");\n database.serialize(() => {\n database.run(\"create table if not exists [data] ([council_reference] text primary key, [address] text, [description] text, [info_url] text, [comment_url] text, [date_scraped] text, [date_received] text, [legal_description] text)\");\n resolve(database);\n });\n });\n}", "function onLoad() {\n // Load map.\n OpenLayers.ProxyHost = '/proxy/';\n map = new OpenLayers.Map('map');\n map.addControl(new OpenLayers.Control.LayerSwitcher());\n\n var layer = new OpenLayers.Layer.WMS('OpenLayers WMS',\n 'http://labs.metacarta.com/wms/vmap0',\n {layers: 'basic'},\n {wrapDateLine: true});\n map.addLayer(layer);\n map.setCenter(new OpenLayers.LonLat(-145, 0), 3);\n\n // Add layer for the buoys.\n buoys = new OpenLayers.Layer.Markers('TAO array');\n map.addLayer(buoys);\n\n // Add buoys. Apparently, dapper always returns the data\n // in the order lon/lat/_id, independently of the projection.\n var url = baseUrl + \".dods?location.lon,location.lat,location._id\";\n jsdap.loadData(url, plotBuoys, '/proxy/');\n\n // Read variables in each location.\n jsdap.loadDataset(baseUrl, loadVariables, '/proxy/');\n}", "function useGeographic() {\n setUserProjection('EPSG:4326');\n}", "function seedDB() {\n // remove seeding\n deleteSeeds();\n // begin seeding\n getCinesphere(0);\n getRegent(0);\n getTiff(0);\n getRoyal(0);\n getParadise(0);\n getRevue(0);\n getHotDocs(0);\n}", "function createMap(){\n\n //create the map\n map = L.map('map', {\n center: [0, 0],\n zoom: 2\n });\n\n //add OSM base tilelayer\n L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap contributors</a>'\n }).addTo(map);\n\n //call getData function\n getData(map);\n}", "async createDb (localConfig = {}) {\n try {\n let { dbName, bchjs } = localConfig\n\n if (!bchjs) {\n throw new Error('Instance of bchjs required when called createDb()')\n }\n\n // By default, use the DB name in the config file.\n if (!dbName) {\n dbName = this.config.orbitDbName\n }\n\n const orbitdb = await this.OrbitDB.createInstance(this.ipfs, {\n // directory: \"./orbitdb/examples/eventlog\",\n directory: './.ipfsdata/p2wdb/dbs/keyvalue',\n AccessControllers: AccessControllers\n })\n\n const options = {\n accessController: {\n type: 'payToWrite',\n write: ['*']\n }\n }\n\n // console.log('dbName: ', dbName)\n\n // Create the key-value store.\n this.db = await orbitdb.keyvalue(dbName, options)\n\n // Overwrite the default bchjs instance used by the pay-to-write access\n // controller.\n this.db.options.accessController.bchjs = bchjs\n this.db.access.bchjs = bchjs\n this.db.access._this = this.db.access\n // console.log('this.db: ', this.db)\n\n console.log('OrbitDB ID: ', this.db.id)\n\n // Load data persisted to the hard drive.\n // await this.db.load()\n this.db.load()\n\n // Signal that the OrbitDB is ready to use.\n this.isReady = true\n\n return this.db\n } catch (err) {\n console.error('Error in createDb(): ', err)\n throw err\n }\n }", "function initDB(){\n const db = new Localbase(\"TracerDB\");\n return db\n}", "function createMap(){\r\n\r\n //create the map\r\n map = L.map('map', {\r\n center: [0, 0],\r\n zoom: 2\r\n });\r\n\r\n //add OSM base tilelayer\r\n L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\r\n attribution: '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap contributors</a>'\r\n }).addTo(map);\r\n\r\n //call getData function\r\n getData(map);\r\n}", "function polygonGeneration() {\n earthquakeLayer = new WorldWind.RenderableLayer(\"Earthquakes\");\n\n for (var i = 0; i < GeoJSON.features.length; i++) {\n // var polygon = new EQPolygon(GeoJSON.features[i].geometry['coordinates']);\n // polygonLayer.addRenderable(polygon.polygon);\n\n // var polygon = new Cylinder(GeoJSON.features[i].geometry['coordinates'], GeoJSON.features[i].properties['mag'] * 5e5);\n // polygonLayer.addRenderable(polygon.cylinder);\n\n var placeMark = new EQPlacemark(GeoJSON.features[i].geometry.coordinates, GeoJSON.features[i].properties.mag);\n earthquakeLayer.addRenderable(placeMark.placemark);\n }\n }", "function getMap() {\n let sourcePath = path.resolve(__dirname, `../data/cntry02.shp`);\n let source = new G.ShapefileFeatureSource(sourcePath);\n let layer = new G.FeatureLayer(source);\n layer.styles.push(new G.FillStyle('#f0f0f0', '#636363', 1));\n let mapEngine = new G.MapEngine(256, 256);\n mapEngine.pushLayer(layer);\n return mapEngine;\n}", "function createMap() {\r\n //create the map\r\n map = L.map(\"mapid\", {\r\n center: [0, 0],\r\n zoom: 2,\r\n });\r\n\r\n //add OSM base tilelayer\r\n L.tileLayer(\"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\", {\r\n attribution:\r\n '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap contributors</a>',\r\n }).addTo(map);\r\n //call getData function\r\n getData(map);\r\n}", "function loadSatellite() {\n\n\tlet httpReq = new XMLHttpRequest();\n\thttpReq.onreadystatechange = function callback_inRoadSatDB() {\n\t\tvar lines = new Array();\n\t\tif (httpReq.readyState == 4 && httpReq.status == 200) {\n\t\t\t// road database\n\t\t\tlines = httpReq.responseText.split(\"\\n\", 50);\n\t\t\tele_line = new Array();\n\t\t\tlines.forEach(function (ele, index, _array) {\n\t\t\t\tele_line = ele.split(\"\\t\", 5);\n\t\t\t\tsatArray[index] = new Satellite(ele_line[0], ele_line[1],\n\t\t\t\t\tele_line[2], ele_line[3]);\n\t\t\t});\n\t\t\tfor (var i = 0; i < satArray.length; i++) {\n\t\t\t\ttrackCoordinatesArray[i] = new Array();\n\t\t\t}\n\t\t\tfor (var i = 0; i < satArray.length; i++) {\n\t\t\t\tsatNo[i] = 0;\n\t\t\t}\n\t\t}\n\t};\n\tmarker_array = new Array();\n\ttrackLineArray = new Array();\n\tconst url =\n\t\t//'http://localhost:8080/tlews/res/satelliteDataBase.txt';\n\t\t'http://127.0.0.1:5501/src/main/webapp/assets/satelliteDataBase.txt';\n\t// 'https://braincopy.org/tle/assets/satelliteDataBase.txt';\n\thttpReq.open(\"GET\", url, true);\n\thttpReq.send(null);\n}", "function buildDatabases() {\n\treturn new Promise((resolve, reject) => {\n\t\tinsertQueries = [];\n\n\t\t//drop tables\n\t\tfor (let map = 0; map < maps.length; map++) {\n\t\t\tconst table = tablenames[map];\n\t\t\tconst primary_key = \"id\" + tablenames[map];\n\t\t\tconst tileWidth = tileWidths[maps[map]];\n\t\t\tconst tile_ids = generateTileIds(tileWidth);\n\t\t\tconsole.log('building tile id length = ' + tile_ids.length);\n\n\t\t\tinsertQueries.push(new Promise((resolve, reject) => {\n\t\t\t\tvar querystring = 'CREATE TABLE IF NOT EXISTS ?? (?? INT NOT NULL AUTO_INCREMENT, ?? INT UNSIGNED NOT NULL, ?? INT UNSIGNED NOT NULL DEFAULT 0, ?? INT UNSIGNED NOT NULL DEFAULT 0, ?? INT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(??));';\n\t\t\t\tconnection.query(querystring, [table, primary_key, tableschema[0], tableschema[1], tableschema[2], tableschema[3], primary_key], (err, result) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.log('error creating table ' + table + ' with err: ' + err);\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\tquerystring = 'INSERT INTO ?? (??) VALUES ?';\n\t\t\t\t\tconnection.query(querystring, [table, tableschema[0], tile_ids], (err, result) => {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tconsole.log('error inserting tile ids into ' + table + ' with err: ' + err);\n\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}));\n\t\t}\n\t\tPromise.all(insertQueries).then(() => {resolve();}).catch((err) => {reject(err);});\n\t});\n}", "function downloadDatabase(){\n let database_json = {};\n dbRef.once(\"value\", (gameBuilder) => {\n const specs = gameBuilder.child('gameSpecs');\n const elements = gameBuilder.child('elements');\n const images = gameBuilder.child('images');\n\n database_json[\"specs\"] = specs.toJSON();\n database_json[\"elements\"] = elements.toJSON();\n database_json[\"images\"] = images.toJSON();\n specs.forEach((spec) =>{\n let json = spec.child('pieces').toJSON();\n if(typeof json == \"string\"){ //it's a badly formatted array!\n let array_obj = JSON.parse(database_json[\"specs\"][spec.key][\"pieces\"]);\n let build = {};\n for(let i = 0; i < array_obj.length; i++){\n build[i] = array_obj[i];\n }\n database_json[\"specs\"][spec.key][\"pieces\"] = build;\n }\n });\n fs.writeFileSync(db_outfile, JSON.stringify(database_json, null, 2));\n console.log(\"Saved JSON to\", db_outfile);\n });\n}", "function prepare_api_url(latitude, longitude){\n var api_key = \"AIzaSyCEPHkBSiLOrKJZ3_K6Ndwi6Ofx_2haTm4\";\n var api_url = \"https://maps.googleapis.com/maps/api/geocode/json?latlng=\";\n return api_url + latitude + ',' + longitude + \"&key=\" + api_key;\n}", "function zipToGeoJson(binZip,options) {\n\tvar manifestZip = xdmp.zipManifest(binZip);\n\tvar items = [];\n\tfor (prop in manifestZip) {\n\t items.push(manifestZip[prop])\n\t}\n\tvar projection = items.filter(function(item) {\n\t return item.path.match(/\\.prj/gi);\n\t}).map(function(item,index) {\n\t return xdmp.zipGet(binZip,item.path,{\"format\":\"text\"});\n\t})[0];\n\tvar objOut = {};\n\titems\n\t .filter(function(item) {\n\t return item.path.match(/\\.shp$/) || item.path.match(/\\.dbf/);\n\t })\n\t .map(function(item) {\n\t var builder = new NodeBuilder();\n\t var tbuilder = new NodeBuilder();\n\n\t //Build a binaryNode \n\t var entry = xdmp.zipGet(binZip,item.path,{\"format\":\"binary\"});\n\t for(e of entry) {\n\t builder.addNode(e);\n\t }\n\t var bin = builder.toNode();\n\t var path = item.path;\n\t var buffer = BinToBuffer(bin);\n\t //Iterate matched items and process file types\n\t switch(true) {\n\t case /\\.dbf$/gi.test(path) :\n\t type = \"dbf\"; \n\t //We need to extract dbf text before we parse dbf\n\t var text = Utf8ArrayToStr(buffer); \n\t objOut.dbf = DBFParser.parse(buffer.buffer,path,text,\"utf-8\");\n\t break;\n\t case /\\.shp$/gi.test(path) : \n\t objOut.shp = SHPParser.parse(buffer.buffer);\n\t break;\n\t default: throw(\"WHY:\" + path)\n\t }\n\t });\n\treturn toGeoJson(objOut);\n}", "function buildStoreOptions(buildData) {\n let store = {\n supplement: buildData.supplement,\n browser: !(typeof window === 'undefined'),\n server: !!(typeof window === 'undefined')\n };\n\n // Get civix\n _.each(buildData, (d, di) => {\n if (di.match(/civix/)) {\n store[di] = d;\n }\n });\n\n // Make parts fo counties\n if (buildData.mnCounties) {\n (store.mnStateGeo = topojsonFeature(\n buildData.mnCounties,\n buildData.mnCounties.objects.state\n ).features),\n (store.mnCountiesGeo = topojsonFeature(\n buildData.mnCounties,\n buildData.mnCounties.objects.counties\n ).features),\n (store.mnCitiesGeo = topojsonFeature(\n buildData.mnCounties,\n buildData.mnCounties.objects.cities\n ).features),\n (store.mnRoadsGeo = topojsonFeature(\n buildData.mnCounties,\n buildData.mnCounties.objects.roads\n ).features);\n }\n\n //console.log(_.keys(store));\n return store;\n}", "function get_geojson(area_id, client) {\n\tconst queries = [\n\t\tnew Query(\n\t\t\t'areas_vw',\n\t\t\t['id', 'name'],\n\t\t\t'id=$1',\n\t\t\t'GeoJSON',\n\t\t\t'en',\n\t\t\ttrue\n\t\t),\n\t\tnew Query(\n\t\t\t'points_of_interest',\n\t\t\t['id', 'area_id', 'name', 'type', 'comments'],\n\t\t\t'area_id=$1',\n\t\t\t'GeoJSON'\n\t\t),\n\t\tnew Query(\n\t\t\t'access_roads',\n\t\t\t['id', 'area_id', 'description'],\n\t\t\t'area_id=$1',\n\t\t\t'GeoJSON'\n\t\t),\n\t\tnew Query(\n\t\t\t'avalanche_paths',\n\t\t\t['id', 'area_id', 'name'],\n\t\t\t'area_id=$1',\n\t\t\t'GeoJSON'\n\t\t),\n\t\tnew JoinQuery(\n\t\t\tnew Query(\n\t\t\t\t'decision_points',\n\t\t\t\t['id', 'name', 'area_id', 'comments'],\n\t\t\t\t'area_id=$1',\n\t\t\t\t'GeoJson',\n\t\t\t\t'en'\n\t\t\t),\n\t\t\tnew Query(\n\t\t\t\t'decision_points_warnings',\n\t\t\t\t['warning', 'type'],\n\t\t\t\t'decision_point_id=$1',\n\t\t\t\t'GeoJson',\n\t\t\t\t'en',\n\t\t\t\tfalse\n\t\t\t),\n\t\t\t'decision_point_id=decision_points.id',\n\t\t\t'decision_points.area_id = $1'\n\t\t),\n\t\tnew Query(\n\t\t\t'zones',\n\t\t\t['id', 'area_id', 'class_code', 'comments'],\n\t\t\t'area_id=$1',\n\t\t\t'GeoJSON',\n\t\t\t'en',\n\t\t\ttrue\n\t\t)\n\t];\n\n\t// {debug} is just a way for me to redirect the output to files\n\tconst debug = true; // TODO set false in production\n\n\tpromiseOfGeoJson(area_id, client, queries)\n\t\t.then(geoJsonDoc => {\n\t\t\tclient.end();\n\t\t\tif (debug) {\n\t\t\t\tconsole.log(JSON.stringify(geoJsonDoc));\n\t\t\t}\n\t\t});\n}", "getGC() {\n return this.$http.get(PATH + \"gc_polygon.topo.json\", {cache: true})\n .then(function(data, status) {\n return topojson.feature(data.data, data.data.objects['dc_polygon.geo']);\n });\n }", "function manipulate () {\n console.log(\"beginning data manipulation\");\n\n var sql = \"alter table carto.bg add column geonum bigint; update carto.bg set geonum = ('1' || geoid)::bigint; alter table carto.bg add column state integer; update carto.bg set state=statefp::integer; alter table carto.bg add column county integer; update carto.bg set county=countyfp::integer; alter table carto.bg rename column name to geoname; alter table carto.bg rename column tractce to tract; alter table carto.bg rename column blkgrpce to bg; alter table carto.bg drop column statefp; alter table carto.bg drop column countyfp; CREATE INDEX carto_bg_geoid ON carto.bg USING btree (geoid); CREATE UNIQUE INDEX carto_bg_geonum_idx ON carto.bg USING btree (geonum); CREATE INDEX carto_bg_state_idx ON carto.bg USING btree (state); CREATE INDEX bg_geom_gist ON carto.bg USING gist (geom);\" +\n\n \"alter table carto.county add column geonum bigint; update carto.county set geonum = ('1' || geoid)::bigint; alter table carto.county rename column name to geoname; alter table carto.county add column state integer; update carto.county set state=statefp::integer; alter table carto.county add column county integer; update carto.county set county=countyfp::integer; alter table carto.county drop column statefp; alter table carto.county drop column countyfp; CREATE INDEX carto_county_geoid ON carto.county USING btree (geoid); CREATE UNIQUE INDEX carto_county_geonum_idx ON carto.county USING btree (geonum); CREATE INDEX carto_county_state_idx ON carto.county USING btree (state); CREATE INDEX county_geom_gist ON carto.county USING gist (geom);\" +\n\n \"alter table carto.place add column geonum bigint; update carto.place set geonum = ('1' || geoid)::bigint; alter table carto.place rename column name to geoname; alter table carto.place add column state integer; update carto.place set state=statefp::integer; alter table carto.place add column place integer; update carto.place set place=placefp::integer; alter table carto.place drop column statefp; alter table carto.place drop column placefp; CREATE INDEX carto_place_geoid ON carto.place USING btree (geoid); CREATE UNIQUE INDEX carto_place_geonum_idx ON carto.place USING btree (geonum); CREATE INDEX carto_place_state_idx ON carto.place USING btree (state); CREATE INDEX place_geom_gist ON carto.place USING gist (geom);\" +\n\n \"alter table carto.state add column geonum bigint; update carto.state set geonum = ('1' || geoid)::bigint; alter table carto.state rename column name to geoname; alter table carto.state add column state integer; update carto.state set state=statefp::integer; alter table carto.state rename column stusps to abbrev; alter table carto.state drop column statefp; CREATE INDEX carto_state_geoid ON carto.state USING btree (geoid); CREATE UNIQUE INDEX carto_state_geonum_idx ON carto.state USING btree (geonum); CREATE INDEX carto_state_state_idx ON carto.state USING btree (state); CREATE INDEX state_geom_gist ON carto.state USING gist (geom);\" +\n\n \"alter table carto.tract add column geonum bigint; update carto.tract set geonum = ('1' || geoid)::bigint; alter table carto.tract rename column name to geoname; alter table carto.tract add column state integer; update carto.tract set state=statefp::integer; alter table carto.tract add column county integer; update carto.tract set county=countyfp::integer; alter table carto.tract rename column tractce to tract; alter table carto.tract drop column statefp; alter table carto.tract drop column countyfp; CREATE INDEX carto_tract_geoid ON carto.tract USING btree (geoid); CREATE UNIQUE INDEX carto_tract_geonum_idx ON carto.tract USING btree (geonum); CREATE INDEX carto_tract_state_idx ON carto.tract USING btree (state); CREATE INDEX tract_geom_gist ON carto.tract USING gist (geom);\" +\n\n \"alter table tiger.county add column geonum bigint; update tiger.county set geonum = ('1' || geoid)::bigint; alter table tiger.county rename column name to geoname; alter table tiger.county add column state integer; update tiger.county set state=statefp::integer; alter table tiger.county add column county integer; update tiger.county set county=countyfp::integer; alter table tiger.county drop column statefp; alter table tiger.county drop column countyfp; CREATE INDEX county_geom_gist ON tiger.county USING gist (geom); CREATE INDEX tiger_county_geoid ON tiger.county USING btree (geoid); CREATE UNIQUE INDEX tiger_county_geonum_idx ON tiger.county USING btree (geonum); CREATE INDEX tiger_county_state_idx ON tiger.county USING btree (state);\" +\n\n \"alter table tiger.place add column geonum bigint; update tiger.place set geonum = ('1' || geoid)::bigint; alter table tiger.place rename column namelsad to geoname; alter table tiger.place rename column name to geoname_simple; alter table tiger.place add column state integer; update tiger.place set state=statefp::integer; alter table tiger.place add column place integer; update tiger.place set place=placefp::integer; alter table tiger.place drop column statefp; alter table tiger.place drop column placefp; CREATE INDEX place_geom_gist ON tiger.place USING gist (geom); CREATE INDEX tiger_place_geoid ON tiger.place USING btree (geoid); CREATE UNIQUE INDEX tiger_place_geonum_idx ON tiger.place USING btree (geonum); CREATE INDEX tiger_place_state_idx ON tiger.place USING btree (state);\" +\n\n \"alter table tiger.state add column geonum bigint; update tiger.state set geonum = ('1' || geoid)::bigint; alter table tiger.state rename column name to geoname; alter table tiger.state add column state integer; update tiger.state set state=statefp::integer; alter table tiger.state rename column stusps to abbrev; CREATE INDEX state_geom_gist ON tiger.state USING gist (geom); CREATE INDEX tiger_state_geoid ON tiger.state USING btree (geoid); CREATE UNIQUE INDEX tiger_state_geonum_idx ON tiger.state USING btree (geonum); CREATE INDEX tiger_state_state_idx ON tiger.state USING btree (state);\" +\n\n \"alter table tiger.tract add column geonum bigint; update tiger.tract set geonum = ('1' || geoid)::bigint; alter table tiger.tract rename column namelsad to geoname; alter table tiger.tract rename column name to simple_name; alter table tiger.tract add column state integer; update tiger.tract set state=statefp::integer; alter table tiger.tract add column county integer; update tiger.tract set county=countyfp::integer; alter table tiger.tract rename column tractce to tract; alter table tiger.tract drop column statefp; alter table tiger.tract drop column countyfp; CREATE INDEX tiger_tract_geoid ON tiger.tract USING btree (geoid); CREATE UNIQUE INDEX tiger_tract_geonum_idx ON tiger.tract USING btree (geonum); CREATE INDEX tiger_tract_state_idx ON tiger.tract USING btree (state); CREATE INDEX tract_geom_gist ON tiger.tract USING gist (geom);\" +\n\n \"alter table tiger.bg add column geonum bigint; update tiger.bg set geonum = ('1' || geoid)::bigint; alter table tiger.bg add column state integer; update tiger.bg set state=statefp::integer; alter table tiger.bg add column county integer; update tiger.bg set county=countyfp::integer; alter table tiger.bg rename column namelsad to geoname; alter table tiger.bg rename column tractce to tract; alter table tiger.bg rename column blkgrpce to bg; alter table tiger.bg drop column statefp; alter table tiger.bg drop column countyfp; CREATE INDEX bg_geom_gist ON tiger.bg USING gist (geom); CREATE INDEX tiger_bg_geoid ON tiger.bg USING btree (geoid); CREATE UNIQUE INDEX tiger_bg_geonum_idx ON tiger.bg USING btree (geonum); CREATE INDEX tiger_bg_state_idx ON tiger.bg USING btree (state);\";\n \n client.connect();\n\n var newquery = client.query(sql);\n\n newquery.on(\"end\", function () {\n client.end();\n console.log(\"end manipulation\");\n cleanup();\n });\n\n\n}", "async function getDataArrond2() {\r\n const response = await fetch(\"php/arrondissements.php\");\r\n const data = await response.json();\r\n\tconst geojson = L.geoJSON(data, \r\n\t\t{style:{\r\n\t\t\tcolor: '#858585'\r\n\t\t},\r\n\t\tonEachFeature: function(feature, layer) {\r\n\t\t\t\tlayer.on({\r\n\t\t\t\t\t'add': function(){\r\n\t\t\t\t\t layer.bringToBack()}})}});\r\n geojson.addTo(map2);\r\n return geojson;\r\n }", "function build(d){\n \tvar tile = d3.select(this);\n\t\tvar url = tileurl(d);\n\t\t_projection = d3.geoMercator();\n\t\t_path = d3.geoPath().projection(_projection);\n\t\t\n\t\tthis._xhr = d3.json(url, function(error, json) {\n\t\t\tif (error) throw error;\n\t\t\t\n\t\t\tvar k = Math.pow(2, d[2]) * 256; // size of the world in pixels\n\t\t\t\n\t\t\t_path.projection()\n\t\t\t\t.translate([k / 2 - d[0] *256, k / 2 - d[1] *256]) // [0°,0°] in pixels\n\t\t\t\t.scale(k / 2 / Math.PI);\n\t\t\t/* TT: WORK IN PROGRESS FOR ALREADY PROJECTED DATA\n\t\t\tfunction matrix(a, b, c, d, tx, ty) {\n\t\t\t return d3.geoTransform({\n\t\t\t\tpoint: function(x, y) {\n\t\t\t\t this.stream.point(a * x + b * y + tx, c * x + d * y + ty);\n\t\t\t\t}\n\t\t\t });\n\t\t\t}\n\t\t\tvar tx = 0; //k / 2 - d[0] *256;\n\t\t\tvar ty = 0 ; //k / 2 - d[0] *256;\n\t\t\t\n\t\t\t\n\t\t\tvar scale = 1/256;\n\t\t\tvar path = d3.geoPath()\n\t\t\t\t.projection(matrix(scale, 0, 0, scale, tx, ty));\n\t\t\t/* END OF WORK IN PROGRESS */\n\t\t\t\n\t\t\tif (json.objects){\n\t\t\t\tvar features = topojson.feature(json,json.objects[layername]).features;\t\n\t\t\t} else if (json.features){\n\t\t\t\tvar features = json.features;\n\t\t\t} else {\n\t\t\t\tthrow \"Can't work with this vectortile data\";\n\t\t\t}\n\t\t\t\n\t\t\tif (typeof _filter === 'function'){\n\t\t\t\tfeatures = features.filter(_filter);\n\t\t\t}\n\t\t\t\n\t\t\tvar entities = tile.selectAll('path').data(features, function(d){\n\t\t\t\treturn d.id;\n\t\t\t});\n\t\t\t\n\t\t\tvar newentity = entities.enter().append('path')\n\t\t\t\t.attr('id',function(d){\n\t\t\t\t\t\treturn 'entity'+ d.properties.id;\n\t\t\t\t})\n\t\t\t\t.attr('class',function(d){return d.properties.kind;})\n\t\t\t\t.attr(\"d\", _path)\n\t\t\t\t.style('pointer-events','visiblepainted');//make clickable;\n\t\t\tnewentity.each(setStyle);\n\t\t\tentities.exit().remove();\n\t\t\t\n\t\t\t// Add events from config\n\t\t\t if (_events){\n\t\t\t\t _events.forEach(function(d){\n\t\t\t\t\t newentity.each(function(){\n\t\t\t\t\t\td3.select(this).on(d.event, d.action);\n\t\t\t\t\t });\n\t\t\t\t });\n\t\t\t }\n\t\t});\n\t\t\n }", "function initMap() {\n //The api is loaded at this step\n //L'api est chargée à cette étape\n\n // add translations\n translate();\n\n var blyr= OpenLayers.Util.getElement('gpChooseBaseLayer');\n blyr.onchange= function() {\n _switchBL(this.options[this.selectedIndex].value);\n };\n\n //options for creating viewer:\n var options= {\n // default value\n // valeur par défaut\n //mode:'normal',\n // default value\n // valeur par défaut\n //territory:'FXX',\n // default value\n // valeur par défaut\n //displayProjection:'IGNF:RGF93G'\n // only usefull when loading external resources\n // utile uniquement pour charger des resources externes */\n proxy:'/geoportail/api/xmlproxy'+'?url='\n };\n\n // viewer creation of type <Geoportal.Viewer>\n // création du visualiseur du type <Geoportal.Viewer>\n // HTML div id, options\n viewer= new Geoportal.Viewer.Default('viewerDiv', OpenLayers.Util.extend(\n options,\n // API keys configuration variable set by\n // <Geoportal.GeoRMHandler.getConfig>\n // variable contenant la configuration des clefs API remplie par\n // <Geoportal.GeoRMHandler.getConfig>\n window.gGEOPORTALRIGHTSMANAGEMENT===undefined? {'apiKey':'nhf8wztv3m9wglcda6n6cbuf'} : gGEOPORTALRIGHTSMANAGEMENT)\n );\n if (!viewer) {\n // problem ...\n OpenLayers.Console.error(OpenLayers.i18n('new.instance.failed'));\n return;\n }\n\n viewer.addGeoportalLayers([\n 'ORTHOIMAGERY.ORTHOPHOTOS',\n 'GEOGRAPHICALGRIDSYSTEMS.MAPS'],\n {});\n // set zoom now to fix baseLayer ...\n viewer.getMap().setCenterAtLonLat(2.5, 46.6, 5);\n // cache la patience - hide loading image\n viewer.div.style[OpenLayers.String.camelize('background-image')]= 'none';\n\n //Ajout d'une couche KML : les frontières pour vérifier les reprojections\n var styles= new OpenLayers.StyleMap(OpenLayers.Feature.Vector.style[\"default\"]);\n var symb= {\n 'Frontière internationale':{strokeColor:'#ffff00', strokeWidth:5},\n 'Limite côtière' :{strokeColor:'#6600ff', strokeWidth:3}\n };\n styles.addUniqueValueRules('default', 'NATURE', symb);\n styles.addUniqueValueRules('select', 'NATURE', symb);\n var borders= viewer.getMap().addLayer(\"KML\",\n {\n 'borders.kml.name':\n {\n 'de':\"Limits\",\n 'en':\"Borders\",\n 'es':\"Límites\",\n 'fr':\"Limites\",\n 'it':\"Limiti\"\n }\n },\n \"../data/FranceBorders.kml\",\n {\n visibility: true,\n styleMap:styles,\n originators:[{\n logo:'ign',\n url:'http://professionnels.ign.fr/ficheProduitCMS.do?idDoc=5323861'\n }],\n minZoomLevel:0,\n maxZoomLevel:11\n }\n );\n\n //Ajout d'une couche WMS compatible Geoportail et Mercator Spherique\n var cadastro= viewer.getMap().addLayer(\"WMS\",\n {\n 'cadastro.layer.name':\n {\n 'de':'Spanisch kataster',\n 'en':'Spanish cadastre',\n 'es':'Cadastro español',\n 'fr':'Cadastre Espagnol',\n 'it':'Spagnolo Catasto'\n }\n },\n \"http://ovc.catastro.meh.es/Cartografia/WMS/ServidorWMS.aspx?\",\n {\n layers:'Catastro',\n format:'image/png',\n transparent:true\n },\n {\n singleTile:false,\n projection: 'EPSG:4326',\n srs:{'EPSG:4326':'EPSG:4326', 'EPSG:3857':'EPSG:3857'},//some supported SRS from capabilities\n // maxExtent expressed in EPSG:4326 :\n maxExtent: new OpenLayers.Bounds(-18.409876,26.275447,5.22598,44.85536),\n minZoomLevel:5,\n maxZoomLevel:15,\n opacity:1.0,\n units:'degrees',\n isBaseLayer: false,\n visibility:false,\n legends:[{\n style:'Default',\n href:'http://ovc.catastro.meh.es/Cartografia/WMS/simbolos.png',\n width:'160',\n height:'500'\n }],\n originators:[\n {\n logo:'catastro.es',\n pictureUrl:'http://www.catastro.meh.es/ayuda/imagenes/escudo.gif',\n url:'http://ovc.catastro.meh.es'\n }\n ]\n });\n\n //Ajout d'une couche WFS : les cours d'eau pour vérifier les reprojections\n var sandre= viewer.getMap().addLayer(\"WFS\",\n {\n 'sandre.layer.name':\n {\n 'de':\"Wasser kurses\",\n 'en':\"Water courses\",\n 'es':\"Cursos de agua\",\n 'fr':\"Cours d'eau\",\n 'it':\"Corsi d'acqua\"\n }\n },\n/* veille version\n \"http://services.sandre.eaufrance.fr/geo/zonage-shp?\",\n */\n/* url de test\n \"http://services.sandre.eaufrance.fr/geotest/mdo_metropole?\",\n */\n/* url sandre\n */\n \"http://services.sandre.eaufrance.fr/geo/mdo_FXX?\",\n {\n/* veille version\n typename: 'RWBODY'\n */\n typename:'MasseDEauRiviere'\n },\n {\n projection:'EPSG:2154',\n units:'m',\n // maxExtent expressed in EPSG:2154 :\n maxExtent: new OpenLayers.Bounds(-58253.71015916939,6031824.7296808595,1181938.177574663,7233428.222339219),\n minZoomLevel:11,\n maxZoomLevel:16,\n /**\n * wfs_options\n * optional: holds information about the wms layer behavior\n * optionnel: contient les informations permettant d'affiner le comportement de la couche wfs\n */\n protocolOptions:{\n featurePrefix:'sa',\n featureNS:'http://xml.sandre.eaufrance.fr/',\n geometryName:'msGeometry'\n },\n originators: [\n {\n logo:'sandre',\n pictureUrl: 'img/logo_sandre.gif',\n url: 'http://sandre.eaufrance.fr'\n }\n ],\n styleMap: new OpenLayers.StyleMap({\n \"default\": new OpenLayers.Style({strokeColor:'#0000ff', strokeWidth:3}),\n \"select\" : new OpenLayers.Style({strokeColor:'#3399ff', strokeWidth:3})\n }),\n hover: false\n });\n\n // See OpenLayers spherical-mercator.html :\n // In order to keep resolutions, projection, numZoomLevels,\n // maxResolution and maxExtent are set for each layer.\n\n // OpenStreetMap tiled layer :\n var osmarender= new OpenLayers.Layer.OSM(\n \"OpenStreetMap (Mapnik)\",\n \"http://tile.openstreetmap.org/${z}/${x}/${y}.png\",\n {\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\n units: \"m\",\n numZoomLevels: 18,\n maxResolution: 156543.0339,\n maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),\n visibility: false,\n originators:[{\n logo:'osm',\n pictureUrl:'http://wiki.openstreetmap.org/Wiki.png',\n url:'http://wiki.openstreetmap.org/wiki/WikiProject_France'\n }]\n });\n viewer.getMap().addLayers([osmarender]);\n}", "function addEarthgeo()\n\t\t\t\t {\n\n\t\t\t\t\tvar newEarth= new THREE.SphereGeometry(75,75,75);\n\t\t\t\t // texture - texture must not be in same folder or there is an error.\n\t\t\t\t\tvar earthTexture = new THREE.ImageUtils.loadTexture( '../wgl3js/models/earthtextminwhole.png', {}, function(){\n\t\t\t\t\tconsole.log(\"Loaded Texture\")\n\t\t\t\t\t},\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\talert('Error Loading Texture')\n\t\t\t\t\t});\n\t\t\t\t\t//newEarth_shaded.material.map.needsUpdate = true;\n\t\t\t\t\t//Create Mesh\n\t\t\t\t\tvar earthmaterial = new THREE.MeshBasicMaterial({ map: earthTexture });\n\t\t\t\t\tvar newEarth_shaded = new THREE.Mesh(newEarth, earthmaterial );\n\t\t\t\t\t//Position Mesh\n\t\t\t\t\tnewEarth_shaded.position.x = 0;\n\t\t\t\t\tnewEarth_shaded.position.y = 0;\n\t\t\t\t\tnewEarth_shaded.position.z = 0;\n\t\t\t\t\t//Add Identifiying Tag\n\t\t\t\t\tnewEarth_shaded.name = \"Earth\";\n\t\t\t\t\t//Add to Scene\n\t\t\t\t\tscene.add(newEarth_shaded);\n\t\t\t\t\taddUSD();\n\t\t\t\t\taddEU();\n\t\t\t\t\taddCHA();\n\t\t\t\t}", "function makeSources(xyz) {\n // https://xyz.api.here.com/hub/spaces/{space}/tile/web/{z}_{x}_{y}\n return xyz.layers.reduce(function (tgSources, xyzLayer, index) {\n var spaceId = xyzLayer.geospace.id;\n var name = getXYZLayerName(xyzLayer, index);\n var access_token = xyz.rot;\n\n tgSources[name] = {\n type: 'GeoJSON',\n url: (\"https://xyz.api.here.com/hub/spaces/\" + spaceId + \"/tile/web/{z}_{x}_{y}\"),\n // url: `https://xyz.api.here.com/hub/spaces/${spaceId}/tile/quadkey/{q}`,\n url_params: {\n access_token: access_token,\n clip: true,\n clientId: 'viewer',\n },\n // max_zoom: 16, // using explicit zoom list below for now instead\n zooms: [0, 2, 4, 6, 8, 10, 12, 14, 16], // load every other zoom\n transform: 'global.add_feature_id' // TODO: remove this when Tangram 0.19 is released (temp solution for 0.18.x)\n };\n\n // add comma-delimited list of tags if available\n if (xyzLayer.meta && Array.isArray(xyzLayer.meta.spaceTags)) {\n tgSources[name].url_params.tags = xyzLayer.meta.spaceTags.join(',');\n }\n\n // add layer bounding box if available (sometimes `bbox` property is an empty array)\n // TODO: ignoring bounds for now, because bbox reported by Studio is sometimes incorrect\n // if (Array.isArray(xyzLayer.bbox) && xyzLayer.bbox.length === 4) {\n // tgSources[name].bounds = xyzLayer.bbox;\n // }\n\n return tgSources;\n }, {});\n }", "function writeToDB() {\n\tvar pos = markerPos(); //return pos of marker in the markers array\n\tvar spawn = require(\"child_process\").spawn; //spawns a childs proc.\n\tvar child = spawn('python',[\"userInterface/py/updateDB.py\", new_lat, new_lng, pos]); //calls a python script with parameters\n}", "function load() {\r\n\r\n\r\n fetch('zooland.json')\r\n .then(function(result){\r\n return result.json();\r\n })\r\n .then(function(data){\r\n createZooland(data);\r\n });\r\n}", "initializeWaterline (router) {\n\n return new Promise( (resolve, reject) => {\n let orm = new Waterline();\n\n let config = {\n\n adapters : {\n 'default' : diskAdapter,\n disk : diskAdapter\n },\n\n connections : {\n myLocalDisk : {\n adapter : 'disk'\n }\n },\n\n defaults : {\n migrate : 'alter'\n }\n };\n\n Object.keys(router.models).forEach(model => {\n orm.loadCollection(router.models[model]);\n });\n\n orm.initialize(config, function (err, models) {\n if (err) {\n reject(err);\n } else {\n Object.keys(models.collections).forEach(key => {\n global[capitalize(key)] = models.collections[key];\n });\n }\n resolve();\n });\n });\n }", "function searchLatToLng(query){\n const geoDataUrl = `https://maps.googleapis.com/maps/api/geocode/json?address=${query}&key=${process.env.GEOCODING_API_KEY}`\n return superagent.get(geoDataUrl)\n\n .then(geoData => {\n console.log('hey from google',geoData)\n\n\n const location = new Location(geoData.body.results[0]);\n let SQL = `INSERT INTO locations (search_query, formatted_query, latitude, longitude) VALUES($1, $2, $3, $4) RETURNING id`;\n\n //STORE IN DATABASE\n return client.query(SQL, [query, location.formatted_query, location.latitude, location.longitude])\n .then((result) =>{\n console.log(result);\n console.log('stored to DB');\n location.id = result.rows[0].id\n // console.log('what', geoData.body.results)\n return location;\n })\n .catch(err => console.error(err))\n // const geoData = require('./data/geo.json');\n })\n}", "export(filename) {\n const entities = Gltf2Exporter.__entityRepository._getEntities();\n const json = {\n \"asset\": {\n \"version\": \"2.0\",\n \"generator\": `Rhodonite (${_VERSION.version})`\n }\n };\n const fileName = filename ? filename : 'Rhodonite_' + (new Date()).getTime();\n json.buffers = [{\n 'uri': fileName + '.bin'\n }];\n json.bufferViews = [];\n json.accessors = [];\n json.materials = [{\n \"pbrMetallicRoughness\": {\n \"baseColorFactor\": [\n 1.0,\n 1.0,\n 1.0,\n 1.0\n ]\n }\n }];\n this.countMeshes(json, entities);\n this.createNodes(json, entities);\n this.createMeshBinaryMetaData(json, entities);\n this.createMeshes(json, entities);\n this.createMaterials(json, entities);\n const arraybuffer = this.createWriteBinary(json, entities);\n this.download(json, fileName, arraybuffer);\n }", "function build() {\n waypoints = [];\n\n for (let row of document.getElementById(\"pointTableBody\").rows) {\n if ((parseFloat(row.cells[0].innerText) || row.cells[0].innerText === '0') && (parseFloat(row.cells[1].innerText) || row.cells[1].innerText === '0')) waypoints.push(new Point(parseFloat(row.cells[0].innerText), parseFloat(row.cells[1].innerText)));\n }\n\n localStorage['way_points'] = waypoints.join(\"*\");\n\n fill();\n\n smooth();\n\n createPath();\n\n return true;\n}", "function initDB()\n{\n if(window.openDatabase) {\n\t\tvar shortName = 'apex_json_files';\n var version = '1.0';\n var displayName = 'JSON Offline Storage';\n var maxSize = 65536; // in bytes\n filesDB = openDatabase(shortName, version, displayName, maxSize);\n \t\tcreateTable();\n\t\t}\n}", "function geoJsonToOutput(geojson) {\n\t// for now, only support one polygon feature at a time\n\tvar geometry = geojson[\"features\"][0][\"geometry\"];\n\tvar coords = geometry[\"coordinates\"][0];\n\t// create the OpenLayers map element\n\t// with GeoJSON object visualized\n\tcreateMap(coords);\n\t// convert object to string and format it nicely for output\n document.getElementById(\"geojson\").innerHTML = JSON.stringify(geojson,null,2);\n // convert object to string without formatting\n document.getElementById(\"geojson_uf\").innerHTML = JSON.stringify(geojson);\n // convert coords to BigQuery format\n // init with prefix\n var bq_string = \"POLYGON((\";\n for (var i=0; i < coords.length; i++) {\n \tvar latlon = coords[i];\n \t// append coord pair\n \tbq_string += latlon[0] + \" \" + latlon[1];\n \tif (i == coords.length - 1) {\n \t\t// don't add comma after last pair\n \t\tbreak;\n \t} else {\n \t\tbq_string += \",\";\n \t}\n }\n // add suffix\n bq_string += \"))\";\n // output string in BigQuery format\n document.getElementById(\"bigquery\").innerHTML = bq_string;\n}", "function buildGeoJSON() {\n var goodGeoJSON = {\n type: 'FeatureCollection',\n features: []\n };\n qData.qMatrix.map(function (array) {\n if (typeof array[1].qNum !== 'number' || typeof array[2].qNum !== 'number') return false;\n var obj = {\n id: Number(array[0].qNum),\n lat: Number(array[1].qNum),\n lng: Number(array[2].qNum)\n };\n obj[property] = array[3].qText;\n var feature = buildFeatureSimplified(obj);\n goodGeoJSON.features.push(feature);\n return obj;\n });\n return goodGeoJSON;\n } // ========================================================", "function generateSchemaOrgGeo (north, east, south, west) {\n if (north === south) {\n return {\n \"@type\": \"GeoCoordinates\",\n \"latitude\" : north,\n \"longitude\" : west\n }\n } else {\n return {\n \"@type\": \"GeoShape\",\n \"box\": west + \", \" + south + \" \" + east + \", \" + north\n }\n }\n}", "function databaseInitialize() {\n zip_content_db = loki_db.getCollection(\"zipInfo\");\n if (zip_content_db === null) {\n zip_content_db = loki_db.addCollection(\"zipInfo\", { indices: ['filePath'] });\n }\n var entryCount = zip_content_db.count();\n console.log(\"[zipInfoDb] number of entries in database : \" + entryCount);\n}", "refreshPBDB() {\n let bounds = this.map.getBounds()\n let zoom = this.map.getZoom()\n // if (zoom < 7) {\n // // Make sure the layer is visible\n // this.map.setLayoutProperty('pbdbCollections', 'visibility', 'visible')\n // // Dirty way of hiding points when zooming out\n // this.map.getSource('pbdb-points').setData({\"type\": \"FeatureCollection\",\"features\": []})\n // // Fetch the summary\n // fetch(`https://dev.macrostrat.org/api/v2/hex-summary?min_lng=${bounds._sw.lng}&min_lat=${bounds._sw.lat}&max_lng=${bounds._ne.lng}&max_lat=${bounds._ne.lat}&zoom=${zoom}`)\n // .then(response => {\n // return response.json()\n // })\n // .then(json => {\n // let currentZoom = parseInt(this.map.getZoom())\n // let mappings = json.success.data\n // if (currentZoom != this.previousZoom) {\n // this.previousZoom = currentZoom\n //\n // this.maxValue = this.resMax[parseInt(this.map.getZoom())]\n //\n // this.updateColors(mappings)\n //\n // } else {\n // this.updateColors(mappings)\n // }\n // })\n // } else {\n // Hide the hexgrids\n //this.map.setLayoutProperty('pbdbCollections', 'visibility', 'none')\n\n // One for time, one for everything else because\n // time filters require a separate request for each filter\n let timeQuery = []\n let queryString = []\n\n if (this.timeFilters.length) {\n this.timeFilters.forEach(f => {\n timeQuery.push( `max_ma=${f[2][2]}`, `min_ma=${f[1][2]}` )\n })\n }\n if (this.lithFilters.length) {\n queryString.push(`lithology=${this.lithFilters.join(',')}`)\n }\n if (this.stratNameFilters.length) {\n queryString.push(`strat=${this.stratNameFilters.join(',')}`)\n }\n\n // Define the pbdb cluster level\n let level = (zoom < 3) ? '&level=2' : '&level=3'\n\n let urls = []\n // Make sure lngs are between -180 and 180\n const lngMin = (bounds._sw.lng < -180) ? -180 : bounds._sw.lng\n const lngMax = (bounds._ne.lng > 180) ? 180 : bounds._ne.lng\n // If more than one time filter is present, multiple requests are needed\n if (this.timeFilters.length && this.timeFilters.length > 1) {\n urls = this.timeFilters.map(f => {\n let url = `${SETTINGS.pbdbDomain}/data1.2/colls/${zoom < maxClusterZoom ? 'summary' : 'list'}.json?lngmin=${lngMin}&lngmax=${lngMax}&latmin=${bounds._sw.lat}&latmax=${bounds._ne.lat}&max_ma=${f[2][2]}&min_ma=${f[1][2]}${zoom < maxClusterZoom ? level : ''}`\n if (queryString.length) {\n url += `&${queryString.join('&')}`\n }\n return url\n })\n } else {\n let url = `${SETTINGS.pbdbDomain}/data1.2/colls/${zoom < maxClusterZoom ? 'summary' : 'list'}.json?lngmin=${lngMin}&lngmax=${lngMax}&latmin=${bounds._sw.lat}&latmax=${bounds._ne.lat}${zoom < maxClusterZoom ? level : ''}`\n if (timeQuery.length) {\n url += `&${timeQuery.join('&')}`\n }\n if (queryString.length) {\n url += `&${queryString.join('&')}`\n }\n urls = [ url ]\n }\n\n // Fetch the data\n Promise.all(urls.map(url =>\n fetch(url).then(response => response.json())\n )).then(responses => {\n // Ignore data that comes with warnings, as it means nothing was\n // found under most conditions\n let data = responses.filter(res => {\n if (!res.warnings) return res\n }).map(res => res.records).reduce((a, b) => { return [...a, ...b] }, [])\n\n this.pbdbPoints = {\n \"type\": \"FeatureCollection\",\n \"features\": data.map((f, i) => {\n // Make sure there aren't nulls for values used for styling\n f.noc = f.noc || 0\n f.nco = f.nco || 0\n return {\n \"type\": \"Feature\",\n \"properties\": f,\n \"id\": i,\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [f.lng, f.lat]\n }\n }\n })\n }\n // Show or hide the proper PBDB layers\n if (zoom < maxClusterZoom) {\n this.map.getSource('pbdb-clusters').setData(this.pbdbPoints)\n this.map.setLayoutProperty('pbdb-clusters', 'visibility', 'visible')\n this.map.setLayoutProperty('pbdb-points-clustered', 'visibility', 'none')\n // this.map.setLayoutProperty('pbdb-point-cluster-count', 'visibility', 'none')\n this.map.setLayoutProperty('pbdb-points', 'visibility', 'none')\n } else {\n this.map.getSource('pbdb-points').setData(this.pbdbPoints)\n\n this.map.getSource('pbdb-clusters').setData(this.pbdbPoints)\n this.map.setLayoutProperty('pbdb-clusters', 'visibility', 'none')\n this.map.setLayoutProperty('pbdb-points-clustered', 'visibility', 'visible')\n // this.map.setLayoutProperty('pbdb-point-cluster-count', 'visibility', 'visible')\n this.map.setLayoutProperty('pbdb-points', 'visibility', 'visible')\n\n }\n\n })\n// }\n }", "function addGeoJSON() {\r\n $.ajax({\r\n url: \"https://potdrive.herokuapp.com/api/map_mobile_data\",\r\n type: \"GET\",\r\n success: function(data) {\r\n window.locations_data = data\r\n console.log(data)\r\n //create markers from data\r\n addMarkers();\r\n //redraw markers whenever map moves\r\n map.on(plugin.google.maps.event.MAP_DRAG_END, addMarkers);\r\n setTimeout(function(){\r\n map.setAllGesturesEnabled(true);\r\n $.mobile.loading('hide');\r\n }, 300);\r\n },\r\n error: function(e) {\r\n console.log(e)\r\n alert('Request for locations failed.')\r\n }\r\n }) \r\n }", "function populateDb() {\n var data = [{ key: \"sample\"\n\t\t, startDate: new Date(\"1/1/2001\")\n\t\t, endDate: new Date(\"1/1/2001\")\n\t\t, city: \"NONE\"\n\t\t, data: {hi: \"mom\"}\n }];\n\n\tcacheDb.collection(COLLECTION_NAME, function(err, collection) {\n\t\tcollection.insert(data, {safe: true}, function(err, result) {});\n\t\tcollection.ensureIndex({key: 1}, {background: true}, function(err, result) {});\n\t});\n}", "function convertBigQuery() {\n\tvar bqstring = document.getElementById(\"bigquery\").textContent;\n\t// get rid of the unimportant BigQuery syntax parts\n\tbqstring = bqstring.replace('POLYGON','').replace('((','').replace('))','');\n\tvar points = bqstring.split(',');\n\tvar coords = [];\n\tfor (var i=0; i < points.length; i++) {\n\t\tvar pair = points[i];\n\t\t// trim any trailing whitespace\n\t\tpair = pair.trim();\n\t\t// separate lon and lat via regexp\n\t\t// split on one (or more) space characters\n\t\tpair = pair.split(/\\s+/);\n\t\tconsole.log()\n\t\tvar lon = parseFloat(pair[0]);\n\t\tvar lat = parseFloat(pair[1]);\n\t\tconsole.log(lon, lat)\n\t\tcoords.push([lon,lat]);\n\t}\n\tvar geojson = {\n\t\t\"type\": \"FeatureCollection\",\n\t\t\"features\": [\n\t\t {\n\t\t\t\t\"type\": \"Feature\",\n\t\t\t\t\"properties\": {},\n\t\t\t\t\"geometry\": {\n\t\t\t\t\t\"type\": \"Polygon\",\n\t\t\t\t\t\"coordinates\": [ coords ]\n\t\t\t\t}\n\t\t }\n\t\t]\n\t};\n\tgeoJsonToOutput(geojson);\n}", "static get DATABASE_URL() {\n\t\tconst port = 1337; // Change this to your server port\n\t\treturn `http://localhost:${port}/restaurants/`;\n\t}", "function execute(db){\n return db.exec(`\n CREATE TABLE IF NOT EXISTS orphanages (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n lat TEXT,\n lng TEXT,\n name TEXT,\n about TEXT,\n wpp TEXT,\n images TEXT,\n instructions TEXT,\n visit_hours TEXT,\n visit_on_weekends TEXT\n );\n `)\n}", "function initFloor(){\n var floor = document.getElementById('floor');\n floor.setAttribute('geometry', {\n height: floor_height,\n width: floor_width\n })\n}", "static get DATABASE_URL() {\r\n const port = 1337; // Change this to your server port\r\n return `http://localhost:${port}/restaurants`;\r\n }", "static get DATABASE_URL() {\n return `./data/quotes.json`;\n }", "async buildSiteData(filepath) {\n // When the config file is a .js file\n // We need to flush cache\n delete require.cache[this.configPath]\n\n if (filepath) {\n const { path: configPath, data } = await config.load(\n [this.configPath],\n this.options.baseDir\n )\n this.configPath = configPath\n await this.normalizeConfig(data)\n }\n\n await fs.ensureDir(this.resolvePecoDir('data'))\n await fs.writeFile(\n this.resolvePecoDir('data/__site_data__.json'),\n JSON.stringify(this.siteData),\n 'utf8'\n )\n }", "function add_busroutes() {\n axios.get(`/busroutes?minx=${minx}&maxx=${maxx}&miny=${miny}&maxy=${maxy}`)\n .then(function (response) {\n load_geojson(response.data, 'busroutes');\n })\n .catch(function (error) {\n console.log(error);\n });\n}", "static get DATABASE_URL() {\r\n const port = 1337; // Change this to your server port\r\n return `http://localhost:${port}/restaurants`;\r\n }" ]
[ "0.6086823", "0.5971749", "0.5591861", "0.5364068", "0.5344317", "0.5341805", "0.52946705", "0.525791", "0.52495766", "0.5244347", "0.52382904", "0.5211483", "0.5194075", "0.51929337", "0.5191231", "0.5182689", "0.5163114", "0.5163105", "0.51567286", "0.5155177", "0.51371336", "0.51347023", "0.51250374", "0.51207125", "0.5102185", "0.50994414", "0.5068453", "0.5061259", "0.5061218", "0.5054214", "0.50513554", "0.50454843", "0.504453", "0.5034027", "0.5022607", "0.50186574", "0.5015812", "0.50095904", "0.50085485", "0.5007766", "0.5007119", "0.50000906", "0.49991423", "0.49825603", "0.4974915", "0.49496856", "0.49347323", "0.49311894", "0.49307168", "0.49230683", "0.49206826", "0.49167526", "0.4912535", "0.4902532", "0.49005166", "0.4890444", "0.4879251", "0.48768964", "0.4870776", "0.48623973", "0.48536804", "0.48403916", "0.48350725", "0.48328638", "0.4827482", "0.48212945", "0.48196223", "0.4818119", "0.48133734", "0.4813316", "0.48116532", "0.4806653", "0.48051596", "0.4803523", "0.47971684", "0.47954276", "0.47881567", "0.47802472", "0.4779543", "0.47780335", "0.47743148", "0.47685215", "0.47671324", "0.47640166", "0.47624558", "0.47461608", "0.47410566", "0.47373015", "0.47342137", "0.4725209", "0.47091064", "0.47072265", "0.47024515", "0.470013", "0.46961042", "0.46953353", "0.4688212", "0.46869358", "0.46853116", "0.46851805" ]
0.74019617
0
function for Opening the form modal
function openForm() { setTimeout(function () { document.querySelector(".bg-modal").style.display = "flex"; }, 250); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showPopupFormular() {\r\n $(\"#\" + global.Element.PopupFormular).modal(\"show\");\r\n }", "function openModalForm(){\n createForm();\n openModalWindow();\n}", "function showPopupElementFormular() {\r\n $(\"#\" + global.Element.PopupElementFormular).modal(\"show\");\r\n }", "function openModal(){\n $(\"#inputModal\").modal('show');\n}", "function showModal() {\n\t\t \tvar action = $(\"#myModal\").attr(\"action\");\n\t\t \n\t\t \tif (action == 'update' || action == 'create') {\n\t\t \t\t$(\"#myModal\").modal(\"show\");\n\t\t \t}\n\t\t \t\n\t\t \tshowContractEndDateSelect();\n\t\t \tshowHidePassword();\n\t\t \tshowHideConfirmPassword();\n\t\t }", "function openNewRatingForm() {\n $('#newRatingModal').modal('show');\n}", "function MUP_Open(){\n //console.log(\" ----- MUP_Open ----\")\n\n // --- show modal\n $(\"#id_mod_upload_permits\").modal({backdrop: true});\n } // MUP_Open", "function openModal() {\n getRecipeDetails();\n handleShow();\n }", "function formModalRelatorio() {\n console.log(\"www\");\n //$('#formModalRelatorio').modal();\n}", "openModal(){\n\n }", "function openModal() { \n modal.style.display = 'block';\n }", "function openSendToModal()\n\t{\n\t\tclearSendto();\n\t\t$(\"#sendto\").modal(\"show\");\n\t\t\n\t}", "function openModal() {\r\n\t\t\tdocument.getElementById('myModal').style.display = \"block\";\r\n\t\t}", "open() {\n this.modal.jQueryModalFade.addClass('modal_fade_trick');\n this.modal.jQueryModalWindow.css('display', 'block');\n this.jQueryName.focus();\n }", "function show_modal() {\n \t$('#promoModal').modal();\n }", "function nuvoInscPreli(){ \n $(\".modal-title\").html(\"Nueva incripción\"); \n $('#formIncPreliminar').modal('show');\n}", "function openModal() {\n modal.style.display = 'block';\n }", "function openModal() {\n modal.style.display = 'block';\n }", "function openSave () {\n $('#saveTemplate').modal('show');\n }", "function openSave () {\n $('#saveTemplate').modal('show');\n }", "function openModal(){\r\n modal.style.display = 'block';\r\n }", "function openModal(e) {\n\tmodal.style.display = 'block'\n}", "function openLoginForm() {\n $('#signInModal').modal('show');\n}", "function __BRE__show_modal(modal_id){$('#'+modal_id).modal('show');}", "function modalSearch(){\n\t$('#lbl_title').text('Search Data Infaq');\n\t$('#m_search').modal('show');\n}", "function runModal() {\r\n $(\"#myModal\").modal(\"show\");\r\n }", "function openModalEdit() {\n modalEdit.style.display = \"block\"\n }", "customShowModalPopup() { \n this.customFormModal = true;\n }", "function openModal() {\n\n\tdocument.querySelector('#idRol').value = \"\";\n\tdocument.querySelector('.modal-header').classList.replace(\"headerUpdate\", \"headerRegister\");\n\tdocument.querySelector('#btnActionForm').classList.replace(\"btn-info\", \"btn-primary\");\n\tdocument.querySelector('#btnText').innerHTML = \"Guardar\";\n\tdocument.querySelector('#titleModal').innerHTML = \"Nuevo Rol\";\n\tdocument.querySelector('#formRol').reset();\n\n\t$('#modalFormRol').modal('show');\n}", "function openModal () {\n modal.style.display = 'block';\n }", "function ShowModalForm(modal_id){\n console.log(modal_id.data);\n var btn = $(this);\n\n $.ajax({\n url: btn.attr(\"data-url\"),\n \n type: 'get',\n\n dataType: 'json',\n\n beforeSend: function () {\n \n $(modal_id.data).modal('show');\n \n },\n\n success: function (data) {\n \n $(modal_id.data + ' .modal-content').html(data.html_form);\n }\n });\n }", "function okOnGet(data, postFun){\r\n $(\"#\"+modal+\" .modal-body\").html(data.content);\r\n registerForm(postFun);\r\n $(\"#\"+modal).modal(\"show\");\r\n //mymodal.open();\r\n }", "function OpenAddProjectModal() {\n ProjectAddEditShowHide(false);\n clearProject();\n $('#addProject').modal('show');\n}", "modalForm(){\n\t\t// let's prepare our data\n let specs= this.getSpecs;\n\t\t// (I hate using only letters as variables but let's break the rules for once ! it won't hurt ;) ) \n let l=specs.length;\n let values= this.getValues;\n let t_list = this.getToggles; \n\t\t// in case we actualy have nothing! let's give the modal nothing as in \"\" to loop over it (:))\n if(values == null) values = specs.map( spec => \"\");\n\t\t// this is the form var \n let newForm = '<form id=\"modalForm\" \">';\n\t\t// and here we loop over all the inputs \n for(let i=0; i<l;i++){\n\t\t\t\t// if have a toggle \n if(t_list.indexOf(specs[i])!= -1){ \n\t\t\t\t\t\t// then let's display a toggle \n newForm += '<label>'+specs[i]+'</label><br>';\n \n newForm += '<label class=\"switch\"><input type=\"checkbox\" id=\"chk\" onclick=\"toggleCheck()\" value=\"positive\" checked>';\n newForm += '<span class=\"slider round\"></span></label>';\n }else \n newForm += '<label for=\"'+specs[i]+'\">'+specs[i]+'</label><input type=\"text\" value=\"'+values[i]+'\"><br>';\n\n }\n\t\t// here we close the form and return it \n newForm += '</form>';\n return newForm; \n}", "function openModal(myModal) {\n myModal.style.display = \"block\";\n }", "function openModal() {\n setOpen(true);\n }", "function openFormEditKienNghi() {\n showLoadingOverlay(modalIdKienNghi + \" .modal-content\");\n $.ajax({\n type: \"GET\",\n url: editKienNghiUrl,\n data: {\n id: HoSoVuAnID\n },\n success: function (response) {\n $(modalIdKienNghi + \" .modal-content\").html(response);\n\n hideLoadingOverlay(modalIdKienNghi + \" .modal-content\");\n }\n });\n }", "function openModal(){\n\n\tdocument.querySelector('#idUsuario').value =\"\";// el id del input en modalUsuarios y le enviamos un valor vacio\n\tdocument.querySelector('.modal-header').classList.replace(\"headerUpdate\", \"headerRegister\"); //nos dirigimos al elemento con queryselect, con classlist reemplazamos las clases\n\tdocument.querySelector('#btnActionForm').classList.replace(\"btn-info\", \"btn-primary\"); //reemplazamos las clases de los botones\t\n\tdocument.querySelector('#btnText').innerHTML =\"Guardar\";//nos referimos al btntext del id del spam\n\tdocument.querySelector('#titleModal').innerHTML =\"Nuevo Usuario\";//Nos referimos al titulo con innerhtml nuevo Usuario\n\tdocument.querySelector('#formUsuario').reset();//limpiar todos los campos con reset del formulario usuario\n\n\n $('#modalFormUsuario').modal('show'); //muestra el modal con el id \"modalformusuario\"\n }", "function AbrirModalnuevo(){\n $(\"#nuevo\").modal('show');\n}", "function modalCheque()\n{\n $('#agregar_cheque').modal('show');\n}", "function showModal() {\n $(\"#exampleModal\").modal();\n }", "function open() {\n openModal($scope.selectedTaskId, $scope.selectedUserName);\n }", "function OpenNewbussinesstripModal() {\n\n NewbussinesstripAddEditShowHide(false);\n clearNewbussinesstrip();\n $('#NewbussinesstripModal').modal('show');\n}", "function showModal() {\n setVisible(true);\n setSignUp(false);\n }", "function openModal(){\n modal.style.display = 'block';\n }", "function openModal(){\r\n modal.style.display = 'block';\r\n}", "function openContactForm() {\n var contactForm = document.getElementById(\"myModal\")\n contactForm.style.display = \"block\";\n}", "function orderCancleButtonClick() {\n $('#orderCancleModal').modal('show');\n}", "function openModal(){\n\t\n\tmodal.style.display = 'block';\n\t\n}", "function show_addprogram() {\n $('#addprogram').modal('show')\n}", "function openModal(){\r\n modal.style.display = 'block';\r\n}", "function openModal() {\nelModal.style.display = 'block';\n}", "function openModal() {\n document.getElementById(\"myModal\").style.display = \"block\";\n }", "function show_modal() \n{\n $('#myModal').modal();\n}", "function showModal() {\n\tvar btnShowModal = $('.button-show-modal');\n\tif (btnShowModal.length > 0) {\n\t\tbtnShowModal.bind('click', function(e) {\n\t\t\te.preventDefault();\n\t\t\tvar modalTarget = $(this).data('target-modal');\n\t\t\tvar package = $(this).data('option');\n\n\t\t\tif (modalTarget.length > 0) {\n\t\t\t\t$(modalTarget).addClass('show');\n\n\t\t\t\tif ($(modalTarget).hasClass('show')) {\n\t\t\t\t\tchangeValueOptionInForm(package);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function modalFormSK(){\n\n clearFormSK();\n\n $('#modal_data_sk').modal('show');\n\n $('#modal_data_sk').on('shown.bs.modal', function() {\n\n $(\"#txt_sktugas_no\").focus();\n })\n}", "function openSignIn() {\n $(\"#signin\").modal('open');\n }", "openAddModal(){\n document.getElementById(\"add_modal\").style.display = \"block\";\n }", "openCateringModal() {\n console.log('Open Catering Modal');\n }", "openCateringModal() {\n console.log('Open Catering Modal');\n }", "function modalPpmp(thisInput) {\n\n $('#modal-pr-ppmp').modal('show');\n}", "function openModal() {\r\n\tmodal.style.display = 'block';\r\n}", "function openModal() {\r\n modal.style.display = 'block';\r\n}", "openEditModal(){\n $('#detailComicModal').closeModal();\n $('#editComicModal').openModal();\n }", "function openMoadal(e){\n console.log(e);\n modal.style.display = 'block';\n \n}", "function AbrirModalConsulta(){\n $(\"#modal_consultas\").modal({ backdrop: 'static', keyboard: false })\n $(\"#modal_consultas\").modal('show');\n listar_consulta_historial() ;\n}", "function openModal() {\r\n modal.style.display = \"block\";\r\n}", "function ouvrir() {\n creationModal();\n }", "function openModal() {\n document.getElementById('myModal').style.display = \"block\";\n }", "function openModal(modal) {\n \n modal[0].style.display = \"block\";\n}", "openRecurrenceModal() {\n console.log('Open Recurrence Modal');\n }", "openRecurrenceModal() {\n console.log('Open Recurrence Modal');\n }", "function mostrarModalContacto(idAgencia){\n $('#modalAddContact').modal('show');\n $('#addContactoIdAgencia').val(idAgencia);\n}", "function openNewRankTaskModal() {\n newRankTaskModal.style.display = \"block\";\n }", "function openAddPromoModal(id) {\n\t$('#serviceId').val(id);\n\taddModal.style.display = \"block\";\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = \"block\";\n}", "showInvoiceModal(){\n $(\"#receipt-dt-modal\").modal('show');\n }", "function loadSubmitForm() {\n $(\".modal\").css(\"display\", \"block\");\n}", "function openModal() {\n document.getElementById(\"myModal\").style.display = \"inline-grid\";\n document.getElementById(\"return-to-top\").style.display = \"none\"\n document.getElementById(\"return-to-top\").style.property=\"value\"\n }", "function help_add() {\n\n $('#help_add').modal('show');\n}", "function launchModal2() {\n $('#inviteModal').modal();\n}", "function modalOpen() {\n modal.style.display = 'block';\n}", "function showBOMFormDialog() {\n\tdocument.getElementById('myModal').style.display = \"block\";\n $(\"body\").addClass('sidebar-collapse').trigger('collapsed.pushMenu');\n\n}", "showModal() {\n $('.modal').modal('show');\n }", "function openModal(){\n modal.style.display = 'block'; \n}", "function openModal(){\n modal.style.display = 'block';\n}", "function openModal () {\n modal.style.display = 'block'\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal(){\n modal.style.display = 'block';\n}", "function openModalRol() {\n\n document.querySelector('#idRol').value = \"\";\n document.querySelector('.modal-header').classList.replace(\"headerUpdate\", \"headerRegister\");\n document.querySelector('#btnActionForm').classList.replace(\"btn-info\", \"btn-primary\");\n document.querySelector('#btnText').innerHTML = \"Guardar\";\n document.querySelector('#titleModal').innerHTML = \"Nuevo Rol\";\n document.querySelector('#formRol').reset();\n $('#btnActionForm').attr('style', 'background: #009688; border-color: none;');\n // $(\"#txtIdRol\").prop('disabled', false);\n $('#modalFormRol').modal('show');\n}", "function toggleModal() {\n\n let form = document.getElementById('editModal');\n if (form.style.display === 'none') form.style.display = 'block';\n else form.style.display = 'none';\n}", "function openModal() {\n modal.style.display = \"block\";\n}", "function editar() {\n\n\t$('#mdlAgendamento').modal('toggle');\n\t$('#mdlVerAgendamento').modal('hide');\n\n}", "function openContactDetails() {\n\t\tconst contactId = Number(this.id);\n\t\tupdateContactDetails(contactId);\n\t\tmodal.style.display = \"block\";\n\t}", "function openNewProduct(){\n cleanProduct();\n $(\"#check-container\").css('display', 'inline');\n $(\"#modal-product\").modal();\n $(\"#btn-save\").attr(\"onclick\",\"saveProduct()\");\n}" ]
[ "0.8050791", "0.8043072", "0.7801808", "0.76161504", "0.7606348", "0.76003146", "0.7569609", "0.7417896", "0.7369556", "0.72558624", "0.72436935", "0.72137374", "0.7212796", "0.7200347", "0.71990985", "0.7193316", "0.71826047", "0.71826047", "0.7181887", "0.7181887", "0.71778953", "0.71765405", "0.7163069", "0.7154848", "0.71182317", "0.71045625", "0.7092058", "0.708965", "0.70711625", "0.70709807", "0.70526606", "0.70377403", "0.702806", "0.70265424", "0.7026199", "0.7021512", "0.7013604", "0.70117474", "0.7011259", "0.7007866", "0.7002656", "0.70007", "0.69854677", "0.6982682", "0.69801015", "0.69771045", "0.6968766", "0.6960245", "0.6959939", "0.6958015", "0.69576377", "0.6946554", "0.6938749", "0.69355404", "0.6934776", "0.6925693", "0.69205004", "0.691704", "0.69115096", "0.69115096", "0.69097507", "0.6900875", "0.68873495", "0.686808", "0.6865104", "0.68601173", "0.68591017", "0.6827191", "0.6826159", "0.6825796", "0.6815518", "0.6815518", "0.6813657", "0.68090546", "0.679674", "0.6784235", "0.6784235", "0.6784235", "0.6784235", "0.6784235", "0.67761284", "0.67761105", "0.67664427", "0.67628145", "0.67608273", "0.675637", "0.6753986", "0.6753241", "0.6749976", "0.67477745", "0.6742763", "0.6738797", "0.6737592", "0.6737592", "0.67286265", "0.6720623", "0.6718684", "0.671782", "0.67167675", "0.67092234", "0.6708622" ]
0.0
-1
function for closing the form modal
function closeForm() { setTimeout(function () { document.querySelector(".bg-modal").style.display = "none"; }, 250); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function close() {\n $modalInstance.dismiss();\n }", "function closeModal() {\n clearForm();\n props.onChangeModalState();\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "onSubmit() {\n this.activeModal.close(1);\n }", "function closeModal () {\n modal.style.display = 'none'\n modal.setAttribute('aria-hidden', 'true')\n wrapper[0].setAttribute('aria-hidden', 'false')\n cleanform()\n}", "closeModal() {\n this.close();\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "closeModal() {\n var modal = document.getElementById('formModal');\n modal.style.display = 'none';\n document.getElementById('articleFormTitle').value = '';\n document.getElementById('articleFormContent').value = '';\n }", "closemodal() {\n this.modalCtr.dismiss();\n }", "function onCancelButtonClick() {\n modal.close();\n }", "function onCancelButtonClick() {\n modal.close();\n }", "function modalClose() {\t\t\n\t\tif($('mb_Title')) $('mb_Title').remove();\n\t\tif($('mb_Error')) $('mb_Error').remove();\n\t\tif($('mb_header')) $('mb_header').removeClass('yt-Panel-Primary');\n\n\t\t$('mb_center').style.display = 'none';\n\t\t\n\t\t$('mb_contents').getChildren()[0].remove();\n\t\t$('mb_overlay').setStyle('opacity',0);\n\t\t$('mb_frame').setStyle('opacity',0);\n\t\twindow.location.reload(true); \n}", "function closeModal() {\n \tMODAL.style.display = 'none';\n \tRESET();\n }", "closeModal() {\n this.closeModal();\n }", "function closeModal(){\r\n modal.style.display = 'none';\r\n }", "function closeForm() {\n $('.add-parent-popup').hide();\n $('.overlay').hide();\n clearFields();\n $('#pin-message').hide();\n}", "function closePopup() {\n $modalInstance.dismiss();\n }", "function closeModal () {\n modal.style.display = 'none';\n }", "function closeCreatePollModal() {\n \n var backdropElem = document.getElementById('modal-backdrop');\n var createPollElem = document.getElementById('create-poll-modal');\n\n // Hide the modal and its backdrop.\n backdropElem.classList.add('hidden');\n createPollElem.classList.add('hidden');\n \n //clearInputValues();\n}", "function closeModal() {\n\t\n\tmodal.style.display = 'none';\n}", "function closeModal(){\n\t$(\"#myModal\").hide();\n\tcurrPokeID = null;\n}", "close() {\n this.modal.dismiss();\n }", "function closeModal() {\n modalbg.style.display = 'none'; //modalbg: name previously given to the form container (see DOM elements)\n myForm.style.display = \"block\";\n document.getElementById(\"confirmation\").style.display = \"none\";\n}", "function closeModal() {\n\tmodal.style.display = 'none'\n}", "function closeModal(modal) {\n\tmodal.style.display = \"none\";\n}", "function closeModal() {\r\n modal.style.display = 'none';\r\n resetInfo();\r\n}", "function closeModal(){\n modal.style.display = 'none';\n }", "function closeModalEdit(){\n modalEdit.style.display = \"none\"\n modalFormEdit.reset()\n }", "function closeModalForm(event) {\n if (modalBackground == event.target ||\n dismissButton == event.target) {\n modalBackground.classList.remove('fadeIn');\n modalBackground.classList.add('fadeOut');\n } else { return; };\n }", "function modelClose() {\n $( \".btn-close\" ).click(function() {\n $('#disclaimerModal').hide();\n $('body').removeClass('modal-open');\n });\n}", "function closeModal() {\n var content = $('.modal-content');\n var modal = $('#applicant-modal');\n var form = $('#add-app-form');\n modal.hide();\n form.hide();\n content.find('p').remove();\n content.find('td').remove();\n $('#applicant-table').hide();\n}", "function closeModal() {\n if(clickOut == false){\n return\n }\n $('.text_box').css('font-size','25px')\n $('.modal').css('display','none')\n $('.text_box').toggleClass('result')\n $('.text_box').empty()\n clickCounter++\n if(clickCounter == 25){\n endStage()\n }\n clickOut = false\n }", "function closeModal() {\n\t//reset all the input text\n\tdocument.getElementById(\"post-text-input\").value = \"\";\n\tdocument.getElementById(\"post-photo-input\").value = \"\";\n\tdocument.getElementById(\"post-price-input\").value = \"\";\n\tdocument.getElementById(\"post-city-input\").value = \"\";\n\tdocument.getElementById(\"post-condition-new\").checked = true;\n\t//add div to hidden\n\tdocument.getElementById(\"sell-something-modal\").classList.add('hidden');\n\tdocument.getElementById(\"modal-backdrop\").classList.add('hidden');\n}", "function closeModal(){\r\n modal.style.display = 'none';\r\n}", "closemodal() {\n this.modalCtr.dismiss(this.items);\n }", "function closeModal(modal) {\n modal.modal('hide');\n}", "function closeModal() {\r\n modal.style.display = 'none';\r\n}", "function closeForm(){\n document.getElementsByClassName('container-toDO')[0].style.display = 'block';\n let PopUp = document.getElementsByClassName('pop-up')[0];\n PopUp.classList.add('hides');\n document.getElementById(\"myForm\").style.display = \"none\";\n }", "function MUPS_MessageClose() {\n console.log(\" --- MUPS_MessageClose --- \");\n\n $(\"#id_mod_userallowedsection\").modal(\"hide\");\n } // MUPS_MessageClose", "function closeModal() {\n $('#modal, #modal .wrap-modal').hide();\n $('.videomodal .videoresponsive, .imagemodal .label-imagemodal').empty();\n fechaMask();\n}", "function closeSignupAdminModal() {\n parentModalSignupAdmin.style.display = 'none';\n}", "function CloseModul() {\n document.getElementById(\"modal_del_user\").style.display = \"none\";\n window.location=window.location;\n}", "function closeModal() {\r\n modal.style.display = \"none\";\r\n}", "function close() {\n $mdDialog.hide();\n }", "'click .close' (event) {\n console.log(\"MODAL CLOSED VIA X\");\n modal.hide();\n }", "function FormExit(form, title, message, btn) {\n\tvar isEdit = false;\n\t$(\"input,select,textarea\").parents(form).change(function() {isEdit = true;});\n\t$(\"a[href][target!='_blank'][data-toggle!='tab'][data-toggle!='dropdown']\").not(\"[data-dismiss]\").click(function (event) {\n\t\tif(isEdit) {\n\t\t\tevent.preventDefault();\n\t\t\t\n\t\t\t$(\"body\").append(\"<div id='FormExitModal' class='modal fade'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button><h3>\" + title + \"</h3></div><div class='modal-body'>\" + message + \"</div><div class='modal-footer'><a class='btn btn-primary' data-dismiss='modal'>\" + btn.cancel + \"</a><a href='\" + event.target.href + \"' class='btn btn-danger'>\" + btn.exit + \"</a></div></div></div></div>\");\n\n\t\t\t$(\"#FormExitModal\").modal();\n\t\t}\n\t});\n}", "function closeModal(e) {\n document.getElementById(\"myModal\").style.display = \"none\";\n}", "function closeModal() {\n\tdocument.getElementById('myModal').style.display = \"none\";\n }", "function closeModal() {\n\tdocument.getElementById('myModal').style.display = \"none\";\n }", "function closeModal () {\n //chnge the display value to none\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal3.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "handleModalClose() {}", "close() {\n super.close();\n this._popupForm.reset();\n }", "function closeModal(){\n modal.style.display = 'none'; \n}", "function closeIt() {\n\tdocument.getElementById('modal').style.display = \"none\";\n}", "function closeModal3() {\n modal3.style.display = 'none';\n }", "function closeModal3() {\n modal3.style.display = 'none';\n }", "function closeMe() {\n\t\t $('#' + settings.id).modal('hide');\n\t\t if (settings.isSubModal)\n\t\t $('body').addClass('modal-open');\n\t\t }", "function closeRuleModal () {\n rulesModalContainer.style.display = 'none'\n welcomeDiv.style.display = 'block'\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeCreatePostModal() {\r\n\t\r\n\tvar modalBackdrop = document.getElementById('modal-backdrop');\r\n\tvar createPostModal = document.getElementById('create-post-modal');\r\n\r\n\tmodalBackdrop.classList.add('hidden');\r\n\tcreatePostModal.classList.add('hidden');\r\n\r\n\t// This function is defined below\r\n\tclearPostInputValues();\r\n}", "function closeModal(){\n modal.style.display = \"none\";\n resetModal();\n customSelected = 0;\n window.location.hash= 'top';\n}", "function cerrar() {\n\n modal.style.display = \"none\";\n}", "function closeModal3()\n{\n modal3.style.display = \"none\";\n}", "function closeModal () {\n modal.style.display = 'none'\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal3(){\n modal3.style.display = 'none';\n}", "function closeModal()\r\n {\r\n windows.close($('#modalContainer .window').attr('id'));\r\n }", "function handleClose() {\n setOpenModalId(0);\n }", "function closeModal()\n\n{\n Modal.style.display = \"none\";\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal(){\n modal.style.display = \"none\";\n}", "function closeModal(){\n modal.style.display = \"none\";\n}", "function closeForm() {\r\n document.getElementById(\"popupForm\").style.display = \"none\";\r\n document.getElementById(\"taForm\").style.display = \"none\";\r\n document.getElementById(\"anmtForm\").style.display = \"none\";\r\n}", "close() {\n this.closeButton.on('click', null);\n this.modal(false);\n this.window.remove();\n }", "function closeModal(modalID) {\n\t$(\"#\"+modalID).modal ('hide'); \n}", "modalCancel(){\n\t\t// save nothing\n this.setValues = null;\n\t\t// and exit \n this.modalEXit();\n }", "function closeTrasanoModal() {\r\n $('#trasanoMODAL').modal('hide');\r\n window.location.reload();\r\n}", "function cerrarModal(){\n\t$(\"#myModal\").collapse('hide');\n}", "function closeImageModal() {\n image_modal.close();\n }", "function closeModal() {\n const modal = $(\"#ytbsp-modal\");\n if (0 !== modal.length) {\n modal.css(\"display\", \"none\");\n modal.css(\"opacity\", \"0\");\n }\n}", "function clearForm (event) {\n $(\"#name\").val(\"\");\n $(\"#email\").val(\"\");\n $(\"#company\").val(\"\");\n $(\"#message\").val(\"\");\n\n // Alert submission received with a modal\n // When the user clicks the button, open the modal\n // Get the <span> element that closes the modal\n var modal = $('#myModal2');\n var span = $(\".close2\")[0];\n modal.css(\"display\", \"block\");\n\n // When the user clicks on <span> (x), close the modal\n span.onclick = function () {\n modal.css(\"display\", \"none\");\n }\n\n // When the user clicks anywhere outside of the modal, close it\n window.onclick = function (event) {\n if (event.target == modal) {\n modal.css(\"display\", \"none\");\n }\n }\n}" ]
[ "0.82786494", "0.80185705", "0.7909187", "0.7909187", "0.7909187", "0.7791786", "0.7750621", "0.7714938", "0.7652777", "0.76196045", "0.76196045", "0.76196045", "0.7617899", "0.76046133", "0.75742334", "0.75723326", "0.75723326", "0.75659204", "0.7557311", "0.7546813", "0.7532373", "0.7519926", "0.7489742", "0.7483116", "0.7442608", "0.74178195", "0.741486", "0.74038213", "0.74028194", "0.7395846", "0.7393778", "0.73937106", "0.7390015", "0.7389198", "0.7369515", "0.7356479", "0.733969", "0.7337322", "0.7333076", "0.7329631", "0.73202395", "0.73198557", "0.73070943", "0.72952783", "0.72839946", "0.72817236", "0.72790354", "0.72790295", "0.72773945", "0.726423", "0.7263146", "0.7247639", "0.7240861", "0.7231135", "0.7231135", "0.7225968", "0.72179234", "0.72179234", "0.72179234", "0.72179234", "0.7211794", "0.72051525", "0.72051525", "0.71983874", "0.71983874", "0.7194897", "0.71943223", "0.7191663", "0.71913075", "0.71888727", "0.71888727", "0.71790975", "0.7175872", "0.71758074", "0.71758074", "0.71758074", "0.71734786", "0.71726495", "0.7171273", "0.7168541", "0.7166435", "0.7163412", "0.7162705", "0.7159278", "0.7153998", "0.7152776", "0.71507746", "0.71507746", "0.71507746", "0.7148257", "0.7148257", "0.71464103", "0.7141146", "0.71360004", "0.7133622", "0.7120013", "0.7119256", "0.7110498", "0.71101445", "0.7104084" ]
0.7162215
83
there are 3 patterns to deal with aynchronous code: callbacks, prmoise, async/await
function getUser(id) { setTimeout(() => { console.log('Reading a user from database...'); return { id: id, gitHubUsername: 'Nilank Nikhil' }; }, 2000); return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function someAsyncApiCall(callback) { callback(); }", "function async_io_normal(cb) {\n\n}", "async function helloCatAsync(callback) {\n console.log(\"2. callback here is the function passed as argument above...\")\n // 3. Start async operation:\n setTimeout(function () {\n console.log(\"3. start async operation...\");\n console.log(\"4. finished async operation, calling the callback, passing the result...\");\n // 4. Finished async operation,\n // call the callback passing the result as argument\n await callback('Nya');\n }, Math.random() * 2000);\n}", "async method(){}", "async function asyncWrapperFunction() {\r\n await htmlRouting();\r\n await videoRouting();\r\n const data = await dataProcessing();\r\n const nodes = await nodesGetting();\r\n dynamic(data,nodes);\r\n display(data,nodes);\r\n}", "async function MyAsyncFn () {}", "async function test() {}", "async function doSomething() {\n // resolve is callback function\n //reject is a callback\n\n logger.log('2: function is called');\n return new Promise((resolve, reject) => {\n\n\n // read from the database.. example\n // the following timeout function is asynchronus block of code\n setTimeout(function () {\n // anonymous function that simulates reading from the database\n resolve(\"3:reading from the database\")\n\n\n // error scenarios\n // var error= new Error(\" connection failed with the database\")\n // reject(error);\n }, 3000);\n });\n\n\n\n}", "function someAsyncApiCall(callback) {\n // callback()\n process.nextTick(callback)\n}", "async function miFuncionConPromesa ()\r\n{\r\n return 'saludos con promesa y async';\r\n}", "AsyncProcessResponse() {\n\n }", "async function asyncFn(){\n\n return 1;\n}", "async function miFuncionConPromesa(){\n return \"Saludos con promeso y async\";\n}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "async function doWork() {\n const response = await makeRequest('osu');\n console.log('response received')\n const finalResponse = await addSomething(response);\n console.log(finalResponse);\n\n}", "async function fn(){ //This is the newer way of doing an async function\n return 'hello';\n}", "async function myFn() {\n // wait\n}", "async function ej3() {\n var res = await prom();\n console.log(res);\n}", "async runTest() {}", "static async method(){}", "AsyncCode()\n {\n\n }", "async function doWork() {\n // use try catch to handle any errors with the promise\n try {\n // await says that the code should wait for this code to finish before executing the next thing\n const response = await makeRequest('Google')\n console.log('Response received')\n const processedResponse = await makeRequest(response)\n console.log(processedResponse)\n // catch will be used if promise rejects instead of resolves\n } catch(err) {\n console.log(err)\n }\n}", "async function dowork() {\n try {\n const response = await makeReques('Google');\n console.log('response received');\n const processingResponse = await processRequest(response);\n console.log(processingResponse);\n\n }\n catch (err) {\n console.log(err);\n }\n}", "async onFinished() {}", "function fetchAsync(callback) {\n setTimeout(() => {\n callback({ hello: \"world\" });\n }, 1000);\n }", "async function f(){\n return something\n}", "async function updateTheUserTwiceProd() {\n\n let userEmail = await getEmailFromDb('admin')\n let updateWorked = await updateUserBasedOnEmail(userEmail)\n updateWorked = await updateUserBasedOnEmail(userEmail)\n //await myBusinessLogic(username)\n\n // do some stuff\n\n return 'aukfhuseifh'\n}", "function callback(){}", "async function miAsyncFunction()\n{\n try \n { //Esto de acá sería como el then de la async function miAsyncFunction() \n const promesa = await miPromesa; //espera el resultado de la promesa satisfecha (resolved)\n console.log(`Este es el valor de la promesa ${promesa}`);\n } //Esto de acá sería como el catch de la async function miAsyncFunction() \n catch (error) {\n console.log(\"La pecheaste\"); \n }\n}", "async function main() {\n // create the promises first\n var call1 = myApiClient(1)\n var call2 = myApiClient(2)\n\n // then wait for them\n var response1 = await call1\n var response2 = await call2\n\n // do something with the responses\n var message = response1['message'] + ' ' + response2['message']\n console.log(message)\n}", "function getUserFromDatabase(callbackFunction) {\n // does some async processing\n callbackFunction('Brad Stell')\n}", "async function executar(){\n await esperarPor(2000)\n console.log('Async 1');\n\n await esperarPor(2000)\n console.log('Async 2');\n\n await esperarPor(2000)\n console.log('Async 3');\n\n}", "async function main() {\n try {\n var id_data = await get_changed_ids_prices();\n console.log(id_data);\n //use the chained async functions to get the data to update\n //wait for it to complete\n await update_prices(id_data);\n //update the database, wait for it to complete\n db.close();\n }\n catch (e) {\n console.log(\"error\");\n console.log(e);\n }\n}", "async function executeAsyncTask() {\n const valueA = await functionA()\n const valueB = await functionB(valueA)\n return function3(valueA, valueB)\n}", "function asyncop(err, cb) {\n setTimeout(() => {\n // myself.next(\"This is result\");\n }, 2000)\n}", "sendAsync(payload, callback) {\n void this.handleRequest(payload, \n // handleRequest has decided to not handle this, so fall through to the provider\n () => {\n const sendAsync = this._provider.sendAsync.bind(this._provider);\n sendAsync(payload, callback);\n }, \n // handleRequest has called end and will handle this\n (err, data) => {\n err ? callback(err) : callback(null, Object.assign(Object.assign({}, payload), { result: data }));\n });\n }", "async function asyncFunction(arg) {\r\n return arg;\r\n}", "async function translate(file_path, book_id, trans_langs) {\n var arguments = [];\n arguments.push(file_path);\n arguments.push(book_id);\n for (var i = 0; i < trans_langs.length; i++) {\n arguments.push(trans_langs[i]);\n }\n console.log(arguments);\n let options = {\n mode: \"text\",\n executable: \"python3.9\",\n pythonOptions: [\"-u\"], // get print results in real-time\n scriptPath:\n \"./public/translation\",\n args: arguments, //An argument which can be accessed in the script using sys.argv[1]\n };\n console.log(\"entered the async\")\n try{\n await PythonShell.run(\n \"ParseAndTranslate.py\",\n options,\n function (err, result) {\n if (err) throw err;\n //result is an array consisting of messages collected\n //during execution of script.\n console.log(\"result: \", result.toString());\n for(var i = 0 ; i < trans_langs.length ; i++){\n console.log(\"doing something in this loop for downloads\");\n uploadTranslatedBook(book_id, trans_langs[i]);\n }\n }\n );console.log(\"ok this is it\")} catch (error){\n console.log(\"ded\")\n console.log(error)\n }\n console.log(\"exiting the async\")\n \n}", "async function bar(){\r\n\tconsole.log(\"bar\")\r\n}", "async function func() {\n return 1;\n}", "function doAsyncTask(cb) {\n // cb();\n \n setImmediate(() => {\n console.log(\"Async Task Calling Callback\");\n cb();\n });\n \n // process.nextTick(() => {\n // console.log(\"Async Task Calling Callback\");\n // cb();\n // });\n }", "_run(cb) {\n cb();\n }", "_run(cb) {\n cb();\n }", "function callbackDriver() {\n cb();\n }", "function demoOfAsyncAwait(){\n\tfunction mockRequest(second){\n\t const args = [...arguments];\n\t [second,...params] = args;\n\t return new Promise((resolve,reject)=>{\n\t setTimeout(function() {resolve(params)},second*1000);\n\t })\n\t};\n\t //继发,依次执行\n\t async function jifa(){\n\t const a= await mockRequest(1,1,2);\n\t const b= await mockRequest(1,1,2);\n\t const c= await mockRequest(1,1,2);\n\t return [...a,...b,...c];\n\t};\n\t //jifa().then(a=>console.log(a));\n\t \n\t //并发,同时执行\n\t async function wrong_bingfa(){\n\t return Promise.all([await mockRequest(3,1,2),\n\t await mockRequest(3,1,2),\n\t await mockRequest(3,1,2)])\n\t .then(([a,b,c])=>[...a,...b,...c]);\n\t }\n\t //wrong_bingfa()依然是继发执行\n\t async function bingfa(){\n\t const [a,b,c]= await Promise.all([mockRequest(3,10,2),\n\t mockRequest(3,10,2),\n\t mockRequest(3,10,2)]);\n\t return [...a,...b,...c];\n\t\t }\n\t//bingfa().then(a=>console.log(a));\n\t \n\t async function bingfa2(){\n\t const arr=[[4,11,2],[4,11,2],[4,11,2]].map(async item=>{\n\t return await mockRequest(...item);\n\t });\n\t //!!!!!!!! items of 'arr' are Promise instances, not Array instances.\n\t const res=[];\n\t for(const p of arr){\n\t res.push(await p);\n\t }\n\t [a,b,c]=res;\n\t return [...a,...b,...c];\n\t }\n\t/*上面代码中,虽然map方法的参数是async函数,但它是并发执行的,\n\t因为只有async函数内部是继发执行,外部不受影响。\n\t后面的for..of循环内部使用了await,因此实现了按顺序输出。\n*/\n\tbingfa2().then(a=>console.log(a));\n}", "async function executeHardAsync() {\n const r1 = await fetchUrlData(apis[0]);\n const r2 = await fetchUrlData(apis[1]);\n}", "function doAsyncTask(cb) {\n setTimeout(() => {\n console.log(\"Async Task Calling Callback\");\n cb();\n }, 1000);\n }", "async function AppelApi(parfunc=api_tan.GenericAsync(api_tan.getTanStations(47.2133057,-1.5604042)),\nretour=function(par){console.log(\"demo :\" + JSON.stringify(par))}) {\n let demo = await parfunc \n retour(demo);\n // console.log(\"demo : \" + JSON.stringify(demo));\n}", "async function main() {\n const userInfo = await getUserInfo('12');\n console.log(userInfo);\n\n const userAddress = await getUserAddress('12');\n console.log(userAddress);\n\n console.log('ceva4');\n}", "function myAsyncFunction(callback) {\n // 50ms delay before callback\n setTimeout(function () {\n callback('hello');\n }, 100);\n}", "function getDataAndDoSomethingAsync() {\n getDataAsync()\n .then((data) => {\n doSomethingHere(data);\n })\n .catch((error) => {\n throw error;\n });\n}", "async function asyncPromiseAll() {\n //PLACE YOUR CODE HERE:\n}", "async function getData() {\n let data = await getUsername1()\n data = await getAge1(data)\n data = await getDepartment1(data)\n data = await printDetails1(data)\n}", "async function simpleReturn() {\n return 1;\n}", "async function wrapperForAsyncFunc() {\n const result1 = await AsyncFunction1();\n console.log(result1);\n const result2 = await AsyncFunction2();\n console.log(result2);\n}", "async function myFunc() {\n // Function body here\n }", "async function fetchUser() {\r\n // do network request in 10 secs....\r\n return 'ellie';\r\n}", "async function doWork(){\r\n // all the code that could fail goes here.\r\n try {\r\n // await: the 'doWork' function will wait until the 'makeRequest' function has returned before moving forward. if 'await' is not used, it will\r\n // return the promise and not the result of the promise.\r\n // this will only return the resolve section of the promise\r\n const response = await makeRequest('Google')\r\n console.log('Response Recieved')\r\n const processedResponse = await processRequest(response)\r\n console.log(processedResponse)\r\n // catch takes a single parameter 'err' which is collected from the reject statement in the promise.\r\n } catch (err) {\r\n console.log(err)\r\n }\r\n}", "function demoTask(cb)\n{\n console.log('hello');\n cb();\n}", "async function main() {\n\n getUser(\"test1\");\n\n}", "sendAsync(payload, cb) {\n log.info('ASYNC REQUEST', payload)\n const self = this\n // fixes bug with web3 1.0 where send was being routed to sendAsync\n // with an empty callback\n if (cb === undefined) {\n self.rpcEngine.handle(payload, noop)\n return self._sendSync(payload)\n } else {\n self.rpcEngine.handle(payload, cb)\n }\n }", "function asyncHelper () {\n\tlet f, r\n\tconst prm = new Promise((_f, _r)=>{f = _f, r = _r})\n\tfunction done(...x){\n\t\treturn x.length === 0 ? f() : r(x[0])\n\t}\n\tdone.then = prm.then.bind(prm)\n\tdone.catch = prm.catch.bind(prm)\n\tdone.finally = prm.finally.bind(prm)\n\treturn done\n}", "async function foo() {\n return 1\n}", "callback() {\n if (this.stop) {this.is_running=false;return;}\n this.debuglog(\"Stage:\",this.stage);\n this.debuglog(\"Async:\",this.async_requests);\n this.debuglog(\"ID:\",this.id);\n //Don't check for more processing until the last task called is done\n if (this.async_requests !== 0) {\n if (this.last_logged != this.async_requests) {\n this.alllog(`Requests remaining: ${this.async_requests}`);\n this.last_logged = this.async_requests;\n }\n var me = this;\n setTimeout(()=>{me.callback();},polling_interval);\n this.debuglog(\"Rescheduled\");\n } else {\n this.processList();\n }\n }", "async function main() {\n try {\n const user = await getUser();\n const status = await login(user)\n const page = await showPage(status);\n console.log(user, status, page)\n }\n catch (err) {\n console.log(err)\n }\n}", "async function say() {\n}", "do(func) {\n return async && data instanceof Promise\n ? using(data.then(func), async)\n : using(func(data), async)\n }", "async function getRecipeAW() { // the function always return a Promises\n //the await will stop executing the code at this point until the Promises is full filled\n // the await can be used in only async function\n const id = await getID;\n console.log(id)\n console.log('here 2');\n const recipe = await getRecipe(id[1]);\n console.log(recipe);\n const related = await getRelated('Publisher');\n console.log(related);\n\n return recipe;\n}", "async function myPromise (){\n return \"This is my promise\"\n}", "function addAsync(x,y, onResult){\n console.log(\"[SP] processing \", x , \" and \", y);\n setTimeout(function(){\n var result = x + y;\n console.log(\"[SP] returning result\");\n if (typeof onResult === 'function')\n onResult(result);\n },3000);\n}", "function main() {\n\n /*\n * Example template callback\n *\n * callback = function(message) {\n * if (message) console.log(message);\n * }\n *\n */\n\n /*\n * Example usage of connect and disconnect\n *\n * connect().then(callback, callback);\n * disconnect().then(callback, callback);\n */\n\n /*\n * Example usage of User routines\n *\n * addUser(\"user1\", \"token1\").then(callback, callback);\n * getUser(\"token1\").then(callback, callback);\n */\n\n /*\n * Example usage of TopTrack routines\n *\n * features = {[ACOUSTICNESS]: 0.3, [DANCEABILITY]: 0.5, \n * [ENERGY]: 0.8, [TEMPO]: 113.4, [VALENCE]: 0.8};\n * addTopTrack(\"user1\", \"uri1\", features).then(callback, callback);\n */\n\n /*\n * Example usage of Playlist routines\n *\n * addPlaylist(\"user1\", \"uri2\").then(disconnectCB, disconnectCB);\n * getPlaylistId(\"uri1\").then(disconnectCB, disconnectCB);\n * getUserPlaylists(\"user1\").then(disconnectCB, disconnectCB);\n * getPlaylistUri(\"15\").then(disconnectCB, disconnectCB);\n */\n\n}", "async function myFunc() {\n return 'Hello';\n}", "async run() {\n }", "async function submit(){\n \n // pull in values form the user inputs on the webpage\n getUserInput()\n \n // get the location data\n \n let data = await getData(geoURL)\n \n postData('/getLatLon', data);\n // let x = await postData('/getLatLon', data);\n // console.log(x) \n\n // update user interface with another async call\n // updateUI();\n \n // let imData = await getImage()\n await getImage()\n\n await getWeatBit()\n \n await getCountry()\n\n await updateUI()\n\n}", "async function syncPipeline() {\n await generateAllowance();\n // await confirmPendingBookings();\n // the server-side script does this now\n await updateContactList();\n await updateTourList();\n}", "async function myfunc() {\n let promise = new Promise((resolve, reject) => {\n setTimeout(() => resolve(\"okk\"), 2000);\n });\n\n const result = await promise;\n // await makes it wait till the promise resolves and after the promise is resolved\n // after that it assigns the data returned from the promise to result\n return result;\n}", "async function outPutEmployeeQuery() {\n console.log('function called')\n try {\n console.log('function called 1')\n const id = await getIds; // <--- will stop code execution until `resolved` \n console.log('function called 2')\n const name = await getEmployeeName(id);\n console.log('function called 3')\n const final = await finishingTouch(name);\n console.log(final);\n } catch (error) {\n console.log(`exception :: ${error}`);\n }\n}", "async function fetchUser() {\n return \"abc\";\n}", "async function testLib() {\n var initC = await initContract();\n var callOne = await makeRequest(\"ShipmentDelivered\");\n var callTwo = await makeRequest(\"ShipmentDelivered\");\n console.log(initC, callOne, callTwo)\n}", "async function main() {\n\t//// Promises work well for single operations\n\t//// done in sequence Await entire request\n\t// \"The Flash\" Mails another superhero for a dad joke\n\t// Might take a few days, but \"The Flash\" knows \n\t// what to do when it comes back\n\tlet response = await axios.get(\"https://icanhazdadjoke.com/\", {\n\t\theaders: { accept: \"application/json\" }\n\t});\n\t// Once \"The Flash\" recieves the letter, he calls another\n\t// superhero in his office, and tells him \n\t// \"Go downstairs, and add this joke to the list of jokes\"\n\t// \" in filing cabinet 20 \"\n\t\n\t// Other superhero goes downstairs, adds the joke to the list,\n\t// and then walks back upstairs, all while \"The Flash\" is still \n\t// able to do all sorts of other things.\n\t\n\t//// Await adding joke to file\n\tawait fs_async.appendFile(\"jokes.txt\", response.data.joke + \"\\n\\n\");\n\t// Once that guy comes back, \"The Flash\" can continue this process...\n\t// He then asks the guy to go back down the stairs, \n\t// read the entire list of jokes, \n\t// and then tell them to him one by one...\n\t// (IRL, the analogy breaks down, right? \n\t// He could have told the guy \n\t// to look the file up while down there);\n\t\n\t//// Await reading entire jokes file\n\tlet jokes = await fs_async.readFile(\"jokes.txt\");\n\t\n\t// Guy comes back up, tells \"The Flash\" all the jokes...\n\tconsole.log(jokes.toString());\n}", "async function callClient(){\r\n console.log(\"Waiting for the project....\");\r\n let firstStep = await willGetProject();\r\n let secondStep = await showOff(firstStep);\r\n let lastStep = await willWork(secondStep);\r\n console.log(\"Completed and deployed in seatle\");\r\n}", "async function main() {\n // await in front of whatever is resolved from a fct and then returned into a const for instance\n const name = await myPromise;\n name;\n}", "async function getDataAndDoSomethingAsync() {\n try {\n let data = await getDataAsync();\n doSomethingHere(data);\n } catch (error) {\n throw error;\n }\n}", "async function getDetailsAsync(){\n const details = await getDetails(\"Here is your details from ASYNC AWAIT\");\n\n console.log(details);\n}", "async function fetchAsyncSave(func, data) { // eslint-disable-line no-unused-vars\r\n const response = await func(data);\r\n return response;\r\n}", "async function notAsync(){\n console.time('timer')\n\n console.log(\"Im not async\");\n\n var someInfo=asyncFn()\n someInfo.then(response => {\n console.log(response);\n \n if(response == 1){\n console.log (\"IT WORKS 😛\");\n console.timeEnd('timer');\n }\n });\n \n /*\n var someInfo = await asyncFn();\n if(someInfo == 1)\n console.log (\"IT ALSO WORKS! 😛 😛 😛 😛\");\n */\n \n \n return 0;\n}", "function done() {}", "async function async1() {\n console.log(\"async1 start\");\n await async2();\n console.log(\"async1 end\"); // mic1-1\n}", "async function WrapperForAsyncFunc() {\n const result = await AsyncFunction();\n console.log(result);\n}", "function async_api(f, arg, cb, err) {\n err = err || function(e){ console.log(e); };\n var callback = function(a,b,c,d) {\n var e = api.runtime.lastError;\n if (e) {\n err(e);\n }\n else {\n cb(a,b,c,d);\n }\n };\n try {\n var promise = f.call(null, arg, callback);\n if (promise && promise.then) {\n promise.then(callback);\n }\n } catch(e) {\n err(e);\n }\n}", "async function fetchUser() {\n // do network reqeust in 10 secs....\n return 'ellie';\n}", "async function noAwait() {\n let value = myPromise();\n console.log(value);\n}", "async function asyncFuncExample(){\n let resolvedValue = await myPromise();\n console.log(resolvedValue);\n }", "async function waiting() {\n const firstValue = await firstAsyncThing();\n const secondValue = await secondAsyncThing();\n console.log(firstValue, secondValue);\n }", "function runAsyncWrapper(callback) {\n\t/*\n return async (req, res, next) => {\n callback(req, res, next).catch(next);\n }\n */\n\treturn async (req, res, next) => {\n\t\ttry {\n\t\t\tawait callback(req, res, next);\n\t\t} catch (err) {\n\t\t\tconsole.log(err.message);\n\t\t\tres.send({ success: false, message: \"Error with asynchronous registration.\" });\n\t\t\tnext(err);\n\t\t}\n\t};\n}", "function _callback(err, data) { _call(callback, err, data); }", "function success1(a){\n console.log(\"this is success1 \" + a + \"and now executing the new callback\");\n // another async call\n return new Promise(function(resolve,reject){\n setTimeout(function(){\n console.log(\"second promise executing\");\n resolve(\"kadam\");\n },2000);\n });\n\n}" ]
[ "0.72206724", "0.6711249", "0.664578", "0.6581096", "0.6559593", "0.6488737", "0.64628863", "0.63935167", "0.637816", "0.63749075", "0.6334935", "0.633491", "0.62870884", "0.627751", "0.627751", "0.627751", "0.627751", "0.627751", "0.6244162", "0.62290543", "0.6191366", "0.6189686", "0.61706513", "0.614203", "0.61338603", "0.6107674", "0.6103986", "0.6093701", "0.6072434", "0.6067223", "0.6059847", "0.6057576", "0.6043581", "0.6039294", "0.60386425", "0.60324824", "0.60280555", "0.6020533", "0.6000464", "0.5997366", "0.5991893", "0.59904075", "0.5970657", "0.59587693", "0.59513754", "0.5949557", "0.5949557", "0.5945611", "0.5923867", "0.59226906", "0.5908228", "0.58917594", "0.5890996", "0.5881281", "0.58800155", "0.587527", "0.5874885", "0.5862795", "0.58562356", "0.5851418", "0.58476907", "0.58452255", "0.58402103", "0.58361995", "0.5831763", "0.5821637", "0.582016", "0.58179885", "0.5817786", "0.5810809", "0.5809276", "0.57964295", "0.57957965", "0.57934916", "0.5788213", "0.5786768", "0.5773047", "0.577062", "0.5769531", "0.57676196", "0.57657903", "0.57643116", "0.57558554", "0.5743901", "0.5743281", "0.57337403", "0.57328135", "0.57308275", "0.5724293", "0.57202286", "0.5715463", "0.57111937", "0.57070935", "0.570635", "0.5704864", "0.5689508", "0.56885034", "0.568371", "0.5683235", "0.56825244", "0.5674712" ]
0.0
-1
this is run during init (from stackoverflow)
function setUrlParams(){ (window.onpopstate = function () { var match, pl = /\+/g, // Regex for replacing addition symbol with a space search = /([^&=]+)=?([^&]*)/g, decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, query = window.location.search.substring(1); urlParams = new setUrlParamDefaults(); while (match = search.exec(query)) urlParams[decode(match[1])] = decode(match[2]); })(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__previnit(){}", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "function _init() {\n }", "function init() {\n\t \t\n\t }", "function init() {\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "init() {\n }", "function init() {\r\n }", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {\r\n\r\n }", "function _init() {\n }", "function _init() {\n }", "function _init() {\n }", "init () {}", "init () {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function init() {\n\n }", "function init() {\n\n }", "function init() { }", "function init() { }", "function init () {\n // Here below all inits you need\n }", "function init() {\n\n\n\n\t}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "function init() {\n\t//TODO\n}", "transient private protected internal function m182() {}", "init () {\n }", "private internal function m248() {}", "init() {\n }", "init() {\n }", "init() {\n }", "_reflow() {\n this._init();\n }", "function init() {\n\n }", "_initialize() {\n\n }", "initialize() {\n //\n }", "init() {\n //todo: other init stuff here\n }", "init () {\n\t\treturn null;\n\t}", "function init(){\n\n }", "initialize() {\n // Needs to be implemented by derived classes.\n }", "transient protected internal function m189() {}", "private public function m246() {}", "function init() {\n\n }", "initialise () {}", "initialize()\n {\n }", "function init () {\n}", "init() {\n\n }", "init() {\n\n }", "init () {\n\n }", "init () {\n }", "static ready() { }", "async init () {\r\n return;\r\n }", "protected internal function m252() {}", "function init () {\n\n}", "init() {\n }", "init() {\n }", "function init(){}", "init() {\n\n }", "init() {\n\n }", "transient final protected internal function m174() {}", "function init() {\n}", "function init() {\n}", "transient private internal function m185() {}", "function initialize() {}", "function _construct()\n\t\t{;\n\t\t}", "init() {\n // No-op by default.\n }", "static initialize() {\n //\n }", "async init () {\r\n debug.log('called init');\r\n return;\r\n }", "function init() {\n \n}", "function init() {\n \n}", "function init() {\n\n}", "function init() {\n\n}", "init() {\n\t\tconsole.log(\"No special init\");\n\t}" ]
[ "0.7408453", "0.7398333", "0.72870994", "0.7266828", "0.70448935", "0.70441484", "0.70441484", "0.70441484", "0.70441484", "0.70441484", "0.70297956", "0.70166373", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.69570583", "0.69451874", "0.69451874", "0.69451874", "0.69374543", "0.69374543", "0.6923447", "0.6923447", "0.6923447", "0.6923447", "0.6923447", "0.6923447", "0.6921793", "0.6921793", "0.6921606", "0.6921606", "0.6885137", "0.6844588", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.68262863", "0.681862", "0.68132955", "0.6808593", "0.67709655", "0.67469823", "0.67469823", "0.67469823", "0.6746447", "0.6745776", "0.6719782", "0.67096156", "0.6704318", "0.6670992", "0.6670854", "0.6601258", "0.6600923", "0.66004694", "0.6592534", "0.65911597", "0.6557788", "0.65429795", "0.65252024", "0.65252024", "0.64983344", "0.6486353", "0.647305", "0.64699143", "0.64693505", "0.646063", "0.64562017", "0.64562017", "0.6451503", "0.64464384", "0.64464384", "0.64074844", "0.63976485", "0.63976485", "0.63959986", "0.638643", "0.6383597", "0.6375378", "0.6364426", "0.6362147", "0.63580096", "0.63580096", "0.63321275", "0.63321275", "0.63294995" ]
0.0
-1
file handling handler for new file selection
function loadFile(file) { //explicitly loaded files should start at the beginning window.location.hash = ''; //read file var reader = new FileReader(); reader.onload = function(e) { //clear view resetData(); generateMovie(e.target.result); } if(file) reader.readAsText(file); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fileSelected(data, evt) {\n /*jshint validthis: true */\n this.file = evt.target.files[0];\n if (this.file)\n this.filename(this.file.name);\n this.errorMessage('');\n }", "function handleFileSelect(e) {\n e.stopPropagation();\n e.preventDefault();\n\n var file = null;\n\n if (e.type === \"change\") {\n file = e.target.files[0];\n\n // change label text\n changeContent(file.name);\n\n } else if (e.type === \"drop\") {\n file = e.dataTransfer.files[0];\n\n // change drop area text\n changeContent(file.name);\n }\n\n //Validate input file\n if (fileValidator(file)){\n readContent(file);\n }\n }", "function FileSelectHandler(e) {\n // cancel event and hover styling\n FileDragHover(e);\n // fetch FileList object\n var files = e.target.files || e.dataTransfer.files;\n // process all File objects\n for (var i = 0, f; f = files[i]; i++) {\n ParseFile(f);\n UploadFile(f);\n }\n }", "function handleFileSelect(evt){\n var f = evt.target.files[0]; // FileList object\n window.reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = (function(theFile){\n return function(e){\n editor.setData(e.target.result);\n evt.target.value = null; // allow reload\n };\n })(f);\n // Read file as text\n reader.readAsText(f);\n thisDoc = f.name;\n }", "function handleFileSelect(evt) {\n evt.stopPropagation();\n evt.preventDefault();\n\n // Get the FileList object that contains the list of files that were dropped\n var files = evt.dataTransfer.files;\n\n // this UI is only built for a single file so just dump the first one\n dumpFile(files[0]);\n }", "function handleFileSelect(evt) {\n evt.stopPropagation();\n evt.preventDefault();\n // Get the FileList object that contains the list of files that were dropped\n const files = evt.dataTransfer.files;\n // this UI is only built for a single file so just dump the first one\n file = files[0];\n const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add(file);\n loadAndViewImage(imageId);\n }", "function handleFileSelect(evt) {\n \n evt.stopPropagation();\n evt.preventDefault();\n\n // Get the FileList object that contains the list of files that were dropped\n const files = evt.dataTransfer.files;\n\n // this UI is only built for a single file so just dump the first one\n file = files[0];\n const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add(file);\n loadAndViewImage(imageId);\n }", "function handleFileSelect(evt) {\n // These are the files\n var files = evt.target.files;\n // Load each one and trigger a callback\n for (var i = 0; i < files.length; i++) {\n var f = files[i];\n _main.default.File._load(f, callback);\n }\n }", "function fileHandler(){\n const input = document.createElement('input');\n input.type = 'file';\n input.addEventListener('change', getFile, false);\n input.click();\n }", "function handleFileSelect(evt) {\r\n evt.stopPropagation();\r\n evt.preventDefault();\r\n\r\n // Get the FileList object that contains the list of files that were dropped\r\n const files = evt.dataTransfer.files;\r\n\r\n // this UI is only built for a single file so just dump the first one\r\n file = files[0];\r\n const imageId = cornerstoneWADOImageLoader.wadouri.fileManager.add(file);\r\n loadAndViewImage(imageId);\r\n}", "function FileSelectHandler(e) {\n\n // cancel browser events and remove hover style\n FileDragHover(e);\n\n // gets a FileList object containing dropped files\n var files = e.originalEvent.dataTransfer.files;\n //alert(files.item(0).name.toString());\n \n UploadFile(files.item(0));\n }", "function selectFile(evt) {\n\t\tvar last_file = {};\n\t\tif (context_element && (context_element.type == 2)) {\n\t\t\tlast_file = context_element;\n\t\t}\n\t\tcontext_element = getElProp(evt);\n\t\tif (context_element.type == 1) {\n\t\t\t// If select directory then open the directory\n\t\t\t// if index >= 0 then select subfolde, if index < 0 - then select up folder\n\t\t\tif (context_element.index >= 0) {\n\t\t\t\tgetDirContent(cur_path + context_element.name + '/');\n\t\t\t} else {\n\t\t\t\tvar\n\t\t\t\t\tpath = '',\n\t\t\t\t\ti\n\t\t\t\t;\n\t\t\t\tfor (i = dir_content.path.length + context_element.index; i >= 0; i--) {\n\t\t\t\t\tpath = dir_content.path[i] + '/' + path;\n\t\t\t\t}\n\t\t\t\tgetDirContent('/' + path);\n\t\t\t}\n\t\t} else if (context_element.type == 2) {\n\t\t\t// Іf select the file then highlight and execute the external functions with the file properties\n\t\t\thighlightFileItem(context_element.index);\n\t\t\t// If set the external function - then execute it\n\t\t\tif (on_select || on_dblselect) {\n\t\t\t\tvar file = dir_content.files[context_element.index];\n\t\t\t\t// Generate additional field\n\t\t\t\tfile.path = cur_path + file.name;\n\t\t\t\tfile.wwwPath = getURIEncPath(HTMLDecode(upload_path + cur_path + file.name));\n\t\t\t\t// If thumbnail exist, set the www path to him\n\t\t\t\tif (file.thumb && file.thumb !== '') {\n\t\t\t\t\tfile.wwwThumbPath = getURIEncPath(HTMLDecode(upload_path + file.thumb));\n\t\t\t\t}\n\t\t\t\tif (on_select) {\n\t\t\t\t\ton_select(file);\n\t\t\t\t}\n\t\t\t\t// If double click on file then chose them by on_dblselect() function\n\t\t\t\tif ( on_dblselect &&(last_file.index == context_element.index) && ((context_element.time - last_file.time) < dbclick_delay) ) {\n\t\t\t\t\ton_dblselect(file);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// No selections\n\t\t\t// Clean the highlight\n\t\t\thighlightFileItem();\n\t\t\t// Hide the tooltips\n\t\t\thideTooltips();\n\t\t\t// If set the external function - then execute it\n\t\t\tif (on_deselect) {\n\t\t\t\ton_deselect();\n\t\t\t}\n\t\t}\n\t}", "function file_selected( e ) {\n\tif( e.files.length == 1 ) {\n\t\t$('#upload_button').button('enable');\n\t\t$('#new_file_name_container').html( '<span id=\"new_file_name\">' + e.files[0].name + '</span>' );\n\t} else {\n\t\t$('#upload_button').button('disable');\n\t\t$('#new_file_name_container').html( '(Use \\'pick file\\' to select a tradition file to upload.)' );\n\t}\n}", "function handleFileSelect(evt) {\r\n\t\"use strict\";\t\r\n var files = evt.target.files;\r\n\r\n // files is a FileList of File objects. List some properties.\r\n var output = [];\r\n for (var i = 0, f; f = files[i]; i++) {\r\n output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',\r\n f.size, ' bytes, last modified: ',\r\n f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',\r\n '</li>');\r\n }\r\n\t\r\n\tupdateBGfromFile();\r\n\t\r\n\tBGNAME = escape(f.name);\r\n document.getElementById('file_output').innerHTML = '<ul>' + output.join('') + '</ul>';\r\n }", "onFileSelected(event) {\n this.selectedFiles = event.target.files;\n }", "function handleFileSelected(event) {\n // Add file to bundle\n bundle.files = Array.from(document.getElementById(\"securesend_upload_input\").files);\n bundle.permissionsArray = [];\n\n // Load the next page: permissions\n loadPermissions();\n }", "function handlePicked() {\n displayFile(this.files);\n}", "function processSelectedFile(filePath, requestingField) {\n $('#' + requestingField).val(filePath).trigger('change');\n}", "function handleFileSelect(evt) {\n var files = evt.target.files; // FileList object\n\n // Loop through the FileList and render image files as thumbnails.\n for (var i = 0, f; f = files[i]; i++) {\n\n // Only process image files.\n console.log(f.type);\n\n var reader = new FileReader();\n\n // Closure to capture the file information.\n reader.onload = (function(theFile) {\n return function(e) {\n doc.name = theFile.name ;\n\t doc.content = e.target.result;\n\t switchToPanel('adjust');\n\t document.getElementById('span_filename').innerHTML = doc.name;\n };\n })(f);\n\n // Read in the file as Text -utf-8.\n reader.readAsText(f);\n }\n}", "fileBrowseHandler(files) {\n this.prepareFilesList(files);\n }", "function onFileSelect(event) {\n jQuery('#uploadHelp').text('The file \"' + event.target.files[0].name + '\" has been selected.');\n \n var reader = new FileReader();\n reader.onload = onReaderLoad;\n reader.readAsText(event.target.files[0]);\n}", "function onFileSelected(files) {\n for(let file of files) {\n handleSelectedFile(file);\n }\n}", "function filesSelected(event) {\n processImport(event.target.files, 0);\n}", "function handleFileSelect(evt) { \n \n // A FileList\n var files = evt.target.files;\n // Show some properties\n for (var i = 0; i < files.length; i++) {\n var f = files[i];\n var file = createElement('li',f.name + ' ' + f.type + ' ' + f.size + ' bytes');\n file.parent(list);\n \n // Read the file and process the result\n var reader = new FileReader();\n reader.onload = (function(theFile) {\n return function(e) {\n // Render thumbnail\n var img = createImg(e.target.result);\n img.parent(container);\n img.class('thumb');\n \n loadImage(e.target.result, gotImage);\n };\n })(f);\n\n // Read in the image file as a data URL.\n reader.readAsDataURL(f);\n }\n }", "function handleFileChange() {\n\t// First, handle custom display of file select\n\tvar $this = $(this),\n $val = $this.val(),\n valArray = $val.split('\\\\'),\n newVal = valArray[valArray.length-1],\n $button = $this.siblings('.btn-text'),\n $fileName = $(\"#upload-file\");\n \n if(newVal !== '') {\n $button.text( $button.attr('data-selected-text') );\n $fileName.html(\"Selected file: <em>\" + newVal + \"</em>\");\n } else {\n $button.text( $button.attr('data-default-text') );\n $fileName.empty();\n }\n\t\n\t// This seems jank, but I guess it's how the plugin works for validations\n\tvar $form = $('form.edit_show');\n\tvar id = $form.attr(\"id\");\n\tvar validators = window.ClientSideValidations.forms[id].validators;\n\tif ($form.isValid(validators)) {\n\t $form.data(\"remote\", true);\n\t $form.attr(\"data-remote\", true);\n\t $form.submit();\n\t} else {\n\t\talert('Please fill out the missing fields to preview your poster');\n\t}\n}", "function handleFileSelect(evt) {\n for(var f=0; f < $('#put_files')[0].files.length; f++)\n allfiles.push($('#put_files')[0].files[f]);\n updateFileList();\n}", "changeFn(event) {\n var fileList = event.__files_ || (event.target && event.target.files);\n if (!fileList)\n return;\n this.stopEvent(event);\n this.handleFiles(fileList);\n }", "function handleFileSelect(evt) {\n\n var files = evt.target.files; // FileList object\n\n console.log(files);\n console.log(files[0]);\n\n var reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = function() {\n //console.log(reader.result);\n\n var fileContent =reader.result;\n\n parsearArchivo( fileContent );\n pintarLaberinto();\n //alert('termino de paresear');\n $('#ingresoPosicion').show();\n $('#contSolucion').hide();\n $('#solucion').html('');\n }\n\n reader.readAsText(files[0]);\n}", "function handleFileSelect(evt) {\n var files = evt.target.files; // FileList object\n for (var i = 0, f; f = files[i]; i++) {\n var reader = new FileReader();\n reader.onload = (function (theFile) {\n return function (e) {\n processData(e.target.result); //\n };\n })(f);\n reader.readAsText(f); //read the file as text\n }\n $(\"#control\").hide();\n }", "function open_file() {\n //get the hidden <input type=\"file\"> file loader element and force a click on it\n var loader = document.getElementById('file_loader_2');\n loader.click();\n\n //Now, as soon as the user selects the file, handle_files is calles automatically and we can work with the selected file\n}", "function onChangeFile(event) {\n var files = event.target.files;\n readFile(files);\n }", "function handle(type) {\n // Handling newfile, newfolder.\n var newFile = document.getElementById('new' + type);\n newFile.addEventListener('click', function() {\n var name = search.value;\n if (name === '') {\n search.value = type; search.focus(); search.select(); return false;\n }\n var xhr = new XMLHttpRequest();\n var newPath = cwd + name;\n xhr.open(methodFromFileType[type], newPath, true);\n xhr.withCredentials = true;\n xhr.onload = function(r) {\n if (xhr.status < 200 || xhr.status >= 300) {\n alert(\"Creating new file failed: \" + xhr.status + \" \" + xhr.statusText);\n } else if (newPath) {\n document.location = encodePath(newPath);\n }\n };\n xhr.send(null);\n });\n }", "function handleFileSelect(event) {\n // console.log('evt', evt.target.files);\n var files = event.target.files; // FileList object\n playFile(files[0]);\n}", "function handleFile(e) {\n setLoadingState(\"Loading\")\n var file = e.target.files[0];\n let fileName = file.name.split(\" \").join(\"-\");\n console.log(fileName);\n var reader = new FileReader();\n reader.onload = function (event) { //on loading file.\n console.log(event.target.result);\n var unconverteFile = event.target.result;\n var convertedFile;\n switch (format) {\n case \"JSON\":\n convertedFile = jsonJSON(unconverteFile);\n fileName = fileName.substring(0, fileName.indexOf(\".json\"));\n break;\n case \"CSV\":\n convertedFile = csvJSON(unconverteFile);\n fileName = fileName.substring(0, fileName.indexOf(\".csv\"));\n break;\n case \"SSV\":\n convertedFile = ssvJSON(unconverteFile);\n fileName = fileName.substring(0, fileName.indexOf(\".csv\"));\n break\n default:\n convertedFile = jsonJSON(unconverteFile);\n }\n dispatchDeleteSel();\n dispatchLoad(convertedFile);\n setLoadingState(\"Loaded\");\n dispatchKeys(createKeys(convertedFile));\n dispatchLoadName(fileName);\n dispatchExtended(false);\n }\n reader.readAsText(file);\n }", "function handleFileSelect(evt) {\n evt.stopPropagation();\n evt.preventDefault();\n\n var files = evt.dataTransfer.files; // FileList object.\n\n // files is a FileList of File objects. List some properties.\n var output;\n for (var i = 0, f; f = files[i]; i++) {\n output=f.name;\n }\n document.getElementById('textarea').value = output;\n }", "function handleFile(e) {\n preventDefaults(e);\n const dataTransfer = e.dataTransfer;\n const files = e.target.files || dataTransfer.files;\n if (files.length === 1) {\n myContainer.removeChild(fileContainer);\n const ext = files[0].name.split('.').slice(-1)[0];\n const options = Object.assign({ file: files[0], ext }, userParams);\n load(myContainer, options);\n }\n }", "function handleFileSelect(mEvent) {\n mEvent.stopPropagation();\n mEvent.preventDefault();\n\n files = mEvent.dataTransfer.files; // FileList object.\n\n //List some properties.\n document.getElementById('list').innerHTML =\n '<p><strong>' + files[0].name + '</strong> - ' +\n files[0].size + ' bytes, last modified: ' +\n (files[0].lastModifiedDate ? files[0].lastModifiedDate.toLocaleDateString() : 'n/a') +\n '</p>';\n\n var add = addElements();\n\n startDrawing = true;\n\n}", "function fileReceived(e) {\n // if user clicks 'cancel' on file dialogue, the filelist might be zero\n if (typeof e === 'undefined' || e.target.files.length === 0) return null;\n const selectedFile = e.target.files[0];\n console.log(selectedFile)\n if (Constants.VALID_EXTENSIONS.indexOf(selectedFile.name.split('.').pop()) >= 0) {\n console.log(`Selected file: ${selectedFile.name}`)\n // when the file has been read in, it will trigger the on load reader event\n reader.readAsArrayBuffer(selectedFile);\n } else {\n alert(`The file extension ${selectedFile.name.split('.').pop()} is invalid, must be in ${Constants.VALID_EXTENSIONS}`);\n }\n }", "function handleFileSelect(evt) {\n evt.stopPropagation();\n evt.preventDefault();\n var file = evt.target.files[0];\n var metadata = {\n 'contentType': file.type\n };\n storageRef.child('images/' + file.name).put(file, metadata).then(function (snapshot) {\n console.log('Uploaded', snapshot.totalBytes, 'bytes.');\n console.log(snapshot.metadata);\n var url = snapshot.downloadURL;\n console.log('File available at', url);\n $scope.files.$add({\n name: file.name,\n downloadURL: url,\n type: file.type\n })\n }).catch(function (error) {\n console.error('Upload failed:', error);\n });\n }", "function handleImportRouteSelection() {\n\t\t\tvar file;\n\t\t\tvar fileInput = $$('#gpxUploadFiles input[type=\"file\"]')[0];\n\t\t\tif (fileInput && fileInput.files && fileInput.files.length > 0) {\n\t\t\t\tfile = fileInput.files[0];\n\t\t\t} else if (fileInput && fileInput.value) {\n\t\t\t\t//IE doesn't know x.files\n\t\t\t\tfile = fileInput.value;\n\t\t\t}\n\n\t\t\tif (file) {\n\t\t\t\ttheInterface.emit('ui:uploadRoute', file);\n\t\t\t}\n\t\t}", "function installFileOnChangeHandler() {\n // Attach handler to process a project file when it is selected in the\n // Import Project File hamburger menu item.\n const selectControl = document.getElementById('selectfile');\n selectControl.addEventListener('change', (event) => {\n selectProjectFile(event)\n .catch( (reject) => {\n logConsoleMessage(`Select project file rejected: ${reject}`);\n closeImportProjectDialog();\n const message =\n `Unable to load the selected project file. The error reported is: \"${reject}.\"`;\n utils.showMessage('Project Load Error', message);\n });\n });\n}", "function handleFileSelect(evt) {\n evt.stopPropagation();\n evt.preventDefault();\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n // Pode-se receber varios arquivos. \n files = evt.dataTransfer.files; // Objeto FileList\n console.log(files)\n var output = [];\n for (var i = 0, f; f = files[i]; i++) {\n output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',\n f.size, ' kb, last modified: ',\n f.lastModifiedDate.toLocaleDateString(), '</li>');\n }\n document.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';\n\n } else {\n swal({\n title: 'Navegador não suportado: ' + navigator.appVersion,\n text: 'Atualize seu navegador!',\n timer: 2000,\n showConfirmButton: false\n });\n }\n }//", "function doFileSelect(fileObj) {\n\n\t\t\tif (!(typeof fileObj.attr === 'string' || typeof fileObj.date === 'string' || typeof fileObj.dir === 'string' || typeof fileObj.ext === 'string' || typeof fileObj.fullpath === 'string' || typeof fileObj.mime === 'string' || typeof fileObj.height === 'string' || typeof fileObj.height === 'number' || typeof fileObj.name !== 'string' || typeof fileObj.size !== 'number' || typeof fileObj.type !== 'string' || typeof fileObj.width === 'string' || typeof fileObj.width === 'number')) {\n\n\t\t\t\t// debug the file selection settings (if debug is turned on and console is available)\n\t\t\t\tif (sys.debug) {\n\t\t\t\t\tconsole.log(fileObj);\n\t\t\t\t}\n\n\t\t\t\tdisplayDialog({\n\t\t\t\t\ttype: 'throw',\n\t\t\t\t\tstate: 'show',\n\t\t\t\t\tlabel: 'Oops! There was a problem',\n\t\t\t\t\tcontent: 'There was a problem reading file selection information.'\n\t\t\t\t});\n\n\t\t\t} else if (typeof tinyMCE !== 'undefined' && typeof tinyMCEPopup !== 'undefined') {\n\t\t\t\tvar win = tinyMCEPopup.getWindowArg('window'),\n\t\t\t\t\trelPath = fileObj.dir + fileObj.name;\n\n\t\t\t\t// insert information into the tinyMCE window\n\t\t\t\twin.document.getElementById(tinyMCEPopup.getWindowArg('input')).value = relPath;\n\n\t\t\t\t// for image browsers: update image dimensions\n\t\t\t\tif (win.ImageDialog) {\n\t\t\t\t\tif (win.ImageDialog.getImageData) {\n\t\t\t\t\t\twin.ImageDialog.getImageData();\n\t\t\t\t\t}\n\t\t\t\t\tif (win.ImageDialog.showPreviewImage) {\n\t\t\t\t\t\twin.ImageDialog.showPreviewImage(relPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// close popup window\n\t\t\t\ttinyMCEPopup.close();\n\n\t\t\t} else {\n\n\t\t\t\t// We are a standalone mode. What to do, is up to you...\n\t\t\t\tif (opts.callBack !== null) {\n\n\t\t\t\t\t// user passed a callback function\n\t\t\t\t\topts.callBack(fileObj);\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// just do a simple throw\n\t\t\t\t\tdisplayDialog({\n\t\t\t\t\t\ttype: 'throw',\n\t\t\t\t\t\tstate: 'show',\n\t\t\t\t\t\tlabel: 'Standalone Mode Message',\n\t\t\t\t\t\tcontent: 'You selected' + (fileObj.dir + fileObj.name) + '<br />' + fileObj.fullpath\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t}\n\t\t}", "function handleFileSelect2(evt) {\r\n\t\tevt.stopPropagation();\r\n\t\tevt.preventDefault();\r\n\r\n\t\tvar files = evt.dataTransfer.files; // FileList object.\r\n\r\n\t\tif(typeof(currentFiles.Data) !== \"undefined\"){\r\n\t\t\tvar r = confirm(\"Override existing File?\"); // ask User\r\n\t\t\tif(r == true){\r\n\t\t\t\tconsole.log(\"Override File\");\r\n\t\t\t\t// now clear all old options from Data-Selection\r\n\t\t\t\tvar select = document.getElementById(\"dateSelect\");\r\n\t\t\t\tvar length = select.options.length;\r\n\t\t\t\tfor (i = 0; i < length; i++) {\r\n\t\t\t\t select.options[0] = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tconsole.log(\"Do nothing\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// files is a FileList of File objects. List some properties.\r\n\t\tvar output = [];\r\n\t\tf = files[0];\r\n\t\toutput.push('<li><strong>', escape(f.name), '</strong> - ',\r\n\t\tf.size, ' bytes, last modified: ',\r\n\t\tf.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a','</li>');\r\n\r\n\t\tcurrentFiles.Data = f.name;\r\n\r\n\t\tvar reader = new FileReader(); // to read the FileList object\r\n\t\treader.onload = function(event){ // Reader ist asynchron, wenn reader mit operation fertig ist, soll das hier (JSON.parse) ausgeführt werden, sonst ist es noch null\r\n\t\t\tif (f.name.substr(f.name.length - 3) ===\"csv\"){ // check if filetiype is csv\r\n\t\t\t\tzaehlstellen_data = csvToJSON(reader.result);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tzaehlstellen_data = JSON.parse(reader.result); // global, better method?\r\n\t\t\t}\r\n\r\n\t\t\tdocument.getElementById(\"renderDataButton\").style.visibility = \"visible\";\r\n\t\t\tdocument.getElementById(\"hideDataSelection\").style.visibility = \"visible\";\r\n\t\t\tdocument.getElementById(\"choseFieldDiv2\").style.visibility = \"visible\";\r\n\t\t\tdocument.getElementById(\"hideSelectionHolder\").style.visibility = \"visible\";\r\n\r\n\t\t\taskFields2(zaehlstellen_data[0], 2); // only first feature is needed for property names\r\n\t\t\tdocument.getElementById(\"renderDataButton\").addEventListener('click', function(){applyDate();}, false);\r\n\t\t};\r\n\t\treader.readAsText(f);\r\n\r\n\t\t// global variable for selection\r\n\t\tselectedWeekdays = [0,1,2,3,4,5,6]; // select all weekdays before timeslider gets initialized\r\n\t\toldSelectedStreetNames = [] // Array for street names, if same amount of points are selected, but different streetnames -> redraw chart completely\r\n\t\tdocument.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';\r\n\t}", "handleFileSelect(evt) {\n let files = evt.target.files;\n if (!files.length) {\n alert('No file select');\n return;\n }\n let file = files[0];\n let that = this;\n let reader = new FileReader();\n\n //Se asigna la función que se realiza al cargar el archivo\n reader.onload = function (e) {\n that.cargaJson(e.target.result);\n };\n reader.readAsText(file);\n }", "_browseInputChangeHandler() {\n const that = this,\n selectedFiles = that._filterNewFiles(Array.from(that.$.browseInput.files));\n let validNewFiles = [];\n\n if (that.disabled || selectedFiles.length === 0) {\n return;\n }\n\n if (that.validateFile && typeof that.validateFile === 'function') {\n validNewFiles = selectedFiles.filter(file => {\n if (that.validateFile(file)) {\n return true;\n }\n\n that.$.fireEvent('validationError', {\n 'filename': file.name,\n 'type': file.type,\n 'size': file.size\n });\n\n return false;\n });\n }\n else {\n validNewFiles = selectedFiles;\n }\n\n that._selectedFiles = that._selectedFiles.concat(validNewFiles);\n\n if (that._selectedFiles.length === 0) {\n return;\n }\n\n that._renderSelectedFiles(validNewFiles);\n that.$.browseButton.disabled = (!that.multiple && that._selectedFiles.length > 0) || that.disabled ? true : false;\n that.$.browseInput.value = '';\n\n if (that.autoUpload) {\n that.uploadAll();\n }\n }", "function addFileSelectListener() {\n document.getElementById('file').addEventListener('change', function (e) {\n document.querySelector('.file-name').textContent = this.value;\n });\n }", "function fileChange() {\n\tcount++;\n\tif (count > 1) {\n\t\tvar num = count - 1;\n\t\t$(\"div#file\" + num).removeClass(\"highlightFile\");\n\t}\n\t// FileList Object existing of input with ID \"fileA\"\n\tvar fileList = document.getElementById(\"fileA\").files;\n\n\t// File Object (first element of FileList)\n\tfile = fileList[0];\n\n\tfileArr.push(file);\n\t// File Object not available = no data chosen\n\tif (!file) {\n\t\treturn;\n\t}\n\n\t$(\"div#wrapFiles\")\n\t\t\t.append(\n\t\t\t\t\t\"<div id='file\"\n\t\t\t\t\t\t\t+ count\n\t\t\t\t\t\t\t+ \"' class='singleFile' onClick='setFile(\"\n\t\t\t\t\t\t\t+ count\n\t\t\t\t\t\t\t+ \")'> <span class='fileName'></span><span class='fileSize'></span> <br> <div id='prog' class='progress-bar blue stripes'><span style='width: 0%'></span> </div> </div>\");\n\n\t$(\"div#file\" + count + \" span.fileName\").html(\"Name: \" + file.name);\n\t$(\"div#file\" + count + \" span.fileSize\").html(\"Size: \" + file.size + \"B\");\n\t$(\"div#file\" + count).addClass(\"highlightFile\");\n\n}", "function handleFile(path) {\n console.log('Dropped File: ', path);\n // Sends the file path to the Main process\n ipcRenderer.send('set-file', path);\n\n // Gets the file name only\n var file = Path.basename(path);\n\n // Hides the options to choose a file\n $('#chooseFileSection').hide();\n // Shows the preview section\n $('#previewSection').transition('fade down');\n\n // Enables the buttons\n $('#inputStepNext').removeClass('disabled');\n $('#inputStepClear').removeClass('disabled');\n\n // Clears the preview\n $('#previewHeader').empty();\n $('#previewContent').empty();\n $('#preview').removeClass('placeholder');\n\n // Sets the preview\n $('#previewHeader').append('<h3>Preview of: \\'' + file + '\\'</h3>');\n fs.readFile(path, function (err, data) {\n if (err) {\n console.log(err);\n }\n if (data) {\n $('#previewContent').append('<pre>' + data + '</pre>');\n }\n })\n}", "function handleFileChange(event) {\n file.current = event.target.files[0];\n }", "function handleFileSelect(e) {\n // Prevent default behavior (Prevent file from being opened)\n e.stopPropagation()\n e.preventDefault()\n\n var files = e.dataTransfer.files; // FileList object.\n\n // files is a FileList of File objects\n for (var file of files) {\n // Only process image files.\n if (!file.type.match('image.*')) {\n continue\n }\n if (e.currentTarget.id === 'drop_zone_photo') {\n imageManager.source = file \n }\n else {\n imageManager.traceSource = file \n }\n }\n}", "function openFileSelect() {\n // add event listener to post name of file then display data\n $('#eeg_file').change(function () {\n $.post('/upload_eeg', {eeg_file: this.value}, function() {\n displayData(0);\n fetch('/upload_eeg').then(response =>response.text()).then(text => {\n console.log(\"buffer data finished\");\n })\n });\n });\n // Opens up select file prompt\n $('#eeg_file').click();\n}", "function handleFileSelect(evt) {\r\n\tif (player)\r\n\t\tplayer.stop();\r\n evt.stopPropagation();\r\n evt.preventDefault();\r\n\tconsole.log(evt);\r\n var file = evt.path[0].files[0]; // File object.\r\n\t\tif (file.type.match('audio/wav.*')) {\r\n\t\t\tlet url = window.URL.createObjectURL(file);\r\n\t\t\t//remove tonejs interface to reload it with this sound file\r\n\t\t\tdocument.getElementById(\"Content\").innerHTML = \"\";\r\n\t\t\tdocument.getElementById(\"Content\").innerHTML += \"<div id=\\\"Sliders\\\"></div>\";\r\n\r\n\t\t\tbuildplayer(url,file.name);\r\n\t\t}else {\r\n\t\t\talert(\"This is not a suitable file type!\");\r\n\t\t\treturn -1;\r\n\t\t}\r\n}", "function handleFileSelect(evt) {\n var files = evt.target.files; // FileList object\n // Loop through the FileList and render image files as thumbnails.\n for (var i = 0, f; f = files[i]; i++) {\n\n // Only process image files.\n if (!f.type.match('image.*')) {\n continue;\n }\n\n var reader = new FileReader();\n\n // Closure to capture the file information.\n reader.onload = (function(theFile) {\n return function(e) {\n // Render thumbnail.\n var img = $(\"#imgOriginal\")[0];\n img.src = e.target.result;\n $(\"#dialogOriginal\").dialog({\n width: img.width + 10,\n heigth: img.height + 10\n });\n };\n })(f);\n\n // Read in the image file as a data URL.\n reader.readAsDataURL(f);\n }\n }", "selectDocument(event) {\n const { attachFile } = this.context;\n\n let file = null;\n if (event.target.files && event.target.files[0]) {\n file = event.target.files[0];\n this.setState({\n file: file\n }, () => attachFile(file));\n }\n }", "handleSelect(e) {\n if (e.target.files.length > 0) {\n this.setState({\n title: e.target.files[0].name,\n size: `${(e.target.files[0].size / 1024).toFixed(2)}KB`,\n });\n this.props.getUnknownFile(e.target.files);\n }\n }", "_selectedFilesClickHandler(event) {\n const that = this;\n\n if (that.disabled) {\n return;\n }\n\n const target = event.target,\n isItemUploadClicked = target.closest('.jqx-item-upload-button'),\n isItemCancelClicked = target.closest('.jqx-item-cancel-button'),\n isItemAbortClicked = target.closest('.jqx-item-pause-button'),\n clickedItem = target.closest('.jqx-file');\n\n if (isItemUploadClicked) {\n that.uploadFile(clickedItem.index);\n }\n else if (isItemCancelClicked) {\n that.cancelFile(clickedItem.index);\n }\n else if (isItemAbortClicked) {\n that.pauseFile(clickedItem.index);\n }\n }", "function handleFile(e) {\n var files;\n\n if (e.type === 'drop') {\n files = e.dataTransfer.files\n } else if (e.type === 'change') {\n files = e.target.files;\n }\n\n if (window.FileReader) {\n // FileReader is supported.\n readFile(files);\n } else {\n alertHandler.error('FileReader is not supported in this browser.');\n }\n }", "function handleFileSelect() {\n var picture = document.getElementById('picture_input').files.item(0);\n displayPicturePreview(picture);\n }", "function onSelectedFile(event)\n{\n\tfile = event.target.files[0];\n\n\tif (file && file.type == 'image/png')\n\t{\n\t\tif (file_boolean)\n\t\t\tfile_stream.src = URL.createObjectURL(file);\n\t\telse\n\t\t{\n\t\t\tfile_stream = document.createElement('img');\n\t\t\tfile_stream.src = URL.createObjectURL(file);\n\t\t\tfile_stream.setAttribute('id', 'file-stream');\n\t\t\tfile_stream.setAttribute('size', 'auto');\n\t\t\tfile_stream.setAttribute('z-index', '1');\n\t\t\tvideo.style.display = \"none\";\n\t\t\tcamera.insertBefore(file_stream, video);\n\t\t\tfile_boolean = true;\n\t\t}\n\t}\n\telse\n\t{\n\t\talert('Sorry, the extension of your file does not work, is accepted : .png');\n\t\tdocument.location.href = 'montage.php';\n\t}\n}", "function handleFile(e) {\n var files;\n\n if (e.type === 'drop') {\n files = e.dataTransfer.files\n } else if (e.type === 'change') {\n files = e.target.files;\n }\n\n if (window.FileReader) {\n // FileReader is supported.\n readFile(files);\n } else {\n alertify.alert(\"<img src='/images/cancel.png' alt='Error'>Error!\", 'FileReader is not supported in this browser.');\n }\n }", "setFileDetector() {}", "function handleFileSelect(event){\n\t\t$('#list > .row').empty(); // Empty output\n\n\t\tvar files = event.target.files; // The files\n\n\t\t// Loop through files\n\t\tfor (var i = 0, f; f = files[i]; i++){\n\t\t\t// Filter out anything but images\n\t\t\tif(!f.type.match('image.*')){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar reader = new FileReader(); // FileReader\n\n\t\t\t// Create a thumbnail for each image\n\t\t\treader.onload = (function(theFile){\n\t\t\t\treturn function(e){\n\n\t\t\t\t\t// The thumbnail\n\t\t\t\t\tvar span = '<img class=\"uploadThumb\" src=\"';\n\t\t\t\t\tspan = span.concat(e.target.result,\n\t\t\t\t\t\t\t\t\t '\" title=\"',\n\t\t\t\t\t\t\t\t\t escape(theFile.name),\n\t\t\t\t\t\t\t\t\t '\" />');\n\n\t\t\t\t\t$('#list > .row').append(span); // Append the thumbnail\n\t\t\t\t};\n\t\t\t})(f);\n\n\t\t\t// Read image\n\t\t\treader.readAsDataURL(f);\n\n\t\t}\n\t}", "selectFile(callback) {\n\t\tconst input = document.createElement('input');\n\t\tinput.type = 'file';\n\t\tinput.multiple = false;\n\t\tinput.onchange = (ev) => {\n\t\t\tconst { files } = ev.target;\n\t\t\tcallback.call(UploadFS, files[0]);\n\t\t};\n\t\t// Fix for iOS/Safari\n\t\tconst div = document.createElement('div');\n\t\tdiv.className = 'ufs-file-selector';\n\t\tdiv.style = 'display:none; height:0; width:0; overflow: hidden;';\n\t\tdiv.appendChild(input);\n\t\tdocument.body.appendChild(div);\n\t\t// Trigger file selection\n\t\tinput.click();\n\t}", "handleFilechange(event, path) {\n console.log('PdfjsViewerView: file', event, path)\n this.reloadPdf()\n }", "function inputChange(e) {\n for(var i=0;i<e.target.files.length;i++){\n model.addItem(e.target.files[i]);\n }\n previewService.previewFiles();\n }", "function selectfiles(files) {\n\t\t// now switch to the viewer\n \t//switchToViewer();\n\t // .. and start the file reading\n\t //alert(files);\n read(files);\n\t}", "function optionChanged(newsample){readFile(newsample)}", "function handleFileSelect1(evt) {\r\n\t\tevt.stopPropagation();\r\n\t\tevt.preventDefault();\r\n\r\n\t\tvar files = evt.dataTransfer.files; // FileList object.\r\n\r\n\t\tif(typeof(currentFiles.Coords) !== \"undefined\"){\r\n\t\t\tvar r = confirm(\"Override existing File?\"); // ask User\r\n\t\t\tif(r == true){\r\n\t\t\t\tconsole.log(\"Override File\");\r\n\t\t\t\t// now clear all old options from Coords- and Match-ID-Selection\r\n\t\t\t\tvar select = document.getElementById(\"xSelect\");\r\n\t\t\t\tvar select2 = document.getElementById(\"coordIDSelect\");\r\n\t\t\t\tvar select3 = document.getElementById(\"ySelect\");\r\n\t\t\t\tvar length = select.options.length; // the 2 selects should have same options\r\n\t\t\t\tfor (i = 0; i < length; i++) {\r\n\t\t\t\t select.options[0] = null;\r\n\t\t\t\t select2.options[0] = null;\r\n\t\t\t\t select3.options[0] = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tconsole.log(\"Do nothing\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// files is a FileList of File objects. List some properties.\r\n\t\tvar output = [];\r\n\t\tf = files[0];\r\n\r\n\t\toutput.push('<li><strong>', escape(f.name), '</strong> - ',\r\n\t\tf.size, ' bytes, last modified: ',\r\n\t\tf.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a','</li>');\r\n\t\tcurrentFiles.Coords = f.name;\r\n\r\n\t\tcoords_json ={};\r\n\t\tvar reader = new FileReader(); // to read the FileList object\r\n\t\treader.onload = function(event){ // Reader ist asynchron, wenn reader mit operation fertig ist, soll das hier (JSON.parse) ausgeführt werden, sonst ist es noch null\r\n\t\t\tvar columnNames = [];\r\n\t\t\tif (f.name.substr(f.name.length - 3) ===\"csv\"){ // check if filetiype is csv\r\n\t\t\t\tcurrentFiles.CoordsFileType = \"csv\";\r\n\t\t\t\tcolumnNames = getColumnNames(reader.result);\r\n\t\t\t\twindow.csv = reader.result; // temporary save reader.result into global variable, until geoJSON can be created with user-inputs\r\n\t\t\t\taskFields2(columnNames, 1);\r\n\t\t\t}\r\n\t\t\telse if (f.name.substr(f.name.length - 4) ===\"json\"){\r\n\t\t\t\tcurrentFiles.CoordsFileType = \"JSON\";\r\n\t\t\t\tcoords_json = JSON.parse(reader.result);\r\n\t\t\t\taskFields2(columnNames, 1);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\talert(\"Unrecognized Filetype. Please Check your input (only .csv or .json allowed)\");\r\n\t\t\t}\r\n\r\n\t\t\tdocument.getElementById(\"hideCoordSelection\").style.visibility = \"visible\";\r\n\t\t\tdocument.getElementById(\"choseFieldDiv1\").style.visibility = \"visible\";\r\n\t\t\tdocument.getElementById(\"renderCoordinatesButton\").style.visibility = \"visible\";\r\n\t\t\tdocument.getElementById(\"hideSelectionHolder\").style.visibility = \"visible\";\r\n\r\n\t\t\t//askFields(coords_json.features[0], 1); // only first feature is needed for property names\r\n\t\t\tdocument.getElementById(\"renderCoordinatesButton\").addEventListener('click', function(){add_zaehlstellen(coords_json);}, false);\r\n\t\t\t//console.log('added Event Listener to apply button');\r\n\t\t\t//add_zaehlstellen(coords_json);\r\n\t\t};\r\n\t\treader.readAsText(f,\"UTF-8\");\r\n\r\n\t\tdocument.getElementById('list_coords').innerHTML = '<ul style=\"margin: 0px;\">' + output.join('') + '</ul>';\r\n\t}", "function handleFileSelect() {\n // Check for the various File API support.\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n } else {\n alert('The File APIs are not fully supported in this browser.');\n }\n\n var f = event.target.files[0]; // FileList object\n var reader = new FileReader();\n\n reader.onload = function(event) {\n load_d3(event.target.result)\n };\n // Read in the file as a data URL.\n reader.readAsDataURL(f);\n}", "function getAndProcessData() { \n\t\tchooseFileSource();\n\t}", "function onFileSelection(e) {\n\tvar files = e.target.files;\n\tvar output = [];\n\ttotFileCount = files.length;\n\ttotFileLength = 0;\n\tfor (var i = 0; i < totFileCount; i++) {\n\t\tvar file = files[i];\n\t\toutput.push(file.name, ' (', file.size, ' bytes, ',\n\t\t\tfile.lastModifiedDate.toLocaleDateString(), ')');\n\t\toutput.push('<br/>');\n\t\tdebug('add ' + file.size);\n\t\ttotFileLength += file.size;\n\t}\n\tdocument.getElementById('selectedFiles').innerHTML = output.join('');\n}", "function handleFileSelect(evt) {\n var files = evt.target.files; // FileList object\n\n // Loop through the FileList and render image files as thumbnails\n for (var i = 0, f; f = files[i]; i++) {\n\n // Only process image files\n if (!f.type.match('image.*')) {\n continue;\n }\n\n var reader = new FileReader();\n\n // Closure to capture the file information.\n reader.onload = (function(theFile) {\n return function(e) {\n // Render image\n document.getElementById('event_image_preview').src = e.target.result\n };\n })(f);\n\n // Read in the image file as a data URL\n reader.readAsDataURL(f);\n }\n}", "function fileSelected(file) {\n // Clear file selection listeners\n const reportSelector = document.getElementById('report_file_input');\n reportSelector.removeEventListener('change', fileInputValueChanged);\n const dropArea = document.getElementById('drop_target');\n dropArea.removeEventListener('dragover', dragoverEvent);\n dropArea.removeEventListener('drop', dropEvent);\n document.getElementById('report_upload').hidden = true;\n document.getElementById('loading').hidden = false;\n document.getElementById('local_file').innerText = file.name;\n const fileReader = new FileReader();\n fileReader.addEventListener('load', () => {\n const statistics = JSON.parse(fileReader.result);\n document.getElementById('loading').hidden = true;\n document.getElementById('viewer').hidden = false;\n allStatistics = statistics;\n reloadStatistics();\n });\n fileReader.readAsText(file);\n}", "function onChangeDiskFile()\n\t{\n\t\tvar viDiskFile = document.getElementById(\"viDiskFile\");\n\t\tif(viDiskFile.value != \"\")\n\t\t{\n\t\t\t//Notifying that user has selected a File to upload\n\t\t\tflexApplication.virtualImageFileSelected(viDiskFile.value);\n\t\t}\n\t}", "function fileChoose(e) {\n\t\n\tdocument.getElementById(\"uploadFile\").click();\n}", "function handleFileSelect(evt) {\n let files = evt.target.files; // FileList object\n \n // Loop through the FileList and render image files as thumbnails.\n for (var i = 0, f; f = files[i]; i++) {\n // Only process image files.\n if (!f.type.match('image.*')) {\n continue;\n }\n let reader = new FileReader();\n \n // Closure to capture the file information.\n reader.onload = (function(theFile) {\n return function(event) {\n // Render thumbnail.\n let span = document.createElement('span');\n span.innerHTML = ['<img class=\"thumb\" src=\"', event.target.result,\n '\" title=\"', escape(theFile.name), '\"/>'].join('');\n document.getElementById('list').insertBefore(span, null);\n $('#add-post-container .input-field').find('#button').addClass('button-image');\n $('#add-post-container .input-field').find('#description-span').addClass('image-span');\n let $inputContent = $('#first_name').val();\n if ($inputContent && $('#files').val()) {\n $publishButton.removeAttr('disabled');\n } else {\n $publishButton.attr('disabled', true);\n } \n };\n })(f);\n \n // Read in the image file as a data URL.\n reader.readAsDataURL(f);\n }\n }", "function open_dir(dir){\r\n $('body').addClass('loading');\r\n manager.get_dir(dir,function(files){\r\n \r\n global.total_selected=0;\r\n $('#edit').hide();\r\n html='';\r\n for(var i=0;i<files.length;i++){\r\n html+='<div data-file=\"'+files[i].rel_filename+'\" class=\"file '+files[i].type+'\"'+\r\n 'title=\"'+files[i].filename+'\" data-i=\"'+i+'\" data-type=\"'+files[i].type+'\">'+\r\n '<div class=\"icon\"><i class=\"fa fa-'+files[i].icon+'\"></i></div>'+\r\n '<div class=\"name\">'+files[i].filename+'</div>'+\r\n '<div class=\"type\">'+files[i].type+'</div>'+\r\n '<div class=\"filedate\" data-date=\"'+files[i].modified_timestamp+'\">'+files[i].date+'</div>'+\r\n '<div class=\"filesize\" data-size=\"'+files[i].raw_size+'\">'+files[i].filesize+'</div>'+\r\n '</div>';\r\n }\r\n $('.file').remove();\r\n $('#files').html(html);\r\n $('#info').text(files.length+' file(s)');\r\n\r\n //remove selection\r\n $('#files').off('click').on('click',function(event) { \r\n if(!$(event.target).closest('.file').length) {\r\n $('.selected').removeClass('selected');\r\n $('#info').text(files.length+' file(s)');\r\n $('#edit').hide();\r\n } \r\n })\r\n\r\n //select files\r\n $('.file').on('click',function(e){\r\n var index=parseInt($(this).data('i')),\r\n text='';\r\n \r\n if(!e.ctrlKey){\r\n if($(this).hasClass('selected')) return; //kill if already selected\r\n $('.selected').removeClass('selected');\r\n }\r\n if(e.shiftKey){ //select multiples\r\n\r\n if(index > global.last_selected){\r\n while(index >= global.last_selected){\r\n $('.file[data-i=\"'+index+'\"]').addClass('selected');\r\n index--;\r\n }\r\n }\r\n else{\r\n while(index <= global.last_selected){\r\n $('.file[data-i=\"'+index+'\"]').addClass('selected');\r\n index++;\r\n }\r\n }\r\n $(this).addClass('selected');\r\n global.total_selected=$('.selected').length;\r\n\r\n text=global.total_selected+' files selected';\r\n }\r\n else if(e.ctrlKey){\r\n if($(this).hasClass('selected'))\r\n $(this).removeClass('selected');\r\n else\r\n $(this).addClass('selected');\r\n global.total_selected=$('.selected').length;\r\n text=global.total_selected+' files selected';\r\n }\r\n else{ //deselect everything except this one\r\n global.last_selected=index;\r\n $(this).addClass('selected');\r\n global.total_selected=1;\r\n console.log(manager.files[index]);\r\n text=manager.files[index].rel_filename;\r\n if(manager.files[index].type!=='dir')\r\n text+=' - Size:'+manager.files[index].filesize;\r\n text+=' - Modified:'+manager.files[index].modified;\r\n }\r\n $('#info').text(text);\r\n \r\n if(global.total_selected === 1){\r\n $('#edit .single').show();\r\n }\r\n else{\r\n $('#edit .single').hide();\r\n }\r\n if(global.total_selected > 0){\r\n $('#edit').show();\r\n }\r\n else{\r\n $('#edit').hide();\r\n }\r\n });\r\n \r\n //open the file\r\n $('.file[data-type!=\"dir\"]').on('dblclick',function(){\r\n var index=$(this).data('i');\r\n if(typeof index==='undefined')return;\r\n var file=manager.files[index];\r\n $('#image').html('');\r\n $('#text textarea').html('');\r\n manager.get_file(index,function(file){\r\n if(!file){\r\n error('This type of file is not permitted.');\r\n }\r\n else{\r\n console.log(file);\r\n $('#image').hide();\r\n $('#text').hide();\r\n $('#iframe').hide();\r\n if(file.action=='view'){\r\n if(file.type==='jpg' || file.type==='gif' || file.type==='png'){\r\n $('#image').html('<img src=\"'+global.base_url+file.rel_filename+'\">');\r\n $('#image').show();\r\n lightbox.show(file.filename);\r\n }\r\n else{\r\n console.log(global.base_url+encodeURIComponent(file.rel_filename));\r\n window.open(global.base_url+encodeURIComponent(file.rel_filename));\r\n //$('#iframe iframe').attr('src',global.base_url+encodeURIComponent(file.rel_filename));\r\n }\r\n }\r\n else if(file.action=='edit'){\r\n $('#text textarea').text(file.contents);\r\n $('#text').show();\r\n lightbox.show(file.filename);\r\n }\r\n else{\r\n $('#iframe iframe').attr('src','download.php?file='+encodeURIComponent(file.rel_filename));\r\n }\r\n }\r\n });\r\n \r\n });\r\n\r\n $('.dir').on('dblclick',function(){open_dir($(this).data('file'));});\r\n\r\n manager.get_breadcrumbs(function(nav){\r\n html='';\r\n for(var i=0;i<nav.length;i++){\r\n html+='<li><a data-path=\"'+nav[i].rel_path+'\">'+nav[i].name+'</a></li>';\r\n }\r\n $('.breadcrumb li').remove();\r\n $('.breadcrumb').html(html);\r\n $('.breadcrumb li a').on('click',function(){open_dir($(this).data('path'));});\r\n $('body').removeClass('loading');\r\n });\r\n });\r\n //window.location.href=window.location.origin+window.location.pathname+'?dir='+$(this).data('file');\r\n}", "handleFileActivate(event, file) {\n // Disable file editing if the file has not finished uploading\n // or the upload has errored.\n if (file.created === null) {\n return;\n }\n\n this.props.onOpenFile(file.id, file);\n }", "function selectFile($files){\n \t File.upload($files);\n \t}", "function initFileSelection() {\n // If there is an entry, set the pointer to the first entry.\n if (filelist.children.length > 0) { // If there is at least one entry…\n pointer = 0; // … set the pointer to the first item.\n }\n\n // Populate slots.\n initSlots();\n\n // Set the event listener.\n addEventListener('keydown', keyListener, false);\n}", "function loadFile(e){\n if (!e) e = window.event;\n var target = (e.target || e.srcElement);\n \n $.get(\"text-file-management.php?request=loadFile&file=\"+target.firstChild.nodeValue, loadFileCallback);\n \n hideFilesDropdown();\n}", "handleSelect(event){\n const selected = event.detail.name;\n this.selectedItem = selected; \n if(selected == 'upload'){\n this.uploadFileModal = true;\n }else { \n this.uploadFileModal = false;\n }\n if(selected == 'isNewfolder'){\n this.closedModel = true;\n }else{\n this.closedModel = false;\n } \n }", "fileSelected(event) {\n let reader = new FileReader();\n this.fileInput = event.target;\n let filename = event.target.value;\n let file = event.target.files[0];\n\n reader.onloadend = () => {\n this.setState({\n currentFile: file,\n currentFilename: filename\n });\n };\n\n reader.readAsDataURL(file);\n }", "function onFileSelected(e)\n\t{\n\t\t//console.log(e.target.files);\n\n\t\tvar files = e.target.files;\n\t\tfor (var i = 0; i < files.length; i++) \n\t\t{\n\t\t\tfile = files[i];\n\t\t\tuploaders.push(new ChunkedUploader(file));\n\t\t\tfile_list.append('<li>' + files[i].name + '(' + files[i].size.formatBytes() + ') <button class=\"pausebutton\" style=\"display:none\">Pause</button> </li>');\n\t\t}\n\n\t\tfile_list.find('button').on('click', onPauseClick);\n\t\tfile_list.show();\n\t\tsubmit_btn.attr('disabled', false);\n\t}", "function handleFileSelect(evt) {\n $('#export').show();\n $(\"#current_map\").empty();\n\n var files = evt.target.files; // FileList object\n\n // Loop through the FileList and render image files as thumbnails.\n for (var i = 0, f; f = files[i]; i++) {\n\n // Only process image files.\n if (!f.type.match('image.*')) {\n continue;\n }\n\n var reader = new FileReader();\n\n // Closure to capture the file information.\n reader.onload = (function (theFile) {\n return function (e) {\n $(\"#current_map\").append(['<img id=\"map\" class=\"get_coord\" src=\"', e.target.result, '\" title=\"', escape(theFile.name), '\" style=\"position:relative; width:600px;\"/>'].join(''));\n Datos.imagen = e.target.result;\n //console.log(Datos);\n $('#input_add_image').hide();\n $('#importar').css(\"display\", \"none\"); \n };\n })(f);\n\n // Read in the image file as a data URL.\n reader.readAsDataURL(f);\n }\n }", "function selectFile(file, prompt){\n\n\tprompt = (prompt == null) ? detectType(file) : prompt;\n\t\n\tswitch(method){\n\t\tcase 'mce'\t\t\t: parent.opener.insertRichEditor(field, '<img src=\"'+file+'\" />');\tbreak;\n\t\tcase 'sort'\t\t\t: parent.opener.mediaInsert(field, prompt+'@@'+file, 'sort'); \t\tbreak;\n\t\tcase 'sort-embed'\t: parent.mediaInsert(field, prompt+'@@'+file, 'sort'); \t\tbreak;\n\n\t//\tcase 'fck'\t\t\t: parent.opener.insertContent('<img src=\\\"'+file+'\\\" border=\\\"0\\\" alt=\\\"\\\" />', field); break;\n\t//\tcase 'multiline'\t: parent.opener.document.getElementById(field).value += prompt + file+\"\\n\"; break;\n\n\t\tcase 'line'\t\t\t: fld = parent.opener.document.getElementById(field);\n\t\t\t\t\t\t\t fld.value = file;\n\t\t\t\t\t\t\t fld.fireEvent('change', fld);\n\t\t\t\t\t\t\t break;\n\n\t\tcase 'editable'\t\t: parent.opener.editable.imageBack(file);\n\n\t//\tdefault\t\t\t\t: log_('Insert : '+ file);\n\t}\n}", "function browse() {\r\n\r\n}", "function onFilenameTemplateChange() {\n\tvar template = dlgMain.grpFilenameTemplate.field.text;\n\tvar filename = processFilenameTemplate(template, 'version');\n\tdlgMain.grpFilenamePreview.field.text = filename;\n}", "function fileChanged(){\n \n // default: fit result to screen\n $('input[name=fitToScreen]').attr('checked', true);\n fitted = true;\n \n filechanged = true;\n \n // get filename\n\tvar value = $('#fileSelection').val();\n\t\t\n // manage settings \n\tif(value != \"donothing\"){\n\t\t\n\t\treceiveCanvasContent(value);\n\t\t$('#visTag').show();\n\t\t$('#visSelect').show();\n\t\t$('#saveButton').show();\n $('#fitToScreen').show();\n $('#ftsTag').show();\n\t\t\n // manage settings dialog\n manageSettings($('#visSelect').val());\n \n receiveChanges();\n\t}\n \n // display choose dialog for available probands\n manageProbands($('#fileSelection').find('option:selected').attr('count'), true);\n}", "function assignmentsFileSelected() {\n\tvar idx = assignmentsGetCurrentIdx();\n\tif (idx == -1) return;\n\t\n\tvar filesSelect = document.getElementById(\"filesSelect\");\n\tvar currentFile = filesSelect.options[filesSelect.selectedIndex].value;\n\t\n\tfor (var j=0; j<assignments[idx].files.length; j++) {\n\t\tif (assignments[idx].files[j].filename == currentFile) {\n\t\t\t//document.getElementById('fileName').value = assignments[idx].files[j].filename;\n\t\t\tvar span = document.getElementById('fileNameSpan');\n\t\t\twhile( span.firstChild ) {\n\t\t\t\tspan.removeChild( span.firstChild );\n\t\t\t}\n\t\t\tspan.appendChild( document.createTextNode(assignments[idx].files[j].filename) );\n\t\t\t\n\t\t\tdocument.getElementById('fileBinary').checked = assignments[idx].files[j].binary;\n\t\t\tdocument.getElementById('fileShow').checked = assignments[idx].files[j].show;\n\t\t}\n\t}\n\t\n\tdocument.getElementById('assignmentChangeMessage').style.display='none';\n\tdocument.getElementById('uploadFileWrapper').style.display='none';\n}", "function sfmb_select(cp_selected){\n if (cp_selected.length != 1) return false; // Make sure we only have one selected\n\n var l = $(cp_selected[0]);\n var link = l.find('.action .link a');\n var file;\n if(!l.hasClass('file')) {file = getDirFromUrl(link.attr('href'));}\n else {file = link.attr('href');}\n // Do something with file\n var window_manager = parent.window.opener.window_manager;\n window_manager.callback(file);\n}", "function handleFileBrowse(evt){\n\tvar files = evt.target.files;\n\t\n\tvar output = [];\n\tfor (var i=0, f; f = files[i]; i++){\n\t\t//build the HTML list output\n\t\toutput.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',\n\t\tf.size, ' bytes, last modified: ',\n\t\tf.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a', '</li>');\n\t};\n\tdocument.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';\n}", "addFileX(event) {\n let aFile = event.target.files[0];\n if (aFile.type === \"text/plain\"){\n this.files[0] = aFile;\n } \n }", "function handleFiles(files){\r\n\tclearSeed();\r\n\tsetAnimationFunction();\r\n\tdisableShare();\r\n\tif(files){\r\n\t\tuploadedSVG = files[0];\r\n\t\tsimSVG = files[0];\r\n\t\tdocument.title = files[0].name;\r\n\t}else{\r\n\t\tuploadedSVG = simSVG;\r\n\t\tdocument.title = simSVG.name;\r\n\t}\r\n\tpathIsText = false;\r\n\trestart = true;\r\n}", "function handleFiles() {\n // The file list from input, currently a single item since multiple upload is disallowed.\n fileList = Array.from(this.files);\n let blob = fileList[0];\n let videoUrl = window.URL.createObjectURL(blob);\n previewVideo.src = videoUrl;\n\n // Display a preview of the selected file and the button for upload confirmation.\n document.querySelector('.filename-preview').innerHTML = fileList[0].name;\n previewPanel.setAttribute('style', 'display: block');\n}", "function handleFileSelect(evt) {\n // Get the file\n var files = evt.target.files; // FileList object\n\n // Call the parse method\n var xl2json = new ExcelToJSON();\n xl2json.parseExcel(files[0]);\n}", "handleFile(evt) {\n const fileInput = this.shadowRoot.querySelector('[type=\"file\"]');\n const label = this.shadowRoot.querySelector(\"[data-js-label]\");\n let preview = this.shadowRoot.querySelector(\".file-preview img\");\n let reader = new FileReader(); // console.log(preview.src);\n\n reader.onload = function () {\n preview.src = reader.result;\n };\n\n reader.readAsDataURL(evt.target.files[0]);\n\n fileInput.onmouseout = function () {\n if (!fileInput.value) return;\n let value = fileInput.value.replace(/^.*[\\\\\\/]/, \"\"); // console.log(this.getFileExtension(value))\n // el.className += ' -chosen'\n\n label.innerText = value;\n };\n\n this.uploadFile(fileInput);\n }", "selectFile(file) {\n let [{ id }] = findElementWithAssert(this);\n let renderedInstance = this.context.container.lookup('-view-registry:main')[id];\n\n let mockEvent = { target: { files: [file] } };\n renderedInstance.change(mockEvent);\n }", "function handleFileSelect(evt) {\n evt.stopPropagation();\n evt.preventDefault();\n evt.srcElement.classList.remove(\"dragover\");\n\n var files = evt.dataTransfer.files; // FileList object.\n\n var ul = document.createElement(\"ul\");\n\n const promises = [];\n const zip = new Zip();\n\n //FIXME: support font-size\n Array.prototype.forEach.call(files, function(file) {\n promises.push(\n file.text().then(text => {\n let ttml = new Ttml(text);\n zip.file(\n `${file.name.replace(/\\.ttml$/, \"\")}.srt`,\n Srt.parse(ttml.tokenize())\n );\n })\n );\n\n let li = document.createElement(\"li\");\n let strong = document.createElement(\"strong\");\n strong.innerText = file.name;\n let text = document.createTextNode(\"\");\n text.textContent = ` (${file.type || \"n/a\"}) - ${\n file.size\n } bytes, last modified: ${\n file.lastModifiedDate ? file.lastModifiedDate.toLocaleDateString() : \"n/a\"\n }`;\n li.append(strong, text);\n ul.appendChild(li);\n });\n\n Promise.all(promises)\n .then(() => {\n zip.generateAsync({ type: \"blob\" }).then(function(content) {\n // see FileSaver.js\n saveAs(content, window.location.host + \".zip\");\n });\n })\n .catch(e => {\n // Handle errors here\n });\n\n document.getElementById(\"list\").appendChild(ul);\n}", "onOk(){\n var view = this.insideFrame().childViewByType('View')\n var path = view.childWidgetByType('Tree').getSelectionPath()\n path.push(this.fileName)\n this.onRenameFile(path)\n }" ]
[ "0.7215183", "0.7182604", "0.71252555", "0.71106064", "0.70418435", "0.7032427", "0.7028404", "0.7027565", "0.6983275", "0.6959631", "0.6896054", "0.6891452", "0.68791944", "0.6874909", "0.68583596", "0.68463135", "0.68230844", "0.67484", "0.67197675", "0.67115265", "0.6675053", "0.6659839", "0.6648227", "0.664195", "0.6633492", "0.65987015", "0.6561311", "0.6548484", "0.6534748", "0.65261286", "0.65197676", "0.6490137", "0.64873344", "0.64858425", "0.6481813", "0.646358", "0.6421449", "0.6397488", "0.6391912", "0.63832706", "0.6358471", "0.63462055", "0.63286424", "0.631691", "0.6316232", "0.63117546", "0.6302777", "0.6289393", "0.62542516", "0.62483984", "0.6221149", "0.62108344", "0.62083095", "0.618599", "0.61665374", "0.6157263", "0.6155401", "0.6137002", "0.6135784", "0.61339086", "0.6118376", "0.611271", "0.6110762", "0.61069274", "0.6087374", "0.60830957", "0.6079611", "0.6079462", "0.6073809", "0.6069842", "0.6066428", "0.6061139", "0.6055764", "0.6030526", "0.59954643", "0.59945977", "0.5991639", "0.59840447", "0.5973325", "0.59665644", "0.5966472", "0.5958355", "0.5957131", "0.5957105", "0.59563494", "0.5950411", "0.5949278", "0.59456664", "0.5936543", "0.59359807", "0.5928613", "0.5928481", "0.59180975", "0.59098756", "0.5907122", "0.5906569", "0.59060085", "0.5905911", "0.5902562", "0.5893992", "0.5891202" ]
0.0
-1
var colors = new Colors();
function GetAxiomTree() { var Waxiom = rules.axiom; var newf = rules.mainRule; var newb = 'bb'; var newx = rules.Rule2; var level = params.iterations; while (level > 0) { var m = Waxiom.length; var T = ''; for (var j=0; j < m; j++) { var a = Waxiom[j]; if (a == 'F'){T += newf;} else if (a == 'b'){T += newb;} else if (a == 'X'){T += newx;} else T += a; } Waxiom = T; level--; } return Waxiom; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Color() {}", "constructor(color){\n this.color = color\n }", "constructor() {\n\t\tthis.colors = ['red', 'pink', 'green', 'blue', 'yellow', 'purple', 'grey'];\n\t}", "function Color() { }", "constructor(coloring = []){\n this._coloring = coloring;\n }", "function Colour(rgb) {\n this.rgb = rgb;\n}", "constructor(white, red, green, blue) {\n this.white = white;\n this.red = red;\n this.green = green;\n this.blue = blue;\n }", "function ColorList() {}", "addColorToObject(){\n let color = new Color(this.colorID)\n this.colors[this.colorID] = color\n this.colorID++\n }", "function Color() {\n var self = this;\n\n // _data maps channel names to their current state\n this._values = {};\n $.each(CHANNELS, function(key) {\n self._values[key] = 0;\n });\n}", "function Color() {\n\t//only one can be true at a time\n\tthis.BLUE = false;\n\tthis.RED = false;\n\tthis.GREEN = false;\n\tthis.setBLUE = function () {this.BLUE = true; this.RED = false; this.GREEN = false; };\n\tthis.setRED = function () {this.BLUE = false; this.RED = true; this.GREEN = false; };\n\tthis.setGREEN = function () {this.BLUE = false; this.RED = false; this.GREEN = true; };\n\tthis.setNO_COLOR = function () {this.BLUE = false; this.RED = false; this.GREEN = false; };\n\tthis.equals = function (other) {if (this.BLUE === other.BLUE && this.RED === other.RED && this.GREEN === other.GREEN) {return true; } else {return false; } };\n}", "function SuperType(){\n this.colors=[\"red\",\"blue\",\"green\"]\n}", "function RGBConstructor(rgb)\n{\n this.rgb = rgb;\n}", "function SuperSteal(){\n this.color = [\"red\", \"blue\", \"green\"]\n}", "function SuperType(){\n this.colors = [\"red\", \"blue\", \"green\"];\n}", "function Shape(color){\n this.color= color\n}", "constructor (color) {\n this.color = color\n this.shouldDraw = true\n }", "static get color() {\n\t\treturn colorNames;\n\t}", "function Shape(color) {\n this.color = color;\n}", "function carConstructor(color){\n this.color = color;\n}", "constructor()\n {\n //The base constructor is called\n super(\"Game Over\");\n //Color created\n this.color = \"rgb(240,100,150)\";\n }", "set colors(colors) {\n this._colors = colors;\n }", "function getColors()\n {\n return colors;\n }", "function Color(r, g, b) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n /*\r\n this.rgb = function () {\r\n const { r, g, b } = this;\r\n return `rgb(${r}, ${g}, ${b})`;\r\n }; // gets added to object not prototype\r\n */\r\n}", "set_colors()\r\n {\r\n /* colors */\r\n let colors = [\r\n Color.of( 0.9,0.9,0.9,1 ), /*white*/\r\n Color.of( 1,0,0,1 ), /*red*/\r\n Color.of( 1,0.647,0,1 ), /*orange*/\r\n Color.of( 1,1,0,1 ), /*yellow*/\r\n Color.of( 0,1,0,1 ), /*green*/\r\n Color.of( 0,0,1,1 ), /*blue*/\r\n Color.of( 1,0,1,1 ), /*purple*/\r\n Color.of( 0.588,0.294,0,1 ) /*brown*/\r\n ]\r\n\r\n this.boxColors = Array();\r\n for (let i = 0; i < 8; i++ ) {\r\n let randomIndex = Math.floor(Math.random() * colors.length);\r\n this.boxColors.push(colors[randomIndex]);\r\n colors[randomIndex] = colors[colors.length-1];\r\n colors.pop();\r\n }\r\n\r\n }", "get color() {\n\n\t}", "function Car() {\n this.color = \"color\";\n}", "function Color(r, g, b) {\n this.r = r;\n this.g = g;\n this.b = b;\n}", "function Color(red_, green_, blue_) {\n\t\t\tthis.blue = blue_;\n\t\t\tthis.green = green_;\n\t\t\tthis.red = red_;\n\t\t}", "get color() {}", "static get nice () {\n\n if (Colors.niceReady === undefined) {\n Colors.niceReady = true\n\n Colors.names.forEach (k => {\n if (!(k in String.prototype)) {\n O.defineProperty (String.prototype, k, { get: function () { return Colors[k] (this) } })\n }\n })\n }\n\n return Colors\n }", "function setEnumColor() {\n\tBLUE = new Color();\n\tGREEN = new Color();\n\tRED = new Color();\n\tGREEN = new Color();\n\tNO_COLOR = new Color();\n\tBLUE.setBLUE();\n\tRED.setRED();\n\tGREEN.setGREEN();\n\tNO_COLOR.setNO_COLOR();\n\tconsole.log(\"Different colours created used for creating Enum\");\n}", "function colorFactory(name) {\n return new Color(name);\n }", "constructor(x, y, color) {\r\n this.x = x;\r\n this.y = y;\r\n this.color = color;\r\n }", "constructor(name) { //default color parameter\n this.name = name; //this unicorn is instantiated with a name\n this.statues = [];\n }", "constructor(...args) {\n this.r = 0;\n this.g = 0;\n this.b = 0;\n this.a = 255;\n /* Handle Color([...]) -> Color(...) */\n if (args.length == 1 && args[0] instanceof Array) {\n args = args[0];\n }\n if (args.length == 1) {\n /* Handle Color(Color) and Color(\"string\") */\n let arg = args[0];\n if (arg instanceof Color) {\n [this.r, this.g, this.b, this.a] = [arg.r, arg.g, arg.b, arg.a];\n this.scale = arg.scale;\n } else if (typeof(arg) == \"string\" || arg instanceof String) {\n let [r, g, b, a] = ColorParser.parse(arg);\n [this.r, this.g, this.b, this.a] = [r, g, b, a];\n } else {\n throw new TypeError(`Invalid argument \"${arg}\" to Color()`);\n }\n } else if (args.length >= 3 && args.length <= 4) {\n /* Handle Color(r, g, b) and Color(r, g, b, a) */\n [this.r, this.g, this.b] = args;\n if (args.length == 4) this.a = args[3];\n } else if (args.length > 0) {\n throw new TypeError(`Invalid arguments \"${args}\" to Color()`);\n }\n }", "setColor(c){\n\t\tthis.color=c;\n\t}", "constructor(matrix, colors) {\n this.matrix = matrix; // double array of integers (=indices of colors array)\n this.colors = colors; // array of Color objects\n this.numRows = matrix.length;\n this.numCols = matrix[0].length;\n //canvasUtil.println(`created new ColorMatrix with size ${this.numRows} x ${this.numCols} and ${this.colors.length} colors`);\n }", "function ColorIntensityPalette() {\n this.positive = [255, 0, 0];\n this.neutral = [200, 200, 200];\n this.negative = [0, 93, 144];\n\n this.rgb = function(color) {\n rgb = \"rgb(\" + \n color[0] + \",\" +\n color[1] + \",\" +\n color[2] + \")\";\n return rgb;\n }\n\n this.str = function(intensity) {\n if (intensity > 0) {\n var top_color = this.positive;\n } else {\n var top_color = this.negative;\n intensity = -intensity;\n }\n\n s = \"rgb(\";\n for (var i=0; i<3; i++) {\n diff = top_color[i] - this.neutral[i];\n s += Math.floor(this.neutral[i] + diff*intensity);\n if (i < 2) {\n s += \",\"\n }\n }\n s += \")\"\n return s;\n }\n}", "constructor(peso, color){ //propiedades\n this.peso= peso;\n this.color=color;\n }", "colors() {\n return ['#B1BCBC', '#3ACF80', '#70F2F2', '#B3F2C9', '#528C18', '#C3F25C']\n }", "constructor() {\n this.red = null;\n this.green = null;\n this.blue = null;\n this.x = null;\n this.y = null;\n this.brightness = null;\n this.hue = null;\n this.saturation = null;\n this.temperature = null;\n this.originalColor = null;\n }", "function Person(name, color) {\n this.name = name;\n this.color = color;\n}", "constructor(color, material)\n {\n this._color = color;\n this._material = material;\n }", "getColor(){\n\t\treturn this.color;\n\t}", "function SuperType(name){\nthis.name = name;\nthis.colors = [\"red\", \"blue\", \"green\"];\n}", "function CategoryColors() {\n this.colors = {};\n _.each(categoryColors, function(c) {\n this.colors[c] = null;\n }, this);\n}", "function Colour(){\n\n /* Returns an object representing the RGBA components of this Colour. The red,\n * green, and blue components are converted to integers in the range [0,255].\n * The alpha is a value in the range [0,1].\n */\n this.getIntegerRGB = function(){\n\n // get the RGB components of this colour\n var rgb = this.getRGB();\n\n // return the integer components\n return {\n 'r' : Math.round(rgb.r),\n 'g' : Math.round(rgb.g),\n 'b' : Math.round(rgb.b),\n 'a' : rgb.a\n };\n\n };\n\n /* Returns an object representing the RGBA components of this Colour. The red,\n * green, and blue components are converted to numbers in the range [0,100].\n * The alpha is a value in the range [0,1].\n */\n this.getPercentageRGB = function(){\n\n // get the RGB components of this colour\n var rgb = this.getRGB();\n\n // return the percentage components\n return {\n 'r' : 100 * rgb.r / 255,\n 'g' : 100 * rgb.g / 255,\n 'b' : 100 * rgb.b / 255,\n 'a' : rgb.a\n };\n\n };\n\n /* Returns a string representing this Colour as a CSS hexadecimal RGB colour\n * value - that is, a string of the form #RRGGBB where each of RR, GG, and BB\n * are two-digit hexadecimal numbers.\n */\n this.getCSSHexadecimalRGB = function(){\n\n // get the integer RGB components\n var rgb = this.getIntegerRGB();\n\n // determine the hexadecimal equivalents\n var r16 = rgb.r.toString(16);\n var g16 = rgb.g.toString(16);\n var b16 = rgb.b.toString(16);\n\n // return the CSS RGB colour value\n return '#'\n + (r16.length == 2 ? r16 : '0' + r16)\n + (g16.length == 2 ? g16 : '0' + g16)\n + (b16.length == 2 ? b16 : '0' + b16);\n\n };\n\n /* Returns a string representing this Colour as a CSS integer RGB colour\n * value - that is, a string of the form rgb(r,g,b) where each of r, g, and b\n * are integers in the range [0,255].\n */\n this.getCSSIntegerRGB = function(){\n\n // get the integer RGB components\n var rgb = this.getIntegerRGB();\n\n // return the CSS RGB colour value\n return 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')';\n\n };\n\n /* Returns a string representing this Colour as a CSS integer RGBA colour\n * value - that is, a string of the form rgba(r,g,b,a) where each of r, g, and\n * b are integers in the range [0,255] and a is in the range [0,1].\n */\n this.getCSSIntegerRGBA = function(){\n\n // get the integer RGB components\n var rgb = this.getIntegerRGB();\n\n // return the CSS integer RGBA colour value\n return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + rgb.a + ')';\n\n };\n\n /* Returns a string representing this Colour as a CSS percentage RGB colour\n * value - that is, a string of the form rgb(r%,g%,b%) where each of r, g, and\n * b are in the range [0,100].\n */\n this.getCSSPercentageRGB = function(){\n\n // get the percentage RGB components\n var rgb = this.getPercentageRGB();\n\n // return the CSS RGB colour value\n return 'rgb(' + rgb.r + '%,' + rgb.g + '%,' + rgb.b + '%)';\n\n };\n\n /* Returns a string representing this Colour as a CSS percentage RGBA colour\n * value - that is, a string of the form rgba(r%,g%,b%,a) where each of r, g,\n * and b are in the range [0,100] and a is in the range [0,1].\n */\n this.getCSSPercentageRGBA = function(){\n\n // get the percentage RGB components\n var rgb = this.getPercentageRGB();\n\n // return the CSS percentage RGBA colour value\n return 'rgb(' + rgb.r + '%,' + rgb.g + '%,' + rgb.b + '%,' + rgb.a + ')';\n\n };\n\n /* Returns a string representing this Colour as a CSS HSL colour value - that\n * is, a string of the form hsl(h,s%,l%) where h is in the range [0,100] and\n * s and l are in the range [0,100].\n */\n this.getCSSHSL = function(){\n\n // get the HSL components\n var hsl = this.getHSL();\n\n // return the CSS HSL colour value\n return 'hsl(' + hsl.h + ',' + hsl.s + '%,' + hsl.l + '%)';\n\n };\n\n /* Returns a string representing this Colour as a CSS HSLA colour value - that\n * is, a string of the form hsla(h,s%,l%,a) where h is in the range [0,100],\n * s and l are in the range [0,100], and a is in the range [0,1].\n */\n this.getCSSHSLA = function(){\n\n // get the HSL components\n var hsl = this.getHSL();\n\n // return the CSS HSL colour value\n return 'hsl(' + hsl.h + ',' + hsl.s + '%,' + hsl.l + '%,' + hsl.a + ')';\n\n };\n\n /* Sets the colour of the specified node to this Colour. This functions sets\n * the CSS 'color' property for the node. The parameter is:\n *\n * node - the node whose colour should be set\n */\n this.setNodeColour = function(node){\n\n // set the colour of the node\n node.style.color = this.getCSSHexadecimalRGB();\n\n };\n\n /* Sets the background colour of the specified node to this Colour. This\n * functions sets the CSS 'background-color' property for the node. The\n * parameter is:\n *\n * node - the node whose background colour should be set\n */\n this.setNodeBackgroundColour = function(node){\n\n // set the background colour of the node\n node.style.backgroundColor = this.getCSSHexadecimalRGB();\n\n };\n\n}", "constructor(colors) {\n this.colors = colors;\n this.divider = \"-------------------------------------------------------------------------------------------------------------------------\";\n }", "function SuperType(name){\n this.name = name\n this.colors = [\"red\",\"blue\",\"green\"]\n}", "newColors(){\n for (let i = 0; i < this.colorCount; i++) {\n this.addColorToObject()\n }\n this.updateGradientString()\n }", "function makeColors() {\n colors.push([\"rgb(205,230,245)\",\"rgb(141,167,190)\"])\n colors.push([\"rgb(24,169,153)\",\"rgb(72,67,73)\"])\n colors.push([\"rgb(24,169,153)\",\"rgb(242,244,243)\"])\n colors.push([\"rgb(237,242,244)\",\"rgb(43,45,66)\"])\n colors.push([\"rgb(192,248,209)\",\"rgb(189,207,181)\"])\n colors.push([\"rgb(141,177,171)\",\"rgb(88,119,146)\"])\n colors.push([\"rgb(80,81,104)\",\"rgb(179,192,164)\"])\n colors.push([\"rgb(34,34,34)\",\"rgb(99,159,171)\"])\n}", "get color() {\n\t\treturn this.__color;\n\t}", "constructor(color){\n this.model = \"bmw\"\n this.color = color\n this.year = 2019\n\n }", "function Color(red, green, blue, alpha) {\n var maxArgs = 4;\n var delegate = arguments.length > maxArgs ?\n arguments[maxArgs] \n : arguments.length === 4 ? new javaClass(B.boxAsJava(red), B.boxAsJava(green), B.boxAsJava(blue), B.boxAsJava(alpha))\n : arguments.length === 3 ? new javaClass(B.boxAsJava(red), B.boxAsJava(green), B.boxAsJava(blue))\n : arguments.length === 2 ? new javaClass(B.boxAsJava(red), B.boxAsJava(green))\n : arguments.length === 1 ? new javaClass(B.boxAsJava(red))\n : new javaClass();\n\n Object.defineProperty(this, \"unwrap\", {\n configurable: true,\n value: function() {\n return delegate;\n }\n });\n if(Color.superclass)\n Color.superclass.constructor.apply(this, arguments);\n delegate.setPublished(this);\n this.GRAY = new Object();\n Object.defineProperty(this, \"GRAY\", {\n get: function() {\n var value = delegate.GRAY;\n return B.boxAsJs(value);\n }\n });\n\n this.WHITE = new Object();\n Object.defineProperty(this, \"WHITE\", {\n get: function() {\n var value = delegate.WHITE;\n return B.boxAsJs(value);\n }\n });\n\n this.BLUE = new Object();\n Object.defineProperty(this, \"BLUE\", {\n get: function() {\n var value = delegate.BLUE;\n return B.boxAsJs(value);\n }\n });\n\n this.GREEN = new Object();\n Object.defineProperty(this, \"GREEN\", {\n get: function() {\n var value = delegate.GREEN;\n return B.boxAsJs(value);\n }\n });\n\n this.RED = new Object();\n Object.defineProperty(this, \"RED\", {\n get: function() {\n var value = delegate.RED;\n return B.boxAsJs(value);\n }\n });\n\n this.PINK = new Object();\n Object.defineProperty(this, \"PINK\", {\n get: function() {\n var value = delegate.PINK;\n return B.boxAsJs(value);\n }\n });\n\n this.LIGHT_GRAY = new Object();\n Object.defineProperty(this, \"LIGHT_GRAY\", {\n get: function() {\n var value = delegate.LIGHT_GRAY;\n return B.boxAsJs(value);\n }\n });\n\n this.BLACK = new Object();\n Object.defineProperty(this, \"BLACK\", {\n get: function() {\n var value = delegate.BLACK;\n return B.boxAsJs(value);\n }\n });\n\n this.MAGENTA = new Object();\n Object.defineProperty(this, \"MAGENTA\", {\n get: function() {\n var value = delegate.MAGENTA;\n return B.boxAsJs(value);\n }\n });\n\n this.YELLOW = new Object();\n Object.defineProperty(this, \"YELLOW\", {\n get: function() {\n var value = delegate.YELLOW;\n return B.boxAsJs(value);\n }\n });\n\n this.DARK_GRAY = new Object();\n Object.defineProperty(this, \"DARK_GRAY\", {\n get: function() {\n var value = delegate.DARK_GRAY;\n return B.boxAsJs(value);\n }\n });\n\n this.CYAN = new Object();\n Object.defineProperty(this, \"CYAN\", {\n get: function() {\n var value = delegate.CYAN;\n return B.boxAsJs(value);\n }\n });\n\n this.ORANGE = new Object();\n Object.defineProperty(this, \"ORANGE\", {\n get: function() {\n var value = delegate.ORANGE;\n return B.boxAsJs(value);\n }\n });\n\n }", "get color() {return this._p.color;}", "get color(){\n return this.getPalette(this.currentColor);\n }", "function Shape(color) { // Parent function\n this.color = color; // Initialize\n}", "randomColor(){\n return colors[Math.floor(Math.random() * colors.length)];\n }", "function ColorPickerInstance()\r\n{\r\n this._id = $.colorPicker._register(this);\r\n this._input = null;\r\n this._colorPickerDiv = $.colorPicker._colorPickerDiv;\r\n this._sampleSpan = null;\r\n}", "function Cat(name, color){\n this.name = name;\n this.color = color;\n}", "setColor(color) {\n this.color = color;\n }", "function createConstructors(newName, sliderRedBody, sliderGreenBody, sliderBlueBody, sliderRedHeader, sliderGreenHeader, sliderBlueHeader) {\n\n console.log(newName, sliderRedBody, sliderGreenBody, sliderBlueBody, sliderRedHeader, sliderGreenHeader, sliderBlueHeader);\n\n colorScheme[index] = new backgroundColorScheme(newName, sliderRedBody, sliderGreenBody, sliderBlueBody, sliderRedHeader, sliderGreenHeader, sliderBlueHeader);\n\n index += 1;\n}", "function Cat(name, color) {\n this.name = name;\n this.color = color;\n}", "constructor(x,y,w,h,clr){\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n this.clr = clr;\n}", "constructor() {\n this.engine = 'V8';\n this.color = 'Red';\n this.isAutomatic = true;\n }", "function Person(name, favColor){\n this.name = name\n this.favColor = favColor\n}", "function Dog(color) {\r\n this.name = \"Woof\";\r\n this.color = color;\r\n this.legs = 4;\r\n}", "function Method(color){\n this.skinColor = color\n}", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function Plant(){\n this.color = \"red\";\n this.size = \"circle\";\n}", "function Color(x, y, size, col){\n this.x=x;\n this.y=y;\n this.size=size;\n this.col=col;\n this.strokeCol = 'black';\n this.click=false;\n}", "function Cat(name, color){\r\n this.name = name\r\n this.color = color\r\n}", "constructor(make, model, year, color){\n //this. creates local instances\n this.make = make;\n this.model = model;\n this.year = year;\n this.color = color;\n\n }", "function color() {\n\t return {\n\t r: Math.floor(Math.random() * colorArray[0][0]),\n\t g: Math.floor(Math.random() * colorArray[0][1]),\n\t b: Math.floor(Math.random() * colorArray[0][2]),\n\t }\n\t}", "function colorReplace(){\n var color = colorGetter.getColor(this);\n}", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "static StandardColors() {\n\t\tif ( !Civ.colors ) { \n\t\t\tCiv.next_standard_color_index = -1;\n\t\t\tCiv.colors = [\n\t\t\t\t[128, 0, 0], \t\t// maroon\n\t\t\t\t[45, 130, 220], \t// blue\n\t\t\t\t[219, 210, 72], \t// yellow\n\t\t\t\t[10, 128, 30], \t\t// forest green\n\t\t\t\t[15, 120, 155],\t\t// teal\n\t\t\t\t[192, 192, 192], \t// silver\n\t\t\t\t[255, 0, 0], \t\t// red\n\t\t\t\t[0, 220, 0], \t\t// green\n\t\t\t\t[100, 100, 100], \t// grey\n\t\t\t\t[128, 128, 0], \t\t// olive\n\t\t\t\t[20, 66, 170], \t\t// navy\n\t\t\t\t[255, 0, 255],\t\t// fuschia\n\t\t\t\t[128, 0, 128],\t\t// purple\n\t\t\t\t[0, 255, 255],\t\t// aqua\n\t\t\t\t[140,205,140],\t\t// spring green\n\t\t\t\t[195,144,212],\t\t// lavender\n\t\t\t\t[212,161,144],\t\t// mid brown\n\t\t\t\t[120,80,24],\t\t// dark brown\n\t\t\t\t[222,195,144],\t\t// tan\n\t\t\t\t[190,102,40],\t\t// dull orange\n\t\t\t\t[255,149,0],\t\t// orange \n\t\t\t\t[162,255,31],\t\t// chartreuse\n\t\t\t\t[230,119,119],\t\t// salmon\n\t\t\t\t[255,186,206]\t\t// pink\n\t\t\t\t];\n\t\t\tCiv.colors.shuffle();\n\t\t\t// random colors to finish off the set\n\t\t\tfor ( let n = 0; n < 124; ) {\n\t\t\t\tlet c = [ \n\t\t\t\t\tutils.RandomInt(0,255),\n\t\t\t\t\tutils.RandomInt(0,255),\n\t\t\t\t\tutils.RandomInt(0,255),\n\t\t\t\t\t];\n\t\t\t\tif ( c[0] + c[1] + c[2] > 200 ) { \n\t\t\t\t\tCiv.colors.push(c); \n\t\t\t\t\tn++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\treturn Civ.colors;\n\t\t}", "function Fruit(taste,color){\r\n this.color = color;\r\n this.taste = taste;\r\n}", "constructor(options) {\n super(options) //car constructor\n this.color = options.color\n }", "changeColor() {\n //this.color = \n }", "function Shap(color){\n this.color = color;\n }", "randomizeColors(){\n for (const [key, color] of Object.entries(this.colors)) {\n color.newColor()\n }\n this.updateGradientString()\n }", "function color() {\n var map = {\n \"black\" : [ 0/255,0/255,0/255 ],\n \"silver\": [ 192/255,192/255,192/255 ],\n \"gray\" : [ 128/255,128/255,128/255 ],\n \"white\" : [ 255/255,255/255,255/255 ],\n \"maroon\": [ 128/255,0/255,0/255 ],\n \"red\" : [ 255/255,0/255,0/255 ],\n \"purple\": [ 128/255,0/255,128/255 ],\n \"fuchsia\": [ 255/255,0/255,255/255 ],\n \"green\" : [ 0/255,128/255,0/255 ],\n \"lime\" : [ 0/255,255/255,0/255 ],\n \"olive\" : [ 128/255,128/255,0/255 ],\n \"yellow\": [ 255/255,255/255,0/255 ],\n \"navy\" : [ 0/255,0/255,128/255 ],\n \"blue\" : [ 0/255,0/255,255/255 ],\n \"teal\" : [ 0/255,128/255,128/255 ],\n \"aqua\" : [ 0/255,255/255,255/255 ],\n \"aliceblue\" : [ 240/255,248/255,255/255 ],\n \"antiquewhite\" : [ 250/255,235/255,215/255 ],\n \"aqua\" : [ 0/255,255/255,255/255 ],\n \"aquamarine\" : [ 127/255,255/255,212/255 ],\n \"azure\" : [ 240/255,255/255,255/255 ],\n \"beige\" : [ 245/255,245/255,220/255 ],\n \"bisque\" : [ 255/255,228/255,196/255 ],\n \"black\" : [ 0/255,0/255,0/255 ],\n \"blanchedalmond\" : [ 255/255,235/255,205/255 ],\n \"blue\" : [ 0/255,0/255,255/255 ],\n \"blueviolet\" : [ 138/255,43/255,226/255 ],\n \"brown\" : [ 165/255,42/255,42/255 ],\n \"burlywood\" : [ 222/255,184/255,135/255 ],\n \"cadetblue\" : [ 95/255,158/255,160/255 ],\n \"chartreuse\" : [ 127/255,255/255,0/255 ],\n \"chocolate\" : [ 210/255,105/255,30/255 ],\n \"coral\" : [ 255/255,127/255,80/255 ],\n \"cornflowerblue\" : [ 100/255,149/255,237/255 ],\n \"cornsilk\" : [ 255/255,248/255,220/255 ],\n \"crimson\" : [ 220/255,20/255,60/255 ],\n \"cyan\" : [ 0/255,255/255,255/255 ],\n \"darkblue\" : [ 0/255,0/255,139/255 ],\n \"darkcyan\" : [ 0/255,139/255,139/255 ],\n \"darkgoldenrod\" : [ 184/255,134/255,11/255 ],\n \"darkgray\" : [ 169/255,169/255,169/255 ],\n \"darkgreen\" : [ 0/255,100/255,0/255 ],\n \"darkgrey\" : [ 169/255,169/255,169/255 ],\n \"darkkhaki\" : [ 189/255,183/255,107/255 ],\n \"darkmagenta\" : [ 139/255,0/255,139/255 ],\n \"darkolivegreen\" : [ 85/255,107/255,47/255 ],\n \"darkorange\" : [ 255/255,140/255,0/255 ],\n \"darkorchid\" : [ 153/255,50/255,204/255 ],\n \"darkred\" : [ 139/255,0/255,0/255 ],\n \"darksalmon\" : [ 233/255,150/255,122/255 ],\n \"darkseagreen\" : [ 143/255,188/255,143/255 ],\n \"darkslateblue\" : [ 72/255,61/255,139/255 ],\n \"darkslategray\" : [ 47/255,79/255,79/255 ],\n \"darkslategrey\" : [ 47/255,79/255,79/255 ],\n \"darkturquoise\" : [ 0/255,206/255,209/255 ],\n \"darkviolet\" : [ 148/255,0/255,211/255 ],\n \"deeppink\" : [ 255/255,20/255,147/255 ],\n \"deepskyblue\" : [ 0/255,191/255,255/255 ],\n \"dimgray\" : [ 105/255,105/255,105/255 ],\n \"dimgrey\" : [ 105/255,105/255,105/255 ],\n \"dodgerblue\" : [ 30/255,144/255,255/255 ],\n \"firebrick\" : [ 178/255,34/255,34/255 ],\n \"floralwhite\" : [ 255/255,250/255,240/255 ],\n \"forestgreen\" : [ 34/255,139/255,34/255 ],\n \"fuchsia\" : [ 255/255,0/255,255/255 ],\n \"gainsboro\" : [ 220/255,220/255,220/255 ],\n \"ghostwhite\" : [ 248/255,248/255,255/255 ],\n \"gold\" : [ 255/255,215/255,0/255 ],\n \"goldenrod\" : [ 218/255,165/255,32/255 ],\n \"gray\" : [ 128/255,128/255,128/255 ],\n \"green\" : [ 0/255,128/255,0/255 ],\n \"greenyellow\" : [ 173/255,255/255,47/255 ],\n \"grey\" : [ 128/255,128/255,128/255 ],\n \"honeydew\" : [ 240/255,255/255,240/255 ],\n \"hotpink\" : [ 255/255,105/255,180/255 ],\n \"indianred\" : [ 205/255,92/255,92/255 ],\n \"indigo\" : [ 75/255,0/255,130/255 ],\n \"ivory\" : [ 255/255,255/255,240/255 ],\n \"khaki\" : [ 240/255,230/255,140/255 ],\n \"lavender\" : [ 230/255,230/255,250/255 ],\n \"lavenderblush\" : [ 255/255,240/255,245/255 ],\n \"lawngreen\" : [ 124/255,252/255,0/255 ],\n \"lemonchiffon\" : [ 255/255,250/255,205/255 ],\n \"lightblue\" : [ 173/255,216/255,230/255 ],\n \"lightcoral\" : [ 240/255,128/255,128/255 ],\n \"lightcyan\" : [ 224/255,255/255,255/255 ],\n \"lightgoldenrodyellow\" : [ 250/255,250/255,210/255 ],\n \"lightgray\" : [ 211/255,211/255,211/255 ],\n \"lightgreen\" : [ 144/255,238/255,144/255 ],\n \"lightgrey\" : [ 211/255,211/255,211/255 ],\n \"lightpink\" : [ 255/255,182/255,193/255 ],\n \"lightsalmon\" : [ 255/255,160/255,122/255 ],\n \"lightseagreen\" : [ 32/255,178/255,170/255 ],\n \"lightskyblue\" : [ 135/255,206/255,250/255 ],\n \"lightslategray\" : [ 119/255,136/255,153/255 ],\n \"lightslategrey\" : [ 119/255,136/255,153/255 ],\n \"lightsteelblue\" : [ 176/255,196/255,222/255 ],\n \"lightyellow\" : [ 255/255,255/255,224/255 ],\n \"lime\" : [ 0/255,255/255,0/255 ],\n \"limegreen\" : [ 50/255,205/255,50/255 ],\n \"linen\" : [ 250/255,240/255,230/255 ],\n \"magenta\" : [ 255/255,0/255,255/255 ],\n \"maroon\" : [ 128/255,0/255,0/255 ],\n \"mediumaquamarine\" : [ 102/255,205/255,170/255 ],\n \"mediumblue\" : [ 0/255,0/255,205/255 ],\n \"mediumorchid\" : [ 186/255,85/255,211/255 ],\n \"mediumpurple\" : [ 147/255,112/255,219/255 ],\n \"mediumseagreen\" : [ 60/255,179/255,113/255 ],\n \"mediumslateblue\" : [ 123/255,104/255,238/255 ],\n \"mediumspringgreen\" : [ 0/255,250/255,154/255 ],\n \"mediumturquoise\" : [ 72/255,209/255,204/255 ],\n \"mediumvioletred\" : [ 199/255,21/255,133/255 ],\n \"midnightblue\" : [ 25/255,25/255,112/255 ],\n \"mintcream\" : [ 245/255,255/255,250/255 ],\n \"mistyrose\" : [ 255/255,228/255,225/255 ],\n \"moccasin\" : [ 255/255,228/255,181/255 ],\n \"navajowhite\" : [ 255/255,222/255,173/255 ],\n \"navy\" : [ 0/255,0/255,128/255 ],\n \"oldlace\" : [ 253/255,245/255,230/255 ],\n \"olive\" : [ 128/255,128/255,0/255 ],\n \"olivedrab\" : [ 107/255,142/255,35/255 ],\n \"orange\" : [ 255/255,165/255,0/255 ],\n \"orangered\" : [ 255/255,69/255,0/255 ],\n \"orchid\" : [ 218/255,112/255,214/255 ],\n \"palegoldenrod\" : [ 238/255,232/255,170/255 ],\n \"palegreen\" : [ 152/255,251/255,152/255 ],\n \"paleturquoise\" : [ 175/255,238/255,238/255 ],\n \"palevioletred\" : [ 219/255,112/255,147/255 ],\n \"papayawhip\" : [ 255/255,239/255,213/255 ],\n \"peachpuff\" : [ 255/255,218/255,185/255 ],\n \"peru\" : [ 205/255,133/255,63/255 ],\n \"pink\" : [ 255/255,192/255,203/255 ],\n \"plum\" : [ 221/255,160/255,221/255 ],\n \"powderblue\" : [ 176/255,224/255,230/255 ],\n \"purple\" : [ 128/255,0/255,128/255 ],\n \"red\" : [ 255/255,0/255,0/255 ],\n \"rosybrown\" : [ 188/255,143/255,143/255 ],\n \"royalblue\" : [ 65/255,105/255,225/255 ],\n \"saddlebrown\" : [ 139/255,69/255,19/255 ],\n \"salmon\" : [ 250/255,128/255,114/255 ],\n \"sandybrown\" : [ 244/255,164/255,96/255 ],\n \"seagreen\" : [ 46/255,139/255,87/255 ],\n \"seashell\" : [ 255/255,245/255,238/255 ],\n \"sienna\" : [ 160/255,82/255,45/255 ],\n \"silver\" : [ 192/255,192/255,192/255 ],\n \"skyblue\" : [ 135/255,206/255,235/255 ],\n \"slateblue\" : [ 106/255,90/255,205/255 ],\n \"slategray\" : [ 112/255,128/255,144/255 ],\n \"slategrey\" : [ 112/255,128/255,144/255 ],\n \"snow\" : [ 255/255,250/255,250/255 ],\n \"springgreen\" : [ 0/255,255/255,127/255 ],\n \"steelblue\" : [ 70/255,130/255,180/255 ],\n \"tan\" : [ 210/255,180/255,140/255 ],\n \"teal\" : [ 0/255,128/255,128/255 ],\n \"thistle\" : [ 216/255,191/255,216/255 ],\n \"tomato\" : [ 255/255,99/255,71/255 ],\n \"turquoise\" : [ 64/255,224/255,208/255 ],\n \"violet\" : [ 238/255,130/255,238/255 ],\n \"wheat\" : [ 245/255,222/255,179/255 ],\n \"white\" : [ 255/255,255/255,255/255 ],\n \"whitesmoke\" : [ 245/255,245/255,245/255 ],\n \"yellow\" : [ 255/255,255/255,0/255 ],\n \"yellowgreen\" : [ 154/255,205/255,50/255 ] };\n\n var o, i = 1, a = arguments, c = a[0], alpha;\n\n if(a[0].length<4 && (a[i]*1-0)==a[i]) { alpha = a[i++]; } // first argument rgb (no a), and next one is numeric?\n if(a[i].length) { a = a[i], i = 0; } // next arg an array, make it our main array to walk through\n if(typeof c == 'string')\n c = map[c.toLowerCase()];\n if(alpha!==undefined)\n c = c.concat(alpha);\n for(o=a[i++]; i<a.length; i++) {\n o = o.union(a[i]);\n }\n return o.setColor(c);\n}", "constructor(value,color) {\n this.sides = value;\n this.diceRoll = 0;\n this.diceColor = color;\n }", "function Cat(name, color) {\n this.name = name;\n this.color = color;\n}", "function initJSColor(){\n\tjscolor.installByClassName('jscolor');\n}", "function ColorPicker() {\n this._colorPos = {};\n this.el = o(require('./template'));\n this.main = this.el.find('.main').get(0);\n this.spectrum = this.el.find('.spectrum').get(0);\n this.hue(rgb(255, 0, 0));\n this.spectrumEvents();\n this.mainEvents();\n this.w = 180;\n this.h = 180;\n this.render();\n}", "setColour(colour){\n this.colour = colour;\n }", "function generateColor(red, green, blue)\n{\n paintColor[0] = red;\n paintColor[1] = green;\n paintColor[2] = blue;\n}", "PowerUpModel(color){\n this.color = color;\n }", "function Dog(name, color) {\n this.name = name; \n this.color = color; \n}", "createColorsArray() {\n const _hexadecimals = '0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f';\n const hexadecimals = _hexadecimals.split(',');\n const colorsArray = [];\n\n // mesaure time needed to create an array\n const startTime = performance.now();\n\n while (colorsArray.length < this.pairs) {\n let hexColor = '';\n\n for (let j = 0; j < 6; j++) {\n const randomIndex = Math.floor(Math.random() * hexadecimals.length);\n hexColor += hexadecimals[randomIndex];\n }\n\n hexColor = `#${hexColor}`;\n\n // if that color does not exist yet, push it to the array\n // else iterate again\n if (colorsArray.indexOf(hexColor) === -1)\n colorsArray.push(hexColor);\n }\n\n const endTime = performance.now();\n const creationTime = endTime - startTime;\n\n // double array to make every color have a pair\n const pairedColorsArray = colorsArray.concat(colorsArray);\n\n // function returns object maybe for future purposes\n return {\n pairedColors: pairedColorsArray,\n colors: colorsArray,\n time: creationTime,\n };\n }", "function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha\n };\n }", "function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha\n };\n }", "function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha\n };\n }", "function colorMaker(r, g, b) {\n colors = {};\n colors.r = r;\n colors.g = g;\n colors.b = b;\n\n colors.rgb = function () {\n const { r, g, b } = this;\n return `rgb(${r},${g},${b})`\n }\n colors.hex = function () {\n const { r, g, b } = this;\n return \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\n }\n return colors;\n}" ]
[ "0.78174037", "0.7696213", "0.7669188", "0.7565268", "0.7455361", "0.7296242", "0.7123405", "0.7061253", "0.7023974", "0.70067036", "0.69883984", "0.69475466", "0.6870564", "0.6857136", "0.6839013", "0.68067133", "0.6763742", "0.6599667", "0.656793", "0.65335137", "0.6520825", "0.65201795", "0.6506162", "0.6502711", "0.64834166", "0.64663565", "0.64654034", "0.6445052", "0.64295155", "0.63384444", "0.6336039", "0.6323447", "0.63190305", "0.63172746", "0.63153553", "0.6307909", "0.6290497", "0.62844527", "0.62601006", "0.6259617", "0.62491107", "0.6234165", "0.62226355", "0.62181616", "0.6211961", "0.61964196", "0.61866295", "0.61683726", "0.6159537", "0.61508536", "0.6143134", "0.61404854", "0.61171913", "0.61149716", "0.6098376", "0.60931724", "0.60913473", "0.6074881", "0.60610795", "0.60587573", "0.60443693", "0.60438067", "0.6020637", "0.60187536", "0.6013662", "0.6012786", "0.60127854", "0.6004142", "0.59969676", "0.59897226", "0.59897226", "0.5983584", "0.59835786", "0.5978623", "0.5967242", "0.5957893", "0.5953617", "0.59492105", "0.59492105", "0.59492105", "0.59492105", "0.5948739", "0.59403133", "0.5932469", "0.5925876", "0.59239846", "0.59239405", "0.59167415", "0.59154665", "0.5914484", "0.5913945", "0.5908888", "0.5907083", "0.5896364", "0.58954924", "0.58910984", "0.5890424", "0.58879954", "0.58879954", "0.58879954", "0.5884098" ]
0.0
-1
The draw function for the Tree which takes a empty geometry and inital position as input and returns geometry with added vertices
function DrawTheTree(geom, x_init, y_init, z_init){ var geometry = geom; var Wrule = GetAxiomTree(); var n = Wrule.length; var stackX = []; var stackY = []; var stackZ = []; var stackA = []; var stackV = []; var stackAxis = []; var theta = params.theta * Math.PI / 180; var scale = params.scale; var angle = params.angle * Math.PI / 180; var x0 = x_init; var y0 = y_init; var z0 = z_init ; var x; var y; var z; var rota = 0, rota2 = 0, deltarota = 18 * Math.PI/180; var newbranch = false; var axis_x = new THREE.Vector3( 1, 0, 0 ); var axis_y = new THREE.Vector3( 0, 1, 0 ); var axis_z = new THREE.Vector3( 0, 0, 1 ); var zero = new THREE.Vector3( 0, 0, 0 ); var axis_delta = new THREE.Vector3(), prev_startpoint = new THREE.Vector3(); var startpoint = new THREE.Vector3(x0,y0,z0), endpoint = new THREE.Vector3(); var bush_mark; var vector_delta = new THREE.Vector3(scale, scale, 0); for (var j=0; j<n; j++){ var a = Wrule[j]; if (a == "+"){angle -= theta; } if (a == "-"){angle += theta; } if (a == "F"){ var a = vector_delta.clone().applyAxisAngle( axis_y, angle ); endpoint.addVectors(startpoint, a); geometry.vertices.push(startpoint.clone()); geometry.vertices.push(endpoint.clone()); prev_startpoint.copy(startpoint); startpoint.copy(endpoint); axis_delta = new THREE.Vector3().copy(a).normalize(); rota += deltarota;// + (5.0 - Math.random()*10.0); } if (a == "L"){ endpoint.copy(startpoint); endpoint.add(new THREE.Vector3(0, scale*1.5, 0)); var vector_delta2 = new THREE.Vector3().subVectors(endpoint, startpoint); vector_delta2.applyAxisAngle( axis_delta, rota2 ); endpoint.addVectors(startpoint, vector_delta2); geometry.vertices.push(startpoint.clone()); geometry.vertices.push(endpoint.clone()); rota2 += 45 * Math.PI/180; } if (a == "%"){ } if (a == "["){ stackV.push(new THREE.Vector3(startpoint.x, startpoint.y, startpoint.z)); stackA[stackA.length] = angle; } if (a == "]"){ var point = stackV.pop(); startpoint.copy(new THREE.Vector3(point.x, point.y, point.z)); angle = stackA.pop(); } bush_mark = a; } return geometry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawTree(){\n drawLeaves();\n drawTrunk();\n penUp();\n}", "DrawTree()\n {\n\n }", "insertTreeVertexNode(tree, q_node) { \n\t\ttree.vertices.push(q_node);\n\t}", "function tree_init(q) {\n\n // create tree object\n var tree = {};\n\n // initialize with vertex for given configuration\n tree.vertices = [];\n tree.vertices[0] = {};\n tree.vertices[0].vertex = q;\n tree.vertices[0].edges = [];\n\n // create rendering geometry for base location of vertex configuration\n add_config_origin_indicator_geom(tree.vertices[0]);\n\n // maintain index of newest vertex added to tree\n tree.newest = 0;\n\n return tree;\n}", "drawTree() {\r\n fuenfteAufgabe.crc2.beginPath();\r\n fuenfteAufgabe.crc2.moveTo(this.x, this.y);\r\n fuenfteAufgabe.crc2.lineTo(this.x + 30, this.y - 60);\r\n fuenfteAufgabe.crc2.lineTo(this.x + 60, this.y);\r\n fuenfteAufgabe.crc2.strokeStyle = this.color;\r\n fuenfteAufgabe.crc2.stroke();\r\n fuenfteAufgabe.crc2.fillStyle = this.color;\r\n fuenfteAufgabe.crc2.fill();\r\n }", "createChildren(){\n\t\tvar left = []; \n\t\tvar right = [];\n\t\tvar intersection_points = [];\n\t\tvar color = [];\n\t\tvar origin = [];\n\t\t\t\n\t\t\tarrange(this.vertex);\n\t\t\t//gets points where polygon line intersects with mouse line\n\t\t\tfor(var i = 0; i < this.vertex.length ; i ++){\n\t\t\t\tif(i == this.vertex.length - 1)\n\t\t\t\t\tvar point = getIntersection(this.vertex[i], this.vertex[0]);\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tvar point = getIntersection(this.vertex[i], this.vertex[i+1]);\n\t\t\t\tif(point != null){\n\t\t\t\t\tintersection_points.push(point);\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tleft = intersection_points.slice();\n\t\t\tright = intersection_points.slice();\n\t\t\torigin = intersection_points.slice();\n\t\t\t//separates in two nodes\n\t\t\tfor(var i = 0; i < this.vertex.length; i ++){\n\t\t\t\t\n\t\t\t\tif(position(mouse_press, mouse_drag, this.vertex[i]) < 0)\n\t\t\t\t\tleft.push(this.vertex[i]);\n\n\t\t\t\telse if(position(mouse_press, mouse_drag, this.vertex[i]) > 0)\n\t\t\t\t\tright.push(this.vertex[i]);\n\n\t\t\t}\n\n\t\t\t//sets child variables\n\t\t\tcolor = this.color.slice();\n\t\t\tthis.children.push(new Node(left, color, this));\n\t\t\tcolor = randomColor();\n\t\t\tthis.children.push(new Node(right, color, this));\t\n\t\t\tthis.children[0].origin_line = origin.slice();\n\t\t\tthis.children[1].origin_line = origin.slice();\n\t\t\tthis.children[0].root = this.root;\n\t\t\tthis.children[1].root = this.root;\n\n\n\t}", "function drawTree() {\n noStroke();\n fill(TRUNK_COLOR);\n rect(xTrunkCorner, yTrunkCorner, 10, 50);\n\n // fill alternating columns with different colors of green\n if (i % 2 == 0) {\n fill(TREE_COLOR1);\n }\n if (i % 2 == 1) {\n fill(TREE_COLOR2);\n }\n\n // triangles that make up the treetops\n triangle(xTreeCorner1, yTreeCorner1, xTreeCorner2, yTreeCorner2, xTreeCorner3, yTreeCorner3);\n triangle(xTreeCorner1 - 5, yTreeCorner1 + 20, xTreeCorner2, yTreeCorner2 + 20, xTreeCorner3 + 5, yTreeCorner3 + 20);\n triangle(xTreeCorner1 - 10, yTreeCorner1 + 40, xTreeCorner2, yTreeCorner2 + 40, xTreeCorner3 + 10, yTreeCorner3 + 40);\n }", "function drawTree() {\n noStroke();\n fill(TRUNK_COLOR);\n rect(xTrunkCorner, yTrunkCorner, 10, 50);\n\n // fill alternating columns with different colors of green\n if (i % 2 == 0) {\n fill(TREE_COLOR1);\n }\n if (i % 2 == 1) {\n fill(TREE_COLOR2);\n }\n\n // triangles that make up the treetops\n triangle(xTreeCorner1, yTreeCorner1, xTreeCorner2, yTreeCorner2, xTreeCorner3, yTreeCorner3);\n triangle(xTreeCorner1 - 5, yTreeCorner1 + 20, xTreeCorner2, yTreeCorner2 + 20, xTreeCorner3 + 5, yTreeCorner3 + 20);\n triangle(xTreeCorner1 - 10, yTreeCorner1 + 40, xTreeCorner2, yTreeCorner2 + 40, xTreeCorner3 + 10, yTreeCorner3 + 40);\n }", "display() {\n stroke([204, 0, 255, 100]);\n strokeWeight(1);\n fill([255,0,0,70]);\n beginShape();\n for (let i=0; i<this.vertices.length; i++) {\n vertex(this.vertices[i].x/DIVIDER, this.vertices[i].y/DIVIDER);\n circle(this.vertices[i].x/DIVIDER, this.vertices[i].y/DIVIDER, 3);\n }\n vertex(this.vertices[0].x/DIVIDER, this.vertices[0].y/DIVIDER);\n endShape();\n }", "function drawTrees()\n{\nfor(var i = 0; i < trees_x.length; i++)\n {\n fill(160,82,45)\n rect(trees_x[i] - 25, floorPos_y - 150, 50, 150)\n //head\n fill(0, 100, 0) \n triangle(trees_x[i] - 75, floorPos_y - 150, trees_x[i], floorPos_y - 300, trees_x[i] + 75, floorPos_y - 150);\n }\n\n}", "function drawTrunk(){\n centerTree();\n penRGB(142,41,12,0.75);\n penDown();\n penWidth(10);\n moveForward(15);\n turnLeft(180);\n moveForward(30);\n drawLeaves();\n penUp();\n}", "function DrawTheTree2(geom, x_init, y_init, z_init){\n var geometry = geom;\n var Wrule = GetAxiomTree();\n var n = Wrule.length;\n var stackX = []; var stackY = []; var stackZ = []; var stackA = [];\n var stackV = []; var stackAxis = [];\n\n var theta = params.theta * Math.PI / 180;\n var scale = params.scale;\n var angle = params.angle * Math.PI / 180;\n\n var x0 = x_init; var y0 = y_init; var z0 = z_init ;\n var x; var y; var z;\n var rota = 0, rota2 = 0,\n deltarota = 18 * Math.PI/180;\n var newbranch = false;\n var axis_x = new THREE.Vector3( 1, 0, 0 );\n var axis_y = new THREE.Vector3( 0, 1, 0 );\n var axis_z = new THREE.Vector3( 0, 0, 1 );\n var zero = new THREE.Vector3( 0, 0, 0 );\n var axis_delta = new THREE.Vector3(),\n prev_startpoint = new THREE.Vector3();\n\n\n // NEW\n var decrease = params.treeDecrease;\n var treeWidth = params.treeWidth;\n // END\n\n\n var startpoint = new THREE.Vector3(x0,y0,z0),\n endpoint = new THREE.Vector3();\n var bush_mark;\n var vector_delta = new THREE.Vector3(scale, scale, 0);\n var cylindermesh = new THREE.Object3D();\n\n for (var j=0; j<n; j++){\n\n treeWidth = treeWidth-decrease;\n var a = Wrule[j];\n if (a == \"+\"){angle -= theta;}\n if (a == \"-\"){angle += theta;}\n if (a == \"F\"){\n\n var a = vector_delta.clone().applyAxisAngle( axis_y, angle );\n endpoint.addVectors(startpoint, a);\n\n cylindermesh.add(cylinderMesh(startpoint,endpoint,treeWidth));\n\n prev_startpoint.copy(startpoint);\n startpoint.copy(endpoint);\n\n axis_delta = new THREE.Vector3().copy(a).normalize();\n rota += deltarota;\n }\n if (a == \"L\"){\n endpoint.copy(startpoint);\n endpoint.add(new THREE.Vector3(0, scale*1.5, 0));\n var vector_delta2 = new THREE.Vector3().subVectors(endpoint, startpoint);\n vector_delta2.applyAxisAngle( axis_delta, rota2 );\n endpoint.addVectors(startpoint, vector_delta2);\n\n cylindermesh.add(cylinderMesh(startpoint,endpoint,treeWidth));\n\n rota2 += 45 * Math.PI/180;\n }\n if (a == \"%\"){\n\n }\n if (a == \"[\"){\n stackV.push(new THREE.Vector3(startpoint.x, startpoint.y, startpoint.z));\n stackA[stackA.length] = angle;\n }\n if (a == \"]\"){\n var point = stackV.pop();\n startpoint.copy(new THREE.Vector3(point.x, point.y, point.z));\n angle = stackA.pop();\n }\n bush_mark = a;\n }\n return cylindermesh;\n}", "function drawTree(fork) {\n ctx.fillStyle = \"#fff\"\n ctx.fillRect(0,0,width,height)\n fork.assignID(1)\n let list = fork.list()\n let levels = fork.levels()\n console.log(\"Drawing L\"+levels+\" \"+list)\n //console.log(list)\n //console.log(levels + \" levels\")\n let dy = height / list.length\n var putx = 440 - Math.max(0, 15 * (fork.maxcharlength() - 15))\n let dx = putx / (levels+1)\n\n //Add names\n ctx.fillStyle = \"#000\"\n list.forEach((e, i) => ctx.fillText(e, putx+11, 1 + i * dy + dy/2));\n ctx.fillStyle = \"#00f\"\n list.forEach((e, i) => ctx.fillText(e, putx+10, 0 + i * dy + dy/2));\n\n //Add lines\n ctx.fillStyle = \"#000\"\n //ctx.fillRect(dx,height/4,10,height/2)\n //ctx.fillStyle = \"#f00\"\n //ctx.fillRect(10,fork.mid() * dy, dx, 10)\n //list.forEach((e, i) => ctx.fillRect(440 - dx, -15 + i * dy + dy/2, dx, 10))\n fork.draw(ctx, levels, levels+1, levels, dx, dy)\n}", "function drawTrees()\n{\n for(var i = 0; i < trees_x.length; i++)\n {\n \n fill(102, 51, 0)\n rect(trees_x[i].x_pos - 10, 347, 20, 85);\n \n fill(0,255,0)\n triangle(trees_x[i].x_pos, 280, trees_x [i].x_pos - 29, 369, trees_x [i].x_pos + 29, 369);\n }\n}", "renderTree() {\n // STEP 1: CREATE THE SVG FOR THE VISUALIZATION\n let svg = d3.select(\"body\").append(\"svg\");\n svg.attr(\"width\", 1200)\n .attr(\"height\", 1200);\n \n // STEP 2: DRAW THE VERTICES AND THE LABELS\n let nodes = svg.selectAll(\"g\").data(this.nodeList); // Update\n let nodesEnter = nodes.enter().append(\"g\"); // Enter\n nodes.exit().remove() // Exit\n nodes = nodesEnter.merge(nodes); // Merge\n // set the class and the transformation for the nodes\n nodes.attr(\"class\", \"nodeGroup\")\n .attr(\"transform\", \"translate(50, 145)\");\n // append circle to the groups\n nodes.append(\"circle\").attr(\"cx\", function(node){return node.level * 260;})\n .attr(\"cy\", function(node){return node.position * 130;})\n .attr(\"r\", 50);\n // append text to the circle\n nodes.append(\"text\").text(function(node){return node.name;})\n .attr(\"class\", \"label\")\n .attr(\"x\", function(node){return node.level * 260})\n .attr(\"y\", function(node){return node.position * 130});\n\n // STEP 3: DRAW THE EDGES\n // Not too happy with this part because there has to be a correct way of solving this problem cleanly like drawing the nodes\n // With the deadline this was the best thing that I could come up with\n let animalSponge = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 50)\n .attr(\"y1\", 0)\n .attr(\"x2\", 210)\n .attr(\"y2\", 0);\n let animalNephroza = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 36)\n .attr(\"y1\", 36)\n .attr(\"x2\", 215)\n .attr(\"y2\", 238);\n let spongeCalcinea = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 310)\n .attr(\"y1\", 0)\n .attr(\"x2\", 470)\n .attr(\"y2\", 0);\n let spongePetrosina = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 302)\n .attr(\"y1\", 28)\n .attr(\"x2\", 470)\n .attr(\"y2\", 120);\n let nephrozaVertebrates = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 310)\n .attr(\"y1\", 260)\n .attr(\"x2\", 470)\n .attr(\"y2\", 260);\n let nephrozaProtosomes = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 290)\n .attr(\"y1\", 300)\n .attr(\"x2\", 480)\n .attr(\"y2\", 615);\n let vertebratesLampreys = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 260)\n .attr(\"x2\", 730)\n .attr(\"y2\", 260);\n let vertebratesSharks = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 275)\n .attr(\"x2\", 730)\n .attr(\"y2\", 380);\n let vertebratesTetrapods = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 290)\n .attr(\"x2\", 730)\n .attr(\"y2\", 500);\n let tetrapodsTurtles = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 830)\n .attr(\"y1\", 520)\n .attr(\"x2\", 990)\n .attr(\"y2\", 520);\n let protosomesWaterBears = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 650)\n .attr(\"x2\", 730)\n .attr(\"y2\", 650);\n let protosomesHexapods = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 670)\n .attr(\"x2\", 730)\n .attr(\"y2\", 780);\n let hexapodsInsects = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 830)\n .attr(\"y1\", 780)\n .attr(\"x2\", 990)\n .attr(\"y2\", 780);\n let hexapodsProturans = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 830)\n .attr(\"y1\", 800)\n .attr(\"x2\", 990)\n .attr(\"y2\", 900);\n }", "function TreePainter() {\n\n}", "function drawTrees()\n{\n for(var i =0; i < treePos_x.length; i++)\n {\n \n noStroke();\n\tfill(180, 100, 50);\n\trect(treePos_x[i], treePos_y, 35, 70);\n\tfill(20, 130, 20);\n\ttriangle(treePos_x[i] - 50, treePos_y + 10, treePos_x[i] + 20, treePos_y - 100, treePos_x[i] + 90, treePos_y + 10);\n\tfill(20, 150, 20);\n\ttriangle(treePos_x[i] - 50, treePos_y - 30, treePos_x[i] + 20, treePos_y - 140, treePos_x[i] + 90, treePos_y - 30);\n\tfill(30, 170, 50);\n\ttriangle(treePos_x[i] - 50, treePos_y - 60, treePos_x[i] + 20, treePos_y - 180, treePos_x[i] + 90, treePos_y - 60);\n } \n}", "function drawTrees()\n{\n for (var i = 0; i < trees_x.length; i++)\n {\n fill(114, 76, 10);\n rect(trees_x[i], treePos_y + 45 , 60, 100);\n fill(42, 241, 149);\n triangle(trees_x[i] - 50, treePos_y + 50, trees_x[i] + 30, treePos_y - 50, trees_x[i] + 110, treePos_y + 50);\n triangle(trees_x[i] - 50, treePos_y , trees_x[i] + 30, treePos_y - 100, trees_x[i] + 110, treePos_y );\n\n }\n}", "buildTree() {\n\t\tthis.assignLevel(this.nodesList[0], 0);\n\t\tthis.positionMap = new Map();\n\t\tthis.assignPosition(this.nodesList[0], 0);\n\t}", "createTreeVisualizer(obj) {\n const geom = new THREE.Geometry();\n function traverse(o) {\n const p0 = o.getWorldPosition(new THREE.Vector3());\n o.children.forEach(c => {\n if (c.type === \"Bone\" && o.type === \"Bone\") {\n const p1 = c.getWorldPosition(new THREE.Vector3());\n geom.vertices.push(p0);\n geom.vertices.push(p1);\n }\n traverse(c);\n });\n }\n traverse(obj);\n const mat = new THREE.LineBasicMaterial({ color: \"red\" });\n mat.depthTest = false;\n return new THREE.LineSegments(geom, mat);\n }", "vertex(x, y) {\n this.currentShape.vertex({ x, y });\n }", "function drawTree(dataStructure, level) {\n var daDisegnare = true;\n var numChild = dataStructure.children.length;\n\n for (let i = 0; i < numChild; i++) {\n drawTree(dataStructure.children[i], level + 1);\n }\n\n if (numChild == 0) { //base case\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n if (level > 0 && arraySpazioLivelli[level - 2] > arraySpazioLivelli[level - 1]) {\n arraySpazioLivelli[level - 1] = arraySpazioLivelli[level - 2];\n }\n drawNode(dataStructure, arraySpazioLivelli[level - 1], level * levelLength);\n arraySpazioLivelli[level - 1] += spazioNodo + brotherDistance;\n for (let i = level - 1; i < arraySpazioLivelli.length; i++) {\n if (arraySpazioLivelli[i] < (arraySpazioLivelli[level - 1])) {\n arraySpazioLivelli[i] = (arraySpazioLivelli[level - 1]);\n }\n }\n daDisegnare = false;\n }\n\n for (let i = 0; i < dataStructure.children.length; i++) {\n if (dataStructure.children[i].disegnato == false) {\n daDisegnare = false;\n }\n }\n\n if (daDisegnare == true) {\n if (dataStructure.children.length == 1) {\n if (dataStructure.children[0].children.length == 0) {\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n drawNode(dataStructure, dataStructure.children[0].x, level * levelLength);\n arraySpazioLivelli[level - 1] = dataStructure.children[0].x + spazioNodo + brotherDistance;\n } else {\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n var spazioNodoFiglio = dataStructure.children[0].name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n drawNode(dataStructure, arraySpazioLivelli[level - 1], level * levelLength);\n arraySpazioLivelli[level - 1] += spazioNodo + brotherDistance;\n }\n } else {\n var XprimoFiglio = dataStructure.children[0].x;\n var XultimoFiglio = dataStructure.children[dataStructure.children.length - 1].x;\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n drawNode(dataStructure, arraySpazioLivelli[level - 1], level * levelLength);\n arraySpazioLivelli[level - 1] += spazioNodo + brotherDistance;\n }\n }\n}", "function addTree(lineModel,pointh,vertexTreeCallback,numBranches)\n{\n\tvar indexOffset=lineModel.preVertices.length/lineModel.floatsPerVertex; //in units of \"points\"\n\tlineModel.preVertices=lineModel.preVertices.concat( vertexTreeCallback(pointh,numBranches) ); \n\tlineModel.preVerticesIndices=lineModel.preVerticesIndices.concat( buildBiSplitIndices(numBranches,indexOffset) ); //bugbug quad??\n}", "renderTree() {\n\t\tlet svg = d3.select(\"body\")\n\t\t\t.append(\"svg\")\n\t\t\t.attr(\"width\", 1200)\n\t\t\t.attr(\"height\", 1200);\n\n\t\tsvg.selectAll(\"line\")\n\t\t\t.data(this.nodesList.slice(1, this.nodesList.length))\n\t\t\t.enter()\n\t\t\t.append(\"line\")\n\t\t\t.attr(\"x1\", d => d.parentNode.level*220+50)\n\t\t\t.attr(\"y1\", d => d.parentNode.position*100+55)\n\t\t\t.attr(\"x2\", d => d.level*220+50)\n\t\t\t.attr(\"y2\", d => d.position*100+55);\n\n\t\tsvg.selectAll(\"circle\")\n\t\t .data(this.nodesList)\n\t\t .enter()\n\t\t .append(\"circle\")\n\t\t .attr(\"cx\", d => d.level*220+50)\n\t\t .attr(\"cy\", d => d.position*100+50)\n\t\t .attr(\"r\", 45);\n\n\t\tsvg.selectAll(\"text\")\n\t\t\t.data(this.nodesList)\n\t\t\t.enter()\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", d => d.level*220+50)\n\t\t\t.attr(\"y\", d => d.position*100+55)\n\t\t\t.attr(\"text-anchor\", \"middle\")\n\t\t\t.html(d => d.name);\n\t\t}", "function setup() {\r\n\r\n const tree = createTree(treeSize);\r\n const dimension = Math.pow(PI, PI) * Math.pow(PI, PI);\r\n\r\n createCanvas(dimension, dimension - (dimension / PI));\r\n strokeWeight(HALF_PI);\r\n stroke(0, TWO_PI);\r\n noFill();\r\n\r\n var start;\r\n\r\n if (fullMode === true) { start = createVector(width / PI + Math.pow(PI, PI) + Math.pow(PI, PI), height / 2); }\r\n else { start = createVector(width / 2 + Math.pow(PI, PI) * PI, height - Math.pow(PI, PI) * 1.61803398875); }\r\n\r\n for (var i=0; i<tree.length; i++) {\r\n\r\n var v = start.copy();\r\n var z = createVector(0, -PI - PI / 1.61803398875);\r\n\r\n beginShape();\r\n vertex(v.x, v.y);\r\n\r\n for (var j=0; j<tree[i].length; j++) {\r\n\r\n if (tree[i][j] %2 === 0) { z.rotate(angle); }\r\n else { z.rotate(-angle); }\r\n\r\n v.add(z);\r\n vertex(v.x, v.y);\r\n\r\n }\r\n\r\n endShape();\r\n\r\n }\r\n\r\n}", "update() {\n\n\t\tconst depth = (this.octree !== null) ? this.octree.getDepth() : -1;\n\n\t\tlet level = 0;\n\t\tlet result;\n\n\t\t// Remove existing geometry.\n\t\tthis.dispose();\n\n\t\twhile(level <= depth) {\n\n\t\t\tresult = this.octree.findNodesByLevel(level);\n\n\t\t\tthis.createLineSegments(\n\t\t\t\tresult[Symbol.iterator](),\n\t\t\t\t(typeof result.size === \"number\") ? result.size : result.length\n\t\t\t);\n\n\t\t\t++level;\n\n\t\t}\n\n\t}", "createGeometry()\n {\n this.executeMidpoint();\n\n // Prepare specifics buffers for WebGL\n this.verticesBuffer = getVertexBufferWithVertices(this.vertices);\n this.colorsBuffer = getVertexBufferWithVertices(this.colors);\n this.indicesBuffer = getIndexBufferWithIndices(this.indices);\n this.normalsBuffer = getVertexBufferWithVertices(this.normals);\n }", "draw() {\n if (!this.validate()) {\n console.log('ERROR: Before .draw() you need to call .enable()');\n }\n if (this.box_num == 1) {\n gl.drawArrays(this.draw_method, 0, this.vertex_count);\n return;\n }\n var v_count = 0;\n var temp;\n var geom;\n for (var i = 0; i < g_scene.geometries.size; i++) {\n temp = glMatrix.mat4.clone(this._mvp_matrix);\n geom = g_scene.geometries.get(i);\n // Perform transformations\n for (var j = 0; j < geom.transformations.length; j++) {\n switch (geom.transformations[j].type) {\n case TRANSFORMATIONS.TRANSLATE:\n glMatrix.mat4.translate(this._mvp_matrix, this._mvp_matrix, geom.transformations[j].vector);\n break;\n case TRANSFORMATIONS.ROTATE:\n glMatrix.mat4.rotate(this._mvp_matrix, this._mvp_matrix, geom.transformations[j].rad, geom.transformations[j].vector);\n break;\n case TRANSFORMATIONS.SCALE:\n glMatrix.mat4.scale(this._mvp_matrix, this._mvp_matrix, geom.transformations[j].vector);\n break;\n default:\n break;\n }\n }\n // Update vbo\n gl.uniformMatrix4fv(this.u_mvp_matrix_loc, false, this._mvp_matrix);\n // draw the appropriate shape\n switch (geom.type) {\n case GEOMETRIES.GRID:\n gl.drawArrays(this.draw_method, this.grid_vertex_offset, this.grid_vertex_count);\n break;\n case GEOMETRIES.DISC:\n gl.drawArrays(this.draw_method, this.disc_vertex_offset, this.disc_vertex_count);\n break;\n case GEOMETRIES.SPHERE:\n default:\n gl.drawArrays(this.draw_method, this.sphere_vertex_offset, this.sphere_vertex_count);\n break;\n }\n // Reset transformations\n glMatrix.mat4.copy(this._mvp_matrix, temp);\n }\n }", "paint(ctx, geom, properties) {\n this.leafSize = parseInt(properties.get('--leaf-size')) || 16;\n this.leafColor = (properties.get('--leaf-color') || '#73ce8f').toString().trim();\n this.leafVariance = (properties.get('--leaf-variance') || 'left').toString().trim();\n\n // left\n this.paintVine(ctx, properties, geom.height, 0, [0, 0]);\n\n if (this.leafVariance === 'around') {\n // top\n this.paintVine(ctx, properties, geom.width, -90, [-this.width, 0]);\n // // right\n this.paintVine(ctx, properties, geom.height, -180, [-geom.width, -geom.height]);\n // // bottom\n this.paintVine(ctx, properties, geom.width, -270, [geom.height - this.width, -geom.width]);\n }\n }", "glowTree(){\n\t\tif(isInside(mouse_press, this.vertex) && (this.children.length == 0)){\n\t\t\tnoFill();\n\t\t\tstrokeWeight(2);\n\t\t\tstroke(255);\n\t\t\tellipse(this.x, this.y, 15);\n\n\t\t\tif(!isInside(mouse_drag, this.vertex) && mouseIsDragged){\n\t\t\t\tvar brother = this.getBrother();\n\t\t\t\tvar father = this.parent;\n\t\t\t\tfill(brother.color[0], brother.color[1], brother.color[2]);\n\t\t\t\tstrokeWeight(2);\n\t\t\t\tstroke(51);\n\t\t\t\tellipse(father.x, father.y, 15);\n\t\t\t}\n\t\t\treturn;\n\n\t\t}else if(isInside(mouse_press, this.vertex) && (this.children.length !== 0)){\n\t\t\tthis.children[0].glowTree();\n\t\t\tthis.children[1].glowTree();\n\t\t}else return;\n\t\n\t}", "_createNodes() {\n\n const NO_STATE_INHERIT = false;\n const scene = this._viewer.scene;\n const radius = 1.0;\n const handleTubeRadius = 0.06;\n const hoopRadius = radius - 0.2;\n const tubeRadius = 0.01;\n const arrowRadius = 0.07;\n\n this._rootNode = new Node(scene, {\n position: [0, 0, 0],\n scale: [5, 5, 5]\n });\n\n const rootNode = this._rootNode;\n\n const shapes = {// Reusable geometries\n\n arrowHead: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: arrowRadius,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.2,\n openEnded: false\n })),\n\n arrowHeadBig: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: 0.09,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.25,\n openEnded: false\n })),\n\n arrowHeadHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.09,\n radiusBottom: 0.09,\n radialSegments: 8,\n heightSegments: 1,\n height: 0.37,\n openEnded: false\n })),\n\n curve: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: tubeRadius,\n radialSegments: 64,\n tubeSegments: 14,\n arc: (Math.PI * 2.0) / 4.0\n })),\n\n curveHandle: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: handleTubeRadius,\n radialSegments: 64,\n tubeSegments: 14,\n arc: (Math.PI * 2.0) / 4.0\n })),\n\n hoop: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: tubeRadius,\n radialSegments: 64,\n tubeSegments: 8,\n arc: (Math.PI * 2.0)\n })),\n\n axis: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: tubeRadius,\n radiusBottom: tubeRadius,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n })),\n\n axisHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.08,\n radiusBottom: 0.08,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n }))\n };\n\n const materials = { // Reusable materials\n\n pickable: new PhongMaterial(rootNode, { // Invisible material for pickable handles, which define a pickable 3D area\n diffuse: [1, 1, 0],\n alpha: 0, // Invisible\n alphaMode: \"blend\"\n }),\n\n red: new PhongMaterial(rootNode, {\n diffuse: [1, 0.0, 0.0],\n emissive: [1, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightRed: new EmphasisMaterial(rootNode, { // Emphasis for red rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [1, 0, 0],\n fillAlpha: 0.6\n }),\n\n green: new PhongMaterial(rootNode, {\n diffuse: [0.0, 1, 0.0],\n emissive: [0.0, 1, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightGreen: new EmphasisMaterial(rootNode, { // Emphasis for green rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [0, 1, 0],\n fillAlpha: 0.6\n }),\n\n blue: new PhongMaterial(rootNode, {\n diffuse: [0.0, 0.0, 1],\n emissive: [0.0, 0.0, 1],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightBlue: new EmphasisMaterial(rootNode, { // Emphasis for blue rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [0, 0, 1],\n fillAlpha: 0.2\n }),\n\n center: new PhongMaterial(rootNode, {\n diffuse: [0.0, 0.0, 0.0],\n emissive: [0, 0, 0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80\n }),\n\n highlightBall: new EmphasisMaterial(rootNode, {\n edges: false,\n fill: true,\n fillColor: [0.5, 0.5, 0.5],\n fillAlpha: 0.5,\n vertices: false\n }),\n\n highlightPlane: new EmphasisMaterial(rootNode, {\n edges: true,\n edgeWidth: 3,\n fill: false,\n fillColor: [0.5, 0.5, .5],\n fillAlpha: 0.5,\n vertices: false\n })\n };\n\n this._displayMeshes = {\n\n plane: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, {\n primitive: \"triangles\",\n positions: [\n 0.5, 0.5, 0.0, 0.5, -0.5, 0.0, // 0\n -0.5, -0.5, 0.0, -0.5, 0.5, 0.0, // 1\n 0.5, 0.5, -0.0, 0.5, -0.5, -0.0, // 2\n -0.5, -0.5, -0.0, -0.5, 0.5, -0.0 // 3\n ],\n indices: [0, 1, 2, 2, 3, 0]\n }),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0.0, 0],\n diffuse: [0, 0, 0],\n backfaces: true\n }),\n opacity: 0.6,\n ghosted: true,\n ghostMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n edgeColor: [0, 0, 0],\n fillAlpha: 0.1,\n backfaces: true\n }),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n scale: [2.4, 2.4, 1]\n }), NO_STATE_INHERIT),\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, { // Visible frame\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 1.7,\n tube: tubeRadius * 2,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0, 0],\n diffuse: [0, 0, 0],\n specular: [0, 0, 0],\n shininess: 0\n }),\n //highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n edgeColor: [0.0, 0.0, 0.0],\n filled: true,\n fillColor: [0.8, 0.8, 0.8],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, .1],\n rotation: [0, 0, 45]\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n xCurve: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis\n geometry: shapes.curve,\n material: materials.red,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n xCurveHandle: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis\n geometry: shapes.curveHandle,\n material: materials.pickable,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n xCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0., -0.07, -0.8, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(0 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0.0, -0.8, -0.07, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n yCurve: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curve,\n material: materials.green,\n rotation: [-90, 0, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n yCurveHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curveHandle,\n material: materials.pickable,\n rotation: [-90, 0, 0],\n pickable: true,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n yCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0.07, 0, -0.8, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0.8, 0.0, -0.07, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n zCurve: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis\n geometry: shapes.curve,\n material: materials.blue,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zCurveHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curveHandle,\n material: materials.pickable,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zCurveCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(.8, -0.07, 0, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n return math.mulMat4(translate, scale, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(.05, -0.8, 0, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n center: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildSphereGeometry({\n radius: 0.05\n })),\n material: materials.center,\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n xAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxis: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxisHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n yAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n opacity: 0.2\n }), NO_STATE_INHERIT),\n\n yShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.green,\n position: [0, -radius / 2, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yShaftHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n position: [0, -radius / 2, 0],\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n\n zShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: false,\n collidable: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: true,\n collidable: true,\n visible: false\n }), NO_STATE_INHERIT)\n };\n\n this._affordanceMeshes = {\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 2,\n tube: tubeRadius,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n ambient: [1, 1, 1],\n diffuse: [0, 0, 0],\n emissive: [1, 1, 0]\n }),\n highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, 1],\n rotation: [0, 0, 45]\n }), NO_STATE_INHERIT),\n\n xHoop: rootNode.addChild(new Mesh(rootNode, { // Full \n geometry: shapes.hoop,\n material: materials.red,\n highlighted: true,\n highlightMaterial: materials.highlightRed,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yHoop: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.hoop,\n material: materials.green,\n highlighted: true,\n highlightMaterial: materials.highlightGreen,\n rotation: [-90, 0, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zHoop: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis\n geometry: shapes.hoop,\n material: materials.blue,\n highlighted: true,\n highlightMaterial: materials.highlightBlue,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT)\n };\n }", "drawCurrentState(){\n reset();\n drawPolygonLines(this.hull, \"red\"); \n drawLine(this.currentVertex, this.nextVertex, \"green\");\n drawLine(this.currentVertex,this.points[this.index]);\n for(let i=0;i<this.points.length;i++){\n this.points[i].draw();\n }\n\n for(let i=0;i<this.hull.length;i++){\n this.hull[i].draw(5,\"red\");\n }\n }", "function createVertices(vertices) {\n\n //For each vertice in the graph\n $.each(vertices, function () {\n\n var dummyAllignment = 0;\n\n //create vertex and append it to drawing area\n var tempVertex = jQuery('<div/>', {\n id: this.label,\n text: this.label\n }).appendTo('#drawing-area');\n\n //add vertex-class\n tempVertex.addClass('component');\n\n if (this.dummy) {\n tempVertex.addClass('dummy');\n tempVertex.empty();\n dummyAllignment = 20;\n }\n\n //Set appropriate coordinates of vertex\n tempVertex.css({\n 'left': (this.xCoordinate * 100) + dummyAllignment,\n 'top': this.layer * 100\n });\n\n //Update references in jsPlumb\n jsPlumb.setIdChanged(this.label, this.label);\n });\n}", "initBuffers(gl) {\n // Create a buffer for the tree's vertex positions.\n const treePositionBuffer = gl.createBuffer();\n\n // Select the treePositionBuffer as the one to apply buffer\n // operations to from here out.\n gl.bindBuffer(gl.ARRAY_BUFFER, treePositionBuffer);\n\n // Now create an array of positions for the tree.\n const unit = this.treeSize / this.treeLOD;\n let i = 0, offset = 0, offsetX = 0, offsetY = this.treeSize, offsetZ = 0, one = 0, k = 0,\n skew = 1;\n one = (2 * Math.PI) / this.treeLOD;\n for (i = 0; i < this.treeLOD; i++) {\n offsetX = Math.sin(i * one) * this.treeSize / 24 + skew;\n offsetZ = Math.cos(i * one) * this.treeSize / 24 - skew;\n offsetY = this.treeOffset;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin((i + 1) * one) * this.treeSize / 24 + skew;\n offsetZ = Math.cos((i + 1) * one) * this.treeSize / 24 - skew;\n offsetY = this.treeOffset;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin(i * one) * this.treeSize / 48 + skew;\n offsetZ = Math.cos(i * one) * this.treeSize / 48 - skew;\n offsetY = this.treeOffset + this.treeSize;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin(i * one) * this.treeSize / 48 + skew;\n offsetZ = Math.cos(i * one) * this.treeSize / 48 - skew;\n offsetY = this.treeOffset + this.treeSize;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin((i + 1) * one) * this.treeSize / 48 + skew;\n offsetZ = Math.cos((i + 1) * one) * this.treeSize / 48 - skew;\n offsetY = this.treeOffset + this.treeSize;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin((i + 1) * one) * this.treeSize / 24 + skew;\n offsetZ = Math.cos((i + 1) * one) * this.treeSize / 24 - skew;\n offsetY = this.treeOffset;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n }\n\n // Branches\n for (i = 0; i < this.treeLOD; i++) {\n var height = this.treeSize * Math.random();\n\n offsetX = Math.sin(i * one) * this.treeSize / 24 + skew;\n offsetZ = Math.cos(i * one) * this.treeSize / 24 - skew;\n offsetY = this.treeOffset + height;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin((i + 1) * one) * this.treeSize / 24 + skew;\n offsetZ = Math.cos((i + 1) * one) * this.treeSize / 24 - skew;\n offsetY = this.treeOffset + height;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin((i + 1) * one) * this.treeSize / 3 + skew;\n offsetZ = Math.cos((i + 1) * one) * this.treeSize / 3 - skew;\n offsetY = this.treeOffset + height + this.treeSize / 6;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin(i * one) * this.treeSize / 48 + skew;\n offsetZ = Math.cos(i * one) * this.treeSize / 48 - skew;\n offsetY = this.treeOffset + height - this.treeSize / 24;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin(i * one) * this.treeSize / 48 + skew;\n offsetZ = Math.cos(i * one) * this.treeSize / 48 - skew;\n offsetY = this.treeOffset + height + this.treeSize / 24;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n\n offsetX = Math.sin((i + 1) * one) * this.treeSize / 3 + skew;\n offsetZ = Math.cos((i + 1) * one) * this.treeSize / 3 - skew;\n offsetY = this.treeOffset + height + this.treeSize / 6;\n this.sourcePositions[offset++] = offsetX;\n this.sourcePositions[offset++] = offsetY;\n this.sourcePositions[offset++] = offsetZ;\n }\n\n // Now pass the list of positions into WebGL to build the\n // shape. We do this by creating a Float32Array from the\n // JavaScript array, then use it to fill the current buffer.\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.sourcePositions), gl.STATIC_DRAW);\n const treeTextureCoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, treeTextureCoordBuffer);\n\n let treeTextureCoordinates = [];\n offset = 0;\n\n for (i = 0; i < this.treeLOD * 4; i++) {\n treeTextureCoordinates[offset++] = 0; // X\n treeTextureCoordinates[offset++] = 0; // Y\n\n treeTextureCoordinates[offset++] = 1 / this.treeSize; // X\n treeTextureCoordinates[offset++] = 0; // Y\n\n treeTextureCoordinates[offset++] = 2 / this.treeSize; // X\n treeTextureCoordinates[offset++] = this.treeSize; // Y\n }\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(treeTextureCoordinates),\n gl.STATIC_DRAW);\n\n // Build the element array buffer; this specifies the indices\n // into the vertex arrays for each face's vertices.\n\n const treeIndexBuffer = gl.createBuffer();\n let start = 0, treeIndices = [];\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, treeIndexBuffer);\n\n // This array defines each face as two triangles, using the\n // indices into the vertex array to specify each triangle's\n // position.\n for (i = 0; i < this.treeLOD * 12; i++) {\n //for (i = 0; i < 3; i++) {\n treeIndices[i] = i;\n }\n\n // Now send the element array to GL\n\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,\n new Uint16Array(treeIndices), gl.STATIC_DRAW);\n\n this.buffers = {\n position: treePositionBuffer,\n textureCoord: treeTextureCoordBuffer,\n indices: treeIndexBuffer,\n };\n\n // Load the texture.\n this.loadTexture(gl, 'texture/tree.jpg');\n\n return this.buffers;\n }", "function subdivide()\n\t{\n\t\tif (this.points === null)\n\t\t{\n\t\t\tthrow new Error(\"Cannot subdivide a QuadTree that is not a leaf node\");\n\t\t}\n\t\t\n\t\tvar myself = this;\n\t\t\n\t\tvar maxX = this.maxX,\n\t\t\tminX = this.minX,\n\t\t maxY = this.maxY,\n\t\t\tminY = this.minY;\n\t\t\t\n\t\tvar midX = (minX + maxX) / 2;\n\t\tvar midY = (minY + maxY) / 2;\n\t\t\n\t\tvar config = {\n\t\t\txAccessor: this.xAccessor, \n\t\t\tyAccessor: this.yAccessor,\n\t\t\tupperThreshold: this.upperThreshold,\n\t\t\tlowerThreshold: this.lowerThreshold,\n\t\t\tmaxDepth: this.maxDepth - 1,\n\t\t};\n\t\t\n\t\t//Make the new nodes\n\t\tthis.topLeft = new QuadTree(minX, minY, midX, midY, config);\n\t\tthis.topRight = new QuadTree(midX, minY, maxX, midY, config);\n\t\tthis.bottomLeft = new QuadTree(minX, midY, midX, maxY, config);\n\t\tthis.bottomRight = new QuadTree(midX, midY, maxX, maxY, config);\n\n\t\t//Add all the points\n\t\tthis.points.forEach(function (point)\n\t\t{\n\t\t\tdistributePoint.call(myself, point);\n\t\t});\n\t\t\n\t\t//We are no longer a leaf node, clear the points out.\n\t\tthis.points = null;\n\t}", "function addVertex(e) {\n let [x, y, w, h] = [e.offsetX, e.offsetY, this.offsetWidth, this.offsetHeight];\n \n // Convert x and y from window coordinates (pixels) to clip coordinates (-1,-1 to 1,1)\n let xy = [(2 * x) / w - 1, 1 - (2 * y) / h];\n\n /** \n * Gets the previous object in drawingHistory if the current mode is the same as the previouse mode,\n * otherwise pushes new object on with the current drawing mode.\n */\n if (drawingHistory.length === 0 || gl.drawingMode !== drawingHistory[drawingHistory.length - 1].mode) {\n drawingHistory.push({mode: gl.drawingMode, vertLength: 0}); \n }\n drawingHistory[drawingHistory.length - 1].vertLength += 1; // Add one to the vertex count for the current mode\n\n gl.bindBuffer(gl.ARRAY_BUFFER, gl.posBuffer);\n gl.bufferSubData(gl.ARRAY_BUFFER, gl.currentCoordByteOffset, Float32Array.from(xy)); // Add new vertex to buffer\n \n gl.bindBuffer(gl.ARRAY_BUFFER, gl.colorBuffer); \n gl.bufferSubData(gl.ARRAY_BUFFER, gl.currentColorByteOffset, Float32Array.from(gl.drawingColor)); // Add new color to buffer \n\n // Cleanup\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n\n // Update offsets\n gl.currentCoordByteOffset += 2*Float32Array.BYTES_PER_ELEMENT;\n gl.currentColorByteOffset += 3*Float32Array.BYTES_PER_ELEMENT;\n\n render();\n}", "function make_naive_tree() {\n var nodeSize = 40\n var nodeDx = NODE_DY\n var nodeDy = NODE_DX\n var rootY = ROOT_X\n var tree = {}\n tree.HISTORY = 4\n\n var reset = function() {\n tree.roots =\n [ { id : 0\n , label : 0\n , active : true\n , children : [] } ]\n tree.next_id = 1\n reposition()\n }\n\n var garbageCollect = function() {\n var new_roots = []\n function gc(underGarbage, u) {\n if (underGarbage && u.label < tree.HISTORY) {\n new_roots.push(u)\n }\n u.children.forEach(function(v) {gc(u.label>=tree.HISTORY, v)})\n u.children = u.children.filter(function(v) {return v.label < tree.HISTORY})\n }\n tree.roots.forEach(function(u) { gc(true, u) })\n tree.roots = new_roots\n reposition()\n }\n\n tree.getVertices = function() {\n var vs = []\n function getVertices(u, startPosition) {\n vs.push(\n { id : u.id\n , label : u.label\n , position : u.position\n , startPosition : startPosition }\n )\n u.children.forEach(function(v) { getVertices(v, u.position) })\n }\n tree.roots.forEach(function(v) { getVertices(v, v.position) })\n return vs.sort(function(a,b){ return a.id - b.id })\n }\n\n tree.getEdges = function() {\n var es = []\n function getEdges(_) {\n _.children.forEach(function(d) {\n es.push(\n { v1:_.id\n , l1:_.label\n , p1:_.position\n , v2:d.id\n , l2:d.label\n , p2:d.position }\n )\n })\n _.children.forEach(getEdges);\n }\n tree.roots.forEach(getEdges)\n return es.sort(function(a,b){ return a.v2 - b.v2;});\n }\n\n var modifyVertex = function(id, f) {\n function mv(t) {\n if (t.id == id) f(t)\n t.children.forEach(mv)\n }\n tree.roots.forEach(mv)\n }\n\n tree.addLeaf = function(v){\n modifyVertex(v, function (t) {\n if (t.active) {\n t.children.push(\n { id : tree.next_id++\n , label : 0\n , active : true\n , children : [] }\n )\n }\n })\n reposition()\n relabel()\n redraw()\n }\n\n tree.deactivate = function(id) {\n modifyVertex(id, function(v) { v.active = false })\n relabel()\n redraw()\n }\n\n var clickHandler = function(vertex) {\n if (d3.event.ctrlKey) {\n tree.deactivate(vertex)\n } else {\n tree.addLeaf(vertex)\n }\n }\n\n var relabel = function() {\n function relbl(u) {\n u.children.forEach(relbl)\n if (u.active) {\n u.label = 0\n } else {\n u.label = 1000\n u.children.forEach(function(v) { u.label = Math.min(u.label, v.label) })\n u.label += 1\n }\n }\n tree.roots.forEach(relbl)\n }\n\n var vertexcolor = function(vertex) {\n if (vertex.label == 0) {\n return GREEN\n } else if (vertex.label < tree.HISTORY) {\n return YELLOW\n } else {\n return RED\n }\n }\n\n var vertextext = function(vertex) {\n if (vertex.label >= 1000) return '&infin;'\n return vertex.label\n }\n\n var redraw = function() {\n var edges = d3.select(\"#g_lines\").selectAll('line')\n .data(tree.getEdges(), function(d) {return 'from '+d.v1+' to '+d.v2})\n edges.transition().duration(TRANSITION)\n .attr('x1',function(d){ return d.p1.y }).attr('y1',function(d){ return d.p1.x })\n .attr('x2',function(d){ return d.p2.y }).attr('y2',function(d){ return d.p2.x })\n edges.enter().append('line')\n .attr('x1',function(d){ return d.p1.y }).attr('y1',function(d){ return d.p1.x })\n .attr('x2',function(d){ return d.p1.y }).attr('y2',function(d){ return d.p1.x })\n .transition().duration(TRANSITION)\n .attr('x2',function(d){ return d.p2.y }).attr('y2',function(d){ return d.p2.x })\n edges.exit().remove()\n\n var nodes = d3.select(\"#g_nodes\").selectAll('rect')\n .data(tree.getVertices(), function(d) {return d.id})\n nodes.transition().duration(TRANSITION)\n .attr('x',function(d){ return d.position.y - nodeSize / 2 })\n .attr('y',function(d){ return d.position.x - nodeSize / 2 })\n .style('fill', vertexcolor)\n nodes.enter().append('rect')\n .attr('x', function(d) { return d.startPosition.y - nodeSize / 2 })\n .attr('y',function(d){ return d.startPosition.x - nodeSize / 2 })\n .attr('height', nodeSize).attr('width', nodeSize)\n .style('fill', vertexcolor)\n .on('click',function(d){ return clickHandler(d.id) })\n .transition().duration(TRANSITION)\n .attr('x',function(d){ return d.position.y - nodeSize / 2 })\n .attr('y',function(d){ return d.position.x - nodeSize / 2 })\n nodes.exit().remove()\n\n var labels = d3.select(\"#g_labels\").selectAll('text')\n .data(tree.getVertices(), function(d) {return d.id})\n labels.html(vertextext).transition().duration(TRANSITION)\n .attr('x',function(d){ return d.position.y })\n .attr('y',function(d){ return d.position.x+nodeSize/2-7 })\n labels.enter()\n .append('text')\n .attr('x',function(d){ return d.startPosition.y })\n .attr('y',function(d){ return d.startPosition.x+nodeSize/2-7 })\n .html(vertextext)\n .on('click',function(d){return clickHandler(d.id) })\n .transition().duration(TRANSITION)\n .attr('x',function(d){ return d.position.y })\n .attr('y',function(d){ return d.position.x+nodeSize/2-7 })\n labels.exit().remove()\n }\n\n var reposition = function() {\n function computeLeafCount(u) {\n u.children.forEach(computeLeafCount)\n u.leafCount = 0\n u.children.forEach(function(v) { u.leafCount += v.leafCount })\n u.leafCount = Math.max(1, u.leafCount)\n }\n tree.roots.forEach(computeLeafCount)\n function setPosition(offsetX, offsetY, u) {\n u.position =\n { x : offsetX + u.leafCount * nodeDx / 2\n , y : offsetY }\n u.children.forEach(function(v) {\n setPosition(offsetX, offsetY + nodeDy, v)\n offsetX += v.leafCount * nodeDx\n })\n }\n totalLeafCount = 0\n tree.roots.forEach(function(u) {totalLeafCount += u.leafCount})\n offsetX = HEIGHT / 2 - totalLeafCount * nodeDx / 2\n tree.roots.forEach(function(u) {\n setPosition(offsetX, rootY, u)\n offsetX += u.leafCount * nodeDx\n })\n }\n\n var initialize = function() {\n reset()\n d3.select(\"#treebuffer-naive\")\n .append(\"svg\").attr(\"width\", WIDTH).attr(\"height\", HEIGHT)\n .attr('id', 'treesvg')\n d3.select(\"#treebuffer-naive\").append(\"div\").attr('id', 'navdiv')\n d3.select(\"#navdiv\")\n .append(\"button\").attr('type', 'button').text('Reset')\n .on('click', function(_) { reset(); redraw() })\n d3.select(\"#navdiv\")\n .append(\"button\").attr('type', 'button').text('Collect')\n .on('click', function(_) { garbageCollect(); redraw() })\n d3.select(\"#treesvg\").append('g').attr('id', 'g_lines')\n d3.select(\"#treesvg\").append('g').attr('id', 'g_nodes')\n d3.select(\"#treesvg\").append('g').attr('id', 'g_labels')\n redraw()\n }\n\n initialize()\n return tree\n}", "function draw() {\n\n /*\n * Resize canvas in accordance with size of parent container\n */\n scope.defaultWidth = scope.width;\n scope.width = element[0].clientWidth;\n if (scope.width === 0) {\n scope.width = element[0].parentElement.clientWidth;\n if (scope.width === 0)\n scope.width = scope.defaultWidth; // fallback to passed in width\n }\n\n scope.defaultHeight = scope.height;\n scope.height = element[0].clientHeight;\n if (scope.height === 0) {\n scope.height = element[0].parentElement.clientHeight;\n if (scope.height === 0)\n scope.height = scope.defaultHeight; // fallback to passed in height\n }\n\n svg.attr(D3V.CSS_WIDTH, scope.width)\n .attr(D3V.CSS_HEIGHT, scope.height);\n\n /*\n * clear the elements inside of the directive\n */\n svgGroup.selectAll(SYNTAX.STAR).remove();\n\n var treeData = initNode(scope.vdbEntry);\n\n /*\n * Assign the selection listener to the click event of the svg\n * Call an initial zoom on the svg\n */\n svg.on(D3V.HTML_CLICK, selectionCallback).call(zoomListener);\n\n root = treeData;\n\n // Will call update\n expandCollapseChildCallback(root);\n }", "function createTree(x , y, z){ //holds all of the below as a function\r\n\t//treeTrunk the brown trunk of the tree\r\n\tvar g1 = new THREE.CylinderGeometry( 0.6, 0.6, 4.5, 20); ///(top, bottom, size, shapeish)\r\n\tvar m1 = new THREE.MeshToonMaterial({color:0x603B14,transparent:false,flatShading:false});\r\n\tm1.shininess = 7;\r\n//\tvar m1 = new THREE.MeshBasicMaterial( {color: 0x603B14} );\r\n\tvar treeTrunk = new THREE.Mesh( g1, m1 );\r\n\t//treeTrunk.rotation.y = globeBox.getCenter[2];\r\n\t//treeLower- the green part of the tree creation\r\n\tvar g2 = new THREE.CylinderGeometry(0.1, 2.9, 7, 20); // You had the sizes the wrong way around, didn't need to -7 the scale.\r\n\tvar m2 = new THREE.MeshToonMaterial({color:0x358C47,transparent:false,flatShading:false});\r\n\tm2.shininess = 5;\r\n\tvar treeLower = new THREE.Mesh( g2, m2 );\r\n\t\r\n\t// Set position of tree parts.\r\n\ttreeLower.position.x=0;\r\n\ttreeLower.position.y=6.0; //-920 for big view //6.0 works with ghetto set up\r\n\ttreeLower.position.z=0; //250 //0 works with my ghetto set up\r\n\t//add tree meshes\r\n\tscene.add( treeTrunk );\r\n\tscene.add(treeLower);\r\n\t//scales the trees up to be seen better.\r\n\ttreeTrunk.scale.x = 6;\r\n\ttreeTrunk.scale.y = 6;\r\n\ttreeTrunk.scale.z = 6;\r\n\t// define parent-child relationships\r\n\ttreeLower.parent = treeTrunk;\r\n\ttreeTrunk.position.x = x;\r\n\ttreeTrunk.position.y = y;\r\n\ttreeTrunk.position.z = z;\r\n\ttreeTrunk.parent = globe;\r\n\tvar rotation = new THREE.Quaternion();\r\n\trotation.setFromUnitVectors(globe.up, treeTrunk.position.clone().normalize());\r\n\ttreeTrunk.quaternion.copy(rotation);\r\n\t\r\n\t// Enable shadows.\r\n\ttreeTrunk.castShadow = true;\r\n\ttreeLower.castShadow = true;\r\n\r\n\t// Sets the name so the raycast can query against it.\r\n\ttreeLower.name = \"tree\";\r\n\ttreeTrunk.name = \"tree\";\r\n}", "initGrid(){\n \n let vertex;\n let vertices = [];\n let vertex_data;\n let col_len = grid.column_n;\n let row_len = grid.row_n;\n\n // Outer loop to create parent\n // mod gives you column\n // division gives you row\n // calculations are not 0 index\n for ( let i = 0; i < grid.n; i++ ) {\n\n vertex_data = { };\n\n if( grid.begin_i === i ){ // IF AT BEGIN\n vertex_data.name = \"vertex begin-pos pos pos-\" + grid.begin_i + \" item-\" + i;\n vertex_data.id = \"vertex-\" + i;\n vertex_data.distance = 0;\n }else if( grid.target_i === i ){ // IF AT TARGET\n vertex_data.name = \"vertex target-pos item-\" + i;\n vertex_data.distance = INFINITY;\n vertex_data.id = \"vertex-\" + i;\n }\n else{ //IF VANILLA VERTEX\n vertex_data.name = \"vertex item-\" + i ;\n vertex_data.distance = INFINITY;\n vertex_data.id = \"vertex-\" + i;\n }\n\n //ADD WEIGHTS\n if( i % col_len === 0 ) //LEFT\n vertex_data.left = -1;\n else\n vertex_data.left = 1;\n\n if( ( i % col_len ) === ( col_len - 1 ) ) //RIGHT\n vertex_data.right = -1;\n else\n vertex_data.right = 1;\n\n if( Math.floor( i / col_len ) === ( 0 ) ) //UPPER\n vertex_data.top = -1;\n else\n vertex_data.top = 1;\n\n if( Math.floor( i / col_len ) >= ( row_len-1 ) ) //LOWER\n vertex_data.bottom = -1;\n else\n vertex_data.bottom = 1;\n\n vertex = <Vertex \n name={vertex_data.name}\n key={i}\n index={i}\n id={vertex_data.id}\n /> \n\n vertices.push( vertex );\n\n grid.vertex_data.push({\n index: i,\n visited_via: \"\",\n cost: vertex_data.distance,\n left: vertex_data.left,\n right: vertex_data.right,\n top: vertex_data.top,\n bottom: vertex_data.bottom,\n });\n }\n\n //ADD TO STATE-STORE FOR RENDER()\n this.setState( (state,props) => {\n return { vertices: [...vertices] }\n });\n }", "function drawTree(){\n\t\n\t// Create the SVG element\n\tvar width = 300;\n\tvar height = 300;\n\tvar margin = 40;\n\n\tsvg = d3.select(\"h2\").append(\"svg\")\n\t .attr(\"width\", width + 2*margin)\n\t .attr(\"height\", height + 2*margin)\n\t .append(\"g\")\n\t .attr(\"transform\", \"translate(\" + margin + \",\" + margin + \")\");\n\n\t// Create the diagonal path generator\n\tvar diagonal = d3.svg.diagonal()\n\t .projection(function(d) { return [d.y, d.x]; });\n\n\t// Create the tree\n\n\tvar tree = d3.layout.tree().size([height, width]);\n\tvar nodes = tree.nodes(root);\n\tvar links = tree.links(nodes);\n\n\tvar layerOffset = 100;\n\n\t// Set y position of nodes based on their depth\n\tnodes.forEach(function(d) { d.y = d.depth * layerOffset; });\n\n\tvar edge = svg.selectAll(\".edge\")\n\t .data(links)\n\t .enter().append(\"line\")\n\t .attr(\"class\", \"edge\")\n\t .attr(\"x1\", function(d) { return d.source.y; })\n\t .attr(\"y1\", function(d) { return d.source.x; })\n\t .attr(\"x2\", function(d) { return d.target.y; })\n\t .attr(\"y2\", function(d) { return d.target.x; });\n\n\tvar edgeLabel = svg.selectAll(\".edgelabel\")\n\t .data(links)\n\t .enter().append(\"text\")\n\t .attr(\"class\", \"edgelabel\")\n\t .attr(\"dx\", function(d) { return (d.source.y + d.target.y)/2; })\n\t .attr(\"dy\", function(d) { return (d.source.x + d.target.x)/2; })\n\t .attr(\"text-anchor\", \"middle\")\n\t .text( function(d) { \n\t \tvar source = riverNetwork.getNodeIdByLabel(d.source.name);\n\t \tvar target = riverNetwork.getNodeIdByLabel(d.target.name);\n\t \tvar upstream = riverNetwork.getDirectedProbabilityByIds(source, target);\n\t \tvar downstream = riverNetwork.getDirectedProbabilityByIds(target, source);\n\t \treturn \"\\u2191 \" + upstream + \" \\u2193 \" + downstream ;\n\t } )\n\t .on(\"click\", click);\n\n\t// Create nodes as svg groups\n\tvar node = svg.selectAll(\".node\")\n\t .data(nodes)\n\t .enter().append(\"g\")\n\t .attr(\"class\", \"node\")\n\t .attr(\"id\", \"name\")\n\t .attr(\"transform\", function(d) { return \"translate(\" + d.y + \",\" + d.x + \")\"; })\n\t\t.on(\"mouseover\", mouseoverNode)\n\t\t.on(\"mouseout\", mouseoutNode);\n\n\tradius = 10;\n\n\tif(showFlowIn){\n\t// Add circle to svg group for each node\n\t\tnode.append(\"circle\")\n\t\t\t.style(\"fill\", nodeColorIn)\n\t \t.attr(\"r\", radius);\n\t}\n\telse{\n\t// Add circle to svg group for each node\n\t\tnode.append(\"circle\")\n\t\t\t.style(\"fill\", nodeColorOut)\n\t \t.attr(\"r\", radius);\n\t}\n\n\n\t// Add text to svg group for each node\n\tnode.append(\"text\")\n\t .attr(\"dy\", -1.4*radius)\n\t .attr(\"text-anchor\", \"middle\")\n\t .text(function(d) { return d.name; });\n\t\t\n}", "function renderAfterDagreRender(){\n d3.selectAll('g.node').on(\"click\", function (n) {\n if(d3.select(this).classed('selected')){\n d3.selectAll('g.node').classed('selected', false);\n selectCommit(null);\n }else{\n d3.selectAll('g.node').classed('selected', false);\n d3.select(this).classed(\"selected\", true);\n selectCommit(gr.node(n).commitdata);\n }\n });\n\n\n d3.selectAll(\".commitcontainer\").attr(\"style\", \"min-width:\" + nodewidth + \"px\");\n\n //Append the visualizations of each commit\n // d3.selectAll(\".lineschanged\").append(\"span\").text(\"asdf\");\n let nodes = d3.selectAll('.lineschanged');\n nodes.each(function () {\n renderLinesChanged(d3.select(this),gr.node(this.id).commitdata, this.id); //I only need the commitdata #Mike\n });\n\n\n\n // https://groups.google.com/forum/#!topic/d3-js/fMh1Sr7QFEA\n\n\n d3.selectAll(\"foreignObject\").attr(\"width\", nodewidth).attr(\"height\", nodeheight);\n\n\n // let transx = -(nodewidth) / 6 + 4;\n // let transy = 8\n // d3.selectAll(\".node\").selectAll(\".label\").attr(\"transform\", \"translate(\" + transx + \",\" + transy + \")\");\n\n\n let transx = (-(nodewidth) / 6 + 4);\n let transy = 8;\n d3.selectAll(\".node\").selectAll(\"foreignObject\").attr(\"transform\", \"translate(\" + transx + \",\" + transy + \")\");\n}", "draw() {\n while (scene.children.length > 0) {\n scene.remove(scene.children[0]);\n }\n var from = new THREE.Vector3(0, (this.height / -2), (this.length / 2));\n var to = new THREE.Vector3(0, (this.height / -2), (this.length / 2) + 1000);\n var direction = to.clone().sub(from);\n var length = direction.length();\n var arrowHelper = new THREE.ArrowHelper(direction.normalize(), from, length, \"red\");\n scene.add(arrowHelper);\n var gridHelper = new THREE.GridHelper(1.5 * this.length, 15);\n gridHelper.position.set(0, (this.height / -2), 0);\n scene.add(gridHelper);\n runtimeManager.currentGridUUID = gridHelper.uuid;\n super.draw(null, { type: \"bordered\" });\n for (var index in this.goods) {\n var g = this.goods[index];\n g.draw({ h: this.height, w: this.width, l: this.length }, { type: \"filled\" });\n }\n }", "draw() {\n //Draw this box\n if (this.strokeColor != undefined || this.fillColor != undefined) {\n this.ctx.beginPath();\n this.ctx.lineWidth = 2.0;\n this.ctx.rect(this.x, this.y, this.w, this.h);\n if (this.fillColor != undefined) {\n this.ctx.fillStyle = this.fillColor;\n this.ctx.fill()\n }\n if (this.strokeColor != undefined) {\n this.ctx.strokeStyle = this.strokeColor;\n this.ctx.stroke();\n }\n this.ctx.closePath();\n }\n //Recurse through children and draw them\n this.children.forEach(b => b.draw())\n }", "draw(){\n var canvas = document.getElementById(\"2d-plane\");\n var context = canvas.getContext(\"2d\");\n context.beginPath();\n context.strokeStyle=\"white\";\n context.rect(this.boundary.x-this.boundary.w,this.boundary.y-this.boundary.h,this.boundary.w*2,this.boundary.h*2); \n context.stroke();\n //Draw recursive the children\n if(this.isDivided){\n this.northeast.draw();\n this.northwest.draw();\n this.southeast.draw();\n this.southwest.draw();\n }\n //Draw Points in Boarder\n for(let i=0;i<this.points.length;i++){\n context.beginPath();\n context.fillStyle=\"red\";\n context.arc(this.points[i].x, this.points[i].y, 2, 0, 2*Math.PI);\n context.fill();\n }\n}", "drawGraph(){\n let shapes = this.vertices.iterator();\n\n while(!shapes.isEmpty()){\n shapes.currItem().drawEdges();\n shapes.next();\n }\n\n shapes = this.vertices.iterator();\n\n \n while(!shapes.isEmpty()){\n shapes.currItem().draw(this.currentStage);\n shapes.next();\n }\n }", "draw() {\n if (!this.lines[1]) { return; }\n let left = this.endpoints[0].x;\n let right = this.endpoints[1].x + this.endpoints[1].boxWidth;\n\n let lOffset = -this.endpoints[0].boxWidth / 2;\n let rOffset = this.endpoints[1].boxWidth / 2;\n\n if (this.endpoints[0].row === this.endpoints[1].row) {\n // draw left side of the brace and align text\n let center = (-left + right) / 2;\n this.x = center + lOffset;\n this.svgText.x(center + lOffset);\n this.lines[0].plot('M' + lOffset + ',33c0,-10,' + [center,0,center,-8]);\n this.lines[1].plot('M' + rOffset + ',33c0,-10,' + [-center,0,-center,-8]);\n }\n else {\n // draw right side of brace extending to end of row and align text\n let center = (-left + this.endpoints[0].row.rw) / 2 + 10;\n this.x = center + lOffset;\n this.svgText.x(center + lOffset);\n\n this.lines[0].plot('M' + lOffset\n + ',33c0,-10,' + [center,0,center,-8]\n + 'c0,10,' + [center,0,center,8]\n );\n this.lines[1].plot('M' + rOffset\n + ',33c0,-10,' + [-right + 8, 0, -right + 8, -8]\n + 'c0,10,' + [-right + 8, 0, -right + 8, 8]\n );\n }\n\n // propagate draw command to parent links\n this.links.forEach(l => l.draw(this));\n }", "function nodeDrawer(context, target, lineW, strokeS, fillS) {\n context.beginPath();\n context.lineWidth = lineW;\n context.strokeStyle = strokeS;\n context.fillStyle = fillS;\n context.fillRect(target.posx, target.posy, target.size, target.size);\n context.rect(target.posx, target.posy, target.size, target.size);\n context.closePath();\n context.stroke();\n}", "render(ctx)\n\t{\n\t\tlet camera = this.tree.camera;\n\t\tlet zoom = camera.zoomSmooth;\n\n\t\tlet pos = this.posSmooth.toScreen(camera);\n\t\tlet width = this.width * zoom;\n\t\tlet height = this.height * zoom;\n\t\tlet radius = this.tree.theme.nodeBorderRadius * zoom;\n\t\tlet header = this.tree.theme.nodeHeaderSize * zoom;\n\n\t\tthis.buildNodeShape(ctx, pos, width, height, radius);\n\t\tctx.fillStyle = this.nodeColor;\n\t\tctx.fill();\n\n\t\tthis.buildNodeHeaderShape(ctx, pos, width, height, radius, header);\n\t\tctx.fillStyle = this.nodeHeaderColor;\n\t\tctx.fill();\n\n\t\tthis.buildNodeShape(ctx, pos, width, height, radius);\n\t\tctx.lineWidth = this.tree.theme.nodeBorderThickness * zoom;\n\n\t\tif (this.select)\n\t\t\tctx.strokeStyle = this.tree.theme.nodeBorderSelect;\n\t\telse if (this.hover)\n\t\t\tctx.strokeStyle = this.borderColorHighlight;\n\t\telse\n\t\t\tctx.strokeStyle = this.borderColor;\n\n\t\tctx.stroke();\n\n\t\tfor (let i = 0; i < this.inputPlugs.length; i++)\n\t\t\tthis.inputPlugs[i].render(ctx);\n\n\t\tfor (let i = 0; i < this.outputPlugs.length; i++)\n\t\t\tthis.outputPlugs[i].render(ctx);\n\n\t\tctx.fillStyle = this.tree.theme.headerFontColor;\n\t\tctx.font = this.tree.theme.headerFontSize * zoom + 'px '\n\t\t\t+ this.tree.theme.headerFontFamily;\n\t\tctx.textAlign = 'center';\n\t\tctx.textBaseline = 'middle';\n\t\tctx.fillText(this.name, pos.x + width / 2, pos.y + header / 2 * 1.05);\n\n\t\tthis.input.render(ctx);\n\t}", "function draw() {\n function drawP(text) {\n var elem = document.createElement(\"p\");\n elem.innerText = text;\n document.getElementById(\"root\").append(elem);\n }\n drawP(\"(0,0) Note: SVG origin is top left\");\n var myGenerator = generator();\n var myChart = chart(400, 400);\n var svg = build(myGenerator, myChart);\n document.getElementById(\"root\").appendChild(svg);\n }", "function draw(data, plot){\n\t//Draw/update DOM nodes based on data\n\t//i.e. enter exit update\n\n\tconst rectNodes = plot.selectAll('.node')\n\t\t.data(\n\t\t\tdata\n\t\t\t\t.descendants()\n\t\t\t\t.filter(function(d){\n\t\t\t\t\treturn d.depth < 3\n\t\t\t\t}),\n\t\t\tfunction(d){return d.data.key}\n\t\t); //UPDATE\n\n\t//ENTER\n\tconst rectNodesEnter = rectNodes.enter()\n\t\t.append('rect')\n\t\t.attr('class', 'node');\n\n\trectNodes.merge(rectNodesEnter)\n\t\t.transition()\n\t\t.attr('x', function(d){return d.x0})\n\t\t.attr('y', function(d){return d.y0})\n\t\t.attr('width', function(d){return d.x1-d.x0})\n\t\t.attr('height', function(d){return d.y1-d.y0})\n\t\t.style('fill', function(d){\n\t\t\tswitch(d.depth){\n\t\t\t\tcase 1: return 'red';\n\t\t\t\tcase 2: return 'blue';\n\t\t\t\tcase 0: return 'green'\n\t\t\t}\n\t\t})\n\t\t.style('stroke', 'black')\n\t\t.style('stroke-width', '1px');\n\n\tconst labelNodes = plot.selectAll('text')\n\t\t.data(\n\t\t\tdata\n\t\t\t\t.descendants()\n\t\t\t\t.filter(function(d){\n\t\t\t\t\treturn d.depth < 3\n\t\t\t\t})\n\t\t);\n\n\tconst labelNodesEnter = labelNodes.enter()\n\t\t.append('text');\n\n\tlabelNodes.merge(labelNodesEnter)\n\t\t.text(function(d){return d.data.key})\n\t\t.attr('text-anchor','middle')\n\t\t.transition()\n\t\t.attr('x', function(d){ return (d.x0 + d.x1)/2 })\n\t\t.attr('y', function(d){ return (d.y0 + d.y1)/2 })\n}", "drawNodeShape (node, ctx, size, fgcolor, bgcolor, no_title, selected) {\n //bg rect\n ctx.strokeStyle = fgcolor || LiteGraph.NODE_DEFAULT_COLOR;\n ctx.fillStyle = bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR;\n\n /* gradient test\n let grad = ctx.createLinearGradient(0,0,0,node.size[1]);\n grad.addColorStop(0, \"#AAA\");\n grad.addColorStop(0.5, fgcolor || LiteGraph.NODE_DEFAULT_COLOR);\n grad.addColorStop(1, bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR);\n ctx.fillStyle = grad;\n //*/\n\n let title_height = LiteGraph.NODE_TITLE_HEIGHT;\n\n //render depending on shape\n let shape = node.shape || \"box\";\n if (shape == \"box\") {\n ctx.beginPath();\n ctx.rect(0, no_title ? 0 : -title_height, size[0] + 1, no_title ? size[1] : size[1] + title_height);\n ctx.fill();\n ctx.shadowColor = \"transparent\";\n\n if (selected) {\n ctx.strokeStyle = \"#CCC\";\n ctx.strokeRect(-0.5, no_title ? -0.5 : -title_height + -0.5, size[0] + 2, no_title ? (size[1] + 2) : (size[1] + title_height + 2) - 1);\n ctx.strokeStyle = fgcolor;\n }\n }\n else if (node.shape == \"round\") {\n ctx.roundRect(0, no_title ? 0 : -title_height, size[0], no_title ? size[1] : size[1] + title_height, 10);\n ctx.fill();\n }\n else if (node.shape == \"circle\") {\n ctx.beginPath();\n ctx.arc(size[0] * 0.5, size[1] * 0.5, size[0] * 0.5, 0, Math.PI * 2);\n ctx.fill();\n }\n\n ctx.shadowColor = \"transparent\";\n\n //ctx.stroke();\n\n //image\n if (node.bgImage && node.bgImage.width)\n ctx.drawImage(node.bgImage, (size[0] - node.bgImage.width) * 0.5, (size[1] - node.bgImage.height) * 0.5);\n\n if (node.bgImageUrl && !node.bgImage)\n node.bgImage = node.loadImage(node.bgImageUrl);\n\n if (node.onDrawBackground)\n node.onDrawBackground(ctx);\n\n //title bg (remember, it is rendered ABOVE the node\n if (!no_title) {\n ctx.fillStyle = fgcolor || LiteGraph.NODE_DEFAULT_COLOR;\n let old_alpha = ctx.globalAlpha;\n ctx.globalAlpha = 0.5 * old_alpha;\n if (shape == \"box\") {\n ctx.beginPath();\n ctx.rect(0, -title_height, size[0] + 1, title_height);\n ctx.fill()\n //ctx.stroke();\n }\n else if (shape == \"round\") {\n ctx.roundRect(0, -title_height, size[0], title_height, 10, 0);\n //ctx.fillRect(0,8,size[0],NODE_TITLE_HEIGHT - 12);\n ctx.fill();\n //ctx.stroke();\n }\n\n //title box\n ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR;\n ctx.beginPath();\n if (shape == \"round\")\n ctx.arc(title_height * 0.5, title_height * -0.5, (title_height - 6) * 0.5, 0, Math.PI * 2);\n else\n ctx.rect(3, -title_height + 3, title_height - 6, title_height - 6);\n ctx.fill();\n ctx.globalAlpha = old_alpha;\n\n //title text\n ctx.font = this.d_title_text_font;\n let title = node.getTitle();\n if (title && this.d_scale > 0.5) {\n ctx.fillStyle = LiteGraph.NODE_TITLE_COLOR;\n ctx.fillText(title, 16, 13 - title_height);\n }\n }\n }", "function drawVertex(id, info, visualInfo) {\r\n var pos = this._getVertexPosition(visualInfo);\r\n this.originalPositions[id] = pos;\r\n\r\n var vertex = this.paper.circle(pos.x, pos.y).attr(this.circleAttr).attr('r',vertexAttr.r-2);\r\n if(id == \"start\"){\r\n vertex.attr('fill','white');\r\n }\r\n return [vertex];\r\n }", "split() {\n // bottom four octants\n // -x-y-z\n this.nodes[0] = new Octree(this.bounds.x, this.bounds.y, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x-y-z\n this.nodes[1] = new Octree(this.bounds.frontX, this.bounds.y, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // -x+y-z\n this.nodes[2] = new Octree(this.bounds.x, this.bounds.frontY, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x+y-z\n this.nodes[3] = new Octree(this.bounds.frontX, this.bounds.frontY, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n\n // top four octants\n // -x-y+z\n this.nodes[4] = new Octree(this.bounds.x, this.bounds.y, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x-y+z\n this.nodes[5] = new Octree(this.bounds.frontX, this.bounds.y, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // -x+y+z\n this.nodes[6] = new Octree(this.bounds.x, this.bounds.frontY, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x+y+z\n this.nodes[7] = new Octree(this.bounds.frontX, this.bounds.frontY, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n }", "draw(){\n let shapes = this.shapeList.iterator();\n push();\n while(!shapes.isEmpty()){\n shapes.currItem().draw();\n shapes.next();\n }\n pop();\n\n this.drawText();\n }", "function createOrderedGeomList() {\n var curIndex = 0, \n currentGObj, \n canBeAdded;\n \n function perParentCanBeAdded(index, parent) {\n if (queueMap[parent.id] && \n !queueMap[parent.id].hasBeenAddedToOrderedList &&\n !queueMap[parent.id].isSelectedZ) {\n canBeAdded = false;\n return false;\n }\n return true;\n }\n \n while (processedQueue.length > 0) { \n canBeAdded = true;\n currentGObj = processedQueue[curIndex];\n currentGObj.eachParent(perParentCanBeAdded, true);\n \n if (canBeAdded) {\n orderedGeomList.push(currentGObj);\n processedQueue.splice(curIndex, 1);\n queueMap[currentGObj.id].hasBeenAddedToOrderedList = true;\n } else {\n curIndex++;\n }\n \n if (curIndex === processedQueue.length) {\n curIndex = 0; \n }\n } \n }", "function drawTrees()\n{\n\tfor(var i = 0; i < trees_x.length; i++)\n\t\t{\t//tunk\n\t\t\tfill(120,100,40);\n\t\t\trect(trees_x[i],\n\t\t\t\t treePos_y,60,150);\n\t\t\t//branches\n\t\t\tfill(0,155,0);\n\t\t\ttriangle(trees_x[i] - 50,\n\t\t\t\t\t treePos_y,trees_x[i] + 30,\n\t\t\t\t\t treePos_y - 100,trees_x[i] + 110,treePos_y);\n\t\t\ttriangle(trees_x[i] - 50,\n\t\t\t\t\t treePos_y + 50,trees_x[i]+ 30,treePos_y - 50,trees_x[i] + 110,treePos_y + 50);\n\t\t}\n}", "function makeTree() {\r\n var eD = document.createElement(\"aside\");\r\n eD.setAttribute(\"id\", \"treeBox\");\r\n var evi = document.createElement(\"h1\");\r\n evi.textContent = \"Node Tree\";\r\n eD.appendChild(evi);\r\n document.getElementById(\"main\").appendChild(eD);\r\n\r\n var nodeList = document.createElement(\"ol\");\r\n\r\n eD.appendChild(nodeList);\r\n\r\n var sourceArticle = document.querySelector(\"#main article\");\r\n\r\n makeBranches(sourceArticle, nodeList);\r\n\r\n document.getElementById(\"totalNodes\").textContent = nodeCount;\r\n document.getElementById(\"elemNodes\").textContent = elemCount;\r\n document.getElementById(\"textNodes\").textContent = textCount;\r\n document.getElementById(\"wsNodes\").textContent = wsCount;\r\n}", "function drawTree(options) {\n var json = options[0],\n selector = options[1];\n\n if (typeof selector === \"undefined\") {\n selector = \"body\";\n }\n\n if (typeof json === \"undefined\") {\n throw(new Error(\"drawTree(), no json provided\"));\n }\n\n var diameter = 800;\n\n var tree = d3.layout.tree()\n .size([180, diameter / 4 ])\n .separation(function(a, b) { return (a.parent === b.parent ? 1 : 2) / a.depth; });\n\n var diagonal = d3.svg.diagonal.radial()\n .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });\n\n var svg = d3.select(selector).append(\"svg\")\n .attr(\"width\", diameter / 2)\n .attr(\"height\", diameter)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + 50 + \",\" + diameter / 8 * 3 + \")\");\n\n\n d3.json(json, function(error, root) {\n var nodes = tree.nodes(root),\n links = tree.links(nodes);\n\n var link = svg.selectAll(\".link\")\n .data(links)\n .enter().append(\"path\")\n .attr(\"class\", function (d) { return \"depth-\" + d.source.depth + \" link\"; })\n .attr(\"d\", diagonal);\n\n var node = svg.selectAll(\".node\")\n .data(nodes)\n .enter().append(\"g\")\n .attr(\"class\", function (d) { return \"depth-\" + d.depth + \" node\"; })\n .attr(\"id\", function (d) { return d.name; })\n .attr(\"transform\", function(d) { return \"rotate(\" + (d.x - 90) + \")translate(\" + d.y + \")\"; });\n\n\n node.append(\"circle\")\n .attr(\"r\", 4.5);\n\n node.append(\"text\")\n .attr(\"text-anchor\", function(d) { return d.x < 180 ? \"start\" : \"end\"; })\n .attr(\"transform\", function(d) { return d.x < 180 ? \"translate(8)\" : \"rotate(180)translate(-8)\"; })\n .text(function(d) { return d.name; });\n });\n\n d3.select(self.frameElement).style(\"height\", diameter - 150 + \"px\");\n\n}", "function drawTrees()\n{\n for(var i = 0; i < trees_x.length; i++)\n {\n\n fill(130,90,30);\n rect(trees_x[i] - 30, floorPos_y -115,60,120);\n fill(0,120,0,200);\n ellipse(trees_x[i] + 3, floorPos_y-190,200,190);\n }\n}", "buildPrimalSpanningTree() {\n\t\t// TODO\n\t\t// initialize all vertices\n\t\tfor (let v of this.mesh.vertices) {\n\t\t\tthis.vertexParent[v] = v;\n\t\t}\n\n\t\t// build spanning tree\n\t\tlet root = this.mesh.vertices[0];\n\t\tlet queue = [root];\n\t\twhile (queue.length > 0) {\n\t\t\tlet u = queue.shift();\n\n\t\t\tfor (let v of u.adjacentVertices()) {\n\t\t\t\tif (this.vertexParent[v] === v && v !== root) {\n\t\t\t\t\tthis.vertexParent[v] = u;\n\t\t\t\t\tqueue.push(v);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "buildTree() {\n // note: in this function you will assign positions and levels by making calls to assignPosition() and assignLevel()\n let rootNode = this.nodeList.find(theRootNode => theRootNode.parentName === \"root\");\n this.assignLevel(rootNode, 0);\n this.assignPosition(rootNode, 0);\n }", "buildVertices_() {\n const vertices = [];\n const width = this.config_.style.width;\n const height = this.config_.style.height;\n const stroke = this.config_.style.stroke;\n const hasAngle = this.config_.style.hasAngle;\n\n if (hasAngle) {\n // start corner\n this.addCornerVertices_(vertices, -width/2 + stroke, -height/2, stroke/2, -90);\n\n // outer radius\n const outerRadius = stroke*2.5;\n this.addOuterRadiusVertices_(vertices, width/2, -height/2, outerRadius);\n\n // end corner\n this.addCornerVertices_(vertices, width/2, height/2 - stroke, stroke/2, 180);\n\n // inner radius\n const innerRadius = stroke*2;\n this.addInnerRadiusVertices_(vertices, width/2, -height/2, innerRadius, stroke);\n }\n else {\n // start corner\n this.addCornerVertices_(vertices, -width/2 + height, -height/2, height/2, -90);\n\n // end corner\n this.addCornerVertices_(vertices, width/2, -height/2, height/2, 90);\n }\n\n return vertices;\n }", "function draw() {\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n gl.drawArrays(gl.TRIANGLES, 0, pointsPositions.length/size);\n}", "function drawScene() {\n \n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.drawArrays(gl.LINE_LOOP, 0, 5); //call this for each object I want to draw, but keep all the vertices in one big array\n \n gl.drawArrays(gl.TRIANGLE_FAN, 5, 5);\n \n gl.drawArrays(gl.POINTS, 10, 6);\n gl.drawArrays(gl.TRIANGLE_FAN, 10, 6);\n \n gl.drawArrays(gl.POINTS, 16, 5);\n gl.drawArrays(gl.LINE_LOOP, 16, 5);\n \n \n \n /**\n we have one big array with all the points/vertices. The array is called vertices. It is an array of type vec2. \n Later, we call gl.drawArrays for each object we want to draw-- \n 1st parameter is the type of line we want to connect the points(gl.LINES, gl.LINE_LOOP, etc.),\n 2nd is what index to start at in the array. **Not sure how it knows which array to look in** --drawScene() gets called at the end of canvasMain()-- \n 3rd parameter is how many points (or sides?) in our object--square would be 4, triangle 3 etc.\n \n **/\n //other constants to try \n // gl.TRIANGLE_FAN\n // gl.POINTS\n // gl.LINES\n // gl.LINE_STRIP\n // gl.LINE_LOOP\n // gl.TRIANGLE_FAN\n}//drawScene", "render() {\n gl.useProgram(program);\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, nodes, gl.DYNAMIC_DRAW);\n if (isCanvasDirty) {\n isCanvasDirty = false;\n gl.uniformMatrix4fv(locations.transform, false, transform);\n gl.uniform2f(locations.screenSize, canvasWidth, canvasHeight);\n }\n gl.vertexAttribPointer(locations.vertexPos, 2, gl.FLOAT, false, ATTRIBUTES_PER_PRIMITIVE * Float32Array.BYTES_PER_ELEMENT, 0);\n gl.vertexAttribPointer(locations.customAttributes, 2, gl.FLOAT, false, ATTRIBUTES_PER_PRIMITIVE * Float32Array.BYTES_PER_ELEMENT, 2 * 4);\n gl.drawArrays(gl.POINTS, 0, nodesCount);\n }", "function createNode( args ) {\n\t\n\tif (nodes_in_canvas.length >= gridInformation.number_of_grids ) {\n\t\tLog(\"Error: Number of Nodes will cannot exceed Number of Grids\");\n\t\treturn null;\n\t}\n\t\n \n var shape_image = new createjs.Bitmap(queue.getResult(\"circle\")),\n text = new createjs.Text(args.id, text_height + \"px Arial\", \"#000\"),\n\t subText = new createjs.Text('', 10 + \"px Arial\", \"#ca413b\"),\n\t superText = new createjs.Text('', 10 + \"px Arial\", \"#ca413b\");;\n\t outsideText = new createjs.Text('', 10 + \"px Arial\", \"#ca413b\");;\n\t\n\t \n \n\tshape_node = new createjs.Node({ 'image' : shape_image,\n\t\t'text' : text, 'id': parseInt( args.id ), 'subText':subText,\n\t\t'superText': superText, 'outsideText':outsideText});\n\t \n //Lets center the text \n var metrics = context.measureText(text.text),\n text_width = metrics.width;\n text.x = shape_image.image.width/2 - text_width/2,\n text.y = shape_image.image.height/2 - text_height/2 \n \n\tsubText.x = text.x - 7;\n\tsubText.y = text.y + 20;\n\t\n\tsuperText.x = text.x - 15;\n\tsuperText.y = text.y - 20;\n\t\n\toutsideText.x = text.x - 15;\n\toutsideText.y = text.y + 60;\n\t\n\tshape_node.Log = Log;\n \n //Add Shape instance to stage display list.\n stage.addChild(shape_node);\n\t\n //Update stage will render next frame\n stage.update();\n\t\n\tvar self = shape_node;\t \n\tself.addEventListener(\"mousedown\", function(evt) {\n\t\n\t if (solving) {\n\t\tLog('Please wait until the algorithm has finished to move nodes');\n\t\treturn;\n\t }\n\t\t\t \n\t var offset = {x:self.x-evt.stageX, y:self.y-evt.stageY}; \n\t // add handlers directly to the event object:\n\t evt.onMouseMove = function(evt) { \n\t\t\n\t\t self.x = evt.stageX+offset.x;\n\t\t self.y = evt.stageY+offset.y; \n\t }\n\t //Lets add an onmouseup event listener so I can\n\t //snap elements to a grid Space and update position \n\t evt.onMouseUp = function(evt) {\n\t\t/*\n\t\t//Update grid info for node and grid space\n\t\t if(self.gridSpace){\n\t\t\tself.gridSpace.occupant = null;\n\t\t\tself.gridSpace=null;\n\t\t\t\n\t\t\t} \n\t\t*/\n\t\t\n\t\t//When I move up free the gridspace\n\t\t(self.gridSpace) ? self.gridSpace.occupant = null : '';\n\t\t\n\t\tsnap_Element_to_gridSpace(self);\n\t\t\n\t\tfor (var line_index in self.connectionLines) {\n\t\t\tself.connectionLines[line_index].redrawLine();\n\t\t }\t\t \n\t\tstage.update(); \n\t\t \n\t }\n\t \n\t \n\t});\n\t \n\tself.addEventListener( \"dblclick\", function(evt) {\n\t\t\n\t console.log(\"Double Clicked the container object\"); \n\t \n\t var date = new Date();\n\t var current_time = date.getTime();\n\t \n\t \n\t //Pushing the container and also the time clicked \n\t modify_Parent_Child_relationship_queue.push({\n\t\ttime_clicked : current_time,\n\t\tnode : self \n\t });\n\t \n\t\t\t\t \n\t\t\n\t //If I have two shape_nodes in the queue I need to create a child\n\t //parent relationship\n\t if (modify_Parent_Child_relationship_queue.length == 2) {\n\t\t\n\t\tif ( ( modify_Parent_Child_relationship_queue[1].time_clicked -\n\t\t modify_Parent_Child_relationship_queue[0].time_clicked )\n\t\t\t < time_difference_btwn_double_clicks ) {\n\t\t \n\t\t \n\t\t modify_child_Parent_relationship();\n\t\t}\n\t\t\n\t\t\n\t\telse modify_Parent_Child_relationship_queue.length = 0;\n\t\t\t \n\t }\n\t \n\t}); \n \n \n //Now I can need to gather all the active elements for manipulation\n elements_in_canvas[shape_node.id] = shape_node ;\n nodes_in_canvas.push( shape_node );\n\t\n\t//Creating this here because Im not sure if nodes and lines can have same id\n\tnodes_in_canvas_by_id[ shape_node.id ] = shape_node;\n \n Log('Adding Node ' + shape_node.id);\n\t\n var startX = args.startX || canvas.width-100, startY = args.startY ||100,\n\ttween_time = 2.5;\n\tif (args.tween == false ) {\n\t\tstartX = startY = 150, tween_time = 0;\n\t}\n\t\n\tTweenLite.to( shape_node, tween_time, { x: startX, y: startY, ease:Quad.easeOut} )\n\t\n //tween.to({x:canvas.width-100, y: 100, rotation:0}, 2500, createjs.Ease.circOut);\n \n createjs.Ticker.addEventListener(\"tick\", stage);\n\t\n\t\n\treturn shape_node;\n \n }", "function CuboidGeometry(engine, width, height, depth) {\n var _this;\n\n if (width === void 0) {\n width = 1;\n }\n\n if (height === void 0) {\n height = 1;\n }\n\n if (depth === void 0) {\n depth = 1;\n }\n\n _this = _ShapeGeometry.call(this, engine) || this;\n var halfWidth = width / 2;\n var halfHeight = height / 2;\n var halfDepth = depth / 2; // prettier-ignore\n\n var vertices = new Float32Array([// up\n -halfWidth, halfHeight, -halfDepth, 0, 1, 0, 0, 0, halfWidth, halfHeight, -halfDepth, 0, 1, 0, 1, 0, halfWidth, halfHeight, halfDepth, 0, 1, 0, 1, 1, -halfWidth, halfHeight, halfDepth, 0, 1, 0, 0, 1, // down\n -halfWidth, -halfHeight, -halfDepth, 0, -1, 0, 0, 1, halfWidth, -halfHeight, -halfDepth, 0, -1, 0, 1, 1, halfWidth, -halfHeight, halfDepth, 0, -1, 0, 1, 0, -halfWidth, -halfHeight, halfDepth, 0, -1, 0, 0, 0, // left\n -halfWidth, halfHeight, -halfDepth, -1, 0, 0, 0, 0, -halfWidth, halfHeight, halfDepth, -1, 0, 0, 1, 0, -halfWidth, -halfHeight, halfDepth, -1, 0, 0, 1, 1, -halfWidth, -halfHeight, -halfDepth, -1, 0, 0, 0, 1, // right\n halfWidth, halfHeight, -halfDepth, 1, 0, 0, 1, 0, halfWidth, halfHeight, halfDepth, 1, 0, 0, 0, 0, halfWidth, -halfHeight, halfDepth, 1, 0, 0, 0, 1, halfWidth, -halfHeight, -halfDepth, 1, 0, 0, 1, 1, // fornt\n -halfWidth, halfHeight, halfDepth, 0, 0, 1, 0, 0, halfWidth, halfHeight, halfDepth, 0, 0, 1, 1, 0, halfWidth, -halfHeight, halfDepth, 0, 0, 1, 1, 1, -halfWidth, -halfHeight, halfDepth, 0, 0, 1, 0, 1, // back\n -halfWidth, halfHeight, -halfDepth, 0, 0, -1, 1, 0, halfWidth, halfHeight, -halfDepth, 0, 0, -1, 0, 0, halfWidth, -halfHeight, -halfDepth, 0, 0, -1, 0, 1, -halfWidth, -halfHeight, -halfDepth, 0, 0, -1, 1, 1]); // prettier-ignore\n\n var indices = new Uint16Array([// up\n 0, 2, 1, 2, 0, 3, // donw\n 4, 6, 7, 6, 4, 5, // left\n 8, 10, 9, 10, 8, 11, // right\n 12, 14, 15, 14, 12, 13, // fornt\n 16, 18, 17, 18, 16, 19, // back\n 20, 22, 23, 22, 20, 21]);\n\n _this._initialize(engine, vertices, indices);\n\n return _this;\n }", "display() {\n push();\n fill(255, 255, 0);\n let angle = TWO_PI / this.points;\n let halfAngle = angle / 2.0;\n beginShape();\n for (let a = 0; a < TWO_PI; a += angle) {\n let sx = this.x + cos(a) * this.outerRadius;\n let sy = this.y + sin(a) * this.outerRadius;\n vertex(sx, sy);\n sx = this.x + cos(a + halfAngle) * this.innerRadius;\n sy = this.y + sin(a + halfAngle) * this.innerRadius;\n vertex(sx, sy);\n }\n endShape(CLOSE);\n pop();\n }", "function Tree(density, startPosX, startPosY, charWidth, char, wordSize) {\n this.leaves = [];\n this.branches = [];\n\n // BOUNDARY CHECK using a background layer\n let tempCanvas = createGraphics(width, height);\n tempCanvas.fill(100);\n tempCanvas.textFont(myFont);\n tempCanvas.textSize(wordSize);\n tempCanvas.text(char, startPosX, startPosY);\n\n // MAKE LEAVES\n\n for (var i = 0; i < density; i++) {\n let tempPos = createVector(random(startPosX, startPosX + charWidth), random(startPosY, startPosY - charWidth * 1.25));\n // check if tempPos is within B/W bounds\n let sampleColor = tempCanvas.get(tempPos.x, tempPos.y);\n\n if (sampleColor[0] == 100) {\n this.leaves.push(new Leaf(tempPos.x, tempPos.y));\n } else {\n density += 1;\n }\n }\n // console.log('density Count is ' + density)\n\n // MAKE ROOT\n let rootNum = startRootNum; // could change later\n let rootPos = [];\n for (let i = 0; i < rootNum; i++) {\n\n // making sure sketch doesn't crash!\n if (i > 100) {\n console.log(\"Something is wrong, can't find a place to place roots!\")\n break;\n }\n\n // making a 'root' start from inside the letter\n let tempPos = createVector(random(startPosX, startPosX + charWidth), random(startPosY, startPosY - charWidth));\n\n // check if tempPos is within B/W bounds\n let sampleColor = tempCanvas.get(tempPos.x, tempPos.y);\n\n // Resample root pos if tempPos is not within bounds\n if (sampleColor[0] == 100) {\n rootPos.push(tempPos);\n } else {\n rootNum += 1;\n }\n\n }\n\n\n let roots = [];\n var dir = createVector(0, -1);\n for (let i = 0; i < rootPos.length; i++) {\n let root = new Branch(null, rootPos[i], dir)\n this.branches.push(root);\n var current = root;\n var found = false;\n let failCount = 0;\n while (!found) {\n\n for (let i = 0; i < this.leaves.length; i++) {\n var d = p5.Vector.dist(current.pos, this.leaves[i].pos);\n\n if (d < max_dist) {\n found = true;\n }\n }\n if (!found) {\n // failCount += 1;\n console.log(\"failcount is \" + failCount);\n\n // if I delete it it still works, what's this doing??\n\n var branch = current.next();\n current = branch;\n this.branches.push(current);\n // if (failCount > 10) {\n // console.log(\"failcount is \" + failCount);\n // break;\n // }\n }\n\n }\n }\n\n this.grow = function() {\n for (var i = 0; i < this.leaves.length; i++) {\n var leaf = this.leaves[i];\n var closestBranch = null;\n var record = max_dist;\n\n for (var j = 0; j < this.branches.length; j++) {\n var branch = this.branches[j];\n var d = p5.Vector.dist(leaf.pos, branch.pos);\n if (d < min_dist) {\n leaf.reached = true;\n closestBranch = null;\n break;\n } else if (d < record) {\n closestBranch = branch;\n record = d;\n }\n }\n\n if (closestBranch != null) {\n var newDir = p5.Vector.sub(leaf.pos, closestBranch.pos);\n newDir.normalize();\n closestBranch.dir.add(newDir);\n closestBranch.count++;\n }\n }\n\n for (var i = this.leaves.length - 1; i >= 0; i--) {\n if (this.leaves[i].reached) {\n this.leaves.splice(i, 1);\n }\n }\n\n for (var i = this.branches.length - 1; i >= 0; i--) {\n var branch = this.branches[i];\n if (branch.count > 0) {\n branch.dir.div(branch.count + 1);\n this.branches.push(branch.next());\n branch.reset();\n }\n }\n }\n\n\n\n\n\n this.show = function(debugView) {\n\n if (debugView) {\n // DEBUGGING VIEW FOR LETTERS!\n image(tempCanvas, 0, 0);\n\n // root start points are RED\n tempCanvas.noStroke();\n tempCanvas.fill(255, 0, 0);\n for (let i = 0; i < rootPos.length; i++) {\n tempCanvas.ellipse(rootPos[i].x, rootPos[i].y, 10);\n }\n\n // shows unreached leaves in GREEN\n for (var i = 0; i < this.leaves.length; i++) {\n this.leaves[i].showDebug();\n }\n }\n\n for (var i = 0; i < this.branches.length; i++) {\n this.branches[i].show();\n }\n\n }\n\n}", "draw(newTree) {\n\n // Switch to the new tree (might be the same)\n this.tree = newTree;\n\n // Do the layout - modifies the Tree instances in-place. \n const nodes = this.nodes = this.flextree.nodes(this.tree);\n const links = this.links = this.flextree.links(nodes);\n\n // Fix up:\n // - flextree removes empty `children` arrays for some reason. Let's put\n // them back\n // - swap x and y\n nodes.forEach(n => {\n if (!('children' in n)) n.children = [];\n const x = n.x;\n n.x = n.y;\n n.y = x;\n });\n\n // Draw\n this.renderer.draw(nodes, links);\n\n // Save important data that we'll need for transitions next time\n this.storeTreeData();\n }", "function draw() {\n ellipse(100, 100, 100, 100)\n rect(30, 20, 55, 55)\n triangle(30, 75, 58, 20, 86, 75)\n }", "function drawTree() {\n\n // draw tree using prepared data and config variables\n // \n var t1 = new Date();\n //oTree.clearChart();\n \n updateHandler();\n\n setTimeout(function(){\n oTree.draw(oTreeData, oTreeOptions);\n\n setPopularWords();\n }, 1);\n \n }", "renderScene(scene) {\n let flatScene = this.projectScene(scene)\n\n let polygonList = []\n flatScene.addToList(polygonList)\n //polygonList.sort((a, b) => (a === b)? 0 : a? -1 : 1)\n polygonList.sort(function(a, b) {\n if(a.getAverageDepth() < b.getAverageDepth()) {\n return 1\n } else if(a.getAverageDepth() > b.getAverageDepth()) {\n return -1\n } else if(a.justOutline && !b.justOutline) {//Both are same depth, sort by outline or not\n return -1\n } else return 1\n })\n // polygonList.sort((a,b) => (a.getAverageDepth() < b.getAverageDepth()) ? 1 : -1 || (a.justOutline === b.justOutline)? 0 : a.justOutline? 1 : -1)\n \n let context = this.canvas.getContext(\"2d\")\n \n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n //Clear context first? \n for(let i = 0; i < polygonList.length; i++) {\n let polygon = polygonList[i] \n polygon.render(context)\n }\n }", "function buildObj(x, y) {\n var treeObj= {\n character: x,\n height: y\n }\n growTree(treeObj);\n }", "function add_tree_at(position_vec) {\n var tree = new THREE.Object3D();\n\tvar trunk = new THREE.Mesh(\n new THREE.CylinderGeometry(0.2,0.2,1,16,1),\n\t\tnew THREE.MeshLambertMaterial({\n\t\t color: 0x885522\n\t\t})\n\t);\n\ttrunk.position.y = 0.5; // move base up to origin\n\tvar leaves = new THREE.Mesh(\n new THREE.ConeGeometry(.7,2,16,3),\n\t\tnew THREE.MeshPhongMaterial({\n\t\t color: 0x00BB00,\n\t\t\tspecular: 0x002000,\n\t\t\tshininess: 5\n\t\t})\n\t);\n\tleaves.position.y = 2; // move bottom of cone to top of trunk\n\ttrunk.castShadow = true;\n\ttrunk.receiveShadow = true;\n\tleaves.castShadow = true;\n\tleaves.receiveShadow = true;\n\ttree.add(trunk);\n\ttree.add(leaves);\n\ttree.position.set(position_vec.x, 0, position_vec.z);\n var rand = Math.random();\n tree.scale.set(rand, rand, rand);\n var a_tree = tree.clone();\n DISK_WORLD_MODEL.add(a_tree);\n TRANSLATING_OBJECTS.push(a_tree);\n}", "addVertex(givenX, givenY, xMove, yMove, zoom){ //generally the mouse coords\n\n //apply transformations!\n let xcoor = (givenX - (width/2)) / (width/2);\n let ycoor = ((height - givenY) - (height/2)) / (height/2); //weird since canvas is upside down for mouse\n let hit = false;\n //now you have to apply the transformations for world, not inverse\n xcoor = xcoor/zoom;\n ycoor = ycoor/zoom;\n\n\n xcoor -= xMove; //minus because shifting left is negative, so subtracting a negative value moves to the right\n ycoor -= yMove;\n\n //now just create a vertex with these coords\n this.numVertices++; //get a unique ID\n\n let vert = new Vertex(xcoor, ycoor, this.numVertices);\n this.vertices.addFront(new VertexItem(vert));\n this.vertArray.push(vert);\n\n }", "draw(){\n const panel = document.getElementById('graphpanel')\n const diamond = document.createElementNS('http://www.w3.org/2000/svg', 'polygon')\n\t let xMid = this.x + (this.size / 2)\n let yMid = this.y + (this.size / 2)\n\t let xLong = this.x + this.size\n\t let yLong = this.y + this.size\n\t let str = String(xMid) + ' ' + String(this.y) + ', ' + String(xLong) + ' ' + String(yMid) + ', ' + String(xMid) + ' ' + String(yLong) + ', ' + String(this.x) + ' ' + String(yMid)\n\t diamond.setAttribute('points', str) \n\t diamond.setAttribute('fill', this.color)\n panel.appendChild(diamond)\n }", "function draw() {\n // Clear the scene\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);\n \n // draw your shapes\n drawShapes();\n\n // Clean\n gl.bindVertexArray(null);\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);\n }", "function drawNode(ctx, node, rect){\n\tif(typeof ctx===\"undefined\") return;\n\tif(node===null) return;\n\tif(typeof node===\"undefined\") node=kdtree;\n\tif(typeof rect===\"undefined\") rect=[0,0,WIDTH,HEIGHT];\n\n\tif(node.dim==0){\n\t\tctx.beginPath();\n\t\tctx.moveTo(node.pnt.x, rect[1]);\n\t\tctx.lineTo(node.pnt.x, rect[3]);\n\t\tctx.stroke();\n\t\tif(node.left!==null){\n\t\t\tlet r=rect.slice();\n\t\t\tr[2]=node.pnt.x;\n\t\t\tdrawNode(ctx, node.left, r);\n\t\t}\n\t\tif(node.right!==null){\n\t\t\tlet r=rect.slice();\n\t\t\tr[0]=node.pnt.x;\n\t\t\tdrawNode(ctx, node.right, r);\n\t\t}\n\t}else{\n\t\tctx.beginPath();\n\t\tctx.moveTo(rect[0], node.pnt.y);\n\t\tctx.lineTo(rect[2], node.pnt.y);\n\t\tctx.stroke();\n\t\tif(node.left!==null){\n\t\t\tlet r=rect.slice();\n\t\t\tr[3]=node.pnt.y;\n\t\t\tdrawNode(ctx, node.left, r);\n\t\t}\n\t\tif(node.right!==null){\n\t\t\tlet r=rect.slice();\n\t\t\tr[1]=node.pnt.y;\n\t\t\tdrawNode(ctx, node.right, r);\n\t\t}\n\t}\n\n\t\n}// end #drawNode()", "function drawTrees()\n{\n for (var i = 0; i < trees_x.length; i++)\n {\n //draw tree\n fill(165,42,42)\n rect(trees_x[i]+215, floorPos_y-91, 29.5, 91);\n fill(0,255,0)\n ellipse(trees_x[i]+215, floorPos_y-95, 60, 50);\n ellipse(trees_x[i]+220, floorPos_y-80, 60, 50);\n ellipse(trees_x[i]+215, floorPos_y-95, 60, 50);\n fill(0,230,0)\n ellipse(trees_x[i]+205, floorPos_y-95, 60, 50); \n fill(0,250,0)\n ellipse(trees_x[i]+240, floorPos_y-90, 60, 50);\n ellipse(trees_x[i]+250, floorPos_y-90, 60, 50);\n ellipse(trees_x[i]+250, floorPos_y-93, 60, 50);\n fill(255,165,0)\n ellipse(trees_x[i]+210, floorPos_y-95, 9, 8);\n ellipse(trees_x[i]+230, floorPos_y-80, 9, 8);\n ellipse(trees_x[i]+215, floorPos_y-109, 9, 8);\n ellipse(trees_x[i]+260, floorPos_y-90, 9, 8);\n }\n}", "addVertex(vertex) { \n this.nodes.add(vertex);\n }", "createTree(treeData) {\n\n // ******* TODO: PART VI *******\n\n\n //Create a tree and give it a size() of 800 by 300. \n\n\n //Create a root for the tree using d3.stratify(); \n\n \n //Add nodes and links to the tree. \n }", "function merge()\n\t{\n\t\tif (this.points !== null)\n\t\t{\n\t\t\tthrow new Error(\"Cannot merge a QuadTree that is a leaf node\");\n\t\t}\n\t\t\n\t\tfunction addAllPoints(pointsArray, quadTreeNode) {\n\t\t\tif (quadTreeNode.points === null)\n\t\t\t\tthrow new Error(\"Child node is not a leaf node\");\n\t\t\t\n\t\t\tpointsArray.concat(quadTreeNode.points);\n\t\t}\n\t\t\n\t\tthis.points = [];\n\t\t\n\t\taddAllPoints(this.points, this.topLeft);\n\t\taddAllPoints(this.points, this.topRight);\n\t\taddAllPoints(this.points, this.bottomLeft);\n\t\taddAllPoints(this.points, this.bottomRight);\n\t\t\n\t\tthis.topLeft = null;\n\t\tthis.topRight = null;\n\t\tthis.bottomLeft = null;\n\t\tthis.bottomRight = null;\n\t}", "function makeTree(nfaces)\n{\n var vCone = nfaces + 2;\n var omega = (360.0 / faces) * (Math.PI / 180.0);\n var vertices = [];\n\n // The 8 raw vertices of the canopy (cone shape)\n vertices.push( vec4( 0.0, 0.0, 0.5 , 1) );\n for (var i = 0; i < faces; i++){\n vertices[i + 1] = vec4( Math.cos( i * omega) / 2.0, Math.sin( i * omega) / 2.0, 0.1, 1 ); // scale the rawVertices\n }\n\n // push the first point of the fan to complete the cone\n vertices.push(vertices[1]);\n\n var vCylinder = nfaces * 2;\n\n for (var j = 0 ; j < faces*2; j++) {\n if (j == 0 ) {\n vertices.push( vec4( Math.cos( j * omega) / 2.0, Math.sin( j * omega) / 2.0, 0.1, 1));\n vertices.push( vec4( Math.cos( j * omega) / 2.0, Math.sin( j * omega) / 2.0, 0.0, 1));\n }\n \n vertices.push( vec4( Math.cos( (j + 1) * omega) / 6.0, Math.sin( (j + 1) * omega) / 6.0, 0.1, 1));\n vertices.push( vec4( Math.cos( (j + 1) * omega) / 6.0, Math.sin( (j + 1) * omega) / 6.0, 0.0, 1));\n }\n\n\n for (var j = 0 ; j < vertices.length; j++) {\n console.log(vertices[j]);\n }\n\n return vertices;\n}", "_updateQuadtree() {\n this._quadtree.clear();\n //insert all entities into the tree again\n for (let i = 0; i < this._entities.length; i++) {\n const entity = this._entities[i];\n this._quadtree.insert(entity);\n }\n }", "function createTree(scene) {\n var trunk = new THREE.CubeGeometry(1, 8, 1);\n var leaves = new THREE.SphereGeometry(4);\n\n // create the mesh\n var trunkMesh = new THREE.Mesh(trunk, new THREE.MeshPhongMaterial({\n color: 0x8b4513\n }));\n var leavesMesh = new THREE.Mesh(leaves, new THREE.MeshPhongMaterial({\n color: 0x00ff00\n }));\n\n // position the trunk. Set y to half of height of trunk\n trunkMesh.position.set(-10, 4, 0);\n leavesMesh.position.set(-10, 12, 0);\n\n trunkMesh.castShadow = true;\n trunkMesh.receiveShadow = true;\n leavesMesh.castShadow = true;\n leavesMesh.receiveShadow = true;\n\n scene.add(trunkMesh);\n scene.add(leavesMesh);\n }", "function quadtreeRect(rect, x1, y1, x2, y2) {\r\n console.log(\"THIS IS THE QUAD TREE OF THE DATASET\"+x1+x2+y1+y2);\r\n var con_width = x2 - x1;\r\n var con_height = y2 - y1;\r\n\r\n // clip to the edges of the plot area\r\n if (x1 + con_width > (con_width - 70)) {\r\n con_width = (con_width - 70) - x1;\r\n }\r\n\r\n if (y1 + con_height > (con_height - 60)) {\r\n con_height = (con_height - 60) - y1;\r\n }\r\n\r\n return rect\r\n .attr('class', 'quadtree-node')\r\n .attr('x', x1)\r\n .attr('y', y1)\r\n .attr('width', con_width + 70)\r\n .attr('height', con_height + 60)\r\n .style('fill', 'none')\r\n .style('stroke', '#ccc');\r\n}", "function render()\n {\n if (me.triggerEvent('renderBefore', data) === false)\n return;\n\n // remove all child nodes\n container.html('');\n\n // render child nodes\n for (var i=0; i < data.length; i++) {\n data[i].level = 0;\n render_node(data[i], container);\n }\n\n me.triggerEvent('renderAfter', container);\n }", "function node_add(_pos, _rx, _ry, _fontsize,_type){\r\n\tvar newnode=null;\r\n\tvar title_pre = \"V\";\r\n\tswitch(_type){\r\n\t\tcase \"ellipse\": title_pre =\"F\";\r\n\t\t\tbreak;\r\n\t\tcase \"rect\": title_pre =\"X\";\r\n\t\t\tbreak;\r\n\t\tcase \"triangle\": title_pre = \"1\";\r\n\t\t\tbreak;\r\n\t\tdefault:;\r\n\t}// end of switch (_type) title_pre\r\n\tswitch (_type){\r\n\t\tcase \"ellipse\": \r\n\t\t\tNodecurrent_IdNUM++;\r\n\t\t\tElli_current_TitleNUM++;\t\t\t\r\n\t\t\tnewnode = { id: \"node\"+String(Nodecurrent_IdNUM), type: _type, x:_pos.x, y:_pos.y, rx: default_RADIUSH,ry:default_RADIUSV, strokedotted:0, color: defaultCOLOR, title: title_pre+ Elli_current_TitleNUM, fontsize:defaultFONTSIZE,strokewidth:default_strokeWIDTH, selected: false};\r\n\t\t\tnodes.push(newnode);\r\n\t\t\tnumElli++;\r\n\t\t\tnumNode++;\t\t\t\t\r\n\t\t\tbreak;\r\n\t\tcase \"rect\":\r\n\t\t\tNodecurrent_IdNUM++;\r\n\t\t\tRec_current_TitleNUM++;\r\n\t\t\tnewnode = { id: \"node\"+String(Nodecurrent_IdNUM), type: _type, x:_pos.x, y:_pos.y, rx: default_RADIUSH,ry:default_RADIUSV, strokedotted:0, color: defaultCOLOR, title: title_pre+ Rec_current_TitleNUM, fontsize:defaultFONTSIZE,strokewidth:default_strokeWIDTH,selected: false};\r\n\t\t\tnodes.push(newnode);\r\n\t\t\tnumRec++;\r\n\t\t\tnumNode++;\t\t\t\t\r\n\t\t\tbreak;\r\n\t\tcase \"triangle\":{\r\n\t\t\tNodecurrent_IdNUM++;\r\n\t\t\tnewnode = { id: \"node\"+String(Nodecurrent_IdNUM), type: _type, x:_pos.x, y:_pos.y, rx: default_RADIUSH,ry:default_RADIUSV, strokedotted:0, color: defaultCOLOR, title: title_pre, fontsize:defaultFONTSIZE,strokewidth:default_strokeWIDTH,selected: false};\r\n\t\t\tnodes.push(newnode);\r\n\t\t\tnumTri++;\r\n\t\t\tnumNode++;\t\t\t\t\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\tbreak;\r\n\t\tdefault:;\r\n\t}//end of switch (_type) \r\n\treturn newnode;\r\n}", "function tree() {\n var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null;\n function tree(root) {\n var t = treeRoot(root);\n // Compute the layout using Buchheim et al.’s algorithm.\n (t.eachAfter(firstWalk), t.parent.m = -t.z);\n t.eachBefore(secondWalk);\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode); else // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n {\n var left = root, right = root, bottom = root;\n root.eachBefore(function (node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1);\n root.eachBefore(function (node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n return root;\n }\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;\n while ((vim = nextRight(vim), vip = nextLeft(vip), vim && vip)) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n tree.separation = function (x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n tree.size = function (x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [dx, dy];\n };\n tree.nodeSize = function (x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [dx, dy] : null;\n };\n return tree;\n }", "function webglDirectedNodeProgram() {\n var ATTRIBUTES_PER_VERTEX = 4; // primitive is Line with two points. Each has x,y,z and color = 3 * 2 attributes.\n var ATTRIBUTES_PER_PRIMITIVE = ATTRIBUTES_PER_VERTEX * 3; // 3 Vertices make an arrow head\n var BYTES_PER_NODE =\n 3 * (3 * Float32Array.BYTES_PER_ELEMENT + Uint32Array.BYTES_PER_ELEMENT); // ((3 vertices) nodes * (x,y + color))\n\n var nodesFS = [\n \"#version 300 es\",\n \"precision mediump float;\",\n \"in vec4 color;\",\n \"out vec4 outColor;\",\n \"void main(void) {\",\n \" outColor = color;\",\n \"}\"\n ].join(\"\\n\");\n var nodesVS = [\n \"#version 300 es\",\n \"in vec3 a_vertexPos;\",\n \"in vec4 a_color;\",\n\n \"uniform vec2 u_screenSize;\",\n \"uniform mat4 u_transform;\",\n\n \"out vec4 color;\",\n\n \"void main(void) {\",\n \" gl_Position = u_transform * vec4(a_vertexPos.xy/u_screenSize, -a_vertexPos.z, 1.0);\",\n \" color = a_color.abgr;\",\n \"}\"\n ].join(\"\\n\");\n\n var program;\n var gl;\n var buffer;\n var locations;\n var utils;\n var storage = new ArrayBuffer(16 * BYTES_PER_NODE);\n var positions = new Float32Array(storage);\n var colors = new Uint32Array(storage);\n var nodesCount = 0;\n var width;\n var height;\n var transform;\n var sizeDirty;\n var circleTexture;\n\n return {\n load: load,\n\n /**\n * Updates position of node in the buffer of nodes.\n *\n * @param idx - index of current node.\n * @param pos - new position of the node.\n */\n position: position,\n\n updateTransform: updateTransform,\n\n updateSize: updateSize,\n\n removeNode: removeNode,\n\n createNode: createNode,\n\n replaceProperties: replaceProperties,\n\n render: render,\n\n resetStorage: resetStorage\n };\n\n function resetStorage() {\n storage = new ArrayBuffer(16 * BYTES_PER_NODE);\n positions = new Float32Array(storage);\n colors = new Uint32Array(storage);\n }\n function ensureEnoughStorage() {\n // TODO: this is a duplicate of webglNodeProgram code. Extract it to webgl.js\n if (nodesCount * BYTES_PER_NODE > storage.byteLength) {\n // Every time we run out of space create new array twice bigger.\n // TODO: it seems buffer size is limited. Consider using multiple arrays for huge graphs\n var extendedStorage = new ArrayBuffer(storage.byteLength * 2),\n extendedPositions = new Float32Array(extendedStorage),\n extendedColors = new Uint32Array(extendedStorage);\n\n extendedColors.set(colors); // should be enough to copy just one view.\n positions = extendedPositions;\n colors = extendedColors;\n storage = extendedStorage;\n }\n }\n\n function load(glContext) {\n gl = glContext;\n utils = glUtils(glContext);\n\n program = utils.createProgram(nodesVS, nodesFS);\n gl.useProgram(program);\n locations = utils.getLocations(program, [\n \"a_vertexPos\",\n \"a_color\",\n \"u_screenSize\",\n \"u_transform\"\n ]);\n\n buffer = gl.createBuffer();\n }\n\n function position(nodeUI, pos) {\n var idx = nodeUI.id;\n\n var direction = nodeUI.gradient.direction;\n size = nodeUI.size;\n let parallel = {\n x: direction.x * (size / 2),\n y: direction.y * (size / 2)\n };\n\n var perpendicular = {\n x: (direction.y * size) / 4,\n y: (-direction.x * size) / 4\n };\n\n var magnitude = nodeUI.gradient.magnitude;\n\n var offset = idx * ATTRIBUTES_PER_PRIMITIVE;\n\n var centerVert = {\n x: pos.x + parallel.x,\n y: pos.y + parallel.y\n };\n\n var rightVert = {\n x: pos.x - parallel.x + perpendicular.x,\n y: pos.y - parallel.y + perpendicular.y\n };\n\n var leftVert = {\n x: pos.x - parallel.x - perpendicular.x,\n y: pos.y - parallel.y - perpendicular.y\n };\n\n // Center vertex\n positions[offset] = centerVert.x;\n positions[offset + 1] = -centerVert.y;\n positions[offset + 2] = nodeUI.depth;\n colors[offset + 3] = nodeUI.color;\n\n // Right vertex\n positions[offset + 4] = rightVert.x;\n positions[offset + 5] = -rightVert.y;\n positions[offset + 6] = nodeUI.depth;\n colors[offset + 7] = nodeUI.color;\n\n // Left vertex\n positions[offset + 8] = leftVert.x;\n positions[offset + 9] = -leftVert.y;\n positions[offset + 10] = nodeUI.depth;\n colors[offset + 11] = nodeUI.color;\n }\n\n function updateTransform(newTransform) {\n sizeDirty = true;\n transform = newTransform;\n }\n\n function updateSize(w, h) {\n width = w;\n height = h;\n sizeDirty = true;\n }\n\n function removeNode(node) {\n if (nodesCount > 0) {\n nodesCount -= 1;\n }\n\n if (node.id < nodesCount && nodesCount > 0) {\n // we can use colors as a 'view' into array array buffer.\n utils.copyArrayPart(\n colors,\n node.id * ATTRIBUTES_PER_PRIMITIVE,\n nodesCount * ATTRIBUTES_PER_PRIMITIVE,\n ATTRIBUTES_PER_PRIMITIVE\n );\n }\n }\n\n function createNode() {\n ensureEnoughStorage();\n nodesCount += 1;\n }\n\n function replaceProperties(/* replacedNode, newNode */) {}\n function render() {\n gl.enableVertexAttribArray(locations.vertexPos);\n gl.enableVertexAttribArray(locations.color);\n\n gl.useProgram(program);\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, storage, gl.DYNAMIC_DRAW);\n\n if (sizeDirty) {\n sizeDirty = false;\n gl.uniformMatrix4fv(locations.transform, false, transform);\n gl.uniform2f(locations.screenSize, width, height);\n }\n\n gl.vertexAttribPointer(\n locations.vertexPos,\n 3,\n gl.FLOAT,\n false,\n 4 * Float32Array.BYTES_PER_ELEMENT,\n 0\n );\n gl.vertexAttribPointer(\n locations.color,\n 4,\n gl.UNSIGNED_BYTE,\n true,\n 4 * Float32Array.BYTES_PER_ELEMENT,\n 3 * 4\n );\n gl.drawArrays(gl.TRIANGLES, 0, nodesCount * 3);\n\n frontArrowId = nodesCount - 1;\n }\n}", "get shapeTree() {\n let tree = this.childOne(ShapeTree);\n if (!tree) {\n tree = this.createElement(ShapeTree);\n tree && this.appendChild(tree);\n }\n return tree;\n }", "function drawMethod() {\n startupView = 1;\n \n // gl draw parameters\n var count;\n var primitiveType;\n var offset = 0;\n\n // Clear out the position arrays that will be changed by generate functions\n bezierPos = [];\n bezierPos2 = [];\n bezier3dPos = [];\n bezier3dPos2 = [];\n ans = [];\n ans2 = [];\n \n // Clear out the viewport with solid black color\n gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);\n gl.clear( gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n //draws the dotted horizontal axis lines\n var primitiveType = gl.LINES;\n var count = axisRotation.length/2;\n gl.lineWidth(2);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(axisRotation), gl.STATIC_DRAW);\n gl.uniform4f(colorLocation, 0, 0, 0, 1);\n gl.drawArrays(primitiveType, offset, count);\n\n //If a point is being moved then draw the current highlighted point\n if(moveMode == 1)\n {\n count = 1;\n primitiveType = gl.POINTS;\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(highlightPoint), gl.STATIC_DRAW);\n gl.uniform4f(colorLocation, 1, 0, 1, 1);\n gl.drawArrays(primitiveType, offset, count);\n }\n\n //draws the control points\n primitiveType = gl.POINTS;\n count = positions.length/2;\n gl.uniform4f(colorLocation, 0.47, 0.47, 0.47, 1);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);\n gl.drawArrays(primitiveType, offset, count);\n\n //draws the dotted lines\n generateDottedLine();\n gl.lineWidth(1);\n primitiveType = gl.LINES;\n count = dottedLinePoints.length/2;\n gl.uniform4f(colorLocation, 0, 0, 0, 1);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(dottedLinePoints), gl.STATIC_DRAW);\n gl.drawArrays(primitiveType, offset, count);\n\n //generate and draw the bezier curve everytime the control points are moved\n generateBezierCurve();\n gl.lineWidth(3);\n gl.uniform4f(colorLocation, 1, 0, 0, 1);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(bezierPos), gl.STATIC_DRAW);\n count = subdivisions+1;\n primitiveType = gl.LINE_STRIP;\n gl.drawArrays(primitiveType, offset, count);\n\n //draw the 2nd bezier curve that we just generated\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(bezierPos2), gl.STATIC_DRAW);\n count = subdivisions+1;\n primitiveType = gl.LINE_STRIP;\n gl.drawArrays(primitiveType, offset, count);\n} // End of drawMethod()", "function tree() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}", "function InstaTree(options)\n{\n this.trunk = {width : {start : 20, end : 1}, \n length : 800, \n lengthRate : 1.5,\n angle : Math.PI / 2, \n curl : 0.2, /*the randomness of the path*/\n branchProb : 0.05,\n segmentLength : 10,\n colour : {r : 128, g : 64, b : 64}};\n\n var branchObj = function()\n { \n this.width = {start : 50, end : 1}; \n this.length = 0; \n this.lengthRate = 1.0;\n this.curl = 0.2; /*the randomness of the path*/\n this.angleDelta = {min : Math.PI / 8, max : Math.PI / 2};\n this.branchProb = 0.07,\n this.angle = 30;\n this.depth = 3;\n this.graviphobia = 0.02;\n this.segmentLength = 10;\n this.colour = {r : 128, g : 64, b : 64};\n };\n \n var leafObj = function()\n {\n this.size = 20;\n this.angle = 0;\n this.colour = {r : 0, g : 255, b : 0};\n };\n \n var DrawLeaf = function(x, y, leaf, context)\n {\n var points = {x : [x,\n x + Math.cos(leaf.angle + Math.PI/4) * leaf.size/2,\n x + Math.cos(leaf.angle) * leaf.size,\n x + Math.cos(leaf.angle - Math.PI/4) * leaf.size/2], \n y : [y,\n y + Math.sin(leaf.angle + Math.PI/4) * leaf.size/2,\n y + Math.sin(leaf.angle) * leaf.size,\n y + Math.sin(leaf.angle - Math.PI/4) * leaf.size/2]};\n \n context.fillStyle = \"rgba(\" + leaf.colour.r + \",\" + leaf.colour.g + \",\" + leaf.colour.b + \", 1)\";\n context.strokeStyle = \"rgba(\" + leaf.colour.r + \",\" + leaf.colour.g + \",\" + leaf.colour.b + \", 1)\";\n context.beginPath();\n context.moveTo(points.x[0], points.y[0]); \n \n for (p = 0; p < points.x.length; p++)\n {\n context.lineTo(points.x[p], points.y[p]);\n }\n \n context.closePath();\n context.stroke();\n context.fill();\n }; \n \n \n //function :this.Draw(x, y, context)\n //date :May 1 2014\n //parameters :x, y, - the location of the base of the tree\n // :context - the drawing context\n //description :This funcion draws the trunk while arbitrarily adding branchs\n // :along the way. The objects this.trunk and this.branch hold\n // :the parameters used in constructing the tree.\n this.Draw = function(x, y, context)\n {\n var segmentLength = this.trunk.segmentLength;\n var numSegments = this.trunk.length / segmentLength;\n var segmentShrink = (this.trunk.width.end - this.trunk.width.start) / numSegments;\n\n var segment = {x : [this.trunk.width.start / -2,this.trunk.width.start / 2,0,0], y : [0,0,0,0]};\n \n var vertex = {x : 0, y : 0};\n \n var branchRight = false; //to keep the tree asymetrical, branching alternates left/right\n \n //walk along the main trunk while arbitrarily choosing branch points\n for (var s = 0; s < numSegments; s++)\n {\n //the angle for this segment based on trunk angle\n //makes the trunk more rough by shifting the angle from side to side\n var angle = this.trunk.angle + ((Math.random() - 0.5) * Math.PI * this.trunk.curl);\n \n //this is how wide the segment will be\n //each segment gets thinner as we move along the trunk\n var segmentWidth = (this.trunk.width.start + (segmentShrink * s)) / 2;\n \n //leaves are more probable near the end of the trunk\n var leafProb = s / (numSegments - 1);\n \n //calculate the end midpoint of the segment\n vertex.x -= Math.cos(angle) * segmentLength;\n vertex.y -= Math.sin(angle) * segmentLength;\n \n //calculate the end left and right points of the segment\n segment.x[2] = vertex.x + Math.cos(angle - Math.PI / 2) * segmentWidth;\n segment.y[2] = vertex.y + Math.sin(angle - Math.PI / 2) * segmentWidth;\n segment.x[3] = vertex.x + Math.cos(angle + Math.PI / 2) * segmentWidth;\n segment.y[3] = vertex.y + Math.sin(angle + Math.PI / 2) * segmentWidth;\n \n //set the colour\n context.fillStyle = \"rgba(\" + this.trunk.colour.r + \",\" + this.trunk.colour.g + \",\" + this.trunk.colour.b + \", 1)\";\n context.strokeStyle = \"rgba(\" + this.trunk.colour.r + \",\" + this.trunk.colour.g + \",\" + this.trunk.colour.b + \", 1)\";\n \n //draw the segment\n context.beginPath(); \n context.moveTo(x + segment.x[0], y + segment.y[0]);\n context.lineTo(x + segment.x[1], y + segment.y[1]);\n context.lineTo(x + segment.x[2], y + segment.y[2]);\n context.lineTo(x + segment.x[3], y + segment.y[3]); \n context.closePath(); \n context.fill();\n context.stroke();\n \n //the end points of the segment become the start points of the next segment\n segment.x[0] = segment.x[3];\n segment.y[0] = segment.y[3];\n \n segment.x[1] = segment.x[2];\n segment.y[1] = segment.y[2];\n \n //choose to add a branch if we are up far enough along the trunk\n if (Math.random() < this.trunk.branchProb && (s * segmentLength) > segmentWidth)\n {\n //create a new branch\n var branch = new branchObj();\n \n //calculate the angle of the new branch depending on if it is going left or right\n var range = branch.angleDelta.max - branch.angleDelta.min;\n var min = branch.angleDelta.min;\n var branchAngle = 0;\n \n if (branchRight === true)\n {\n branchAngle = angle - (Math.random() * range) - min;\n branchRight = false;\n }\n else\n {\n branchAngle = angle + (Math.random() * range) + min;\n branchRight = true;\n }\n \n //set up branch\n branch.angle = branchAngle;\n //length is proportional to the remaining length of the trunk\n branch.length = (segmentWidth * (numSegments - s - 1)) * this.trunk.lengthRate;\n branch.width.start = segmentWidth;\n branch.width.end = 1;\n branch.colour.r = this.trunk.colour.r;\n branch.colour.g = this.trunk.colour.g;\n branch.colour.b = this.trunk.colour.b;\n \n DrawBranch(x + vertex.x, y + vertex.y, branch, context);\n }\n \n if (Math.random() < leafProb)\n {\n var leaf = new leafObj();\n var left = Math.random() < 0.5;\n \n if (left === true)\n {\n leaf.angle = angle + Math.random() * Math.PI / 4 + Math.PI/2;\n }\n else\n {\n leaf.angle = angle - Math.random() * Math.PI / 4 - Math.PI/2;\n }\n \n leaf.colour.r = this.trunk.colour.r;\n leaf.colour.g = this.trunk.colour.g;\n leaf.colour.b = this.trunk.colour.b;\n \n DrawLeaf(x + vertex.x, y + vertex.y, leaf, context);\n }\n }\n };\n \n //function :this.DrawBranch(x, y, branch, context)\n //date :May 2 2014\n //parameters :x, y, - the location of the base of the tree\n // :branch - an object containing the properties of the branch\n // :context - the drawing context\n //description :This funcion draws the trunk while arbitrarily adding branchs\n // :along the way. The objects this.trunk and this.branch hold\n // :the parameters used in constructing the tree.\n var DrawBranch = function(x, y, branch, context)\n {\n var segmentLength = branch.segmentLength;\n var numSegments = branch.length / segmentLength;\n var segmentShrink = (branch.width.end - branch.width.start) / numSegments;\n\n var segment = {x : [branch.width.start / -2,branch.width.start / 2,0,0], y : [0,0,0,0]};\n \n var vertex = {x : 0, y : 0};\n \n var branchRight = false;\n \n //walk along the length of the branch adding more branches as needed\n for (var s = 0; s < numSegments; s++)\n {\n var angle = branch.angle + ((Math.random() - 0.5) * Math.PI * branch.curl);\n \n var segmentWidth = (branch.width.start + (segmentShrink * s))/2;\n \n var leafProb = s / (numSegments - 1);\n \n //graviphobic responce - branchs curl up away from gravity\n if (angle < 0)\n {\n branch.angle += Math.PI / 16;\n }\n else if(angle > Math.PI)\n {\n branch.angle -= Math.PI / 16;\n }\n else if(angle < Math.PI/2)\n {\n branch.angle += branch.graviphobia;\n }\n else if(angle > Math.PI/2)\n {\n branch.angle -= branch.graviphobia;\n }\n \n //choose to create a new branch as long as we are far along the branch\n //enough and ensure we don't go too deep into the recursion and \n //cause a stack overflow\n if (Math.random() < branch.branchProb && \n (s * segmentLength) > segmentWidth &&\n (branch.depth > 0))\n {\n //create new branch\n var newBranch = new branchObj();\n var range = newBranch.angleDelta.max - newBranch.angleDelta.min;\n var min = newBranch.angleDelta.min;\n var branchAngle = 0;\n \n if (this.branchRight === true)\n {\n branchAngle = angle - (Math.random() * range) - min;\n this.branchRight = false;\n }\n else\n {\n branchAngle = angle + (Math.random() * range) + min;\n this.branchRight = true;\n }\n \n //set up branch\n newBranch.angle = branchAngle;\n newBranch.length = (segmentWidth * (numSegments - s - 1)) * branch.lengthRate;\n newBranch.width.start = segmentWidth;\n newBranch.width.end = 1;\n newBranch.colour.r = branch.colour.r;\n newBranch.colour.g = branch.colour.g;\n newBranch.colour.b = branch.colour.b;\n newBranch.depth = branch.depth - 1; //count down the recursion\n \n DrawBranch(x + vertex.x, y + vertex.y, newBranch, context);\n \n }\n \n //calculate end midpoint of branch\n vertex.x -= Math.cos(angle) * segmentLength;\n vertex.y -= Math.sin(angle) * segmentLength;\n \n //calculate end points of segment\n segment.x[2] = vertex.x + Math.cos(angle - Math.PI / 2) * segmentWidth;\n segment.y[2] = vertex.y + Math.sin(angle - Math.PI / 2) * segmentWidth;\n segment.x[3] = vertex.x + Math.cos(angle + Math.PI / 2) * segmentWidth;\n segment.y[3] = vertex.y + Math.sin(angle + Math.PI / 2) * segmentWidth;\n \n //draw the segment\n context.fillStyle = \"rgba(\" + branch.colour.r + \",\" + branch.colour.g + \",\" + branch.colour.b + \", 1)\";\n context.strokeStyle = \"rgba(\" + branch.colour.r + \",\" + branch.colour.g + \",\" + branch.colour.b + \", 1)\";\n context.beginPath();\n context.moveTo(x + segment.x[0], y + segment.y[0]);\n context.lineTo(x + segment.x[1], y + segment.y[1]);\n context.lineTo(x + segment.x[2], y + segment.y[2]);\n context.lineTo(x + segment.x[3], y + segment.y[3]);\n context.closePath();\n context.fill();\n context.stroke();\n \n //end points become start points of next segment\n segment.x[0] = segment.x[3];\n segment.y[0] = segment.y[3]; \n segment.x[1] = segment.x[2];\n segment.y[1] = segment.y[2];\n \n if (Math.random() < leafProb)\n {\n var leaf = new leafObj();\n var left = Math.random() < 0.5;\n \n if (left === true)\n {\n leaf.angle = angle + Math.random() * Math.PI / 4 + Math.PI/2;\n }\n else\n {\n leaf.angle = angle - Math.random() * Math.PI / 4 - Math.PI/2;\n }\n \n leaf.colour.r = branch.colour.r;\n leaf.colour.g = branch.colour.g;\n leaf.colour.b = branch.colour.b;\n\n DrawLeaf(x + vertex.x, y + vertex.y, leaf, context);\n }\n }\n }; \n \n\n}", "function drawVertex(p) {\n point(p.x, p.y);\n}", "function tree() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}", "createTree(treeData) {\n\n // ******* TODO: PART VI *******\n\n\n //Create a tree and give it a size() of 800 by 300. \n\n\n //Create a root for the tree using d3.stratify(); \n\n \n //Add nodes and links to the tree. \n try{\n\n function diagonal(s, d) {\n\n let path = 'M '+ s.y + ' ' + s.x +\n 'C '+ ((s.y + d.y) / 2) + ' ' + s.x + ',' +\n ((s.y + d.y) / 2) + ' ' + d.x + ',' +\n d.y + ' ' + d.x;\n\n return path;\n }\n this.treeData = treeData;\n let treeDisplay = d3.tree().size([800, 300]);\n\n let treeRoot = d3.stratify()\n // .id(d => d.id)\n .id((d, i) => i)\n .parentId(d => d.ParentGame)\n (treeData);\n\n let treeDisplayData = treeDisplay(treeRoot);\n\n let treeNodes = treeDisplayData.descendants();\n let treeLinks = treeDisplayData.descendants().slice(1); \n\n treeNodes.forEach(function(d){\n d.y = d.depth * 75 + 90;\n });\n\n let nodeSelection = d3.select(\"#tree\")\n .selectAll(\"g\")\n .data(treeNodes, d => d.id);\n\n let padding = 50;\n let nodeSelectionEnter = nodeSelection.enter()\n .append(\"g\")\n .attr(\"class\", d => (d.data.Wins == 1) ? \"winner\" : \"loser\")\n .classed(\"node\", true)\n .attr(\"transform\", d => (\"translate(\" + d.y + \",\" + d.x + \")\"));\n\n nodeSelectionEnter.append(\"circle\")\n .attr(\"r\", 6);\n\n nodeSelectionEnter.append(\"text\")\n .text(d => d.data.Team)\n .attr(\"dy\", \"0.35em\")\n .attr(\"x\", d => (!d.children ? 13 : -13))\n .attr(\"text-anchor\", d => (d.children) ? \"end\" : \"start\")\n // .attr(\"id\", function(d){return \"node\"+d.data.id.slice().replace(/[a-z]/gi, '');});\n .attr(\"id\", function(d){return \"node\"+d.data.id.slice().replace(/[a-z]/gi, '');});\n\n let nodeLink = d3.select(\"#tree\")\n .selectAll(\"path.link\")\n .data(treeLinks, d => d.id);\n // .data(treeLinks, function(d){ return d.id;})\n\n\n\n // for id, we have to use replace function, I found a related link which I am using:\n // https://stackoverflow.com/questions/1487422/regular-expression-in-javascript-to-remove-anything-that-is-not-a-z-0-9-and-hyp\n\n let nodeLinkEnter = nodeLink.enter()\n .insert(\"path\", \"g\")\n .classed(\"link\", true)\n .attr(\"d\", d => diagonal(d, d.parent))\n // .attr(\"id\", function(d){return d.data.id.slice().replace(/[^a-z]/gi, '');});\n .attr(\"id\", function(d){return d.data.id.slice().replace(/[^a-z]/gi, '');});\n }\n catch(error){\n console.log(error);\n }\n }", "function tree() {\n var separation = defaultSeparation$1,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n }" ]
[ "0.6588249", "0.6539659", "0.60968155", "0.6004436", "0.5975557", "0.59688026", "0.59235865", "0.59235865", "0.5895816", "0.5879113", "0.5870597", "0.5868967", "0.5859389", "0.5853435", "0.5836282", "0.58235264", "0.5771436", "0.5765022", "0.57234573", "0.57196176", "0.56992733", "0.56948256", "0.5682141", "0.56820554", "0.5678575", "0.56607467", "0.5626041", "0.5616906", "0.56163365", "0.56024873", "0.5554664", "0.55478126", "0.55402875", "0.55357516", "0.5475386", "0.5469151", "0.5440147", "0.5435405", "0.5426226", "0.5412891", "0.5403795", "0.53835416", "0.53767294", "0.5371314", "0.5369022", "0.535805", "0.5350066", "0.5324731", "0.5317579", "0.5314711", "0.5305144", "0.5293496", "0.52926743", "0.5287947", "0.5273187", "0.5269323", "0.5266028", "0.5263937", "0.5255221", "0.5254812", "0.5247208", "0.52350533", "0.52342254", "0.523386", "0.523282", "0.5228713", "0.5222687", "0.5209045", "0.5208489", "0.5188298", "0.5187588", "0.5183051", "0.518249", "0.517699", "0.5176757", "0.5169563", "0.5159168", "0.5158888", "0.51587135", "0.51479846", "0.5147557", "0.5142827", "0.5141905", "0.5140958", "0.5134395", "0.51297", "0.51215607", "0.51210606", "0.51204175", "0.51178813", "0.51138407", "0.5103462", "0.5102901", "0.51019317", "0.50987774", "0.50876343", "0.5083368", "0.50823337", "0.50782806", "0.5065155" ]
0.6361335
2
Some predefined rules for the Lsystem
function setRules0(){ rules.axiom = "F"; rules.mainRule = "F[--F++][F]"; params.iterations =1; params.theta = 12; params.scale = 16; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get rules() {\n\t\treturn [];\n\t}", "function ruleslanguage(hljs) {\n return {\n name: 'Oracle Rules Language',\n keywords: {\n keyword:\n 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' +\n 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' +\n 'INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 ' +\n 'INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 ' +\n 'INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 ' +\n 'INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 ' +\n 'INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 ' +\n 'INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 ' +\n 'INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 ' +\n 'INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 ' +\n 'INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 ' +\n 'INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 ' +\n 'INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 ' +\n 'INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 ' +\n 'INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 ' +\n 'MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER ' +\n 'OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE ' +\n 'NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH ' +\n 'IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND ' +\n 'UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ' +\n 'ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE ' +\n 'GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE ' +\n 'SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING ' +\n 'DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF ' +\n 'MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY ' +\n 'YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE ' +\n 'COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR ' +\n 'READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ' +\n 'ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE ' +\n 'EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE ' +\n 'SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL ' +\n 'COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN ' +\n 'MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING ' +\n 'FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ' +\n 'NUMDAYS READ_DATE STAGING',\n built_in:\n 'IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML ' +\n 'DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT ' +\n 'DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE ' +\n 'DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT ' +\n 'DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME'\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'literal',\n variants: [\n { // looks like #-comment\n begin: '#\\\\s+',\n relevance: 0\n },\n {\n begin: '#[a-zA-Z .]+'\n }\n ]\n }\n ]\n };\n}", "function ruleslanguage(hljs) {\n return {\n name: 'Oracle Rules Language',\n keywords: {\n keyword:\n 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' +\n 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' +\n 'INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 ' +\n 'INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 ' +\n 'INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 ' +\n 'INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 ' +\n 'INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 ' +\n 'INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 ' +\n 'INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 ' +\n 'INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 ' +\n 'INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 ' +\n 'INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 ' +\n 'INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 ' +\n 'INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 ' +\n 'INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 ' +\n 'MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER ' +\n 'OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE ' +\n 'NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH ' +\n 'IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND ' +\n 'UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ' +\n 'ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE ' +\n 'GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE ' +\n 'SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING ' +\n 'DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF ' +\n 'MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY ' +\n 'YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE ' +\n 'COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR ' +\n 'READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ' +\n 'ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE ' +\n 'EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE ' +\n 'SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL ' +\n 'COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN ' +\n 'MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING ' +\n 'FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ' +\n 'NUMDAYS READ_DATE STAGING',\n built_in:\n 'IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML ' +\n 'DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT ' +\n 'DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE ' +\n 'DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT ' +\n 'DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME'\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'literal',\n variants: [\n { // looks like #-comment\n begin: '#\\\\s+',\n relevance: 0\n },\n {\n begin: '#[a-zA-Z .]+'\n }\n ]\n }\n ]\n };\n}", "function ruleslanguage(hljs) {\n return {\n name: 'Oracle Rules Language',\n keywords: {\n keyword: 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' +\n 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' +\n 'INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 ' +\n 'INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 ' +\n 'INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 ' +\n 'INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 ' +\n 'INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 ' +\n 'INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 ' +\n 'INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 ' +\n 'INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 ' +\n 'INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 ' +\n 'INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 ' +\n 'INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 ' +\n 'INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 ' +\n 'INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 ' +\n 'MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER ' +\n 'OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE ' +\n 'NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH ' +\n 'IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND ' +\n 'UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ' +\n 'ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE ' +\n 'GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE ' +\n 'SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING ' +\n 'DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF ' +\n 'MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY ' +\n 'YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE ' +\n 'COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR ' +\n 'READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ' +\n 'ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE ' +\n 'EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE ' +\n 'SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL ' +\n 'COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN ' +\n 'MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING ' +\n 'FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ' +\n 'NUMDAYS READ_DATE STAGING',\n built_in: 'IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML ' +\n 'DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT ' +\n 'DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE ' +\n 'DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT ' +\n 'DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME'\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'literal',\n variants: [\n {begin: '#\\\\s+[a-zA-Z\\\\ \\\\.]*', relevance: 0}, // looks like #-comment\n {begin: '#[a-zA-Z\\\\ \\\\.]+'}\n ]\n }\n ]\n };\n}", "function ruleslanguage(hljs) {\n return {\n name: 'Oracle Rules Language',\n keywords: {\n keyword: 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' +\n 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' +\n 'INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 ' +\n 'INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 ' +\n 'INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 ' +\n 'INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 ' +\n 'INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 ' +\n 'INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 ' +\n 'INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 ' +\n 'INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 ' +\n 'INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 ' +\n 'INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 ' +\n 'INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 ' +\n 'INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 ' +\n 'INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 ' +\n 'MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER ' +\n 'OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE ' +\n 'NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH ' +\n 'IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND ' +\n 'UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ' +\n 'ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE ' +\n 'GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE ' +\n 'SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING ' +\n 'DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF ' +\n 'MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY ' +\n 'YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE ' +\n 'COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR ' +\n 'READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ' +\n 'ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE ' +\n 'EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE ' +\n 'SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL ' +\n 'COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN ' +\n 'MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING ' +\n 'FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ' +\n 'NUMDAYS READ_DATE STAGING',\n built_in: 'IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML ' +\n 'DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT ' +\n 'DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE ' +\n 'DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT ' +\n 'DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME'\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'literal',\n variants: [\n {begin: '#\\\\s+[a-zA-Z\\\\ \\\\.]*', relevance: 0}, // looks like #-comment\n {begin: '#[a-zA-Z\\\\ \\\\.]+'}\n ]\n }\n ]\n };\n}", "getLexRules() {\n\n // Return if the rules were provided by a user,\n // or we have already calculated them from terminals.\n if (this._lexRules) {\n return this._lexRules;\n }\n\n this._lexRules = {};\n\n this.getTerminals().forEach(terminal => {\n this._lexRules[terminal] = terminal;\n });\n\n return this._lexRules;\n }", "function generateRules() {\n window.rules.forEach(rule => {\n switch (rule.type) {\n case 'show':\n window.showRule(rule);\n break;\n case 'valid':\n window.validRule(rule);\n break;\n default:\n }\n });\n}", "function InterfaceRules( ruleList ){\n\n}", "function linTbUseLyNoSs() {\n this.ruleID = 'linTbUseLyNoSs';\n}", "function LSystem(axiom, r) {\n this.sentence = axiom; // The sentence (a String)\n this.ruleset = r; // The ruleset (an array of Rule objects)\n this.generation = 0; // Keeping track of the generation #\n\n // Generate the next generation\n this.generate = function() {\n // An empty StringBuffer that we will fill\n let nextgen = '';\n // For every character in the sentence\n for (let i = 0; i < this.sentence.length; i++) {\n // What is the character\n // We will replace it with itself unless it matches one of our rules\n let replace = this.sentence.charAt(i);\n // Check every rule\n for (let j = 0; j < this.ruleset.length; j++) {\n let a = this.ruleset[j].getA();\n // if we match the Rule, get the replacement String out of the Rule\n if (a === replace) {\n replace = this.ruleset[j].getB();\n break;\n }\n }\n // Append replacement String\n nextgen += replace;\n }\n // Replace sentence\n this.sentence = nextgen;\n // Increment generation\n this.generation++;\n };\n\n this.getSentence = function() {\n return this.sentence;\n };\n\n this.getGeneration = function() {\n return this.generation;\n };\n}", "verifyRules()\r\n {\r\n for (let rule of RULES) {\r\n for (let entry of this.app.entries()) {\r\n rule(this, entry);\r\n }\r\n }\r\n }", "function buildRules() {\n\n // Start creating a new ruleset\n var ruleset = $.deps.createRuleset();\n\n var masterSwitch = ruleset.createRule(getDGFId(\"mechanicalThrombectomyDevice\") + \" select\",\n \"not-any\",\n [\"--NOVALUE--\", \"noDevice\", \"notApplicable\"]);\n\n\n // Make this controls to be slave for the master rule\n masterSwitch.include(getDGFId(\"dac\"));\n masterSwitch.include(getDGFId(\"numberOfAttempts\"));\n\n // Some more selection dropdowns under master rule\n\n masterSwitch.include(getDGFId(\"balloonGuide\"));\n masterSwitch.include(getDGFId(\"aspirationInGuideDuringThrombectomy\"));\n masterSwitch.include(getDGFId(\"incubationOfDevice\"));\n masterSwitch.include(getDGFId(\"delayedReocclusion\"));\n masterSwitch.include(getDGFId(\"angioplasty\"));\n\n // Check that <select> value equals our choice \"yes\"\n var angioplasty = masterSwitch.createRule(getDGFId(\"angioplasty\") + \" select\", \"==\", \"yes\");\n angioplasty.include(getDGFId(\"angioplastyExtraCranial\"));\n angioplasty.include(getDGFId(\"angioplastyIntraCranial\"));\n\n // Another <select> with nested options\n masterSwitch.include(getDGFId(\"adjunctiveStenting\"));\n var adjunctiveStenting = masterSwitch.createRule(getDGFId(\"adjunctiveStenting\") + \" select\", \"==\", \"yes\");\n adjunctiveStenting.include(getDGFId(\"adjunctiveStentingExtraCranial\"));\n adjunctiveStenting.include(getDGFId(\"adjunctiveStentingIntraCranial\"));\n\n // Then add some third level options which check against checboxes\n var adjunctiveStentingExtraCranial = adjunctiveStenting.createRule(getDGFId(\"adjunctiveStentingExtraCranial\") + \" input\", \"==\", true);\n adjunctiveStentingExtraCranial.include(getDGFId(\"adjunctiveStentingExtraCranialType\"));\n\n var adjunctiveStentingIntraCranial = adjunctiveStenting.createRule(getDGFId(\"adjunctiveStentingIntraCranial\") + \" input\", \"==\", true);\n adjunctiveStentingIntraCranial.include(getDGFId(\"adjunctiveStentingIntraCranialType\"));\n\n masterSwitch.include(getDGFId(\"ticiScoreAfterThisDevice\"));\n masterSwitch.include(getDGFId(\"wasSuccessful\"));\n\n return ruleset;\n }", "rule(r) { return this.rules[r] }", "rule(r) { return this.rules[r] }", "constructor(schema, rules) {\n this.schema = schema;\n this.rules = rules;\n this.tags = [];\n this.styles = [];\n rules.forEach((rule) => {\n if (rule.tag)\n this.tags.push(rule);\n else if (rule.style)\n this.styles.push(rule);\n });\n this.normalizeLists = !this.tags.some((r) => {\n if (!/^(ul|ol)\\b/.test(r.tag) || !r.node)\n return false;\n let node = schema.nodes[r.node];\n return node.contentMatch.matchType(node);\n });\n }", "function printRules () {\n\n\tvar d = document.getElementById(\"mainDivRule\");\n\n\twhile ( d.hasChildNodes() ) {\n\t\twhile ( d.childNodes.length >= 1 ) {\n\t\t\td.removeChild( d.firstChild ); \n\t\t} \n\t}\n\n\tvar table = document.createElement(\"table\");\n\n\tfor ( var key in systemRules ) {\n\t\tvar trow = document.createElement(\"tr\");\t\n\t\tvar tcol = document.createElement(\"td\");\n\n\t\tif ( !isLastKey (key, systemRules)) {\n\t\t\ttcol.setAttribute(\"style\",\"border-bottom:1px solid black\");\t\n\t\t}\n\n\t\ttcol.appendChild(document.createTextNode(\"IF \"));\n\t\tfor ( var key2 in systemRules[key].inputList ) {\n\t\t\tvar x = systemRules[key].inputList[key2];\n\n\t\t\tvar ns =\"\";\n\t\t\tif (x.negated){\n\t\t\t\tns = \"NOT\";\n\t\t\t} \n\n\t\t\tif ( strcmp(x.rightEl,\"(Not used)\") == 0 ) {\n\t\t\t} else {\n\t\t\t\tif ( !isFirstKey ( key2, systemRules[key].inputList ) ) {\n\t\t\t\t\ttcol.appendChild(document.createTextNode(systemRules[key].connective + \" \"));\n\t\t\t\t}\n\t\t\t\tif ( inputDivs[x.leftEl] !== undefined ) {\n\t\t\t\t\ttcol.appendChild(document.createTextNode(inputDivs[x.leftEl].varName + \" IS \" + ns + \" \" + x.rightEl + \" \"));\n\t\t\t\t} else {\n\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif ( (isLastKey (key2, systemRules[key].inputList))) {\n\t\t\t\ttcol.appendChild(document.createTextNode(\"THEN \"));\n\t\t\t}\n\t\t}\n\n\t\tfor ( var key2 in systemRules[key].outputList ) {\n\t\t\tvar x = systemRules[key].outputList[key2];\n\n\t\t\tvar ns =\"\";\n\t\t\tif (x.negated){\n\t\t\t\tns = \"NOT\";\n\t\t\t} \n\n\t\t\tif ( !isFirstKey ( key2, systemRules[key].outputList ) ) {\n\t\t\t\tif ( strcmp (x.rightEl, \"(Not used)\") != 0) { \n\t\t\t\t\ttcol.appendChild(document.createTextNode(systemRules[key].connective + \" \"));\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ( strcmp(x.rightEl,\"(Not used)\") == 0 ) {\n\t\t\t} else {\n\t\t\t\tif ( outputDivs[x.leftEl] !== undefined ) {\n\t\t\t\t\ttcol.appendChild(document.createTextNode(outputDivs[x.leftEl].varName + \" IS \" + ns + \" \" + x.rightEl + \" \"));\n\t\t\t\t} else {\n\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t\n\n\t\ttcol.appendChild(document.createTextNode(\"(\" + systemRules[key].weight + \")\"));\t\t\t\n\n\t\tvar tcol2 = document.createElement(\"td\");\n\n\t\tif ( !isLastKey (key, systemRules)) {\n\t\t\ttcol2.setAttribute(\"style\",\"border-bottom:1px solid black\");\t\n\t\t}\n\n\t\tvar deleteButton = document.createElement(\"button\");\n\t\tdeleteButton.className = \"btn btn-danger lowMarge\";\n\t\tdeleteButton.setAttribute (\"style\",\"float:right\")\n\t\tdeleteButton.appendChild(document.createTextNode(\"Delete\"));\n\t\tdeleteButton.setAttribute(\"onclick\", \"deleteRule(\" + s + \")\");\n\t\ttcol2.appendChild(deleteButton);\n\t\t\n\t\tvar editButton = document.createElement(\"button\");\n\t\teditButton.className = \"btn btn-primary lowMarge\";\n\t\teditButton.setAttribute (\"style\",\"float:right\")\n\t\teditButton.appendChild(document.createTextNode(\"Edit\"));\n\t\tvar s = \"\\\"\"+ key +\"\\\"\";\n\t\teditButton.setAttribute(\"onclick\", \"resetRuleCreator(); editRule(\" + s + \")\");\n\t\ttcol2.appendChild(editButton);\n\n\t\ttrow.appendChild(tcol);\n\t\ttrow.appendChild(tcol2);\n\t\ttable.appendChild(trow);\n\t}\n\n\td.appendChild(table);\n\n\tif ( getLength(true) == 2 && getLength(false) == 1 ) {\n\t\tdocument.getElementById(\"ruleTableTitle\").innerHTML = \"<h4 class='smallIndent'>Rule Tables</h4>\";\n\t\tprintRulesAsTable(\"AND\");\n\t\tprintRulesAsTable(\"OR\");\n\t} else {\n\t\tdocument.getElementById(\"ruleTableTitle\").innerHTML = \"\";\n\t\tclearNode(document.getElementById(\"ruleTableDivAND\"));\n\t\tclearNode(document.getElementById(\"ruleTableDivOR\"));\t\n\t}\n\t\n\n}", "function ruleList()\n{\n\t// Fetch the rules from the algebraic equivalence module\n\treturn rules.getRules();\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = []; // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n\n this.__cache__ = null;\n} ////////////////////////////////////////////////////////////////////////////////", "constructor() {\n this.allowFunctions = new ValidationRule();\n this.allowConstants = new ValidationRule();\n this.allowVariables = new ValidationRule();\n\n // this.acceptMathOperations = new ValidationRule();\n this.acceptEquations = new ValidationRule();\n this.acceptInequalities = new ValidationRule();\n this.acceptSequenceOfStatements = new ValidationRule();\n this.acceptEmpty = new ValidationRule();\n this.acceptOnlyNumber = new ValidationRule();\n\n this.valueOnlyFinite = new ValidationRule();\n this.valueOnlyInteger = new ValidationRule();\n this.valueRange = new ValidationRule();\n this.valueOnlyGreaterThan = new ValidationRule();\n this.valueOnlyLessThan = new ValidationRule();\n }", "_learnRules() {\n each(this._perimeters || [], (perimeter) => {\n this.governess.learnRules(perimeter);\n });\n }", "function Ruler() {\n\t // List of added rules. Each element is:\n\t //\n\t // { name: XXX,\n\t // enabled: Boolean,\n\t // fn: Function(),\n\t // alt: [ name2, name3 ] }\n\t //\n\t this.__rules__ = [];\n\n\t // Cached rule chains.\n\t //\n\t // First level - chain name, '' for default.\n\t // Second level - digital anchor for fast filtering by charcodes.\n\t //\n\t this.__cache__ = null;\n\t}", "function Ruler() {\n\t // List of added rules. Each element is:\n\t //\n\t // { name: XXX,\n\t // enabled: Boolean,\n\t // fn: Function(),\n\t // alt: [ name2, name3 ] }\n\t //\n\t this.__rules__ = [];\n\n\t // Cached rule chains.\n\t //\n\t // First level - chain name, '' for default.\n\t // Second level - digital anchor for fast filtering by charcodes.\n\t //\n\t this.__cache__ = null;\n\t}", "function Ruler() {\n\t // List of added rules. Each element is:\n\t //\n\t // { name: XXX,\n\t // enabled: Boolean,\n\t // fn: Function(),\n\t // alt: [ name2, name3 ] }\n\t //\n\t this.__rules__ = [];\n\n\t // Cached rule chains.\n\t //\n\t // First level - chain name, '' for default.\n\t // Second level - digital anchor for fast filtering by charcodes.\n\t //\n\t this.__cache__ = null;\n\t}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // { name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ] }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - digital anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n }", "constructor(tokenizer, rules, main) {\n super(tokenizer)\n this.rules = {}\n this.main = main\n for(var r in rules) this.add(rules[r])\n \n }", "function load_custom_logic(rules) {\n /**\n * Ici on gère les embranchements/apparition/disparition de metaboxes et de fields\n * \n * une rule a les attributs :\n * - source_ids (array des id HTML des éléments à monitorer), \n * - (optional) source_selector qui override source_ids éventuellement\n * - target_selector (les éléments à show/hide) \n * - condition (la condition à satisfaire)\n */\n\n for (let rule of rules) {\n let source_selector = (rule.source_selector) ? rule.source_selector : '#' + rule.source_ids.join(', #');\n\n // we define the current rule function\n let curr_check_rule = function() {\n if (check_rule_condition(rule)) {\n let target = jQuery(rule.target_selector)\n target.show();\n // we enable all fields tha are now shown\n target.find('.ccnlib_post').removeAttr('disabled');\n } else {\n let target = jQuery(rule.target_selector)\n target.hide();\n // we disable all fields that are now hidden\n target.find('.ccnlib_post').attr('disabled', 'disabled');\n }\n }\n\n // we execute the rule now\n curr_check_rule();\n\n // we register the rule in a change event\n jQuery(source_selector).change(curr_check_rule);\n }\n}", "function $8f4a3e44e930d960$var$ruleslanguage(hljs) {\n return {\n name: \"Oracle Rules Language\",\n keywords: {\n keyword: \"BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM NUMDAYS READ_DATE STAGING\",\n built_in: \"IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME\"\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: \"literal\",\n variants: [\n {\n begin: \"#\\\\s+\",\n relevance: 0\n },\n {\n begin: \"#[a-zA-Z .]+\"\n }\n ]\n }\n ]\n };\n}", "function Ruler() {\n // List of added rules. Each element is:\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n this.__rules__ = [];\n // Cached rule chains.\n \n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n \n this.__cache__ = null;\n }", "function useLstW3CTch()\n {\n this.ruleID = 'useLstW3CTch';\n }", "function processRules(allText) {\n var allTextLines = allText.split(/\\r\\n|\\n/);\n var headers = allTextLines[0].split(',');\n\n for (var i=1; i<allTextLines.length; i++) {\n var data = allTextLines[i].split(',');\n if (data.length == headers.length) {\n var ruleMap = new Map();\n for (var j=0; j<headers.length; j++) {\n ruleMap.set(headers[j],data[j])\n }\n ruleLines.push(ruleMap);\n }\n }\n console.log('Rules:',ruleLines) // just to see rules at console\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // { name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ] }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - digital anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // { name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ] }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - digital anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "function Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "constructor() {\n this.rules = [];\n }", "function rules(x, aux, i, j) {\n\t\n\t\tvar t = 0;\n\t\t\n\t\tt += x[i-1][j-1];\n\t\tt += x[i][j-1];\n\t\tt += x[i+1][j-1];\n\t\tt += x[i-1][j];\n\t\tt += x[i+1][j];\n\t\tt += x[i-1][j+1];\n\t\tt += x[i][j+1];\n\t\tt += x[i+1][j+1];\n\n\t\tif(x[i][j] == 1) {\n\t\t\t\n\t\t\tif(t < 2 || t > 4)\n\t\t\t\taux[i][j] = 0;\n\t\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\tif(t == 3)\n\t\t\t\taux[i][j] = 1;\n\t\t}\n\t}", "__checkRules(){\n\n let keys = Object.keys(this.rules);\n\n for (let i=0; i<keys.length; i+=1){\n \n let name = keys[i];\n let ruleDef = Validator.ruleLibary[name];\n\n // Check this rule exists first\n //if (!ruleDef){\n // throw new Error(`Rule ${name} does not exist, and no validator given`);\n //} \n\n // Does the rule have a checkRule function?\n if (ruleDef && typeof ruleDef.checkRule == 'function'){\n ruleDef.checkRule(this.rules[name]);\n }\n\n }\n }", "function Rule () {\n this.continue = false;\n\tthis.filters = [];\n\tthis.modifiers = [];\n\tthis.codeLines = [];\n\n\tthis.match = function (item) {\n\t\treturn this.filters.every( function (filter) { return filter.match( item ); } );\n\t}\n\n\tthis.applyTo = function (item) {\n\t\tthis.modifiers.forEach( function (modifier) { modifier.applyTo( item ); } );\n\t}\n}", "get rules () {\n\t\treturn this._rules;\n\t}", "onRulesUpdated({ rules }) {\n this.loading.init = false;\n\n if (rules) {\n this.isActivityStepVisible = some(\n [\n 'organisation',\n 'vat',\n 'nationalIdentificationNumber',\n 'companyNationalIdentificationNumber',\n 'corporationType',\n ],\n (fieldName) => get(rules, `${fieldName}`) !== undefined,\n );\n\n let invalid = 0;\n\n Object.entries(rules).forEach(([key, value]) => {\n const modelItem = this.model[key];\n\n if (\n modelItem !== undefined &&\n (value.in &&\n !(typeof value.in[0] === 'string'\n ? value.in?.includes(modelItem)\n : !!value.in?.find((item) => item.value === modelItem)),\n value.regularExpression && modelItem\n ? !new RegExp(value.regularExpression).test(modelItem)\n : false,\n value.mandatory && !modelItem)\n ) {\n invalid += 1;\n }\n });\n\n this.isValid = invalid === 0;\n }\n }", "constructor(rules, main) {\n this.main = main\n this.rules = {}\n for(var i=0; i<rules.length; i++) {\n this.rules[rules[i].type] = rules[i]\n rules[i].parser = this\n } \n }", "function initRuleXs(rules, model) {\n return rules.map(function (r, i) {\n var conditions = r.conditions, _support = r._support, rest = __rest(r, [\"conditions\", \"_support\"]);\n var conditionXs = [];\n // if (i !== rules.length - 1) \n var conditionsFiltered = conditions.filter(function (c) { return c.feature >= 0; });\n conditionXs = conditionsFiltered.map(function (c) { return (__assign({}, c, { ruleIdx: r.idx, desc: model.categoryMathDesc(c.feature, c.category), title: model.categoryDescription(c.feature, c.category), x: 0, width: 0, height: 0, interval: model.categoryInterval(c.feature, c.category), expanded: false, range: model.meta.ranges[c.feature], \n // histRange: model.categoryHistRange(c.feature, c.category),\n isCategorical: model.meta.isCategorical[c.feature] })); });\n var _supportNew = _support ? _support : model.meta.labelNames.map(function () { return 0; });\n return __assign({}, rest, { conditions: conditionXs, height: 0, x: 0, y: 0, width: 0, expanded: false, _support: _supportNew });\n });\n }", "function checkSpecialRules(strStudent, std, tch, rules, msgObj)\n {\n\t\t// Check for failure to parse\n\t\tif (!std || !std.rootNode || !tch || !tch.rootNode)\n\t\t\treturn false;\n\n // x * 1 or x + 0 is not allowed:\n if (std.rootNode.checkForOnes())\n return exitWithMsg(msgObj, message.getMsg().ones);\n if (std.rootNode.checkForZeros())\n return exitWithMsg(msgObj, message.getMsg().zeroes);\n \n if (std.rootNode instanceof tree.Division && std.rootNode.checkForDenomZeros())\n return exitWithMsg(msgObj, message.getMsg().divideZero);\n\n if (!rules) //return true;\n rules = {}; // so that we can force simplify rule later\n rules.simplify = true; // the system set up is such that the simplify rule is always on\n \n if (rules.factored)\n {\n if (!eqTools.compareFactorObjects(std.getFactors(), tch.getFactors()))\n return exitWithMsg(msgObj, message.getMsg().factor);\n\n return true; // factored trump simplify\n }\n\n if (!rules.allowNegExp && std.checkForNegativeExponents())\n return exitWithMsg(msgObj, message.getMsg().negExp);\n\n rules.simplify = true; // the system set up is such that the simplify rule is always on\n var simplified = false;\n if (rules.simplify) // no other rules necessary:\n {\n if (std.reduceFractions()) // fractions such as 6/2 can be further reduced?\n return exitWithMsg(msgObj, message.getMsg().reduce); //\"fraction needs to be reduced.\");\n else if (std.simplify(rules)) // can be further simplified?\n return exitWithMsg(msgObj, message.getMsg().simplify); //\"Expression should be simplified.\");\n else if (!std.isFullyCombined()) // is already fully combined of like terms?\n return exitWithMsg(msgObj, message.getMsg().terms); //\"All same terms need to be combined.\");\n else if (std.areRadicalsInDenominator()) // are radicals rationalized?\n return exitWithMsg(msgObj, message.getMsg().rationalize); //\"Radicals can not be in denominators.\");\n else if (std.checkPerfectPower()) // no perfect squares found?\n return exitWithMsg(msgObj, message.getMsg().perfRoots); //\"All perfect-nroot factors need to be factored out the root simble.\");\n }\n\n if (rules.descendingOrder &&\n (!std.isOrderedPolynomial()))\n return exitWithMsg(msgObj, message.getMsg().descend);\n \n simplified = true;\n \n// if (rules.allowSlop)\n// simplified = simplified & eqTools.compareNumbersWithSlop(tch, std);\n \n return simplified;\n }", "function RunRule(rule){\n\n //Check if requested cube exist\n if(PhysikitCubeExist(rule.cube)) {\n\n //Check if request sensor exists\n if (SmartCitizenSensorExist(rule.smartSensor)) {\n\n if(debug.details)\n debug.log(\"Run rule for \" + rule.cube + \" on Physikit \"+ rule.id,\"Physikit Server\");\n\n switch(rule.mode) {\n case \"0\":\n //Find the sensor from the right SCK\n var sckId = rule.smartId;\n\n //Get the correct sensor value from the kit\n GetValueFromSensorOfSck(rule.smartSensor, sckId,function(valueOfSensor){\n\n if(valueOfSensor !=undefined){\n //Get the range of the sensor\n var sensorRange = {};\n sensorRange.min = common.getSensorByName(rule.smartSensor).min;\n sensorRange.max = common.getSensorByName(rule.smartSensor).max;\n\n //Map the value to Physikit Space\n var mappedValue = valueOfSensor.map(sensorRange.min,sensorRange.max,0,255);\n\n var convertedValue = Math.ceil(mappedValue);\n\n //Execute Physikit command\n if(!debug.disablePhysikitCalls)\n UpdatePhysikit(rule.id,rule.cube,rule.mode,rule.setting,rule.args,convertedValue);\n }\n });\n break;\n case \"2\":\n //Find the sensor from the right SCK\n var sckId = rule.smartId;\n\n //Calculate the relative distance: 0: decrease, 1: same, 2: increase\n GetRelativeDistanceFromSensorOfSck(rule.smartSensor,sckId,function(relativeMove){\n //if(relativeMove == 0 || relativeMove ==2)\n //{\n //Todo: only increase or decrease, or also send \"same\"??????\n if(!debug.disablePhysikitCalls)\n UpdatePhysikit(rule.id,rule.cube,rule.mode,rule.setting,rule.args,relativeMove);\n //}\n });\n break;\n case \"1\":\n //Find the sensor from the right SCK\n var sckId = rule.smartId;\n\n //Grab th\n var operator = rule.condition.substring(0,1);\n\n var value = rule.condition.substring(1,rule.condition.length);\n\n CheckIfAlertIsValidFromSensorOfSck(rule.smartSensor,sckId,operator,value,function(result){\n if(result == true){\n if(!debug.disablePhysikitCalls)\n UpdatePhysikit(rule.id,rule.cube,rule.mode,rule.setting,rule.args,rule.value);\n }\n\n });\n break;\n default:\n if(debug.details)\n debug.log(\"Found incompatible rule \"+ rule.condition,\"Physikit Server\",\"Error\");\n break;\n }\n\n //Send update event\n io.to(rule.id).emit('rule',rule);\n\n }\n }\n}", "function loadsystemUI(system) {\n rulewrapper.innerHTML = '';\n iName.value = 'auto'\n iStart.value = system.axiom;\n iAngle.value = system.data.angle;\n iLen.value = system.data.len;\n\n for (let i = 0; i < system.data.rules.length; i++) {\n addRule(system.data.rules[i].a, system.data.rules[i].b)\n }\n}", "function DHBMLUIRulesConfig() {\n var _this = _super.call(this) || this;\n _this.localisationKeys.push('rules_Game');\n return _this;\n }", "static getRules() {\n return {\n \"hasValue\": this.hasValue,\n \"isValidDayWord\": this.isValidDayWord,\n \"isValidDayNumber\": this.isValidDayNumber\n };\n }", "function Generate_PLC_RLL(){\r\n\t// get all the data from the tables\r\n\t// this data is a string of 1's, 0's and spaces ' ' \r\n\tvar input_cnt = $('#input_list').find('td').length;\r\n\tvar output_cnt = $('#output_list').find('td').length;\r\n\tvar rule_cnt = $('#rule_id').find('td').length;\r\n\tvar irules_str = $('#input_rules').text();\r\n\tvar orules_str = $('#output_rules').text();\r\n\tvar i_prefix = $('#code_i_prefix').val();\r\n\tvar r_prefix = $('#code_r_prefix').val();\r\n\tvar e_prefix = $('#code_e_prefix').val();\r\n\tvar o_prefix = $('#code_o_prefix').val();\r\n\t// Need\r\n\t// Inputs word - eg N10:0 -> Input 0 is N10:0/0\r\n\t// Rules word - eg N10:1 -> Rule 0 is N10:1/0\r\n\t// Rule enable word - eg N10:2 -> Rule 0 Enable is N10:2/0\r\n\t// Outputs word - eg N10:3 -> Output 0 is N10:3/0\r\n\t\r\n\t// generate the inputs mapping\r\n\tvar input_rll = Generate_PLC_Inputs( i_prefix, input_cnt);\r\n\tif(input_rll.length > 1){\r\n\t\t$('#logic1').text( 'SOR BST ' + input_rll.join(' NXB ') + ' BND EOR ');\r\n\t}else{\r\n\t\t$('#logic1').text( 'SOR ' + input_rll[0] + ' EOR ');\r\n\t}\r\n\t\r\n\t// generate the input rules mapping\r\n\tvar rule_rll = Generate_PLC_RuleDecode( i_prefix, r_prefix, input_cnt, rule_cnt, irules_str);\r\n\tif(rule_rll.length > 1){\r\n\t\t$('#logic2').text( 'SOR BST ' + rule_rll.join(' NXB ') + ' BND EOR ');\r\n\t}else{\r\n\t\t$('#logic2').text( 'SOR ' + rule_rll[0] + ' EOR ');\r\n\t}\r\n\t\r\n\t// generate the output rules mapping\r\n\tvar output_rll = Generate_PLC_Outputs( r_prefix, e_prefix, o_prefix, rule_cnt, output_cnt, orules_str)\r\n\tif(output_rll.length > 1){\r\n\t\t$('#logic3').text( 'SOR BST ' + output_rll.join(' NXB ') + ' BND EOR ');\r\n\t}else{\r\n\t\t$('#logic3').text( 'SOR ' + output_rll[0] + ' EOR ');\r\n\t}\r\n\t\r\n\t// last 2 rungs\r\n\t$('#logic4').text( $('#logic2').text() + ' ' + $('#logic3').text());\r\n\r\n\t// combined rungs\r\n\t$('#logic5').text( $('#logic1').text() + ' ' + $('#logic2').text() + ' ' + $('#logic3').text());\r\n\r\n\t// comments\r\n\t$('#logic6').html( Generate_PLC_Comments());\r\n\t\r\n}", "modifyRules(rules){\n return (rules || []).map((rule)=>{\n let newRule = {\n ...rule\n };\n switch((rule.type || '').toLowerCase()){\n case 'number':\n delete newRule.type;\n return {\n validator : numberValidator,\n ...newRule\n };\n case 'integer':\n delete newRule.type;\n return {\n validator : integerValidator,\n ...newRule\n };\n\n default :\n return rule;\n }\n })\n }", "function FooRule() {\n}", "function LogicalRules (id, controller) {\n // Call superconstructor first (AutomationModule)\n LogicalRules.super_.call(this, id, controller);\n\n var self = this;\n \n this._testRule = function () { // wrapper to correct this and parameters in testRule\n self.testRule.call(self, null);\n };\n}", "function parse()\n{\n\trules=[];\n\t//if(document.getElementById(\"schematext\").value.length>0){schema=JSON.parse(document.getElementById(\"schematext\").value);}\n\t//else{\n\t\tschema=defaultSchema;\n\t//}//by default schema.json is loaded from the web page's folder, no need to paste it every time unless you need to change it\n\tvar line;var matched;var displayName;\n\tlines=document.getElementById(\"ruletext\").value.split(\"\\n\");\nfor(linenumber=0;linenumber<lines.length;linenumber++)\n{\n\tif(lines[linenumber].length==0){continue;}\n\tline=lines[linenumber];\n\tmatched=line.match(\".+?:\");if(!matched){continue;}\n\tlineheader=matched[0].substring(0,matched[0].length-1);line=line.substring(matched[0].length).trim();\n\tswitch (lineheader)\n\t{\n\t\tcase \"name\":\n\t\t\trule={};rules.push(rule);\n\t\t\tvar dni=line.indexOf(\",\");//display name index\n\t\t\tdisplayName=null;\n\t\t\tif(dni!=-1){displayName=line.substring(dni+1).trim();line=line.substring(0,dni).trim();}\n\t\t\trule.name=line.trim();if(displayName){rule.displayName=displayName;}\n\t\t\tbreak;\n\t\tcase 'leads to':\n\t\t\tvar rulenames=line.split(\",\");\n\t\t\tfor(var i=0;i<rulenames.length;i++)\n\t\t\t{\n\t\t\t\trulenames[i]=rulenames[i].trim();\n\t\t\t}\n\t\t\trule.leadsTo=rulenames;\n\t\t\tbreak;\n\t\tcase 'intent':\n\t\t\taddIntent(line.trim());\n\t\t\tbreak;\n\t\tcase 'conditions':\n\t\t\tvar conditions=line.split(\";\");if(\"conditions\" in rule==false){rule.conditions=[];}\n\t\t\tfor(var i=0;i<conditions.length;i++)\n\t\t\t{\n\t\t\t\trule.conditions.push(createCondition(conditions[i].trim()));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'effects':\n\t\t\tvar c=line.match(\"if\\\\s.+?:\");//conditional clause\n\t\t\tif(c)\n\t\t\t{//then all effects on this line are subject to this condition\n\t\t\t\t//note that for now allowing multiple conditions is not a good idea because conditions can only be connected with AND not OR, so generating negation of multiple conditions is pretty inefficient; better save this until we can use OR to connect conditions in Ensemble\n\t\t\t\tvar condEff={};\n\t\t\t\tvar condition=c[0].substring(2,c[0].length-1).trim();\n\t\t\t\tcondEff.condition=createCondition(condition);\n\t\t\t\tline=line.substring(c[0].length).trim();\n\t\t\t\t//check for else clause\n\t\t\t\tvar ec=line.match(\".*?else\\\\s*:\");//else clause\n\t\t\t\tif(ec)\n\t\t\t\t{\n\t\t\t\t\tvar elseEff={};condEff.elseEffects=[];\n\t\t\t\t\tvar elseEffects=line.substring(ec[0].length).split(\";\");//effects after the else:\n\t\t\t\t\tfor(var i=0;i<elseEffects.length;i++)\n\t\t\t\t\t{\t\n\t\t\t\t\t\tif(elseEffects[i].trim()){condEff.elseEffects.push(createEffect(elseEffects[i].trim()));}\n\t\t\t\t\t}\n\t\t\t\t\tline=line.substring(0,line.length-line.match(\"else\\\\s*:.*\")[0].length).trim();\n\t\t\t\t}\n\t\t\t\telse{condEff.elseEffects=[];}\n\t\t\t\tvar effects=line.split(\";\");condEff.effects=[];\n\t\t\t\tfor(var i=0;i<effects.length;i++)\n\t\t\t\t{\n\t\t\t\t\tif(effects[i].trim()){condEff.effects.push(createEffect(effects[i].trim()));}\n\t\t\t\t}\n\t\t\t\tif(\"effects\" in rule==false){rule.effects=[];}\n\t\t\t\trule.effects.push(condEff);//a conditional effect object in the list, will be split later\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar effects=line.split(\";\");if(\"effects\" in rule==false){rule.effects=[];}\n\t\t\t\tfor(var i=0;i<effects.length;i++)\n\t\t\t\t{\n\t\t\t\t\trule.effects.push(createEffect(effects[i].trim()));\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"is accept\":\n\t\t\tif(line.match(\"true\")){rule.isAccept=true;}\n\t\t\tif(line.match(\"false\")){rule.isAccept=false;}\n\t\tdefault: formatError(\"unknown line header\");\n\t}\n\t\n}\nfor(var i=0;i<rules.length;i++){sanitize(rules[i]);}//add necessary attributes like influence rules that I'm not using, and also split conditional rules until they are no longer conditional\nsplitRules();\nvar ruleobj={fileName:\"actions.json\",actions:rules};\ncif.clearActionLibrary();//modified cif.js to add this one\nactions = cif.addActions(ruleobj);\n}", "function Ruler$3() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}", "isRule(type) { return this.rule(type)!=null }", "function semanticRules(words){\n\n var string = \"\";\n var keyword, rule;\n for(var x = 0; x < words.length; x++){\n\n keyword = words[x];\n rule = languageForest[keyword];\n\n if (rule != undefined) string += rule;\n }\n\n return string;\n}", "function prepareRules(rules, macros, actions, tokens, startConditions, caseless, caseHelper) {\n var m, i, k, action, conditions,\n active_conditions,\n newRules = [];\n\n if (macros) {\n macros = prepareMacros(macros);\n }\n\n function tokenNumberReplacement (str, token) {\n return 'return ' + (tokens[token] || \"'\" + token + \"'\");\n }\n\n actions.push('switch($avoiding_name_collisions) {');\n\n for (i = 0; i < rules.length; i++) {\n active_conditions = [];\n if (Object.prototype.toString.apply(rules[i][0]) !== '[object Array]') {\n // implicit add to all inclusive start conditions\n for (k in startConditions) {\n if (startConditions[k].inclusive) {\n active_conditions.push(k);\n startConditions[k].rules.push(i);\n }\n }\n } else if (rules[i][0][0] === '*') {\n // Add to ALL start conditions\n active_conditions.push('*');\n for (k in startConditions) {\n startConditions[k].rules.push(i);\n }\n rules[i].shift();\n } else {\n // Add to explicit start conditions\n conditions = rules[i].shift();\n for (k = 0; k < conditions.length; k++) {\n if (!startConditions.hasOwnProperty(conditions[k])) {\n startConditions[conditions[k]] = {\n rules: [], inclusive: false\n };\n console.warn('Lexer Warning : \"' + conditions[k] + '\" start condition should be defined as %s or %x; assuming %x now.');\n }\n active_conditions.push(conditions[k]);\n startConditions[conditions[k]].rules.push(i);\n }\n }\n\n m = rules[i][0];\n if (typeof m === 'string') {\n for (k in macros) {\n if (macros.hasOwnProperty(k)) {\n m = m.split('{' + k + '}').join('(' + macros[k] + ')');\n }\n }\n m = new RegExp('^(?:' + m + ')', caseless ? 'i' : '');\n }\n newRules.push(m);\n if (typeof rules[i][1] === 'function') {\n rules[i][1] = String(rules[i][1]).replace(/^\\s*function \\(\\)\\s?\\{/, '').replace(/\\}\\s*$/, '');\n }\n action = rules[i][1];\n if (tokens && action.match(/return '[^']+'/)) {\n action = action.replace(/return '([^']+)'/g, tokenNumberReplacement);\n }\n \n var code = ['\\n/*! Conditions::'];\n code = code.concat(active_conditions);\n code = code.concat('*/', '\\n/*! Rule:: ');\n code = code.concat(rules[i][0]);\n code = code.concat('*/', '\\n');\n \n var match_nr = /^return\\s+('[^\\']+'|\\d+)\\s*;?$/.exec(action.trim());\n if (match_nr) {\n caseHelper.push([].concat(code, i, ':', match_nr[1]).join(' ').replace(/[\\n]/g, '\\n '));\n } else {\n actions.push([].concat('case', i, ':', code, action, '\\nbreak;').join(' '));\n }\n }\n actions.push('default:');\n actions.push(' return this.simpleCaseActionClusters[$avoiding_name_collisions];');\n actions.push('}');\n\n return newRules;\n}", "function prepareRules(rules, macros, actions, tokens, startConditions, caseless, caseHelper) {\n var m, i, k, action, conditions,\n active_conditions,\n newRules = [];\n\n if (macros) {\n macros = prepareMacros(macros);\n }\n\n function tokenNumberReplacement (str, token) {\n return 'return ' + (tokens[token] || \"'\" + token + \"'\");\n }\n\n actions.push('switch($avoiding_name_collisions) {');\n\n for (i = 0; i < rules.length; i++) {\n active_conditions = [];\n if (Object.prototype.toString.apply(rules[i][0]) !== '[object Array]') {\n // implicit add to all inclusive start conditions\n for (k in startConditions) {\n if (startConditions[k].inclusive) {\n active_conditions.push(k);\n startConditions[k].rules.push(i);\n }\n }\n } else if (rules[i][0][0] === '*') {\n // Add to ALL start conditions\n active_conditions.push('*');\n for (k in startConditions) {\n startConditions[k].rules.push(i);\n }\n rules[i].shift();\n } else {\n // Add to explicit start conditions\n conditions = rules[i].shift();\n for (k = 0; k < conditions.length; k++) {\n if (!startConditions.hasOwnProperty(conditions[k])) {\n startConditions[conditions[k]] = {\n rules: [], inclusive: false\n };\n console.warn('Lexer Warning : \"' + conditions[k] + '\" start condition should be defined as %s or %x; assuming %x now.');\n }\n active_conditions.push(conditions[k]);\n startConditions[conditions[k]].rules.push(i);\n }\n }\n\n m = rules[i][0];\n if (typeof m === 'string') {\n for (k in macros) {\n if (macros.hasOwnProperty(k)) {\n m = m.split('{' + k + '}').join('(' + macros[k] + ')');\n }\n }\n m = new RegExp('^(?:' + m + ')', caseless ? 'i' : '');\n }\n newRules.push(m);\n if (typeof rules[i][1] === 'function') {\n rules[i][1] = String(rules[i][1]).replace(/^\\s*function \\(\\)\\s?\\{/, '').replace(/\\}\\s*$/, '');\n }\n action = rules[i][1];\n if (tokens && action.match(/return '[^']+'/)) {\n action = action.replace(/return '([^']+)'/g, tokenNumberReplacement);\n }\n \n var code = ['\\n/*! Conditions::'];\n code = code.concat(active_conditions);\n code = code.concat('*/', '\\n/*! Rule:: ');\n code = code.concat(rules[i][0]);\n code = code.concat('*/', '\\n');\n \n var match_nr = /^return\\s+('[^\\']+'|\\d+)\\s*;?$/.exec(action.trim());\n if (match_nr) {\n caseHelper.push([].concat(code, i, ':', match_nr[1]).join(' ').replace(/[\\n]/g, '\\n '));\n } else {\n actions.push([].concat('case', i, ':', code, action, '\\nbreak;').join(' '));\n }\n }\n actions.push('default:');\n actions.push(' return this.simpleCaseActionClusters[$avoiding_name_collisions];');\n actions.push('}');\n\n return newRules;\n}", "getRules() {\n var _a;\n return Config.getRulesObject((_a = this.config.rules) !== null && _a !== void 0 ? _a : {});\n }", "addRules(name, rules) {\n // Find the rule\n let rule = this._rules[name];\n\n // Check if the rule exits\n if( rule === undefined )\n return false;\n\n //\n if( !isArray(rule) ) {\n // Set the rule\n this._rules[name] = rules[0];\n\n // Return!\n return true;\n }\n\n // Push all the rules\n for( let i = 0; i < rules.length; i++ )\n rule.push(rules[i]);\n\n // Return!\n return true;\n }", "function _executeRule(oRules, oBody, oJournal, oJournalItem, oFields, pItem) {\n\t\t//Variables for Rule Parameters\n\t\tvar lvParameter1 = \"\",\n\t\t\tlvParameter2 = \"\",\n\t\t\tlvParameter3 = \"\",\n\t\t\tlvParameter4 = \"\",\n\t\t\tlvParameter5 = \"\",\n\t\t\tlvReturn,\n\t\t\toLevel = [],\n\t\t\tlvLevelIndex;\n\n\t\t//Execute Rules\n\t\tfor (var j = 0; j < oRules.length; j++) {\n\t\t\t//Perform the Function\n\t\t\tswitch (oRules[j].FUNCTION) {\n\t\t\t\tcase \"LEFT\":\n\t\t\t\t\t//Get Parameter 1 Value\n\t\t\t\t\tvar lvInTable,\n\t\t\t\t\t\tlvInField;\n\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER1) {\n\t\t\t\t\t\tvar oSplit = oRules[j].PARAMETER1.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter1 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter1 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter1 = oRules[j].PARAMETER1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Other Parameters\n\t\t\t\t\tlvParameter2 = parseFloat(oRules[j].PARAMETER2);\n\t\t\t\t\t//Call Conversion Functions\n\t\t\t\t\tlvReturn = ConversionLibrary.VAT_LEFT(lvParameter1, lvParameter2);\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"RIGHT\":\n\t\t\t\t\t//Get Parameter 1 Value\n\t\t\t\t\tvar lvInTable,\n\t\t\t\t\t\tlvInField;\n\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER1) {\n\t\t\t\t\t\tvar oSplit = oRules[j].PARAMETER1.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter1 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter1 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter1 = oRules[j].PARAMETER1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Other Parameters\n\t\t\t\t\tlvParameter2 = parseFloat(oRules[j].PARAMETER2);\n\t\t\t\t\t//Call Conversion Function\n\t\t\t\t\tlvReturn = ConversionLibrary.VAT_RIGHT(lvParameter1, lvParameter2);\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"MID\":\n\t\t\t\t\t//Get Parameter 1 Value\n\t\t\t\t\tvar lvInTable,\n\t\t\t\t\t\tlvInField;\n\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER1) {\n\t\t\t\t\t\tvar oSplit = oRules[j].PARAMETER1.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter1 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter1 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter1 = oRules[j].PARAMETER1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Other Parameters\n\t\t\t\t\tlvParameter2 = parseFloat(oRules[j].PARAMETER2);\n\t\t\t\t\tlvParameter3 = parseFloat(oRules[j].PARAMETER3);\n\t\t\t\t\t//Call Conversion Function\n\t\t\t\t\tlvReturn = ConversionLibrary.VAT_MID(lvParameter1, lvParameter2, lvParameter3);\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"CONCATENATE\":\n\t\t\t\t\t//Get Parameter 1 Value\n\t\t\t\t\tvar lvInTable,\n\t\t\t\t\t\tlvInField;\n\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER1) {\n\t\t\t\t\t\tvar oSplit = oRules[j].PARAMETER1.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter1 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter1 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter1 = oRules[j].PARAMETER1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get Parameter 2 Value\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER2) {\n\t\t\t\t\t\toSplit = oRules[j].PARAMETER2.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter2 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter2 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter2 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter2 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter2 = oRules[j].PARAMETER2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get Parameter 3 Value\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER3) {\n\t\t\t\t\t\toSplit = oRules[j].PARAMETER3.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter3 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter3 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter3 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter3 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter3 = oRules[j].PARAMETER2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get Parameter 4 Value\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER4) {\n\t\t\t\t\t\toSplit = oRules[j].PARAMETER4.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter4 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter4 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter4 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter4 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter4 = oRules[j].PARAMETER2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get Parameter 5 Value\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER5) {\n\t\t\t\t\t\toSplit = oRules[j].PARAMETER5.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter5 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter5 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter5 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter5 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter5 = oRules[j].PARAMETER2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlvReturn = ConversionLibrary.VAT_CONCATENATE(lvParameter1, lvParameter2, lvParameter3, lvParameter4, lvParameter5);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"LOOKUP\":\n\t\t\t\t\t//Get Parameter 1 Value\n\t\t\t\t\tvar lvInTable,\n\t\t\t\t\t\tlvInField;\n\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER1) {\n\t\t\t\t\t\tvar oSplit = oRules[j].PARAMETER1.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter1 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter1 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter1 = oRules[j].PARAMETER1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Other Parameters\n\t\t\t\t\tlvParameter2 = oRules[j].PARAMETER2;\n\t\t\t\t\t//Call Conversion Functions\n\t\t\t\t\tlvReturn = ConversionLibrary.VAT_LOOKUP(lvParameter1, lvParameter2);\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"IF\":\n\t\t\t\t\t//Get Parameter 1 Value\n\t\t\t\t\tvar lvInTable,\n\t\t\t\t\t\tlvInField,\n\t\t\t\t\t\tlvOperator;\n\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER1) {\n\t\t\t\t\t\tvar oOperatorSplit = oRules[j].PARAMETER1.split(\"=\");\n\n\t\t\t\t\t\tif (!oOperatorSplit.length > 1) {\n\t\t\t\t\t\t\toOperatorSplit = oRules[j].PARAMETER1.split(\"!=\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!lvOperator) lvOperator = \"=\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!oOperatorSplit.length > 1) {\n\t\t\t\t\t\t\toOperatorSplit = oRules[j].PARAMETER1.split(\">\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!lvOperator) lvOperator = \"!=\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!oOperatorSplit.length > 1) {\n\t\t\t\t\t\t\toOperatorSplit = oRules[j].PARAMETER1.split(\"<\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!lvOperator) lvOperator = \">\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!oOperatorSplit.length > 1) {\n\t\t\t\t\t\t\toOperatorSplit = oRules[j].PARAMETER1.split(\">=\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!lvOperator) lvOperator = \"<\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!oOperatorSplit.length > 1) {\n\t\t\t\t\t\t\toOperatorSplit = oRules[j].PARAMETER1.split(\"<=\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!lvOperator) lvOperator = \">=\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!oOperatorSplit.length > 1) {\n\t\t\t\t\t\t\toOperatorSplit = oRules[j].PARAMETER1.split(\"<>\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!lvOperator) lvOperator = \"<=\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!lvOperator) {\n\t\t\t\t\t\t\tlvOperator = \"<>\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar oSplit = oOperatorSplit[0].split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter1 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t\tif (!lvParameter1) lvParameter1 = \"\";\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t\tif (!lvParameter1) lvParameter1 = \"\";\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter1 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t\tif (!lvParameter1) lvParameter1 = \"\";\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter1 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t\tif (!lvParameter1) lvParameter1 = \"\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// \t\t\tlvParameter1 = lvParameter1 + \" \" + lvOperator + \" \" + oOperatorSplit[1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter1 = oRules[j].PARAMETER1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get Parameter 2 Value\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER2) {\n\t\t\t\t\t\toSplit = oRules[j].PARAMETER2.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter2 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter2 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter2 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter2 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter2 = oRules[j].PARAMETER2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get Parameter 3 Value\n\t\t\t\t\t//Check if it is a Table and Field\n\t\t\t\t\tif (oRules[j].PARAMETER3) {\n\t\t\t\t\t\toSplit = oRules[j].PARAMETER3.split(\".\");\n\t\t\t\t\t\t//It is a Table and Field\n\t\t\t\t\t\tif (oSplit.length > 1) {\n\t\t\t\t\t\t\tlvInTable = oSplit[0];\n\t\t\t\t\t\t\tlvInField = oSplit[1];\n\n\t\t\t\t\t\t\tif (lvInTable === gvInBatchHeaderTable) {\n\t\t\t\t\t\t\t\tlvParameter3 = oBody[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalHeader) {\n\t\t\t\t\t\t\t\tlvParameter3 = oJournal[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvInJournalEntry) {\n\t\t\t\t\t\t\t\tlvParameter3 = oJournalItem[oFields.IN_FIELD];\n\t\t\t\t\t\t\t} else if (lvInTable === gvLevel) {\n\t\t\t\t\t\t\t\tlvLevelIndex = parseFloat(lvInField) - 1;\n\t\t\t\t\t\t\t\tlvParameter3 = oLevel[lvLevelIndex];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//It is a Constant\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlvParameter3 = oRules[j].PARAMETER3;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//Call Conversion Function\n\t\t\t\t\tif (lvParameter1 && lvParameter2 && lvParameter3) {\n\t\t\t\t\t\tlvReturn = ConversionLibrary.VAT_IF(lvParameter1, lvOperator, oOperatorSplit[1], lvParameter2, lvParameter3);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//Log the Result to the Rule Logging Table\n\t\t\tif (gvExecution !== \"TEST\") {\n\t\t\t\t_logRuleResult(oRules[j], pItem, lvParameter1, lvParameter2, lvParameter3, lvParameter4, lvParameter5, lvReturn);\n\t\t\t}\n\n\t\t\toLevel.push(lvReturn);\n\t\t}\n\n\t\treturn lvReturn;\n\t}", "function splitRules()\n{\n\twhile(1)\n\t{\n\t\ttemprules=[];\n\t\tfor(var i=0;i<rules.length;i++)\n\t\t{\n\t\t\tvar cond; var effs; var elseEffs;var ruletosplit;\n\t\t\tif(\"effects\" in rules[i]==false){continue;}\n\t\t\tfor(var j=0;j<rules[i].effects.length;j++)\n\t\t\t{\n\t\t\t\tif(\"condition\" in rules[i].effects[j])\n\t\t\t\t{\n\t\t\t\t\tcond=rules[i].effects[j].condition;effs=rules[i].effects[j].effects;elseEffs=rules[i].effects[j].elseEffects;\n\t\t\t\t\tvar temp=rules[i].effects.splice(j+1);rules[i].effects.pop();\n\t\t\t\t\trules[i].effects=rules[i].effects.concat(temp);//take out this effect object\n\t\t\t\t\truletosplit=rules[i];//remember the rule\n\t\t\t\t\trules[i]=null;//remove the rule for this iteration\n\t\t\t\t\tvar splitted=splitARule(ruletosplit,cond,effs,elseEffs);\n\t\t\t\t\t//must alter all leads to arrays containing this rule so it doesn't break\n\t\t\t\t\tfor(var k in rules)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(rules[k])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(\"leadsTo\" in rules[k])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar tempindex=rules[k].leadsTo.indexOf(ruletosplit.name);\n\t\t\t\t\t\t\t\tif(tempindex>=0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar templeadsto=rules[k].leadsTo.splice(tempindex+1);rules[k].leadsTo.pop();\n\t\t\t\t\t\t\t\t\trules[k].leadsTo=rules[k].leadsTo.concat(templeadsto);\n\t\t\t\t\t\t\t\t\tfor(var l=0;l<splitted.length;l++)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\trules[k].leadsTo.push(splitted[l].name);\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\tfor(var k in temprules)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(temprules[k])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(\"leadsTo\" in temprules[k])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar tempindex=temprules[k].leadsTo.indexOf(ruletosplit.name);\n\t\t\t\t\t\t\t\tif(tempindex>=0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar templeadsto=temprules[k].leadsTo.splice(tempindex+1);temprules[k].leadsTo.pop();\n\t\t\t\t\t\t\t\t\ttemprules[k].leadsTo=temprules[k].leadsTo.concat(templeadsto);\n\t\t\t\t\t\t\t\t\tfor(var l=0;l<splitted.length;l++)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttemprules[k].leadsTo.push(splitted[l].name);\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}//no rule leads to itself so updating other rules should be fine\n\t\t\t\t\ttemprules=temprules.concat(splitted);//save split rules for next iteration\n\t\t\t\t\tbreak;//only split for one conditional per iteration\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar oldrules=rules.filter(function(a){if(a==null)return false;return true;});\n\t\trules=oldrules.concat(temprules);\n\t\tif(temprules.length==0){break;}//finally done\n\t}\n}", "getLogicalOperator (lo) {\n return this.logicalOperators[lo] ? this.logicalOperators[lo] : { fn: [].every };\n }", "function parseLogic(logic) {\n\t\tlogic = logic.split(\";\");\n\t\tmoves = [];\n\t\tcaptureMoves = [];\n\t\tcaptureCaptures = [];\n\t\tfirstCaptures = [];\n\t\tfirstMoves = [];\n\t\ttransformLocations = [];\n\n\t\tfor (var i = 0; i < logic.length; i++) {\n\t\t\trule = logic[i];\n\n\t\t\tregex = /^[a-zA-Z]+/g;\n\t\t\tprefixes = rule.match(regex)[0].split(\"\");\n\n\t\t\tregex = /[a-zA-Z]+[0-9]*$/g;\n\t\t\tconsole.log(rule.match(regex));\n\t\t\tvar suffixes = [];\n\t\t\tsuffixes = rule.match(regex);\n\t\t\tif ( suffixes !== null ) {\n\t\t\t\tsuffixes = suffixes[0].split(\"\");\n\t\t\t} else {\n\t\t\t\tsuffixes = [];\n\t\t\t}\n\t\t\tconsole.log(suffixes);\n\n\t\t\tregex = /[\\-0-9]+,[\\-0-9]+/g;\n\n\t\t\t// is coordinate\n\t\t\tif (rule.match(regex) !== null) {\n\t\t\t\tpos = rule.match(regex)[0].split(\",\");\n\t\t\t\tfor (var j = 0; j < pos.length; j++) {\n\t\t\t\t\tpos[j] = parseInt(pos[j]);\n\t\t\t\t}\n\n\t\t\t\tif (suffixes.includes(\"i\")) {\n\t\t\t\t\tpos.push(true);\n\t\t\t\t} else {\n\t\t\t\t\tpos.push(false);\n\t\t\t\t}\n\n\t\t\t\tif (suffixes.length > 1 ) {\t\t\t\t\n\t\t\t\t\tpos.push(suffixes[1]);\n\t\t\t\t} else {\t\t\t\n\t\t\t\t\tpos.push(64);\t\t\t\t\n\t\t\t\t}\n\n\n\t\t\t// \n\t\t\t\n\n\t\t\t\n\n\t\t\t\t// if move add to moves[]\n\t\t\t\tif (prefixes.includes(\"m\")) {\n\t\t\t\t\tmoves.push(pos);\n\t\t\t\t}\n\n\t\t\t\t// if capturemove add to captureMoves[]\n\t\t\t\tif (prefixes.includes(\"c\")) {\n\t\t\t\t\tcaptureMoves.push(pos);\n\t\t\t\t}\n\n\n\t\t\t\t// if firstMoves\n\t\t\t\tif (prefixes.includes(\"f\")) {\n\t\t\t\t\tfirstMoves.push(pos);\n\t\t\t\t}\n\n\t\t\t\t// if firstMoves\n\t\t\t\tif (prefixes.includes(\"f\") && prefixes.includes(\"c\")) {\n\t\t\t\t\tfirstCaptures.push(pos);\n\t\t\t\t}\n\t\t\t}\n\t\t\tregex = /[\\-0-9]+:[\\-0-9]+/g;\n\t\t\tif (rule.match(regex) !== null) {\n\t\t\t\tpos = rule.match(regex)[0].split(/[:]+/);\n\t\t\t\tfor (var j = 0; j < pos.length; j++) {\n\t\t\t\t\tpos[j] = parseInt(pos[j]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\n\n\t\t\t\n\n\n\t\t\tconsole.log(prefixes);\n\n\n\t\t\tif (prefixes.includes(\"t\")) {\n\t\t\t\tif (prefixes.includes(\"r\")) {\n\t\t\t\t\tpos.push(\"r\");\n\t\t\t\t\ttransformLocations.push(pos);\n\t\t\t\t} else if (prefixes.includes(\"c\")){\n\t\t\t\t\tpos.push(\"c\");\n\t\t\t\t\ttransformLocations.push(pos);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\n\n\t\treturn {\n\t\t\t\"moves\" : moves,\n\t\t\t\"captureMoves\" : captureMoves,\n\t\t\t\"firstMoves\" : firstMoves,\n\t\t\t\"firstCaptures\" : firstCaptures,\n\t\t\t\"transformLocations\" : transformLocations,\n\t\t};\n\t}", "function parseRules() {\n\tqueries = {};\n\tvar sheets = document.styleSheets;\n\tvar rules;\n\tfor (var i = 0; i < sheets.length; i++) {\n\t\tif (sheets[i].disabled) {\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\trules = sheets[i].cssRules;\n\t\t}\n\t\tcatch(e) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (var j = 0; j < rules.length; j++) {\n\t\t\tparseRule(rules[j]);\n\t\t}\n\t}\n}", "function ruleBase() {\n\tvar node = false;\n\tvar tmp;\n\n\tif ((tmp = ruleFuncCall()) || (tmp = ruleFunc()))\n\t node = tmp;\n\telse if (accept(\"LX_STRING\")) {\n\t node = {name:_curr.name, val:_curr.val.substr(1, _curr.val.length - 2)};\n\t shift();\n\t}\n\telse if (accept(\"LX_NUMBER\")) {\n\t node = {name:_curr.name, val:parseFloat(_curr.val)};\n\t shift();\n\t} else if (accept(\"LX_ID\")) {\n\t node = {name:_curr.name, val:_curr.val};\n\t shift();\n\t} else if (accept(\"LX_LPAREN\")) {\n\t shift();\n\t node = ruleAssign();\n\t if (expect(\"LX_RPAREN\"))\n\t\tshift();\n\t} else\n\t return (false);\n\treturn (node);\n }", "function request_all_rules(){\n\tvar cmd_data = { \"cmd\":\"get_rules\"};\n\tcon.send(JSON.stringify(cmd_data));\n\tg_rules=[];\n}", "lintByLine(rules, lines) {\n return lines.map((line) => {\n return rules.map(rule => this.callRuleLint(rule, line));\n });\n }", "function loadRules() {\n console.log(\"Load rules\");\n api.storage.local.get(\"rules\", (data) => {\n var loaded = api.runtime.lastError ? [] : data[\"rules\"];\n if (!loaded) {\n loaded = [];\n }\n rules = loaded.filter(function (rule) {\n return rule.enabled;\n });\n console.log(\"Loaded rules: \" + JSON.stringify(rules));\n });\n}", "function SSCtrlLyPr() {\n this.ruleID = 'SSCtrlLyPr';\n}", "function RuleManager(parent) {\n var _this = _super.call(this, 'Tlb.RlMngr', parent.log, 'constructor') || this;\n /** List of rules which were picked up and will be applied */\n _this.rules = [];\n _this.tempId = Math.floor(Math.random() * 99999);\n /** the settings are usually retrieved on settings, but you can also put them behind the toolbar */\n _this.getSettings = function () { return _this.getSystemRule(_build_steps__WEBPACK_IMPORTED_MODULE_2__[\"BuildSteps\"].settings) || _this.getToolbar(); };\n /** the params for the command - if not found, will use the toolbar params */\n _this.getParams = function () { return _this.getSystemRule(_build_steps__WEBPACK_IMPORTED_MODULE_2__[\"BuildSteps\"].params) || _this.getToolbar(); };\n _this.getToolbar = function () { return _this.getSystemRule(_build_steps__WEBPACK_IMPORTED_MODULE_2__[\"BuildSteps\"].toolbar); };\n _this.getAdd = function () { return _this.filter(function (br) { return br.operator === ___WEBPACK_IMPORTED_MODULE_0__[\"Operations\"].add; }); };\n _this.getRemoveGroups = function () { return _this.filter(function (br) { return br.operator === ___WEBPACK_IMPORTED_MODULE_0__[\"Operations\"].remove && br.step === _build_steps__WEBPACK_IMPORTED_MODULE_2__[\"BuildSteps\"].group; }); };\n _this.log.add('tempId:' + _this.tempId);\n return _this;\n }", "constructor() {\n /**\n * @type {Object<string, string>}\n */\n this._rules = {};\n }", "function evaluateRules() {\n var triplesAdded = false;\n var triplesBefore = _statementCount();\n do {\n triplesAdded = false;\n // Iterate and execute rules. Break if any triples are added\n for (var i = 0; i < _rules.length && !triplesAdded; i++) {\n _store.execute(\n getPrefixesForSparql() + _rules[i].construct,\n function(success, graph) {\n if (success) {\n if (graph.length > 0) {\n console.log('Rule ' + _rules[i].rule + ' +' + graph.length);\n _store.insert(graph, function() {});\n triplesAdded = true;\n }\n }\n else\n console.log(\"Failed to execute rule \" + _rules[i].rule);\n }\n );\n }\n }\n while (triplesAdded);\n triplesAdded = _statementCount() - triplesBefore;\n console.log(\"Rule entailment evaluation: \" + triplesBefore + \" + \" + triplesAdded + \" = \" + (triplesBefore+triplesAdded));\n }", "function programming(){\n return ['loops', 'conditionals', 'arrays', 'boolean logic', 'string manipulation' ];\n}", "function getRules()\n{\n\treturn ruleObj;\n}", "get rules() {\n let schema = this.modelDefinition.schema.fields;\n\n if ( !Array.isArray( schema ) ) {\n schema = Object.keys(schema).map(key => {\n return { model: key, ...schema[key] }\n });\n }\n\n let rules = {};\n schema.forEach(field => {\n // TODO: Allow multiple rules\n // TODO: Allow UI-rules AND DB-rules\n // TODO: Allow custom message\n // TODO: Allow to set blur\n rules[ field.model ] = [{\n validator: (rule, value, callback) => {\n if ( field.validator( value ) ) {\n callback();\n } else {\n callback(new Error('Invalid input'));\n }\n },\n trigger: 'blur'\n }];\n });\n return rules;\n }", "function rule_def(peg_parser, tree_obj){\n\t\t//console.log(tree_obj);\n\t\tvar rule_name = tree_obj.rule_name.value;\n\t\tif (tree_obj.term === undefined){\n\t\t\tthrow \"Rule \" + rule_name + \" has no associated term.\";\n\t\t}\n\t\tpeg_parser.rule(rule_name, \n\t\t\tterm(peg_parser, tree_obj.term)\n\t\t);\n\t}", "function Core() {\n this.options = {};\n this.ruler = new ruler();\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n }", "function isat_find_device_mobile(mob)\n{\n\n//just simply write your rules\n\n}", "function addRules(state, newrules, rules) {\r\n var idx;\r\n for(idx in rules) {\r\n var rule = rules[idx];\r\n var include = rule.include;\r\n if(include) {\r\n if(typeof (include) !== \"string\") {\r\n Common.throwError(lexer, \"an 'include' attribute must be a string at: \" + state);\r\n }\r\n if(include[0] === \"@\") {\r\n include = include.substr(1);\r\n }// peel off starting @\r\n \r\n if(!json.tokenizer[include]) {\r\n Common.throwError(lexer, \"include target '\" + include + \"' is not defined at: \" + state);\r\n }\r\n addRules(state + \".\" + include, newrules, json.tokenizer[include]);\r\n } else {\r\n var newrule = new Rule(state);\r\n // Set up new rule attributes\r\n if(rule instanceof Array && rule.length >= 1 && rule.length <= 3) {\r\n newrule.setRegex(lexerMin, rule[0]);\r\n if(rule.length >= 3) {\r\n if(typeof (rule[1]) === \"string\") {\r\n newrule.setAction(lexerMin, {\r\n token: rule[1],\r\n next: rule[2]\r\n });\r\n } else if(typeof (rule[1]) === \"object\") {\r\n var rule1 = rule[1];\r\n rule1.next = rule[2];\r\n newrule.setAction(lexerMin, rule1);\r\n } else {\r\n Common.throwError(lexer, \"a next state as the last element of a rule can only be given if the action is either an object or a string, at: \" + state);\r\n }\r\n } else {\r\n newrule.setAction(lexerMin, rule[1]);\r\n }\r\n } else {\r\n if(!rule.regex) {\r\n Common.throwError(lexer, \"a rule must either be an array, or an object with a 'regex' or 'include' field at: \" + state);\r\n }\r\n if(rule.name) {\r\n newrule.name = string(rule.name);\r\n }\r\n if(rule.matchOnlyAtStart) {\r\n newrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart);\r\n }\r\n newrule.setRegex(lexerMin, rule.regex);\r\n newrule.setAction(lexerMin, rule.action);\r\n }\r\n newrules.push(newrule);\r\n }\r\n }\r\n }", "initRules(setRequiredRules = false) {\n let rules = {}\n\n Object.keys(this.setNewItemFields()).map((Key) => {\n if (Key === 'translatables') {\n this.setNewItemFields()[Key].map((key) => {\n // generate translatable rules\n rules[key] = Object.fromEntries(this.getLocalesList().map(locale => {\n let rules = [\n () => !this.remoteErrors[key] || !this.remoteErrors[key][locale] || this.remoteErrors[key][locale][0]\n ]\n\n if (locale === this.getDefaultLocale() && setRequiredRules) {\n rules.unshift(val => !!val || this.errorMessages.required)\n }\n\n return [locale, rules]\n }, [this, key]))\n }, this)\n } else {\n this.setNewItemFields()[Key].map((key) => {\n // generate rules\n if (key !== 'id') {\n rules[key] = []\n if (setRequiredRules) {\n rules[key].push(val => !!val || this.errorMessages.required)\n }\n rules[key].push(() => !this.remoteErrors[key] || this.remoteErrors[key][0])\n }\n }, Key)\n }\n }, this)\n\n return rules\n }", "function getLogic(){ \n workspacePlayground.updateToolbox(\"<category name='%{BKY_CATLOGIC}' colour='%{BKY_LOGIC_HUE}'><block type='controls_if'></block> <block type='logic_compare'></block> <block type='logic_operation'></block> <block type='logic_negate'></block> <block type='logic_boolean'></block> <block type='logic_null'></block> <block type='logic_ternary'></block> </category>\");\n }", "static get rules() {\n\t\tconst compare = (list) => {\n\t\t\tconst { coordinates: first } = GeometryPoint.from(list[0]);\n\t\t\tconst { coordinates: last } = GeometryPoint.from(\n\t\t\t\tlist[list.length - 1]\n\t\t\t);\n\n\t\t\treturn first[0] === last[0] && first[1] === last[1];\n\t\t};\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tvalidate: (value) =>\n\t\t\t\t\tvalue &&\n\t\t\t\t\ttypeof value === 'object' &&\n\t\t\t\t\t(value.type === this.type || value.type === 'LineString') &&\n\t\t\t\t\t'coordinates' in value &&\n\t\t\t\t\tArray.isArray(value.coordinates) &&\n\t\t\t\t\tvalue.coordinates.length > 3 &&\n\t\t\t\t\tvalue.coordinates.filter((val) => GeometryPoint.valid(val))\n\t\t\t\t\t\t.length === value.coordinates.length &&\n\t\t\t\t\tcompare(value.coordinates),\n\t\t\t\tfactory: (value) => new this(...value.coordinates)\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalidate: (value) =>\n\t\t\t\t\tArray.isArray(value) &&\n\t\t\t\t\tvalue.length > 3 &&\n\t\t\t\t\tvalue.filter((val) => GeometryPoint.valid(val)).length ===\n\t\t\t\t\t\tvalue.length &&\n\t\t\t\t\tcompare(value),\n\t\t\t\tfactory: (value) => new this(...value)\n\t\t\t}\n\t\t];\n\t}", "function isRule(thing) {\n return getIriAll(thing, rdf.type).includes(acp.Rule);\n}", "function prepareRules(rules, macros, actions, tokens, startConditions, caseless) {\n var m,\n i,\n k,\n action,\n conditions,\n newRules = [];\n\n if (macros) {\n macros = prepareMacros(macros);\n }\n\n function tokenNumberReplacement(str, token) {\n return \"return \" + (tokens[token] || \"'\" + token + \"'\");\n }\n\n actions.push('switch($avoiding_name_collisions) {');\n\n for (i = 0; i < rules.length; i++) {\n if (Object.prototype.toString.apply(rules[i][0]) !== '[object Array]') {\n // implicit add to all inclusive start conditions\n for (k in startConditions) {\n if (startConditions[k].inclusive) {\n startConditions[k].rules.push(i);\n }\n }\n } else if (rules[i][0][0] === '*') {\n // Add to ALL start conditions\n for (k in startConditions) {\n startConditions[k].rules.push(i);\n }\n\n rules[i].shift();\n } else {\n // Add to explicit start conditions\n conditions = rules[i].shift();\n\n for (k = 0; k < conditions.length; k++) {\n startConditions[conditions[k]].rules.push(i);\n }\n }\n\n m = rules[i][0];\n\n if (typeof m === 'string') {\n for (k in macros) {\n if (macros.hasOwnProperty(k)) {\n m = m.split(\"{\" + k + \"}\").join('(' + macros[k] + ')');\n }\n }\n\n m = new RegExp(\"^(?:\" + m + \")\", caseless ? 'i' : '');\n }\n\n newRules.push(m);\n\n if (typeof rules[i][1] === 'function') {\n rules[i][1] = String(rules[i][1]).replace(/^\\s*function \\(\\)\\s?\\{/, '').replace(/\\}\\s*$/, '');\n }\n\n action = rules[i][1];\n\n if (tokens && action.match(/return '[^']+'/)) {\n action = action.replace(/return '([^']+)'/g, tokenNumberReplacement);\n }\n\n actions.push('case ' + i + ':' + action + '\\nbreak;');\n }\n\n actions.push(\"}\");\n return newRules;\n} // expand macros within macros", "setupRules(config, parser) {\n const rules = {};\n for (const [ruleId, [severity, options]] of config.getRules().entries()) {\n rules[ruleId] = this.loadRule(ruleId, config, severity, options, parser, this.report);\n }\n return rules;\n }", "static get LANCER_DIRS() {\n return {\n 'c': [-1, 0], //north\n 'd': [-1, 1], //N-E\n 'e': [0, 1], //east\n 'f': [1, 1], //S-E\n 'g': [1, 0], //south\n 'h': [1, -1], //S-W\n 'm': [0, -1], //west\n 'o': [-1, -1] //N-W\n };\n }", "function initialize()\n{\n//Linguistic initialization\nclSize = LinguisticSize;\n\n//create widths and limits for the BLTS\nvar wid = 1/(clSize-1);\nvar cur = 0.0;\nstr = \"\";\nfor (var i=0; i<clSize; i++)\n\t{\n\tlinLimits[i] = cur;\n\tcur += wid;\n\t}\nlinLimits[clSize-1] = 1;\n\n//initialize widths and limits foreach linguistic variable\nfor (var j=1; j<=NofVariables; j++) \n if (Variables[j].type == \"Linguistic\")\n {\n var str = Variables[j].name + \": \";\n var wid2 = 1/(Variables[j].LinguisticSize-1);\n var cur2 = 0.0;\n Variables[j].oldLimits = new Array();\n for (var i=0; i<Variables[j].LinguisticSize-1; i++)\n {\n Variables[j].oldLimits[i] = cur2;\n cur2 += wid2;\n }\n Variables[j].oldLimits[Variables[j].LinguisticSize-1] = 1;\n }\n}", "function makeFilter(styleRule) {\n if (styleRule == null) {\n return;\n }\n\n var rules = styleRule.r[0]; // TODO: handle multi-element OR properties (Studio doesn't currently support)\n var conditions = [];\n rules.forEach(function (rule) {\n // Tangram property look-up\n var prop = rule.property;\n\n // special handling for `id` and `__id` property handling between XYZ and Tangram\n if (prop === 'id') { // XYZ property `id`' is for `feature.id` (NOT `feature.properties.id`)\n // prop = '$id'; // in Tangram, this is accessed through a special `$id` property\n prop = '_feature_id'; // TODO: remove this when Tangram 0.19 is released (temp solution for 0.18.x)\n }\n else if (prop === '__id') { // XYZ property `__id` is for `feature.properties.id` (NOT `feature.id`)\n prop = 'id'; // in Tangram, this is accessed as a normal feature property\n }\n\n var value;\n if (prop[0] === '$') { // special Tangram accessor prefixed with `$`, use property name directly\n value = prop; // e.g. `$id`, `$geometry`, `$layer`, etc.\n }\n else { // regular feature property\n value = \"feature['\" + prop + \"']\"; // Tangram exposes feature properties in the `feature` object\n }\n\n // apply the logic for this operator\n switch (rule.operator) {\n case 'eq': // equals\n conditions.push((value + \" == \" + (quoteValue(rule.value))));\n break;\n case 'neq': // not equals\n conditions.push((value + \" != \" + (quoteValue(rule.value))));\n break;\n case 'lt': // less than\n conditions.push((value + \" < \" + (quoteValue(rule.value))));\n break;\n case 'gt': // greater than\n conditions.push((value + \" > \" + (quoteValue(rule.value))));\n break;\n case 'em': // is empty\n conditions.push((value + \" == null\"));\n break;\n case 'nem': // is not empty\n conditions.push((value + \" != null\"));\n break;\n }\n });\n\n if (conditions.length === 0) {\n return;\n }\n\n var filter = \"function() { return \" + (conditions.join(' && ')) + \"; }\";\n return filter;\n }", "function $8cdd8e5f2a340285$var$lsl(hljs) {\n var LSL_STRING_ESCAPE_CHARS = {\n className: \"subst\",\n begin: /\\\\[tn\"\\\\]/\n };\n var LSL_STRINGS = {\n className: \"string\",\n begin: '\"',\n end: '\"',\n contains: [\n LSL_STRING_ESCAPE_CHARS\n ]\n };\n var LSL_NUMBERS = {\n className: \"number\",\n relevance: 0,\n begin: hljs.C_NUMBER_RE\n };\n var LSL_CONSTANTS = {\n className: \"literal\",\n variants: [\n {\n begin: \"\\\\b(PI|TWO_PI|PI_BY_TWO|DEG_TO_RAD|RAD_TO_DEG|SQRT2)\\\\b\"\n },\n {\n begin: \"\\\\b(XP_ERROR_(EXPERIENCES_DISABLED|EXPERIENCE_(DISABLED|SUSPENDED)|INVALID_(EXPERIENCE|PARAMETERS)|KEY_NOT_FOUND|MATURITY_EXCEEDED|NONE|NOT_(FOUND|PERMITTED(_LAND)?)|NO_EXPERIENCE|QUOTA_EXCEEDED|RETRY_UPDATE|STORAGE_EXCEPTION|STORE_DISABLED|THROTTLED|UNKNOWN_ERROR)|JSON_APPEND|STATUS_(PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(_OBJECT)?|(DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(_(BY_(LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(PARCEL(_OWNER)?|REGION)))?|CAMERA_(PITCH|DISTANCE|BEHINDNESS_(ANGLE|LAG)|(FOCUS|POSITION)(_(THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(ROOT|SET|ALL_(OTHERS|CHILDREN)|THIS)|ACTIVE|PASS(IVE|_(ALWAYS|IF_NOT_HANDLED|NEVER))|SCRIPTED|CONTROL_(FWD|BACK|(ROT_)?(LEFT|RIGHT)|UP|DOWN|(ML_)?LBUTTON)|PERMISSION_(RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(_START)?|TELEPORT|MEDIA)|OBJECT_(CLICK_ACTION|HOVER_HEIGHT|LAST_OWNER_ID|(PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_(ATTACHED|ON_REZ)|NAME|DESC|POS|PRIM_(COUNT|EQUIVALENCE)|RETURN_(PARCEL(_OWNER)?|REGION)|REZZER_KEY|ROO?T|VELOCITY|OMEGA|OWNER|GROUP(_TAG)?|CREATOR|ATTACHED_(POINT|SLOTS_AVAILABLE)|RENDER_WEIGHT|(BODY_SHAPE|PATHFINDING)_TYPE|(RUNNING|TOTAL)_SCRIPT_COUNT|TOTAL_INVENTORY_COUNT|SCRIPT_(MEMORY|TIME))|TYPE_(INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(DEBUG|PUBLIC)_CHANNEL|ATTACH_(AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](SHOULDER|HAND|FOOT|EAR|EYE|[UL](ARM|LEG)|HIP)|(LEFT|RIGHT)_PEC|HUD_(CENTER_[12]|TOP_(RIGHT|CENTER|LEFT)|BOTTOM(_(RIGHT|LEFT))?)|[LR]HAND_RING1|TAIL_(BASE|TIP)|[LR]WING|FACE_(JAW|[LR]EAR|[LR]EYE|TOUNGE)|GROIN|HIND_[LR]FOOT)|LAND_(LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(ONLINE|NAME|BORN|SIM_(POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(ON_FILE|USED)|REMOTE_DATA_(CHANNEL|REQUEST|REPLY)|PSYS_(PART_(BF_(ZERO|ONE(_MINUS_(DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(START|END)_(COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(RIBBON|WIND|INTERP_(COLOR|SCALE)|BOUNCE|FOLLOW_(SRC|VELOCITY)|TARGET_(POS|LINEAR)|EMISSIVE)_MASK)|SRC_(MAX_AGE|PATTERN|ANGLE_(BEGIN|END)|BURST_(RATE|PART_COUNT|RADIUS|SPEED_(MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(DROP|EXPLODE|ANGLE(_CONE(_EMPTY)?)?)))|VEHICLE_(REFERENCE_FRAME|TYPE_(NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(LINEAR|ANGULAR)_(FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(LINEAR|ANGULAR)_(DEFLECTION_(EFFICIENCY|TIMESCALE)|MOTOR_(DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(EFFICIENCY|TIMESCALE)|BANKING_(EFFICIENCY|MIX|TIMESCALE)|FLAG_(NO_DEFLECTION_UP|LIMIT_(ROLL_ONLY|MOTOR_UP)|HOVER_((WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(ALLOW_UNSIT|ALPHA_MODE(_(BLEND|EMISSIVE|MASK|NONE))?|NORMAL|SPECULAR|TYPE(_(BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(_(STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(NONE|LOW|MEDIUM|HIGH)|BUMP_(NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(DEFAULT|PLANAR)|SCRIPTED_SIT_ONLY|SCULPT_(TYPE_(SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(MIRROR|INVERT))|PHYSICS(_(SHAPE_(CONVEX|NONE|PRIM|TYPE)))?|(POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIT_TARGET|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(ALT_IMAGE_ENABLE|CONTROLS|(CURRENT|HOME)_URL|AUTO_(LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(WIDTH|HEIGHT)_PIXELS|WHITELIST(_ENABLE)?|PERMS_(INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(STANDARD|MINI)|PERM_(NONE|OWNER|GROUP|ANYONE)|MAX_(URL_LENGTH|WHITELIST_(SIZE|COUNT)|(WIDTH|HEIGHT)_PIXELS)))|MASK_(BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(MEDIA_COMMAND_(STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(ALLOW_(FLY|(GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(GROUP_)?OBJECTS)|USE_(ACCESS_(GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(GROUP|ALL)_OBJECT_ENTRY)|COUNT_(TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(HIDE|DEFAULT)|REGION_FLAG_(ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(METHOD|MIMETYPE|BODY_(MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|SIT_(INVALID_(AGENT|LINK_OBJECT)|NO(T_EXPERIENCE|_(ACCESS|EXPERIENCE_PERMISSION|SIT_TARGET)))|STRING_(TRIM(_(HEAD|TAIL))?)|CLICK_ACTION_(NONE|TOUCH|SIT|BUY|PAY|OPEN(_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(NONE|SCRIPT_MEMORY)|RC_(DATA_FLAGS|DETECT_PHANTOM|GET_(LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(TYPES|AGENTS|(NON)?PHYSICAL|LAND))|RCERR_(CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(ALLOWED_(AGENT|GROUP)_(ADD|REMOVE)|BANNED_AGENT_(ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(COMMAND|CMD_(PLAY|STOP|PAUSE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(CMD_((SMOOTH_)?STOP|JUMP)|DESIRED_(TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(_([ABCD]|NONE))?|MAX_(DECEL|TURN_RADIUS|(ACCEL|SPEED)))|PURSUIT_(OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(EVADE_(HIDDEN|SPOTTED)|FAILURE_(DYNAMIC_PATHFINDING_DISABLED|INVALID_(GOAL|START)|NO_(NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(PARCEL_)?UNREACHABLE)|(GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(_(FAST|NONE|SLOW))?|CONTENT_TYPE_(ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(RADIUS|STATIC)|(PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\\\\b\"\n },\n {\n begin: \"\\\\b(FALSE|TRUE)\\\\b\"\n },\n {\n begin: \"\\\\b(ZERO_ROTATION)\\\\b\"\n },\n {\n begin: \"\\\\b(EOF|JSON_(ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(GRANTED|DENIED))\\\\b\"\n },\n {\n begin: \"\\\\b(ZERO_VECTOR|TOUCH_INVALID_(TEXCOORD|VECTOR))\\\\b\"\n }\n ]\n };\n var LSL_FUNCTIONS = {\n className: \"built_in\",\n begin: \"\\\\b(ll(AgentInExperience|(Create|DataSize|Delete|KeyCount|Keys|Read|Update)KeyValue|GetExperience(Details|ErrorMessage)|ReturnObjectsBy(ID|Owner)|Json(2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(Mag|Norm|Dist)|Rot(Between|2(Euler|Fwd|Left|Up))|(Euler|Axes)2Rot|Whisper|(Region|Owner)?Say|Shout|Listen(Control|Remove)?|Sensor(Repeat|Remove)?|Detected(Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|([GS]et)(AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(Scale|Offset|Rotate)Texture|(Rot)?Target(Remove)?|(Stop)?MoveToTarget|Apply(Rotational)?Impulse|Set(KeyframedMotion|ContentType|RegionPos|(Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(Queueing|Radius)|Vehicle(Type|(Float|Vector|Rotation)Param)|(Touch|Sit)?Text|Camera(Eye|At)Offset|PrimitiveParams|ClickAction|Link(Alpha|Color|PrimitiveParams(Fast)?|Texture(Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get((Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(PrimitiveParams|Number(OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(Details|PermMask|PrimCount)|Parcel(MaxPrims|Details|Prim(Count|Owners))|Attached(List)?|(SPMax|Free|Used)Memory|Region(Name|TimeDilation|FPS|Corner|AgentCount)|Root(Position|Rotation)|UnixTime|(Parcel|Region)Flags|(Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(Prims|NotecardLines|Sides)|Animation(List)?|(Camera|Local)(Pos|Rot)|Vel|Accel|Omega|Time(stamp|OfDay)|(Object|CenterOf)?Mass|MassMKS|Energy|Owner|(Owner)?Key|SunDirection|Texture(Offset|Scale|Rot)|Inventory(Number|Name|Key|Type|Creator|PermMask)|Permissions(Key)?|StartParameter|List(Length|EntryType)|Date|Agent(Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(Name|State))|(Get|Reset|GetAndReset)Time|PlaySound(Slave)?|LoopSound(Master|Slave)?|(Trigger|Stop|Preload)Sound|((Get|Delete)Sub|Insert)String|To(Upper|Lower)|Give(InventoryList|Money)|RezObject|(Stop)?LookAt|Sleep|CollisionFilter|(Take|Release)Controls|DetachFromAvatar|AttachToAvatar(Temp)?|InstantMessage|(GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(Length|Trim)|(Start|Stop)Animation|TargetOmega|Request(Experience)?Permissions|(Create|Break)Link|BreakAllLinks|(Give|Remove)Inventory|Water|PassTouches|Request(Agent|Inventory)Data|TeleportAgent(Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(Axis|Angle)|A(cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(CSV|Integer|Json|Float|String|Key|Vector|Rot|List(Strided)?)|DeleteSubList|List(Statistics|Sort|Randomize|(Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(Slope|Normal|Contour)|GroundRepel|(Set|Remove)VehicleFlags|SitOnLink|(AvatarOn)?(Link)?SitTarget|Script(Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(Integer|String)ToBase64|XorBase64|Log(10)?|Base64To(String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(Load|Release|(E|Une)scape)URL|ParcelMedia(CommandList|Query)|ModPow|MapDestination|(RemoveFrom|AddTo|Reset)Land(Pass|Ban)List|(Set|Clear)CameraParams|HTTP(Request|Response)|TextBox|DetectedTouch(UV|Face|Pos|(N|Bin)ormal|ST)|(MD5|SHA1|DumpList2)String|Request(Secure)?URL|Clear(Prim|Link)Media|(Link)?ParticleSystem|(Get|Request)(Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\\\\b\"\n };\n return {\n name: \"LSL (Linden Scripting Language)\",\n illegal: \":\",\n contains: [\n LSL_STRINGS,\n {\n className: \"comment\",\n variants: [\n hljs.COMMENT(\"//\", \"$\"),\n hljs.COMMENT(\"/\\\\*\", \"\\\\*/\")\n ],\n relevance: 0\n },\n LSL_NUMBERS,\n {\n className: \"section\",\n variants: [\n {\n begin: \"\\\\b(state|default)\\\\b\"\n },\n {\n begin: \"\\\\b(state_(entry|exit)|touch(_(start|end))?|(land_)?collision(_(start|end))?|timer|listen|(no_)?sensor|control|(not_)?at_(rot_)?target|money|email|experience_permissions(_denied)?|run_time_permissions|changed|attach|dataserver|moving_(start|end)|link_message|(on|object)_rez|remote_data|http_re(sponse|quest)|path_update|transaction_result)\\\\b\"\n }\n ]\n },\n LSL_FUNCTIONS,\n LSL_CONSTANTS,\n {\n className: \"type\",\n begin: \"\\\\b(integer|float|string|key|vector|quaternion|rotation|list)\\\\b\"\n }\n ]\n };\n}", "function lsl(hljs) {\n\n var LSL_STRING_ESCAPE_CHARS = {\n className: 'subst',\n begin: /\\\\[tn\"\\\\]/\n };\n\n var LSL_STRINGS = {\n className: 'string',\n begin: '\"',\n end: '\"',\n contains: [\n LSL_STRING_ESCAPE_CHARS\n ]\n };\n\n var LSL_NUMBERS = {\n className: 'number',\n relevance:0,\n begin: hljs.C_NUMBER_RE\n };\n\n var LSL_CONSTANTS = {\n className: 'literal',\n variants: [\n {\n begin: '\\\\b(PI|TWO_PI|PI_BY_TWO|DEG_TO_RAD|RAD_TO_DEG|SQRT2)\\\\b'\n },\n {\n begin: '\\\\b(XP_ERROR_(EXPERIENCES_DISABLED|EXPERIENCE_(DISABLED|SUSPENDED)|INVALID_(EXPERIENCE|PARAMETERS)|KEY_NOT_FOUND|MATURITY_EXCEEDED|NONE|NOT_(FOUND|PERMITTED(_LAND)?)|NO_EXPERIENCE|QUOTA_EXCEEDED|RETRY_UPDATE|STORAGE_EXCEPTION|STORE_DISABLED|THROTTLED|UNKNOWN_ERROR)|JSON_APPEND|STATUS_(PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(_OBJECT)?|(DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(_(BY_(LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(PARCEL(_OWNER)?|REGION)))?|CAMERA_(PITCH|DISTANCE|BEHINDNESS_(ANGLE|LAG)|(FOCUS|POSITION)(_(THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(ROOT|SET|ALL_(OTHERS|CHILDREN)|THIS)|ACTIVE|PASS(IVE|_(ALWAYS|IF_NOT_HANDLED|NEVER))|SCRIPTED|CONTROL_(FWD|BACK|(ROT_)?(LEFT|RIGHT)|UP|DOWN|(ML_)?LBUTTON)|PERMISSION_(RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(_START)?|TELEPORT|MEDIA)|OBJECT_(CLICK_ACTION|HOVER_HEIGHT|LAST_OWNER_ID|(PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_(ATTACHED|ON_REZ)|NAME|DESC|POS|PRIM_(COUNT|EQUIVALENCE)|RETURN_(PARCEL(_OWNER)?|REGION)|REZZER_KEY|ROO?T|VELOCITY|OMEGA|OWNER|GROUP(_TAG)?|CREATOR|ATTACHED_(POINT|SLOTS_AVAILABLE)|RENDER_WEIGHT|(BODY_SHAPE|PATHFINDING)_TYPE|(RUNNING|TOTAL)_SCRIPT_COUNT|TOTAL_INVENTORY_COUNT|SCRIPT_(MEMORY|TIME))|TYPE_(INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(DEBUG|PUBLIC)_CHANNEL|ATTACH_(AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](SHOULDER|HAND|FOOT|EAR|EYE|[UL](ARM|LEG)|HIP)|(LEFT|RIGHT)_PEC|HUD_(CENTER_[12]|TOP_(RIGHT|CENTER|LEFT)|BOTTOM(_(RIGHT|LEFT))?)|[LR]HAND_RING1|TAIL_(BASE|TIP)|[LR]WING|FACE_(JAW|[LR]EAR|[LR]EYE|TOUNGE)|GROIN|HIND_[LR]FOOT)|LAND_(LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(ONLINE|NAME|BORN|SIM_(POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(ON_FILE|USED)|REMOTE_DATA_(CHANNEL|REQUEST|REPLY)|PSYS_(PART_(BF_(ZERO|ONE(_MINUS_(DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(START|END)_(COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(RIBBON|WIND|INTERP_(COLOR|SCALE)|BOUNCE|FOLLOW_(SRC|VELOCITY)|TARGET_(POS|LINEAR)|EMISSIVE)_MASK)|SRC_(MAX_AGE|PATTERN|ANGLE_(BEGIN|END)|BURST_(RATE|PART_COUNT|RADIUS|SPEED_(MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(DROP|EXPLODE|ANGLE(_CONE(_EMPTY)?)?)))|VEHICLE_(REFERENCE_FRAME|TYPE_(NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(LINEAR|ANGULAR)_(FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(LINEAR|ANGULAR)_(DEFLECTION_(EFFICIENCY|TIMESCALE)|MOTOR_(DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(EFFICIENCY|TIMESCALE)|BANKING_(EFFICIENCY|MIX|TIMESCALE)|FLAG_(NO_DEFLECTION_UP|LIMIT_(ROLL_ONLY|MOTOR_UP)|HOVER_((WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(ALLOW_UNSIT|ALPHA_MODE(_(BLEND|EMISSIVE|MASK|NONE))?|NORMAL|SPECULAR|TYPE(_(BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(_(STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(NONE|LOW|MEDIUM|HIGH)|BUMP_(NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(DEFAULT|PLANAR)|SCRIPTED_SIT_ONLY|SCULPT_(TYPE_(SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(MIRROR|INVERT))|PHYSICS(_(SHAPE_(CONVEX|NONE|PRIM|TYPE)))?|(POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIT_TARGET|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(ALT_IMAGE_ENABLE|CONTROLS|(CURRENT|HOME)_URL|AUTO_(LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(WIDTH|HEIGHT)_PIXELS|WHITELIST(_ENABLE)?|PERMS_(INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(STANDARD|MINI)|PERM_(NONE|OWNER|GROUP|ANYONE)|MAX_(URL_LENGTH|WHITELIST_(SIZE|COUNT)|(WIDTH|HEIGHT)_PIXELS)))|MASK_(BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(MEDIA_COMMAND_(STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(ALLOW_(FLY|(GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(GROUP_)?OBJECTS)|USE_(ACCESS_(GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(GROUP|ALL)_OBJECT_ENTRY)|COUNT_(TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(HIDE|DEFAULT)|REGION_FLAG_(ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(METHOD|MIMETYPE|BODY_(MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|SIT_(INVALID_(AGENT|LINK_OBJECT)|NO(T_EXPERIENCE|_(ACCESS|EXPERIENCE_PERMISSION|SIT_TARGET)))|STRING_(TRIM(_(HEAD|TAIL))?)|CLICK_ACTION_(NONE|TOUCH|SIT|BUY|PAY|OPEN(_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(NONE|SCRIPT_MEMORY)|RC_(DATA_FLAGS|DETECT_PHANTOM|GET_(LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(TYPES|AGENTS|(NON)?PHYSICAL|LAND))|RCERR_(CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(ALLOWED_(AGENT|GROUP)_(ADD|REMOVE)|BANNED_AGENT_(ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(COMMAND|CMD_(PLAY|STOP|PAUSE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(CMD_((SMOOTH_)?STOP|JUMP)|DESIRED_(TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(_([ABCD]|NONE))?|MAX_(DECEL|TURN_RADIUS|(ACCEL|SPEED)))|PURSUIT_(OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(EVADE_(HIDDEN|SPOTTED)|FAILURE_(DYNAMIC_PATHFINDING_DISABLED|INVALID_(GOAL|START)|NO_(NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(PARCEL_)?UNREACHABLE)|(GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(_(FAST|NONE|SLOW))?|CONTENT_TYPE_(ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(RADIUS|STATIC)|(PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\\\\b'\n },\n {\n begin: '\\\\b(FALSE|TRUE)\\\\b'\n },\n {\n begin: '\\\\b(ZERO_ROTATION)\\\\b'\n },\n {\n begin: '\\\\b(EOF|JSON_(ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(GRANTED|DENIED))\\\\b'\n },\n {\n begin: '\\\\b(ZERO_VECTOR|TOUCH_INVALID_(TEXCOORD|VECTOR))\\\\b'\n }\n ]\n };\n\n var LSL_FUNCTIONS = {\n className: 'built_in',\n begin: '\\\\b(ll(AgentInExperience|(Create|DataSize|Delete|KeyCount|Keys|Read|Update)KeyValue|GetExperience(Details|ErrorMessage)|ReturnObjectsBy(ID|Owner)|Json(2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(Mag|Norm|Dist)|Rot(Between|2(Euler|Fwd|Left|Up))|(Euler|Axes)2Rot|Whisper|(Region|Owner)?Say|Shout|Listen(Control|Remove)?|Sensor(Repeat|Remove)?|Detected(Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|([GS]et)(AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(Scale|Offset|Rotate)Texture|(Rot)?Target(Remove)?|(Stop)?MoveToTarget|Apply(Rotational)?Impulse|Set(KeyframedMotion|ContentType|RegionPos|(Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(Queueing|Radius)|Vehicle(Type|(Float|Vector|Rotation)Param)|(Touch|Sit)?Text|Camera(Eye|At)Offset|PrimitiveParams|ClickAction|Link(Alpha|Color|PrimitiveParams(Fast)?|Texture(Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get((Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(PrimitiveParams|Number(OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(Details|PermMask|PrimCount)|Parcel(MaxPrims|Details|Prim(Count|Owners))|Attached(List)?|(SPMax|Free|Used)Memory|Region(Name|TimeDilation|FPS|Corner|AgentCount)|Root(Position|Rotation)|UnixTime|(Parcel|Region)Flags|(Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(Prims|NotecardLines|Sides)|Animation(List)?|(Camera|Local)(Pos|Rot)|Vel|Accel|Omega|Time(stamp|OfDay)|(Object|CenterOf)?Mass|MassMKS|Energy|Owner|(Owner)?Key|SunDirection|Texture(Offset|Scale|Rot)|Inventory(Number|Name|Key|Type|Creator|PermMask)|Permissions(Key)?|StartParameter|List(Length|EntryType)|Date|Agent(Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(Name|State))|(Get|Reset|GetAndReset)Time|PlaySound(Slave)?|LoopSound(Master|Slave)?|(Trigger|Stop|Preload)Sound|((Get|Delete)Sub|Insert)String|To(Upper|Lower)|Give(InventoryList|Money)|RezObject|(Stop)?LookAt|Sleep|CollisionFilter|(Take|Release)Controls|DetachFromAvatar|AttachToAvatar(Temp)?|InstantMessage|(GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(Length|Trim)|(Start|Stop)Animation|TargetOmega|Request(Experience)?Permissions|(Create|Break)Link|BreakAllLinks|(Give|Remove)Inventory|Water|PassTouches|Request(Agent|Inventory)Data|TeleportAgent(Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(Axis|Angle)|A(cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(CSV|Integer|Json|Float|String|Key|Vector|Rot|List(Strided)?)|DeleteSubList|List(Statistics|Sort|Randomize|(Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(Slope|Normal|Contour)|GroundRepel|(Set|Remove)VehicleFlags|SitOnLink|(AvatarOn)?(Link)?SitTarget|Script(Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(Integer|String)ToBase64|XorBase64|Log(10)?|Base64To(String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(Load|Release|(E|Une)scape)URL|ParcelMedia(CommandList|Query)|ModPow|MapDestination|(RemoveFrom|AddTo|Reset)Land(Pass|Ban)List|(Set|Clear)CameraParams|HTTP(Request|Response)|TextBox|DetectedTouch(UV|Face|Pos|(N|Bin)ormal|ST)|(MD5|SHA1|DumpList2)String|Request(Secure)?URL|Clear(Prim|Link)Media|(Link)?ParticleSystem|(Get|Request)(Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\\\\b'\n };\n\n return {\n name: 'LSL (Linden Scripting Language)',\n illegal: ':',\n contains: [\n LSL_STRINGS,\n {\n className: 'comment',\n variants: [\n hljs.COMMENT('//', '$'),\n hljs.COMMENT('/\\\\*', '\\\\*/')\n ],\n relevance: 0\n },\n LSL_NUMBERS,\n {\n className: 'section',\n variants: [\n {\n begin: '\\\\b(state|default)\\\\b'\n },\n {\n begin: '\\\\b(state_(entry|exit)|touch(_(start|end))?|(land_)?collision(_(start|end))?|timer|listen|(no_)?sensor|control|(not_)?at_(rot_)?target|money|email|experience_permissions(_denied)?|run_time_permissions|changed|attach|dataserver|moving_(start|end)|link_message|(on|object)_rez|remote_data|http_re(sponse|quest)|path_update|transaction_result)\\\\b'\n }\n ]\n },\n LSL_FUNCTIONS,\n LSL_CONSTANTS,\n {\n className: 'type',\n begin: '\\\\b(integer|float|string|key|vector|quaternion|rotation|list)\\\\b'\n }\n ]\n };\n}", "function lsl(hljs) {\n\n var LSL_STRING_ESCAPE_CHARS = {\n className: 'subst',\n begin: /\\\\[tn\"\\\\]/\n };\n\n var LSL_STRINGS = {\n className: 'string',\n begin: '\"',\n end: '\"',\n contains: [\n LSL_STRING_ESCAPE_CHARS\n ]\n };\n\n var LSL_NUMBERS = {\n className: 'number',\n relevance:0,\n begin: hljs.C_NUMBER_RE\n };\n\n var LSL_CONSTANTS = {\n className: 'literal',\n variants: [\n {\n begin: '\\\\b(PI|TWO_PI|PI_BY_TWO|DEG_TO_RAD|RAD_TO_DEG|SQRT2)\\\\b'\n },\n {\n begin: '\\\\b(XP_ERROR_(EXPERIENCES_DISABLED|EXPERIENCE_(DISABLED|SUSPENDED)|INVALID_(EXPERIENCE|PARAMETERS)|KEY_NOT_FOUND|MATURITY_EXCEEDED|NONE|NOT_(FOUND|PERMITTED(_LAND)?)|NO_EXPERIENCE|QUOTA_EXCEEDED|RETRY_UPDATE|STORAGE_EXCEPTION|STORE_DISABLED|THROTTLED|UNKNOWN_ERROR)|JSON_APPEND|STATUS_(PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(_OBJECT)?|(DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(_(BY_(LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(PARCEL(_OWNER)?|REGION)))?|CAMERA_(PITCH|DISTANCE|BEHINDNESS_(ANGLE|LAG)|(FOCUS|POSITION)(_(THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(ROOT|SET|ALL_(OTHERS|CHILDREN)|THIS)|ACTIVE|PASS(IVE|_(ALWAYS|IF_NOT_HANDLED|NEVER))|SCRIPTED|CONTROL_(FWD|BACK|(ROT_)?(LEFT|RIGHT)|UP|DOWN|(ML_)?LBUTTON)|PERMISSION_(RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(_START)?|TELEPORT|MEDIA)|OBJECT_(CLICK_ACTION|HOVER_HEIGHT|LAST_OWNER_ID|(PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_(ATTACHED|ON_REZ)|NAME|DESC|POS|PRIM_(COUNT|EQUIVALENCE)|RETURN_(PARCEL(_OWNER)?|REGION)|REZZER_KEY|ROO?T|VELOCITY|OMEGA|OWNER|GROUP(_TAG)?|CREATOR|ATTACHED_(POINT|SLOTS_AVAILABLE)|RENDER_WEIGHT|(BODY_SHAPE|PATHFINDING)_TYPE|(RUNNING|TOTAL)_SCRIPT_COUNT|TOTAL_INVENTORY_COUNT|SCRIPT_(MEMORY|TIME))|TYPE_(INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(DEBUG|PUBLIC)_CHANNEL|ATTACH_(AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](SHOULDER|HAND|FOOT|EAR|EYE|[UL](ARM|LEG)|HIP)|(LEFT|RIGHT)_PEC|HUD_(CENTER_[12]|TOP_(RIGHT|CENTER|LEFT)|BOTTOM(_(RIGHT|LEFT))?)|[LR]HAND_RING1|TAIL_(BASE|TIP)|[LR]WING|FACE_(JAW|[LR]EAR|[LR]EYE|TOUNGE)|GROIN|HIND_[LR]FOOT)|LAND_(LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(ONLINE|NAME|BORN|SIM_(POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(ON_FILE|USED)|REMOTE_DATA_(CHANNEL|REQUEST|REPLY)|PSYS_(PART_(BF_(ZERO|ONE(_MINUS_(DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(START|END)_(COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(RIBBON|WIND|INTERP_(COLOR|SCALE)|BOUNCE|FOLLOW_(SRC|VELOCITY)|TARGET_(POS|LINEAR)|EMISSIVE)_MASK)|SRC_(MAX_AGE|PATTERN|ANGLE_(BEGIN|END)|BURST_(RATE|PART_COUNT|RADIUS|SPEED_(MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(DROP|EXPLODE|ANGLE(_CONE(_EMPTY)?)?)))|VEHICLE_(REFERENCE_FRAME|TYPE_(NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(LINEAR|ANGULAR)_(FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(LINEAR|ANGULAR)_(DEFLECTION_(EFFICIENCY|TIMESCALE)|MOTOR_(DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(EFFICIENCY|TIMESCALE)|BANKING_(EFFICIENCY|MIX|TIMESCALE)|FLAG_(NO_DEFLECTION_UP|LIMIT_(ROLL_ONLY|MOTOR_UP)|HOVER_((WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(ALLOW_UNSIT|ALPHA_MODE(_(BLEND|EMISSIVE|MASK|NONE))?|NORMAL|SPECULAR|TYPE(_(BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(_(STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(NONE|LOW|MEDIUM|HIGH)|BUMP_(NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(DEFAULT|PLANAR)|SCRIPTED_SIT_ONLY|SCULPT_(TYPE_(SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(MIRROR|INVERT))|PHYSICS(_(SHAPE_(CONVEX|NONE|PRIM|TYPE)))?|(POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIT_TARGET|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(ALT_IMAGE_ENABLE|CONTROLS|(CURRENT|HOME)_URL|AUTO_(LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(WIDTH|HEIGHT)_PIXELS|WHITELIST(_ENABLE)?|PERMS_(INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(STANDARD|MINI)|PERM_(NONE|OWNER|GROUP|ANYONE)|MAX_(URL_LENGTH|WHITELIST_(SIZE|COUNT)|(WIDTH|HEIGHT)_PIXELS)))|MASK_(BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(MEDIA_COMMAND_(STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(ALLOW_(FLY|(GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(GROUP_)?OBJECTS)|USE_(ACCESS_(GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(GROUP|ALL)_OBJECT_ENTRY)|COUNT_(TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(HIDE|DEFAULT)|REGION_FLAG_(ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(METHOD|MIMETYPE|BODY_(MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|SIT_(INVALID_(AGENT|LINK_OBJECT)|NO(T_EXPERIENCE|_(ACCESS|EXPERIENCE_PERMISSION|SIT_TARGET)))|STRING_(TRIM(_(HEAD|TAIL))?)|CLICK_ACTION_(NONE|TOUCH|SIT|BUY|PAY|OPEN(_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(NONE|SCRIPT_MEMORY)|RC_(DATA_FLAGS|DETECT_PHANTOM|GET_(LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(TYPES|AGENTS|(NON)?PHYSICAL|LAND))|RCERR_(CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(ALLOWED_(AGENT|GROUP)_(ADD|REMOVE)|BANNED_AGENT_(ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(COMMAND|CMD_(PLAY|STOP|PAUSE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(CMD_((SMOOTH_)?STOP|JUMP)|DESIRED_(TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(_([ABCD]|NONE))?|MAX_(DECEL|TURN_RADIUS|(ACCEL|SPEED)))|PURSUIT_(OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(EVADE_(HIDDEN|SPOTTED)|FAILURE_(DYNAMIC_PATHFINDING_DISABLED|INVALID_(GOAL|START)|NO_(NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(PARCEL_)?UNREACHABLE)|(GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(_(FAST|NONE|SLOW))?|CONTENT_TYPE_(ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(RADIUS|STATIC)|(PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\\\\b'\n },\n {\n begin: '\\\\b(FALSE|TRUE)\\\\b'\n },\n {\n begin: '\\\\b(ZERO_ROTATION)\\\\b'\n },\n {\n begin: '\\\\b(EOF|JSON_(ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(GRANTED|DENIED))\\\\b'\n },\n {\n begin: '\\\\b(ZERO_VECTOR|TOUCH_INVALID_(TEXCOORD|VECTOR))\\\\b'\n }\n ]\n };\n\n var LSL_FUNCTIONS = {\n className: 'built_in',\n begin: '\\\\b(ll(AgentInExperience|(Create|DataSize|Delete|KeyCount|Keys|Read|Update)KeyValue|GetExperience(Details|ErrorMessage)|ReturnObjectsBy(ID|Owner)|Json(2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(Mag|Norm|Dist)|Rot(Between|2(Euler|Fwd|Left|Up))|(Euler|Axes)2Rot|Whisper|(Region|Owner)?Say|Shout|Listen(Control|Remove)?|Sensor(Repeat|Remove)?|Detected(Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|([GS]et)(AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(Scale|Offset|Rotate)Texture|(Rot)?Target(Remove)?|(Stop)?MoveToTarget|Apply(Rotational)?Impulse|Set(KeyframedMotion|ContentType|RegionPos|(Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(Queueing|Radius)|Vehicle(Type|(Float|Vector|Rotation)Param)|(Touch|Sit)?Text|Camera(Eye|At)Offset|PrimitiveParams|ClickAction|Link(Alpha|Color|PrimitiveParams(Fast)?|Texture(Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get((Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(PrimitiveParams|Number(OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(Details|PermMask|PrimCount)|Parcel(MaxPrims|Details|Prim(Count|Owners))|Attached(List)?|(SPMax|Free|Used)Memory|Region(Name|TimeDilation|FPS|Corner|AgentCount)|Root(Position|Rotation)|UnixTime|(Parcel|Region)Flags|(Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(Prims|NotecardLines|Sides)|Animation(List)?|(Camera|Local)(Pos|Rot)|Vel|Accel|Omega|Time(stamp|OfDay)|(Object|CenterOf)?Mass|MassMKS|Energy|Owner|(Owner)?Key|SunDirection|Texture(Offset|Scale|Rot)|Inventory(Number|Name|Key|Type|Creator|PermMask)|Permissions(Key)?|StartParameter|List(Length|EntryType)|Date|Agent(Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(Name|State))|(Get|Reset|GetAndReset)Time|PlaySound(Slave)?|LoopSound(Master|Slave)?|(Trigger|Stop|Preload)Sound|((Get|Delete)Sub|Insert)String|To(Upper|Lower)|Give(InventoryList|Money)|RezObject|(Stop)?LookAt|Sleep|CollisionFilter|(Take|Release)Controls|DetachFromAvatar|AttachToAvatar(Temp)?|InstantMessage|(GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(Length|Trim)|(Start|Stop)Animation|TargetOmega|Request(Experience)?Permissions|(Create|Break)Link|BreakAllLinks|(Give|Remove)Inventory|Water|PassTouches|Request(Agent|Inventory)Data|TeleportAgent(Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(Axis|Angle)|A(cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(CSV|Integer|Json|Float|String|Key|Vector|Rot|List(Strided)?)|DeleteSubList|List(Statistics|Sort|Randomize|(Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(Slope|Normal|Contour)|GroundRepel|(Set|Remove)VehicleFlags|SitOnLink|(AvatarOn)?(Link)?SitTarget|Script(Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(Integer|String)ToBase64|XorBase64|Log(10)?|Base64To(String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(Load|Release|(E|Une)scape)URL|ParcelMedia(CommandList|Query)|ModPow|MapDestination|(RemoveFrom|AddTo|Reset)Land(Pass|Ban)List|(Set|Clear)CameraParams|HTTP(Request|Response)|TextBox|DetectedTouch(UV|Face|Pos|(N|Bin)ormal|ST)|(MD5|SHA1|DumpList2)String|Request(Secure)?URL|Clear(Prim|Link)Media|(Link)?ParticleSystem|(Get|Request)(Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\\\\b'\n };\n\n return {\n name: 'LSL (Linden Scripting Language)',\n illegal: ':',\n contains: [\n LSL_STRINGS,\n {\n className: 'comment',\n variants: [\n hljs.COMMENT('//', '$'),\n hljs.COMMENT('/\\\\*', '\\\\*/')\n ],\n relevance: 0\n },\n LSL_NUMBERS,\n {\n className: 'section',\n variants: [\n {\n begin: '\\\\b(state|default)\\\\b'\n },\n {\n begin: '\\\\b(state_(entry|exit)|touch(_(start|end))?|(land_)?collision(_(start|end))?|timer|listen|(no_)?sensor|control|(not_)?at_(rot_)?target|money|email|experience_permissions(_denied)?|run_time_permissions|changed|attach|dataserver|moving_(start|end)|link_message|(on|object)_rez|remote_data|http_re(sponse|quest)|path_update|transaction_result)\\\\b'\n }\n ]\n },\n LSL_FUNCTIONS,\n LSL_CONSTANTS,\n {\n className: 'type',\n begin: '\\\\b(integer|float|string|key|vector|quaternion|rotation|list)\\\\b'\n }\n ]\n };\n}", "function Core() {\n this.options = {};\n this.ruler = new Ruler();\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n}", "function Core() {\n this.options = {};\n this.ruler = new Ruler();\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n}", "function registerRules() {\n var redirectRule = {\n priority: 100,\n conditions: [\n // If any of these conditions is fulfilled, the actions are executed.\n new RequestMatcher({\n // Both, the url and the resourceType must match.\n url: { pathSuffix: \".jpg\" },\n resourceType: [\"image\"],\n }),\n new RequestMatcher({\n url: { pathSuffix: \".jpeg\" },\n resourceType: [\"image\"],\n }),\n ],\n actions: [new RedirectRequest({ redirectUrl: catImageUrl })],\n };\n\n var exceptionRule = {\n priority: 1000,\n conditions: [\n // We use hostContains to compensate for various top-level domains.\n new RequestMatcher({ url: { hostContains: \".google.\" } }),\n ],\n actions: [new IgnoreRules({ lowerPriorityThan: 1000 })],\n };\n\n var callback = function () {\n if (chrome.runtime.lastError) {\n console.error(\"Error adding rules: \" + chrome.runtime.lastError);\n } else {\n console.info(\"Rules successfully installed\");\n chrome.declarativeWebRequest.onRequest.getRules(null, function (rules) {\n console.info(\n \"Now the following rules are registered: \" +\n JSON.stringify(rules, null, 2)\n );\n });\n }\n };\n\n chrome.declarativeWebRequest.onRequest.addRules(\n [redirectRule, exceptionRule],\n callback\n );\n}", "function Rules(options) {\n this.options = options;\n this._keep = [];\n this._remove = [];\n\n this.blankRule = {\n replacement: options.blankReplacement\n };\n\n this.keepReplacement = options.keepReplacement;\n\n this.defaultRule = {\n replacement: options.defaultReplacement\n };\n\n this.array = [];\n for (var key in options.rules) {\n this.array.push(options.rules[key]);\n }\n }", "callRuleLint(rule, raw) {\n const issues = [];\n function report(data) {\n const meta = {\n ...data.meta,\n severity: rule.severity\n };\n\n issues.push(new Issue(\n data.code,\n data.position,\n rule.name,\n meta\n ));\n }\n rule.need ? rule.lint(raw, this.config.legacy_config, { report, rules: this.config.activatedRules }) : rule.lint(raw, rule.config, { report });\n return issues;\n }", "function Rule(controller, rule, callback, name) {\n this.controller = controller;\n this.rule = rule\n this.callback = callback;\n this.name = name;\n this._infix = null;\n\t\tthis.history = [];\n \n // Cached copy of the recent most score\n this.recentScore = 0;\n \n // TODO: these functions might be useful\n // this.isEnabled = true;\n // this.disable = function() { this.isEnabled = false; return this; }\n // this.enable = function() { this.isEnabled = true; return this; }\n // this.destroy = function() { this.controller._rules.remove(this); }\n\t\t\n\t\tthis.eval = function(terms) {\n var output = this._infix.clone();\n var operators = [];\n \n while(output.length > 0) {\n var token = output.shift();\n \n\t\t\t\tif(token == 'not') {\n\t\t\t\t\tvar a = operators.pop();\n\t\t\t\t\tvar c = this.controller.operators.Negate(isNaN(a) ? terms[a] : a);\n\t\t\t\t\t\n\t\t\t\t\toperators.push(c);\n\t\t\t\n } else if(token == 'or' || token == 'and') {\n var a = operators.pop();\n var b = operators.pop();\n var c = null;\n \n if( isNaN(a) && isNaN(terms[a])) {\n throw new Error(\"Unknown term '\" + a + \"'.\");\n break;\n }\n \n if( isNaN(b) && isNaN(terms[b])) {\n throw new Error(\"Unknown term '\" + b + \"'.\");\n break;\n }\n \n // Use lookup if the variable is not a number.\n a = isNaN(a) ? terms[a] : a;\n b = isNaN(b) ? terms[b] : b;\n \n // Execute Zadeh operators\n if(token == 'or') {\n c = this.controller.operators.Or(a, b);\n } else {\n c = this.controller.operators.And(a, b);\n }\n \n // Push back into stack for next iteration.\n operators.push(c);\n } else {\n operators.push(token);\n }\n }\n \n\t\t\tvar last = operators.last();\n\t\t\t\n\t\t\t// Just incase the rule only has one variable.\n\t\t\tif(isNaN(last)) {\n\t\t\t\tlast = terms[last];\n\t\t\t} \n\t\t\t\n\t\t\tthis.history.push(last);\n\n\t\t\t// Trim to some maximum size. These\n\t\t\t// values are used for debug drawing.\n\t\t\twhile(this.history.length > 80) {\n\t\t\t\tthis.history.shift();\n\t\t\t}\n\t\t\t\n\t\t\treturn last;\n\t\t};\n }" ]
[ "0.6121276", "0.60369444", "0.60369444", "0.598585", "0.598585", "0.58960414", "0.572993", "0.5647609", "0.56428504", "0.5637207", "0.56331825", "0.56065226", "0.55734676", "0.55734676", "0.5549632", "0.55333686", "0.5476405", "0.54638815", "0.54311925", "0.54306453", "0.54291457", "0.54291457", "0.54291457", "0.54210716", "0.5419043", "0.5410348", "0.540956", "0.5380736", "0.537971", "0.53759885", "0.5365752", "0.5365752", "0.53462076", "0.53462076", "0.53462076", "0.53462076", "0.53462076", "0.5341778", "0.5319129", "0.5307464", "0.5293678", "0.5235479", "0.5223963", "0.52070814", "0.5202337", "0.5195179", "0.5194995", "0.5190213", "0.5165375", "0.5135431", "0.5132411", "0.5132364", "0.51275235", "0.5121584", "0.50999457", "0.5097091", "0.50966036", "0.5094713", "0.5082363", "0.5082363", "0.5081399", "0.5074919", "0.5074697", "0.506299", "0.50514334", "0.50500685", "0.50485593", "0.5044508", "0.5042059", "0.503801", "0.50338197", "0.5016877", "0.5004948", "0.4969962", "0.49669632", "0.49631494", "0.49602968", "0.49574217", "0.49541926", "0.49539816", "0.49535865", "0.49515948", "0.4944222", "0.49341926", "0.49297252", "0.49281654", "0.49280688", "0.49238572", "0.49210212", "0.491704", "0.49138147", "0.4909696", "0.4895934", "0.4895934", "0.4889631", "0.4889631", "0.48844445", "0.48699215", "0.48599765", "0.48594937" ]
0.57895505
6
The draw function for the Tree which takes a empty geometry and Return cylindermesh!
function DrawTheTree2(geom, x_init, y_init, z_init){ var geometry = geom; var Wrule = GetAxiomTree(); var n = Wrule.length; var stackX = []; var stackY = []; var stackZ = []; var stackA = []; var stackV = []; var stackAxis = []; var theta = params.theta * Math.PI / 180; var scale = params.scale; var angle = params.angle * Math.PI / 180; var x0 = x_init; var y0 = y_init; var z0 = z_init ; var x; var y; var z; var rota = 0, rota2 = 0, deltarota = 18 * Math.PI/180; var newbranch = false; var axis_x = new THREE.Vector3( 1, 0, 0 ); var axis_y = new THREE.Vector3( 0, 1, 0 ); var axis_z = new THREE.Vector3( 0, 0, 1 ); var zero = new THREE.Vector3( 0, 0, 0 ); var axis_delta = new THREE.Vector3(), prev_startpoint = new THREE.Vector3(); // NEW var decrease = params.treeDecrease; var treeWidth = params.treeWidth; // END var startpoint = new THREE.Vector3(x0,y0,z0), endpoint = new THREE.Vector3(); var bush_mark; var vector_delta = new THREE.Vector3(scale, scale, 0); var cylindermesh = new THREE.Object3D(); for (var j=0; j<n; j++){ treeWidth = treeWidth-decrease; var a = Wrule[j]; if (a == "+"){angle -= theta;} if (a == "-"){angle += theta;} if (a == "F"){ var a = vector_delta.clone().applyAxisAngle( axis_y, angle ); endpoint.addVectors(startpoint, a); cylindermesh.add(cylinderMesh(startpoint,endpoint,treeWidth)); prev_startpoint.copy(startpoint); startpoint.copy(endpoint); axis_delta = new THREE.Vector3().copy(a).normalize(); rota += deltarota; } if (a == "L"){ endpoint.copy(startpoint); endpoint.add(new THREE.Vector3(0, scale*1.5, 0)); var vector_delta2 = new THREE.Vector3().subVectors(endpoint, startpoint); vector_delta2.applyAxisAngle( axis_delta, rota2 ); endpoint.addVectors(startpoint, vector_delta2); cylindermesh.add(cylinderMesh(startpoint,endpoint,treeWidth)); rota2 += 45 * Math.PI/180; } if (a == "%"){ } if (a == "["){ stackV.push(new THREE.Vector3(startpoint.x, startpoint.y, startpoint.z)); stackA[stackA.length] = angle; } if (a == "]"){ var point = stackV.pop(); startpoint.copy(new THREE.Vector3(point.x, point.y, point.z)); angle = stackA.pop(); } bush_mark = a; } return cylindermesh; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Tree() {\n\n this.mesh = new THREE.Object3D();\n var top = createCylinder( 1, 30, 30, 4, Colors.green, 0, 90, 0 );\n var mid = createCylinder( 1, 40, 40, 4, Colors.green, 0, 70, 0 );\n var bottom = createCylinder( 1, 50, 50, 4, Colors.green, 0, 40, 0 );\n var trunk = createCylinder( 10, 10, 30, 32, Colors.brownDark, 0, 0, 0 );\n\n this.mesh.add( top );\n this.mesh.add( mid );\n this.mesh.add( bottom );\n this.mesh.add( trunk );\n\n this.collidable = bottom;\n}", "function drawCylinder() {\n setMV();\n Cylinder.draw();\n}", "function drawCylinder() {\n setMV();\n Cylinder.draw();\n}", "function createTree(x , y, z){ //holds all of the below as a function\r\n\t//treeTrunk the brown trunk of the tree\r\n\tvar g1 = new THREE.CylinderGeometry( 0.6, 0.6, 4.5, 20); ///(top, bottom, size, shapeish)\r\n\tvar m1 = new THREE.MeshToonMaterial({color:0x603B14,transparent:false,flatShading:false});\r\n\tm1.shininess = 7;\r\n//\tvar m1 = new THREE.MeshBasicMaterial( {color: 0x603B14} );\r\n\tvar treeTrunk = new THREE.Mesh( g1, m1 );\r\n\t//treeTrunk.rotation.y = globeBox.getCenter[2];\r\n\t//treeLower- the green part of the tree creation\r\n\tvar g2 = new THREE.CylinderGeometry(0.1, 2.9, 7, 20); // You had the sizes the wrong way around, didn't need to -7 the scale.\r\n\tvar m2 = new THREE.MeshToonMaterial({color:0x358C47,transparent:false,flatShading:false});\r\n\tm2.shininess = 5;\r\n\tvar treeLower = new THREE.Mesh( g2, m2 );\r\n\t\r\n\t// Set position of tree parts.\r\n\ttreeLower.position.x=0;\r\n\ttreeLower.position.y=6.0; //-920 for big view //6.0 works with ghetto set up\r\n\ttreeLower.position.z=0; //250 //0 works with my ghetto set up\r\n\t//add tree meshes\r\n\tscene.add( treeTrunk );\r\n\tscene.add(treeLower);\r\n\t//scales the trees up to be seen better.\r\n\ttreeTrunk.scale.x = 6;\r\n\ttreeTrunk.scale.y = 6;\r\n\ttreeTrunk.scale.z = 6;\r\n\t// define parent-child relationships\r\n\ttreeLower.parent = treeTrunk;\r\n\ttreeTrunk.position.x = x;\r\n\ttreeTrunk.position.y = y;\r\n\ttreeTrunk.position.z = z;\r\n\ttreeTrunk.parent = globe;\r\n\tvar rotation = new THREE.Quaternion();\r\n\trotation.setFromUnitVectors(globe.up, treeTrunk.position.clone().normalize());\r\n\ttreeTrunk.quaternion.copy(rotation);\r\n\t\r\n\t// Enable shadows.\r\n\ttreeTrunk.castShadow = true;\r\n\ttreeLower.castShadow = true;\r\n\r\n\t// Sets the name so the raycast can query against it.\r\n\ttreeLower.name = \"tree\";\r\n\ttreeTrunk.name = \"tree\";\r\n}", "function cylinderMesh(pointX, pointY,treeWidth) {\n var direction = new THREE.Vector3().subVectors(pointY, pointX);\n var orientation = new THREE.Matrix4();\n orientation.lookAt(pointX, pointY, new THREE.Object3D().up);\n orientation.multiply(new THREE.Matrix4(1, 0, 0, 0,\n 0, 0, 1, 0,\n 0, -1, 0, 0,\n 0, 0, 0, 1));\n var edgeGeometry = new THREE.CylinderGeometry(0.5, 0.5, direction.length(), 8, 1);\n var edge = new THREE.Mesh(edgeGeometry);\n edge.applyMatrix(orientation);\n // position based on midpoints - there may be a better solution than this\n edge.position.x = (pointY.x + pointX.x) / 2;\n edge.position.y = (pointY.y + pointX.y) / 2;\n edge.position.z = (pointY.z + pointX.z) / 2;\n return edge;\n}", "function drawCylinder() {\t\r\n\t\t//TODO: update VBO positions based on 'factor' for cone-like effect\r\n\t\tmeshes.cylinder.drawMode = gl.LINE_LOOP;\r\n\t\t\r\n\t\t// Render\r\n\t\tmeshes.cylinder.setAttribLocs(attribs);\r\n\t\tmeshes.cylinder.render();\t\t\t\t\r\n\t}", "DrawTree()\n {\n\n }", "function makeTree(n, x, y, z, rz, ry, tree) {\n\n // Get a cylinder mesh\n let segment = shapes.getCylinder(n * 0.75 / 2, n / 2, 8, \"#e0a872\")\n\n //Create a group that will serve as te center of rotation\n const group = new THREE.Group();\n const dir = new THREE.Vector3(0, 1, 0) \n group.position.x = x;\n group.position.y = y;\n group.position.z = z;\n\n group.add(segment)\n tree.add(group)\n segment.position.y += 4;\n // The rotation is done in two steps, a rotation around the Z axis followed by a rotation around the Y axis\n group.rotation.z = rz;\n let axis = new THREE.Vector3(0, 0, 1);\n let angle = rz;\n dir.applyAxisAngle(axis, angle)\n group.rotation.y = ry;\n axis = new THREE.Vector3(0, 1, 0)\n angle = ry;\n dir.applyAxisAngle(axis, angle)\n \n // Scale the direction vector to easily find the endpoint of the branch (which is also the start point of the next branches)\n dir.multiply(new THREE.Vector3(8, 8, 8));\n\n // num dictates how many branches branch off this branch\n let num = Math.floor(Math.random() * 2 * n)\n if(tree.children.length < 10) { // If the tree is too small, add an extra child branch\n num ++\n }\n for (let i = 0; i < num; i++) {\n makeTree(n * 0.75, x + dir.x, y + dir.y, z + dir.z, Math.random() * Math.PI / 2, ry + Math.PI * 2 / num * i + Math.random() * Math.PI / 6 - Math.PI / 3, tree)\n }\n\n // If this is a terminal branch then attach a bushel of leaves\n if (num == 0) {\n let leaves = shapes.getSphere(Math.log(n * 10.75), `rgb(${Math.floor(Math.random() * 100)}, 255, ${Math.floor(Math.random() * 100)})`)\n leaves.position.x = x + dir.x\n leaves.position.y = y + dir.y\n leaves.position.z = z + dir.z\n tree.add(leaves)\n }\n\n}", "render(ctx)\n\t{\n\t\tlet camera = this.tree.camera;\n\t\tlet zoom = camera.zoomSmooth;\n\n\t\tlet pos = this.posSmooth.toScreen(camera);\n\t\tlet width = this.width * zoom;\n\t\tlet height = this.height * zoom;\n\t\tlet radius = this.tree.theme.nodeBorderRadius * zoom;\n\t\tlet header = this.tree.theme.nodeHeaderSize * zoom;\n\n\t\tthis.buildNodeShape(ctx, pos, width, height, radius);\n\t\tctx.fillStyle = this.nodeColor;\n\t\tctx.fill();\n\n\t\tthis.buildNodeHeaderShape(ctx, pos, width, height, radius, header);\n\t\tctx.fillStyle = this.nodeHeaderColor;\n\t\tctx.fill();\n\n\t\tthis.buildNodeShape(ctx, pos, width, height, radius);\n\t\tctx.lineWidth = this.tree.theme.nodeBorderThickness * zoom;\n\n\t\tif (this.select)\n\t\t\tctx.strokeStyle = this.tree.theme.nodeBorderSelect;\n\t\telse if (this.hover)\n\t\t\tctx.strokeStyle = this.borderColorHighlight;\n\t\telse\n\t\t\tctx.strokeStyle = this.borderColor;\n\n\t\tctx.stroke();\n\n\t\tfor (let i = 0; i < this.inputPlugs.length; i++)\n\t\t\tthis.inputPlugs[i].render(ctx);\n\n\t\tfor (let i = 0; i < this.outputPlugs.length; i++)\n\t\t\tthis.outputPlugs[i].render(ctx);\n\n\t\tctx.fillStyle = this.tree.theme.headerFontColor;\n\t\tctx.font = this.tree.theme.headerFontSize * zoom + 'px '\n\t\t\t+ this.tree.theme.headerFontFamily;\n\t\tctx.textAlign = 'center';\n\t\tctx.textBaseline = 'middle';\n\t\tctx.fillText(this.name, pos.x + width / 2, pos.y + header / 2 * 1.05);\n\n\t\tthis.input.render(ctx);\n\t}", "function DrawTheTree(geom, x_init, y_init, z_init){\n var geometry = geom;\n var Wrule = GetAxiomTree();\n var n = Wrule.length;\n var stackX = []; var stackY = []; var stackZ = []; var stackA = [];\n var stackV = []; var stackAxis = [];\n\n var theta = params.theta * Math.PI / 180;\n var scale = params.scale;\n var angle = params.angle * Math.PI / 180;\n\n var x0 = x_init; var y0 = y_init; var z0 = z_init ;\n var x; var y; var z;\n var rota = 0, rota2 = 0,\n deltarota = 18 * Math.PI/180;\n var newbranch = false;\n var axis_x = new THREE.Vector3( 1, 0, 0 );\n var axis_y = new THREE.Vector3( 0, 1, 0 );\n var axis_z = new THREE.Vector3( 0, 0, 1 );\n var zero = new THREE.Vector3( 0, 0, 0 );\n var axis_delta = new THREE.Vector3(),\n prev_startpoint = new THREE.Vector3();\n\n var startpoint = new THREE.Vector3(x0,y0,z0),\n endpoint = new THREE.Vector3();\n var bush_mark;\n var vector_delta = new THREE.Vector3(scale, scale, 0);\n\n for (var j=0; j<n; j++){\n var a = Wrule[j];\n if (a == \"+\"){angle -= theta;\n }\n if (a == \"-\"){angle += theta;\n }\n if (a == \"F\"){\n\n var a = vector_delta.clone().applyAxisAngle( axis_y, angle );\n endpoint.addVectors(startpoint, a);\n\n geometry.vertices.push(startpoint.clone());\n geometry.vertices.push(endpoint.clone());\n\n prev_startpoint.copy(startpoint);\n startpoint.copy(endpoint);\n\n axis_delta = new THREE.Vector3().copy(a).normalize();\n rota += deltarota;// + (5.0 - Math.random()*10.0);\n\n }\n if (a == \"L\"){\n endpoint.copy(startpoint);\n endpoint.add(new THREE.Vector3(0, scale*1.5, 0));\n var vector_delta2 = new THREE.Vector3().subVectors(endpoint, startpoint);\n vector_delta2.applyAxisAngle( axis_delta, rota2 );\n endpoint.addVectors(startpoint, vector_delta2);\n\n geometry.vertices.push(startpoint.clone());\n geometry.vertices.push(endpoint.clone());\n\n rota2 += 45 * Math.PI/180;\n }\n if (a == \"%\"){\n\n }\n if (a == \"[\"){\n stackV.push(new THREE.Vector3(startpoint.x, startpoint.y, startpoint.z));\n stackA[stackA.length] = angle;\n }\n if (a == \"]\"){\n var point = stackV.pop();\n startpoint.copy(new THREE.Vector3(point.x, point.y, point.z));\n angle = stackA.pop();\n }\n bush_mark = a;\n }\n return geometry;\n}", "function makeTree(nfaces)\n{\n var vCone = nfaces + 2;\n var omega = (360.0 / faces) * (Math.PI / 180.0);\n var vertices = [];\n\n // The 8 raw vertices of the canopy (cone shape)\n vertices.push( vec4( 0.0, 0.0, 0.5 , 1) );\n for (var i = 0; i < faces; i++){\n vertices[i + 1] = vec4( Math.cos( i * omega) / 2.0, Math.sin( i * omega) / 2.0, 0.1, 1 ); // scale the rawVertices\n }\n\n // push the first point of the fan to complete the cone\n vertices.push(vertices[1]);\n\n var vCylinder = nfaces * 2;\n\n for (var j = 0 ; j < faces*2; j++) {\n if (j == 0 ) {\n vertices.push( vec4( Math.cos( j * omega) / 2.0, Math.sin( j * omega) / 2.0, 0.1, 1));\n vertices.push( vec4( Math.cos( j * omega) / 2.0, Math.sin( j * omega) / 2.0, 0.0, 1));\n }\n \n vertices.push( vec4( Math.cos( (j + 1) * omega) / 6.0, Math.sin( (j + 1) * omega) / 6.0, 0.1, 1));\n vertices.push( vec4( Math.cos( (j + 1) * omega) / 6.0, Math.sin( (j + 1) * omega) / 6.0, 0.0, 1));\n }\n\n\n for (var j = 0 ; j < vertices.length; j++) {\n console.log(vertices[j]);\n }\n\n return vertices;\n}", "function drawTree(){\n drawLeaves();\n drawTrunk();\n penUp();\n}", "drawTree() {\r\n fuenfteAufgabe.crc2.beginPath();\r\n fuenfteAufgabe.crc2.moveTo(this.x, this.y);\r\n fuenfteAufgabe.crc2.lineTo(this.x + 30, this.y - 60);\r\n fuenfteAufgabe.crc2.lineTo(this.x + 60, this.y);\r\n fuenfteAufgabe.crc2.strokeStyle = this.color;\r\n fuenfteAufgabe.crc2.stroke();\r\n fuenfteAufgabe.crc2.fillStyle = this.color;\r\n fuenfteAufgabe.crc2.fill();\r\n }", "makeCylinder(len) {\n var width = 0.3 / (0.5*(this.iter + 1));\n\n var c = (0.6 - this.iter * 0.1) + 0.2;\n var color = new THREE.Color(c, c - 0.1, c * 0.1);\n\n var geometry = new THREE.CylinderGeometry(width, width, len);\n var material = new THREE.MeshLambertMaterial( {color: color} );\n material.metalness = 0;\n material.reflectivity = 0;\n material.roughness = 0.6;\n var cylinder = new THREE.Mesh( geometry, material );\n this.scene.add( cylinder );\n\n //Orient the cylinder to the turtle's current direction\n var quat = new THREE.Quaternion();\n quat.setFromUnitVectors(new THREE.Vector3(0,1,0), this.state.dir);\n var mat4 = new THREE.Matrix4();\n mat4.makeRotationFromQuaternion(quat);\n cylinder.applyMatrix(mat4);\n\n\n //Move the cylinder so its base rests at the turtle's current position\n var mat5 = new THREE.Matrix4();\n var trans = this.state.pos.add(this.state.dir.multiplyScalar(0.5 * len));\n mat5.makeTranslation(trans.x, trans.y, trans.z);\n cylinder.applyMatrix(mat5);\n\n //Scoot the turtle forward by len units\n this.moveForward(len / 2);\n }", "function drawTrees()\n{\nfor(var i = 0; i < trees_x.length; i++)\n {\n fill(160,82,45)\n rect(trees_x[i] - 25, floorPos_y - 150, 50, 150)\n //head\n fill(0, 100, 0) \n triangle(trees_x[i] - 75, floorPos_y - 150, trees_x[i], floorPos_y - 300, trees_x[i] + 75, floorPos_y - 150);\n }\n\n}", "function TreePainter() {\n\n}", "paint(ctx, geom, properties) {\n this.leafSize = parseInt(properties.get('--leaf-size')) || 16;\n this.leafColor = (properties.get('--leaf-color') || '#73ce8f').toString().trim();\n this.leafVariance = (properties.get('--leaf-variance') || 'left').toString().trim();\n\n // left\n this.paintVine(ctx, properties, geom.height, 0, [0, 0]);\n\n if (this.leafVariance === 'around') {\n // top\n this.paintVine(ctx, properties, geom.width, -90, [-this.width, 0]);\n // // right\n this.paintVine(ctx, properties, geom.height, -180, [-geom.width, -geom.height]);\n // // bottom\n this.paintVine(ctx, properties, geom.width, -270, [geom.height - this.width, -geom.width]);\n }\n }", "renderTree() {\n\t\tlet svg = d3.select(\"body\")\n\t\t\t.append(\"svg\")\n\t\t\t.attr(\"width\", 1200)\n\t\t\t.attr(\"height\", 1200);\n\n\t\tsvg.selectAll(\"line\")\n\t\t\t.data(this.nodesList.slice(1, this.nodesList.length))\n\t\t\t.enter()\n\t\t\t.append(\"line\")\n\t\t\t.attr(\"x1\", d => d.parentNode.level*220+50)\n\t\t\t.attr(\"y1\", d => d.parentNode.position*100+55)\n\t\t\t.attr(\"x2\", d => d.level*220+50)\n\t\t\t.attr(\"y2\", d => d.position*100+55);\n\n\t\tsvg.selectAll(\"circle\")\n\t\t .data(this.nodesList)\n\t\t .enter()\n\t\t .append(\"circle\")\n\t\t .attr(\"cx\", d => d.level*220+50)\n\t\t .attr(\"cy\", d => d.position*100+50)\n\t\t .attr(\"r\", 45);\n\n\t\tsvg.selectAll(\"text\")\n\t\t\t.data(this.nodesList)\n\t\t\t.enter()\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", d => d.level*220+50)\n\t\t\t.attr(\"y\", d => d.position*100+55)\n\t\t\t.attr(\"text-anchor\", \"middle\")\n\t\t\t.html(d => d.name);\n\t\t}", "function createTree(scene) {\n var trunk = new THREE.CubeGeometry(1, 8, 1);\n var leaves = new THREE.SphereGeometry(4);\n\n // create the mesh\n var trunkMesh = new THREE.Mesh(trunk, new THREE.MeshPhongMaterial({\n color: 0x8b4513\n }));\n var leavesMesh = new THREE.Mesh(leaves, new THREE.MeshPhongMaterial({\n color: 0x00ff00\n }));\n\n // position the trunk. Set y to half of height of trunk\n trunkMesh.position.set(-10, 4, 0);\n leavesMesh.position.set(-10, 12, 0);\n\n trunkMesh.castShadow = true;\n trunkMesh.receiveShadow = true;\n leavesMesh.castShadow = true;\n leavesMesh.receiveShadow = true;\n\n scene.add(trunkMesh);\n scene.add(leavesMesh);\n }", "function drawTree() {\n noStroke();\n fill(TRUNK_COLOR);\n rect(xTrunkCorner, yTrunkCorner, 10, 50);\n\n // fill alternating columns with different colors of green\n if (i % 2 == 0) {\n fill(TREE_COLOR1);\n }\n if (i % 2 == 1) {\n fill(TREE_COLOR2);\n }\n\n // triangles that make up the treetops\n triangle(xTreeCorner1, yTreeCorner1, xTreeCorner2, yTreeCorner2, xTreeCorner3, yTreeCorner3);\n triangle(xTreeCorner1 - 5, yTreeCorner1 + 20, xTreeCorner2, yTreeCorner2 + 20, xTreeCorner3 + 5, yTreeCorner3 + 20);\n triangle(xTreeCorner1 - 10, yTreeCorner1 + 40, xTreeCorner2, yTreeCorner2 + 40, xTreeCorner3 + 10, yTreeCorner3 + 40);\n }", "function drawTree() {\n noStroke();\n fill(TRUNK_COLOR);\n rect(xTrunkCorner, yTrunkCorner, 10, 50);\n\n // fill alternating columns with different colors of green\n if (i % 2 == 0) {\n fill(TREE_COLOR1);\n }\n if (i % 2 == 1) {\n fill(TREE_COLOR2);\n }\n\n // triangles that make up the treetops\n triangle(xTreeCorner1, yTreeCorner1, xTreeCorner2, yTreeCorner2, xTreeCorner3, yTreeCorner3);\n triangle(xTreeCorner1 - 5, yTreeCorner1 + 20, xTreeCorner2, yTreeCorner2 + 20, xTreeCorner3 + 5, yTreeCorner3 + 20);\n triangle(xTreeCorner1 - 10, yTreeCorner1 + 40, xTreeCorner2, yTreeCorner2 + 40, xTreeCorner3 + 10, yTreeCorner3 + 40);\n }", "function drawTrunk(){\n centerTree();\n penRGB(142,41,12,0.75);\n penDown();\n penWidth(10);\n moveForward(15);\n turnLeft(180);\n moveForward(30);\n drawLeaves();\n penUp();\n}", "function drawTree(fork) {\n ctx.fillStyle = \"#fff\"\n ctx.fillRect(0,0,width,height)\n fork.assignID(1)\n let list = fork.list()\n let levels = fork.levels()\n console.log(\"Drawing L\"+levels+\" \"+list)\n //console.log(list)\n //console.log(levels + \" levels\")\n let dy = height / list.length\n var putx = 440 - Math.max(0, 15 * (fork.maxcharlength() - 15))\n let dx = putx / (levels+1)\n\n //Add names\n ctx.fillStyle = \"#000\"\n list.forEach((e, i) => ctx.fillText(e, putx+11, 1 + i * dy + dy/2));\n ctx.fillStyle = \"#00f\"\n list.forEach((e, i) => ctx.fillText(e, putx+10, 0 + i * dy + dy/2));\n\n //Add lines\n ctx.fillStyle = \"#000\"\n //ctx.fillRect(dx,height/4,10,height/2)\n //ctx.fillStyle = \"#f00\"\n //ctx.fillRect(10,fork.mid() * dy, dx, 10)\n //list.forEach((e, i) => ctx.fillRect(440 - dx, -15 + i * dy + dy/2, dx, 10))\n fork.draw(ctx, levels, levels+1, levels, dx, dy)\n}", "function draw(numberOfSurfaces) {\n // Calculate the size of each surface\n var interiorAngle = Math.PI * (numberOfSurfaces-2) / numberOfSurfaces;\n var childNodeSize = parentNodeSize/Math.tan(interiorAngle/2);\n\n for (var i=0; i<numberOfSurfaces; i++) {\n var newNode = MeshNode.addChild();\n meshArray.push(newNode);\n\n var newDomNode = DomNode.addChild();\n domArray.push(newDomNode);\n new DOMElement(newDomNode, { \n tagName: 'div',\n properties: {\n backgroundColor: \"hsl(\" + (i * 360 / numberOfSurfaces) + \", 100%, 50%)\"\n }\n });\n var mesh = new Mesh(newNode);\n mesh.setGeometry('Plane');\n var hex = tinycolor(\"hsl(\" + (i * 360 / numberOfSurfaces) + \", 100%, 50%)\").toHex();\n var gloss = tinycolor(\"hsl(\" + ((numberOfSurfaces-1-i) * 360 / numberOfSurfaces) + \", 100%, 50%)\").toHex();\n mesh.setBaseColor(new Color(\"#\" + hex))\n .setGlossiness(new Color(\"#\" + gloss), 500);\n\n newNode\n // Set size mode to 'absolute' to use absolute pixel values\n .setSizeMode('absolute', 'absolute', 'absolute')\n .setAbsoluteSize(childNodeSize, parentNodeSize, parentNodeSize)\n // Center the 'node' to the parent (the screen, in this instance)\n .setAlign(0.5, 0.5, 0.5)\n // Set the translational origin to the center of the 'node'(depth=0 in this case)\n .setMountPoint(0.5, 0.5, 0)\n // Set the rotational origin to the center of the 'node'(depth=0 in this case)\n .setOrigin(0.5, 0.5, 0)\n .setRotation(0, i*2*Math.PI/numberOfSurfaces, 0);\n\n newDomNode\n // Set size mode to 'absolute' to use absolute pixel values\n .setSizeMode('absolute', 'absolute', 'absolute')\n .setAbsoluteSize(childNodeSize, parentNodeSize, parentNodeSize)\n // Center the 'node' to the parent (the screen, in this instance)\n .setAlign(0.5, 0.5, 0.5)\n // Set the translational origin to the center of the 'node'(depth=0 in this case)\n .setMountPoint(0.5, 0.5, 0)\n // Set the rotational origin to the center of the 'node'(depth=0 in this case)\n .setOrigin(0.5, 0.5, 0)\n .setRotation(0, i*2*Math.PI/numberOfSurfaces, 0);\n } \n}", "makeObjectGeometry () {\n // A fresh, empty Geometry object that will hold the mesh geometry\n var cylGeom = new THREE.Geometry()\n var normals = []\n\n // The bottom face is set at Y = -1\n cylGeom.vertices.push(new THREE.Vector3(0, -1, 0))\n normals.push(new THREE.Vector3(0, -1, 0))\n\n // Create and push the vertices/normals of the bottom face\n for (let i = this._slices; i > 0; i--) {\n var theta = (i / this._slices) * Math.PI * 2\n cylGeom.vertices.push(new THREE.Vector3(Math.cos(theta), -1, Math.sin(theta)))\n normals.push(new THREE.Vector3(Math.cos(theta), 0, Math.sin(theta)))\n }\n\n // Push the faces for the bottom circle\n for (let i = 1; i <= this._slices; i++) {\n if (i === this._slices) {\n cylGeom.faces.push(new THREE.Face3(1, i, 0, normals[0]))\n } else {\n cylGeom.faces.push(new THREE.Face3(i + 1, i, 0, normals[0]))\n }\n }\n\n // topCircle checks the length of the vertices on the bottom circle\n // Later used to draw faces for the side\n let topCircle = cylGeom.vertices.length\n\n // // The top face is set at Y = 1\n cylGeom.vertices.push(new THREE.Vector3(0, 1, 0))\n normals.push(new THREE.Vector3(0, 1, 0))\n\n // Create and push the vertices/normals of the top face\n for (let i = this._slices; i > 0; i--) {\n theta = (i / this._slices) * Math.PI * 2\n cylGeom.vertices.push(new THREE.Vector3(Math.cos(theta), 1, Math.sin(theta)))\n normals.push(new THREE.Vector3(Math.cos(theta), 0, Math.sin(theta)))\n }\n\n // Push the faces for the top circle\n for (let i = 1; i <= this._slices; i++) {\n if (i === this._slices) {\n cylGeom.faces.push(new THREE.Face3(this._slices + 2, this._slices + 1, i + this._slices + 1, normals[this._slices + 1]))\n } else {\n cylGeom.faces.push(new THREE.Face3(i + this._slices + 2, this._slices + 1, i + this._slices + 1, normals[this._slices + 1]))\n }\n }\n\n // Push the faces for the sides\n // C---D\n // |\\ |\n // | \\ |\n // | \\|\n // A---B\n //\n for (let i = 1; i <= this._slices; i++) {\n let A = i\n let B = A + 1\n let C = topCircle + i\n let D = C + 1\n\n // Alter vertices B and D for the last face of the cylinder\n if (i === this._slices) {\n B = 1\n D = topCircle + 1\n }\n\n cylGeom.faces.push(new THREE.Face3(C, A, B, [normals[C], normals[A], normals[B]]))\n cylGeom.faces.push(new THREE.Face3(C, B, D, [normals[C], normals[B], normals[D]]))\n }\n\n // Return the finished geometry\n return cylGeom\n }", "function Cylinder(color){\n this.color = color;\n this.trs = mat4();\n}", "display() {\n stroke([204, 0, 255, 100]);\n strokeWeight(1);\n fill([255,0,0,70]);\n beginShape();\n for (let i=0; i<this.vertices.length; i++) {\n vertex(this.vertices[i].x/DIVIDER, this.vertices[i].y/DIVIDER);\n circle(this.vertices[i].x/DIVIDER, this.vertices[i].y/DIVIDER, 3);\n }\n vertex(this.vertices[0].x/DIVIDER, this.vertices[0].y/DIVIDER);\n endShape();\n }", "draw() {\n while (scene.children.length > 0) {\n scene.remove(scene.children[0]);\n }\n var from = new THREE.Vector3(0, (this.height / -2), (this.length / 2));\n var to = new THREE.Vector3(0, (this.height / -2), (this.length / 2) + 1000);\n var direction = to.clone().sub(from);\n var length = direction.length();\n var arrowHelper = new THREE.ArrowHelper(direction.normalize(), from, length, \"red\");\n scene.add(arrowHelper);\n var gridHelper = new THREE.GridHelper(1.5 * this.length, 15);\n gridHelper.position.set(0, (this.height / -2), 0);\n scene.add(gridHelper);\n runtimeManager.currentGridUUID = gridHelper.uuid;\n super.draw(null, { type: \"bordered\" });\n for (var index in this.goods) {\n var g = this.goods[index];\n g.draw({ h: this.height, w: this.width, l: this.length }, { type: \"filled\" });\n }\n }", "function cylinder(scene, height, br, tr, stacks, slices) {\n \tCGFobject.call(this,scene);\n\t\n\tthis.height = height;\n\tthis.br = br;\n\tthis.tr = tr;\n\tthis.slices=slices;\n\tthis.stacks=stacks;//+1;\n\t\n \tthis.initBuffers();\n }", "function makeHWTree (treeHeight, treeRadius, treeImage, branchImage, leafImage) {\n\tvar treeFrame = new THREE.Object3D();\n\n\t//create and add the cylindrical trunk\n var trunkGeom = new THREE.CylinderGeometry(treeRadius, treeRadius, treeHeight, 64, 64);\n var trunkMat = createMaterial(treeImage);\n var trunkMesh = new THREE.Mesh(trunkGeom, trunkMat);\n trunkMesh.position.set(0, 0.5*treeHeight, 0);\n treeFrame.add(trunkMesh);\n treeFrame.add(trunkMesh);\n\n //branches\n var numBranches = Math.floor(Math.random()*5 + 7);\n for (var i = 0; i < numBranches; i++) {\n \t//define randomized branch parameters and create the branch\n \tvar branchLength = (Math.random()*0.2 + 0.2)*treeHeight;\n \tvar branchRadius = (Math.random()*0.2 + 0.4)*treeRadius;\n \tvar branchCurvature = (Math.random()*0.2 + 0.2)*branchLength;\n \tvar numLeaves = Math.floor(Math.random()*2 + 3);\n \tvar branch = makeBranch(branchLength, branchRadius, branchCurvature, branchImage, numLeaves, leafImage, 0.3);\n\n \t//position and rotate the branch along the cylindrical trunk\n \tvar branchHeight = (Math.random()*0.2 + 0.6)*treeHeight;\n \tbranch.position.set(0, branchHeight, 0);\n \tbranch.rotateY(Math.random()*2*Math.PI - 2*Math.PI);\n \tbranch.rotateZ(Math.random()*2*Math.PI - 2*Math.PI);\n \ttreeFrame.add(branch);\n }\n\n\treturn treeFrame;\n}", "function addFlatCylinder(obj, x, y, z, s) {\n 'use strict';\n\n geometry = new THREE.CylinderGeometry(3 * s, 3 * s, 0.5, 12);\n mesh= new THREE.Mesh(geometry, material);\n\n mesh.position.set(x, y, z);\n mesh.rotation.x += Math.PI / 2;\n obj.add(mesh);\n}", "glowTree(){\n\t\tif(isInside(mouse_press, this.vertex) && (this.children.length == 0)){\n\t\t\tnoFill();\n\t\t\tstrokeWeight(2);\n\t\t\tstroke(255);\n\t\t\tellipse(this.x, this.y, 15);\n\n\t\t\tif(!isInside(mouse_drag, this.vertex) && mouseIsDragged){\n\t\t\t\tvar brother = this.getBrother();\n\t\t\t\tvar father = this.parent;\n\t\t\t\tfill(brother.color[0], brother.color[1], brother.color[2]);\n\t\t\t\tstrokeWeight(2);\n\t\t\t\tstroke(51);\n\t\t\t\tellipse(father.x, father.y, 15);\n\t\t\t}\n\t\t\treturn;\n\n\t\t}else if(isInside(mouse_press, this.vertex) && (this.children.length !== 0)){\n\t\t\tthis.children[0].glowTree();\n\t\t\tthis.children[1].glowTree();\n\t\t}else return;\n\t\n\t}", "_createNodes() {\n\n const NO_STATE_INHERIT = false;\n const scene = this._viewer.scene;\n const radius = 1.0;\n const handleTubeRadius = 0.06;\n const hoopRadius = radius - 0.2;\n const tubeRadius = 0.01;\n const arrowRadius = 0.07;\n\n this._rootNode = new Node(scene, {\n position: [0, 0, 0],\n scale: [5, 5, 5]\n });\n\n const rootNode = this._rootNode;\n\n const shapes = {// Reusable geometries\n\n arrowHead: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: arrowRadius,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.2,\n openEnded: false\n })),\n\n arrowHeadBig: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.001,\n radiusBottom: 0.09,\n radialSegments: 32,\n heightSegments: 1,\n height: 0.25,\n openEnded: false\n })),\n\n arrowHeadHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.09,\n radiusBottom: 0.09,\n radialSegments: 8,\n heightSegments: 1,\n height: 0.37,\n openEnded: false\n })),\n\n curve: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: tubeRadius,\n radialSegments: 64,\n tubeSegments: 14,\n arc: (Math.PI * 2.0) / 4.0\n })),\n\n curveHandle: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: handleTubeRadius,\n radialSegments: 64,\n tubeSegments: 14,\n arc: (Math.PI * 2.0) / 4.0\n })),\n\n hoop: new ReadableGeometry(rootNode, buildTorusGeometry({\n radius: hoopRadius,\n tube: tubeRadius,\n radialSegments: 64,\n tubeSegments: 8,\n arc: (Math.PI * 2.0)\n })),\n\n axis: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: tubeRadius,\n radiusBottom: tubeRadius,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n })),\n\n axisHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({\n radiusTop: 0.08,\n radiusBottom: 0.08,\n radialSegments: 20,\n heightSegments: 1,\n height: radius,\n openEnded: false\n }))\n };\n\n const materials = { // Reusable materials\n\n pickable: new PhongMaterial(rootNode, { // Invisible material for pickable handles, which define a pickable 3D area\n diffuse: [1, 1, 0],\n alpha: 0, // Invisible\n alphaMode: \"blend\"\n }),\n\n red: new PhongMaterial(rootNode, {\n diffuse: [1, 0.0, 0.0],\n emissive: [1, 0.0, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightRed: new EmphasisMaterial(rootNode, { // Emphasis for red rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [1, 0, 0],\n fillAlpha: 0.6\n }),\n\n green: new PhongMaterial(rootNode, {\n diffuse: [0.0, 1, 0.0],\n emissive: [0.0, 1, 0.0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightGreen: new EmphasisMaterial(rootNode, { // Emphasis for green rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [0, 1, 0],\n fillAlpha: 0.6\n }),\n\n blue: new PhongMaterial(rootNode, {\n diffuse: [0.0, 0.0, 1],\n emissive: [0.0, 0.0, 1],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80,\n lineWidth: 2\n }),\n\n highlightBlue: new EmphasisMaterial(rootNode, { // Emphasis for blue rotation affordance hoop\n edges: false,\n fill: true,\n fillColor: [0, 0, 1],\n fillAlpha: 0.2\n }),\n\n center: new PhongMaterial(rootNode, {\n diffuse: [0.0, 0.0, 0.0],\n emissive: [0, 0, 0],\n ambient: [0.0, 0.0, 0.0],\n specular: [.6, .6, .3],\n shininess: 80\n }),\n\n highlightBall: new EmphasisMaterial(rootNode, {\n edges: false,\n fill: true,\n fillColor: [0.5, 0.5, 0.5],\n fillAlpha: 0.5,\n vertices: false\n }),\n\n highlightPlane: new EmphasisMaterial(rootNode, {\n edges: true,\n edgeWidth: 3,\n fill: false,\n fillColor: [0.5, 0.5, .5],\n fillAlpha: 0.5,\n vertices: false\n })\n };\n\n this._displayMeshes = {\n\n plane: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, {\n primitive: \"triangles\",\n positions: [\n 0.5, 0.5, 0.0, 0.5, -0.5, 0.0, // 0\n -0.5, -0.5, 0.0, -0.5, 0.5, 0.0, // 1\n 0.5, 0.5, -0.0, 0.5, -0.5, -0.0, // 2\n -0.5, -0.5, -0.0, -0.5, 0.5, -0.0 // 3\n ],\n indices: [0, 1, 2, 2, 3, 0]\n }),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0.0, 0],\n diffuse: [0, 0, 0],\n backfaces: true\n }),\n opacity: 0.6,\n ghosted: true,\n ghostMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n edgeColor: [0, 0, 0],\n fillAlpha: 0.1,\n backfaces: true\n }),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false,\n scale: [2.4, 2.4, 1]\n }), NO_STATE_INHERIT),\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, { // Visible frame\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 1.7,\n tube: tubeRadius * 2,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n emissive: [0, 0, 0],\n diffuse: [0, 0, 0],\n specular: [0, 0, 0],\n shininess: 0\n }),\n //highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n edgeColor: [0.0, 0.0, 0.0],\n filled: true,\n fillColor: [0.8, 0.8, 0.8],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, .1],\n rotation: [0, 0, 45]\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n xCurve: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis\n geometry: shapes.curve,\n material: materials.red,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n xCurveHandle: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis\n geometry: shapes.curveHandle,\n material: materials.pickable,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n xCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0., -0.07, -0.8, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(0 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0.0, -0.8, -0.07, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n yCurve: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curve,\n material: materials.green,\n rotation: [-90, 0, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n yCurveHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curveHandle,\n material: materials.pickable,\n rotation: [-90, 0, 0],\n pickable: true,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n yCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0.07, 0, -0.8, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0.8, 0.0, -0.07, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n zCurve: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis\n geometry: shapes.curve,\n material: materials.blue,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zCurveHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.curveHandle,\n material: materials.pickable,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zCurveCurveArrow1: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(.8, -0.07, 0, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n return math.mulMat4(translate, scale, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zCurveArrow2: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(.05, -0.8, 0, math.identityMat4());\n const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());\n const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n center: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildSphereGeometry({\n radius: 0.05\n })),\n material: materials.center,\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n xAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxis: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxisHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n yAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false,\n opacity: 0.2\n }), NO_STATE_INHERIT),\n\n yShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.green,\n position: [0, -radius / 2, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yShaftHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n position: [0, -radius / 2, 0],\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n //----------------------------------------------------------------------------------------------------------\n //\n //----------------------------------------------------------------------------------------------------------\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHead,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: true,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n\n zShaft: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axis,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: false,\n collidable: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisHandle: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.axisHandle,\n material: materials.pickable,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n clippable: false,\n pickable: true,\n collidable: true,\n visible: false\n }), NO_STATE_INHERIT)\n };\n\n this._affordanceMeshes = {\n\n planeFrame: rootNode.addChild(new Mesh(rootNode, {\n geometry: new ReadableGeometry(rootNode, buildTorusGeometry({\n center: [0, 0, 0],\n radius: 2,\n tube: tubeRadius,\n radialSegments: 4,\n tubeSegments: 4,\n arc: Math.PI * 2.0\n })),\n material: new PhongMaterial(rootNode, {\n ambient: [1, 1, 1],\n diffuse: [0, 0, 0],\n emissive: [1, 1, 0]\n }),\n highlighted: true,\n highlightMaterial: new EmphasisMaterial(rootNode, {\n edges: false,\n filled: true,\n fillColor: [1, 1, 0],\n fillAlpha: 1.0\n }),\n pickable: false,\n collidable: false,\n clippable: false,\n visible: false,\n scale: [1, 1, 1],\n rotation: [0, 0, 45]\n }), NO_STATE_INHERIT),\n\n xHoop: rootNode.addChild(new Mesh(rootNode, { // Full \n geometry: shapes.hoop,\n material: materials.red,\n highlighted: true,\n highlightMaterial: materials.highlightRed,\n matrix: (function () {\n const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());\n const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate1, rotate2, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yHoop: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.hoop,\n material: materials.green,\n highlighted: true,\n highlightMaterial: materials.highlightGreen,\n rotation: [-90, 0, 0],\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zHoop: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis\n geometry: shapes.hoop,\n material: materials.blue,\n highlighted: true,\n highlightMaterial: materials.highlightBlue,\n matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),\n pickable: false,\n collidable: true,\n clippable: false,\n backfaces: true,\n visible: false\n }), NO_STATE_INHERIT),\n\n xAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.red,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n yAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.green,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT),\n\n zAxisArrow: rootNode.addChild(new Mesh(rootNode, {\n geometry: shapes.arrowHeadBig,\n material: materials.blue,\n matrix: (function () {\n const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());\n const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());\n return math.mulMat4(rotate, translate, math.identityMat4());\n })(),\n pickable: false,\n collidable: true,\n clippable: false,\n visible: false\n }), NO_STATE_INHERIT)\n };\n }", "function drawTrees()\n{\n for(var i = 0; i < trees_x.length; i++)\n {\n \n fill(102, 51, 0)\n rect(trees_x[i].x_pos - 10, 347, 20, 85);\n \n fill(0,255,0)\n triangle(trees_x[i].x_pos, 280, trees_x [i].x_pos - 29, 369, trees_x [i].x_pos + 29, 369);\n }\n}", "renderTree() {\n // STEP 1: CREATE THE SVG FOR THE VISUALIZATION\n let svg = d3.select(\"body\").append(\"svg\");\n svg.attr(\"width\", 1200)\n .attr(\"height\", 1200);\n \n // STEP 2: DRAW THE VERTICES AND THE LABELS\n let nodes = svg.selectAll(\"g\").data(this.nodeList); // Update\n let nodesEnter = nodes.enter().append(\"g\"); // Enter\n nodes.exit().remove() // Exit\n nodes = nodesEnter.merge(nodes); // Merge\n // set the class and the transformation for the nodes\n nodes.attr(\"class\", \"nodeGroup\")\n .attr(\"transform\", \"translate(50, 145)\");\n // append circle to the groups\n nodes.append(\"circle\").attr(\"cx\", function(node){return node.level * 260;})\n .attr(\"cy\", function(node){return node.position * 130;})\n .attr(\"r\", 50);\n // append text to the circle\n nodes.append(\"text\").text(function(node){return node.name;})\n .attr(\"class\", \"label\")\n .attr(\"x\", function(node){return node.level * 260})\n .attr(\"y\", function(node){return node.position * 130});\n\n // STEP 3: DRAW THE EDGES\n // Not too happy with this part because there has to be a correct way of solving this problem cleanly like drawing the nodes\n // With the deadline this was the best thing that I could come up with\n let animalSponge = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 50)\n .attr(\"y1\", 0)\n .attr(\"x2\", 210)\n .attr(\"y2\", 0);\n let animalNephroza = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 36)\n .attr(\"y1\", 36)\n .attr(\"x2\", 215)\n .attr(\"y2\", 238);\n let spongeCalcinea = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 310)\n .attr(\"y1\", 0)\n .attr(\"x2\", 470)\n .attr(\"y2\", 0);\n let spongePetrosina = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 302)\n .attr(\"y1\", 28)\n .attr(\"x2\", 470)\n .attr(\"y2\", 120);\n let nephrozaVertebrates = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 310)\n .attr(\"y1\", 260)\n .attr(\"x2\", 470)\n .attr(\"y2\", 260);\n let nephrozaProtosomes = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 290)\n .attr(\"y1\", 300)\n .attr(\"x2\", 480)\n .attr(\"y2\", 615);\n let vertebratesLampreys = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 260)\n .attr(\"x2\", 730)\n .attr(\"y2\", 260);\n let vertebratesSharks = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 275)\n .attr(\"x2\", 730)\n .attr(\"y2\", 380);\n let vertebratesTetrapods = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 290)\n .attr(\"x2\", 730)\n .attr(\"y2\", 500);\n let tetrapodsTurtles = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 830)\n .attr(\"y1\", 520)\n .attr(\"x2\", 990)\n .attr(\"y2\", 520);\n let protosomesWaterBears = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 650)\n .attr(\"x2\", 730)\n .attr(\"y2\", 650);\n let protosomesHexapods = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 570)\n .attr(\"y1\", 670)\n .attr(\"x2\", 730)\n .attr(\"y2\", 780);\n let hexapodsInsects = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 830)\n .attr(\"y1\", 780)\n .attr(\"x2\", 990)\n .attr(\"y2\", 780);\n let hexapodsProturans = svg.append(\"line\")\n .attr(\"transform\", \"translate(50, 145)\")\n .attr(\"x1\", 830)\n .attr(\"y1\", 800)\n .attr(\"x2\", 990)\n .attr(\"y2\", 900);\n }", "function drawTrees()\n{\n for (var i = 0; i < trees_x.length; i++)\n {\n fill(114, 76, 10);\n rect(trees_x[i], treePos_y + 45 , 60, 100);\n fill(42, 241, 149);\n triangle(trees_x[i] - 50, treePos_y + 50, trees_x[i] + 30, treePos_y - 50, trees_x[i] + 110, treePos_y + 50);\n triangle(trees_x[i] - 50, treePos_y , trees_x[i] + 30, treePos_y - 100, trees_x[i] + 110, treePos_y );\n\n }\n}", "function cylinder() {\n\n}", "function drawTrees()\n{\n\tfor(var i = 0; i < trees_x.length; i++)\n\t\t{\t//tunk\n\t\t\tfill(120,100,40);\n\t\t\trect(trees_x[i],\n\t\t\t\t treePos_y,60,150);\n\t\t\t//branches\n\t\t\tfill(0,155,0);\n\t\t\ttriangle(trees_x[i] - 50,\n\t\t\t\t\t treePos_y,trees_x[i] + 30,\n\t\t\t\t\t treePos_y - 100,trees_x[i] + 110,treePos_y);\n\t\t\ttriangle(trees_x[i] - 50,\n\t\t\t\t\t treePos_y + 50,trees_x[i]+ 30,treePos_y - 50,trees_x[i] + 110,treePos_y + 50);\n\t\t}\n}", "function createResistorMesh(){\n let d = 2.54;\n let radialSegments = 10;\n let heightSegments = 1;\n let openEnded = true;\n\n let bodyLength = 6.0;\n let bodyDiameter = 2.3;\n let leadLength = 28.0; \n let leadDiameter = 0.4;\n\n // Materials\n let material = new THREE.MeshLambertMaterial({ \n color: 0xDEB87A,\n side: THREE.DoubleSide,\n alphaTest: 1,\n transparent: true\n });\n\n let leadMaterial = new THREE.MeshLambertMaterial({\n color: 0x828F96,\n side: THREE.DoubleSide,\n alphaTest: 1,\n transparent: true\n });\n\n // center cylinder =\n let cLength = 2.5;\n let cRadius = 1.9/2;\n let centerGeometry = new THREE.CylinderGeometry(cRadius, cRadius, cLength, radialSegments, heightSegments, openEnded);\n\n // first cone cylinder <\n let c1Length = 0.3;\n let c1RadiusTop = 2.3/2;\n let c1RadiusBottom = 1.9/2;\n\n let c1Geometry = new THREE.CylinderGeometry(c1RadiusTop, c1RadiusBottom, c1Length, radialSegments, heightSegments, openEnded);\n c1Geometry.translate(0,cLength/2+c1Length/2,0);\n let c1CloneGeometry = c1Geometry.clone();\n c1CloneGeometry.rotateX(Math.PI);\n\n // head cylinder =\n let cHLength = 1.0;\n let cHRadius = 2.3/2;\n\n let cHGeometry = new THREE.CylinderGeometry(cHRadius, cHRadius, cHLength, radialSegments, heightSegments, openEnded);\n cHGeometry.translate(0,cLength/2 + c1Length + cHLength/2,0);\n let cHCloneGeometry = cHGeometry.clone();\n cHCloneGeometry.rotateX(Math.PI);\n\n // second cone cylinder >\n let c2Length = 0.3;\n let c2TopRadius = 1.9/2;\n let c2BottomRadius = 2.3/2;\n\n let c2Geometry = new THREE.CylinderGeometry(c2TopRadius, c2BottomRadius, c2Length, radialSegments, heightSegments, openEnded);\n c2Geometry.translate(0,cLength/2 + c1Length + cHLength + c2Length/2,0);\n let c2CloneGeometry = c2Geometry.clone();\n c2CloneGeometry.rotateX(Math.PI);\n\n // Final cone cylinder >\n let cFLength = 0.2;\n let cFTopRadius = 0.4/2;\n let cFBottomRadius = 1.9/2;\n\n let cFGeometry = new THREE.CylinderGeometry(cFTopRadius, cFBottomRadius, cFLength, radialSegments, heightSegments, openEnded);\n cFGeometry.translate(0,cLength/2 + c1Length + cHLength + c2Length + cFLength/2,0);\n let cFCloneGeometry = cFGeometry.clone();\n cFCloneGeometry.rotateX(Math.PI);\n\n // Megre geometries\n let groupGeometry = new THREE.Geometry();\n groupGeometry.merge(centerGeometry);\n groupGeometry.merge(c1Geometry);\n groupGeometry.merge(c1CloneGeometry);\n groupGeometry.merge(cHGeometry);\n groupGeometry.merge(cHCloneGeometry);\n groupGeometry.merge(c2Geometry);\n groupGeometry.merge(c2CloneGeometry);\n groupGeometry.merge(cFGeometry);\n groupGeometry.merge(cFCloneGeometry);\n\n // Create and return mesh\n let mesh = new THREE.Mesh(groupGeometry, material);\n\n // LEADS\n let tubularSegments = 5;\n let centerLeadLength = d*3 - 1;\n\n // Center Lead\n let centerLeadPath = new THREE.LineCurve3(\n new THREE.Vector3(0, -centerLeadLength/2, 0),\n new THREE.Vector3(0, centerLeadLength/2, 0)\n );\n let centerLeadGeometry = new THREE.TubeGeometry(centerLeadPath, tubularSegments, 0.2, 8, false);\n\n // Corner Leads\n let cornerLeadPath = new THREE.QuadraticBezierCurve3(\n new THREE.Vector3( 0, 0, 0 ),\n new THREE.Vector3( 0, 0.5, 0 ),\n new THREE.Vector3( 0, 0.5, 0.5 )\n ); \n\n let rightCornerLeadGeometry = new THREE.TubeGeometry(cornerLeadPath, tubularSegments, 0.2, 8, false);\n rightCornerLeadGeometry.translate(0,centerLeadLength/2,0);\n let leftCornerLeadGeometry = rightCornerLeadGeometry.clone();\n leftCornerLeadGeometry.rotateZ(Math.PI);\n\n // Board Lead\n let boardLeadPath = new THREE.LineCurve3(\n new THREE.Vector3(0, centerLeadLength/2 + 0.5, 0.5),\n new THREE.Vector3(0, centerLeadLength/2 + 0.5, 4)\n );\n let rightBoardLeadGeometry = new THREE.TubeGeometry(boardLeadPath, tubularSegments, 0.2, 8, false);\n let leftBoardLeadGeometry = rightBoardLeadGeometry.clone();\n leftBoardLeadGeometry.rotateZ(Math.PI);\n\n let leadGroupGeometry = new THREE.Geometry();\n leadGroupGeometry.merge(centerLeadGeometry);\n leadGroupGeometry.merge(leftCornerLeadGeometry);\n leadGroupGeometry.merge(rightCornerLeadGeometry);\n leadGroupGeometry.merge(leftBoardLeadGeometry);\n leadGroupGeometry.merge(rightBoardLeadGeometry);\n\n let leadMesh = new THREE.Mesh(leadGroupGeometry, leadMaterial); \n\n let group = new THREE.Group();\n group.add(mesh);\n group.add(leadMesh);\n\n let pivotPoint = new THREE.Mesh(\n new THREE.SphereGeometry(0.1, 5, 5),\n leadMaterial\n );\n pivotPoint.position.set(0, -centerLeadLength/2 - 0.5, 0);\n pivotPoint.Name = \"Pivot Point\";\n group.add(pivotPoint);\n\n return group;\n}", "function setup() {\r\n\r\n const tree = createTree(treeSize);\r\n const dimension = Math.pow(PI, PI) * Math.pow(PI, PI);\r\n\r\n createCanvas(dimension, dimension - (dimension / PI));\r\n strokeWeight(HALF_PI);\r\n stroke(0, TWO_PI);\r\n noFill();\r\n\r\n var start;\r\n\r\n if (fullMode === true) { start = createVector(width / PI + Math.pow(PI, PI) + Math.pow(PI, PI), height / 2); }\r\n else { start = createVector(width / 2 + Math.pow(PI, PI) * PI, height - Math.pow(PI, PI) * 1.61803398875); }\r\n\r\n for (var i=0; i<tree.length; i++) {\r\n\r\n var v = start.copy();\r\n var z = createVector(0, -PI - PI / 1.61803398875);\r\n\r\n beginShape();\r\n vertex(v.x, v.y);\r\n\r\n for (var j=0; j<tree[i].length; j++) {\r\n\r\n if (tree[i][j] %2 === 0) { z.rotate(angle); }\r\n else { z.rotate(-angle); }\r\n\r\n v.add(z);\r\n vertex(v.x, v.y);\r\n\r\n }\r\n\r\n endShape();\r\n\r\n }\r\n\r\n}", "draw() {\n if (!this.validate()) {\n console.log('ERROR: Before .draw() you need to call .enable()');\n }\n if (this.box_num == 1) {\n gl.drawArrays(this.draw_method, 0, this.vertex_count);\n return;\n }\n var v_count = 0;\n var temp;\n var geom;\n for (var i = 0; i < g_scene.geometries.size; i++) {\n temp = glMatrix.mat4.clone(this._mvp_matrix);\n geom = g_scene.geometries.get(i);\n // Perform transformations\n for (var j = 0; j < geom.transformations.length; j++) {\n switch (geom.transformations[j].type) {\n case TRANSFORMATIONS.TRANSLATE:\n glMatrix.mat4.translate(this._mvp_matrix, this._mvp_matrix, geom.transformations[j].vector);\n break;\n case TRANSFORMATIONS.ROTATE:\n glMatrix.mat4.rotate(this._mvp_matrix, this._mvp_matrix, geom.transformations[j].rad, geom.transformations[j].vector);\n break;\n case TRANSFORMATIONS.SCALE:\n glMatrix.mat4.scale(this._mvp_matrix, this._mvp_matrix, geom.transformations[j].vector);\n break;\n default:\n break;\n }\n }\n // Update vbo\n gl.uniformMatrix4fv(this.u_mvp_matrix_loc, false, this._mvp_matrix);\n // draw the appropriate shape\n switch (geom.type) {\n case GEOMETRIES.GRID:\n gl.drawArrays(this.draw_method, this.grid_vertex_offset, this.grid_vertex_count);\n break;\n case GEOMETRIES.DISC:\n gl.drawArrays(this.draw_method, this.disc_vertex_offset, this.disc_vertex_count);\n break;\n case GEOMETRIES.SPHERE:\n default:\n gl.drawArrays(this.draw_method, this.sphere_vertex_offset, this.sphere_vertex_count);\n break;\n }\n // Reset transformations\n glMatrix.mat4.copy(this._mvp_matrix, temp);\n }\n }", "render() {\n fill(this.layerColor)\n noStroke()\n push()\n translate(width / 2, height / 2)\n if (this.randomShape < 0.33) {\n rotate(45)\n rect(0, 0, this.shapeSize * 2, this.shapeSize * 2)\n } else if (this.randomShape < 0.66) {\n ellipse(0, 0, this.shapeSize * 2, this.shapeSize * 2)\n } else {\n rotate(this.angle / 2)\n hexagon(0, 0, this.shapeSize)\n }\n pop()\n }", "createTreeVisualizer(obj) {\n const geom = new THREE.Geometry();\n function traverse(o) {\n const p0 = o.getWorldPosition(new THREE.Vector3());\n o.children.forEach(c => {\n if (c.type === \"Bone\" && o.type === \"Bone\") {\n const p1 = c.getWorldPosition(new THREE.Vector3());\n geom.vertices.push(p0);\n geom.vertices.push(p1);\n }\n traverse(c);\n });\n }\n traverse(obj);\n const mat = new THREE.LineBasicMaterial({ color: \"red\" });\n mat.depthTest = false;\n return new THREE.LineSegments(geom, mat);\n }", "function drawTrees()\n{\n for(var i =0; i < treePos_x.length; i++)\n {\n \n noStroke();\n\tfill(180, 100, 50);\n\trect(treePos_x[i], treePos_y, 35, 70);\n\tfill(20, 130, 20);\n\ttriangle(treePos_x[i] - 50, treePos_y + 10, treePos_x[i] + 20, treePos_y - 100, treePos_x[i] + 90, treePos_y + 10);\n\tfill(20, 150, 20);\n\ttriangle(treePos_x[i] - 50, treePos_y - 30, treePos_x[i] + 20, treePos_y - 140, treePos_x[i] + 90, treePos_y - 30);\n\tfill(30, 170, 50);\n\ttriangle(treePos_x[i] - 50, treePos_y - 60, treePos_x[i] + 20, treePos_y - 180, treePos_x[i] + 90, treePos_y - 60);\n } \n}", "function fuelTankGraphic (selector, stageNo) {\n var scene = new THREE.Scene();\n var width = $window.innerWidth * 1/2 * 1/3;\n var height = $window.innerHeight * .44;\n \n var camera = new THREE.PerspectiveCamera( 75, width/height, 0.1, 1000 );\n var renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });\n renderer.setClearColor( 0xffffff, 0);\n renderer.setSize( width, height);\n $(selector).append(renderer.domElement);\n\n camera.position.set(0, 0, 67);\n\n //Orbit Controls\n var orbit = new THREE.OrbitControls(camera, renderer.domElement);\n\n //Lighting\n var light = new THREE.AmbientLight( 0x404040 ); // soft white light\n scene.add( light );\n\n var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );\n directionalLight.position.set( -2, 2, 0 );\n scene.add( directionalLight );\n\n var tankGeometry = new THREE.CylinderGeometry( 25, 25, 40, 30, 30 );\n var tankMaterial = new THREE.MeshPhongMaterial({\n color: 0x65696b,\n emissive: 0x2d2828,\n specular: 0x7f7373,\n wireframe: false,\n transparent: true,\n opacity: .5\n });\n var tank = new THREE.Mesh( tankGeometry, tankMaterial );\n scene.add( tank );\n\n //Tank top/bottom\n var tankCapGeometry = new THREE.SphereGeometry(27,30, 30, 0, 2*Math.PI, 0, 1.2);\n var tankTop = new THREE.Mesh(tankCapGeometry, tankMaterial)\n scene.add(tankTop);\n tankTop.position.y = 10;\n\n var tankBottom = new THREE.Mesh(tankCapGeometry, tankMaterial)\n scene.add(tankBottom);\n tankBottom.position.y = -10;\n tankBottom.rotation.z = -Math.PI;\n\n var fuelSpecs = {\n radius: 24,\n height: 40,\n radialSegments: 30,\n heightSegments: 30\n }\n\n var fuelGeometry = new THREE.CylinderGeometry(fuelSpecs.radius, fuelSpecs.radius, fuelSpecs.height, fuelSpecs.radialSegments, fuelSpecs.heightSegments);\n var fuelMaterial = new THREE.MeshPhongMaterial({\n color: 0x117cb1,\n emissive: 0x0b1b91,\n specular: 0x1e1a1a\n });\n var fuel = new THREE.Mesh(fuelGeometry, fuelMaterial);\n scene.add(fuel);\n\n var fuelCapGeometry = new THREE.SphereGeometry(25,30, 30, 0, 2*Math.PI, 0, 1.3);\n var fuelBottom = new THREE.Mesh(fuelCapGeometry, fuelMaterial);\n scene.add(fuelBottom);\n fuelBottom.position.y = -11;\n fuelBottom.rotation.z = Math.PI;\n\n //Rendering & animation loop\n var s1LOXMax = 150000;\n var s1RP1Max = 95000;\n var s2LOXMax = 28000;\n var s2RP1Max = 17000;\n\n var vec = new THREE.Vector3( 0, 0, 0 );\n\n var render = function (actions) {\n camera.lookAt(vec)\n renderer.render(scene, camera);\n requestAnimationFrame( render );\n };\n render();\n }", "function cylinder(radius, height) { \n this.radius = radius;\n this.height = height;\n}", "split() {\n // bottom four octants\n // -x-y-z\n this.nodes[0] = new Octree(this.bounds.x, this.bounds.y, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x-y-z\n this.nodes[1] = new Octree(this.bounds.frontX, this.bounds.y, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // -x+y-z\n this.nodes[2] = new Octree(this.bounds.x, this.bounds.frontY, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x+y-z\n this.nodes[3] = new Octree(this.bounds.frontX, this.bounds.frontY, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n\n // top four octants\n // -x-y+z\n this.nodes[4] = new Octree(this.bounds.x, this.bounds.y, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x-y+z\n this.nodes[5] = new Octree(this.bounds.frontX, this.bounds.y, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // -x+y+z\n this.nodes[6] = new Octree(this.bounds.x, this.bounds.frontY, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x+y+z\n this.nodes[7] = new Octree(this.bounds.frontX, this.bounds.frontY, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n }", "function drawMesh() {\n ctx.beginPath();\n for (let yl = 1; yl < col; yl++) {\n ctx.moveTo(cellSize * yl , 0);\n ctx.lineTo(cellSize * yl , height);\n }\n for (let xl = 1; xl < row; xl++) {\n ctx.moveTo(0 , cellSize * xl);\n ctx.lineTo(width , cellSize * xl);\n }\n ctx.lineWidth = 1;\n ctx.strokeStyle='#888';\n ctx.stroke();\n}", "constructor(scene) {\n this.scene = scene;\n\n let geo = new T.SphereBufferGeometry(.5, 30, 30);\n let mat = new T.MeshStandardMaterial({color: \"blue\"});\n \n // let botLeft = [];\n // for (let i = 0; i < 10; i++) {\n // let mesh = new T.Mesh(geo,mat);\n // scene.add(mesh);\n // }\n //split objects into 4 quadrants\n\n // build ground\n let groundGeo = new T.PlaneBufferGeometry(30,30);\n let groundMat = new T.MeshStandardMaterial( {color: \"red\"});\n this.ground = new T.Mesh(groundGeo, groundMat);\n this.ground.receiveShadow = true;\n this.ground.rotateX(2*Math.PI - Math.PI / 2);\n scene.add(this.ground);\n this.worldSize = 15;\n\n // build objects\n this.objects = [];\n let mesh1 = new T.Mesh(geo, mat);\n mesh1.position.x = -10;\n mesh1.position.y = .5;\n mesh1.position.z = -10;\n this.objects.push(mesh1);\n\n let mesh2 = new T.Mesh(geo, mat);\n mesh2.position.x = -5;\n mesh2.position.y = .5;\n mesh2.position.z = 8;\n this.objects.push(mesh2);\n\n let mesh3 = new T.Mesh(geo, mat);\n mesh3.position.x = -8;\n mesh3.position.y = .5;\n mesh3.position.z = -8;\n this.objects.push(mesh3);\n\n let mesh4 = new T.Mesh(geo, mat);\n mesh4.position.x = -12;\n mesh4.position.y = .5;\n mesh4.position.z = -5;\n this.objects.push(mesh4);\n\n let defGeo = new T.ConeBufferGeometry(1,1,50);\n let defMat = new T.MeshStandardMaterial({color: \"yellow\"});\n\n this.defenders = [];\n this.def2 = new T.Mesh(defGeo, defMat); // the following defender\n this.def2.position.x = 0;\n this.def2.position.z = -15;\n this.def2.position.y = .5;\n //this.scene.add(this.def2);\n this.defenders.push(this.def2);\n\n for (let i = 0; i < this.defenders.length; i++) {\n this.scene.add(this.defenders[i]);\n }\n\n for (let i = 0; i < this.objects.length; i++) {\n this.scene.add(this.objects[i]);\n }\n }", "function CuboidGeometry(engine, width, height, depth) {\n var _this;\n\n if (width === void 0) {\n width = 1;\n }\n\n if (height === void 0) {\n height = 1;\n }\n\n if (depth === void 0) {\n depth = 1;\n }\n\n _this = _ShapeGeometry.call(this, engine) || this;\n var halfWidth = width / 2;\n var halfHeight = height / 2;\n var halfDepth = depth / 2; // prettier-ignore\n\n var vertices = new Float32Array([// up\n -halfWidth, halfHeight, -halfDepth, 0, 1, 0, 0, 0, halfWidth, halfHeight, -halfDepth, 0, 1, 0, 1, 0, halfWidth, halfHeight, halfDepth, 0, 1, 0, 1, 1, -halfWidth, halfHeight, halfDepth, 0, 1, 0, 0, 1, // down\n -halfWidth, -halfHeight, -halfDepth, 0, -1, 0, 0, 1, halfWidth, -halfHeight, -halfDepth, 0, -1, 0, 1, 1, halfWidth, -halfHeight, halfDepth, 0, -1, 0, 1, 0, -halfWidth, -halfHeight, halfDepth, 0, -1, 0, 0, 0, // left\n -halfWidth, halfHeight, -halfDepth, -1, 0, 0, 0, 0, -halfWidth, halfHeight, halfDepth, -1, 0, 0, 1, 0, -halfWidth, -halfHeight, halfDepth, -1, 0, 0, 1, 1, -halfWidth, -halfHeight, -halfDepth, -1, 0, 0, 0, 1, // right\n halfWidth, halfHeight, -halfDepth, 1, 0, 0, 1, 0, halfWidth, halfHeight, halfDepth, 1, 0, 0, 0, 0, halfWidth, -halfHeight, halfDepth, 1, 0, 0, 0, 1, halfWidth, -halfHeight, -halfDepth, 1, 0, 0, 1, 1, // fornt\n -halfWidth, halfHeight, halfDepth, 0, 0, 1, 0, 0, halfWidth, halfHeight, halfDepth, 0, 0, 1, 1, 0, halfWidth, -halfHeight, halfDepth, 0, 0, 1, 1, 1, -halfWidth, -halfHeight, halfDepth, 0, 0, 1, 0, 1, // back\n -halfWidth, halfHeight, -halfDepth, 0, 0, -1, 1, 0, halfWidth, halfHeight, -halfDepth, 0, 0, -1, 0, 0, halfWidth, -halfHeight, -halfDepth, 0, 0, -1, 0, 1, -halfWidth, -halfHeight, -halfDepth, 0, 0, -1, 1, 1]); // prettier-ignore\n\n var indices = new Uint16Array([// up\n 0, 2, 1, 2, 0, 3, // donw\n 4, 6, 7, 6, 4, 5, // left\n 8, 10, 9, 10, 8, 11, // right\n 12, 14, 15, 14, 12, 13, // fornt\n 16, 18, 17, 18, 16, 19, // back\n 20, 22, 23, 22, 20, 21]);\n\n _this._initialize(engine, vertices, indices);\n\n return _this;\n }", "function drawTree(dataStructure, level) {\n var daDisegnare = true;\n var numChild = dataStructure.children.length;\n\n for (let i = 0; i < numChild; i++) {\n drawTree(dataStructure.children[i], level + 1);\n }\n\n if (numChild == 0) { //base case\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n if (level > 0 && arraySpazioLivelli[level - 2] > arraySpazioLivelli[level - 1]) {\n arraySpazioLivelli[level - 1] = arraySpazioLivelli[level - 2];\n }\n drawNode(dataStructure, arraySpazioLivelli[level - 1], level * levelLength);\n arraySpazioLivelli[level - 1] += spazioNodo + brotherDistance;\n for (let i = level - 1; i < arraySpazioLivelli.length; i++) {\n if (arraySpazioLivelli[i] < (arraySpazioLivelli[level - 1])) {\n arraySpazioLivelli[i] = (arraySpazioLivelli[level - 1]);\n }\n }\n daDisegnare = false;\n }\n\n for (let i = 0; i < dataStructure.children.length; i++) {\n if (dataStructure.children[i].disegnato == false) {\n daDisegnare = false;\n }\n }\n\n if (daDisegnare == true) {\n if (dataStructure.children.length == 1) {\n if (dataStructure.children[0].children.length == 0) {\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n drawNode(dataStructure, dataStructure.children[0].x, level * levelLength);\n arraySpazioLivelli[level - 1] = dataStructure.children[0].x + spazioNodo + brotherDistance;\n } else {\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n var spazioNodoFiglio = dataStructure.children[0].name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n drawNode(dataStructure, arraySpazioLivelli[level - 1], level * levelLength);\n arraySpazioLivelli[level - 1] += spazioNodo + brotherDistance;\n }\n } else {\n var XprimoFiglio = dataStructure.children[0].x;\n var XultimoFiglio = dataStructure.children[dataStructure.children.length - 1].x;\n var spazioNodo = dataStructure.name.length * (4.3 + (parseFloat(dataStructure.value) * 10))\n drawNode(dataStructure, arraySpazioLivelli[level - 1], level * levelLength);\n arraySpazioLivelli[level - 1] += spazioNodo + brotherDistance;\n }\n }\n}", "initializeCylinder(){\n if (this.args_array.length == 6){\n this.primitive = new MyCylinder(this.scene, this.args_array[1], this.args_array[2], this.args_array[3], \n this.args_array[4], this.args_array[5]);\n }\n else console.log(\"Invalid number of arguments for a Cylinder\");\n }", "makeRocketCylinder(height, center){\n\n // Group to hold all rocket cylinder parts from this call\n let rocketGroup = new Group();\n\n var texture = new THREE.TextureLoader().load(logo1);\n\n let geometry = new CylinderGeometry(.55, .55, height, 40);\n let material;\n if(center) {\n material = new MeshPhongMaterial({color: 0xffffff, map: texture, shininess: 10});\n } else { //d9dbe0\n material = new MeshPhongMaterial({color: 0xbdbfc1, shininess: 10});\n }\n let rocketCylinder = new Mesh(geometry, material);\n\n rocketCylinder.rotateX(-Math.PI / 2);\n rocketCylinder.rotateY(Math.PI + .1);\n rocketCylinder.translateY(height / 2);\n rocketCylinder.castShadow = true;\n\n // Create 4 fins for bottom of cylinder\n let geometry1 = new CylinderGeometry(.01, .2, 6, 30);\n let material1 = new MeshPhongMaterial({color: 0x3f4042, shininess: 0});\n let fin1 = new Mesh(geometry1, material1);\n\n let geometry2 = new CylinderGeometry(.01, .2, 6, 30);\n let material2 = new MeshPhongMaterial({color: 0x3f4042, shininess: 0});\n let fin2 = new Mesh(geometry2, material2);\n\n let geometry3 = new CylinderGeometry(.01, .2, 6, 30);\n let material3 = new MeshPhongMaterial({color: 0x3f4042, shininess: 0});\n let fin3 = new Mesh(geometry3, material3);\n\n let geometry4 = new CylinderGeometry(.01, .2, 6, 30);\n let material4 = new MeshPhongMaterial({color: 0x3f4042, shininess: 0});\n let fin4 = new Mesh(geometry4, material4);\n\n // Position fins\n fin1.translateX(-.46);\n fin1.translateZ(-3.1);\n fin1.rotateX(-Math.PI / 2);\n\n fin2.translateY(.46);\n fin2.translateZ(-3.1);\n fin2.rotateX(-Math.PI / 2);\n\n fin3.translateX(.46);\n fin3.translateZ(-3.1);\n fin3.rotateX(-Math.PI / 2);\n\n fin4.translateY(-.46);\n fin4.translateZ(-3.1);\n fin4.rotateX(-Math.PI / 2);\n\n rocketGroup.add(rocketCylinder, fin1, fin2, fin3, fin4);\n\n return rocketGroup;\n }", "createTree(treeData) {\n\n // ******* TODO: PART VI *******\n\n\n //Create a tree and give it a size() of 800 by 300. \n\n\n //Create a root for the tree using d3.stratify(); \n\n \n //Add nodes and links to the tree. \n }", "function makeCylinder (radialdivision,heightdivision){\n // fill in your code here.\n\tvar triangles = [];\n\tvar circ_triangles = []; // Contains triangles from the top and bottom\n\tvar side_triangles = []; // Contains triagnles from the side and \n\n\tvar Bottom_Center = [0, -0.5, 0];\n\tvar Top_Center = [0, 0.5, 0];\n\t\n\tconst radius = 0.5;\n\n\t\n\tvar alpha_deg = 0.0;\n\tvar step = 360 / radialdivision;\n\tvar vertical_step = 1 / heightdivision;\n\n\t// Generate top and bottom triangles\n\tfor(var i=0; i<radialdivision; i++){\n\n\n\t\tvar b0 = [radius * Math.cos(radians(alpha_deg)), -0.5, radius * Math.sin(radians(alpha_deg))];\n\t\tvar t0 = [radius * Math.cos(radians(alpha_deg)), 0.5, radius * Math.sin(radians(alpha_deg))];\n\t\talpha_deg += step;\n\t\tvar b1 = [radius * Math.cos(radians(alpha_deg)), -0.5, radius * Math.sin(radians(alpha_deg))];\n\t\tvar t1 = [radius * Math.cos(radians(alpha_deg)), 0.5, radius * Math.sin(radians(alpha_deg))];\n\n\t\tcirc_triangles.push([Bottom_Center, b0, b1]);\n\t\tcirc_triangles.push([Top_Center, t1, t0]);\n\n\t\t// side_triangles.push([t0, b0, t1]);\n\t\t// side_triangles.push([t1, b0, b1]);\n\n\t\tvar height_mark = -0.5;\n\n\t\tfor(var j=0; j<heightdivision; j++){\n\t\t\tvar m0 = [b0[0], height_mark, b0[2]];\n\t\t\tvar m1 = [b1[0], height_mark, b1[2]];\n\t\t\theight_mark += vertical_step;\n\t\t\tvar m2 = [b0[0], height_mark, b0[2]];\n\t\t\tvar m3 = [b1[0], height_mark, b1[2]];\n\n\t\t\tside_triangles.push([m3, m1, m0]);\n\t\t\tside_triangles.push([m2, m3, m0]);\n\t\t}\n\t}\n\n\t// For Debug\n\t// console.log(radialdivision, \" + \", circ_triangles.length);\n\t// for(d of circ_triangles){\n\t// \tconsole.log(d);\n\t// }\n\n\ttriangles = circ_triangles.concat(side_triangles);\n\n\t// add triangles to finish the make process\n\tfor (tri of triangles){\n\t\taddTriangle(\n\t\t\ttri[0][0], tri[0][1], tri[0][2],\n\t\t\ttri[1][0], tri[1][1], tri[1][2],\n\t\t\ttri[2][0], tri[2][1], tri[2][2]\n\t\t\t);\n\t}\n\t\n}", "function drawTree(options) {\n var json = options[0],\n selector = options[1];\n\n if (typeof selector === \"undefined\") {\n selector = \"body\";\n }\n\n if (typeof json === \"undefined\") {\n throw(new Error(\"drawTree(), no json provided\"));\n }\n\n var diameter = 800;\n\n var tree = d3.layout.tree()\n .size([180, diameter / 4 ])\n .separation(function(a, b) { return (a.parent === b.parent ? 1 : 2) / a.depth; });\n\n var diagonal = d3.svg.diagonal.radial()\n .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });\n\n var svg = d3.select(selector).append(\"svg\")\n .attr(\"width\", diameter / 2)\n .attr(\"height\", diameter)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + 50 + \",\" + diameter / 8 * 3 + \")\");\n\n\n d3.json(json, function(error, root) {\n var nodes = tree.nodes(root),\n links = tree.links(nodes);\n\n var link = svg.selectAll(\".link\")\n .data(links)\n .enter().append(\"path\")\n .attr(\"class\", function (d) { return \"depth-\" + d.source.depth + \" link\"; })\n .attr(\"d\", diagonal);\n\n var node = svg.selectAll(\".node\")\n .data(nodes)\n .enter().append(\"g\")\n .attr(\"class\", function (d) { return \"depth-\" + d.depth + \" node\"; })\n .attr(\"id\", function (d) { return d.name; })\n .attr(\"transform\", function(d) { return \"rotate(\" + (d.x - 90) + \")translate(\" + d.y + \")\"; });\n\n\n node.append(\"circle\")\n .attr(\"r\", 4.5);\n\n node.append(\"text\")\n .attr(\"text-anchor\", function(d) { return d.x < 180 ? \"start\" : \"end\"; })\n .attr(\"transform\", function(d) { return d.x < 180 ? \"translate(8)\" : \"rotate(180)translate(-8)\"; })\n .text(function(d) { return d.name; });\n });\n\n d3.select(self.frameElement).style(\"height\", diameter - 150 + \"px\");\n\n}", "function createCylinder(radiusTop, radiusBottom, height, radialSegments, color,\n x, y, z) {\n var geom = new THREE.CylinderGeometry(radiusTop, radiusBottom, height, radialSegments);\n var mat = new THREE.MeshPhongMaterial({color:color, flatShading: true});\n var cylinder = new THREE.Mesh(geom, mat);\n cylinder.castShadow = true;\n cylinder.receiveShadow = true;\n cylinder.position.set( x, y, z );\n return cylinder;\n}", "render () {\n let data = this.getData();\n this._tree = this._createTree(data);\n this._toolTip = this._createToolTip();\n this._updateTree(this.getRoot());\n }", "update() {\n this.state = 0\n this.x += this.vx\n this.y += this.vy\n if ((this.x < quadtree.x)||(this.x > quadtree.width)||(this.y < quadtree.y)||(this.y > quadtree.height)) { this.destroy() }\n }", "function drawSphere() {\n setMV();\n Sphere.draw();\n}", "function drawSphere() {\n setMV();\n Sphere.draw();\n}", "function drawAllCylinders(gl,canvas,a_Position){\r\n // draw all finished cylinder \r\n for (var i =0 ; i < oldlines.length ; i++){ \r\n previousFace = []\r\n let tempNormalholder = []\r\n if (oldlines[i].length >= 4){\r\n var loop = (((oldlines[i].length/2)-1)*2)\r\n for (var j =0; j < loop;j+=2){ \r\n drawcylinder(gl,canvas,a_Position,radius,sides,oldlines[i][j],oldlines[i][j+1],oldlines[i][j+2],oldlines[i][j+3])\r\n }\r\n }\r\n } \r\n}", "function render(){var createNodes=require(\"./create-nodes\"),createClusters=require(\"./create-clusters\"),createEdgeLabels=require(\"./create-edge-labels\"),createEdgePaths=require(\"./create-edge-paths\"),positionNodes=require(\"./position-nodes\"),positionEdgeLabels=require(\"./position-edge-labels\"),positionClusters=require(\"./position-clusters\"),shapes=require(\"./shapes\"),arrows=require(\"./arrows\");var fn=function(svg,g){preProcessGraph(g);svg.selectAll(\"*\").remove();var outputGroup=createOrSelectGroup(svg,\"output\"),clustersGroup=createOrSelectGroup(outputGroup,\"clusters\"),edgePathsGroup=createOrSelectGroup(outputGroup,\"edgePaths\"),edgeLabels=createEdgeLabels(createOrSelectGroup(outputGroup,\"edgeLabels\"),g),nodes=createNodes(createOrSelectGroup(outputGroup,\"nodes\"),g,shapes);layout(g);positionNodes(nodes,g);positionEdgeLabels(edgeLabels,g);createEdgePaths(edgePathsGroup,g,arrows);var clusters=createClusters(clustersGroup,g);positionClusters(clusters,g);postProcessGraph(g)};fn.createNodes=function(value){if(!arguments.length)return createNodes;createNodes=value;return fn};fn.createClusters=function(value){if(!arguments.length)return createClusters;createClusters=value;return fn};fn.createEdgeLabels=function(value){if(!arguments.length)return createEdgeLabels;createEdgeLabels=value;return fn};fn.createEdgePaths=function(value){if(!arguments.length)return createEdgePaths;createEdgePaths=value;return fn};fn.shapes=function(value){if(!arguments.length)return shapes;shapes=value;return fn};fn.arrows=function(value){if(!arguments.length)return arrows;arrows=value;return fn};return fn}", "function drawAllCylinders(gl,canvas,a_Position){\r\n // draw all finished cylinder \r\n for (var i =0 ; i < oldlines.length ; i++){ \r\n previousFace = []\r\n let tempNormalholder = []\r\n if (oldlines[i].length >= 4){\r\n var loop = (((oldlines[i].length/2)-1)*2)\r\n for (var j =0; j < loop;j+=2){ \r\n drawcylinder(gl,canvas,a_Position,radius,sides,oldlines[i][j],oldlines[i][j+1],oldlines[i][j+2],oldlines[i][j+3],i)\r\n }\r\n }\r\n } \r\n}", "function makeCylinder (radialDivision, heightDivision){\n // fill in your code here.\n var heightDivTransformed = 1 / heightDivision;\n var rads = radians(360);\n var radDivision = rads / radialDivision;\n var start = 0.5;\n var radius = 0.5;\n // makes the base of the cylinder at the top \n baseMaker(radDivision, rads, 0.5, true);\n for (var yCoor = -start; yCoor <= start - (heightDivTransformed / 2); yCoor += heightDivTransformed) {\n for (var unit = 0; unit <= rads; unit += radDivision) {\n addTriangle(radius * Math.cos(unit + radDivision), yCoor, radius * Math.sin(unit + radDivision),\n radius * Math.cos(unit), yCoor, radius * Math.sin(unit),\n radius * Math.cos(unit), yCoor + heightDivTransformed, radius * Math.sin(unit));\n addTriangle(radius * Math.cos(unit + radDivision), yCoor, radius * Math.sin(unit + radDivision),\n radius * Math.cos(unit), yCoor + heightDivTransformed, radius * Math.sin(unit),\n radius * Math.cos(unit + radDivision), yCoor + heightDivTransformed, radius * Math.sin(unit + radDivision));\n }\n }\n}", "function Tree(density, startPosX, startPosY, charWidth, char, wordSize) {\n this.leaves = [];\n this.branches = [];\n\n // BOUNDARY CHECK using a background layer\n let tempCanvas = createGraphics(width, height);\n tempCanvas.fill(100);\n tempCanvas.textFont(myFont);\n tempCanvas.textSize(wordSize);\n tempCanvas.text(char, startPosX, startPosY);\n\n // MAKE LEAVES\n\n for (var i = 0; i < density; i++) {\n let tempPos = createVector(random(startPosX, startPosX + charWidth), random(startPosY, startPosY - charWidth * 1.25));\n // check if tempPos is within B/W bounds\n let sampleColor = tempCanvas.get(tempPos.x, tempPos.y);\n\n if (sampleColor[0] == 100) {\n this.leaves.push(new Leaf(tempPos.x, tempPos.y));\n } else {\n density += 1;\n }\n }\n // console.log('density Count is ' + density)\n\n // MAKE ROOT\n let rootNum = startRootNum; // could change later\n let rootPos = [];\n for (let i = 0; i < rootNum; i++) {\n\n // making sure sketch doesn't crash!\n if (i > 100) {\n console.log(\"Something is wrong, can't find a place to place roots!\")\n break;\n }\n\n // making a 'root' start from inside the letter\n let tempPos = createVector(random(startPosX, startPosX + charWidth), random(startPosY, startPosY - charWidth));\n\n // check if tempPos is within B/W bounds\n let sampleColor = tempCanvas.get(tempPos.x, tempPos.y);\n\n // Resample root pos if tempPos is not within bounds\n if (sampleColor[0] == 100) {\n rootPos.push(tempPos);\n } else {\n rootNum += 1;\n }\n\n }\n\n\n let roots = [];\n var dir = createVector(0, -1);\n for (let i = 0; i < rootPos.length; i++) {\n let root = new Branch(null, rootPos[i], dir)\n this.branches.push(root);\n var current = root;\n var found = false;\n let failCount = 0;\n while (!found) {\n\n for (let i = 0; i < this.leaves.length; i++) {\n var d = p5.Vector.dist(current.pos, this.leaves[i].pos);\n\n if (d < max_dist) {\n found = true;\n }\n }\n if (!found) {\n // failCount += 1;\n console.log(\"failcount is \" + failCount);\n\n // if I delete it it still works, what's this doing??\n\n var branch = current.next();\n current = branch;\n this.branches.push(current);\n // if (failCount > 10) {\n // console.log(\"failcount is \" + failCount);\n // break;\n // }\n }\n\n }\n }\n\n this.grow = function() {\n for (var i = 0; i < this.leaves.length; i++) {\n var leaf = this.leaves[i];\n var closestBranch = null;\n var record = max_dist;\n\n for (var j = 0; j < this.branches.length; j++) {\n var branch = this.branches[j];\n var d = p5.Vector.dist(leaf.pos, branch.pos);\n if (d < min_dist) {\n leaf.reached = true;\n closestBranch = null;\n break;\n } else if (d < record) {\n closestBranch = branch;\n record = d;\n }\n }\n\n if (closestBranch != null) {\n var newDir = p5.Vector.sub(leaf.pos, closestBranch.pos);\n newDir.normalize();\n closestBranch.dir.add(newDir);\n closestBranch.count++;\n }\n }\n\n for (var i = this.leaves.length - 1; i >= 0; i--) {\n if (this.leaves[i].reached) {\n this.leaves.splice(i, 1);\n }\n }\n\n for (var i = this.branches.length - 1; i >= 0; i--) {\n var branch = this.branches[i];\n if (branch.count > 0) {\n branch.dir.div(branch.count + 1);\n this.branches.push(branch.next());\n branch.reset();\n }\n }\n }\n\n\n\n\n\n this.show = function(debugView) {\n\n if (debugView) {\n // DEBUGGING VIEW FOR LETTERS!\n image(tempCanvas, 0, 0);\n\n // root start points are RED\n tempCanvas.noStroke();\n tempCanvas.fill(255, 0, 0);\n for (let i = 0; i < rootPos.length; i++) {\n tempCanvas.ellipse(rootPos[i].x, rootPos[i].y, 10);\n }\n\n // shows unreached leaves in GREEN\n for (var i = 0; i < this.leaves.length; i++) {\n this.leaves[i].showDebug();\n }\n }\n\n for (var i = 0; i < this.branches.length; i++) {\n this.branches[i].show();\n }\n\n }\n\n}", "render() {\n\n stroke(this.layerColor)\n strokeWeight(this.randomWeight)\n noFill()\n push()\n translate(width / 2, height / 2)\n for (let i = 0; i <= this.numShapes; i++) {\n ellipse(this.position, 0, this.shapeSize, this.shapeSize)\n rotate(this.angle)\n }\n pop()\n\n }", "function QuadTree(x, y, length, level) //Assume square quadtree and square canvases\n{\n\tthis.x=x;\n\tthis.y=y;\n\tthis.length=length;\n\n\tthis.level = level;\n\tthis.nodes = [null,null,null,null];\n\n\tthis.objects = [];\n}", "update() {\n\n\t\tconst depth = (this.octree !== null) ? this.octree.getDepth() : -1;\n\n\t\tlet level = 0;\n\t\tlet result;\n\n\t\t// Remove existing geometry.\n\t\tthis.dispose();\n\n\t\twhile(level <= depth) {\n\n\t\t\tresult = this.octree.findNodesByLevel(level);\n\n\t\t\tthis.createLineSegments(\n\t\t\t\tresult[Symbol.iterator](),\n\t\t\t\t(typeof result.size === \"number\") ? result.size : result.length\n\t\t\t);\n\n\t\t\t++level;\n\n\t\t}\n\n\t}", "function drawIt(H) { \t\t\n\t\n\t// for cylinder we need to redraw the entire canvas (it extends under drawn x axis)\n\tdrawInit();\n\t\t\t\n\t// if we clear only the rectangle containing the chart (without title , legends, labels)\n\t// clear the drawn area (if drawInit is called in drawChart)\n\t//\tc.fillStyle = background; \n\t//\tc.fillRect(hStep-10,titleSpace+legendSpace,width, realHeight-step-titleSpace-legendSpace-2);\n\t\n\tvar stop = drawData(true, false, \"\");\n\t\n\tdrawGrid();\n\tdrawAxis();\n\t \t\t\t\t\n\treturn stop;\n}", "function drawTrees(x, y, color) {\r\n crc2.fillStyle = \"#61380B\";\r\n crc2.fillRect(x - 5, y + 60, 15, 20);\r\n crc2.beginPath();\r\n crc2.moveTo(x, y);\r\n crc2.lineTo(x + 25, y + 40);\r\n crc2.lineTo(x - 25, y + 40);\r\n crc2.closePath();\r\n crc2.fillStyle = color;\r\n crc2.fill();\r\n crc2.beginPath();\r\n crc2.moveTo(x, y + 10);\r\n crc2.lineTo(x + 25, y + 60);\r\n crc2.lineTo(x - 25, y + 60);\r\n crc2.closePath();\r\n crc2.fillStyle = color;\r\n crc2.fill();\r\n }", "function render()\n {\n if (me.triggerEvent('renderBefore', data) === false)\n return;\n\n // remove all child nodes\n container.html('');\n\n // render child nodes\n for (var i=0; i < data.length; i++) {\n data[i].level = 0;\n render_node(data[i], container);\n }\n\n me.triggerEvent('renderAfter', container);\n }", "draw(){\n var canvas = document.getElementById(\"2d-plane\");\n var context = canvas.getContext(\"2d\");\n context.beginPath();\n context.strokeStyle=\"white\";\n context.rect(this.boundary.x-this.boundary.w,this.boundary.y-this.boundary.h,this.boundary.w*2,this.boundary.h*2); \n context.stroke();\n //Draw recursive the children\n if(this.isDivided){\n this.northeast.draw();\n this.northwest.draw();\n this.southeast.draw();\n this.southwest.draw();\n }\n //Draw Points in Boarder\n for(let i=0;i<this.points.length;i++){\n context.beginPath();\n context.fillStyle=\"red\";\n context.arc(this.points[i].x, this.points[i].y, 2, 0, 2*Math.PI);\n context.fill();\n }\n}", "function main () {\n var thd = -0.7 //top hinges depth\n var shell = difference(cylinder({r1:2.1, h:10,r2:2.7 }),cylinder({r1:1.8,r2:2.2, h: 10}))\n shell = intersection(cube({size: [10,5,10]}).translate([-5,-1,0]), shell)\n shell = difference(shell, cylinder({r: 1, h:10}).translate([-7, -0.8,-5]).rotateY(90))\n shell = difference(shell, cylinder({r: 2, h:10}).translate([-5, -0.8,-5]).rotateY(90))\n shell = difference(shell, cylinder({r: 3, h:10}).translate([-10,3,-5]).rotateY(90))\n\n shell = union(cylinder({r:1, h:1}).translate([-10,thd,-2.7]).rotateY(90), shell)\n shell = union(cylinder({r:1, h:1}).translate([-10,thd,1.7]).rotateY(90), shell)\n return shell;\n}", "calcOctree ()\n\t{\n\t\tif (this.octr) return this.octr;\n\n\t\t// Bounding box is the cube itself\n\t\tvar bBox = new Utils.BoundingBox (this.center, this._edge);\n\t\t// var bBox = Utils.BoundingBox (this.center, this._edge);\n\n\t\t// Only the root node completely filled\n\t\t// no parent, cube bounding box, filled, no kids\n\t\tthis.octr = new Octree.Node(null, bBox, Octree.BLACK, []);\n\t\treturn this.octr;\n\t}", "get shapeTree() {\n let tree = this.childOne(ShapeTree);\n if (!tree) {\n tree = this.createElement(ShapeTree);\n tree && this.appendChild(tree);\n }\n return tree;\n }", "draw() {\n //Draw this box\n if (this.strokeColor != undefined || this.fillColor != undefined) {\n this.ctx.beginPath();\n this.ctx.lineWidth = 2.0;\n this.ctx.rect(this.x, this.y, this.w, this.h);\n if (this.fillColor != undefined) {\n this.ctx.fillStyle = this.fillColor;\n this.ctx.fill()\n }\n if (this.strokeColor != undefined) {\n this.ctx.strokeStyle = this.strokeColor;\n this.ctx.stroke();\n }\n this.ctx.closePath();\n }\n //Recurse through children and draw them\n this.children.forEach(b => b.draw())\n }", "function createDodecahedron(gl, translation, rotationAxis)\n{ \n // Vertex Data\n let vertexBuffer;\n vertexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\n // Names of vertices assigned for better figure construction, after drawing it on Geogebra\n let verts = [\n // Face 1\n 0.5, 1.3, 0.0, // Point M\n 0.8, 0.8, -0.8, // Point B\n 1.3, 0.0, -0.5, // Point S\n 1.3, 0.0, 0.5, // Point Q\n 0.8, 0.8, 0.8, // Point A\n\n // Face 2\n 0.5, 1.3, 0.0, // Point M\n 0.8, 0.8, 0.8, // Point A\n 0.0, 0.5, 1.3, // Point I\n -0.8, 0.8, 0.8, // Point E\n -0.5, 1.3, 0.0, // Point N\n\n // Face 3\n -0.5, 1.3, 0.0, // Point N\n -0.8, 0.8, -0.8, // Point F\n 0.0, 0.5, -1.3, // Point J\n 0.8, 0.8, -0.8, // Point B\n 0.5, 1.3, 0.0, // Point M\n \n // Face 4\n 0.8, 0.8, -0.8, // Point B\n 0.0, 0.5, -1.3, // Point J\n 0.0, -0.5, -1.3, // Point K\n 0.8, -0.8, -0.8, // Point D\n 1.3, 0.0, -0.5, // Point S\n\n // Face 5\n -0.5, 1.3, 0.0, // Point N\n -0.8, 0.8, 0.8, // Point E\n -1.3, 0.0, 0.5, // Point R\n -1.3, 0.0, -0.5, // Point T\n -0.8, 0.8, -0.8, // Point F\n\n // Face 6\n -0.8, 0.8, -0.8, // Point F\n -1.3, 0.0, -0.5, // Point T\n -0.8, -0.8, -0.8, // Point H\n 0.0, -0.5, -1.3, // Point K\n 0.0, 0.5, -1.3, // Point J\n\n // Face 7\n -1.3, 0.0, -0.5, // Point T\n -1.3, 0.0, 0.5, // Point R\n -0.8, -0.8, 0.8, // Point G\n -0.5, -1.3, 0.0, // Point P\n -0.8, -0.8, -0.8, // Point H\n\n // Face 8\n -0.8, 0.8, 0.8, // Point E\n 0.0, 0.5, 1.3, // Point I\n 0.0, -0.5, 1.3, // Point L\n -0.8, -0.8, 0.8, // Point G\n -1.3, 0.0, 0.5, // Point R\n\n // Face 9\n 0.8, 0.8, 0.8, // Point A\n 1.3, 0.0, 0.5, // Point Q\n 0.8, -0.8, 0.8, // Point C\n 0.0, -0.5, 1.3, // Point L\n 0.0, 0.5, 1.3, // Point I\n\n // Face 10\n 1.3, 0.0, 0.5, // Point Q\n 1.3, 0.0, -0.5, // Point S\n 0.8, -0.8, -0.8, // Point D\n 0.5, -1.3, 0.0, // Point O\n 0.8, -0.8, 0.8, // Point C\n\n // Face 11\n 0.0, -0.5, -1.3, // Point K\n -0.8, -0.8, -0.8, // Point H\n -0.5, -1.3, 0.0, // Point P\n 0.5, -1.3, 0.0, // Point O\n 0.8, -0.8, -0.8, // Point D\n\n // Face 12\n -0.5, -1.3, 0.0, // Point P\n -0.8, -0.8, 0.8, // Point G\n 0.0, -0.5, 1.3, // Point L\n 0.8, -0.8, 0.8, // Point C\n 0.5, -1.3, 0.0, // Point O\n ];\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verts), gl.STATIC_DRAW);\n\n // Color data\n let colorBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);\n\n let faceColors = [\n [1.0, 0.0, 0.0, 1.0], // Face 1\n [0.0, 1.0, 0.0, 1.0], // Face 2\n [0.0, 0.0, 1.0, 1.0], // Face 3\n [1.0, 1.0, 0.0, 1.0], // Face 4\n [1.0, 0.0, 1.0, 1.0], // Face 5\n [0.0, 1.0, 1.0, 1.0], // Face 6\n [1.0, 1.0, 1.0, 1.0], // Face 7\n [0.5, 0.0, 0.0, 1.0], // Face 8\n [0.0, 0.5, 0.0, 1.0], // Face 9\n [0.0, 0.0, 0.5, 1.0], // Face 10\n [0.5, 1.0, 0.0, 1.0], // Face 11\n [0.0, 1.0, 0.5, 1.0] // Face 12\n ];\n\n // Each vertex must have the color information, that is why the same color is concatenated 5 times, one for each vertex of each face.\n let vertexColors = [];\n faceColors.forEach(color =>{\n for (let j=0; j < 5; j++)\n vertexColors.push(...color); // ... -> Inserts each value from each subarray [1.0, 0.0, 0.0, 1.0] → 1.0, 0.0, 0.0, 1.0\n });\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexColors), gl.STATIC_DRAW);\n\n // Index data (defines the triangles to be drawn).\n let dodecahedronIndexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, dodecahedronIndexBuffer);\n\n let dodecahedronIndices = [\n 0, 1, 2, 0, 2, 3, 0, 3, 4, // Face 1 (3 triangles)\n 5, 6, 7, 5, 7, 8, 5, 8, 9, // Face 2 (3 triangles)\n 10, 11, 12, 10, 12, 13, 10, 13, 14, // Face 3 (3 triangles)\n 15, 16, 17, 15, 17, 18, 15, 18, 19, // Face 4 (3 triangles)\n 20, 21, 22, 20, 22, 23, 20, 23, 24, // Face 5 (3 triangles)\n 25, 26, 27, 25, 27, 28, 25, 28, 29, // Face 6 (3 triangles)\n 30, 31, 32, 30, 32, 33, 30, 33, 34, // Face 7 (3 triangles)\n 35, 36, 37, 35, 37, 38, 35, 38, 39, // Face 8 (3 triangles)\n 40, 41, 42, 40, 42, 43, 40, 43, 44, // Face 9 (3 triangles)\n 45, 46, 47, 45, 47, 48, 45, 48, 49, // Face 10 (3 triangles)\n 50, 51, 52, 50, 52, 53, 50, 53, 54, // Face 11 (3 triangles)\n 55, 56, 57, 55, 57, 58, 55, 58, 59 // Face 12 (3 triangles)\n ];\n\n // gl.ELEMENT_ARRAY_BUFFER: Buffer used for element indices.\n // Uint16Array: Array of 16-bit unsigned integers.\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(dodecahedronIndices), gl.STATIC_DRAW);\n \n let dodecahedron = {\n buffer: vertexBuffer, colorBuffer:colorBuffer, indices:dodecahedronIndexBuffer,\n vertSize:3, nVerts:60, colorSize:4, nColors: 60, nIndices:108, // nVerts must be equal as the nColors. nIndices comes from cubeIndices\n primtype:gl.TRIANGLES, modelViewMatrix: mat4.create(), currentTime : Date.now()\n };\n\n mat4.translate(dodecahedron.modelViewMatrix, dodecahedron.modelViewMatrix, translation);\n\n dodecahedron.update = function()\n {\n let now = Date.now();\n let deltat = now - this.currentTime;\n this.currentTime = now;\n let fract = deltat / duration;\n let angle = Math.PI * 2 * fract;\n \n // Rotates a mat4 by the given angle\n // mat4 out the receiving matrix\n // mat4 a the matrix to rotate\n // Number rad the angle to rotate the matrix by\n // vec3 axis the axis to rotate around\n mat4.rotate(this.modelViewMatrix, this.modelViewMatrix, angle, rotationAxis);\n };\n \n return dodecahedron;\n}", "split() {\n\t\t\t\tvar nextLevel = this.level + 1,\n\t\t\t\t\tsubWidth = this.bounds.width / 2,\n\t\t\t\t\tsubHeight = this.bounds.height / 2,\n\t\t\t\t\tx = this.bounds.x,\n\t\t\t\t\ty = this.bounds.y;\n\n\t\t\t\t//top right node\n\t\t\t\tthis.nodes[0] = new Quadtree(\n\t\t\t\t\t{\n\t\t\t\t\t\tx: x + subWidth,\n\t\t\t\t\t\ty: y,\n\t\t\t\t\t\twidth: subWidth,\n\t\t\t\t\t\theight: subHeight\n\t\t\t\t\t},\n\t\t\t\t\tthis.max_objects,\n\t\t\t\t\tthis.max_levels,\n\t\t\t\t\tnextLevel\n\t\t\t\t);\n\n\t\t\t\t//top left node\n\t\t\t\tthis.nodes[1] = new Quadtree(\n\t\t\t\t\t{\n\t\t\t\t\t\tx: x,\n\t\t\t\t\t\ty: y,\n\t\t\t\t\t\twidth: subWidth,\n\t\t\t\t\t\theight: subHeight\n\t\t\t\t\t},\n\t\t\t\t\tthis.max_objects,\n\t\t\t\t\tthis.max_levels,\n\t\t\t\t\tnextLevel\n\t\t\t\t);\n\n\t\t\t\t//bottom left node\n\t\t\t\tthis.nodes[2] = new Quadtree(\n\t\t\t\t\t{\n\t\t\t\t\t\tx: x,\n\t\t\t\t\t\ty: y + subHeight,\n\t\t\t\t\t\twidth: subWidth,\n\t\t\t\t\t\theight: subHeight\n\t\t\t\t\t},\n\t\t\t\t\tthis.max_objects,\n\t\t\t\t\tthis.max_levels,\n\t\t\t\t\tnextLevel\n\t\t\t\t);\n\n\t\t\t\t//bottom right node\n\t\t\t\tthis.nodes[3] = new Quadtree(\n\t\t\t\t\t{\n\t\t\t\t\t\tx: x + subWidth,\n\t\t\t\t\t\ty: y + subHeight,\n\t\t\t\t\t\twidth: subWidth,\n\t\t\t\t\t\theight: subHeight\n\t\t\t\t\t},\n\t\t\t\t\tthis.max_objects,\n\t\t\t\t\tthis.max_levels,\n\t\t\t\t\tnextLevel\n\t\t\t\t);\n\t\t\t}", "function main() {\n // Retrieve <canvas> element\n var canvas = document.getElementById('webgl');\n // Prevent the default setting for left/right click in the window\n canvas.oncontextmenu = function (ev) {\n ev.preventDefault();\n }\n // Get the rendering context for WebGL\n var gl = getWebGLContext(canvas);\n if (!gl) {\n console.log('Failed to get the rendering context for WebGL');\n return;\n }\n\n // Initialize two programs for respectively drawing cylinder and normals\n var cylinderProgram = createProgram(gl, VSHADER_SOURCE, FSHADER_SOURCE);\n var lineProgram = createProgram(gl, vshader, fshader);\n if (!cylinderProgram || !lineProgram) {\n console.log('Failed to create program');\n return -1;\n }\n\n // Get locations of all the variables for drawing a cylinder\n cylinderProgram.a_Position = gl.getAttribLocation(cylinderProgram, 'a_Position');\n cylinderProgram.a_Color = gl.getAttribLocation(cylinderProgram, 'a_Color');\n cylinderProgram.a_Normal = gl.getAttribLocation(cylinderProgram, 'a_Normal');\n cylinderProgram.u_ViewMatrix = gl.getUniformLocation(cylinderProgram, 'u_ViewMatrix');\n cylinderProgram.u_ProjMatrix = gl.getUniformLocation(cylinderProgram, 'u_ProjMatrix');\n cylinderProgram.u_LightColor = gl.getUniformLocation(cylinderProgram, 'u_LightColor');\n cylinderProgram.u_LightDirection = gl.getUniformLocation(cylinderProgram, 'u_LightDirection');\n if (cylinderProgram.a_Position < 0 || cylinderProgram.a_Color < 0 || cylinderProgram.a_Normal < 0 ||\n cylinderProgram.u_ViewMatrix < 0 || cylinderProgram.u_ProjMatrix < 0 || cylinderProgram.u_LightColor < 0 ||\n cylinderProgram.u_LightDirection < 0) {\n console.log('Failed to locate variables for cylinder');\n return -1;\n }\n\n // Get location of all the variables for drawing normals\n lineProgram.a_Position = gl.getAttribLocation(lineProgram, 'a_Position');\n lineProgram.u_ViewMatrix = gl.getUniformLocation(lineProgram, 'u_ViewMatrix');\n lineProgram.u_ProjMatrix = gl.getUniformLocation(lineProgram, 'u_ProjMatrix');\n if (lineProgram.a_Position < 0 || lineProgram.u_ViewMatrix < 0 || lineProgram.u_ProjMatrix < 0) {\n console.log('Failed to locate variables for lines');\n return -1;\n }\n\n generate_tc(); // Initialize the array 'points' defined at line 46\n setColors(); // Initialize the array 'colors' at line 47\n setNormals(); // Initialize the array 'n' at line 48\n setViewNormals(); // Initialize the array 'shown' at line 49\n\n // From the names of the functions below,\n // you can easily known what they are doing.\n initPositions(gl, cylinderProgram, lineProgram, 0); // The last parameter '0' is to choose between two programs\n initColors(gl, cylinderProgram);\n initNormals(gl, cylinderProgram);\n initLightColor(gl, cylinderProgram);\n initLightDirection(gl, cylinderProgram);\n initMatrix(gl, cylinderProgram, lineProgram, 0, 0); // The last two parameters are to choose between programs and top/side view\n\n // Specify the color for clearing <canvas>\n gl.clearColor(1.0, 1.0, 1.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n // Clear color and depth buffer\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n // Display a default view\n var len = points.length / 3;\n gl.drawArrays(gl.TRIANGLES, 0, len);\n\n // Listen to toggle1, which is responsible for changing view\n var checkbox1 = document.getElementById('toggle1');\n checkbox1.addEventListener('change', function () {\n if (checkbox1.checked) {\n toggle1 = 1;\n setSideView(gl, cylinderProgram, lineProgram);\n } else {\n toggle1 = 0;\n setTopView(gl, cylinderProgram, lineProgram);\n }\n });\n\n // Toggle2, responsible for switching between flat shading and wireframe\n var checkbox2 = document.getElementById('toggle2');\n checkbox2.addEventListener('change', function () {\n if (checkbox2.checked) {\n toggle2 = 1;\n if (toggle1 == 0) {\n setTopView(gl, cylinderProgram, lineProgram);\n }\n else {\n setSideView(gl, cylinderProgram, lineProgram);\n }\n } else {\n toggle2 = 0;\n if (toggle1 == 0) {\n setTopView(gl, cylinderProgram, lineProgram);\n }\n else {\n setSideView(gl, cylinderProgram, lineProgram);\n }\n }\n });\n\n // Toggle3, for displaying normals\n var checkbox3 = document.getElementById('toggle3');\n checkbox3.addEventListener('change', function () {\n if (checkbox3.checked) {\n toggle3 = 1;\n if (toggle1 == 0) {\n setTopView(gl, cylinderProgram, lineProgram);\n }\n else {\n setSideView(gl, cylinderProgram, lineProgram);\n }\n } else {\n toggle3 = 0;\n if (toggle1 == 0) {\n setTopView(gl, cylinderProgram, lineProgram);\n }\n else {\n setSideView(gl, cylinderProgram, lineProgram);\n }\n }\n });\n}", "function drawTrees()\n{\n for(var i = 0; i < trees_x.length; i++)\n {\n\n fill(130,90,30);\n rect(trees_x[i] - 30, floorPos_y -115,60,120);\n fill(0,120,0,200);\n ellipse(trees_x[i] + 3, floorPos_y-190,200,190);\n }\n}", "function drawQuad() {\n setMV();\n Quad.draw();\n}", "function drawcylinder(gl,canvas,a_Position,r,s,x1,y1,x2,y2){\r\n\r\n // ** DRAW CYLINDERS **\r\n //\r\n\r\n // multiply degrees by convert to get value in radians \r\n // a circle is 360 degrees, rotate by (360 / s) degrees for every side, where n is number of sides!\r\n const convert = Math.PI/180 \r\n const numsides = 360/s\r\n\r\n // get the angle that the line segment forms\r\n const deltaX = x2-x1\r\n const deltaY = y2-y1 \r\n let degreeToRotate = Math.atan2(deltaY,deltaX)\r\n degreeToRotate = ((2*Math.PI)-degreeToRotate)\r\n \r\n // first we'll draw a circle by rotating around the x axis, then use a transformation matrix to rotate it\r\n // by the angle we found previously so the circle fits around the axis formed by the line segment\r\n let unrotated = []\r\n\r\n for (var i=0 ; i <=360; i+=numsides){ \r\n unrotated.push(0)\r\n unrotated.push((Math.cos(convert*i))*r)\r\n unrotated.push(Math.sin(convert*i)*r)\r\n } \r\n for (var i=0 ; i <=360; i+=numsides){ \r\n unrotated.push(0)\r\n unrotated.push((Math.cos(convert*i))*r)\r\n unrotated.push(Math.sin(convert*i)*r)\r\n } \r\n\r\n // OUR ROTATIONAL MATRIX (Rotating around the Z axis):\r\n // cos sin (0)\r\n // -sin cos (0)\r\n // 0 0 1 \r\n \r\n // first circle\r\n for (var i = 0 ; i < unrotated.length/2 ; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[i+2])\r\n cylinder_points.push(Rcolor)\r\n cylinder_points.push(Gcolor)\r\n cylinder_points.push(Bcolor)\r\n cylinder_points.push(Acolor)\r\n }\r\n // second circle\r\n for (var i = unrotated.length/2; i < unrotated.length; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) +x2) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) +y2)\r\n cylinder_points.push(unrotated[i+2])\r\n cylinder_points.push(Rcolor)\r\n cylinder_points.push(Gcolor)\r\n cylinder_points.push(Bcolor)\r\n cylinder_points.push(Acolor)\r\n }\r\n let cylindernormals = calcnormals(gl,canvas,a_Position,r,s,x1,y1,x2,y2,cylinder_points) \r\n console.log(cylindernormals)\r\n // actually apply shading after calculating surface normals\r\n let colors = []\r\n // Lambertan Shading Ld = kD * I * Max(0,n dot vl)\r\n light1V = normalize(light1V)\r\n light2V = normalize(light2V)\r\n // now both the light and surface normal are length 1 \r\n \r\n let currentsurfacecolor = findsurfacecolor(light1C,defaultcolor)\r\n if (whiteLightBox.checked){\r\n colors = calculateColors(cylindernormals,light1V,currentsurfacecolor) \r\n }\r\n\r\n if (redLightBox.checked){ \r\n if (whiteLightBox.checked){\r\n currentsurfacecolor = findsurfacecolor (light2C,currentsurfacecolor)\r\n colors = calculateColors(cylindernormals,light2V,currentsurfacecolor) \r\n }\r\n else{\r\n currentsurfacecolor = findsurfacecolor (light2C,defaultcolor)\r\n colors = calculateColors(cylindernormals,light2V,currentsurfacecolor) \r\n }\r\n }\r\n cylinder_points = []\r\n if (colors.length == 0){\r\n console.log (\"Try Turning on a light!\")\r\n return\r\n }\r\n colors.push(colors[0]) \r\n\r\n for (var i = 0 ; i < s ; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[3*i+2])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n cylinder_points.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x1)\r\n cylinder_points.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[3*i+5])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n }\r\n // second circle\r\n for (var i = 0 ; i < s ; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[3*i+2])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n cylinder_points.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x2)\r\n cylinder_points.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[3*i+5])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n }\r\n\r\n let len = cylinder_points.length/14;\r\n let indices = []\r\n // cool traiangles\r\n for (var i=0 ; i < s; i++){\r\n\r\n indices.push(i)\r\n indices.push(i+1) \r\n indices.push(len+i)\r\n indices.push(i)\r\n \r\n indices.push(i+1)\r\n indices.push(i)\r\n indices.push(len+i+1)\r\n indices.push(i+1)\r\n\r\n indices.push(len+i+1)\r\n indices.push(len+i) \r\n indices.push(i+1)\r\n indices.push(len+i+1)\r\n\r\n\r\n }\r\n\r\n var vertices = new Float32Array(cylinder_points)\r\n setVertexBuffer(gl, new Float32Array(vertices))\r\n setIndexBuffer(gl, new Uint16Array(indices))\r\n // draw cylinder\r\n gl.drawElements(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT, 0) \r\n //draw normal vectors ! (if applicable)\r\n calcnormals(gl,canvas,a_Position,r,s,x1,y1,x2,y2,cylinder_points) \r\n cylinder_points = []\r\n\r\n\r\n\r\n // ** DRAW CAP **\r\n // (FOR SMOOTH EDGES) \r\n\r\n let cap_points = []\r\n if (previousFace.length < 1){\r\n // second circle\r\n for (var i = 0 ; i < s ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n previousFace.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x2)\r\n previousFace.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+5])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n }\r\n return\r\n } \r\n for (var j=0 ; j < previousFace.length ;j++){\r\n cap_points.push(previousFace[j]) \r\n }\r\n\r\n previousFace = []\r\n for (var i = 0 ; i < s ; i++){\r\n cap_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cap_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cap_points.push(unrotated[3*i+2])\r\n cap_points.push(colors[i][0])\r\n cap_points.push(colors[i][1])\r\n cap_points.push(colors[i][2])\r\n cap_points.push(colors[i][3])\r\n cap_points.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x1)\r\n cap_points.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y1)\r\n cap_points.push(unrotated[3*i+5])\r\n cap_points.push(colors[i][0])\r\n cap_points.push(colors[i][1])\r\n cap_points.push(colors[i][2])\r\n cap_points.push(colors[i][3])\r\n }\r\n for (var i = 0 ; i < s ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n previousFace.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x2)\r\n previousFace.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+5])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n }\r\n var capvertices = new Float32Array(cap_points)\r\n let caplen = capvertices.length/14;\r\n if (caplen === 0)\r\n return\r\n setVertexBuffer(gl, new Float32Array(cap_points))\r\n setIndexBuffer(gl, new Uint16Array(indices))\r\n // draw caps \r\n gl.drawElements(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT, 0)\r\n}", "display() {\n fill('#323230');\n noStroke();\n if(this.shape === 'rect') {\n rectMode(CENTER);\n rect(this.x, this.y, this.size, this.size);\n } else if(this.shape === 'circle') {\n circle(this.x, this.y, this.size);\n } else {\n triangle(this.x - this.size / 2, this.y + this.size / 2, this.x + this.size / 2, this.y + this.size / 2, this.x, this.y - this.size / 2);\n }\n }", "constructor(centre, axis, radius, halfHeight, convex, baseColour, material) {\r\n\t\tsuper();\r\n\t\t\r\n\t\tthis.type = 'cylinder';\r\n\t\tthis.centre = centre;\r\n\t\tthis.axis = vecNormalize(axis);\r\n\t\tthis.radius = radius;\r\n\t\tthis.halfHeight = halfHeight;\r\n\t\tthis.convex = convex;\t// if true, surface points away from centre\r\n\t\tthis.baseColour = baseColour || COL_WHITE;\r\n\t\tthis.material = material;\r\n\t}", "function drop(ev){\n\tvar tube;\n\tvar o;\n\tvar grid = $(\"#geometry\");\n\tif(eval(ev.dataTransfer.getData(\"newcylinder\"))){\n\t\ttube = $('<div class=\"geometric-object\"/>');\n\t\ttube.appendTo(grid);\n\t\to = parserContext.createClass('cylinder');\n\t\tgeoObjects[ids] = o;\n\t\ttube.attr(\"id\",ids++);\n\t\to.height = Infinity;\n\t\to.radius = defaultRadius;\n\t\to.center = parserContext.createClass('vector3');\n\t\to.center.z = null;\n\t\to.material = parserContext.createClass('dielectric');\n\t\to.material.epsilon = 11.56;\n\t\ttube.addClass(\"cylinder\");\n\t\ttube.attr(\"ondragstart\",\"startDragGeoObject(event)\");\n\t\ttube.attr(\"ondrag\",\"draggingGeoObject(event)\");\n\t\ttube.attr(\"ondragend\",\"endDragGeoObject(event)\");\n\t\ttube.attr(\"draggable\",\"true\");\n\t\ttube.click(clickCylinder);\n\t\ttube.height(defaultRadius*2*simulation.getParam('resolution'));\n\t\ttube.width(defaultRadius*2*simulation.getParam('resolution'));\n\t} else {\n\t\ttube = $(\"#\"+ev.dataTransfer.getData(\"dragged\"));\n\t\to = geoObjects[tube[0].id];\n\t}\n\to.center.x += (event.clientX-event.dataTransfer.getData(\"ox\"))/simulation.getParam('resolution');\n\to.center.y += (event.clientY-event.dataTransfer.getData(\"oy\"))/simulation.getParam('resolution');\n\ttube.css(\"top\",o.center.y*simulation.getParam('resolution')+grid.height()/2-tube.height()/2);\n\ttube.css(\"left\",o.center.x*simulation.getParam('resolution')+grid.width()/2-tube.width()/2);\n}", "createChildren(){\n\t\tvar left = []; \n\t\tvar right = [];\n\t\tvar intersection_points = [];\n\t\tvar color = [];\n\t\tvar origin = [];\n\t\t\t\n\t\t\tarrange(this.vertex);\n\t\t\t//gets points where polygon line intersects with mouse line\n\t\t\tfor(var i = 0; i < this.vertex.length ; i ++){\n\t\t\t\tif(i == this.vertex.length - 1)\n\t\t\t\t\tvar point = getIntersection(this.vertex[i], this.vertex[0]);\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tvar point = getIntersection(this.vertex[i], this.vertex[i+1]);\n\t\t\t\tif(point != null){\n\t\t\t\t\tintersection_points.push(point);\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tleft = intersection_points.slice();\n\t\t\tright = intersection_points.slice();\n\t\t\torigin = intersection_points.slice();\n\t\t\t//separates in two nodes\n\t\t\tfor(var i = 0; i < this.vertex.length; i ++){\n\t\t\t\t\n\t\t\t\tif(position(mouse_press, mouse_drag, this.vertex[i]) < 0)\n\t\t\t\t\tleft.push(this.vertex[i]);\n\n\t\t\t\telse if(position(mouse_press, mouse_drag, this.vertex[i]) > 0)\n\t\t\t\t\tright.push(this.vertex[i]);\n\n\t\t\t}\n\n\t\t\t//sets child variables\n\t\t\tcolor = this.color.slice();\n\t\t\tthis.children.push(new Node(left, color, this));\n\t\t\tcolor = randomColor();\n\t\t\tthis.children.push(new Node(right, color, this));\t\n\t\t\tthis.children[0].origin_line = origin.slice();\n\t\t\tthis.children[1].origin_line = origin.slice();\n\t\t\tthis.children[0].root = this.root;\n\t\t\tthis.children[1].root = this.root;\n\n\n\t}", "function generateCylinder1(config) {\n\n var radius = config.radius || 50;\n var length = config.length || 200;\n var strips = config.strips || 5;\n var xRot = config.xRot || null;\n var yRot = config.yRot || null;\n var zRot = config.zRot || null;\n\n var points = [],\n polygons = [],\n edges = [];\n var inc = TAU / strips;\n for (var s = 0, offset = 0; s <= strips; s++) {\n points.push({\n x: cos(offset) * radius,\n z: sin(offset) * radius,\n y: length / 2\n });\n points.push({\n x: cos(offset) * radius,\n z: sin(offset) * radius,\n y: -length / 2\n });\n offset += inc;\n if (s !== 0) {\n polygons.push([s * 2 - 2, s * 2, s * 2 + 1, s * 2 - 1]);\n edges.push({\n a: s * 2,\n b: s * 2 - 2\n }, {\n a: s * 2 - 2,\n b: s * 2 - 1\n }, {\n a: s * 2 + 1,\n b: s * 2 - 1\n });\n if (s === strips - 1) {\n var vs = [];\n for (let i = strips; i >= 0; i--) {\n vs.push(i * 2)\n }\n polygons.push(vs);\n vs = [];\n for (let i = 0; i < strips; i++) {\n vs.push(i * 2 + 1)\n }\n polygons.push(vs);\n }\n }\n }\n\n rotateZ3D(zRot, points, true);\n rotateY3D(yRot, points, true);\n rotateX3D(xRot, points, true);\n\n return {\n points: points,\n edges: edges,\n polygons: polygons\n }\n }", "function DrawScene()\r\n{\r\n\t// 1. Obtenemos las matrices de transformación \r\n\tvar mvp = GetModelViewProjection( perspectiveMatrix, 0, 0, transZ, rotX, autorot+rotY );\r\n\r\n\t// 2. Limpiamos la escena\r\n\tgl.clear( gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT );\r\n\t\t\r\n\t// 3. Le pedimos a cada objeto que se dibuje a si mismo\r\n\tmeshDrawer.draw( mvp );\r\n\tif ( showBox.checked ) \r\n\t{\r\n\t\tboxDrawer.draw( mvp );\r\n\t}\r\n}", "function drawcylinder(gl,canvas,a_Position,r,s,x1,y1,x2,y2,numpolyline){\r\n Acolor = 1 - (numpolyline/255) \r\n // ** DRAW CYLINDERS **\r\n //\r\n // multiply degrees by convert to get value in radians \r\n // a circle is 360 degrees, rotate by (360 / s) degrees for every side, where n is number of sides!\r\n let convert = Math.PI/180 \r\n let numsides = 360/s\r\n\r\n // get the angle that the line segment forms\r\n let deltaX = x2-x1\r\n let deltaY = y2-y1 \r\n let degreeToRotate = Math.atan2(deltaY,deltaX)\r\n degreeToRotate = ((2* Math.PI)-degreeToRotate)\r\n \r\n // first we'll draw a circle by rotating around the x axis, then use a transformation matrix to rotate it\r\n // by the angle we found previously so the circle fits around the axis formed by the line segment\r\n let unrotated = []\r\n\r\n for (var i=0 ; i <=360; i+=numsides){ \r\n unrotated.push(0)\r\n unrotated.push((Math.cos(convert*i))*r)\r\n unrotated.push(Math.sin(convert*i)*r)\r\n } \r\n let cylinder_points = [] \r\n let indices = []\r\n let colors = []\r\n let normie = []\r\n //first circle\r\n for (var i = 0 ; i < unrotated.length; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[i+2])\r\n }\r\n\r\n // second circle\r\n for (var i = 0 ; i < unrotated.length; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[i+2])\r\n }\r\n\r\n \r\n //calculate face normals from cylinder points \r\n let cylindernormals = calcnormals(gl,canvas,a_Position,r,s,x1,y1,x2,y2,cylinder_points) \r\n // n+1th normal (the point that comes after the last point is the same as the first point) \r\n cylindernormals.push(cylindernormals[0])\r\n cylindernormals.push(cylindernormals[1])\r\n cylindernormals.push(cylindernormals[2])\r\n cylinder_points = []\r\n colors = []\r\n \r\n cylinder_points.push((unrotated[0] * Math.cos(degreeToRotate)) + (unrotated[1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[0] * (-1 * Math.sin(degreeToRotate))) + (unrotated[1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[2])\r\n normie.push((cylindernormals[0]+cylindernormals[27]) / 2)\r\n normie.push((cylindernormals[1]+cylindernormals[28]) / 2)\r\n normie.push((cylindernormals[2]+cylindernormals[29]) / 2)\r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n\r\n\r\n for (var i = 1 ; i < s+1; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[3*i+2])\r\n normie.push((cylindernormals[3*i]+cylindernormals[3*(i-1)])/2) \r\n normie.push((cylindernormals[3*i+1]+cylindernormals[3*(i-1)+1])/2) \r\n normie.push((cylindernormals[3*i+2]+cylindernormals[3*(i-1)+2])/2) \r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n }\r\n // second circle\r\n cylinder_points.push((unrotated[0] * Math.cos(degreeToRotate)) + (unrotated[1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[0] * (-1 * Math.sin(degreeToRotate))) + (unrotated[1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[2])\r\n normie.push((cylindernormals[0]+cylindernormals[27]) / 2)\r\n normie.push((cylindernormals[1]+cylindernormals[28]) / 2)\r\n normie.push((cylindernormals[2]+cylindernormals[29]) / 2)\r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n for (var i = 1 ; i < s+1; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[3*i+2])\r\n normie.push((cylindernormals[3*i]+cylindernormals[3*(i-1)])/2) \r\n normie.push((cylindernormals[3*i+1]+cylindernormals[3*(i-1)+1])/2) \r\n normie.push((cylindernormals[3*i+2]+cylindernormals[3*(i-1)+2])/2) \r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n }\r\n\r\n // 2 points to represent the center\r\n cylinder_points.push(x2) \r\n cylinder_points.push(y2)\r\n cylinder_points.push(0)\r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n\r\n let len = cylinder_points.length/6\r\n // cool traiangles\r\n for (var i=0 ; i < s; i++){\r\n indices.push(i)\r\n indices.push(i+1) \r\n indices.push(len+i)\r\n indices.push(i)\r\n \r\n indices.push(i+1)\r\n indices.push(i)\r\n indices.push(len+i+1)\r\n indices.push(i+1)\r\n\r\n indices.push(len+i+1)\r\n indices.push(len+i) \r\n indices.push(i+1)\r\n indices.push(len+i+1)\r\n }\r\n\r\n var n = initVertexBuffers(gl,cylinder_points,colors,normie,indices)\r\n if (n<0){\r\n console.log('failed to set vert info')\r\n return\r\n }\r\n // Set the clear color and enable the depth test\r\n gl.enable(gl.DEPTH_TEST);\r\n initAttrib(gl,canvas,numpolyline)\r\n\r\n //draw the cylinder!\r\n gl.drawElements(gl.TRIANGLES, n, gl.UNSIGNED_BYTE, 0);\r\n \r\n\r\n // ** DRAW CAP **\r\n // (FOR SMOOTH EDGES) \r\n let cap_points = []\r\n if (previousFace.length < 1){\r\n // second circle\r\n for (var i = 0 ; i < s+1 ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n }\r\n return\r\n } \r\n for (var j=0 ; j < previousFace.length ;j++){\r\n cap_points.push(previousFace[j]) \r\n }\r\n previousFace = []\r\n for (var i = 0 ; i < s+1 ; i++){\r\n cap_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cap_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cap_points.push(unrotated[3*i+2])\r\n }\r\n for (var i = 0 ; i < s+1 ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n }\r\n var capvertices = new Float32Array(cap_points)\r\n let caplen = capvertices.length/14;\r\n if (caplen === 0)\r\n return\r\n var n = initVertexBuffers(gl,capvertices,colors,normie,indices)\r\n if (n<0){\r\n console.log('failed to set vert info')\r\n return\r\n }\r\n // Set the clear color and enable the depth test\r\n gl.enable(gl.DEPTH_TEST);\r\n initAttrib(gl,canvas,numpolyline)\r\n //draw the cylinder!\r\n gl.drawElements(gl.TRIANGLES, n, gl.UNSIGNED_BYTE, 0);\r\n}", "function fuelTankGraphic (selector, stageNo) {\n var scene = new THREE.Scene();\n var width = $window.innerWidth;\n var height = $window.innerHeight;\n \n if (stageNo === 2) {\n height = height * .35 * .7;\n width = width * .6 * .6 * .34;\n } else {\n height = height * .65 * .8 * .5;\n width = width * .6 * .4 * .5;\n }\n var camera = new THREE.PerspectiveCamera( 75, width/height, 0.1, 1000 );\n // var camera = new THREE.OrthographicCamera(- width/1 , width / 1, height / 1, -height / 1, 1, 1000 );\n var renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });\n renderer.setClearColor( 0xffffff, 0);\n renderer.setSize( width, height);\n $(selector).append( renderer.domElement );\n\n camera.position.set(0, 0, 67);\n\n //Lighting\n var light = new THREE.AmbientLight( 0x404040 ); // soft white light\n scene.add( light );\n\n var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );\n directionalLight.position.set( -2, 2, 0 );\n scene.add( directionalLight );\n\n\n var tankGeometry = new THREE.CylinderGeometry( 25, 25, 40, 30, 30 );\n var tankMaterial = new THREE.MeshPhongMaterial({\n color: 0x65696b,\n emissive: 0x2d2828,\n specular: 0x7f7373,\n wireframe: false,\n transparent: true,\n opacity: .5\n });\n var tank = new THREE.Mesh( tankGeometry, tankMaterial );\n scene.add( tank );\n\n\n //Tank top/bottom\n // var tankCapGeometry = new THREE.SphereGeometry(40,40, 30, Math.PI*1.5, Math.PI, 0, 3.1);\n var tankCapGeometry = new THREE.SphereGeometry(27,30, 30, 0, 2*Math.PI, 0, 1.2);\n var tankTop = new THREE.Mesh(tankCapGeometry, tankMaterial)\n scene.add(tankTop);\n tankTop.position.y = 10;\n // tankTop.rotation.x = Math.PI / 2 ;\n // tankTop.rotation.z = -Math.PI/2;\n\n\n var tankBottom = new THREE.Mesh(tankCapGeometry, tankMaterial)\n scene.add(tankBottom);\n tankBottom.position.y = -10;\n tankBottom.rotation.z = -Math.PI;\n\n var fuelSpecs = {\n radius: 24,\n height: 40,\n radialSegments: 30,\n heightSegments: 30\n }\n\n var fuelGeometry = new THREE.CylinderGeometry(fuelSpecs.radius, fuelSpecs.radius, fuelSpecs.height, fuelSpecs.radialSegments, fuelSpecs.heightSegments);\n var fuelMaterial = new THREE.MeshPhongMaterial({\n color: 0x117cb1,\n emissive: 0x0b1b91,\n specular: 0x1e1a1a\n });\n var fuel = new THREE.Mesh(fuelGeometry, fuelMaterial);\n scene.add(fuel);\n\n // var fuelCapGeometry = new THREE.SphereGeometry(39,30, 30, Math.PI*1.5, Math.PI, 0, 3.1);\n var fuelCapGeometry = new THREE.SphereGeometry(25,30, 30, 0, 2*Math.PI, 0, 1.3);\n var fuelBottom = new THREE.Mesh(fuelCapGeometry, fuelMaterial);\n scene.add(fuelBottom);\n fuelBottom.position.y = -11;\n fuelBottom.rotation.z = Math.PI;\n\n var vec = new THREE.Vector3( 0, 0, 0 );\n \n //Rendering & animation loop\n var render = function (actions) {\n camera.lookAt(vec)\n renderer.render(scene, camera);\n requestAnimationFrame( render );\n };\n render();\n }", "function add_tree_at(position_vec) {\n var tree = new THREE.Object3D();\n\tvar trunk = new THREE.Mesh(\n new THREE.CylinderGeometry(0.2,0.2,1,16,1),\n\t\tnew THREE.MeshLambertMaterial({\n\t\t color: 0x885522\n\t\t})\n\t);\n\ttrunk.position.y = 0.5; // move base up to origin\n\tvar leaves = new THREE.Mesh(\n new THREE.ConeGeometry(.7,2,16,3),\n\t\tnew THREE.MeshPhongMaterial({\n\t\t color: 0x00BB00,\n\t\t\tspecular: 0x002000,\n\t\t\tshininess: 5\n\t\t})\n\t);\n\tleaves.position.y = 2; // move bottom of cone to top of trunk\n\ttrunk.castShadow = true;\n\ttrunk.receiveShadow = true;\n\tleaves.castShadow = true;\n\tleaves.receiveShadow = true;\n\ttree.add(trunk);\n\ttree.add(leaves);\n\ttree.position.set(position_vec.x, 0, position_vec.z);\n var rand = Math.random();\n tree.scale.set(rand, rand, rand);\n var a_tree = tree.clone();\n DISK_WORLD_MODEL.add(a_tree);\n TRANSLATING_OBJECTS.push(a_tree);\n}", "clearGeometry() {\n this.geometries = [];\n this.texGeometries = [];\n this.render();\n }", "function addHorizontalCylinder(obj, x, y, z, s) {\n 'use strict';\n\n geometry = new THREE.CylinderGeometry(0.5, 0.5, 10 * s, 32);\n mesh = new THREE.Mesh(geometry,material);\n\n mesh.position.set(x, y, z);\n mesh.rotation.z += Math.PI / 2;\n obj.add(mesh);\n}", "render() {\n stroke(this.layerColor)\n fill(this.layerColor)\n strokeWeight(this.weight)\n\n push()\n translate(width / 2, height / 2)\n let pick = random(1)\n for (let i = 0; i < this.numShapes; i++) {\n if (pick < 0.5) {\n myTriangle(this.center, this.radius, this.direction)\n } else {\n ellipse(0, this.center, this.radius, this.radius)\n }\n rotate(this.angle)\n }\n pop()\n }", "function drawTree() {\n\n // draw tree using prepared data and config variables\n // \n var t1 = new Date();\n //oTree.clearChart();\n \n updateHandler();\n\n setTimeout(function(){\n oTree.draw(oTreeData, oTreeOptions);\n\n setPopularWords();\n }, 1);\n \n }", "constructor() {\n // create geometry\n const geometry = new T.BoxGeometry()\n\n // build mesh\n const mesh = new T.Mesh(geometry, material().ref)\n\n // add mesh shadows\n mesh.castShadow = false\n mesh.receiveShadow = true\n\n // store mesh\n this.mesh = mesh\n }", "function drawTrees()\n{\n for (var i = 0; i < trees_x.length; i++)\n {\n //draw tree\n fill(165,42,42)\n rect(trees_x[i]+215, floorPos_y-91, 29.5, 91);\n fill(0,255,0)\n ellipse(trees_x[i]+215, floorPos_y-95, 60, 50);\n ellipse(trees_x[i]+220, floorPos_y-80, 60, 50);\n ellipse(trees_x[i]+215, floorPos_y-95, 60, 50);\n fill(0,230,0)\n ellipse(trees_x[i]+205, floorPos_y-95, 60, 50); \n fill(0,250,0)\n ellipse(trees_x[i]+240, floorPos_y-90, 60, 50);\n ellipse(trees_x[i]+250, floorPos_y-90, 60, 50);\n ellipse(trees_x[i]+250, floorPos_y-93, 60, 50);\n fill(255,165,0)\n ellipse(trees_x[i]+210, floorPos_y-95, 9, 8);\n ellipse(trees_x[i]+230, floorPos_y-80, 9, 8);\n ellipse(trees_x[i]+215, floorPos_y-109, 9, 8);\n ellipse(trees_x[i]+260, floorPos_y-90, 9, 8);\n }\n}", "draw(shader, tpMatrix) {\n for(var i = 0; i < this.children.length; i++) {\n this.children[i].draw(shader, tpMatrix.multiplyMatrix4(this.transform.toMatrix()));\n }\n\n if(this.object && this.visible) {\n shader.setMatrix4fv(\"model\", tpMatrix.multiplyMatrix4(this.transform.toMatrix()));\n this.object.draw();\n }\n }", "static tree(data) {\n const chart = this.container;\n // create a d3-hierarchy from our form-json\n const root = d3__WEBPACK_IMPORTED_MODULE_0__[\"hierarchy\"](data, d => d.space);\n\n // set up design variables\n const design = _graph_d3_styles_js__WEBPACK_IMPORTED_MODULE_3__[\"tree\"][this.styleClass];\n const [nodeSize, nodeSep] = [design.nodeSize, design.nodeSeparation];\n const [fontSize, font] = [design.font.size, design.font.family];\n\n this.padding = { left: 10, right: 10, top: 10, bottom: 10 };\n\n root.dx = nodeSize.w + nodeSep.hz;\n root.dy = this.width / (root.height + 1);\n\n // define tree layout\n const layout = d3__WEBPACK_IMPORTED_MODULE_0__[\"tree\"]()\n .nodeSize([\n root.dx,\n root.dy\n ])\n .separation((a,b) => {\n return a.parent == b.parent ? 1 : 2;\n });\n const tree = layout(root);\n\n // compute min/max x-values\n let x0 = Infinity;\n let x1 = -x0;\n tree.each(d => {\n if (d.x > x1) x1 = d.x;\n if (d.x < x0) x0 = d.x;\n });\n // compute new height based on the difference of min/max x-values of tree nodes + twice the padding\n const rootUnmarked = root.data.unmarked;\n const tickpadding = nodeSize.h*1.8;\n const axisHeight = tickpadding; //30;\n this.height = (x1 - x0) + this.padding.top*2 + nodeSize.h+2 + axisHeight;\n\n // setup svg container\n this.svg\n .attr('width', this.width)\n .attr('height', this.height);\n _graph_d3_styles_js__WEBPACK_IMPORTED_MODULE_3__[\"clearDefaults\"](this.svg); // clear default styles for svg export\n\n // setup basic chart structure\n chart\n .classed('graph-tree', true)\n .attr('transform', `translate(${this.padding.left + nodeSize.w/2 + (root.data.unmarked ? -root.dy : 0)},${this.padding.top - x0 + nodeSize.h/2})`);\n \n // add vertical axis lines for depth\n\n const rootHeights = d3__WEBPACK_IMPORTED_MODULE_0__[\"range\"](root.height + (rootUnmarked ? 0:1));\n\n this.depthScale = d3__WEBPACK_IMPORTED_MODULE_0__[\"scaleOrdinal\"]()\n .domain( rootHeights )\n .range( rootHeights.map(i => (i+(rootUnmarked ? 1:0))*root.dy) );\n \n const depthAxis = d3__WEBPACK_IMPORTED_MODULE_0__[\"axisBottom\"]()\n .scale(this.depthScale)\n .tickSizeInner(-(x1-x0))\n .tickSizeOuter(0)\n .tickPadding(tickpadding)\n .tickValues( this.depthScale.domain().map(i => \n (this.depthScale.domain().length < 15) ? 'Depth '+i : i\n ) );\n\n const axis = chart.append('g')\n .classed('depthAxis', true)\n .attr('transform', `translate(0, ${x1})`)\n .call(depthAxis);\n axis.select('.domain').remove();\n \n\n // add groups for links and nodes\n\n const links = chart.selectAll('.link')\n .data(tree.links()) \n .enter().append('g')\n .classed('link', true)\n\n const nodes = chart.selectAll('.node')\n .data(tree.descendants())\n .enter().append('g')\n .classed('node', true)\n .attr('transform', d => `translate(${d.y},${d.x})`);\n\n if (rootUnmarked) {\n links.filter(d => d.source.depth === 0)\n .remove();\n\n nodes.filter(d => d.depth === 0)\n .remove();\n }\n\n // generate link partition selections\n const linkPartitions = resolveLinks(tree, links);\n const [reChildLink, rePointLink] = linkPartitions;\n\n // generate node partition selections\n const nodePartitions = resolveNodes(tree, nodes);\n const [leaves, sets, forms, reEntries, reChilds, rePoints, elements, vars, consts, unclear] = nodePartitions;\n\n // curved line generator\n const line = d3__WEBPACK_IMPORTED_MODULE_0__[\"line\"]().curve(d3__WEBPACK_IMPORTED_MODULE_0__[\"curveBasis\"]);\n\n links\n .append('path')\n .attr('d', d3__WEBPACK_IMPORTED_MODULE_0__[\"linkHorizontal\"]()\n .x(d => d.y)\n .y(d => d.x));\n\n nodes.filter(d => !d.data.unmarked)\n .append('circle')\n .attr('r', nodeSize.w/2)\n rePoints.append('text')\n .attr('x', nodeSize.w/2 + 2)\n .text(d => {\n let p = d.parent;\n let counter = 0;\n while(p.data.type !== 'reEntry') {\n p = p.parent;\n if (counter > 1000) return null; // security\n counter++;\n }\n return (p.data.reEven !== 'undefined') ? (p.data.reEven ? '2|r|' : '2|r|+1') : '';\n });\n\n elements.selectAll('circle')\n .attr('r', (nodeSize.w/2)/2);\n\n nodes\n .append('text')\n .attr('x', nodeSize.w/2 + 2)\n \n vars.selectAll('text')\n .call(Object(_common_d3_helper__WEBPACK_IMPORTED_MODULE_2__[\"textSubscript\"])(d => d.data.symbol));\n consts.selectAll('text')\n .text(d => `= ${d.data.value}`);\n unclear.selectAll('text')\n .text(d => `/${d.data.symbol}/`);\n\n sets.filter(d => d.children)\n .append('circle')\n .classed('inner',true)\n .attr('r', (nodeSize.w/2)/2);\n\n\n // apply all style-related attributes to the selections\n design.applyAxisStyles(axis);\n design.applyLinkStyles(links, linkPartitions);\n design.applyNodeStyles(nodes, nodePartitions);\n\n Object(_common_d3_helper__WEBPACK_IMPORTED_MODULE_2__[\"fitChart\"])(chart, this.padding);\n\n // debugging:\n // [this.root, this.layout, this.chart, this.tree, this.design] = \n // [root, layout, chart, tree, design];\n }" ]
[ "0.6898562", "0.6708071", "0.6708071", "0.6635934", "0.6594494", "0.6302421", "0.625228", "0.61873144", "0.61303943", "0.60439575", "0.6031439", "0.60280377", "0.6002882", "0.5967892", "0.5916542", "0.59140736", "0.5893779", "0.5878236", "0.5820949", "0.5817835", "0.5817835", "0.5791148", "0.5756134", "0.5745322", "0.57400525", "0.57186735", "0.569379", "0.5683831", "0.5677731", "0.5673773", "0.5670762", "0.56205076", "0.5602", "0.5599857", "0.5599726", "0.5587556", "0.5583031", "0.55693406", "0.55479026", "0.55463856", "0.5540964", "0.55397445", "0.5537165", "0.55359995", "0.5525119", "0.55198956", "0.54978395", "0.54668105", "0.5440684", "0.5440045", "0.5435262", "0.54226196", "0.5403605", "0.54031664", "0.5393139", "0.53880465", "0.5370087", "0.53700656", "0.5369652", "0.5369559", "0.5369559", "0.5369383", "0.5366156", "0.5364376", "0.5363109", "0.53516054", "0.5346117", "0.5333638", "0.53295296", "0.53292084", "0.5327749", "0.5325558", "0.5320909", "0.5301744", "0.52961445", "0.52932006", "0.5291106", "0.5288835", "0.52870196", "0.5285815", "0.5278211", "0.52745014", "0.52612567", "0.5258155", "0.52577496", "0.52571285", "0.52432656", "0.52421266", "0.5238801", "0.5232832", "0.5228348", "0.5228135", "0.522347", "0.52213264", "0.52180535", "0.5212137", "0.5203877", "0.51951045", "0.51933503", "0.5191819" ]
0.7074454
0
Convert vector between point X and Y to a cylinder...
function cylinderMesh(pointX, pointY,treeWidth) { var direction = new THREE.Vector3().subVectors(pointY, pointX); var orientation = new THREE.Matrix4(); orientation.lookAt(pointX, pointY, new THREE.Object3D().up); orientation.multiply(new THREE.Matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1)); var edgeGeometry = new THREE.CylinderGeometry(0.5, 0.5, direction.length(), 8, 1); var edge = new THREE.Mesh(edgeGeometry); edge.applyMatrix(orientation); // position based on midpoints - there may be a better solution than this edge.position.x = (pointY.x + pointX.x) / 2; edge.position.y = (pointY.y + pointX.y) / 2; edge.position.z = (pointY.z + pointX.z) / 2; return edge; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawcylinder(gl,canvas,a_Position,r,s,x1,y1,x2,y2){\r\n\r\n // ** DRAW CYLINDERS **\r\n //\r\n\r\n // multiply degrees by convert to get value in radians \r\n // a circle is 360 degrees, rotate by (360 / s) degrees for every side, where n is number of sides!\r\n const convert = Math.PI/180 \r\n const numsides = 360/s\r\n\r\n // get the angle that the line segment forms\r\n const deltaX = x2-x1\r\n const deltaY = y2-y1 \r\n let degreeToRotate = Math.atan2(deltaY,deltaX)\r\n degreeToRotate = ((2*Math.PI)-degreeToRotate)\r\n \r\n // first we'll draw a circle by rotating around the x axis, then use a transformation matrix to rotate it\r\n // by the angle we found previously so the circle fits around the axis formed by the line segment\r\n let unrotated = []\r\n\r\n for (var i=0 ; i <=360; i+=numsides){ \r\n unrotated.push(0)\r\n unrotated.push((Math.cos(convert*i))*r)\r\n unrotated.push(Math.sin(convert*i)*r)\r\n } \r\n for (var i=0 ; i <=360; i+=numsides){ \r\n unrotated.push(0)\r\n unrotated.push((Math.cos(convert*i))*r)\r\n unrotated.push(Math.sin(convert*i)*r)\r\n } \r\n\r\n // OUR ROTATIONAL MATRIX (Rotating around the Z axis):\r\n // cos sin (0)\r\n // -sin cos (0)\r\n // 0 0 1 \r\n \r\n // first circle\r\n for (var i = 0 ; i < unrotated.length/2 ; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[i+2])\r\n cylinder_points.push(Rcolor)\r\n cylinder_points.push(Gcolor)\r\n cylinder_points.push(Bcolor)\r\n cylinder_points.push(Acolor)\r\n }\r\n // second circle\r\n for (var i = unrotated.length/2; i < unrotated.length; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) +x2) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) +y2)\r\n cylinder_points.push(unrotated[i+2])\r\n cylinder_points.push(Rcolor)\r\n cylinder_points.push(Gcolor)\r\n cylinder_points.push(Bcolor)\r\n cylinder_points.push(Acolor)\r\n }\r\n let cylindernormals = calcnormals(gl,canvas,a_Position,r,s,x1,y1,x2,y2,cylinder_points) \r\n console.log(cylindernormals)\r\n // actually apply shading after calculating surface normals\r\n let colors = []\r\n // Lambertan Shading Ld = kD * I * Max(0,n dot vl)\r\n light1V = normalize(light1V)\r\n light2V = normalize(light2V)\r\n // now both the light and surface normal are length 1 \r\n \r\n let currentsurfacecolor = findsurfacecolor(light1C,defaultcolor)\r\n if (whiteLightBox.checked){\r\n colors = calculateColors(cylindernormals,light1V,currentsurfacecolor) \r\n }\r\n\r\n if (redLightBox.checked){ \r\n if (whiteLightBox.checked){\r\n currentsurfacecolor = findsurfacecolor (light2C,currentsurfacecolor)\r\n colors = calculateColors(cylindernormals,light2V,currentsurfacecolor) \r\n }\r\n else{\r\n currentsurfacecolor = findsurfacecolor (light2C,defaultcolor)\r\n colors = calculateColors(cylindernormals,light2V,currentsurfacecolor) \r\n }\r\n }\r\n cylinder_points = []\r\n if (colors.length == 0){\r\n console.log (\"Try Turning on a light!\")\r\n return\r\n }\r\n colors.push(colors[0]) \r\n\r\n for (var i = 0 ; i < s ; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[3*i+2])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n cylinder_points.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x1)\r\n cylinder_points.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[3*i+5])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n }\r\n // second circle\r\n for (var i = 0 ; i < s ; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[3*i+2])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n cylinder_points.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x2)\r\n cylinder_points.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[3*i+5])\r\n cylinder_points.push(colors[i][0])\r\n cylinder_points.push(colors[i][1])\r\n cylinder_points.push(colors[i][2])\r\n cylinder_points.push(colors[i][3])\r\n }\r\n\r\n let len = cylinder_points.length/14;\r\n let indices = []\r\n // cool traiangles\r\n for (var i=0 ; i < s; i++){\r\n\r\n indices.push(i)\r\n indices.push(i+1) \r\n indices.push(len+i)\r\n indices.push(i)\r\n \r\n indices.push(i+1)\r\n indices.push(i)\r\n indices.push(len+i+1)\r\n indices.push(i+1)\r\n\r\n indices.push(len+i+1)\r\n indices.push(len+i) \r\n indices.push(i+1)\r\n indices.push(len+i+1)\r\n\r\n\r\n }\r\n\r\n var vertices = new Float32Array(cylinder_points)\r\n setVertexBuffer(gl, new Float32Array(vertices))\r\n setIndexBuffer(gl, new Uint16Array(indices))\r\n // draw cylinder\r\n gl.drawElements(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT, 0) \r\n //draw normal vectors ! (if applicable)\r\n calcnormals(gl,canvas,a_Position,r,s,x1,y1,x2,y2,cylinder_points) \r\n cylinder_points = []\r\n\r\n\r\n\r\n // ** DRAW CAP **\r\n // (FOR SMOOTH EDGES) \r\n\r\n let cap_points = []\r\n if (previousFace.length < 1){\r\n // second circle\r\n for (var i = 0 ; i < s ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n previousFace.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x2)\r\n previousFace.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+5])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n }\r\n return\r\n } \r\n for (var j=0 ; j < previousFace.length ;j++){\r\n cap_points.push(previousFace[j]) \r\n }\r\n\r\n previousFace = []\r\n for (var i = 0 ; i < s ; i++){\r\n cap_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cap_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cap_points.push(unrotated[3*i+2])\r\n cap_points.push(colors[i][0])\r\n cap_points.push(colors[i][1])\r\n cap_points.push(colors[i][2])\r\n cap_points.push(colors[i][3])\r\n cap_points.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x1)\r\n cap_points.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y1)\r\n cap_points.push(unrotated[3*i+5])\r\n cap_points.push(colors[i][0])\r\n cap_points.push(colors[i][1])\r\n cap_points.push(colors[i][2])\r\n cap_points.push(colors[i][3])\r\n }\r\n for (var i = 0 ; i < s ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n previousFace.push((unrotated[3*i+3] * Math.cos(degreeToRotate)) + (unrotated[3*i+4] * Math.sin(degreeToRotate)) + x2)\r\n previousFace.push((unrotated[3*i+3] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+4] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+5])\r\n previousFace.push(colors[i][0])\r\n previousFace.push(colors[i][1])\r\n previousFace.push(colors[i][2])\r\n previousFace.push(colors[i][3])\r\n }\r\n var capvertices = new Float32Array(cap_points)\r\n let caplen = capvertices.length/14;\r\n if (caplen === 0)\r\n return\r\n setVertexBuffer(gl, new Float32Array(cap_points))\r\n setIndexBuffer(gl, new Uint16Array(indices))\r\n // draw caps \r\n gl.drawElements(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT, 0)\r\n}", "function cylinder(radius, height) { \n this.radius = radius;\n this.height = height;\n}", "function drawCylinder() {\t\r\n\t\t//TODO: update VBO positions based on 'factor' for cone-like effect\r\n\t\tmeshes.cylinder.drawMode = gl.LINE_LOOP;\r\n\t\t\r\n\t\t// Render\r\n\t\tmeshes.cylinder.setAttribLocs(attribs);\r\n\t\tmeshes.cylinder.render();\t\t\t\t\r\n\t}", "function Vector(_ref) {\n var _ref$vector = _ref.vector,\n vector = _ref$vector === undefined ? [[0, 0, 0], [1, 1, 1]] : _ref$vector,\n _ref$thickness = _ref.thickness,\n thickness = _ref$thickness === undefined ? 0 : _ref$thickness,\n _ref$material = _ref.material,\n material = _ref$material === undefined ? null : _ref$material;\n\n _classCallCheck(this, Vector);\n\n //set length of arrow\n var arrowLength = 20,\n baseMargin = 10,\n _vector$map = vector.map(function (p) {\n return new (Function.prototype.bind.apply(_three.Vector3, [null].concat(_toConsumableArray(p))))();\n }),\n _vector$map2 = _slicedToArray(_vector$map, 2),\n basePoint = _vector$map2[0],\n pointB = _vector$map2[1],\n fullVector = pointB.clone(),\n threeVector = pointB.clone(),\n baseMarginPercent,\n pointA,\n cylinder,\n cylinderLength,\n cone,\n coneLength;\n //subtract basePoint from pointB\n fullVector.sub(basePoint);\n //caclculate base margin as a percentage of length\n baseMarginPercent = baseMargin / fullVector.length();\n //apply margin to basePoint to get pointA\n pointA = new (Function.prototype.bind.apply(_three.Vector3, [null].concat(_toConsumableArray(basePoint.toArray().map(function (it, i) {\n return it + (pointB.toArray()[i] - it) * baseMarginPercent;\n })))))();\n //subtract pointA from pointB\n threeVector.sub(pointA);\n //set lengths\n cylinderLength = threeVector.length() - arrowLength;\n coneLength = arrowLength;\n //normalize vector\n threeVector.normalize();\n //store components\n this.components = [];\n\n //create cylinder (line) of vector\n cylinder = new _whs.Cylinder({\n geometry: {\n radiusTop: thickness / 2,\n radiusBottom: thickness / 2,\n height: cylinderLength\n },\n material: material,\n //geometry will be translated so that position is at pointA\n //pos: [pointA.x, pointA.y, pointA.z]\n position: [pointA.x, pointA.y, pointA.z]\n });\n //add to components\n this.components.push(cylinder);\n //shift geometry up, so that position is at beginning of vector\n cylinder.geometry.translate(0, cylinderLength / 2, 0);\n //update mesh\n //this.component.native = new Mesh(this.component.geometry, this.component.material);\n //align to vector\n this._alignToVector(cylinder, threeVector);\n\n //create cone (arrow) of vector\n cone = new _whs.Cone({\n geometry: {\n //radiusTop: thickness,\n //radiusBottom: thickness,\n radius: thickness,\n height: coneLength\n },\n material: material,\n //geometry will be translated so that position is at pointB\n //pos: [pointA.x, pointA.y, pointA.z]\n position: [pointB.x, pointB.y, pointB.z]\n });\n //add to components\n this.components.push(cone);\n //shift geometry down, so that position is at end of vector\n cone.geometry.translate(0, -coneLength / 2, 0);\n //update mesh\n //this.component.native = new Mesh(this.component.geometry, this.component.material);\n //align to vector\n this._alignToVector(cone, threeVector);\n }", "function drawcylinder(gl,canvas,a_Position,r,s,x1,y1,x2,y2,numpolyline){\r\n Acolor = 1 - (numpolyline/255) \r\n // ** DRAW CYLINDERS **\r\n //\r\n // multiply degrees by convert to get value in radians \r\n // a circle is 360 degrees, rotate by (360 / s) degrees for every side, where n is number of sides!\r\n let convert = Math.PI/180 \r\n let numsides = 360/s\r\n\r\n // get the angle that the line segment forms\r\n let deltaX = x2-x1\r\n let deltaY = y2-y1 \r\n let degreeToRotate = Math.atan2(deltaY,deltaX)\r\n degreeToRotate = ((2* Math.PI)-degreeToRotate)\r\n \r\n // first we'll draw a circle by rotating around the x axis, then use a transformation matrix to rotate it\r\n // by the angle we found previously so the circle fits around the axis formed by the line segment\r\n let unrotated = []\r\n\r\n for (var i=0 ; i <=360; i+=numsides){ \r\n unrotated.push(0)\r\n unrotated.push((Math.cos(convert*i))*r)\r\n unrotated.push(Math.sin(convert*i)*r)\r\n } \r\n let cylinder_points = [] \r\n let indices = []\r\n let colors = []\r\n let normie = []\r\n //first circle\r\n for (var i = 0 ; i < unrotated.length; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[i+2])\r\n }\r\n\r\n // second circle\r\n for (var i = 0 ; i < unrotated.length; i+=3){\r\n cylinder_points.push((unrotated[i] * Math.cos(degreeToRotate)) + (unrotated[i+1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[i+1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[i+2])\r\n }\r\n\r\n \r\n //calculate face normals from cylinder points \r\n let cylindernormals = calcnormals(gl,canvas,a_Position,r,s,x1,y1,x2,y2,cylinder_points) \r\n // n+1th normal (the point that comes after the last point is the same as the first point) \r\n cylindernormals.push(cylindernormals[0])\r\n cylindernormals.push(cylindernormals[1])\r\n cylindernormals.push(cylindernormals[2])\r\n cylinder_points = []\r\n colors = []\r\n \r\n cylinder_points.push((unrotated[0] * Math.cos(degreeToRotate)) + (unrotated[1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[0] * (-1 * Math.sin(degreeToRotate))) + (unrotated[1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[2])\r\n normie.push((cylindernormals[0]+cylindernormals[27]) / 2)\r\n normie.push((cylindernormals[1]+cylindernormals[28]) / 2)\r\n normie.push((cylindernormals[2]+cylindernormals[29]) / 2)\r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n\r\n\r\n for (var i = 1 ; i < s+1; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cylinder_points.push(unrotated[3*i+2])\r\n normie.push((cylindernormals[3*i]+cylindernormals[3*(i-1)])/2) \r\n normie.push((cylindernormals[3*i+1]+cylindernormals[3*(i-1)+1])/2) \r\n normie.push((cylindernormals[3*i+2]+cylindernormals[3*(i-1)+2])/2) \r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n }\r\n // second circle\r\n cylinder_points.push((unrotated[0] * Math.cos(degreeToRotate)) + (unrotated[1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[0] * (-1 * Math.sin(degreeToRotate))) + (unrotated[1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[2])\r\n normie.push((cylindernormals[0]+cylindernormals[27]) / 2)\r\n normie.push((cylindernormals[1]+cylindernormals[28]) / 2)\r\n normie.push((cylindernormals[2]+cylindernormals[29]) / 2)\r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n for (var i = 1 ; i < s+1; i++){\r\n cylinder_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n cylinder_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n cylinder_points.push(unrotated[3*i+2])\r\n normie.push((cylindernormals[3*i]+cylindernormals[3*(i-1)])/2) \r\n normie.push((cylindernormals[3*i+1]+cylindernormals[3*(i-1)+1])/2) \r\n normie.push((cylindernormals[3*i+2]+cylindernormals[3*(i-1)+2])/2) \r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n }\r\n\r\n // 2 points to represent the center\r\n cylinder_points.push(x2) \r\n cylinder_points.push(y2)\r\n cylinder_points.push(0)\r\n colors.push(Rcolor)\r\n colors.push(Gcolor)\r\n colors.push(Bcolor)\r\n colors.push(Acolor)\r\n\r\n let len = cylinder_points.length/6\r\n // cool traiangles\r\n for (var i=0 ; i < s; i++){\r\n indices.push(i)\r\n indices.push(i+1) \r\n indices.push(len+i)\r\n indices.push(i)\r\n \r\n indices.push(i+1)\r\n indices.push(i)\r\n indices.push(len+i+1)\r\n indices.push(i+1)\r\n\r\n indices.push(len+i+1)\r\n indices.push(len+i) \r\n indices.push(i+1)\r\n indices.push(len+i+1)\r\n }\r\n\r\n var n = initVertexBuffers(gl,cylinder_points,colors,normie,indices)\r\n if (n<0){\r\n console.log('failed to set vert info')\r\n return\r\n }\r\n // Set the clear color and enable the depth test\r\n gl.enable(gl.DEPTH_TEST);\r\n initAttrib(gl,canvas,numpolyline)\r\n\r\n //draw the cylinder!\r\n gl.drawElements(gl.TRIANGLES, n, gl.UNSIGNED_BYTE, 0);\r\n \r\n\r\n // ** DRAW CAP **\r\n // (FOR SMOOTH EDGES) \r\n let cap_points = []\r\n if (previousFace.length < 1){\r\n // second circle\r\n for (var i = 0 ; i < s+1 ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n }\r\n return\r\n } \r\n for (var j=0 ; j < previousFace.length ;j++){\r\n cap_points.push(previousFace[j]) \r\n }\r\n previousFace = []\r\n for (var i = 0 ; i < s+1 ; i++){\r\n cap_points.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x1) \r\n cap_points.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y1)\r\n cap_points.push(unrotated[3*i+2])\r\n }\r\n for (var i = 0 ; i < s+1 ; i++){\r\n previousFace.push((unrotated[3*i] * Math.cos(degreeToRotate)) + (unrotated[3*i+1] * Math.sin(degreeToRotate)) + x2) \r\n previousFace.push((unrotated[3*i] * (-1 * Math.sin(degreeToRotate))) + (unrotated[3*i+1] * Math.cos(degreeToRotate)) + y2)\r\n previousFace.push(unrotated[3*i+2])\r\n }\r\n var capvertices = new Float32Array(cap_points)\r\n let caplen = capvertices.length/14;\r\n if (caplen === 0)\r\n return\r\n var n = initVertexBuffers(gl,capvertices,colors,normie,indices)\r\n if (n<0){\r\n console.log('failed to set vert info')\r\n return\r\n }\r\n // Set the clear color and enable the depth test\r\n gl.enable(gl.DEPTH_TEST);\r\n initAttrib(gl,canvas,numpolyline)\r\n //draw the cylinder!\r\n gl.drawElements(gl.TRIANGLES, n, gl.UNSIGNED_BYTE, 0);\r\n}", "function addVerticalCylinder(obj, x, y, z, s) {\n 'use strict';\n\n geometry = new THREE.CylinderGeometry(0.5, 0.5, 10 * s, 32);\n mesh = new THREE.Mesh(geometry, material);\n \n mesh.position.set(x, y, z);\n obj.add(mesh);\n}", "perpendicular() {\n\t\tlet x = this.y;\n\t\tlet y = 0 - this.x;\n\t\t\n\t\treturn new Vector(x, y);\n\t}", "function cylinderCurve(t) {\n return 1\n}", "function drawCylinder() {\n setMV();\n Cylinder.draw();\n}", "function drawCylinder() {\n setMV();\n Cylinder.draw();\n}", "function vector2d(x, y) {\n this.x = x;\n this.y = y;\n}", "function Cylinder(color){\n this.color = color;\n this.trs = mat4();\n}", "circumcenter(ax, ay, bx, by, cx, cy) \n {\n bx -= ax;\n by -= ay;\n cx -= ax;\n cy -= ay;\n\n var bl = bx * bx + by * by;\n var cl = cx * cx + cy * cy;\n\n var d = bx * cy - by * cx;\n\n var x = (cy * bl - by * cl) * 0.5 / d;\n var y = (bx * cl - cx * bl) * 0.5 / d;\n\n return {\n x: ax + x,\n y: ay + y\n };\n }", "function UnitVector(x, y) {\n this.x = x;\n this.y = y;\n this.axis = undefined;\n this.slope = y / x;\n this.normalSlope = -x / y;\n Object.freeze(this);\n}", "function UnitVector(x, y) {\n this.x = x;\n this.y = y;\n this.axis = undefined;\n this.slope = y / x;\n this.normalSlope = -x / y;\n Object.freeze(this);\n}", "function UnitVector(x, y) {\n this.x = x;\n this.y = y;\n this.axis = undefined;\n this.slope = y / x;\n this.normalSlope = -x / y;\n Object.freeze(this);\n }", "function m_modVec(v) //objet x, y\n{\n return Math.sqrt(v.x*v.x + v.y*v.y);\n}", "function prepare(vector){var vertex=vector.normalize().clone();vertex.index=that.vertices.push(vertex)-1;// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\nvar u=azimuth(vector)/2/Math.PI+0.5;var v=inclination(vector)/Math.PI+0.5;vertex.uv=new THREE.Vector2(u,1-v);return vertex;}// Approximate a curved face with recursively sub-divided triangles.", "function getCylinderData(c) {\n // indices for colorList\n var mod = colorList.length;\n var j1, j2, j3;\n j1 = c;\n j2 = j1 + 1;\n j3 = j2 + 1;\n\n // Number of divisions for the circumference of the cylinder\n var NumSides = 72;\n // coords for the top and bot faces of the cylinder\n var x1, z1;\n var x2, z2;\n var y;\n // Increments of the angle based on NumSides\n var angle = 0;\n var inc = Math.PI * 2.0 / NumSides;\n\n //var points = new Array(NumSides * 6);\n //var colors = new Array(NumSides * 6);\n var topPoints = [];\n var topColors = [];\n var topNormals = [];\n\n var botPoints = [];\n var botColors = [];\n var botNormals = [];\n\n var points = [];\n var colors = [];\n var normals = [];\n\n // Currently calculated normal in the forloop\n var currNormal;\n // Normals for the bottom and top of the cylinder\n var up = [0, 1, 0];\n var down = [0, -1, 0];\n\n // coords for the center points of the bases\n x = 0;\n y = baseHeight;\n z = 0;\n\n // top base center point\n topPoints.push(x,y,z);\n topColors.push(colorList[j1], colorList[j2], colorList[j3]);\n topNormals.push(up[0], up[1], up[2]);\n\n // bot base center point\n botPoints.push(x,-y,z);\n botColors.push(colorList[j1], colorList[j2], colorList[j3]);\n botNormals.push(down[0], down[1], down[2]);\n\n // For each 'cut' of the side, add its point and color data\n for(var i=0; i < NumSides; ++i) {\n // indices for colorList\n //j1 = i % mod;\n //j2 = i+1 % mod;\n //j3 = i+2 % mod;\n\n // x,z coords for the left half of a side\n x1 = baseRadius * Math.cos(angle);\n z1 = baseRadius * Math.sin(angle);\n // x,z coords for the right half of a side\n angle += inc;\n x2 = baseRadius * Math.cos(angle);\n z2 = baseRadius * Math.sin(angle);\n\n y = baseHeight; // For now, arbitrary; change it to something later\n\n // Side vertices -----------------------------------------#\n // First triangle\n // top left vertex\n points.push(x1 * TopRadius, y, z1* TopRadius);\n colors.push(colorList[j1], colorList[j2], colorList[j3]);\n // top right vertex\n points.push(x2* TopRadius, y, z2* TopRadius);\n colors.push(colorList[j1], colorList[j2], colorList[j3]);\n // bot left vertex\n points.push(x1* BotRadius, -y, z1* BotRadius);\n colors.push(colorList[j1], colorList[j2], colorList[j3]);\n \n // Compute normals for this slice\n // cross(top left, top right)\n currNormal = m4.cross([x1 * TopRadius, y, z1* TopRadius], \n [x2* TopRadius, y, z2* TopRadius]);\n normals.push(currNormal[0], currNormal[1], currNormal[2]);\n normals.push(currNormal[0], currNormal[1], currNormal[2]);\n normals.push(currNormal[0], currNormal[1], currNormal[2]);\n \n // Second triangle\n // top right vertex\n points.push(x2* TopRadius, y, z2* TopRadius);\n colors.push(colorList[j1], colorList[j2], colorList[j3]);\n // bot right vertex\n points.push(x2* BotRadius, -y, z2* BotRadius);\n colors.push(colorList[j1], colorList[j2], colorList[j3]);\n // bot left vertex\n points.push(x1* BotRadius, -y, z1* BotRadius);\n colors.push(colorList[j1], colorList[j2], colorList[j3]);\n \n // Compute normals\n //currNormal = m4.cross([x2* TopRadius, y, z2* TopRadius], \n // [x1* BotRadius, -y, z1* BotRadius]);\n normals.push(currNormal[0], currNormal[1], currNormal[2]);\n normals.push(currNormal[0], currNormal[1], currNormal[2]);\n normals.push(currNormal[0], currNormal[1], currNormal[2]);\n \n\n // Top base vertex ---------------------------------------#\n // top left vertex\n topPoints.push(z1 * TopRadius, y, x1 * TopRadius);\n topColors.push(colorList[j1], colorList[j2], colorList[j3]);\n topNormals.push(up[0], up[1], up[2]);\n\n // Bot base vertex ---------------------------------------#\n // bot left vertex\n botPoints.push(x1 * BotRadius, -y, z1 * BotRadius);\n botColors.push(colorList[j1], colorList[j2], colorList[j3]);\n botNormals.push(down[0], down[1], down[2]);\n }\n\n // Define final vertices coords\n angle += inc;\n x1 = baseRadius * Math.cos(angle);\n z1 = baseRadius * Math.sin(angle);\n // Final vertex for top base\n topPoints.push(z1 * TopRadius, y, x1 * TopRadius);\n topColors.push(colorList[j1], colorList[j2], colorList[j3]);\n topNormals.push(up[0], up[1], up[2]);\n // Final vertex for bot base\n botPoints.push(x1 * BotRadius, -y, z1 * BotRadius);\n botColors.push(colorList[j1], colorList[j2], colorList[j3]);\n botNormals.push(down[0], down[1], down[2]);\n\n // Put all the data together\n var CylinderData = {\n points,\n colors,\n normals,\n sideLength: points.length / 3,\n baseLength: topPoints.length / 3,\n fullLength: 0,\n }\n\n points = points.concat(topPoints);\n points = points.concat(botPoints);\n colors = colors.concat(topColors);\n colors = colors.concat(botColors);\n normals = normals.concat(topNormals);\n normals = normals.concat(botNormals);\n\n CylinderData.points = points;\n CylinderData.colors = colors;\n CylinderData.normals = normals;\n CylinderData.fullLength = points.length / 3;\n\n return CylinderData;\n}", "function vector(ctx, color, origin, vector, scale) {\n if (scale === void 0) { scale = 1.0; }\n var c = color ? color.toString() : 'blue';\n var v = vector.scale(scale);\n ctx.beginPath();\n ctx.strokeStyle = c;\n ctx.moveTo(origin.x, origin.y);\n ctx.lineTo(origin.x + v.x, origin.y + v.y);\n ctx.closePath();\n ctx.stroke();\n}", "function createPipe(v1, v2, thickness, radiusSegments, heightSegments, material ) {\r\n // edge from X to Y\r\n var direction = new THREE.Vector3().subVectors( v2, v1 ).normalize();\r\n var height = v1.distanceTo( v2);\r\n var pos = new THREE.Vector3( v1.x - (v1.x-v2.x)*0.5, v1.y - (v1.y-v2.y)*0.5, v1.z - (v1.z-v2.z)*0.5);\r\n var arrow = new THREE.ArrowHelper( direction, v1 );\r\n\r\n var geometry = new THREE.CylinderGeometry( thickness, thickness, height, radiusSegments, heightSegments, true /*open ended*/ );\r\n\r\n var mesh = new THREE.Mesh( geometry, material);\r\n\r\n mesh.rotation.copy( arrow.rotation);\r\n mesh.position.copy( pos);\r\n\r\n return mesh;\r\n}", "function makeCylinder (radialDivision, heightDivision){\n // fill in your code here.\n var heightDivTransformed = 1 / heightDivision;\n var rads = radians(360);\n var radDivision = rads / radialDivision;\n var start = 0.5;\n var radius = 0.5;\n // makes the base of the cylinder at the top \n baseMaker(radDivision, rads, 0.5, true);\n for (var yCoor = -start; yCoor <= start - (heightDivTransformed / 2); yCoor += heightDivTransformed) {\n for (var unit = 0; unit <= rads; unit += radDivision) {\n addTriangle(radius * Math.cos(unit + radDivision), yCoor, radius * Math.sin(unit + radDivision),\n radius * Math.cos(unit), yCoor, radius * Math.sin(unit),\n radius * Math.cos(unit), yCoor + heightDivTransformed, radius * Math.sin(unit));\n addTriangle(radius * Math.cos(unit + radDivision), yCoor, radius * Math.sin(unit + radDivision),\n radius * Math.cos(unit), yCoor + heightDivTransformed, radius * Math.sin(unit),\n radius * Math.cos(unit + radDivision), yCoor + heightDivTransformed, radius * Math.sin(unit + radDivision));\n }\n }\n}", "function normalTo(vec){\r\n return {x: vec.y, y: -vec.x};\r\n}", "function cylinder() {\n\n}", "function vertex(point) {\n var lambda = (point[0] * Math.PI) / 180,\n phi = (point[1] * Math.PI) / 180,\n cosPhi = Math.cos(phi);\n return new THREE.Vector3(\n radius * cosPhi * Math.cos(lambda),\n radius * cosPhi * Math.sin(lambda),\n radius * Math.sin(phi)\n );\n }", "function addHorizontalCylinder(obj, x, y, z, s) {\n 'use strict';\n\n geometry = new THREE.CylinderGeometry(0.5, 0.5, 10 * s, 32);\n mesh = new THREE.Mesh(geometry,material);\n\n mesh.position.set(x, y, z);\n mesh.rotation.z += Math.PI / 2;\n obj.add(mesh);\n}", "function vec(x, y) {\n return new Vector(x, y);\n}", "function prepare(vector){var vertex=vector.normalize().clone();vertex.index = that.vertices.push(vertex) - 1; // Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\tvar u=azimuth(vector) / 2 / Math.PI + 0.5;var v=inclination(vector) / Math.PI + 0.5;vertex.uv = new THREE.Vector2(u,1 - v);return vertex;} // Approximate a curved face with recursively sub-divided triangles.", "constructor(centre, axis, radius, halfHeight, convex, baseColour, material) {\r\n\t\tsuper();\r\n\t\t\r\n\t\tthis.type = 'cylinder';\r\n\t\tthis.centre = centre;\r\n\t\tthis.axis = vecNormalize(axis);\r\n\t\tthis.radius = radius;\r\n\t\tthis.halfHeight = halfHeight;\r\n\t\tthis.convex = convex;\t// if true, surface points away from centre\r\n\t\tthis.baseColour = baseColour || COL_WHITE;\r\n\t\tthis.material = material;\r\n\t}", "function Cylinder(cyl_heig, cyl_dia) {\n this.cyl_heig = cyl_heig;\n this.cyl_dia = cyl_dia;\n}", "function tri_cylinder(a, b, c) {\r\n var t1 = subtract(vertices[b], vertices[a]);\r\n var t2 = subtract(vertices[c], vertices[b]);\r\n var normal = normalize(cross(t1, t2));\r\n normal = vec3(normal);\r\n var tangent = vec3(t1[0], t1[1], t1[2]);\r\n\r\n positionsArray.push(vertices[a]);\r\n normalsArray.push(normal);\r\n texCoordsArray.push(texCoord[4]);\r\n emissionsArray.push(vec3(3.0, 3.0, 3.0));\r\n tangentsArray.push(tangent);\r\n positionsArray.push(vertices[b]);\r\n normalsArray.push(normal);\r\n texCoordsArray.push(texCoord[5]);\r\n emissionsArray.push(vec3(3.0, 3.0, 3.0));\r\n tangentsArray.push(tangent);\r\n positionsArray.push(vertices[c]);\r\n normalsArray.push(normal);\r\n texCoordsArray.push(texCoord[6]);\r\n emissionsArray.push(vec3(3.0, 3.0, 3.0));\r\n tangentsArray.push(tangent);\r\n }", "function createVector(x, y) {\n const vec = {\n x: x,\n y: y\n };\n return vec;\n }", "static getVecFromRadians( phi ) {\n\t\tphi -= Math.PI / 2;\n\t\treturn new Vec2D(Math.cos(phi), Math.sin(phi));\n\t}", "function cylinder(spec) {\n let { radius, height } = spec;\n if (!radius) { radius = 1; }\n if (!height) { height = 1; }\n const surfaceArea = () => (2 * Math.PI * radius * height) + (2 * Math.PI * (radius ** 2));\n const volume = () => (Math.PI * (radius ** 2) * height);\n const stretch = (factor) => { height *= factor; };\n const widen = (factor) => { radius *= factor; };\n const toString = () => `cylinder with radius ${radius} and height ${height}`;\n\n return Object.freeze({\n volume,\n surfaceArea,\n widen,\n stretch,\n toString,\n get radius() { return radius; },\n get height() { return height; },\n });\n}", "function getUnitVector(x, y) {\n var d = Math.sqrt(x * x + y * y);\n\n x /= d;\n y /= d;\n\n if (x === 1 && y === 0) {\n return xUnitVector;\n } else if (x === 0 && y === 1) {\n return yUnitVector;\n } else {\n return new UnitVector(x, y);\n }\n }", "function createPipeUsingCylinder(locationStart, locationEnd, label) {\n //Adds a pipe from locationX to locationY\n var cylinder = new THREE.Mesh(new THREE.CylinderGeometry(5, 5, 200, 50, 50, false), \n\t\t\t\t new THREE.MeshBasicMaterial({ color: 0xff0000}));\n cylinder.overdraw = true;\n // The rotation will make sure that we have a diagram where blocks are added on x axis\n cylinder.rotation.x = Math.PI / 2;\n cylinder.rotation.z = Math.PI / 2; \t\t\t\t\t\t\t\t\n cylinder.visible = true;\n cylinder.position.x = (locationStart.x - locationEnd.x)/2;\n cylinder.position.y = (locationStart.y - locationEnd.y)/2;\n cylinder.position.z = (locationStart.z - locationEnd.z)/2;\n\t\n var labelMesh = new THREE.Mesh(new THREE.TextGeometry(label,\n\t\t\t\t\t\t\t{size: 12,\n\t\t\t\t\t\t\t height: 4,\n\t\t\t\t\t\t\t curveSegments: 0\n\t\t\t\t\t\t\t}), new THREE.MeshNormalMaterial());\n labelMesh.lookAt(camera.position);\n labelMesh.position.x = cylinder.position.x;\n labelMesh.position.y = cylinder.position.y + 50;\n labelMesh.position.z = cylinder.position.z;\n\t\t\t\t\t\t\t\n return [cylinder, labelMesh];\n}", "function Cushion( x, y, direction, depth,length ) {\n var p = new Polygon( new Vector(x,y) );\n var sqrt2 = Math.SQRT2;\n var pi = Math.PI;\n\n\n\n p.line( depth* 2, direction + Math.PI* 0.25 );\n p.line( 1 - length * depth/sqrt2, direction );\n p.line( depth* 2 , direction - Math.PI* 0.25);\n\n this.polygon = p;\n}", "function createCylinder(radiusTop, radiusBottom, height, radialSegments, color,\n x, y, z) {\n var geom = new THREE.CylinderGeometry(radiusTop, radiusBottom, height, radialSegments);\n var mat = new THREE.MeshPhongMaterial({color:color, flatShading: true});\n var cylinder = new THREE.Mesh(geom, mat);\n cylinder.castShadow = true;\n cylinder.receiveShadow = true;\n cylinder.position.set( x, y, z );\n return cylinder;\n}", "function rotateCartesian(vector, axis, angle) {\n\t var angleRads = angle * radians,\n\t vectorOut = vector.slice(),\n\t ax1 = (axis === 0) ? 1 : 0,\n\t ax2 = (axis === 2) ? 1 : 2,\n\t cosa = Math.cos(angleRads),\n\t sina = Math.sin(angleRads);\n\t\n\t vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina;\n\t vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina;\n\t\n\t return vectorOut;\n\t}", "function rotateCartesian(vector, axis, angle) {\n\t var angleRads = angle * radians,\n\t vectorOut = vector.slice(),\n\t ax1 = (axis === 0) ? 1 : 0,\n\t ax2 = (axis === 2) ? 1 : 2,\n\t cosa = Math.cos(angleRads),\n\t sina = Math.sin(angleRads);\n\t\n\t vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina;\n\t vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina;\n\t\n\t return vectorOut;\n\t}", "function rotateCartesian(vector, axis, angle) {\n var angleRads = angle * radians,\n vectorOut = vector.slice(),\n ax1 = (axis === 0) ? 1 : 0,\n ax2 = (axis === 2) ? 1 : 2,\n cosa = Math.cos(angleRads),\n sina = Math.sin(angleRads);\n\n vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina;\n vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina;\n\n return vectorOut;\n}", "function Vector(x_,y_) {\r this.x = x_;\r this.y = y_;\r}", "function cylinderDerivative(t) {\n return 0\n}", "function example005 () {\n var cy = [];\n for (var i = 0; i <= 5; i++) {\n cy[i] = translate([sin(360 * i / 6) * 80, cos(360 * i / 6) * 80, 0], cylinder({h: 200, r: 10}));\n }\n return translate([0, 0, -120],\n union(\n difference(\n cylinder({h: 50, r: 100}),\n translate([0, 0, 10], cylinder({h: 50, r: 80})),\n translate([100, 0, 35], cube({size: 50, center: true}))\n ),\n cy,\n translate([0, 0, 200], cylinder({h: 80, r1: 120, r2: 0}))\n )\n );\n}", "getVec(theta, phi, d)\n {\n d = d || 1.0;\n theta = Math.PI/2 - theta;\n var v = new THREE.Vector3();\n v.x = d * Math.sin( phi ) * Math.cos( theta );\n v.y = d * Math.cos( phi );\n v.z = d * Math.sin( phi ) * Math.sin( theta );\n return v;\n }", "norm(vec) \n { \n let mag = Math.sqrt(vec.x*vec.x + vec.y*vec.y);\n let multiplier = 1/mag;\n return {\n x: vec.x * multiplier,\n y: vec.y * multiplier\n };\n }", "function Vector(x,y){\n return new vector(x,y);\n}", "function Vector(x, y) {\n this.x = x;\n this.y = y;\n}", "function Vector(x, y) {\n this.x = x;\n this.y = y;\n}", "function Vector(x, y) {\n this.x = x;\n this.y = y;\n}", "function Vector(x, y) {\n this.x = x; this.y = y;\n}", "function Vector (x, y) {\n this.x = x;\n this.y = y;\n}", "function getUnitVector(x, y) {\n var d = Math.sqrt(x * x + y * y);\n\n x /= d;\n y /= d;\n\n if (x === 1 && y === 0) return xUnitVector;\n else if (x === 0 && y === 1) return yUnitVector;\n else return new UnitVector(x, y);\n}", "function Vector(x, y) {\n this.x = x;\n this.y = y;\n}", "function prepare( vector ) {\n\n\t \t\tvar vertex = vector.normalize().clone();\n\t \t\tvertex.index = that.vertices.push( vertex ) - 1;\n\n\t \t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\n\t \t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\n\t \t\tvar v = inclination( vector ) / Math.PI + 0.5;\n\t \t\tvertex.uv = new Vector2( u, 1 - v );\n\n\t \t\treturn vertex;\n\n\t \t}", "function Vector(x, y){\n this.x = x;\n this.y = y;\n}", "function init () {\n var canvas = document.getElementById('canvas'),\n ctx = canvas.getContext('2d');\n\n var vector2d = function (x, y) {\n var vec = {\n\n // x and y components of vector stored in vx,vy.\n vx: x,\n vy: y,\n\n // scale() method allows us to scale the vector either up or down.\n scale: function (scale) {\n vec.vx *= scale;\n vec.vy *= scale;\n },\n\n // add() method adds a vector.\n add: function (vec2) {\n vec.vx += vec2.vx;\n vec.vy += vec2.vy;\n },\n\n // sub() method subtracts a vector.\n sub: function (vec2) {\n vec.vx -= vec2.vx;\n vec.vy -= vec2.vy;\n },\n\n // negate() method points the vector in the opposite direction.\n negate: function () {\n vec.vx = -vec.vx;\n vec.vy = -vec.vy;\n },\n\n // length() method returns the length of the vector using Pythagoras.\n length: function () {\n return Math.sqrt(vec.vx * vec.vx + vec.vy * vec.vy);\n },\n\n // A faster length calculation that returns the length squared.\n // Useful if all you want to know is that one vector is longer than another.\n lengthSquared: function () {\n return vec.vx * vec.vx + vec.vy * vec.vy;\n },\n\n // normalize() method turns the vector into a unit length vector // pointing in the same direction.\n normalize: function () {\n var len = Math.sqrt(vec.vx * vec.vx + vec.vy * vec.vy);\n if (len) {\n vec.vx /= len;\n vec.vy /= len;\n }\n\n // As we have already calculated the length, it might as well be // returned, as it may be useful.\n return len;\n },\n\n // Rotates the vector by an angle specified in radians.\n rotate: function (angle) {\n var vx = vec.vx,\n vy = vec.vy,\n cosVal = Math.cos(angle),\n sinVal = Math.sin(angle);\n\n vec.vx = vx * cosVal - vy * sinVal;\n vec.vy = vx * sinVal + vy * cosVal;\n },\n\n // toString() is a utility function for displaying the vector as text, // a useful debugging aid.\n toString: function () {\n return '(' + vec.vx.toFixed(3) + ',' + vec.vy.toFixed(3) + ')'; }\n };\n\n return vec;\n };\n\n // This is the main loop that moves and draws everything.\n setInterval( function() {\n\n },30);\n }", "function Vector2d(x, y) {\r\n\tthis.x = parseInt(x);\r\n\tthis.y = parseInt(y);\r\n}", "toRadians() {\n\t\tif (this.y == 0 && this.x == 0) {\n\t\t\treturn 0; //special case, zero length vector\n\t\t}\n\t\treturn Math.atan2 ( this.y, this.x ) + Math.PI / 2;\n\t}", "function calcVelocity(angle, velocity) {\n // handling in between\n // /|\n // v/ | y\n // /o |\n // ____\n // x\n // x = cos (o) * v\n // y = sin (o) * v\n\n var newAngle = toRadians(angle);\n console.log(newAngle);\n var x = Math.cos(newAngle) * velocity;\n var y = Math.sin(newAngle) * velocity;\n return [x,y];\n}", "get cylinder() {\n\t\treturn this.__cylinder;\n\t}", "function addFlatCylinder(obj, x, y, z, s) {\n 'use strict';\n\n geometry = new THREE.CylinderGeometry(3 * s, 3 * s, 0.5, 12);\n mesh= new THREE.Mesh(geometry, material);\n\n mesh.position.set(x, y, z);\n mesh.rotation.x += Math.PI / 2;\n obj.add(mesh);\n}", "crossProduct(point) {\n let result = new Vector3();\n result.setXYZ(this.y * point.z - this.z * point.y, this.z * point.x - this.x * point.z, this.x * point.y - this.y * point.x);\n return result;\n }", "function Vector(x, y) {\n\n this.x = x; this.y = y;\n\n}", "function Vector2D(x, y) {\n this.x = x;\n this.y = y;\n }", "function vector(P1, P2) {\n var x1 = P1[0];\n var y1 = P1[1];\n var x2 = P2[0];\n var y2 = P2[1];\n var v = [x2-x1, y2-y1];\n return v;\n}", "function getUnitVector(x, y) {\n const d = Math.sqrt(x * x + y * y);\n\n x /= d;\n y /= d;\n\n if (x === 1 && y === 0) return xUnitVector;\n else if (x === 0 && y === 1) return yUnitVector;\n else return new UnitVector(x, y);\n}", "function drawCircle(x1, y1, x2, y2) {\n var circleVertices = [];\n var inc = 2 * Math.PI / 50;\n var radius = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n for (var theta = 0; theta < 2 * Math.PI; theta += inc) {\n circleVertices.push(vec2(radius * Math.cos(theta) + x1, radius * Math.sin(theta) + y1));\n }\n return circleVertices;\n}", "function vector(angle, radius) {\n const offset = (angle === 30) ? [1, 2] : (angle === 90) ? [2, 0] : (angle === 120) ? [1, -2] : null;\n offset.forEach(function(value, i) { offset[i] *= radius; });\n return offset;\n}", "function cosVectorVector(a, b) {\n function scp(a, b) {\n return a.x * b.x + a.y * b.y + a.z * b.z;\n }\n function norm(v) {\n return Math.sqrt(scp(v, v));\n }\n return scp(a, b) / (norm(a) * norm(b));\n}", "function perp( v ) {\n let theta = -90 * Math.PI / 180;\n let cs = Math.cos(theta);\n let sn = Math.sin(theta);\n return {\n x: v.x * cs - v.y * sn,\n y: v.x * sn + v.y * cs,\n }\n}", "function snapCylinder( point1, point2, radius = snapRadius, parent = scene ) {\n\t\n\tthis.cylinder = cylinderBetweenPoints( point1, point2, snapRadius, false );\n\t\n\tthis.cylinder.isSnapObj = true;\n\tthis.cylinder.isSnapCylinder = true;\n\tthis.cylinder.snapOn = true;\n\t\n\tthis.cylinder.snapIntensity = globalAppSettings.snapIntensity.snapCylinder;\n\t\n//\tthis.cylinder.referent = this;\t\n\t\n\tparent.add( this.cylinder );\n}", "function circle_verts(steps, x, y)\r\n{\r\n var vert_qty = steps + 2; \r\n var step_arc = 360 / steps;\r\n var angle = 0;\r\n var radius = 0.5;\r\n\r\n var circle = [ 0.0, 0.0 ];\r\n\r\n // Step through the circle calculating coords one vert at a time.\r\n for( var vert_cur = 1; vert_cur < vert_qty; vert_cur++ )\r\n {\r\n var i = vert_cur * 2;\r\n var theta = (Math.PI / 180.0) * angle; // Winners use radians...\r\n\r\n // Convert from polar to cartesian coordinates and store point.\r\n circle.push(radius * Math.cos(theta)) + x;\r\n circle.push(radius * Math.sin(theta)) + y;\r\n\r\n angle = angle + step_arc; // Update angle for next itteration.\r\n }\r\n\r\n return new Float32Array(circle);\r\n}", "function find_sector(in_x,in_y) {\n let output = new Vector2();\n if (in_x < canvas_size.x && in_x != 0 && in_y < canvas_size.y && in_y != 0) {\n output.x = floor(4 * in_x/canvas_size.x);\n output.y = floor(4 * in_y/canvas_size.y);\n } else {\n output.x = -1;\n output.y = -1;\n }\n return output;\n}", "function v(x,y,z){\n return new THREE.Vector3(x,y,z);\n }", "function main(params) {\n var cone = CSG.cylinder({\n start: [0, params.length, 0],\n end: [0, 0, 0],\n radiusStart: params.c1,\n radiusEnd: params.c2,\n resolution: params.resolution\n });\n cone = hollowOutInside(cone, params);\n return cone;\n}", "function Vector(x, y){\n\tthis.x = x;\n\tthis.y = y;\n}", "function Vector(x, y){\n\tthis.x = x;\n\tthis.y = y;\n}", "cross(vector) {\n return this.x * vector.y - this.y * vector.x;\n }", "function Vector(x, y) {\n if (Array.isArray(x)) {\n this.x = x[0] || 0;\n this.y = x[1] || 0;\n } else if (typeof x === \"object\") {\n this.x = x.x || 0;\n this.y = x.y || 0;\n } else {\n this.x = x || 0;\n this.y = y || 0;\n }\n }", "function prepare( vector ) {\r\n\r\n\t\tvar vertex = vector.normalize().clone();\r\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\r\n\r\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\r\n\r\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\r\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\r\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\r\n\r\n\t\treturn vertex;\r\n\r\n\t}", "function prepare( vector ) {\r\n\r\n\t\tvar vertex = vector.normalize().clone();\r\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\r\n\r\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\r\n\r\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\r\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\r\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\r\n\r\n\t\treturn vertex;\r\n\r\n\t}", "function Vector2D(X, Y) {\n this.X = X;\n this.Y = Y;\n }", "function Cylindrical( radius, theta, y ) {\n\n\tthis.radius = ( radius !== undefined ) ? radius : 1.0; // distance from the origin to a point in the x-z plane\n\tthis.theta = ( theta !== undefined ) ? theta : 0; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\tthis.y = ( y !== undefined ) ? y : 0; // height above the x-z plane\n\n\treturn this;\n\n}", "function Cylindrical( radius, theta, y ) {\n\n\tthis.radius = ( radius !== undefined ) ? radius : 1.0; // distance from the origin to a point in the x-z plane\n\tthis.theta = ( theta !== undefined ) ? theta : 0; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\tthis.y = ( y !== undefined ) ? y : 0; // height above the x-z plane\n\n\treturn this;\n\n}", "function prepare( vector ) {\n\n var vertex = vector.normalize().clone();\n vertex.index = that.vertices.push( vertex ) - 1;\n\n // Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\n var u = azimuth( vector ) / 2 / Math.PI + 0.5;\n var v = inclination( vector ) / Math.PI + 0.5;\n vertex.uv = new THREE.Vector2( u, 1 - v );\n\n return vertex;\n\n }", "function v(x, y, z) {\n return new THREE.Vector3(x, y, z);\n }", "function v(x, y, z) {\n return new THREE.Vector3(x, y, z);\n }", "function InfiniteCylinder3D( x , y , z , nx , ny , nz , r ) {\n\tthis.axis = new BoundVector3D( x , y , z , nx , ny , nz ).normalizeCheck() ;\n\tthis.r = + r ;\n}", "function polar2Cartesian(point){\n // Note that testing shows that there is potentially ~1e-7 rounding error\n return [point[0] * Math.cos(deg2rad(point[1])), point[0] * Math.sin(deg2rad(point[1]))];\n}", "static cartesianToPolar([x = 0, y = 0]) {\n\t\tconst r = Math.sqrt(x * x + y * y);\n\t\tconst radians = ArrayCoords.cartesianToRadians([x, y]);\n\t\tconst degrees = ArrayCoords.radiansToDegrees(radians);\n\t\treturn { r, radians, theta: radians, degrees };\n\t}", "function arcballVector(vector) {\n P = new THREE.Vector3;\n\n P.set( vector.x,vector.y, 0 ); \n\n OP_length = P.length();\n\n if (OP_length <= 1 ){\n P.z = Math.sqrt(1 - OP_length * OP_length);\n } else {\n P = P.normalize();\n }\n\n return P;\n}", "function prepare( vector ) {\r\n\r\n\t\t\tvar vertex = vector.normalize().clone();\r\n\t\t\tvertex.index = that.vertices.push( vertex ) - 1;\r\n\r\n\t\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\r\n\r\n\t\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\r\n\t\t\tvar v = inclination( vector ) / Math.PI + 0.5;\r\n\t\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\r\n\r\n\t\t\treturn vertex;\r\n\r\n\t\t}", "function orient2D(ax, ay, bx, by, cx, cy) {\n return determinant2D(ax - cx, ay - cy, bx - cx, by - cy);\n }", "constructor(x, y, value) {\n this.x = x\n this.y = y\n this.l = createVector(x,y)\n this.value = value\n }", "function scalar(scalar, vector){\r\n return {x: vector.x * scalar, y: vector.y * scalar}; \r\n}", "function prepare( vector ) {\n\n\t\tvar vertex = vector.normalize().clone();\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\n\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\n\n\t\treturn vertex;\n\n\t}", "function prepare( vector ) {\n\n\t\tvar vertex = vector.normalize().clone();\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\n\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\n\n\t\treturn vertex;\n\n\t}", "function prepare( vector ) {\n\n\t\tvar vertex = vector.normalize().clone();\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\n\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\n\n\t\treturn vertex;\n\n\t}", "function prepare( vector ) {\n\n\t\tvar vertex = vector.normalize().clone();\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\n\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\n\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\n\n\t\treturn vertex;\n\n\t}" ]
[ "0.6336584", "0.62820566", "0.62040854", "0.61241597", "0.60885936", "0.60264266", "0.59795725", "0.5966922", "0.596528", "0.596528", "0.5951377", "0.5938583", "0.58713025", "0.5854693", "0.5854693", "0.58434", "0.5820725", "0.5793484", "0.57743734", "0.5753707", "0.57500565", "0.57283616", "0.5725061", "0.5721581", "0.5714132", "0.57060194", "0.56966263", "0.5692427", "0.56791294", "0.56781715", "0.5675636", "0.56676614", "0.56475675", "0.56316364", "0.5614372", "0.56073713", "0.56045747", "0.560319", "0.56019896", "0.56019896", "0.559791", "0.5575593", "0.5562444", "0.55567217", "0.55419755", "0.5532323", "0.55277485", "0.55206573", "0.55206573", "0.55206573", "0.55181974", "0.5508575", "0.5508188", "0.55070853", "0.5506492", "0.54875934", "0.547578", "0.5473546", "0.5472655", "0.5471522", "0.54678726", "0.54636836", "0.5454539", "0.54515266", "0.54454494", "0.5431211", "0.54237425", "0.54189277", "0.5412604", "0.5409042", "0.5407929", "0.54078984", "0.5407304", "0.5407018", "0.54066736", "0.54020613", "0.53936285", "0.53936285", "0.5383145", "0.5375298", "0.5373316", "0.5373316", "0.53706163", "0.53682935", "0.53682935", "0.53672874", "0.5363376", "0.53616136", "0.53596914", "0.53578925", "0.5356381", "0.53523046", "0.53466934", "0.53466105", "0.53438723", "0.53433114", "0.5338674", "0.5338674", "0.5338674", "0.5338674" ]
0.63864774
0
set this to false to stop Spam of "Activated Robotrimp MagnetoShriek Ability" Finish Challenge2
function finishChallengeSquared() { // some checks done before reaching this: // getPageSetting('FinishC2')>0 && game.global.runningChallengeSquared var zone = getPageSetting('FinishC2'); if (game.global.world >= zone) { abandonChallenge(); debug("Finished challenge2 because we are on zone " + game.global.world, "other", 'oil'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shouldFarmHackingSkill() {\n return true;\n }", "function Claim()\r\n\t{\r\n\t\t//Show_Solution(Sudoku_Solution);\r\n\t\tfor(var i=0; i<3; i++)\r\n\t\t{\r\n\t\t\tfor(var j=0; j<3; j++)\r\n\t\t\t{\r\n\t\t\t\tif(Claiming(i,j))\r\n\t\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "function refuseIfAITurn() {\n if (playArea.hasClass('interaction-disabled')) {\n console.assert(currentPlayer === 2 && gameMode === 'ai', 'Interaction blocked unexpectedly');\n showError('Wait for your turn');\n return true;\n }\n}", "unlocked(){return hasChallenge(\"燃料\",11)}", "unlocked(){return hasChallenge(\"燃料\",11)}", "function AttackScript() {\n\tGM_setValue(\"autoUse\",1);\r\n\tGM_setValue(\"cancelAtEnd\",1);\n\tdocument.forms.namedItem(\"attack\").submit('tack');\r\n\t}", "function challenge2() {\n\n}", "function C012_AfterClass_Amanda_TestSub() {\n\tif (!ActorIsGagged()) {\n\t\tif (ActorGetValue(ActorSubmission) <= -20) {\n\t\t\tC012_AfterClass_Amanda_CurrentStage = 300;\n\t\t\tOverridenIntroText = \"\";\n\t\t}\n\t} else C012_AfterClass_Amanda_GaggedAnswer();\n}", "stop() { \r\n enabled = false;\r\n // TODO: hide PK block list\r\n }", "function resumeAutoAdvance () {\n /* Important to clear the flag if the user opens and closes a modal during \n game activity. */\n autoAdvancePaused = false;\n if (!actualMainButtonState) {\n allowProgression();\n }\n}", "function C101_KinbakuClub_RopeGroup_NotTieMe() {\n\tif (ActorGetValue(ActorSubmission) <= -3) {\n\t\tOverridenIntroText = GetText(\"ForceTied\");\n\t\tC101_KinbakuClub_RopeGroup_AmeliaTies();\n\t\tActorChangeAttitude(0, -1)\n\t\tC101_KinbakuClub_RopeGroup_CurrentStage = 500;\n\t}\n}", "function playAgainNo() {\n assistant.tell(\"Oh well...Everything good has to come to an end sometime. Good bye!\");\n }", "function hideIfNotAccepted() {\r\n if (state.assignmentId == \"ASSIGNMENT_ID_NOT_AVAILABLE\") {\r\n console.log(\"Hiding if not accepted\");\r\n $('#experiment').hide();\r\n $(\"#hit-not-accepted\").show();\r\n return true;\r\n }\r\n return false;\r\n}", "_mining(){\n return false;\n }", "function C012_AfterClass_Amanda_CuffsGame() {\n\tvar WinGame = ((ActorGetValue(ActorSubmission) - 15 + Math.floor(Math.random() * 31)) >= 0);\n\tCurrentTime = CurrentTime + 110000;\n\tPlayerRemoveInventory(\"Cuffs\", 1);\n\tif (WinGame) ActorAddInventory(\"Cuffs\");\n\telse PlayerLockInventory(\"Cuffs\");\n\tif (!WinGame) OverridenIntroText = GetText(\"LoseCuffsGame\");\n\tif (Common_ActorIsOwner && !WinGame) PlayerRemoveInventory(\"CuffsKey\", 99);\n\tC012_AfterClass_Amanda_CalcParams();\n}", "function end_turn(){\n\tif(dbg){\n\t\tdebug(\"ending turn\");\n\t}\n\tupdate_hand();\n\tvar x = document.getElementsByClassName(\"actions\");\n\tfor (i=0; i < x.length; i++){\n\t\tx[i].disabled = true;\n\t}\n}", "function productionStopCase6() {\n console.log(\"productionStopCase6\");\n if (config.strSkipWOTrackingPrompt) {\n productionStopCase10();\n } else {\n $.confirm({\n title: 'Confirm!',\n content: \"Confirm to stop production?\",\n buttons: {\n confirm: function () {\n productionStopCase10();\n },\n cancel: function () {\n $.alert('Canceled!');\n }\n }\n });\n\n //var answer = confirm(\"Confirm to stop production?\");\n ////todo to implement, trackingdefault ok in model so that default button can change\n ////if (config.TrackingDefaultOK) {\n //// setupStartCase5();\n ////} else {\n //// if (answer) {\n //// setupStartCase5();\n //// }\n ////}\n\n //if (answer) {\n // productionStopCase10();\n //}\n\n\n }\n }", "function completeContinuePhase () {\n /* show the player removing an article of clothing */\n prepareToStripPlayer(recentLoser);\n allowProgression(eGamePhase.STRIP);\n}", "function startAttackNFinish(a2b_doc, vi, ATask, antiFarm, a2bVname, a2bPName) {\n\ttry {\n\t\t//flag ( \"startAttackNFinish():: Started! village: \" + vi );\n\t\t// if response is rally point page, then analyze rally point and update troop counts.\n\t\tvar h1name = document.evaluate('//h1', a2b_doc, null, XPFirst, null).singleNodeValue;\n\t\tif ( h1name != null && h1name.innerHTML.indexOf(aLangAllBuildWithId[16]) != -1 )\n\t\t\tanalyzeRallyPoint(a2b_doc,vi,false);\n\n\t\tif ( antiFarm == \"\" ) { // when not in anti-farm mode...\n\t\t\tif (ATask[3] == \"0\") {\n\t\t\t\tdeleteTaskFromCookie(vi, ATask);\n\t\t\t} \n\t\t\telse {\n\t\t\t\t//var newTask = new Array(); // |2_241654_3_0_1248014400000_0_0,0,0,0,0,5,0,0,0,0,0_0_0\n\t\t\t\tvar newTask = ATask.slice(0); // clone the array ATask.\n\t\t\t\tvar nowt=new Date();\n\t\t\t\ttemp = Number(ATask[3]) - 1\n\t\t\t\tnewTask[3] = temp.toString();\n\t\t\t\t// if attack strict order is disabled, set increment attack time by repeat interval\n\t\t\t\tif ( GM_getValue ( myacc() + \"_attackStrictOrder\", \"0\" ) == \"0\" ) {\n\t\t\t\t\tif (ATask[5] == \"0\") { // if repeat is set to 0, increment by 1 day +/- random 5 mins\n\t\t\t\t\t\t// delay by 24 hrs +/- random ( 5 )\n\t\t\t\t\t\ttemp2 = getRandomizedTime ( 24*60*60*1000, 2 * 5*60*1000, 1 );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( Number(ATask[5]) > 5*60*1000 ) { // else if repeat interval > 5 mins increment by repeat interval +/- random (repeat-interval/2)\n\t\t\t\t\t\t// delay by repeat interval +/- random ( repeat-interval / 2 )\n\t\t\t\t\t\ttemp2 = getRandomizedTime ( Number(ATask[5]), Number(ATask[5]), 1 );\n\t\t\t\t\t}\n\t\t\t\t\telse { // else if repeat interval < 5 mins just increment by repeat interval\n\t\t\t\t\t\ttemp2 = nowt.getTime() + Number(ATask[5]);\n\t\t\t\t\t}\n\t\t\t\t\tnewTask[4] = temp2.toString();\n\t\t\t\t}\n\t\t\t\tnewTask[12] = a2bPName.toString();\n\t\t\t\tnewTask[13] = a2bVname.toString();\n\t\t\t\tdeleteTaskFromCookie(vi, ATask, newTask);\n\t\t\t}\n\t\t\tvar xCoord = getXfromCoord(ATask[1]);\n\t\t\tvar yCoord = getYfromCoord(ATask[1]);\n\t\t\tvar targetcoord = \"(\" + xCoord + \"|\" + yCoord + \")\";\n\t\t\tvar villageUrl = \"\";\n\t\t\tswitch ( aTravianVersion ) {\n\t\t\t\tcase \"3.6\":\n\t\t\t\t\tvillageUrl = \"<a class='spantooltip' style='color: PaleVioletRed' href='\" +\n\t\t\t\t\t\tmyhost + \"/karte.php?newdid=\" + vi + \"&z=\" + ATask[1] + \"'>\" + targetcoord + \"</a>\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"4.0\":\n\t\t\t\t\tvillageUrl = \"<a class='spantooltip' style='color: PaleVioletRed' href='\" +\n\t\t\t\t\t\tmyhost + \"/karte.php?newdid=\" + vi + \"&x=\" + xCoord + \"&y=\" + yCoord + \"'>\" + targetcoord + \"</a>\" +\"<b> \"+ a2bPName +\" : </b>\"+ a2bVname;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrowLogicError ( \"startAttackNFinish():: Travian Version not set!!\" );\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar msg1 = getvillagefromdid(vi) + \" &lrm;(\" + vi + \")&lrm;: \" + aLangTaskOfText[31].fontcolor('#9400D3') + \" to \" + villageUrl;\n\t\t\tvar msg2 = getvillagefromdid(vi) + \" &lrm;(\" + vi + \")&lrm;: \" + aLangTaskOfText[31] + \" to \" + targetcoord;\n\t\t\tprintMSG ( msg1 );\n\t\t\tflag ( \"startAttackNFinish():: \" + msg2 );\n\t\t\tcalldoing1();\n\t\t\tshowTaskList();\n\t\t}\n\t\telse { // when in anti-form mode...\n\n\t\t\tvar foundCallBackUrl = getAntiFarmCallBackUrls(a2b_doc, vi, antiFarm);\n\t\t\tif ( foundCallBackUrl == false ) {\n\t\t\t\t// &k for complete incoming troops in rally point, &j is for all outgoing troops\n\t\t\t\t/*var callBackUrl = myhost + \"/build.php?gid=16&newdid=\"+vi+\"&j\"; // no need to analyze rally point here as &j is used and not &k\n\t\t\t\tTS_getRequest ( callBackUrl, getAntiFarmCallBackUrls, vi, antiFarm );*/\n\t\t\t\tgetAntiFarmCallBackUrls2(vi, antiFarm);\n\t\t\t}\n\t\t}\n\n\t}\n\tcatch ( err ) {\n\t\tprintStackTrace();\n\t\tvar msg = \"<b>startAttackNFinish():: Something went wrong, error: \" + err.name + \" :: \" + err.message + \"</b>\";\n\t\tplaySound ( msg );\n\t\tprintErrorMSG(msg);\n\t\tthrow err;\n\t}\n}", "function C012_AfterClass_Amanda_AmandaDeniedOrgasm() {\n\tCurrentTime = CurrentTime + 50000;\n\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"OrgasmDeniedFromMasturbation\")) {\n\t\tGameLogAdd(\"OrgasmDeniedFromMasturbation\");\n\t\tActorChangeAttitude(-2, 1);\n\t}\n\tC012_AfterClass_Amanda_EndEnslaveAmanda();\n}", "function rules_enforcer (memoryGame) {\n if (memoryGame.selectedCards.length >= 2) {\n $('.back').addClass('blocked')\n }\n }", "function C012_AfterClass_Amanda_TestBedSarah() {\n\tif (!ActorSpecificIsRestrained(\"Amanda\") && !ActorSpecificIsRestrained(\"Sarah\") && !ActorSpecificIsGagged(\"Amanda\") && !ActorSpecificIsGagged(\"Sarah\") && !GameLogQuery(CurrentChapter, \"Amanda\", \"NextPossibleOrgasm\") && !GameLogQuery(CurrentChapter, \"Sarah\", \"NextPossibleOrgasm\")) {\n\t\tOverridenIntroText = GetText(\"AcceptGoToBedWithSarah\");\n\t\tC012_AfterClass_Amanda_CurrentStage = 823;\n\t}\n}", "function resumeGame() {\r\n id(\"submit-btn\").disabled = false;\r\n id(\"skip-btn\").disabled = false;\r\n }", "function C012_AfterClass_Amanda_TestSubmit() {\n\tif (Common_PlayerOwner != \"\") {\n\t\tOverridenIntroText = GetText(\"AlreadyOwned\");\n\t} else {\n\t\tif (ActorIsRestrained()) {\n\t\t\tOverridenIntroText = GetText(\"UnrestrainFirst\");\n\t\t} else {\n\t\t\tif (ActorIsChaste()) {\n\t\t\t\tOverridenIntroText = GetText(\"UnchasteFirst\");\n\t\t\t} else {\n\t\t\t\tif (PlayerHasLockedInventory(\"Collar\")) {\n\t\t\t\t\tOverridenIntroText = GetText(\"PlayerUncollarFirst\");\t\t\t\t\t\n\t\t\t\t} else {\t\t\t\t\t\n\t\t\t\t\tif (Common_PlayerRestrained) {\n\t\t\t\t\t\tOverridenIntroText = GetText(\"PlayerUnrestrainFirst\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tC012_AfterClass_Amanda_CurrentStage = 330;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "promptTargetForChallenge() {\n if (this.currentPlayer.isComputer) {\n let blockChallenge = blockChallengeForm(this.action, this.blockable, this.challengeable);\n this.currentTarget.renderControls(blockChallenge);\n blockChallenge.addEventListener('submit', (e) => {\n e.preventDefault();\n blockChallenge.remove();\n this.domState = this.domState.refresh();\n if (this.domState.playerWasBlocked) {\n this.currentPlayer.learnOpponentBlock(this.action);\n this.promptPlayerForChallenge();\n } else if (this.domState.playerWasChallenged) {\n if (this.playerWonChallengeIdx >= 0) {\n if (this.currentTarget.cards.length >= 2) {\n this.currentPlayer.reshuffleCard(this.playerWonChallengeIdx);\n }\n this.promptTargetForLostChallengeChoice();\n } else {\n this.promptPlayerForLostChallengeChoice();\n }\n } else {\n this.targetAllowedPlayer();\n }\n });\n } else {\n let computerChallenged = this.currentTarget.decideChallenge(this.action);\n let computerBlocked = this.currentTarget.decideBlock(this.action);\n if (computerChallenged) {\n let announcement = computerPlayerMessage(`Challenge ${this.action}`);\n this.currentTarget.renderControls(announcement);\n } else if (computerBlocked) {\n let announcement = computerPlayerMessage(`Block ${this.action}`);\n this.currentTarget.renderControls(announcement);\n } else {\n let announcement = computerPlayerMessage(`Allow ${this.action}`);\n this.currentTarget.renderControls(announcement);\n }\n setTimeout(() => {\n if (computerChallenged) {\n if (this.playerWonChallengeIdx >= 0) {\n if (this.currentTarget.cards.length >= 2) {\n this.currentPlayer.reshuffleCard(this.playerWonChallengeIdx);\n }\n this.promptTargetForLostChallengeChoice();\n } else {\n this.promptPlayerForLostChallengeChoice();\n }\n } else if (computerBlocked) {\n this.promptPlayerForChallenge();\n } else {\n this.targetAllowedPlayer();\n }\n }, 100);\n }\n }", "function C101_KinbakuClub_RopeGroup_TryStopMe() {\n\tif (ActorGetValue(ActorSubmission) <= 0) {\n\t\tC101_KinbakuClub_RopeGroup_CurrentStage = 125;\n\t\tOverridenIntroText = GetText(\"StoppingYou\");\n\t} else LeaveIcon = \"Leave\";\n}", "isFinished() {\n\n return this.pairsGuessed !== this.cards.length / 2 ? false : true\n\n }", "function setUpForAnotherAssessment() {\n $('#next').hide();\n $('#retry').show();\n disableRadios();\n }", "function C012_AfterClass_Amanda_IsChangingBlocked() {\n\tif (GameLogQuery(CurrentChapter, CurrentActor, \"EventBlockChanging\"))\n\t\tOverridenIntroText = GetText(\"ChangingIsBlocked\");\n}", "function anotherCard() {\n for (var i=1; i < buzzwords.length; i++) {\n usedWords[i] = false;\n }\n newCard();\n return false;\n}", "promptPlayerForChallenge() {\n if (this.currentPlayer.isComputer) {\n let blockWasChallenged = this.currentPlayer.decideBlockChallenge(this.action);\n if (blockWasChallenged) {\n let announcement = computerPlayerMessage(`Challenge Block`);\n this.currentPlayer.renderControls(announcement);\n } else {\n let announcement = computerPlayerMessage('Fine, be that way');\n this.currentPlayer.renderControls(announcement);\n }\n setTimeout(() => {\n if (blockWasChallenged) {\n if (this.targetWonChallengeIdx >= 0) {\n if (this.currentPlayer.cards.length >= 2) {\n this.currentTarget.reshuffleCard(this.targetWonChallengeIdx);\n }\n this.promptPlayerForLostChallengeChoice();\n } else {\n this.promptTargetForLostChallengeChoice();\n }\n } else {\n this.playerDidKill = false;\n this.playerDidSteal = false;\n this.playerDidReceive = false;\n this.complete = true;\n }\n }, 1000);\n } else {\n let challengeForm = blockChallengeForm('Block', false, true);\n this.currentPlayer.renderControls(challengeForm);\n challengeForm.addEventListener('submit', (e) => {\n e.preventDefault();\n challengeForm.remove();\n this.domState = this.domState.refresh();\n if (this.domState.targetWasChallenged) {\n if (this.targetWonChallengeIdx >= 0) {\n if (this.currentPlayer.cards.length >= 2) {\n this.currentTarget.reshuffleCard(this.targetWonChallengeIdx);\n }\n this.promptPlayerForLostChallengeChoice();\n } else {\n this.promptTargetForLostChallengeChoice();\n }\n } else {\n this.playerDidKill = false;\n this.playerDidSteal = false;\n this.playerDidReceive = false;\n this.complete = true;\n }\n })\n }\n }", "deuce() {\n if (this.playerOneScore === this.playerTwoScore && this.playerOneScore >= 3) {\n return true;\n }\n return false;\n }", "function finish(){\n\n // sound-effect\n playIncorrect()\n // Disable buttons, because we don't need them.\n elements.correctButton.disabled = true\n elements.incorrectButton.disabled = true\n window.setTimeout(displayGameOver,1500)\n}", "function startSecondAttempt() {\n // Re-randomize the trial order (DO NOT CHANG THESE!)\n shuffle(phrases, true);\n current_trial = 0;\n target_phrase = phrases[current_trial];\n\n // Resets performance variables (DO NOT CHANG THESE!)\n letters_expected = 0;\n letters_entered = 0;\n errors = 0;\n currently_typed = \"\";\n CPS = 0;\n\n current_letter = \"a\";\n\n // Show the watch and keyboard again\n second_attempt_button.remove();\n draw_finger_arm = true;\n attempt_start_time = millis();\n}", "function tryAgain(bool) {\n player.score = 0;\n document.getElementsByClassName('game-links')[0].classList.remove('is-visible');\n document.getElementById('game-fixed-nav-previous-btn').classList.add('is-disabled');\n document.getElementById('score').innerText = '10';\n player.urlLinks = [];\n player.links = [];\n displayLinks('game-links-list');\n player.workingLink = '';\n player.previousLink = player.startingLink;\n player.article = undefined;\n if (!bool) {\n startingLinks();\n }\n loadSummary(player.startingLink, player.targetLink);\n document.getElementById('start-digging-button').classList.remove('removed');\n switchScreen('results','game');\n}", "function isCamrynDone() {\n\tvar perC = findPersonNC(\"Camryn\");\n\treturn perC.place === 1000 || perC.place === 457;\n}", "function C101_KinbakuClub_RopeGroup_Amelia210Done() {\n\tC101_KinbakuClub_RopeGroup_Amelia210NotDone = false;\n}", "function resumeGame() {\r\n\tif (!gameOn && result == false && allowResume == true) {\r\n\t\t// console.log(\"resume game\");\r\n\t\tgameOn = true;\r\n\t\t\r\n\t\tanimateEnemy(animateBoxes,locationOfEnemy,currentDirection);\r\n\r\n\t} // if\r\n\r\n\r\n} // resumeGame", "function canautoheal() {\r\n// DEBUG('in can auto heal - - 2 ');\r\n if(GM_getValue('staminaSpendHow') == STAMINA_HOW_FIGHTROB) {\r\n DEBUG(' STAMINA_HOW_FIGHTROB blocked autoheal ');\r\n return false;\r\n }\r\n if((GM_getValue('staminaSpendHow') == STAMINA_HOW_ROBBING) && (isGMChecked('BlockHealRobbing')) ) {\r\n DEBUG(' STAMINA_HOW_ROBBING blocked autoheal ');\r\n return false;\r\n }\r\n\r\n// DEBUG('canautoheal is allowing healing ');\r\n return true;\r\n}", "function completeMasturbatePhase () {\n /* strip the player with the lowest hand */\n startMasturbation(recentLoser);\n}", "function allowProgression (nextPhase) {\n if (nextPhase !== undefined && nextPhase !== eGamePhase.END_FORFEIT) {\n gamePhase = nextPhase;\n } else if (nextPhase === undefined) {\n nextPhase = gamePhase;\n }\n \n if (humanPlayer.out && !humanPlayer.finished && humanPlayer.timer == 1 && gamePhase != eGamePhase.STRIP) {\n $mainButton.html(\"Cum!\");\n } else if (nextPhase[0]) {\n $mainButton.html(nextPhase[0]);\n } else if (nextPhase === eGamePhase.END_LOOP) { // Special case\n /* someone is still forfeiting */\n var dots = '.'.repeat(endWaitDisplay);\n if (humanPlayer.checkStatus(STATUS_MASTURBATING)) {\n $mainButton.html(\"<small>Keep going\" + dots + \"</small>\");\n } else {\n $mainButton.html(\"Wait\" + dots);\n }\n }\n\n actualMainButtonState = false;\n if (nextPhase != eGamePhase.GAME_OVER && !inRollback()) {\n if (autoAdvancePaused) {\n // Closing the modal that the flag to be set should call allowProgression() again.\n return;\n } else if (FORFEIT_DELAY && humanPlayer.out && !humanPlayer.finished && (humanPlayer.timer > 1 || gamePhase == eGamePhase.STRIP)) {\n timeoutID = autoForfeitTimeoutID = setTimeout(advanceGame, FORFEIT_DELAY);\n $mainButton.attr('disabled', true);\n return;\n } else if (ENDING_DELAY && (humanPlayer.finished || (!humanPlayer.out && gameOver))) {\n /* Human is finished or human is the winner */\n timeoutID = autoForfeitTimeoutID = setTimeout(advanceGame, ENDING_DELAY);\n $mainButton.attr('disabled', true);\n return;\n }\n }\n timeoutID = autoForfeitTimeoutID = undefined;\n $mainButton.attr('disabled', false);\n}", "function decideTrial1Condition() { // sorts the first trial into reveal condition, sends to set up meme\n if (revealOrderCondition === \"messageFirstCondition\") {\n $(\"#memePicture\").hide(); // hide picture\n setMemeContent_MessageFirst();\n } else if (revealOrderCondition === \"sourceFirstCondition\") {\n setMemeContent_SourceFirst();\n } else {\n setMemeContent_Combo();\n }\n}", "function diffuseTheBomb() { return true }", "function allowQuestion() { }", "function AllOKAllowSubmit() {\n if (formInUse === \"#rpsForm\") {\n AppendReasonToRequest(reasonForChallenge);\n\n challengeString += `Do you <a href=\"https://spelmakare.se/steem/rps?challenger=${userName}&permlink=${permLink}\">accept?</a>`;\n\n jsonChallenge.author = userName;\n jsonChallenge.permlink = permLink;\n jsonChallenge.parent_author = userToChallenge;\n jsonChallenge.parent_permlink = permLinkParent;\n jsonChallenge.body = encodeURIComponent(challengeString);\n jsonChallenge.json_metadata.challenged = userToChallenge;\n jsonChallenge.json_metadata.challenge_type = reasonForChallenge;\n jsonChallenge.json_metadata.challenger_rpschoicemd5 = rpsChoiceMD5;\n }\n else {\n jsonResponse.author = userName;\n jsonResponse.permlink = permLink;\n jsonResponse.parent_author = userToChallenge;\n jsonResponse.parent_permlink = permLinkParent;\n jsonResponse.body = encodeURIComponent(actualResponse);\n jsonChallenge.json_metadata.challenger = userToChallenge; ///Challenger is userToChallenge in response!\n jsonChallenge.json_metadata.result = winner;\n }\n\n $(\"#question6\").delay(200).fadeIn(300);\n $(\"#rpsPreviewTitle\").delay(200).fadeIn(300);\n $(\"#rpsPreview\").delay(200).fadeIn(300);\n $(\"#submit\").delay(200).fadeIn(300);\n $(\"#rpsPreview\").html(challengeString);\n\n readyToSubmit = true;\n }", "function C101_KinbakuClub_RopeGroup_Amelia230Done() {\n\tC101_KinbakuClub_RopeGroup_Amelia230NotDone = false;\n}", "function riddleTwo() {\n\tif(riddePlayedTwo == false) {\n\t\tif(x==24 && y ==4) {\n\t\t\tconst position = getPosition();\n\t\t\tposition.append(riddeImg);\n\t\t\t\tvar answer = prompt('I have hands I can move but I cannot clap, what am I?');\n\t\t\t\t\tif(answer.toUpperCase()=='A CLOCK') {\n\t\t\t\t\t\tscore += 20;\n\t\t\t\t\t\tscoreCheck();\n\t\t\t\t\t\talert('You just got 20 extra points!');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tscore -= 10;\n\t\t\t\t\t\talert('You just lost 10 points!')\n\t\t\t\t\t\tscoreCheck();\n\t\t\t\t\t}\n\t\t\t\triddePlayedTwo = true;\n\t\t}\n\t}\n}", "function _hideRouteResults () {\n $directions_route.slideUp(400);\n\n return false;\n }", "function C012_AfterClass_Roommates_TestRefuseIsolation() {\n\tif (ActorGetValue(ActorSubmission) <= -10) {\n\t\tActorSetPose(\"Angry\");\n\t\tOverridenIntroText = GetText(\"CannotRefuseIsolation\");\n\t\tC012_AfterClass_Roommates_CurrentStage = 225;\n\t}\n}", "canPerform() {\n return false;\n }", "function playAgainYes() {\n assistant.ask(\"Great! What's number on your mind?\");\n }", "_shouldMakeMine() {\n return Math.random() < this.mineiness;\n }", "checkResult() {\n const MAX_ANSWERS_LENGTH = 10;\n if (this.model.isDead()) {\n this.loose();\n } else if (this.model.defineAnswersLength() === MAX_ANSWERS_LENGTH) {\n this.win();\n } else {\n this.startGame();\n }\n }", "function phaseOne() {\n\n\t\t$(\".submitBtn\").text(\"SELECT YOUR ANSWER\").removeClass(\"correct incorrect on\").off();\n\n\t\tcurrentItem = jRandom(testItem.length)\n\t\tlet item = testItem[currentItem];\n\t\t$(\".question\").text(item.question);\n\t\t$(\".answerBtn\").attr(\"value\", \"false\");\n\t\t$(\".answerBtn\")[jRandom(4)].setAttribute(\"value\", \"true\");\n\n\t\t$(\".answerBtn\").each(function() {\n\n\t\t\tif (this.value === \"true\") {\n\t\t\t\tlet x = jRandom(item.correctAnswer.length);\n\t\t\t\t$(this).text(item.correctAnswer[x]).click(sounds.right);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet x = jRandom(item.incorrectAnswers.length);\n\t\t\t\t$(this).text(item.incorrectAnswers[x]).click(sounds.wrong);\n\t\t\t\titem.incorrectAnswers.splice(x, 1);\n\t\t\t}\n\n\t\t});\n\t\t\n\t\t$(\".answerBtn\").addClass(\"active\").removeClass(\"off on correct incorrect\").click(sounds.click).click(phaseTwo);\n\n\t}", "function _primeBomb() {\n if (_bombCount > 0) {\n if (_isPrimed) {\n sound.playSfx('unableToMove');\n } else {\n sound.playSfx('bombPrimed');\n }\n\n // Un-prime the other bomb window\n game.unPrimeBomb();\n\n game.primedWindowIndex = game.keyboardControlOn ? 0 : 4;\n game.primedBombType = _bombType;\n _isPrimed = true;\n input.selectedKeyboardBlock = null;\n return true;\n } else {\n return false;\n }\n }", "function canAbandon() {\n return isQuestActive() && !(0, _property.get)(\"_guzzlrQuestAbandoned\");\n}", "function player2() {\n if (flag2) {\n Player2_reduceHealth();\n flag1 = false;\n }\n}", "function setupStopCase6() {\n console.log(\"setupStopCase6\");\n if (config.strSkipWOTrackingPrompt) {\n setupStopCase10();\n } else {\n $.confirm({\n title: 'Confirm!',\n content: \"Confirm to stop setup?\",\n buttons: {\n confirm: function () {\n setupStopCase10();\n },\n cancel: function () {\n $.alert('Canceled!');\n }\n }\n });\n //var answer = confirm(\"Confirm to stop setup?\");\n ////todo to implement, trackingdefault ok in model so that default button can change\n ////if (config.TrackingDefaultOK) {\n //// setupStartCase5();\n ////} else {\n //// if (answer) {\n //// setupStartCase5();\n //// }\n ////}\n\n //if (answer) {\n // setupStopCase10();\n //}\n }\n }", "function stop_resend(fturn) {\n\tif (turn > fturn + 2) return true;\n\tif (isGameOver() && Date.now() - dieTimer > dieTime) {\n\t\tconsole.log('Game is over. Execution stopped.');\n\t\treturn true;\n\t}\n\treturn false;\n}", "function continueExecution() {\n clearBoard();\n hero.positionAtHome();\n hero.setImage('normal');\n hero.setLives(hero.getLives()-1);\n hero.draw();\n isNextLife = true;\n }", "function C012_AfterClass_Amanda_PleasurePlayer() {\n\t\n\t// The more it progresses, the faster Amanda must go\n\tCurrentTime = CurrentTime + 50000;\n\tvar StartCount = C012_AfterClass_Amanda_PleasurePlayerCount;\n\tif ((C012_AfterClass_Amanda_PleasurePlayerCount >= 0) && (C012_AfterClass_Amanda_PleasurePlayerCount <= 1) && (C012_AfterClass_Amanda_PleasurePlayerSpeed == 0)) C012_AfterClass_Amanda_PleasurePlayerCount++;\n\tif ((C012_AfterClass_Amanda_PleasurePlayerCount >= 2) && (C012_AfterClass_Amanda_PleasurePlayerCount <= 3) && (C012_AfterClass_Amanda_PleasurePlayerSpeed == 1)) C012_AfterClass_Amanda_PleasurePlayerCount++;\n\tif ((C012_AfterClass_Amanda_PleasurePlayerCount >= 4) && (C012_AfterClass_Amanda_PleasurePlayerCount <= 9) && (C012_AfterClass_Amanda_PleasurePlayerSpeed == 2)) C012_AfterClass_Amanda_PleasurePlayerCount++;\n\t\n\t// At 6 counts, an orgasm is achieved, the next one will be slower\n\tif (C012_AfterClass_Amanda_PleasurePlayerCount >= 6) {\n\t\tOverridenIntroText = GetText(\"OrgasmFromAmandaPleasure\");\n\t\tActorAddOrgasm();\n\t\tGameLogSpecificAddTimer(CurrentChapter, \"Player\", \"NextPossibleOrgasm\", PlayerHasLockedInventory(\"VibratingEgg\") ? CurrentTime + 1800000 : CurrentTime + 3600000);\n\t\tif (PlayerHasLockedInventory(\"Collar\")) OverridenIntroImage = \"PlayerCollarCloseUpOrgasm.jpg\";\n\t\telse OverridenIntroImage = \"PlayerCloseUpOrgasm.jpg\";\n\t\tC012_AfterClass_Amanda_CurrentStage = 636;\n\t\tC012_AfterClass_Amanda_PleasurePlayerCount = 0;\n\t\tC012_AfterClass_Amanda_PleasurePlayerSpeed = 0;\n\t} else {\n\t\tif (StartCount == C012_AfterClass_Amanda_PleasurePlayerCount) OverridenIntroText = GetText(\"PleasureFromAmandaNoProgress\");\n\t}\n\t\n}", "function startSecondAttempt()\n{\n // Re-randomize the trial order (DO NOT CHANG THESE!)\n shuffle(phrases, true);\n current_trial = 0;\n target_phrase = phrases[current_trial];\n \n // Resets performance variables (DO NOT CHANG THESE!)\n letters_expected = 0;\n letters_entered = 0;\n errors = 0;\n currently_typed = \"\";\n CPS = 0;\n \n current_letter = 'a';\n \n // Show the watch and keyboard again\n second_attempt_button.remove();\n draw_finger_arm = true;\n attempt_start_time = millis(); \n}", "function allowAction() {\n var previousCircleID;\n var previousCircle;\n if (currentStopIndex == 0) {\n if (trains[currentTrainIndex].stops[currentStopIndex].arrivalTime == trains[currentTrainIndex].stops[currentStopIndex].departedTime)\n previousCircleID = currentCircleID;\n else\n previousCircleID = currentCircleID.replace(\"traincircle_2\", \"traincircle_1\");\n }\n else {\n if (isDepartedCircle(currentCircleID)) {\n if (currentChange != changeType.PASS_THROUGH)\n previousCircleID = currentCircleID.replace(\"traincircle_2\", \"traincircle_1\");\n else\n previousCircleID = \"traincircle_2_\" + currentTrainIndex + \"_\" + (currentStopIndex - 1);\n }\n else\n previousCircleID = \"traincircle_2_\" + currentTrainIndex + \"_\" + (currentStopIndex - 1);\n\n }\n previousCircle = d3.select(\"#\" + previousCircleID);\n if(previousCircle === null) return false;\n return (previousCircleID == currentCircleID || previousCircle[0][0] == null || previousCircle.attr(\"color-type\") == \"0\")\n}", "function continueGame() {\n\tGAME_COMPLETE = false;\n\tGAME_OVER = false;\n\tGAME_CONTINUE = true;\n\t$('#winner').hide();\n}", "function C012_AfterClass_Amanda_Kiss() {\n\tCurrentTime = CurrentTime + 50000;\t\n\tif (Common_ActorIsOwner) OverridenIntroText = GetText(\"KissAmandaOwner\");\n\telse if (C012_AfterClass_Amanda_IsGagged) OverridenIntroText = GetText(\"KissAmandaGagged\");\n\telse if (!GameLogQuery(CurrentChapter, CurrentActor, \"Kiss\")) {\n\t\tGameLogAdd(\"Kiss\");\n\t\tActorChangeAttitude(1 + PlayerGetSkillLevel(\"Seduction\"), 0);\n\t\tif (PlayerGetSkillLevel(\"Seduction\") > 0) OverridenIntroText = GetText(\"KissAmandaSeduction\");\n\t}\n}", "function C101_KinbakuClub_RopeGroup_Amelia220Done() {\n\tC101_KinbakuClub_RopeGroup_Amelia220NotDone = false;\n}", "function C101_KinbakuClub_RopeGroup_Amelia250Done() {\n\tC101_KinbakuClub_RopeGroup_Amelia250NotDone = false;\n}", "function C101_KinbakuClub_RopeGroup_Charlotte340Done() {\n\tC101_KinbakuClub_RopeGroup_Charlotte340NotDone = false;\n}", "stop() {\n this.continue = false\n }", "function blackJackPlayer2(){\n if(blackjackGame.player_2 === true){\n blackjackGame.player_1 = false;\n let card = randomCard();\n showCard(card,P2);\n updateScore(card,P2);\n showScore(P2);\n}\n}", "function checkEndGame(guessBank) {\n if (guessBank === 0){\n $('.instructions').eq(0).text('Player 1 has defeated Player 2! Switch roles, and play again?');\n $('.letter').show();\n reverseScore(!player1Turn);\n }else {\n $('.instructions').eq(0).text('Player 2 has defeated Player 1! Switch roles, and play again?');\n hangman.css('background-image', `url(${gameImgs[7]})`);\n reverseScore(player1Turn);\n }// end else if sta\n alphabet.html('');\n $('button').eq(0).prop('id', 'startNewGame');\n $('.instructions').eq(1).text('');\n initial.show();\n }", "function completeExchangePhase () {\n detectCheat();\n /* exchange the player's chosen cards */\n exchangeCards(HUMAN_PLAYER);\n \n /* disable player cards */\n for (var i = 0; i < $cardButtons.length; i++) {\n $cardButtons[i].attr('disabled', true);\n }\n $gameLabels[HUMAN_PLAYER].removeClass(\"current\");\n allowProgression(eGamePhase.REVEAL);\n}", "function challenge1() {\n\n}", "function challenge1() {\n\n}", "function C012_AfterClass_Amanda_BegForOrgasm() {\n\t\n\t// If the player begs for it, Amanda will do it randomly based on love, if not it's based on hate\n\tif (EventRandomChance(\"Love\")) {\n\t\tActorAddOrgasm();\n\t\tEventLogEnd();\n\t\tOverridenIntroText = GetText(\"MasturbatePlayerOrgasm\");\n\t\tC012_AfterClass_Amanda_CurrentStage = 3223;\n\t}\n\n}", "isGoal() {\n if (this.hamming == 0) {\n return true;\n }\n return false;\n }", "card_startStopCommenting(card){\n card.commenting=!card.commenting;\n }", "function C012_AfterClass_Amanda_Masturbate(Factor, CanClimax) {\n\tCurrentTime = CurrentTime + 50000;\n\tC012_AfterClass_Amanda_MasturbateCount = C012_AfterClass_Amanda_MasturbateCount + Factor;\n\tif (C012_AfterClass_Amanda_MasturbateCount < 0) C012_AfterClass_Amanda_MasturbateCount = 0;\n\tif ((C012_AfterClass_Amanda_MasturbateCount >= (ActorHasInventory(\"VibratingEgg\") ? 5 : 7)) && CanClimax && ActorIsRestrained()) {\n\t\tC012_AfterClass_Amanda_CurrentStage = 641;\n\t\tOverridenIntroText = GetText(\"ReadyForOrgasm\");\n\t}\n}", "activate() {\n if(turn.actions < this.actions) {\n hand.deselect();\n return;\n }\n resolver.proccess(this.results, this.actions, this.discard.bind(this));\n }", "finish(){\n model.stat.timer.stop();\n alert(model.algorithm.getCurrStep().description+' '+model.algorithm.getCurrStep().help);\n\t\tdocument.getElementById('nextBtn').disabled=true;\n\t\tdocument.getElementById('autoRunBtn').disabled=true;\n }", "function C012_AfterClass_Amanda_TestNaked() {\n\tif (Common_PlayerNaked) {\n\t\tC012_AfterClass_Amanda_CurrentStage = 392;\n\t\tOverridenIntroText = \"\";\n\t\tCommon_PlayerPose = \"BackShy\";\n\t}\n}", "continue() {\n this.disable = false;\n this.add(null, null, true);\n }", "async finalStep(stepContext) {\n\n // Get the user details / state machine \n const unblockBotDetails = stepContext.options;\n\n // Get the result from the previous text prompt\n const proceed = stepContext.result;\n\n // LUIZ Recogniser processing\n const recognizer = new LuisRecognizer({\n applicationId: process.env.LuisAppId,\n endpointKey: process.env.LuisAPIKey,\n endpoint: `https://${ process.env.LuisAPIHostName }.api.cognitive.microsoft.com`\n }, {\n includeAllIntents: true,\n includeInstanceData: true\n }, true);\n\n // Call prompts recognizer\n const recognizerResult = await recognizer.recognize(stepContext.context);\n\n // Top intent tell us which cognitive service to use.\n const intent = LuisRecognizer.topIntent(recognizerResult, \"None\", 0.50);\n\n // TODO: Check the score value\n\n switch(intent) {\n \n // Proceed\n case 'confirmChoicePositive':\n console.log(\"INTENT: \", intent)\n unblockBotDetails.confirmLookIntoStep = true;\n return await stepContext.endDialog(unblockBotDetails);\n \n // Don't Proceed\n case 'confirmChoiceNegative':\n console.log(\"INTENT: \", intent)\n unblockBotDetails.confirmLookIntoStep = false;\n return await stepContext.endDialog(unblockBotDetails);\n \n // Could not understand / None intent\n default: {\n // Catch all \n console.log(\"NONE INTENT\");\n unblockBotDetails.confirmLookIntoStep = -1;\n unblockBotDetails.errorCount.confirmLookIntoStep++;\n\n return await stepContext.replaceDialog(CONFIRM_LOOK_INTO_STEP, unblockBotDetails);\n }\n }\n\n }", "function C012_AfterClass_Bed_StopMasturbate() {\n\tC012_AfterClass_Bed_PleasureUp = 0;\n\tC012_AfterClass_Bed_PleasureDown = 0;\n}", "function _fail() {\n\t$('.bossHud .regularSeedButton').removeClass('currentButton');\n\t$game.$player.seedMode = false;\n\t$game.$player.resetRenderColor();\n\t_pause = true;\n\t_currentSlide = 3;\n\t_addContent();\n\t$bossArea.show();\n}", "function stopGivingGreatHints() {\n\t\t$(\"#showman\").hide();\n\t\tsoundActive = 0;\n\t\tplayAudio();\n\t}", "function challenge3() {\n\n}", "function C012_AfterClass_Amanda_TestChange() {\n\tif (!ActorIsRestrained()) {\n\t\tif ((ActorGetValue(ActorLove) >= 10) || (ActorGetValue(ActorSubmission) >= 10) || Common_ActorIsOwned || Common_ActorIsLover) {\n\t\t\tif (Common_ActorIsOwned) OverridenIntroText = GetText(\"AcceptChangeFromMistress\");\n\t\t\telse \n\t\t\t\tif (Common_ActorIsLover) OverridenIntroText = GetText(\"AcceptChangeFromLover\");\n\t\t\t\telse OverridenIntroText = GetText(\"AcceptChange\");\n\t\t\tC012_AfterClass_Amanda_CurrentStage = 600;\n\t\t}\n\t\tC012_AfterClass_Amanda_GaggedAnswer();\n\t} else OverridenIntroText = GetText(\"CannotActWhileRestrained\");\n}", "function verify_result() {\n grid_end_time = Date.now();\n trial.grid_rt = grid_end_time - grid_start_time;\n\n document.getElementById(\"Verify_Test\").disabled = true;\n var index, tile_value, num_wrong=0;\n\n // count how many of user_input are hits, misses, false alarms\n // var hits=0, false_alarms=0, misses=0;\n for (var i = 0; i < user_input_tile_ids.length; i++) {\n tile_value = Number(user_input_tile_ids[i]);\n index = generated_tile_ids.indexOf(tile_value);\n\n if (index < 0) {\n trial.false_alarms += 1;\n } else {\n trial.hits += 1;\n }\n }\n trial.misses = generated_tile_ids.length - trial.hits;\n\n num_wrong = Math.max(trial.misses, trial.false_alarms);\n if (num_wrong == 0) {\n verdict = 'Right';\n change_score(1);\n } else if (num_wrong == 1) {\n verdict = 'Almost';\n change_score(0.5);\n } else {\n verdict = 'Not Quite';\n change_score(0);\n }\n\n ////////// display Right Almost or Wrong\n // purge everything except input_verdict\n // if (trial.cognitive_loading) {\n // jsPsych.pluginAPI.setTimeout(function() {\n // display_element.querySelector('#debriefing').style.display = 'none';\n // }, 0);\n jsPsych.pluginAPI.setTimeout(function() {\n display_element.querySelector('#board').style.display = 'none';\n }, 0);\n jsPsych.pluginAPI.setTimeout(function() {\n display_element.querySelector('#board-grid-text').style.display = 'none';\n }, 0);\n jsPsych.pluginAPI.setTimeout(function() {\n display_element.querySelector('#Verify_Test').style.display = 'none';\n }, 0);\n // jsPsych.pluginAPI.setTimeout(function() {\n // display_element.querySelector('#jspsych-html-button-response-prompt').style.display = 'none';\n // }, 0);\n // jsPsych.pluginAPI.setTimeout(function() {\n // display_element.querySelector('#jspsych-html-button-response-rating').style.display = 'none';\n // }, 0);\n // jsPsych.pluginAPI.setTimeout(function() {\n // display_element.querySelector('#verdict').style.display = 'block';\n // }, 0);\n // }\n //\n document.getElementById('input_verdict').innerHTML = verdict ;//+ \"<br/>score: \" + num_correct + \"<br/>num_total: \" + num_total;\n\n jsPsych.pluginAPI.setTimeout(end_trial, 1000); //verdict_feedback_time\n }", "function NoBonus()\n{\n\tgiveBonus = false;\n}", "function go_wild_pressed(){\n controllers.free_flow_flag = !controllers.free_flow_flag;\n}", "function creditsAbort() {\n \tmusic_rasero.stop();\t\t\t\t\t// Stop music\n \tdefDemo.next();\t\t\t\t\t\t\t// Go to next part (End \"crash\")\n }", "function waves_logic_videocom() {\n if (waves.counter == 1) {\n \n if (!waves.tutorial_complete) {\n \n videocom.activate_brd();\n videocom.message_id = 0; // BRD intro\n waves.tutorial_complete = true;\n \n }\n else {\n \n // sometimes friendly\n var chance_brd = 0.2;\n var is_brd = Math.random() < chance_brd;\n if (is_brd) videocom.activate_brd();\n else videocom.activate_enemy();\n }\n }\n if (waves.counter == 60) waves.complete = true;\n}", "function C012_AfterClass_Jennifer_JenniferDeniedOrgasm() {\n\tCurrentTime = CurrentTime + 50000;\n\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"OrgasmDeniedFromMasturbation\")) {\n\t\tGameLogAdd(\"OrgasmDeniedFromMasturbation\");\n\t\tActorChangeAttitude(-2, 1);\n\t}\n\tC012_AfterClass_Jennifer_EndEnslaveJennifer();\n}", "function C012_AfterClass_Amanda_EndPleasureFromAmanda(LoveFactor, SubFactor) {\n\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"PleasureFromAmanda\")) {\n\t\tGameLogAdd(\"PleasureFromAmanda\");\n\t\tActorChangeAttitude(LoveFactor, SubFactor);\n\t}\n\tC012_AfterClass_Amanda_EndEnslaveAmanda();\n}", "willLikelySurvive() { \n\t\t\tlet cnt = 0;\n\n\t\t\tfor(let each of this.dna) {\n\t\t\t\tif (each === 'C' || each === 'G') {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet perc = (cnt/this.dna.length) * 100;\n\t\t\t// console.log(`percent of survival: ${perc}`);\n\n\t\t\tif (perc >= 60) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "shouldAttack() {\n return Random.between(1, 4) === 1;\n }", "function end() {\n \tcreditsLoopOn = false;\n \tcreditsAbort();\n }", "function completeRevealPhase () {\n detectCheat();\n stopCardAnimations(); // If the player was impatient\n /* reveal everyone's hand */\n for (var i = 0; i < players.length; i++) {\n if (players[i] && !players[i].out) {\n players[i].hand.determine();\n players[i].hand.sort();\n showHand(i);\n \n if (i > 0) $gameOpponentAreas[i-1].addClass('opponent-revealed-cards');\n }\n }\n\n /* Sort players by their hand strengths, worst first. */\n var sortedPlayers = players.filter(function(p) { return !p.out; });\n sortedPlayers.sort(function(p1, p2) { return compareHands(p1.hand, p2.hand); });\n\n if (chosenDebug !== -1 && DEBUG) {\n previousLoser = recentLoser;\n recentLoser = chosenDebug;\n } else {\n /* Check if (at least) the two worst hands are equal. */\n if (compareHands(sortedPlayers[0].hand, sortedPlayers[1].hand) == 0) {\n console.log(\"Fuck... there was an absolute tie\");\n /* inform the player */\n players.forEach(function (p) {\n if (p.chosenState) {\n p.clearChosenState();\n updateGameVisual(p.slot);\n }\n });\n updateAllBehaviours(null, null, PLAYERS_TIED);\n\n /* The probability of a three-way tie is basically zero,\n * but it's theoretically possible. */\n for (var i = 0;\n i < 2 || (i < sortedPlayers.length\n && compareHands(sortedPlayers[0].hand,\n sortedPlayers[i].hand) == 0);\n i++) {\n $gameLabels[sortedPlayers[i].slot].addClass(\"tied\");\n };\n /* reset the round */\n allowProgression(eGamePhase.DEAL);\n return;\n }\n previousLoser = recentLoser;\n recentLoser = sortedPlayers[0].slot;\n }\n recentWinner = sortedPlayers[sortedPlayers.length-1].slot;\n\n console.log(\"Player \"+recentLoser+\" is the loser.\");\n if (SENTRY_INITIALIZED) {\n Sentry.addBreadcrumb({\n category: 'game',\n message: players[recentLoser].id+' lost the round',\n level: 'info'\n });\n }\n\n // update loss history\n if (recentLoser == previousLoser) {\n // same player lost again\n players[recentLoser].consecutiveLosses++;\n } else {\n // a different player lost\n players[recentLoser].consecutiveLosses = 1;\n if (previousLoser >= 0) players[previousLoser].consecutiveLosses = 0; //reset last loser\n }\n\n /* update behaviour */\n saveTranscriptMessage(\"<b>\"+players[recentLoser].label+\"</b> has lost the hand.\");\n var clothes = playerMustStrip (recentLoser);\n \n /* playerMustStrip() calls updateAllBehaviours. */\n\n /* highlight the loser */\n for (var i = 0; i < players.length; i++) {\n if (recentLoser == i) {\n $gameLabels[i].addClass(\"loser\");\n \n if (i > 0) $gameOpponentAreas[i-1].addClass('opponent-lost');\n }\n }\n\n /* set up the main button */\n if (recentLoser != HUMAN_PLAYER && clothes > 0) {\n allowProgression(eGamePhase.PRESTRIP);\n } else if (clothes == 0) {\n allowProgression(eGamePhase.FORFEIT);\n } else {\n allowProgression(eGamePhase.STRIP);\n }\n\n}", "dontEatBreakfast() {\n console.clear();\n console.log(\"Angry that you never use it, your Waffle Iron attacks!\");\n console.log(\"The waffle iron uses 'face press'!\");\n \n //Health && check\n let waffleAttack = this.randomInt(25, 1); // Random Integer between 1 and 25\n if(this.player.isDead(waffleAttack)) {\n this.endGame(this.player);\n }\n \n //User attack choice\n this.newLine();\n let waffleChoices = [\"Unplug the waffle iron\", \"Splash water\", \"Jump on it\", \"Just walk away\"];\n let index = this.choiceSelection(waffleChoices, \"Which action do you take? \");\n \n //Array\n this.questionsPush(this.player, \"Which action do you take against the waffle iron?\");\n \n while (!waffleChoices[index]) {\n console.clear();\n console.log(\"I do not understand\");\n index = this.choiceSelection(waffleChoices, \"Which action do you take? \");\n }\n\n switch(index) {\n case 0:\n this.unplugWaffleIron();\n break;\n \n case 1:\n this.splashWater();\n break;\n\n case 2:\n this.jumpOnIt();\n break;\n \n case 3:\n this.walkAway();\n break;\n }// End of waffleBattle Validity check\n\n this.travel();\n }" ]
[ "0.6115727", "0.59832543", "0.58398336", "0.5813325", "0.5813325", "0.56470424", "0.55181205", "0.5482211", "0.54789466", "0.54771143", "0.54616475", "0.5461621", "0.5454641", "0.5447134", "0.5416185", "0.541275", "0.536525", "0.5362943", "0.53395885", "0.53361195", "0.53345627", "0.5331937", "0.5322895", "0.5318596", "0.531689", "0.5309702", "0.5307915", "0.5302447", "0.5292851", "0.5289955", "0.5286949", "0.5281242", "0.52793705", "0.52769184", "0.52762216", "0.5266501", "0.52555794", "0.5252189", "0.52516913", "0.52445245", "0.523981", "0.52361864", "0.5231228", "0.5229658", "0.52174205", "0.5212979", "0.52125806", "0.5211318", "0.52078927", "0.5204216", "0.5203154", "0.52028173", "0.5189752", "0.5187651", "0.51868373", "0.5186708", "0.5184778", "0.518309", "0.5181139", "0.5180732", "0.51802796", "0.51762813", "0.5175469", "0.51742595", "0.5170421", "0.51701856", "0.51628464", "0.5161161", "0.51583636", "0.51581585", "0.5153702", "0.5152769", "0.51510805", "0.51510805", "0.5139627", "0.5139597", "0.5138877", "0.51335555", "0.5133476", "0.51317024", "0.5131599", "0.5128662", "0.5122994", "0.51177377", "0.51155454", "0.51112527", "0.51082754", "0.51065004", "0.5096377", "0.5094695", "0.50870264", "0.50846857", "0.50826615", "0.5080257", "0.5077894", "0.5076274", "0.5075582", "0.50741595", "0.50725764", "0.5069987" ]
0.636713
0
Version 3.6 Golden Upgrades
function autoGoldenUpgradesAT() { var setting = getPageSetting('AutoGoldenUpgrades'); //get the numerical value of the selected index of the dropdown box try { if (setting == "Off") return; //if disabled, exit. var num = getAvailableGoldenUpgrades(); if (num == 0) return; //if we have nothing to buy, exit. //buy one upgrade per loop. var success = buyGoldenUpgrade(setting); //Challenge^2 cant Get/Buy Helium, so adapt - do Derskagg mod. var challSQ = game.global.runningChallengeSquared; var doDerskaggChallSQ = false; if (setting == "Helium" && challSQ && !success) doDerskaggChallSQ = true; // DZUGAVILI MOD - SMART VOID GUs // Assumption: buyGoldenUpgrades is not an asynchronous operation and resolves completely in function execution. // Assumption: "Locking" game option is not set or does not prevent buying Golden Void if (!success && setting == "Void" || doDerskaggChallSQ) { num = getAvailableGoldenUpgrades(); //recheck availables. if (num == 0) return; //we already bought the upgrade...(unreachable) // DerSkagg Mod - Instead of Voids, For every Helium upgrade buy X-1 battle upgrades to maintain speed runs var goldStrat = getPageSetting('goldStrat'); if (goldStrat == "Alternating") { var goldAlternating = getPageSetting('goldAlternating'); setting = (game.global.goldenUpgrades%goldAlternating == 0) ? "Helium" : "Battle"; } else if (goldStrat == "Zone") { var goldZone = getPageSetting('goldZone'); setting = (game.global.world <= goldZone) ? "Helium" : "Battle"; } else setting = (!challSQ) ? "Helium" : "Battle"; buyGoldenUpgrade(setting); } // END OF DerSkagg & DZUGAVILI MOD } catch(err) { debug("Error in autoGoldenUpgrades: " + err.message, "other"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "upgrade() {}", "static final private internal function m106() {}", "transient final protected internal function m174() {}", "private internal function m248() {}", "transient private internal function m185() {}", "private public function m246() {}", "function version(){ return \"0.13.0\" }", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "_mapDeprecatedFunctionality(){\n\t\t//all previously deprecated functionality removed in the 5.0 release\n\t}", "transient final private protected internal function m167() {}", "protected internal function m252() {}", "static transient final private internal function m43() {}", "static transient final protected public internal function m46() {}", "function fixOldSave(oldVersion){\n}", "function fixOldSave(oldVersion){\n}", "static transient private protected internal function m55() {}", "static transient final private protected internal function m40() {}", "transient private protected public internal function m181() {}", "function versionCompatibility() {\n\t\tconst v2number = v => v[0]*1e3 + v[1];\n\t\tconst vLast = [1, 3]; //last supported version of userdata\n\t\tif(CS && (!CS.version || v2number(CS.version) < v2number(vLast))) {saveService.clear();}\n\t}", "transient final private internal function m170() {}", "transient private public function m183() {}", "function upgrade(g) {\n return function (err, done) {\n if (err) { done(err); }\n g(done);\n };\n }", "static transient private protected public internal function m54() {}", "static transient final protected internal function m47() {}", "upgrade() {\r\n return this.clone(App, \"Upgrade\").postCore();\r\n }", "transient final private protected public internal function m166() {}", "function getVersion() {\n return 1.0;\n}", "get version() {\n return \"3.1.4\";\n }", "function no_overlib() { return ver3fix; }", "static transient private public function m56() {}", "static private protected internal function m118() {}", "static transient final protected function m44() {}", "unlocked(){return hasUpgrade(\"燃料\",11)}", "promoteUpdater() {}", "function CheckVersion() {\n \n}", "static transient final private public function m41() {}", "function getVersion(){return _VERSION}", "function version() {\n outlet(2, 249);\n}", "function setupNGP31Versions() {\n\tif (player.aarexModifications.newGame3PlusVersion < 2.3 || player.ghostify.hb.amount !== undefined) {\n\t\tplayer.ghostify.hb = setupHiggsSave()\n\t\tplayer.aarexModifications.newGame3PlusVersion = 2.3\n\t} else {\n\t\ttmp.hb = player.ghostify.hb\n\n\t\tdelete tmp.hb.higgsUnspent\n\t\tdelete tmp.hb.particlesUnlocked\n\t\tdelete tmp.hb.field\n\t}\n}", "function getClientVersion() { return '0.14.4'; }", "updated() {}", "static transient final private protected public function m38() {}", "function upgradeAllRegisteredInternal() {\n\t for (var n = 0; n < registeredComponents_.length; n++) {\n\t upgradeDomInternal(registeredComponents_[n].className);\n\t }\n\t }", "function upgradeAllRegisteredInternal() {\n\t for (var n = 0; n < registeredComponents_.length; n++) {\n\t upgradeDomInternal(registeredComponents_[n].className);\n\t }\n\t }", "function createOrUpgradeDb(db,txn,fromVersion,toVersion){index_esm_assert(fromVersion<toVersion&&fromVersion>=0&&toVersion<=SCHEMA_VERSION,'Unexpected schema upgrade from v${fromVersion} to v{toVersion}.');if(fromVersion<1&&toVersion>=1){createOwnerStore(db);createMutationQueue(db);createQueryCache(db);createRemoteDocumentCache(db);}// Migration 2 to populate the targetGlobal object no longer needed since\n// migration 3 unconditionally clears it.\nvar p=PersistencePromise.resolve();if(fromVersion<3&&toVersion>=3){// Brand new clients don't need to drop and recreate--only clients that\n// potentially have corrupt data.\nif(fromVersion!==0){dropQueryCache(db);createQueryCache(db);}p=p.next(function(){return writeEmptyTargetGlobalEntry(txn);});}return p;}", "get deprecated() {\n return false;\n }", "patch() {\n }", "function libraryVersion() {\r\n return \"1.1.3\";\r\n }", "static transient final private protected public internal function m39() {}", "function StupidBug() {}", "function version() {\r\n return \"3.8.0-dev+202301211440\";\r\n}", "function hooks() {\n \"use strict\";\n}", "function getProductVersion() {\n return \"8.5.0.9167\";\n}", "static transient private internal function m58() {}", "get BC7() {}", "static private internal function m121() {}", "updateCompatibility(aInstallLocation, aOldAddon, aAddonState, aOldAppVersion, aOldPlatformVersion) {\n logger.debug(\"Updating compatibility for add-on \" + aOldAddon.id + \" in \" + aInstallLocation.name);\n\n // If updating from a version of the app that didn't support signedState\n // then fetch that property now\n if (aOldAddon.signedState === undefined && ADDON_SIGNING &&\n SIGNED_TYPES.has(aOldAddon.type)) {\n let file = Cc[\"@mozilla.org/file/local;1\"].createInstance(Ci.nsIFile);\n file.persistentDescriptor = aAddonState.descriptor;\n let manifest = syncLoadManifestFromFile(file, aInstallLocation);\n aOldAddon.signedState = manifest.signedState;\n }\n // This updates the addon's JSON cached data in place\n applyBlocklistChanges(aOldAddon, aOldAddon, aOldAppVersion,\n aOldPlatformVersion);\n aOldAddon.appDisabled = !isUsableAddon(aOldAddon);\n\n return aOldAddon;\n }", "function upgradeAllRegisteredInternal() {\n for (var n = 0; n < registeredComponents_.length; n++) {\n upgradeDomInternal(registeredComponents_[n].className);\n }\n }", "function upgradeAllRegisteredInternal() {\n for (var n = 0; n < registeredComponents_.length; n++) {\n upgradeDomInternal(registeredComponents_[n].className);\n }\n }", "function upgradeAllRegisteredInternal() {\n for (var n = 0; n < registeredComponents_.length; n++) {\n upgradeDomInternal(registeredComponents_[n].className);\n }\n }", "function upgradeAllRegisteredInternal() {\n for (var n = 0; n < registeredComponents_.length; n++) {\n upgradeDomInternal(registeredComponents_[n].className);\n }\n }", "function upgradeAllRegisteredInternal() {\n for (var n = 0; n < registeredComponents_.length; n++) {\n upgradeDomInternal(registeredComponents_[n].className);\n }\n }", "static final protected internal function m110() {}", "function b(){var a,b=\"axe\",c=\"\";return\"undefined\"!=typeof axe&&axe._audit&&!axe._audit.application&&(b=axe._audit.application),\"undefined\"!=typeof axe&&(c=axe.version),a=b+\".\"+c}", "static final private protected public internal function m102() {}", "static final private protected internal function m103() {}", "function getProductVersion() {\n return \"7.4.0.9058\";\n}", "static private protected public internal function m117() {}", "function updateToV6() {\n return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V6, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);\n}", "function sGetFireFixVersion(){\r\n return sFireFixVersion;\r\n}", "function _____SHARED_functions_____(){}", "transient final private public function m168() {}", "migrateFromV1toV2() {\n // MIGRATION_DATE is set a day after we actually deploy, so the overlap\n // covers all timezones. This means for 1 day songbase will load slowly\n // because it redownloads every session.\n const MIGRATION_DATE = new Date('August 22, 2023 03:45:00').getTime();\n this.log('Last updated at: ' + this.app.state.settings.updated_at);\n this.log('MIGRATION_DATE: ' + MIGRATION_DATE);\n if(this.app.state.settings.updated_at > 0 && this.app.state.settings.updated_at < MIGRATION_DATE){\n this.log(\"Resetting DB for v2 API migration.\")\n this.resetDbData();\n this.migrating = true;\n } else {\n this.log('No need to migrate this db');\n }\n }", "repoUpdatedImport(cb) {\n cb('Not implemented');\n }", "function upgradeFn () {\n // == BEGIN MODULE SCOPE VARIABLES ==================================\n var\n xhiObj = this,\n\n catchFn = xhiObj.catchFn,\n commandMap = xhiObj.commandMap,\n logFn = xhiObj.logFn,\n nextFn = xhiObj.nextFn,\n packageMatrix = xhiObj.packageMatrix,\n prefixStr = xhiObj.makePrefixStr( commandMap ),\n stageStatusMap = xhiObj.stageStatusMap,\n\n aliasStr = commandMap.alias_str,\n postObj\n ;\n // == . END MODULE SCOPE VARIABLES ==================================\n\n // == BEGIN UTILITY METHODS =========================================\n // BEGIN utility /failFn/\n // Purpose: Wrap catchFn to store failure and finish\n //\n function failFn () {\n stageStatusMap[ aliasStr ] = false;\n catchFn( arguments );\n }\n // . END utility /failFn/\n // == . END UTILITY METHODS =========================================\n\n // == BEGIN EVENT HANDLERS ==========================================\n // BEGIN event handler /onOutdatedFn/\n function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }\n // . END event handler /onOutdatedFn/\n\n // BEGIN event handler /onLoadFn/\n function onLoadFn ( error_data, localNpmObj ) {\n if ( error_data ) { return catchFn( error_data ); }\n localNpmObj.outdated( onOutdatedFn );\n }\n // . END event handler /onLoadFn/\n // == . END EVENT HANDLERS ==========================================\n\n // == BEGIN MAIN ====================================================\n function mainFn () {\n logFn( prefixStr + 'Start' );\n xhiObj.npmObj.load( xhiObj.fqPkgFilename, onLoadFn );\n }\n // == . END MAIN ====================================================\n mainFn();\n}", "function compat_module_E(n,t){for(var e in t)n[e]=t[e];return n}", "migrate() {\n throw new Error('Migration not implemented');\n }", "function updateToV8() {\n return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V8, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);\n}", "function getMoCheckVersion() {\r\n\treturn \"3.0\";\r\n}", "get isCompatVersion9() {\n return false;\n }", "function fos6_c() {\n ;\n }", "[runUpgrades](e) {\n dbUpgrades.slice((e.oldVersion || 0) - e.newVersion).forEach(fn => fn(e));\n }", "bfs() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "bfs() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function _registerLegacyAPIs() {\n context.foundation = {\n makeLogger,\n startWorkers,\n getConnection,\n getEventEmitter: getSystemEvents\n };\n }", "updateHook() {\n return true;\n }", "function v71(v72) {\n }", "function updateToV7() {\n return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V7, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);\n}", "setVersion(arg) {\n\t\t// this.setState(function(prevState){\n\t\t// \tlet copy = JSON.parse(JSON.stringify(prevState));\n\t\t// \tlet newVer = {\n\t\t// \t\tr_version: arg.minor + ' \"' + arg.nickname + '\"'\n\t\t// \t};\n\t\t//\n\t\t// \tcopy = _.assign(copy, newVer);\n\t\t//\n\t\t// \treturn copy;\n\t\t// });\n\t}", "function InitWebFlyPostBackManager(v09411){ return wdbb71.mb2499(v09411); }", "_computeNewVersion() {\n const { version } = this.active.releaseCandidate;\n return semver.parse(`${version.major}.${version.minor}.${version.patch}`);\n }", "function _prevNamespace(major, minor) {\n\t\t// Standard skipped some of the versions...\n\t\tvar ret = { min: 0, maj: 0 };\n\t\tret.min = minor - 1;\n\t\tif (ret.min < 0) {\n\t\t\tret.maj = major - 1;\n\t\t\tret.min = 5;\n\t\t} else {\n\t\t\tret.maj = major;\n\t\t}\n\t\t\n\t\tif (ret.maj == 2 && ret.min > 1) ret.min = 1;\n\t\tif (ret.maj == 3 && ret.min > 3) ret.min = 3;\n\t\t\n\t\treturn ret;\n\t}", "migrate() {\n\t\tconst settings = this.settingsCollection().document('__settings__');\n\t\tif (settings.version === 'v1.0.0') {\n\t\t\tthis.migrate_v1_0_0_to_v1_1_0();\n\t\t}\n\t}", "function upgradeTo1() {\n console.log(\"Upgrading data model to version 1.0\");\n\t\n var first = false;\n\t\n // upgrading to the new data model\n for (var url in elements.styles) {\n\n // if it is already in the new format, do nothing\n // this may happen when sync is enabled\n // and upgrade is taking place after an upgrade has already taken place at another computer\n\n if (!first) {\n first = elements.styles[url];\n // ideally, there should me a more foolproof check\n if (first['_rules']) {\n console.log(\"Data model already at v1\");\n return;\n }\n }\n\t\t\n var rules = elements.styles[url];\n elements.styles[url] = {};\n elements.styles[url]['_rules'] = rules;\n }\n\t\n // save to localStorage\n updateStylesInDataStore();\n\t\n // update data in bookmark as well\n pushStyles();\n}", "function configUpgrade(configVersion) {\n if (configVersion == null)\n configVersion = \"v1.0\";\n\n try {\n configVersion = configVersion.replace(/[^.\\d]/g, \"\").split(\".\").map(d => parseInt(d));\n function isChecked(settingName) {\n var val = localStorage.getItem(`settings.${settingName}`);\n return val != null && parseInt(val);\n }\n function remove(settingName) {\n localStorage.removeItem(`settings.${settingName}`);\n }\n\n {\n let id = \"contracts\";\n if (isChecked(id)) {\n var dlc = view.dlcsMap.get(\"dlc7\");\n if (dlc)\n dlc.checked(true);\n }\n remove(id);\n }\n\n if (configVersion[0] < 10) {\n if (isChecked(\"noOptionalNeeds\"))\n for (var isl of view.islands())\n for (var l of isl.populationLevels)\n for (var n of l.luxuryNeeds)\n n.checked(false);\n\n for (var key of [\"simpleView\", \"hideNewWorldConstructionMaterial\", \"populationInput\", \"consumptionModifier\", \"additionalProduction\", \"tradeRoutes\", \"autoApplyExtraNeed\", \"autoApplyConsumptionUpgrades\", \"deriveResidentsPerHouse\", \"noOptionalNeeds\"])\n remove(key);\n\n for (var key of [\"populationLevelAmount\"])\n localStorage.removeItem(`serverSettings.${key}`);\n\n for (var isl of view.islands()) {\n for (var b of isl.residenceBuildings) {\n for (var key of [\"limitPerHouse\", \"limit\", \"fixLimitPerHouse\"])\n isl.storage.removeItem(`${b.guid}.${key}`);\n }\n\n for (var l of isl.populationLevels) {\n for (var key of [\"limitPerHouse\", \"limit\", \"fixLimitPerHouse\", \"amountPerHouse\", \"amount\", \"fixAmountPerHouse\"])\n isl.storage.removeItem(`${l.guid}.${key}`);\n\n for (let n of l.needs)\n isl.storage.removeItem(`${l.guid}[${n.guid}].percentBoost`);\n\n }\n }\n }\n\n if (configVersion[0] < 11) {\n for (var isl of view.islands()) {\n for (var f of isl.factories) {\n var id = `${f.guid}.palaceBuff.checked`;\n var buffChecked = isl.storage.getItem(id);\n if (buffChecked == \"1\" && f.palaceBuff == null && f.setBuff != null) {\n f.setBuffChecked(true);\n isl.storage.removeItem(id);\n }\n }\n }\n }\n } catch (e) { console.warn(e); }\n}", "static transient protected internal function m62() {}", "function updateroster() {\n\n}", "function InitWebFlyPostBackManager(v6cc59){ return wdd9448.m52d93(v6cc59); }", "function updateToV6() {\n return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V6, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);\n }", "function VersionCompiler() {\n}" ]
[ "0.73138237", "0.64810467", "0.6443062", "0.63842195", "0.6379148", "0.6364988", "0.6344824", "0.6263174", "0.6259987", "0.61239207", "0.609727", "0.60332894", "0.59703374", "0.5967174", "0.5901337", "0.5901337", "0.5889574", "0.5877613", "0.5871053", "0.5856033", "0.5830225", "0.58273005", "0.5822674", "0.5815467", "0.58124787", "0.57518345", "0.5745001", "0.5685276", "0.56406873", "0.5620766", "0.5618384", "0.5608589", "0.56066376", "0.5523589", "0.55089533", "0.55028844", "0.55005705", "0.5495971", "0.54918325", "0.54780596", "0.5466938", "0.5457132", "0.5452302", "0.5438351", "0.5438351", "0.54065824", "0.5377834", "0.53596497", "0.534165", "0.5309836", "0.5299159", "0.52926505", "0.52836514", "0.5278724", "0.5253931", "0.5251391", "0.5247183", "0.524296", "0.5236677", "0.5236677", "0.5236677", "0.5236677", "0.5236677", "0.5226792", "0.5215821", "0.52120143", "0.520153", "0.5196536", "0.5191606", "0.5191447", "0.5185252", "0.5183748", "0.5177659", "0.517045", "0.5153203", "0.51529175", "0.510944", "0.5100404", "0.5088632", "0.5087844", "0.5087248", "0.50803924", "0.50764316", "0.5075526", "0.5075526", "0.5070313", "0.5057605", "0.5056688", "0.5028451", "0.5026797", "0.5022044", "0.5017127", "0.5012758", "0.5007887", "0.5003223", "0.50008744", "0.4990916", "0.49823198", "0.49760878", "0.49637014", "0.4963515" ]
0.0
-1
auto spend nature tokens
function autoNatureTokens() { var changed = false; for (var nature in game.empowerments) { var empowerment = game.empowerments[nature]; var setting = getPageSetting('Auto' + nature); if (!setting || setting == 'Off') continue; //buy/convert once per nature per loop if (setting == 'Empowerment') { var cost = getNextNatureCost(nature); if (empowerment.tokens < cost) continue; empowerment.tokens -= cost; empowerment.level++; changed = true; debug('Upgraded Empowerment of ' + nature, 'nature'); } else if (setting == 'Transfer') { if (empowerment.retainLevel >= 80) continue; var cost = getNextNatureCost(nature, true); if (empowerment.tokens < cost) continue; empowerment.tokens -= cost; empowerment.retainLevel++; changed = true; debug('Upgraded ' + nature + ' transfer rate', 'nature'); } else if (setting == 'Convert to Both') { if (empowerment.tokens < 20) continue; for (var targetNature in game.empowerments) { if (targetNature == nature) continue; empowerment.tokens -= 10; var convertRate = (game.talents.nature.purchased) ? ((game.talents.nature2.purchased) ? 8 : 6) : 5; game.empowerments[targetNature].tokens += convertRate; changed = true; debug('Converted ' + nature + ' tokens to ' + targetNature, 'nature'); } } else { if (empowerment.tokens < 10) continue; var match = setting.match(/Convert to (\w+)/); var targetNature = match ? match[1] : null; //sanity check if (!targetNature || targetNature === nature || !game.empowerments[targetNature]) continue; empowerment.tokens -= 10; var convertRate = (game.talents.nature.purchased) ? ((game.talents.nature2.purchased) ? 8 : 6) : 5; game.empowerments[targetNature].tokens += convertRate; changed = true; debug('Converted ' + nature + ' tokens to ' + targetNature, 'nature'); } } if (changed) updateNatureInfoSpans(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function twTokenStrong(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"'\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"'\");\n }\n return \"strong\";\n }", "function twTokenStrong(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"'\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"'\");\n }\n return \"strong\";\n }", "function semAnyToken(state, chars, phraseIndex, phraseCount, data) {\n if (state == id.SEM_PRE) {\n data.temp = \"\";\n } else {\n data.str += data.temp + \"\\n\";\n }\n return id.SEM_OK;\n }", "function GetTokenForSpend() {\n let tokens = loadTokens();\n const tokenToSpend = tokens[0];\n tokens = tokens.slice(1);\n storeTokens(tokens);\n return tokenToSpend;\n}", "function twTokenStrong(stream, state) {\n var maybeEnd = false,\n\t\t\tch;\n while (ch = stream.next()) {\n if (ch == \"'\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"'\");\n }\n return ret(\"text\", \"strong\");\n }", "async function stakeTokens(amount) {\n console.log(\"staking \", amount, \"DAI tokens\");\n console.log(tokenFarm._address);\n console.log(\"typeof amount:\", typeof(amount));\n setLoading(true)\n // first approve the transaction\n daiToken.methods.approve(tokenFarm._address, amount)\n .send({ from: account })\n .on('transactionHash', (hash) => {\n tokenFarm.methods.stakeTokens(amount)\n .send({ from: account })\n .on('transactionHash', (hash) => {\n console.log(hash);\n })\n })\n setLoading(false)\n console.log(\"take tokens finished\");\n loadBlockChainData()\n \n }", "function tokener(value, type) {\r\n session.tokens.push({\r\n value: value,\r\n type: type || value,\r\n start: null,\r\n end: null\r\n });\r\n }", "static generateToken() {\n return DataGenerator.generateRandomText() + DataGenerator.generateRandomText(); // to make it longer\n }", "consume() {\n this.tokenIndex++;\n }", "function traducir() {\n let exmaple = editor1.getValue();\n tokens = generaTokens(exmaple);\n mostrarTokens(tokens);\n console.log(tokens);\n console.log(sintactico(tokens))\n editor2.setValue(sintactico(tokens))\n}", "function generateUtterTask() {\n let word;\n switch (parse(localStorage.level)) {\n case 1:\n word = _.sample(window.tasks.spellСheck.level1);\n break;\n case 2:\n word = _.sample(window.tasks.spellСheck.level2);\n break;\n case 3:\n word = _.sample(window.tasks.spellСheck.level3);\n break;\n }\n const toReturn = [word];\n toReturn.push(window.utils.initUtterance(word));\n return toReturn;\n }", "consume() {\n this.tokenIndex++;\n }", "async generateTokens ({ dispatch, state, getters }, { amount, to = false }) {\n state.instance.generateTokens(!to ? state.account : to, amount, getters.txParams)\n }", "generateTokens(x, y){\r\n y = y + 400 * Math.random();\r\n this.tokens.add(new Token(this, x, y, 'token', 0));\r\n }", "function nextToken() {\n return Date.now() + Math.random()\n }", "function stellarToken(name, fullName, decimalPlaces, asset, domain, features, prefix, suffix, network) {\n if (domain === void 0) { domain = ''; }\n if (features === void 0) { features = AccountCoin.DEFAULT_FEATURES; }\n if (prefix === void 0) { prefix = ''; }\n if (suffix === void 0) { suffix = name.toUpperCase(); }\n if (network === void 0) { network = networks_1.Networks.main.stellar; }\n return Object.freeze(new StellarCoin({\n name: name,\n fullName: fullName,\n decimalPlaces: decimalPlaces,\n asset: asset,\n domain: domain,\n features: features,\n prefix: prefix,\n suffix: suffix,\n network: network,\n isToken: true,\n }));\n}", "function consume(x){if(x.includes(token.t))return token=tokens[i++]}", "constructor(token, amount) {\n super(token, amount);\n this.token = token;\n }", "function generateTokenizedPassage()\n{\n\ttokenizedPassage = RiTa.tokenize(selectedPassageText);\n\n\tconsole.log(tokenizedPassage[2]);\n}", "function _token(){\n\tvar len = util_args2int() || 32;\n\tvar suid = require('rand-token').suid;\n\tvar token = suid(len);\n\tconsole.log( esrever.reverse(token) );\n}", "function next() {\n _base.state.tokens.push(new Token());\n nextToken();\n}", "exposeTokenDataToGrammar() {\r\n\t\t\t\t\treturn this.scanTokens(function(token, i) {\r\n\t\t\t\t\t\tvar key, ref, ref1, val;\r\n\t\t\t\t\t\tif (token.generated || (token.data && Object.keys(token.data).length !== 0)) {\r\n\t\t\t\t\t\t\ttoken[1] = new String(token[1]);\r\n\t\t\t\t\t\t\tref1 = (ref = token.data) != null ? ref : {};\r\n\t\t\t\t\t\t\tfor (key in ref1) {\r\n\t\t\t\t\t\t\t\tif (!hasProp.call(ref1, key)) continue;\r\n\t\t\t\t\t\t\t\tval = ref1[key];\r\n\t\t\t\t\t\t\t\ttoken[1][key] = val;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (token.generated) {\r\n\t\t\t\t\t\t\t\ttoken[1].generated = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t});\r\n\t\t\t\t}", "function luisprehandler(fullutterance)\n{\n var sentences = senttokenizer.tokenize(fullutterance);\n for (sent of sentences)\n {\n getLuisIntent(sent)\n }\n}", "function next() {\n state.tokens.push(new Token());\n nextToken();\n}", "function step2 (token) {\n token = replacePatterns(token, [['ational', '', 'ate'], ['tional', '', 'tion'], ['enci', '', 'ence'], ['anci', '', 'ance'],\n ['izer', '', 'ize'], ['abli', '', 'able'], ['bli', '', 'ble'], ['alli', '', 'al'], ['entli', '', 'ent'], ['eli', '', 'e'],\n ['ousli', '', 'ous'], ['ization', '', 'ize'], ['ation', '', 'ate'], ['ator', '', 'ate'], ['alism', '', 'al'],\n ['iveness', '', 'ive'], ['fulness', '', 'ful'], ['ousness', '', 'ous'], ['aliti', '', 'al'],\n ['iviti', '', 'ive'], ['biliti', '', 'ble'], ['logi', '', 'log']], 0)\n\n return token\n}", "eatToken(type) {\n\t\t\tconst token = this.getToken();\n\t\t\tif (token.type === type) {\n\t\t\t\tthis.nextToken();\n\t\t\t\t// @ts-ignore\n\t\t\t\treturn token;\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}", "async function GenerateToken(tx, amount) {\n const factory = await getFactory();\n const tokenRegistry = await getAssetRegistry('org.energy.network.Token');\n let tokenArray = [];\n for (let i = 0; i < amount; i++) {\n const newToken = await factory.newResource('org.energy.network', 'Token', tx.owner.consumerID + \"-\" + Math.floor(Math.random() * 90000));\n newToken.owner = tx.owner;\n tokenArray.push(newToken);\n }\n tokenRegistry.addAll(tokenArray);\n}", "function twTokenStrike(stream, state) {\n var maybeEnd = false,\n\t\t\tch, nr;\n\t\t\t\n while (ch = stream.next()) {\n if (ch == \"-\" && maybeEnd) {\n state.tokenize = jsTokenBase;\n break;\n }\n maybeEnd = (ch == \"-\");\n }\n return ret(\"text\", \"line-through\");\n }", "function tokenBase(stream, state) {\n var ch = stream.next();\n if (hooks[ch]) {\n var result = hooks[ch](stream, state);\n if (result !== false) return result;\n }\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n }\n if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n curPunc = ch;\n return null;\n }\n // Asigna la clase de los números\n if (/\\d/.test(ch)) {\n stream.eatWhile(/[\\w\\.]/);\n return \"number\";\n }\n if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n }\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n }\n if (isOperatorChar.test(ch)) {\n stream.eatWhile(isOperatorChar);\n return \"operator\";\n }\n stream.eatWhile(/[\\w\\$_]/);\n var cur = stream.current();\n\n // Esto esta agregado por mi para diferenciar de clase los keywords de bloque\n // porque antes no los diferenciaba\n\n if (blockKeywords.propertyIsEnumerable(cur)) {\n return \"blockKeyword\";\n };\n\n\n if (constantKeywords.propertyIsEnumerable(cur)) {\n return \"constantKeyword\";\n }\n\n\n if (outerBlockKeywords.propertyIsEnumerable(cur)) {\n return \"outerBlockKeyword\";\n };\n\n if (keywords.propertyIsEnumerable(cur)) {\n if (blockKeywords.propertyIsEnumerable(cur)) curPunc = \"newstatement\";\n // Esta la clase que asigna\n return \"keyword\";\n }\n if (builtin.propertyIsEnumerable(cur)) {\n if (blockKeywords.propertyIsEnumerable(cur)) curPunc = \"newstatement\";\n return \"builtin\";\n }\n if (atoms.propertyIsEnumerable(cur)) {\n return \"atom\";\n }\n\n\n\n // Si no es nada de todo lo anterior devuelve \"variable\"\n // lo cual me parece que esta como el culo pero por ahora sirve\n //return \"variable\";\n }", "function GenTokenParser(){}", "function step2(token) {\n return replacePatterns(token, [['ational', 'ate'], ['tional', 'tion'], ['enci', 'ence'], ['anci', 'ance'],\n ['izer', 'ize'], ['abli', 'able'], ['alli', 'al'], ['entli', 'ent'], ['eli', 'e'],\n ['ousli', 'ous'], ['ization', 'ize'], ['ation', 'ate'], ['ator', 'ate'],['alism', 'al'],\n ['iveness', 'ive'], ['fulness', 'ful'], ['ousness', 'ous'], ['aliti', 'al'],\n ['iviti', 'ive'], ['biliti', 'ble']], 0);\n}", "function step4 (token) {\n return replaceRegex(token, /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/, [1], 1) ||\n replaceRegex(token, /^(.+?)(s|t)(ion)$/, [1, 2], 1) ||\n token\n}", "function demand(x){token.t===x?(token=tokens[i++]):parserError('Expected token of type '+x+' but got '+token.t)}", "function twTokenStrike(stream, state) {\n var maybeEnd = false, ch;\n\n while (ch = stream.next()) {\n if (ch == \"-\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"-\");\n }\n return \"strikethrough\";\n }", "function twTokenStrike(stream, state) {\n var maybeEnd = false, ch;\n\n while (ch = stream.next()) {\n if (ch == \"-\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"-\");\n }\n return \"strikethrough\";\n }", "generateToken() {\n this.data = require(\"../data/tokens\");\n return this.data[Math.floor(Math.random() * this.data.length)];\n }", "function step1a(token) { \n if(token.match(/(ss|i)es$/))\n return token.replace(/(ss|i)es$/, '$1');\n \n if(token.substr(-1) == 's' && token.substr(-2, 1) != 's' && token.length > 3)\n return token.replace(/s?$/, '');\n \n return token;\n}", "function TokenStore(){\n\n var tokens = {};\n\n}", "function customTokens (data) {\n var tokers = [ ];\n console.log(\"TOKE\", data);\n if (data.spec)\n tokers = tokers.concat(Bloodhound.tokenizers.whitespace(data.spec));\n if (data.products) {\n for (var x=0; x< data.products.length; x++) {\n tokers = tokers.concat(Bloodhound.tokenizers.whitespace(data.products[x]));\n }\n }\n return tokers;\n }", "tokenTypes(){ return [] }", "updateTokens() {\n this.getTokens();\n }", "constructor(tokens) {\n this.tokens = tokens\n this.pos = 0\n this.types = {}\n for( var i=0; i<tokens.length; i++) this.types[tokens[i].type] = \"\"\n }", "function gumgum() {\n\n // ctx is used to save and to end the chain\n const ctx = function (...arg) {\n return {\n compile() {\n let firstChain = ctx.chain.shift();\n let dest = new EsWord(firstChain, arg, Array.isArray(arg[0])).compile();\n\n // bubble up the chain\n ctx.chain.forEach(elem => {\n dest = { [elem]: dest };\n });\n\n ctx.chain.unshift(firstChain);\n\n return dest;\n }\n }\n };\n\n // the chain\n ctx.chain = [];\n\n // for each available elastic keywords create a getter\n keyWords.forEach(kw => {\n Reflect.defineProperty(ctx, camelcase(kw), {\n get() {\n ctx.chain.unshift(kw);\n return ctx;\n }\n });\n });\n\n return ctx;\n}", "function stan(hljs) {\n // variable names cannot conflict with block identifiers\n const BLOCKS = [\n 'functions',\n 'model',\n 'data',\n 'parameters',\n 'quantities',\n 'transformed',\n 'generated'\n ];\n const STATEMENTS = [\n 'for',\n 'in',\n 'if',\n 'else',\n 'while',\n 'break',\n 'continue',\n 'return'\n ];\n const SPECIAL_FUNCTIONS = [\n 'print',\n 'reject',\n 'increment_log_prob|10',\n 'integrate_ode|10',\n 'integrate_ode_rk45|10',\n 'integrate_ode_bdf|10',\n 'algebra_solver'\n ];\n const VAR_TYPES = [\n 'int',\n 'real',\n 'vector',\n 'ordered',\n 'positive_ordered',\n 'simplex',\n 'unit_vector',\n 'row_vector',\n 'matrix',\n 'cholesky_factor_corr|10',\n 'cholesky_factor_cov|10',\n 'corr_matrix|10',\n 'cov_matrix|10',\n 'void'\n ];\n const FUNCTIONS = [\n 'Phi',\n 'Phi_approx',\n 'abs',\n 'acos',\n 'acosh',\n 'algebra_solver',\n 'append_array',\n 'append_col',\n 'append_row',\n 'asin',\n 'asinh',\n 'atan',\n 'atan2',\n 'atanh',\n 'bernoulli_cdf',\n 'bernoulli_lccdf',\n 'bernoulli_lcdf',\n 'bernoulli_logit_lpmf',\n 'bernoulli_logit_rng',\n 'bernoulli_lpmf',\n 'bernoulli_rng',\n 'bessel_first_kind',\n 'bessel_second_kind',\n 'beta_binomial_cdf',\n 'beta_binomial_lccdf',\n 'beta_binomial_lcdf',\n 'beta_binomial_lpmf',\n 'beta_binomial_rng',\n 'beta_cdf',\n 'beta_lccdf',\n 'beta_lcdf',\n 'beta_lpdf',\n 'beta_rng',\n 'binary_log_loss',\n 'binomial_cdf',\n 'binomial_coefficient_log',\n 'binomial_lccdf',\n 'binomial_lcdf',\n 'binomial_logit_lpmf',\n 'binomial_lpmf',\n 'binomial_rng',\n 'block',\n 'categorical_logit_lpmf',\n 'categorical_logit_rng',\n 'categorical_lpmf',\n 'categorical_rng',\n 'cauchy_cdf',\n 'cauchy_lccdf',\n 'cauchy_lcdf',\n 'cauchy_lpdf',\n 'cauchy_rng',\n 'cbrt',\n 'ceil',\n 'chi_square_cdf',\n 'chi_square_lccdf',\n 'chi_square_lcdf',\n 'chi_square_lpdf',\n 'chi_square_rng',\n 'cholesky_decompose',\n 'choose',\n 'col',\n 'cols',\n 'columns_dot_product',\n 'columns_dot_self',\n 'cos',\n 'cosh',\n 'cov_exp_quad',\n 'crossprod',\n 'csr_extract_u',\n 'csr_extract_v',\n 'csr_extract_w',\n 'csr_matrix_times_vector',\n 'csr_to_dense_matrix',\n 'cumulative_sum',\n 'determinant',\n 'diag_matrix',\n 'diag_post_multiply',\n 'diag_pre_multiply',\n 'diagonal',\n 'digamma',\n 'dims',\n 'dirichlet_lpdf',\n 'dirichlet_rng',\n 'distance',\n 'dot_product',\n 'dot_self',\n 'double_exponential_cdf',\n 'double_exponential_lccdf',\n 'double_exponential_lcdf',\n 'double_exponential_lpdf',\n 'double_exponential_rng',\n 'e',\n 'eigenvalues_sym',\n 'eigenvectors_sym',\n 'erf',\n 'erfc',\n 'exp',\n 'exp2',\n 'exp_mod_normal_cdf',\n 'exp_mod_normal_lccdf',\n 'exp_mod_normal_lcdf',\n 'exp_mod_normal_lpdf',\n 'exp_mod_normal_rng',\n 'expm1',\n 'exponential_cdf',\n 'exponential_lccdf',\n 'exponential_lcdf',\n 'exponential_lpdf',\n 'exponential_rng',\n 'fabs',\n 'falling_factorial',\n 'fdim',\n 'floor',\n 'fma',\n 'fmax',\n 'fmin',\n 'fmod',\n 'frechet_cdf',\n 'frechet_lccdf',\n 'frechet_lcdf',\n 'frechet_lpdf',\n 'frechet_rng',\n 'gamma_cdf',\n 'gamma_lccdf',\n 'gamma_lcdf',\n 'gamma_lpdf',\n 'gamma_p',\n 'gamma_q',\n 'gamma_rng',\n 'gaussian_dlm_obs_lpdf',\n 'get_lp',\n 'gumbel_cdf',\n 'gumbel_lccdf',\n 'gumbel_lcdf',\n 'gumbel_lpdf',\n 'gumbel_rng',\n 'head',\n 'hypergeometric_lpmf',\n 'hypergeometric_rng',\n 'hypot',\n 'inc_beta',\n 'int_step',\n 'integrate_ode',\n 'integrate_ode_bdf',\n 'integrate_ode_rk45',\n 'inv',\n 'inv_Phi',\n 'inv_chi_square_cdf',\n 'inv_chi_square_lccdf',\n 'inv_chi_square_lcdf',\n 'inv_chi_square_lpdf',\n 'inv_chi_square_rng',\n 'inv_cloglog',\n 'inv_gamma_cdf',\n 'inv_gamma_lccdf',\n 'inv_gamma_lcdf',\n 'inv_gamma_lpdf',\n 'inv_gamma_rng',\n 'inv_logit',\n 'inv_sqrt',\n 'inv_square',\n 'inv_wishart_lpdf',\n 'inv_wishart_rng',\n 'inverse',\n 'inverse_spd',\n 'is_inf',\n 'is_nan',\n 'lbeta',\n 'lchoose',\n 'lgamma',\n 'lkj_corr_cholesky_lpdf',\n 'lkj_corr_cholesky_rng',\n 'lkj_corr_lpdf',\n 'lkj_corr_rng',\n 'lmgamma',\n 'lmultiply',\n 'log',\n 'log10',\n 'log1m',\n 'log1m_exp',\n 'log1m_inv_logit',\n 'log1p',\n 'log1p_exp',\n 'log2',\n 'log_determinant',\n 'log_diff_exp',\n 'log_falling_factorial',\n 'log_inv_logit',\n 'log_mix',\n 'log_rising_factorial',\n 'log_softmax',\n 'log_sum_exp',\n 'logistic_cdf',\n 'logistic_lccdf',\n 'logistic_lcdf',\n 'logistic_lpdf',\n 'logistic_rng',\n 'logit',\n 'lognormal_cdf',\n 'lognormal_lccdf',\n 'lognormal_lcdf',\n 'lognormal_lpdf',\n 'lognormal_rng',\n 'machine_precision',\n 'matrix_exp',\n 'max',\n 'mdivide_left_spd',\n 'mdivide_left_tri_low',\n 'mdivide_right_spd',\n 'mdivide_right_tri_low',\n 'mean',\n 'min',\n 'modified_bessel_first_kind',\n 'modified_bessel_second_kind',\n 'multi_gp_cholesky_lpdf',\n 'multi_gp_lpdf',\n 'multi_normal_cholesky_lpdf',\n 'multi_normal_cholesky_rng',\n 'multi_normal_lpdf',\n 'multi_normal_prec_lpdf',\n 'multi_normal_rng',\n 'multi_student_t_lpdf',\n 'multi_student_t_rng',\n 'multinomial_lpmf',\n 'multinomial_rng',\n 'multiply_log',\n 'multiply_lower_tri_self_transpose',\n 'neg_binomial_2_cdf',\n 'neg_binomial_2_lccdf',\n 'neg_binomial_2_lcdf',\n 'neg_binomial_2_log_lpmf',\n 'neg_binomial_2_log_rng',\n 'neg_binomial_2_lpmf',\n 'neg_binomial_2_rng',\n 'neg_binomial_cdf',\n 'neg_binomial_lccdf',\n 'neg_binomial_lcdf',\n 'neg_binomial_lpmf',\n 'neg_binomial_rng',\n 'negative_infinity',\n 'normal_cdf',\n 'normal_lccdf',\n 'normal_lcdf',\n 'normal_lpdf',\n 'normal_rng',\n 'not_a_number',\n 'num_elements',\n 'ordered_logistic_lpmf',\n 'ordered_logistic_rng',\n 'owens_t',\n 'pareto_cdf',\n 'pareto_lccdf',\n 'pareto_lcdf',\n 'pareto_lpdf',\n 'pareto_rng',\n 'pareto_type_2_cdf',\n 'pareto_type_2_lccdf',\n 'pareto_type_2_lcdf',\n 'pareto_type_2_lpdf',\n 'pareto_type_2_rng',\n 'pi',\n 'poisson_cdf',\n 'poisson_lccdf',\n 'poisson_lcdf',\n 'poisson_log_lpmf',\n 'poisson_log_rng',\n 'poisson_lpmf',\n 'poisson_rng',\n 'positive_infinity',\n 'pow',\n 'print',\n 'prod',\n 'qr_Q',\n 'qr_R',\n 'quad_form',\n 'quad_form_diag',\n 'quad_form_sym',\n 'rank',\n 'rayleigh_cdf',\n 'rayleigh_lccdf',\n 'rayleigh_lcdf',\n 'rayleigh_lpdf',\n 'rayleigh_rng',\n 'reject',\n 'rep_array',\n 'rep_matrix',\n 'rep_row_vector',\n 'rep_vector',\n 'rising_factorial',\n 'round',\n 'row',\n 'rows',\n 'rows_dot_product',\n 'rows_dot_self',\n 'scaled_inv_chi_square_cdf',\n 'scaled_inv_chi_square_lccdf',\n 'scaled_inv_chi_square_lcdf',\n 'scaled_inv_chi_square_lpdf',\n 'scaled_inv_chi_square_rng',\n 'sd',\n 'segment',\n 'sin',\n 'singular_values',\n 'sinh',\n 'size',\n 'skew_normal_cdf',\n 'skew_normal_lccdf',\n 'skew_normal_lcdf',\n 'skew_normal_lpdf',\n 'skew_normal_rng',\n 'softmax',\n 'sort_asc',\n 'sort_desc',\n 'sort_indices_asc',\n 'sort_indices_desc',\n 'sqrt',\n 'sqrt2',\n 'square',\n 'squared_distance',\n 'step',\n 'student_t_cdf',\n 'student_t_lccdf',\n 'student_t_lcdf',\n 'student_t_lpdf',\n 'student_t_rng',\n 'sub_col',\n 'sub_row',\n 'sum',\n 'tail',\n 'tan',\n 'tanh',\n 'target',\n 'tcrossprod',\n 'tgamma',\n 'to_array_1d',\n 'to_array_2d',\n 'to_matrix',\n 'to_row_vector',\n 'to_vector',\n 'trace',\n 'trace_gen_quad_form',\n 'trace_quad_form',\n 'trigamma',\n 'trunc',\n 'uniform_cdf',\n 'uniform_lccdf',\n 'uniform_lcdf',\n 'uniform_lpdf',\n 'uniform_rng',\n 'variance',\n 'von_mises_lpdf',\n 'von_mises_rng',\n 'weibull_cdf',\n 'weibull_lccdf',\n 'weibull_lcdf',\n 'weibull_lpdf',\n 'weibull_rng',\n 'wiener_lpdf',\n 'wishart_lpdf',\n 'wishart_rng'\n ];\n const DISTRIBUTIONS = [\n 'bernoulli',\n 'bernoulli_logit',\n 'beta',\n 'beta_binomial',\n 'binomial',\n 'binomial_logit',\n 'categorical',\n 'categorical_logit',\n 'cauchy',\n 'chi_square',\n 'dirichlet',\n 'double_exponential',\n 'exp_mod_normal',\n 'exponential',\n 'frechet',\n 'gamma',\n 'gaussian_dlm_obs',\n 'gumbel',\n 'hypergeometric',\n 'inv_chi_square',\n 'inv_gamma',\n 'inv_wishart',\n 'lkj_corr',\n 'lkj_corr_cholesky',\n 'logistic',\n 'lognormal',\n 'multi_gp',\n 'multi_gp_cholesky',\n 'multi_normal',\n 'multi_normal_cholesky',\n 'multi_normal_prec',\n 'multi_student_t',\n 'multinomial',\n 'neg_binomial',\n 'neg_binomial_2',\n 'neg_binomial_2_log',\n 'normal',\n 'ordered_logistic',\n 'pareto',\n 'pareto_type_2',\n 'poisson',\n 'poisson_log',\n 'rayleigh',\n 'scaled_inv_chi_square',\n 'skew_normal',\n 'student_t',\n 'uniform',\n 'von_mises',\n 'weibull',\n 'wiener',\n 'wishart'\n ];\n\n return {\n name: 'Stan',\n aliases: [ 'stanfuncs' ],\n keywords: {\n $pattern: hljs.IDENT_RE,\n title: BLOCKS.join(' '),\n keyword: STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),\n built_in: FUNCTIONS.join(' ')\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.COMMENT(\n /#/,\n /$/,\n {\n relevance: 0,\n keywords: {\n 'meta-keyword': 'include'\n }\n }\n ),\n hljs.COMMENT(\n /\\/\\*/,\n /\\*\\//,\n {\n relevance: 0,\n // highlight doc strings mentioned in Stan reference\n contains: [\n {\n className: 'doctag',\n begin: /@(return|param)/\n }\n ]\n }\n ),\n {\n // hack: in range constraints, lower must follow \"<\"\n begin: /<\\s*lower\\s*=/,\n keywords: 'lower'\n },\n {\n // hack: in range constraints, upper must follow either , or <\n // <lower = ..., upper = ...> or <upper = ...>\n begin: /[<,]\\s*upper\\s*=/,\n keywords: 'upper'\n },\n {\n className: 'keyword',\n begin: /\\btarget\\s*\\+=/,\n relevance: 10\n },\n {\n begin: '~\\\\s*(' + hljs.IDENT_RE + ')\\\\s*\\\\(',\n keywords: DISTRIBUTIONS.join(' ')\n },\n {\n className: 'number',\n variants: [\n {\n begin: /\\b\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?/\n },\n {\n begin: /\\.\\d+(?:[eE][+-]?\\d+)?\\b/\n }\n ],\n relevance: 0\n },\n {\n className: 'string',\n begin: '\"',\n end: '\"',\n relevance: 0\n }\n ]\n };\n}", "function stan(hljs) {\n // variable names cannot conflict with block identifiers\n const BLOCKS = [\n 'functions',\n 'model',\n 'data',\n 'parameters',\n 'quantities',\n 'transformed',\n 'generated'\n ];\n const STATEMENTS = [\n 'for',\n 'in',\n 'if',\n 'else',\n 'while',\n 'break',\n 'continue',\n 'return'\n ];\n const SPECIAL_FUNCTIONS = [\n 'print',\n 'reject',\n 'increment_log_prob|10',\n 'integrate_ode|10',\n 'integrate_ode_rk45|10',\n 'integrate_ode_bdf|10',\n 'algebra_solver'\n ];\n const VAR_TYPES = [\n 'int',\n 'real',\n 'vector',\n 'ordered',\n 'positive_ordered',\n 'simplex',\n 'unit_vector',\n 'row_vector',\n 'matrix',\n 'cholesky_factor_corr|10',\n 'cholesky_factor_cov|10',\n 'corr_matrix|10',\n 'cov_matrix|10',\n 'void'\n ];\n const FUNCTIONS = [\n 'Phi',\n 'Phi_approx',\n 'abs',\n 'acos',\n 'acosh',\n 'algebra_solver',\n 'append_array',\n 'append_col',\n 'append_row',\n 'asin',\n 'asinh',\n 'atan',\n 'atan2',\n 'atanh',\n 'bernoulli_cdf',\n 'bernoulli_lccdf',\n 'bernoulli_lcdf',\n 'bernoulli_logit_lpmf',\n 'bernoulli_logit_rng',\n 'bernoulli_lpmf',\n 'bernoulli_rng',\n 'bessel_first_kind',\n 'bessel_second_kind',\n 'beta_binomial_cdf',\n 'beta_binomial_lccdf',\n 'beta_binomial_lcdf',\n 'beta_binomial_lpmf',\n 'beta_binomial_rng',\n 'beta_cdf',\n 'beta_lccdf',\n 'beta_lcdf',\n 'beta_lpdf',\n 'beta_rng',\n 'binary_log_loss',\n 'binomial_cdf',\n 'binomial_coefficient_log',\n 'binomial_lccdf',\n 'binomial_lcdf',\n 'binomial_logit_lpmf',\n 'binomial_lpmf',\n 'binomial_rng',\n 'block',\n 'categorical_logit_lpmf',\n 'categorical_logit_rng',\n 'categorical_lpmf',\n 'categorical_rng',\n 'cauchy_cdf',\n 'cauchy_lccdf',\n 'cauchy_lcdf',\n 'cauchy_lpdf',\n 'cauchy_rng',\n 'cbrt',\n 'ceil',\n 'chi_square_cdf',\n 'chi_square_lccdf',\n 'chi_square_lcdf',\n 'chi_square_lpdf',\n 'chi_square_rng',\n 'cholesky_decompose',\n 'choose',\n 'col',\n 'cols',\n 'columns_dot_product',\n 'columns_dot_self',\n 'cos',\n 'cosh',\n 'cov_exp_quad',\n 'crossprod',\n 'csr_extract_u',\n 'csr_extract_v',\n 'csr_extract_w',\n 'csr_matrix_times_vector',\n 'csr_to_dense_matrix',\n 'cumulative_sum',\n 'determinant',\n 'diag_matrix',\n 'diag_post_multiply',\n 'diag_pre_multiply',\n 'diagonal',\n 'digamma',\n 'dims',\n 'dirichlet_lpdf',\n 'dirichlet_rng',\n 'distance',\n 'dot_product',\n 'dot_self',\n 'double_exponential_cdf',\n 'double_exponential_lccdf',\n 'double_exponential_lcdf',\n 'double_exponential_lpdf',\n 'double_exponential_rng',\n 'e',\n 'eigenvalues_sym',\n 'eigenvectors_sym',\n 'erf',\n 'erfc',\n 'exp',\n 'exp2',\n 'exp_mod_normal_cdf',\n 'exp_mod_normal_lccdf',\n 'exp_mod_normal_lcdf',\n 'exp_mod_normal_lpdf',\n 'exp_mod_normal_rng',\n 'expm1',\n 'exponential_cdf',\n 'exponential_lccdf',\n 'exponential_lcdf',\n 'exponential_lpdf',\n 'exponential_rng',\n 'fabs',\n 'falling_factorial',\n 'fdim',\n 'floor',\n 'fma',\n 'fmax',\n 'fmin',\n 'fmod',\n 'frechet_cdf',\n 'frechet_lccdf',\n 'frechet_lcdf',\n 'frechet_lpdf',\n 'frechet_rng',\n 'gamma_cdf',\n 'gamma_lccdf',\n 'gamma_lcdf',\n 'gamma_lpdf',\n 'gamma_p',\n 'gamma_q',\n 'gamma_rng',\n 'gaussian_dlm_obs_lpdf',\n 'get_lp',\n 'gumbel_cdf',\n 'gumbel_lccdf',\n 'gumbel_lcdf',\n 'gumbel_lpdf',\n 'gumbel_rng',\n 'head',\n 'hypergeometric_lpmf',\n 'hypergeometric_rng',\n 'hypot',\n 'inc_beta',\n 'int_step',\n 'integrate_ode',\n 'integrate_ode_bdf',\n 'integrate_ode_rk45',\n 'inv',\n 'inv_Phi',\n 'inv_chi_square_cdf',\n 'inv_chi_square_lccdf',\n 'inv_chi_square_lcdf',\n 'inv_chi_square_lpdf',\n 'inv_chi_square_rng',\n 'inv_cloglog',\n 'inv_gamma_cdf',\n 'inv_gamma_lccdf',\n 'inv_gamma_lcdf',\n 'inv_gamma_lpdf',\n 'inv_gamma_rng',\n 'inv_logit',\n 'inv_sqrt',\n 'inv_square',\n 'inv_wishart_lpdf',\n 'inv_wishart_rng',\n 'inverse',\n 'inverse_spd',\n 'is_inf',\n 'is_nan',\n 'lbeta',\n 'lchoose',\n 'lgamma',\n 'lkj_corr_cholesky_lpdf',\n 'lkj_corr_cholesky_rng',\n 'lkj_corr_lpdf',\n 'lkj_corr_rng',\n 'lmgamma',\n 'lmultiply',\n 'log',\n 'log10',\n 'log1m',\n 'log1m_exp',\n 'log1m_inv_logit',\n 'log1p',\n 'log1p_exp',\n 'log2',\n 'log_determinant',\n 'log_diff_exp',\n 'log_falling_factorial',\n 'log_inv_logit',\n 'log_mix',\n 'log_rising_factorial',\n 'log_softmax',\n 'log_sum_exp',\n 'logistic_cdf',\n 'logistic_lccdf',\n 'logistic_lcdf',\n 'logistic_lpdf',\n 'logistic_rng',\n 'logit',\n 'lognormal_cdf',\n 'lognormal_lccdf',\n 'lognormal_lcdf',\n 'lognormal_lpdf',\n 'lognormal_rng',\n 'machine_precision',\n 'matrix_exp',\n 'max',\n 'mdivide_left_spd',\n 'mdivide_left_tri_low',\n 'mdivide_right_spd',\n 'mdivide_right_tri_low',\n 'mean',\n 'min',\n 'modified_bessel_first_kind',\n 'modified_bessel_second_kind',\n 'multi_gp_cholesky_lpdf',\n 'multi_gp_lpdf',\n 'multi_normal_cholesky_lpdf',\n 'multi_normal_cholesky_rng',\n 'multi_normal_lpdf',\n 'multi_normal_prec_lpdf',\n 'multi_normal_rng',\n 'multi_student_t_lpdf',\n 'multi_student_t_rng',\n 'multinomial_lpmf',\n 'multinomial_rng',\n 'multiply_log',\n 'multiply_lower_tri_self_transpose',\n 'neg_binomial_2_cdf',\n 'neg_binomial_2_lccdf',\n 'neg_binomial_2_lcdf',\n 'neg_binomial_2_log_lpmf',\n 'neg_binomial_2_log_rng',\n 'neg_binomial_2_lpmf',\n 'neg_binomial_2_rng',\n 'neg_binomial_cdf',\n 'neg_binomial_lccdf',\n 'neg_binomial_lcdf',\n 'neg_binomial_lpmf',\n 'neg_binomial_rng',\n 'negative_infinity',\n 'normal_cdf',\n 'normal_lccdf',\n 'normal_lcdf',\n 'normal_lpdf',\n 'normal_rng',\n 'not_a_number',\n 'num_elements',\n 'ordered_logistic_lpmf',\n 'ordered_logistic_rng',\n 'owens_t',\n 'pareto_cdf',\n 'pareto_lccdf',\n 'pareto_lcdf',\n 'pareto_lpdf',\n 'pareto_rng',\n 'pareto_type_2_cdf',\n 'pareto_type_2_lccdf',\n 'pareto_type_2_lcdf',\n 'pareto_type_2_lpdf',\n 'pareto_type_2_rng',\n 'pi',\n 'poisson_cdf',\n 'poisson_lccdf',\n 'poisson_lcdf',\n 'poisson_log_lpmf',\n 'poisson_log_rng',\n 'poisson_lpmf',\n 'poisson_rng',\n 'positive_infinity',\n 'pow',\n 'print',\n 'prod',\n 'qr_Q',\n 'qr_R',\n 'quad_form',\n 'quad_form_diag',\n 'quad_form_sym',\n 'rank',\n 'rayleigh_cdf',\n 'rayleigh_lccdf',\n 'rayleigh_lcdf',\n 'rayleigh_lpdf',\n 'rayleigh_rng',\n 'reject',\n 'rep_array',\n 'rep_matrix',\n 'rep_row_vector',\n 'rep_vector',\n 'rising_factorial',\n 'round',\n 'row',\n 'rows',\n 'rows_dot_product',\n 'rows_dot_self',\n 'scaled_inv_chi_square_cdf',\n 'scaled_inv_chi_square_lccdf',\n 'scaled_inv_chi_square_lcdf',\n 'scaled_inv_chi_square_lpdf',\n 'scaled_inv_chi_square_rng',\n 'sd',\n 'segment',\n 'sin',\n 'singular_values',\n 'sinh',\n 'size',\n 'skew_normal_cdf',\n 'skew_normal_lccdf',\n 'skew_normal_lcdf',\n 'skew_normal_lpdf',\n 'skew_normal_rng',\n 'softmax',\n 'sort_asc',\n 'sort_desc',\n 'sort_indices_asc',\n 'sort_indices_desc',\n 'sqrt',\n 'sqrt2',\n 'square',\n 'squared_distance',\n 'step',\n 'student_t_cdf',\n 'student_t_lccdf',\n 'student_t_lcdf',\n 'student_t_lpdf',\n 'student_t_rng',\n 'sub_col',\n 'sub_row',\n 'sum',\n 'tail',\n 'tan',\n 'tanh',\n 'target',\n 'tcrossprod',\n 'tgamma',\n 'to_array_1d',\n 'to_array_2d',\n 'to_matrix',\n 'to_row_vector',\n 'to_vector',\n 'trace',\n 'trace_gen_quad_form',\n 'trace_quad_form',\n 'trigamma',\n 'trunc',\n 'uniform_cdf',\n 'uniform_lccdf',\n 'uniform_lcdf',\n 'uniform_lpdf',\n 'uniform_rng',\n 'variance',\n 'von_mises_lpdf',\n 'von_mises_rng',\n 'weibull_cdf',\n 'weibull_lccdf',\n 'weibull_lcdf',\n 'weibull_lpdf',\n 'weibull_rng',\n 'wiener_lpdf',\n 'wishart_lpdf',\n 'wishart_rng'\n ];\n const DISTRIBUTIONS = [\n 'bernoulli',\n 'bernoulli_logit',\n 'beta',\n 'beta_binomial',\n 'binomial',\n 'binomial_logit',\n 'categorical',\n 'categorical_logit',\n 'cauchy',\n 'chi_square',\n 'dirichlet',\n 'double_exponential',\n 'exp_mod_normal',\n 'exponential',\n 'frechet',\n 'gamma',\n 'gaussian_dlm_obs',\n 'gumbel',\n 'hypergeometric',\n 'inv_chi_square',\n 'inv_gamma',\n 'inv_wishart',\n 'lkj_corr',\n 'lkj_corr_cholesky',\n 'logistic',\n 'lognormal',\n 'multi_gp',\n 'multi_gp_cholesky',\n 'multi_normal',\n 'multi_normal_cholesky',\n 'multi_normal_prec',\n 'multi_student_t',\n 'multinomial',\n 'neg_binomial',\n 'neg_binomial_2',\n 'neg_binomial_2_log',\n 'normal',\n 'ordered_logistic',\n 'pareto',\n 'pareto_type_2',\n 'poisson',\n 'poisson_log',\n 'rayleigh',\n 'scaled_inv_chi_square',\n 'skew_normal',\n 'student_t',\n 'uniform',\n 'von_mises',\n 'weibull',\n 'wiener',\n 'wishart'\n ];\n\n return {\n name: 'Stan',\n aliases: [ 'stanfuncs' ],\n keywords: {\n $pattern: hljs.IDENT_RE,\n title: BLOCKS.join(' '),\n keyword: STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),\n built_in: FUNCTIONS.join(' ')\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.COMMENT(\n /#/,\n /$/,\n {\n relevance: 0,\n keywords: {\n 'meta-keyword': 'include'\n }\n }\n ),\n hljs.COMMENT(\n /\\/\\*/,\n /\\*\\//,\n {\n relevance: 0,\n // highlight doc strings mentioned in Stan reference\n contains: [\n {\n className: 'doctag',\n begin: /@(return|param)/\n }\n ]\n }\n ),\n {\n // hack: in range constraints, lower must follow \"<\"\n begin: /<\\s*lower\\s*=/,\n keywords: 'lower'\n },\n {\n // hack: in range constraints, upper must follow either , or <\n // <lower = ..., upper = ...> or <upper = ...>\n begin: /[<,]\\s*upper\\s*=/,\n keywords: 'upper'\n },\n {\n className: 'keyword',\n begin: /\\btarget\\s*\\+=/,\n relevance: 10\n },\n {\n begin: '~\\\\s*(' + hljs.IDENT_RE + ')\\\\s*\\\\(',\n keywords: DISTRIBUTIONS.join(' ')\n },\n {\n className: 'number',\n variants: [\n {\n begin: /\\b\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?/\n },\n {\n begin: /\\.\\d+(?:[eE][+-]?\\d+)?\\b/\n }\n ],\n relevance: 0\n },\n {\n className: 'string',\n begin: '\"',\n end: '\"',\n relevance: 0\n }\n ]\n };\n}", "function tstellarToken(name, fullName, decimalPlaces, asset, domain, features, prefix, suffix, network) {\n if (domain === void 0) { domain = ''; }\n if (features === void 0) { features = AccountCoin.DEFAULT_FEATURES; }\n if (prefix === void 0) { prefix = ''; }\n if (suffix === void 0) { suffix = name.toUpperCase(); }\n if (network === void 0) { network = networks_1.Networks.test.stellar; }\n return stellarToken(name, fullName, decimalPlaces, asset, domain, features, prefix, suffix, network);\n}", "dance(traditional) {\n if(traditional) {\n const dances = [\n 'technodance',\n 'konijnendans',\n 'tap',\n 'ballet'\n ];\n console.log(`${this.name} is doing the ${dances[Math.floor(Math.random() * dances.length)]}!`);\n super.dance();\n return;\n }\n }", "function tokens(n){\n return web3.utils.toWei(n, 'ether'); \n}", "function Assign_Free_Lex() {\r\n}", "function stan(hljs) {\n // variable names cannot conflict with block identifiers\n var BLOCKS = [\n 'functions',\n 'model',\n 'data',\n 'parameters',\n 'quantities',\n 'transformed',\n 'generated'\n ];\n var STATEMENTS = [\n 'for',\n 'in',\n 'if',\n 'else',\n 'while',\n 'break',\n 'continue',\n 'return'\n ];\n var SPECIAL_FUNCTIONS = [\n 'print',\n 'reject',\n 'increment_log_prob|10',\n 'integrate_ode|10',\n 'integrate_ode_rk45|10',\n 'integrate_ode_bdf|10',\n 'algebra_solver'\n ];\n var VAR_TYPES = [\n 'int',\n 'real',\n 'vector',\n 'ordered',\n 'positive_ordered',\n 'simplex',\n 'unit_vector',\n 'row_vector',\n 'matrix',\n 'cholesky_factor_corr|10',\n 'cholesky_factor_cov|10',\n 'corr_matrix|10',\n 'cov_matrix|10',\n 'void'\n ];\n var FUNCTIONS = [\n 'Phi', 'Phi_approx', 'abs', 'acos', 'acosh', 'algebra_solver', 'append_array',\n 'append_col', 'append_row', 'asin', 'asinh', 'atan', 'atan2', 'atanh',\n 'bernoulli_cdf', 'bernoulli_lccdf', 'bernoulli_lcdf', 'bernoulli_logit_lpmf',\n 'bernoulli_logit_rng', 'bernoulli_lpmf', 'bernoulli_rng', 'bessel_first_kind',\n 'bessel_second_kind', 'beta_binomial_cdf', 'beta_binomial_lccdf',\n 'beta_binomial_lcdf', 'beta_binomial_lpmf', 'beta_binomial_rng', 'beta_cdf',\n 'beta_lccdf', 'beta_lcdf', 'beta_lpdf', 'beta_rng', 'binary_log_loss',\n 'binomial_cdf', 'binomial_coefficient_log', 'binomial_lccdf', 'binomial_lcdf',\n 'binomial_logit_lpmf', 'binomial_lpmf', 'binomial_rng', 'block',\n 'categorical_logit_lpmf', 'categorical_logit_rng', 'categorical_lpmf',\n 'categorical_rng', 'cauchy_cdf', 'cauchy_lccdf', 'cauchy_lcdf', 'cauchy_lpdf',\n 'cauchy_rng', 'cbrt', 'ceil', 'chi_square_cdf', 'chi_square_lccdf',\n 'chi_square_lcdf', 'chi_square_lpdf', 'chi_square_rng', 'cholesky_decompose',\n 'choose', 'col', 'cols', 'columns_dot_product', 'columns_dot_self', 'cos',\n 'cosh', 'cov_exp_quad', 'crossprod', 'csr_extract_u', 'csr_extract_v',\n 'csr_extract_w', 'csr_matrix_times_vector', 'csr_to_dense_matrix',\n 'cumulative_sum', 'determinant', 'diag_matrix', 'diag_post_multiply',\n 'diag_pre_multiply', 'diagonal', 'digamma', 'dims', 'dirichlet_lpdf',\n 'dirichlet_rng', 'distance', 'dot_product', 'dot_self',\n 'double_exponential_cdf', 'double_exponential_lccdf', 'double_exponential_lcdf',\n 'double_exponential_lpdf', 'double_exponential_rng', 'e', 'eigenvalues_sym',\n 'eigenvectors_sym', 'erf', 'erfc', 'exp', 'exp2', 'exp_mod_normal_cdf',\n 'exp_mod_normal_lccdf', 'exp_mod_normal_lcdf', 'exp_mod_normal_lpdf',\n 'exp_mod_normal_rng', 'expm1', 'exponential_cdf', 'exponential_lccdf',\n 'exponential_lcdf', 'exponential_lpdf', 'exponential_rng', 'fabs',\n 'falling_factorial', 'fdim', 'floor', 'fma', 'fmax', 'fmin', 'fmod',\n 'frechet_cdf', 'frechet_lccdf', 'frechet_lcdf', 'frechet_lpdf', 'frechet_rng',\n 'gamma_cdf', 'gamma_lccdf', 'gamma_lcdf', 'gamma_lpdf', 'gamma_p', 'gamma_q',\n 'gamma_rng', 'gaussian_dlm_obs_lpdf', 'get_lp', 'gumbel_cdf', 'gumbel_lccdf',\n 'gumbel_lcdf', 'gumbel_lpdf', 'gumbel_rng', 'head', 'hypergeometric_lpmf',\n 'hypergeometric_rng', 'hypot', 'inc_beta', 'int_step', 'integrate_ode',\n 'integrate_ode_bdf', 'integrate_ode_rk45', 'inv', 'inv_Phi',\n 'inv_chi_square_cdf', 'inv_chi_square_lccdf', 'inv_chi_square_lcdf',\n 'inv_chi_square_lpdf', 'inv_chi_square_rng', 'inv_cloglog', 'inv_gamma_cdf',\n 'inv_gamma_lccdf', 'inv_gamma_lcdf', 'inv_gamma_lpdf', 'inv_gamma_rng',\n 'inv_logit', 'inv_sqrt', 'inv_square', 'inv_wishart_lpdf', 'inv_wishart_rng',\n 'inverse', 'inverse_spd', 'is_inf', 'is_nan', 'lbeta', 'lchoose', 'lgamma',\n 'lkj_corr_cholesky_lpdf', 'lkj_corr_cholesky_rng', 'lkj_corr_lpdf',\n 'lkj_corr_rng', 'lmgamma', 'lmultiply', 'log', 'log10', 'log1m', 'log1m_exp',\n 'log1m_inv_logit', 'log1p', 'log1p_exp', 'log2', 'log_determinant',\n 'log_diff_exp', 'log_falling_factorial', 'log_inv_logit', 'log_mix',\n 'log_rising_factorial', 'log_softmax', 'log_sum_exp', 'logistic_cdf',\n 'logistic_lccdf', 'logistic_lcdf', 'logistic_lpdf', 'logistic_rng', 'logit',\n 'lognormal_cdf', 'lognormal_lccdf', 'lognormal_lcdf', 'lognormal_lpdf',\n 'lognormal_rng', 'machine_precision', 'matrix_exp', 'max', 'mdivide_left_spd',\n 'mdivide_left_tri_low', 'mdivide_right_spd', 'mdivide_right_tri_low', 'mean',\n 'min', 'modified_bessel_first_kind', 'modified_bessel_second_kind',\n 'multi_gp_cholesky_lpdf', 'multi_gp_lpdf', 'multi_normal_cholesky_lpdf',\n 'multi_normal_cholesky_rng', 'multi_normal_lpdf', 'multi_normal_prec_lpdf',\n 'multi_normal_rng', 'multi_student_t_lpdf', 'multi_student_t_rng',\n 'multinomial_lpmf', 'multinomial_rng', 'multiply_log',\n 'multiply_lower_tri_self_transpose', 'neg_binomial_2_cdf',\n 'neg_binomial_2_lccdf', 'neg_binomial_2_lcdf', 'neg_binomial_2_log_lpmf',\n 'neg_binomial_2_log_rng', 'neg_binomial_2_lpmf', 'neg_binomial_2_rng',\n 'neg_binomial_cdf', 'neg_binomial_lccdf', 'neg_binomial_lcdf',\n 'neg_binomial_lpmf', 'neg_binomial_rng', 'negative_infinity', 'normal_cdf',\n 'normal_lccdf', 'normal_lcdf', 'normal_lpdf', 'normal_rng', 'not_a_number',\n 'num_elements', 'ordered_logistic_lpmf', 'ordered_logistic_rng', 'owens_t',\n 'pareto_cdf', 'pareto_lccdf', 'pareto_lcdf', 'pareto_lpdf', 'pareto_rng',\n 'pareto_type_2_cdf', 'pareto_type_2_lccdf', 'pareto_type_2_lcdf',\n 'pareto_type_2_lpdf', 'pareto_type_2_rng', 'pi', 'poisson_cdf', 'poisson_lccdf',\n 'poisson_lcdf', 'poisson_log_lpmf', 'poisson_log_rng', 'poisson_lpmf',\n 'poisson_rng', 'positive_infinity', 'pow', 'print', 'prod', 'qr_Q', 'qr_R',\n 'quad_form', 'quad_form_diag', 'quad_form_sym', 'rank', 'rayleigh_cdf',\n 'rayleigh_lccdf', 'rayleigh_lcdf', 'rayleigh_lpdf', 'rayleigh_rng', 'reject',\n 'rep_array', 'rep_matrix', 'rep_row_vector', 'rep_vector', 'rising_factorial',\n 'round', 'row', 'rows', 'rows_dot_product', 'rows_dot_self',\n 'scaled_inv_chi_square_cdf', 'scaled_inv_chi_square_lccdf',\n 'scaled_inv_chi_square_lcdf', 'scaled_inv_chi_square_lpdf',\n 'scaled_inv_chi_square_rng', 'sd', 'segment', 'sin', 'singular_values', 'sinh',\n 'size', 'skew_normal_cdf', 'skew_normal_lccdf', 'skew_normal_lcdf',\n 'skew_normal_lpdf', 'skew_normal_rng', 'softmax', 'sort_asc', 'sort_desc',\n 'sort_indices_asc', 'sort_indices_desc', 'sqrt', 'sqrt2', 'square',\n 'squared_distance', 'step', 'student_t_cdf', 'student_t_lccdf',\n 'student_t_lcdf', 'student_t_lpdf', 'student_t_rng', 'sub_col', 'sub_row',\n 'sum', 'tail', 'tan', 'tanh', 'target', 'tcrossprod', 'tgamma', 'to_array_1d',\n 'to_array_2d', 'to_matrix', 'to_row_vector', 'to_vector', 'trace',\n 'trace_gen_quad_form', 'trace_quad_form', 'trigamma', 'trunc', 'uniform_cdf',\n 'uniform_lccdf', 'uniform_lcdf', 'uniform_lpdf', 'uniform_rng', 'variance',\n 'von_mises_lpdf', 'von_mises_rng', 'weibull_cdf', 'weibull_lccdf',\n 'weibull_lcdf', 'weibull_lpdf', 'weibull_rng', 'wiener_lpdf', 'wishart_lpdf',\n 'wishart_rng'\n ];\n var DISTRIBUTIONS = [\n 'bernoulli', 'bernoulli_logit', 'beta', 'beta_binomial', 'binomial',\n 'binomial_logit', 'categorical', 'categorical_logit', 'cauchy', 'chi_square',\n 'dirichlet', 'double_exponential', 'exp_mod_normal', 'exponential', 'frechet',\n 'gamma', 'gaussian_dlm_obs', 'gumbel', 'hypergeometric', 'inv_chi_square',\n 'inv_gamma', 'inv_wishart', 'lkj_corr', 'lkj_corr_cholesky', 'logistic',\n 'lognormal', 'multi_gp', 'multi_gp_cholesky', 'multi_normal',\n 'multi_normal_cholesky', 'multi_normal_prec', 'multi_student_t', 'multinomial',\n 'neg_binomial', 'neg_binomial_2', 'neg_binomial_2_log', 'normal',\n 'ordered_logistic', 'pareto', 'pareto_type_2', 'poisson', 'poisson_log',\n 'rayleigh', 'scaled_inv_chi_square', 'skew_normal', 'student_t', 'uniform',\n 'von_mises', 'weibull', 'wiener', 'wishart'\n ];\n\n return {\n name: 'Stan',\n aliases: ['stanfuncs'],\n keywords: {\n $pattern: hljs.IDENT_RE,\n title: BLOCKS.join(' '),\n keyword: STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),\n built_in: FUNCTIONS.join(' ')\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.COMMENT(\n /#/,\n /$/,\n {\n relevance: 0,\n keywords: {\n 'meta-keyword': 'include'\n }\n }\n ),\n hljs.COMMENT(\n /\\/\\*/,\n /\\*\\//,\n {\n relevance: 0,\n // highlight doc strings mentioned in Stan reference\n contains: [\n {\n className: 'doctag',\n begin: /@(return|param)/\n }\n ]\n }\n ),\n {\n // hack: in range constraints, lower must follow \"<\"\n begin: /<\\s*lower\\s*=/,\n keywords: 'lower'\n },\n {\n // hack: in range constraints, upper must follow either , or <\n // <lower = ..., upper = ...> or <upper = ...>\n begin: /[<,]\\s*upper\\s*=/,\n keywords: 'upper'\n },\n {\n className: 'keyword',\n begin: /\\btarget\\s*\\+=/,\n relevance: 10\n },\n {\n begin: '~\\\\s*(' + hljs.IDENT_RE + ')\\\\s*\\\\(',\n keywords: DISTRIBUTIONS.join(' ')\n },\n {\n className: 'number',\n variants: [\n {\n begin: /\\b\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?/\n },\n {\n begin: /\\.\\d+(?:[eE][+-]?\\d+)?\\b/\n }\n ],\n relevance: 0\n },\n {\n className: 'string',\n begin: '\"',\n end: '\"',\n relevance: 0\n }\n ]\n }\n}", "function stan(hljs) {\n // variable names cannot conflict with block identifiers\n var BLOCKS = [\n 'functions',\n 'model',\n 'data',\n 'parameters',\n 'quantities',\n 'transformed',\n 'generated'\n ];\n var STATEMENTS = [\n 'for',\n 'in',\n 'if',\n 'else',\n 'while',\n 'break',\n 'continue',\n 'return'\n ];\n var SPECIAL_FUNCTIONS = [\n 'print',\n 'reject',\n 'increment_log_prob|10',\n 'integrate_ode|10',\n 'integrate_ode_rk45|10',\n 'integrate_ode_bdf|10',\n 'algebra_solver'\n ];\n var VAR_TYPES = [\n 'int',\n 'real',\n 'vector',\n 'ordered',\n 'positive_ordered',\n 'simplex',\n 'unit_vector',\n 'row_vector',\n 'matrix',\n 'cholesky_factor_corr|10',\n 'cholesky_factor_cov|10',\n 'corr_matrix|10',\n 'cov_matrix|10',\n 'void'\n ];\n var FUNCTIONS = [\n 'Phi', 'Phi_approx', 'abs', 'acos', 'acosh', 'algebra_solver', 'append_array',\n 'append_col', 'append_row', 'asin', 'asinh', 'atan', 'atan2', 'atanh',\n 'bernoulli_cdf', 'bernoulli_lccdf', 'bernoulli_lcdf', 'bernoulli_logit_lpmf',\n 'bernoulli_logit_rng', 'bernoulli_lpmf', 'bernoulli_rng', 'bessel_first_kind',\n 'bessel_second_kind', 'beta_binomial_cdf', 'beta_binomial_lccdf',\n 'beta_binomial_lcdf', 'beta_binomial_lpmf', 'beta_binomial_rng', 'beta_cdf',\n 'beta_lccdf', 'beta_lcdf', 'beta_lpdf', 'beta_rng', 'binary_log_loss',\n 'binomial_cdf', 'binomial_coefficient_log', 'binomial_lccdf', 'binomial_lcdf',\n 'binomial_logit_lpmf', 'binomial_lpmf', 'binomial_rng', 'block',\n 'categorical_logit_lpmf', 'categorical_logit_rng', 'categorical_lpmf',\n 'categorical_rng', 'cauchy_cdf', 'cauchy_lccdf', 'cauchy_lcdf', 'cauchy_lpdf',\n 'cauchy_rng', 'cbrt', 'ceil', 'chi_square_cdf', 'chi_square_lccdf',\n 'chi_square_lcdf', 'chi_square_lpdf', 'chi_square_rng', 'cholesky_decompose',\n 'choose', 'col', 'cols', 'columns_dot_product', 'columns_dot_self', 'cos',\n 'cosh', 'cov_exp_quad', 'crossprod', 'csr_extract_u', 'csr_extract_v',\n 'csr_extract_w', 'csr_matrix_times_vector', 'csr_to_dense_matrix',\n 'cumulative_sum', 'determinant', 'diag_matrix', 'diag_post_multiply',\n 'diag_pre_multiply', 'diagonal', 'digamma', 'dims', 'dirichlet_lpdf',\n 'dirichlet_rng', 'distance', 'dot_product', 'dot_self',\n 'double_exponential_cdf', 'double_exponential_lccdf', 'double_exponential_lcdf',\n 'double_exponential_lpdf', 'double_exponential_rng', 'e', 'eigenvalues_sym',\n 'eigenvectors_sym', 'erf', 'erfc', 'exp', 'exp2', 'exp_mod_normal_cdf',\n 'exp_mod_normal_lccdf', 'exp_mod_normal_lcdf', 'exp_mod_normal_lpdf',\n 'exp_mod_normal_rng', 'expm1', 'exponential_cdf', 'exponential_lccdf',\n 'exponential_lcdf', 'exponential_lpdf', 'exponential_rng', 'fabs',\n 'falling_factorial', 'fdim', 'floor', 'fma', 'fmax', 'fmin', 'fmod',\n 'frechet_cdf', 'frechet_lccdf', 'frechet_lcdf', 'frechet_lpdf', 'frechet_rng',\n 'gamma_cdf', 'gamma_lccdf', 'gamma_lcdf', 'gamma_lpdf', 'gamma_p', 'gamma_q',\n 'gamma_rng', 'gaussian_dlm_obs_lpdf', 'get_lp', 'gumbel_cdf', 'gumbel_lccdf',\n 'gumbel_lcdf', 'gumbel_lpdf', 'gumbel_rng', 'head', 'hypergeometric_lpmf',\n 'hypergeometric_rng', 'hypot', 'inc_beta', 'int_step', 'integrate_ode',\n 'integrate_ode_bdf', 'integrate_ode_rk45', 'inv', 'inv_Phi',\n 'inv_chi_square_cdf', 'inv_chi_square_lccdf', 'inv_chi_square_lcdf',\n 'inv_chi_square_lpdf', 'inv_chi_square_rng', 'inv_cloglog', 'inv_gamma_cdf',\n 'inv_gamma_lccdf', 'inv_gamma_lcdf', 'inv_gamma_lpdf', 'inv_gamma_rng',\n 'inv_logit', 'inv_sqrt', 'inv_square', 'inv_wishart_lpdf', 'inv_wishart_rng',\n 'inverse', 'inverse_spd', 'is_inf', 'is_nan', 'lbeta', 'lchoose', 'lgamma',\n 'lkj_corr_cholesky_lpdf', 'lkj_corr_cholesky_rng', 'lkj_corr_lpdf',\n 'lkj_corr_rng', 'lmgamma', 'lmultiply', 'log', 'log10', 'log1m', 'log1m_exp',\n 'log1m_inv_logit', 'log1p', 'log1p_exp', 'log2', 'log_determinant',\n 'log_diff_exp', 'log_falling_factorial', 'log_inv_logit', 'log_mix',\n 'log_rising_factorial', 'log_softmax', 'log_sum_exp', 'logistic_cdf',\n 'logistic_lccdf', 'logistic_lcdf', 'logistic_lpdf', 'logistic_rng', 'logit',\n 'lognormal_cdf', 'lognormal_lccdf', 'lognormal_lcdf', 'lognormal_lpdf',\n 'lognormal_rng', 'machine_precision', 'matrix_exp', 'max', 'mdivide_left_spd',\n 'mdivide_left_tri_low', 'mdivide_right_spd', 'mdivide_right_tri_low', 'mean',\n 'min', 'modified_bessel_first_kind', 'modified_bessel_second_kind',\n 'multi_gp_cholesky_lpdf', 'multi_gp_lpdf', 'multi_normal_cholesky_lpdf',\n 'multi_normal_cholesky_rng', 'multi_normal_lpdf', 'multi_normal_prec_lpdf',\n 'multi_normal_rng', 'multi_student_t_lpdf', 'multi_student_t_rng',\n 'multinomial_lpmf', 'multinomial_rng', 'multiply_log',\n 'multiply_lower_tri_self_transpose', 'neg_binomial_2_cdf',\n 'neg_binomial_2_lccdf', 'neg_binomial_2_lcdf', 'neg_binomial_2_log_lpmf',\n 'neg_binomial_2_log_rng', 'neg_binomial_2_lpmf', 'neg_binomial_2_rng',\n 'neg_binomial_cdf', 'neg_binomial_lccdf', 'neg_binomial_lcdf',\n 'neg_binomial_lpmf', 'neg_binomial_rng', 'negative_infinity', 'normal_cdf',\n 'normal_lccdf', 'normal_lcdf', 'normal_lpdf', 'normal_rng', 'not_a_number',\n 'num_elements', 'ordered_logistic_lpmf', 'ordered_logistic_rng', 'owens_t',\n 'pareto_cdf', 'pareto_lccdf', 'pareto_lcdf', 'pareto_lpdf', 'pareto_rng',\n 'pareto_type_2_cdf', 'pareto_type_2_lccdf', 'pareto_type_2_lcdf',\n 'pareto_type_2_lpdf', 'pareto_type_2_rng', 'pi', 'poisson_cdf', 'poisson_lccdf',\n 'poisson_lcdf', 'poisson_log_lpmf', 'poisson_log_rng', 'poisson_lpmf',\n 'poisson_rng', 'positive_infinity', 'pow', 'print', 'prod', 'qr_Q', 'qr_R',\n 'quad_form', 'quad_form_diag', 'quad_form_sym', 'rank', 'rayleigh_cdf',\n 'rayleigh_lccdf', 'rayleigh_lcdf', 'rayleigh_lpdf', 'rayleigh_rng', 'reject',\n 'rep_array', 'rep_matrix', 'rep_row_vector', 'rep_vector', 'rising_factorial',\n 'round', 'row', 'rows', 'rows_dot_product', 'rows_dot_self',\n 'scaled_inv_chi_square_cdf', 'scaled_inv_chi_square_lccdf',\n 'scaled_inv_chi_square_lcdf', 'scaled_inv_chi_square_lpdf',\n 'scaled_inv_chi_square_rng', 'sd', 'segment', 'sin', 'singular_values', 'sinh',\n 'size', 'skew_normal_cdf', 'skew_normal_lccdf', 'skew_normal_lcdf',\n 'skew_normal_lpdf', 'skew_normal_rng', 'softmax', 'sort_asc', 'sort_desc',\n 'sort_indices_asc', 'sort_indices_desc', 'sqrt', 'sqrt2', 'square',\n 'squared_distance', 'step', 'student_t_cdf', 'student_t_lccdf',\n 'student_t_lcdf', 'student_t_lpdf', 'student_t_rng', 'sub_col', 'sub_row',\n 'sum', 'tail', 'tan', 'tanh', 'target', 'tcrossprod', 'tgamma', 'to_array_1d',\n 'to_array_2d', 'to_matrix', 'to_row_vector', 'to_vector', 'trace',\n 'trace_gen_quad_form', 'trace_quad_form', 'trigamma', 'trunc', 'uniform_cdf',\n 'uniform_lccdf', 'uniform_lcdf', 'uniform_lpdf', 'uniform_rng', 'variance',\n 'von_mises_lpdf', 'von_mises_rng', 'weibull_cdf', 'weibull_lccdf',\n 'weibull_lcdf', 'weibull_lpdf', 'weibull_rng', 'wiener_lpdf', 'wishart_lpdf',\n 'wishart_rng'\n ];\n var DISTRIBUTIONS = [\n 'bernoulli', 'bernoulli_logit', 'beta', 'beta_binomial', 'binomial',\n 'binomial_logit', 'categorical', 'categorical_logit', 'cauchy', 'chi_square',\n 'dirichlet', 'double_exponential', 'exp_mod_normal', 'exponential', 'frechet',\n 'gamma', 'gaussian_dlm_obs', 'gumbel', 'hypergeometric', 'inv_chi_square',\n 'inv_gamma', 'inv_wishart', 'lkj_corr', 'lkj_corr_cholesky', 'logistic',\n 'lognormal', 'multi_gp', 'multi_gp_cholesky', 'multi_normal',\n 'multi_normal_cholesky', 'multi_normal_prec', 'multi_student_t', 'multinomial',\n 'neg_binomial', 'neg_binomial_2', 'neg_binomial_2_log', 'normal',\n 'ordered_logistic', 'pareto', 'pareto_type_2', 'poisson', 'poisson_log',\n 'rayleigh', 'scaled_inv_chi_square', 'skew_normal', 'student_t', 'uniform',\n 'von_mises', 'weibull', 'wiener', 'wishart'\n ];\n\n return {\n name: 'Stan',\n aliases: ['stanfuncs'],\n keywords: {\n 'title': BLOCKS.join(' '),\n 'keyword': STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),\n 'built_in': FUNCTIONS.join(' ')\n },\n lexemes: hljs.IDENT_RE,\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.COMMENT(\n /#/,\n /$/,\n {\n relevance: 0,\n keywords: {\n 'meta-keyword': 'include'\n }\n }\n ),\n hljs.COMMENT(\n /\\/\\*/,\n /\\*\\//,\n {\n relevance: 0,\n // highlight doc strings mentioned in Stan reference\n contains: [\n {\n className: 'doctag',\n begin: /@(return|param)/\n }\n ]\n }\n ),\n {\n // hack: in range constraints, lower must follow \"<\"\n begin: /<\\s*lower\\s*=/,\n keywords: 'lower'\n },\n {\n // hack: in range constraints, upper must follow either , or <\n // <lower = ..., upper = ...> or <upper = ...>\n begin: /[<,]\\s*upper\\s*=/,\n keywords: 'upper'\n },\n {\n className: 'keyword',\n begin: /\\btarget\\s*\\+=/,\n relevance: 10\n },\n {\n begin: '~\\\\s*(' + hljs.IDENT_RE + ')\\\\s*\\\\(',\n keywords: DISTRIBUTIONS.join(' ')\n },\n {\n className: 'number',\n variants: [\n {\n begin: /\\b\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?/\n },\n {\n begin: /\\.\\d+(?:[eE][+-]?\\d+)?\\b/\n }\n ],\n relevance: 0\n },\n {\n className: 'string',\n begin: '\"',\n end: '\"',\n relevance: 0\n }\n ]\n }\n}", "useSet (token1, token2, token3) {\n if (\n THIS.getPlayerNumberOfTokens(THIS.view.currentPlayer) > 4 &&\n THIS.view.currentPlayer.name == THIS.activePlayer.name\n ) {\n var params = {\n token1: token1,\n token2: token2,\n token3: token3\n }\n THIS.$socket.send(new Packet('USE_TOKENS', params).getJson())\n }\n }", "onLoad() {\n this.editor.on('load', () => {\n this.editor.runCommand('preset-mautic:dynamic-content-tokens-to-slots');\n });\n }", "initTokenWithSynonymAlias(index) {\n var tokens = [...this.props.singleTokens];\n var token = { ...this.props.singleTokens[index] };\n // if the token doesn't have synonyms and it doesn't have any selected synonyms\n if (token.synonyms.length < 1 && token.selectedSynonyms.length === 0) {\n var synonyms = this.computeSynonyms(token.label);\n token.synonyms = synonyms;\n tokens[index] = token;\n } else {\n var res = [];\n\n token.synonyms.forEach((synonym) => {\n tokens.filter((token) => {\n if (token.label === synonym.label) {\n res.push(token);\n }\n })\n });\n // var resSel = [];\n // token.selectedSynonyms.forEach((synonym) => {\n // tokens.filter((token) => {\n // if (token.label === synonym.label) {\n // resSel.push(token);\n // }\n // })\n // });\n token.synonyms = res;\n }\n if (!token.alias) {\n token.alias = token.label;\n }\n this.props.multiTokens.forEach((multiToken) => {\n var multiTokenSplitted = multiToken.label.split(\" \");\n if (token.label === multiTokenSplitted[0] || token.label === multiTokenSplitted[1]) {\n token.appearsIn.push(JSON.parse(JSON.stringify(multiToken)));\n }\n });\n this.setState({ currentMultiTokens: token.appearsIn.slice(0, 3) });\n\n\n // Dealing with sinonyms\n token.synonyms.forEach((synonym) => {\n if (token.alias === synonym.alias) {\n synonym.value = synonym.label;\n tokens = this.handleSelectSynonym(synonym);\n token.synonyms = token.synonyms.filter((syn) => {\n return syn !== synonym;\n })\n tokens[token.index] = token;\n }\n });\n\n this.props.onUpdateSingleTokens(tokens);\n token.selectedSynonyms.forEach((selectedSynonym) => {\n var selectedSynonymAsToken = tokens.filter((token) => {\n return token.label === selectedSynonym.value;\n })[0];\n if (selectedSynonymAsToken.alias !== token.alias) {\n selectedSynonymAsToken.value = selectedSynonymAsToken.label;\n this.handleDeleteSynonym(selectedSynonymAsToken);\n }\n });\n }", "initTokenWithSynonymAlias(index) {\n var tokens = [...this.props.multiTokens];\n var token = { ...this.props.multiTokens[index] };\n\n if (token.synonyms.length < 1) {\n // var synonyms = this.computeSynonyms(token.label);\n // token.synonyms = synonyms;\n tokens[index] = token;\n }\n if (!token.alias) {\n token.alias = token.label;\n var multiTokenSplitted = token.alias.split(\" \");\n this.props.singleTokens.forEach((singleToken) => {\n if (singleToken.label === multiTokenSplitted[0] || singleToken.label === multiTokenSplitted[1]) {\n token.composedWith.push(JSON.parse(JSON.stringify(singleToken)));\n }\n });\n }\n this.props.onUpdateMultiTokens(tokens);\n }", "function startsp() {\r\n\tnextWord(false);\r\n}", "function calcAndSetAllBonuses() {\n Object.keys(STATE.get('TokenList')).forEach(k => {\n const tokenObj = STATE.get('TokenList', k);\n Token.setBonus(tokenObj, Token.calcBonus(tokenObj));\n });\n }", "generate() {\n this.len *= 0.5; //So the tree becomes denser instead of larger.\n this.branchValue += 1; //To ensure increased thickness of trunk.\n let nextSentence = \"\";\n for (let i = 0; i < this.sentence.length; i++) {\n let current = this.sentence.charAt(i);\n if (current === current.toLowerCase()) {\n current = current.toUpperCase();\n }\n let found = false;\n\n if (current === this.rules1.letter) {\n found = true;\n nextSentence += this.rules1.becomes;\n } else if (current === this.rules2.letter) {\n found = true;\n nextSentence += this.rules2.becomes;\n } else if (current === this.rules3.letter) {\n found = true;\n nextSentence += this.rules3.becomes;\n }\n\n if (!found) {\n nextSentence += current;\n }\n }\n this.sentence = nextSentence;\n }", "defineStates() {\n // Maximum stack calls\n let maxStackCalls = 400;\n\n // Acquisition lambdas\n let queue = i => {\n return this.text.charAt(i);\n };\n let store = c => {\n this.buffer += c;\n };\n let flush = t => {\n if (this.buffer.length > 0) {\n // Special treatment for id tokens that contain only numbers\n let numberToken = t == Token.ID && !isNaN(this.buffer);\n this.list.push(\n new Token(numberToken ? Token.NUMBER : t, this.buffer, line)\n );\n }\n this.buffer = \"\";\n };\n\n // Line number updater\n let line = 0;\n let newline = i => {\n line++;\n };\n\n // State definitions\n let state = {\n // Transference function\n transference: (i, phase) => {\n if (i < this.text.length) {\n // Prevent stack overflow\n if (i % maxStackCalls == 0 && phase != true) {\n this.index = i;\n return;\n }\n\n // Transfer to the identifier state\n state.identifier(i);\n } else {\n flush(Token.ID);\n this.index = i;\n return;\n }\n },\n\n // For IDs\n identifier: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case '\"':\n case \"'\":\n flush(Token.ID);\n state.string(i + 1, c);\n return;\n case \"\\\\\":\n flush(Token.ID);\n state.extension(i);\n return;\n case \" \":\n case \";\":\n flush(Token.ID);\n state.delimiter(i);\n return;\n case \"#\":\n flush(Token.ID);\n state.comment(i + 1);\n return;\n case \"(\":\n case \")\":\n flush(Token.ID);\n state.parenthesis(i, c);\n return;\n default:\n store(c);\n state.transference(i + 1);\n }\n },\n\n // For strings\n string: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case phase:\n flush(Token.STRING);\n state.transference(i + 1, c);\n return;\n case \"\\\\\":\n state.extension(i + 1);\n return;\n default:\n store(c);\n state.string(i + 1, phase);\n }\n },\n\n // For escape characters\n extension: (i, phase) => {\n let c = queue(i);\n\n store(\"\\\\\" + c);\n state.transference(i + 1);\n },\n\n // For comments\n comment: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case \";\":\n newline();\n flush(Token.COMMENT);\n state.transference(i + 1);\n return;\n default:\n store(c);\n state.comment(i + 1);\n }\n },\n\n // For parenthesis\n parenthesis: (i, phase) => {\n let c = queue(i);\n\n store(c);\n if (phase == \"(\") flush(Token.OPEN);\n else if (phase == \")\") flush(Token.CLOSE);\n state.transference(i + 1);\n },\n\n // For whitespaces and linefeeds\n delimiter: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case \";\":\n newline();\n case \" \":\n store(c);\n state.delimiter(i + 1);\n return;\n default:\n flush(Token.SPACE);\n state.transference(i);\n }\n }\n };\n this.state = state;\n }", "function generateToken( el ) {\n\n axios.get('/0/workspace/'+ space + '/genToken').then(function ( res ) {\n\n var generated = res.data;\n\n // add new key to content\n var appendTo = document.getElementById('member-tokens-assigned');\n\n var html = document.createElement('div');\n html.classList.add('token-generated');\n\n generated.claimed ? html.classList.add('token-used') : html.classList.add('token-free');\n html.innerHTML = '<p>' + generated.token + '</p>';\n\n appendTo.appendChild(html);\n })\n .catch(function (error) { console.log(error); });\n}", "function finishToken(\n type,\n contextualKeyword = ContextualKeyword.NONE,\n) {\n state.end = state.pos;\n state.type = type;\n state.contextualKeyword = contextualKeyword;\n}", "assignToken() {\n this.token = `${this.username}-${new Date().toISOString()}-${Math.floor(Math.random() * 1000000)}`;\n }", "spendExp(amount) {\n this.expCounter -= amount;\n if (this.expCounter < 0) {\n this.expCounter += amount;\n }\n }", "function count_Tokens()\n{\n return this.tokens.length;\n}", "async function predict(){\n var randomness = randomnessElem.value;\n var new_character;\n var token_wordstart = coder_specs[models.active].start_token + wordStartElem.value\n for (var k=0; k<coder_specs[models.active].max_word_size - wordStartElem.value.length; k++){\n var input_tensor = tf.tensor(encode(token_wordstart));\n var output_tensor = await models[models.active].predict(input_tensor);\n var output_ar = await output_tensor.array();\n new_character = decodeCharacter(output_ar[0][token_wordstart.length-1], randomness);\n if (new_character==coder_specs[models.active].end_token){\n break;\n }\n else{\n token_wordstart=token_wordstart+new_character\n }\n }\n console.log(token_wordstart.substring(1))\n outputElem.innerHTML = token_wordstart[1].toUpperCase() + token_wordstart.substring(2)\n}", "token(input, start, value) { return new Token(input,start,input.pos,this.type,value) }", "addTag(token, type = undefined, word) {\n if (!token) {\n switch (type) {\n case \"if\":\n return <syn className=\"if\">{word}</syn>;\n case \"func\":\n return <syn className=\"func\">{word}</syn>;\n case \"comm\":\n return <syn className=\"comm\">{word}</syn>;\n default:\n return <syn className=\"default\">{word}</syn>;\n }\n } else {\n switch (token) {\n case \"comm\":\n return <syn className=\"comm\">//</syn>;\n case \"semic\":\n return <syn className=\"semic\">;</syn>;\n case \"lparen\":\n return <syn className=\"paren\">(</syn>;\n case \"rparen\":\n return <syn className=\"paren\">)</syn>;\n case \"lbrack\":\n return <syn className=\"brack\">{\"{\"}</syn>;\n case \"rbrack\":\n return <syn className=\"brack\">{\"}\"}</syn>;\n case \"dquote\":\n return <syn className=\"dquote\">{'\"'}</syn>;\n case \"squote\":\n return <syn className=\"squote\">{\"'\"}</syn>;\n case \"dot\":\n return <syn className=\"dot\">.</syn>;\n case \"lsq\":\n return <syn className=\"sq\">[</syn>;\n case \"rsq\":\n return <syn className=\"sq\">]</syn>;\n case \"eq\":\n return <syn className=\"eq\">=</syn>;\n case \"plus\":\n return <syn className=\"plus\">+</syn>;\n }\n }\n }", "function finishToken(\n type,\n contextualKeyword = _keywords.ContextualKeyword.NONE,\n) {\n _base.state.end = _base.state.pos;\n _base.state.type = type;\n _base.state.contextualKeyword = contextualKeyword;\n}", "firstToken({token, counter}) {\n\t\tif (['letter', 'especial'].includes(token.name)) {\n\t\t\tthis.listener.candidates = this.listener.candidates.filter(c=> c.name === 'variable');\n\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function step4(token) {\n return replacePatterns(token, [['al', ''], ['ance', ''], ['ence', ''], ['er', ''], \n ['ic', ''], ['able', ''], ['ible', ''], ['ant', ''],\n ['ement', ''], ['ment', ''], ['ent', ''], [/([st])ion/, '$1'], ['ou', ''], ['ism', ''],\n ['ate', ''], ['iti', ''], ['ous', ''], ['ive', ''], \n ['ize', '']], 1);\n}", "function tokenToAction(token) {\n var word = token.value;\n var definition = context.dictionary.lookup(word);\n\n if (token.isStringLiteral) {\n return namedFunction(\"String: \" + word, function (context) {\n return word;\n });\n }\n // TODO: contributed part on StringPushLiteral s\" (TODO make PR)\n else if (token.isStringPushLiteral) {\n return namedFunction(\"PushString: \" + word, function (context) {\n context.stack.push(word);\n });\n }\n // TODO: contributed part on NeoSyscallLiteral syscall\" (TODO: do not make PR, think on something better...)\n else if (token.isNeoSyscallLiteral) {\n\n if(word == \"Neo.Learn.Call\") { // special syscall \n var execAction = context.stack.pop();\n var definedAction = context.dictionary.lookup(execAction);\n return definedAction; // TODO\n }\n else \n return namedFunction(\"NeoSyscallString: \" + word, function (context) {\n invokeNeoSyscall(word);\n /*\n if(sname == \"Neo.Learn.Execute\") // special syscall \n {\n // invoke tokenizer on read string\n // ????????? TODO\n var str = context.stack.pop();\n next(str);\n }*/\n // TODO: Neo Syscall!!\n\n });\n } \n else if (definition !== null) {\n return definition;\n } else if (isFinite(word)) {\n return namedFunction(\"Number: \" + word, function (context) {\n context.stack.push(+word);\n });\n } else {\n throw new MissingWordError(word);\n }\n\n return function () {\n return \"\";\n };\n }", "static get tag() {\n return \"hax-text-editor-vocab\";\n }", "function addToken (value) {\n // Create a token to enter into the token sequence\n var newToken = new token(value);\n // Add our new token\n tokenSequence.push(newToken);\n}", "function step1a (token) {\n if (token.match(/(ss|i)es$/)) {\n return token.replace(/(ss|i)es$/, '$1')\n }\n\n if (token.substr(-1) === 's' && token.substr(-2, 1) !== 's' && token.length > 2) {\n return token.replace(/s?$/, '')\n }\n\n return token\n}", "function Tokens(code) {\n\n this.tokens = tokenize(code);\n\n // Remmeber all of the tokens eaten so we can provide useful error message context.\n this.eaten = [];\n\n this.eat = function (expected) {\n //console.log(expected);\n\n if (expected && !this.nextIs(expected)) {\n console.log(\"expected\", expected);\n throw new Error(\"Line \" + this.currentLine() + \": expected '\" + expected + \"', but found '\" + this.tokens.slice(0, 5).join(\" \") + \"'\");\n }\n\n var eaten = this.tokens.shift();\n\n this.eaten.push(eaten);\n\n return eaten;\n };\n\n this.uneat = function () {\n\n this.tokens.unshift(this.eaten.pop());\n };\n\n this.eatN = function (n) {\n\n for (var i = 0; i < n; i++) this.eat();\n };\n\n this.count = function (text) {\n\n var index = 0;\n while (index < this.tokens.length && this.tokens[index] === text) index++;\n return index;\n };\n\n this.hasNext = function () {\n return this.tokens.length > 0;\n };\n this.nextIs = function (string) {\n return this.hasNext() && this.peek() === string;\n };\n this.peek = function () {\n return this.hasNext() ? this.tokens[0].toLowerCase() : null;\n };\n\n this.currentLine = function () {\n\n var line = 1;\n for (var i = 0; i < this.eaten.length; ++i) {\n if (this.eaten[i] === \"\\n\") line++;\n }\n return line;\n };\n}", "function setMutationToSoft(){\n minNumberbOfMutations = 1;\n maxNumberOfMutations = maxNumberOfMutationsCeiling/4;\n force = maxForce/8;\n randomMutations = false;\n}", "_eat(tokenType) {\n const token = this._lookahead;\n\n if (token === null) {\n throw new SyntaxError(\n `Unexpected end of input, expected: \"${tokenType}\"`,\n );\n }\n\n if (token.type !== tokenType) {\n throw new SyntaxError(\n `Unexpected token: \"${token.value}\", expected: \"${tokenType}\"`,\n );\n }\n\n // Advance to next token.\n this._lookahead = this._tokenizer.getNextToken();\n\n return token;\n }", "generateToken() {\n\t\tconst d0 = Math.random()*0xffffffff|0;\n\t\tconst d1 = Math.random()*0xffffffff|0;\n\t\tconst d2 = Math.random()*0xffffffff|0;\n\t\tconst d3 = Math.random()*0xffffffff|0;\n\t\treturn lut[d0&0xff]+lut[d0>>8&0xff]+lut[d0>>16&0xff]+lut[d0>>24&0xff]+\"-\"+\n\t\t\tlut[d1&0xff]+lut[d1>>8&0xff]+\"-\"+lut[d1>>16&0x0f|0x40]+lut[d1>>24&0xff]+\"-\"+\n\t\t\tlut[d2&0x3f|0x80]+lut[d2>>8&0xff]+\"-\"+lut[d2>>16&0xff]+lut[d2>>24&0xff]+\n\t\t\tlut[d3&0xff]+lut[d3>>8&0xff]+lut[d3>>16&0xff]+lut[d3>>24&0xff];\t\t\n\t}", "function addToken(playername, counter, counterid, tokentype) {\n return {\n type: 'ADD_TOKEN',\n payload: {\n playername: playername,\n counter: counter,\n counterid: counterid,\n tokentype: tokentype\n }\n };\n}", "function it(type, value, quote) {\n var id, the_token;\n if (type === '(string)' || type === '(range)') {\n if (jx.test(value)) {\n warn_at(bundle.url, line, from);\n }\n }\n the_token = Object.create(syntax[(\n type === '(punctuator)' ||\n (type === '(identifier)' && is_own(syntax, value)) ?\n value :\n type\n )] || syntax['(error)']);\n if (type === '(identifier)') {\n the_token.identifier = true;\n if (value === '__iterator__' || value === '__proto__') {\n fail_at(bundle.reserved_a, line, from, value);\n } else if (option.nomen &&\n (value.charAt(0) === '_' ||\n value.charAt(value.length - 1) === '_')) {\n warn_at(bundle.dangling_a, line, from, value);\n }\n }\n if (value !== undefined) {\n the_token.value = value;\n }\n if (quote) {\n the_token.quote = quote;\n }\n if (comments) {\n the_token.comments = comments;\n comments = null;\n }\n the_token.line = line;\n the_token.from = from;\n the_token.thru = character;\n the_token.prev = older_token;\n id = the_token.id;\n prereg = id && (\n ('(,=:[!&|?{};'.indexOf(id.charAt(id.length - 1)) >= 0) ||\n id === 'return'\n );\n older_token.next = the_token;\n older_token = the_token;\n return the_token;\n }", "function nextWord() {\n let words = RiTa.tokenize(txt); // split into words\n\n // loop from a random spot\n let r = floor(random(0, words.length));\n for (let i = r; i < words.length + r; i++) {\n let idx = i % words.length;\n let word = words[idx].toLowerCase();\n if (word.length < 3) continue; // len >= 3\n\n // find related words\n let pos = RiTa.tagger.allTags(word)[0];\n let rhymes = RiTa.rhymes(word, { pos });\n let sounds = RiTa.soundsLike(word, { pos });\n let spells = RiTa.spellsLike(word, { pos });\n let similars = [...rhymes, ...sounds, ...spells];\n\n // only words with 2 or more similars\n if (similars.length < 2) {\n console.log(\"No sims for \" + word);\n continue;\n }\n\n // pick a random similar\n let next = RiTa.random(similars);\n\n if (next.includes(word) || word.includes(next)) {\n continue; // skip substrings\n }\n if (/[A-Z]/.test(words[idx][0])) {\n next = RiTa.capitalize(next); // keep capitals\n }\n\n console.log(\"replace(\" + idx + \"): \" + word + \" -> \" + next);\n\n words[idx] = next; // do replacement\n break;\n }\n\n // recombine into string and display\n txt = RiTa.untokenize(words);\n\n if (counter % 10 === 0) // counter\n sentimentAnalysis(txt);\n \n setTimeout(nextWord, 1000);\n\n counter++;\n}", "async function mintToken() {\n if (typeof window.ethereum !== 'undefined') {\n await requestAccount();\n const provider = new ethers.providers.Web3Provider(window.ethereum);\n const signer = provider.getSigner();\n const contract = new ethers.Contract(tokenAddress, Token.abi, signer);\n let signerAddress = await signer.getAddress();\n console.log(\"Account:\", signerAddress);\n\n try {\n const tx = await contract.createCollectible(signerAddress, \"ipfs://QmZhQho7NniB1pZLzAz9aZzHFw2M7jyZm2bmStFshYWURT\");\n console.log('data: ', tx);\n } catch (err) {\n console.log(\"Error: \", err);\n }\n }\n }", "function WordHints() {\n this.tokenDefinition = /\\#[\\-a-zA-Z0-9_]*[a-zA-Z0-9_]*/g;\n this.currentTokenDefinition = /\\#[\\-a-zA-Z0-9_]*$/g;\n }", "analyse() {\n let currentState = new UndecidedState(this);\n\n while (this._pos < this._text.length && typeof currentState !== 'undefined') {\n let ch = this._text.charAt(this._pos);\n this.skipAheadBy(1);\n currentState = currentState.next(ch);\n }\n\n // Give state chance to store its token.\n if (typeof currentState !== 'undefined') {\n currentState.terminate();\n }\n\n return this._tokens;\n }", "function airdropTokens() {\n\t//First check that the erc20Instance is defined. \n\tif(erc20InstanceDefined()) {\n\t\t//Now we need to check who is the owner of the airdrop contract by invoking the getOwner() function.\n\t\t//The details of this funciton can be found in the Owned.sol smart contract code. \n\t\tairdropInstance.getOwner((error,owner)=>{\n\t\t\tif(!error) {\n\t\t\t\t//If the owner's address of the airdrop smart contract is NOT the same as the user's address,\n\t\t\t\t//alert the user and exit the function. \n\t\t\t\tif(owner != web3.eth.accounts[0]) {\n\t\t\t\t\talert(\"ONLY THE OWNER OF THE CONTRACT IS ALLOWED TO AIRDROP TOKENS\");\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\t//If the owner address of the airdrop smart contract IS the same as the user's address,\n\t\t\t\t\t//then proceed to take the user's input starting with the addresses of all recipients of\n\t\t\t\t\t//the batch transfer. \n\n\t\t\t\t\t//In case the user has separated all addresses (or just some) with a comma or a new line\n\t\t\t\t\t//then replace every occurence of each with a white space.\n\t\t\t\t var addrsInput = document.getElementById(\"recipient_addrs\").value.replaceAll(\",\", \" \");\n\t\t\t\t addrsInput = addrsInput.replaceAll(\"\\n\", \" \")\n\t\t\t\t //Now split the input into an array by the white spaces. \n\t\t\t\t addrsInput = addrsInput.split(\" \");\n\t\t\t\t //Create a new array to hold the addresses\n\t\t\t\t var addrs = [];\n\t\t\t\t for(i=0; i < addrsInput.length; i++) {\n\t\t\t\t \t//If once trimmed (i.e., all white space removed) the value is not the empty string,\n\t\t\t\t \t//then add it to the array of addresses. \n\t\t\t\t if(addrsInput[i].trim() != \"\"){\n\t\t\t\t addrs.push(addrsInput[i].trim())\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t addrs = addrs.map(el => el.trim());\n\t\t\t\t //Now do the exact same thing for the input values (i.e., the total amounts of tokens the \n\t\t\t\t //user wants to send to each address) as what was done with the recipient addresses provided\n\t\t\t\t //by the user as input. \n\t\t\t\t var valsInput = document.getElementById(\"corresponding_values\").value.replaceAll(\",\", \" \");\n\t\t\t\t valsInput = valsInput.replaceAll(\"\\n\", \" \")\n\t\t\t\t valsInput = valsInput.split(\" \");\n\t\t\t\t var vals = []\n\t\t\t\t for(i=0; i < valsInput.length; i++) {\n\t\t\t\t if(valsInput[i].trim() != \"\"){\n\t\t\t\t vals.push(valsInput[i].trim())\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t vals = vals.map(el => el.trim());\n\t\t\t\t //Now check that all addresses provided by the user match the regular expression for\n\t\t\t\t //ETH addresses. \n\t\t\t\t var ethAddrRegex = \"^0x[a-fA-F0-9]{40}$\";\n\t\t\t\t for(var i = 0; i < addrs.length; i++) {\n\t\t\t\t if(!addrs[i].match(ethAddrRegex)){\n\t\t\t\t alert(\"Invalid address found in address list \" + addrs[i]);\n\t\t\t\t return;\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t //At this point we check to see if the user has provided more than one value in order\n\t\t\t\t //to know whether or not the user wants to make a single or multi value airdrop. \n\t\t\t\t if(vals.length > 1) {\n\t\t\t\t \t//If more than one value has been provided then it will be a multi value airdrop,\n\t\t\t\t \t//in which case it is necessary to check that the user has provided the same \n\t\t\t\t \t//amount of values as addresses.\n\t\t\t\t if(vals.length != addrs.length) {\n\t\t\t\t \t//If the user has provided different amounts of values as addresses, then\n\t\t\t\t \t//alert the user and exit the function. \n\t\t\t\t alert(\"Number of values must be the same as number of addresses\");\n\t\t\t\t return;\n\t\t\t\t }\n\t\t\t\t //Otherwise, multiply all the values by (10**erc20Decimals) to ensure that all \n\t\t\t\t //values have the correct number of zeros at the end. \n\t\t\t\t for(var i = 0; i < vals.length; i++) {\n\t\t\t\t vals[i] = (vals[i] * (10 ** erc20Decimals));\n\t\t\t\t }\n\t\t\t\t //Now invoke the multiValue airdrop function to distribute the tokens. \n\t\t\t\t multiValueAirdrop(addrs, vals);\n\t\t\t\t } else {\n\t\t\t\t \t//In this case, the user wants to make a single value airdrop. So all that \n\t\t\t\t \t//needs to be done is to multiply the single value by (10 ** erc20Decimals)\n\t\t\t\t \t//to ensure that the value has the correct number of zeros at the end and then \n\t\t\t\t \t//invoke the singleValueAirdrop function to distribute the tokens. \n\t\t\t\t var value = (vals[0] * (10 ** erc20Decimals));\n\t\t\t\t singleValueAirdrop(addrs, value);\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "checkNext() {\n let token;\n if (this.currentToken < this.tokens.length){\n token = this.tokens[this.currentToken];\n }\n else\n token = \"NO_MORE_TOKENS\";\n return token;\n }", "function MeasureLexicalReach() {\r\n}", "function Assign_Lex_Other() {\r\n}", "function reglaSuperAvance(){\n\n}", "advance () {\n if (!this.hasMoreTokens()) return (this.currentToken = null)\n this.currentToken = this.tokens[++this.currentTokenIndex]\n this.notify(this.currentTokenIndex)\n }", "function tokens(n) {\n return web3.utils.toWei(n, 'ether');\n}", "function token(type, value) {\n \t\tthis.type = type;\n \t\tthis.value = value;\n \t}", "firstToken({token, counter}) {\n\t\tif (['quote'].includes(token.name)) {\n\t\t\tthis.openQuote = token.value;\n\t\t\tthis.listener.candidates = this.listener.candidates.filter(c=> c.name === 'string');\n\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "tratarDigito() {\n let numero = \"\";\n\n numero = numero.concat(this.caracter);\n this.lerCaracter();\n\n while (/[0-9]/g.test(this.caracter) === true) {\n numero = numero.concat(this.caracter);\n this.lerCaracter();\n }\n this.token.lexema = +numero\n this.token.simbolo = \"snumero\"\n this.token.linha = this.numLinha\n }", "get_token_string(){\n return this.token_string;\n }", "function step3(token) {\n return replacePatterns(token, [['icate', 'ic'], ['ative', ''], ['alize', 'al'],\n\t\t\t\t ['iciti', 'ic'], ['ical', 'ic'], ['ful', ''], ['ness', '']], 0); \n}", "function Assign_Lex() {\r\n}", "get tokens() {\n return this._tokens;\n }", "constructor() {\n //para cargar los tokens \n this.loadToken(); //estudiante\n this.loadTokenTeacher(); //docente \n }", "editTokens() {\n return this.gotoState('dbaas-logs.detail.tokens');\n }" ]
[ "0.5863265", "0.5863265", "0.58330864", "0.5793421", "0.56981754", "0.56959707", "0.54972523", "0.5487911", "0.5402416", "0.53890204", "0.5384637", "0.53822684", "0.53205913", "0.5316284", "0.5263694", "0.52555865", "0.52546984", "0.521633", "0.5209758", "0.5195845", "0.5181155", "0.51777685", "0.51666564", "0.51619387", "0.5160018", "0.5159464", "0.51152486", "0.5095302", "0.5076752", "0.5057256", "0.50460076", "0.50458115", "0.50406355", "0.5036061", "0.5036061", "0.5031286", "0.5020948", "0.5011563", "0.5000492", "0.49887598", "0.49671897", "0.49344334", "0.49182266", "0.4917066", "0.4917066", "0.49165824", "0.49147385", "0.49070045", "0.48991027", "0.48971885", "0.48971885", "0.48938736", "0.48863944", "0.48835352", "0.48821855", "0.48783115", "0.48738128", "0.48719397", "0.48542643", "0.48420924", "0.4839737", "0.48353407", "0.48259652", "0.48193803", "0.48093626", "0.48059285", "0.48005322", "0.47996333", "0.47864386", "0.47854403", "0.47854263", "0.4780323", "0.47741687", "0.47713396", "0.47691923", "0.47670493", "0.4764546", "0.47563532", "0.47560874", "0.4749519", "0.4749122", "0.47451153", "0.47201565", "0.47042176", "0.4700822", "0.46966717", "0.4694375", "0.46861917", "0.4685066", "0.46789044", "0.46764666", "0.46737245", "0.46734214", "0.46725383", "0.46723205", "0.46712777", "0.46674097", "0.4663301", "0.46631113", "0.4661979" ]
0.62111944
0
Check if currently in a Spire past IgnoreSpiresUntil
function isActiveSpireAT() { return game.global.spireActive && game.global.world >= getPageSetting('IgnoreSpiresUntil'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isPastCutoff() {\n return this.isTracking && Date.now() - this.pauses.last() > 5 * 60 * 1000\n }", "getExpiresIn() {}", "isExpired() {\n return this.expirationTime < msalCommon.TimeUtils.nowSeconds();\n }", "get expired() {\n if (this.expiresAt) {\n const now = Math.floor(Date.now() / 1000);\n const expiresIn = this.expiresAt - now;\n return expiresIn <= 0;\n }\n return false;\n }", "expired() {\n return isAfter(new Date(), this.token.expires_at);\n }", "checkDateExpiresOn(date) {\n let currentDate = new Date(Date.now());\n let givenDate = new Date(this.stringFormatDate(date));\n if (givenDate < currentDate) {\n return true;\n }\n return false;\n }", "get isTooLate() {\n return this._period.end.diff(this._getCurrentDateTime()).milliseconds < 0\n }", "get is_expiry_date_no_limit(){\n return this._is_expiry_date_no_limit\n }", "isExpiring(offset = 60) {\n return (this.token && this.token.isExpiring(offset));\n }", "function checkVisaExpiry(){\r\n\r\n}", "function isExpired(shareEntry) {\n var expires = shareEntry.expires;\n var expiration = Date.parse(expires);\n\n if (Date.now() >= expiration) {\n return true;\n } else {\n return false;\n }\n}", "function isExpired (campaign) {\n\treturn Date.now() > new Date(campaign.validUntil * 1000).getTime()\n}", "function didExpire(competition) {\n let endTime = new Date(competition.endTime);\n return new Date(endTime.getTime() + 30 * 60000).getTime() < Date.now();\n}", "function checkExpire(todo){\n let dateNum\n if(todo.expire!=null){\n dateNum = Math.floor ( (new Date(todo.expire)-new Date()) / ( 24 * 3600 * 1000 ))+1\n }\n if(todo.expire==null || dateNum>=0){\n // console.log('no expire');\n return todo;\n }\n \n }", "checkTicket(ticket) {\n return ticket && ticket.expires_in > (Date.now() / 1000);\n }", "checkTTL() {\n\t\tlet now = Date.now();\n\t\tthis.cache.forEach((value, key) => {\n\t\t\tlet item = this.cache.get(key);\n\n\t\t\tif (item.expire && item.expire < now) {\n\t\t\t\tthis.logger.debug(`EXPIRED ${key}`);\n\t\t\t\tthis.metrics.increment(METRIC.MOLECULER_CACHER_EXPIRED_TOTAL);\n\t\t\t\tthis.cache.delete(key);\n\t\t\t}\n\t\t});\n\t}", "function isOutsiteTimeline(marker) {\n\tvar interval = $('#slider-range').slider('option').values;\n\t\n\treturn marker.timestamp < interval[0] || marker.timestamp > interval[1];\n}", "function checkPreventCount() {\n var diffDays,\n expires,\n preventCount,\n prevent_cookie_name,\n prevent_cookie_value;\n\n // prevent the intercept presentation until user has visited number of times. Item no: 7\n if (typeof settings.preventCount !== \"undefined\") {\n // validating prevent value\n if (!(!isNaN(parseFloat(settings.preventCount)) && isFinite(settings.preventCount))) {\n console.warn(\"Invalid prevent count.\");\n return false;\n }\n preventCount = settings.preventCount;\n prevent_cookie_name = \"ccf-prevent-intercept-\" + settings.survey.type + \":\" + settings.survey.id;\n\n if (IBM.common.util.storage.getItem(prevent_cookie_name) === null) {\n diffDays = Math.round(Math.abs((new Date().getTime() - new Date(settings.stop).getTime()) / (24 * 60 * 60 * 1000)));\n expires = diffDays * 24 * 60 * 60;\n IBM.common.util.storage.setItem(prevent_cookie_name, 1, expires);\n }\n\n prevent_cookie_value = IBM.common.util.storage.getItem(prevent_cookie_name);\n if (prevent_cookie_value < preventCount) {\n prevent_cookie_value++;\n diffDays = Math.round(Math.abs((new Date().getTime() - new Date(settings.stop).getTime()) / (24 * 60 * 60 * 1000)));\n expires = diffDays * 24 * 60 * 60;\n IBM.common.util.storage.setItem(prevent_cookie_name, prevent_cookie_value, expires);\n return false;\n }\n }\n return true;\n }", "insideLimit () {\n this.check();\n\n let now = Date.now();\n let limits = Object.keys(this.limits);\n\n for(let i = 0; i < limits.length; i++){\n if(this.currentLimits[limits[i]].date - now > 0 && this.currentLimits[limits[i]].value + 1 < this.limits[limits[i]]) {\n return false;\n }\n }\n\n return true;\n }", "static isTokenExpired(tokenExpiresSec) {\n const tokenExpiresDate = new Date(tokenExpiresSec * 1000);\n return tokenExpiresDate < new Date();\n }", "check() {\n let now = Date.now();\n let limits = Object.keys(this.currentLimits);\n \n for(let i = 0; i < limits.length; i++) {\n if(this.limits[limits[i]].date - now <= 0) {\n this.setCount (limits[i], 0);\n }\n }\n }", "function isPastTime(index) {\n if (moment().dayOfYear() !== parseInt($stateParams.day)) return false;\n if (index === 0 && moment().hour() > 11) return true;\n if (index === 1 && moment().hour() > 18) return true;\n return false; \n }", "get isTooEarly() {\n return this._period.start.diff(this._getCurrentDateTime()).milliseconds > 0\n }", "is_expired() {\n return this.viewer == null\n }", "static isTooRecent(w) {\n if(!TeacherCacheState.cache[w])\n return false;\n\n var now = Date.now()/1000;\n var I = TeacherCacheState.cache[w]['I'];\n var last = TeacherCacheState.cache[w]['last'];\n return now < last + I;\n }", "function isfutureDate(value) {\n\tvar now = new Date();\n\tvar target = new Date(value);\n\n\tif (target.getFullYear() > now.getFullYear()) {\n\t\treturn true;\n\t} \n\telse if (target.getFullYear() == now.getFullYear()) {\n\t\tif (target.getMonth() > now.getMonth()) {\n\t\t\treturn true;\n\t\t} \n\t\telse if (target.getMonth() == now.getMonth()) {\n\t\t\tif (target.getDate() > now.getDate()) {\n\t\t\t\treturn true;\n\t\t\t} \n\t\t\telse if(target.getDate() == now.getDate()) {\n\t\t\t\t// current time less than market open time then return true\n\t\t\t\tvar time = now.getHours();\n\t\t\t\tif(time <= 9) {\n\t\t\t\t\treturn true;\n\t\t\t\t} \n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\treturn false;\n\t}\n}", "inCache(url) {\n if ((Date.now() - this.cache[this.hashValue(url)]) > (this.cacheTimeoutMinutes * 60 * 1000)) {\n return false;\n }\n if (this.cache[this.hashValue(url)]) {\n return true;\n }\n return false;\n }", "expiryTime(now) {\n if (this.maxAge != null) {\n const relativeTo = now || this.creation || new Date();\n const age = this.maxAge <= 0 ? -Infinity : this.maxAge * 1000;\n return relativeTo.getTime() + age;\n }\n\n if (this.expires == Infinity) {\n return Infinity;\n }\n return this.expires.getTime();\n }", "expiryTime(now) {\n if (this.maxAge != null) {\n const relativeTo = now || this.creation || new Date();\n const age = this.maxAge <= 0 ? -Infinity : this.maxAge * 1000;\n return relativeTo.getTime() + age;\n }\n\n if (this.expires == Infinity) {\n return Infinity;\n }\n return this.expires.getTime();\n }", "outsideTimeFrame() {\n\t\tconst date = new Date();\n\t\tconst weekday = date.getDay() || 7; // JavaScript days are Sun-Sat 0-6 but we want Mon-Sun 1-7.\n\t\tconst hour = date.getHours();\n\n\t\tif (weekday < window.pizzakitTimes.start.weekday) {\n\t\t\treturn true;\n\t\t}\n\t\telse if (weekday == window.pizzakitTimes.start.weekday) {\n\t\t\tif (hour < window.pizzakitTimes.start.hours) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (window.pizzakitTimes.end.weekday < weekday) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if (window.pizzakitTimes.end.weekday == weekday) {\n\t\t\t\tif (window.pizzakitTimes.end.hours <= hour) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "function isExpired (endtime) {\n return new Date() > new Date(endtime + (moment().isDST() ? '-05:00' : '-06:00'))\n}", "get isExpired() {\n const msg = this.get('x-textile-api-sig-msg');\n const notAuthed = msg === undefined && this.authCallback !== undefined;\n const isExpired = msg !== undefined && new Date(msg) <= new Date();\n return isExpired || notAuthed;\n }", "isRevoked() {\n const { canReceiveAfter, canSendAfter, kycExpiry } = this;\n const datesAreZero = [canReceiveAfter, canSendAfter, kycExpiry].every(date => date.getTime() === 0);\n //\n return datesAreZero;\n }", "function isCurrent(fetchTime: number, ttl: number): boolean {\n return fetchTime + ttl >= Date.now();\n}", "valid(current)\n\t{\n\t\tlet yesterday = Datetime.moment().subtract( 1, 'day' );\n\t\treturn current.isAfter( yesterday );\n\t}", "isDelayed(){\n let isDelayed = false;\n if(this.task && this.task.endDate){\n const startOfDay = moment.utc().startOf('day').valueOf();\n const dueDate = moment.utc(this.task.endDate).valueOf();\n if( dueDate < startOfDay ){\n isDelayed = true;\n }\n }\n return isDelayed;\n }", "async function forceExpiration() {\n await poheth.methods.forceExpiration().send({ from: sellerAddress });\n const expired = await poheth.methods.hasExpired().call();\n expired.should.be.true;\n }", "TTL(now) {\n /* RFC6265 S4.1.2.2 If a cookie has both the Max-Age and the Expires\n * attribute, the Max-Age attribute has precedence and controls the\n * expiration date of the cookie.\n * (Concurs with S5.3 step 3)\n */\n if (this.maxAge != null) {\n return this.maxAge <= 0 ? 0 : this.maxAge * 1000;\n }\n\n let expires = this.expires;\n if (expires != Infinity) {\n if (!(expires instanceof Date)) {\n expires = parseDate(expires) || Infinity;\n }\n\n if (expires == Infinity) {\n return Infinity;\n }\n\n return expires.getTime() - (now || Date.now());\n }\n\n return Infinity;\n }", "TTL(now) {\n /* RFC6265 S4.1.2.2 If a cookie has both the Max-Age and the Expires\n * attribute, the Max-Age attribute has precedence and controls the\n * expiration date of the cookie.\n * (Concurs with S5.3 step 3)\n */\n if (this.maxAge != null) {\n return this.maxAge <= 0 ? 0 : this.maxAge * 1000;\n }\n\n let expires = this.expires;\n if (expires != Infinity) {\n if (!(expires instanceof Date)) {\n expires = parseDate(expires) || Infinity;\n }\n\n if (expires == Infinity) {\n return Infinity;\n }\n\n return expires.getTime() - (now || Date.now());\n }\n\n return Infinity;\n }", "get expired() {\n\t\treturn !this.ticket;\n\t}", "checkExpiration() {\n const interval = Number(this.options.refreshInterval);\n if (interval) {\n const time = getTime(-interval);\n this.invalidate(time);\n }\n }", "tokenExpired(token) {\n const payload = this.payload(token);\n const expirationTime = new Date((payload.exp * 1000) - 300000);\n\n if (expirationTime <= new Date()) {\n return true;\n }\n\n return false;\n }", "isExpired(session) {\n const now = Date.now() / 1000;\n const expiry = session.idClaims && session.idClaims.exp || 0;\n return expiry < now;\n }", "function allowedInterval(now){\n\tif (!moment(now).isValid()) return false;\n\tvar start_at = moment(config.FORBIDDEN_INTERVAL.hour, 'h:mm');\n\tvar until = moment(start_at).add(config.FORBIDDEN_INTERVAL.interval, 'hours');\n\tif (moment(now).isBetween(start_at, until))\n\t\treturn false;\n\telse\n\t\treturn true;\n}", "get expiry() {\n this._logger.trace(\"[getter] expiry\");\n\n return this._expiry;\n }", "function isInactive (e) {\n return e.stateChange && (e.duration && e.duration.mean == 0)\n}", "isAuthenticated() {\n // Check whether the current time is past the\n // Access Token's expiry time\n let expiresAt = JSON.parse(localStorage.getItem('expires_at'));\n\n //alert('in auth0.isAuthenticated: expiresAt = ' + expiresAt);\n\n //let currTime = new Date().getTime();\n //alert(' AND (Date().getTime() < expiresAt) returns(T=auth):' + (currTime < expiresAt));\n\n return (new Date().getTime() < expiresAt);\n }", "function stopRunning(){\n\n return Date.now().valueOf() - start.valueOf() > millimit\n\n}", "function hasTtlExpired(ttl) {\n return ttl < Date.now();\n}", "function isRateLimited(limits, category, now = Date.now()) {\n\t return disabledUntil(limits, category) > now;\n\t}", "checkAccessToken(token) {\n return token && token.expires_in > (Date.now() / 1000);\n }", "function uptodate( user ){\n var age_collected = now - user.time_friends_collected;\n return age_collected < 3 * 24 * 3600 * 1000;\n }", "static isTokenFresh(token, \n /**\n * -10 minutes in seconds\n */\n secondsMargin = 60 * 10 * -1) {\n if (!token) {\n return false;\n }\n if (token.expiresIn) {\n const now = getCurrentTimeInSeconds();\n return now < token.issuedAt + token.expiresIn + secondsMargin;\n }\n // if there is no expiration time but we have an access token, it is assumed to never expire\n return true;\n }", "function sessionHasExpired() {\n if (!service.session || !service.session.expiresOn) {\n return false;\n }\n\n const expiresOn = service.session.expiresOn;\n const nowUTC = new Date().toUTCString();\n const exp = moment(expiresOn, 'YYYY-MM-DDTHH:mm:ss.SSS', false).utc();\n const now = moment(nowUTC, 'ddd, DD MMM YYYY HH:mm:ss.SSSS GMT', false).utc();\n\n return !exp.isAfter(now);\n }", "isA2HSpromptDelayExpired() {\n return new Date(localStorage.getItem('A2HSPromptDate')) <= new Date();\n }", "function disabledDate(current) {\n return current && current.valueOf() < Date.now(); //Date.now()\n }", "checkToken() {\n const bufferTimeSec = 10 * 60 // 10 minutes\n , nowSec = (new Date()).getTime()/1000;\n if (this.accessToken && this.accountId && this.expires && \n (this.expires.getTime()/1000) > (nowSec + bufferTimeSec)) {\n return true\n } else {\n // No longer logged in, but we need the user to login:\n this.accessToken = false;\n this.meToken = false;\n this.appObject.loggedIn = false;\n return false\n }\n }", "function CheckPastTime(t, e, n, a) { var i = t.split(\"/\"), o = n.split(\"/\"); return new Date(JtoG(i[0], i[1], i[2], !0) + \" \" + e) < new Date(JtoG(o[0], o[1], o[2], !0) + \" \" + a) }", "isPersistent() {\n return this.maxAge != null || this.expires != Infinity;\n }", "isPersistent() {\n return this.maxAge != null || this.expires != Infinity;\n }", "function isRateLimited(limits, category, now = Date.now()) {\n return disabledUntil(limits, category) > now;\n }", "static checkTokenExpiration() {\n var d = new Date();\n var timePassed = d.getTime() - localStorage.getItem('timestamp')\n //Removes token if more than 12 hours have passed since last login (token limit)\n if(timePassed > 12*60*60*1000){\n this.deauthenticateUser();\n }\n }", "function debounceSearch() {\n var now = new Date().getMilliseconds();\n lastSearch = lastSearch || now;\n return ((now - lastSearch) < 300);\n }", "is_available() {\n return this._time_until_arrival === 0;\n }", "function disabledDate(current) {\n\t// Can not select future dates\n\treturn current && current >= moment().tz('Asia/Kolkata').endOf('day');\n}", "function isRateLimited(limits, category, now = Date.now()) {\n return disabledUntil(limits, category) > now;\n}", "function debounceSearch() {\n var now = new Date().getMilliseconds();\n lastSearch = lastSearch || now;\n\n return ((now - lastSearch) < 300);\n }", "function debounceSearch() {\n var now = new Date().getMilliseconds();\n lastSearch = lastSearch || now;\n\n return ((now - lastSearch) < 300);\n }", "function debounceSearch() {\n var now = new Date().getMilliseconds();\n lastSearch = lastSearch || now;\n\n return ((now - lastSearch) < 300);\n }", "isTokenExpired() {\n if (this.tokenExpireTime && this.tokenExpireTime > Date.now()) {\n return false;\n }\n return true;\n }", "function _tokenExpiresIn(token) {\r\n const parsedToken = _parseToken(token);\r\n _assert(parsedToken, \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof parsedToken.exp !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof parsedToken.iat !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n return Number(parsedToken.exp) - Number(parsedToken.iat);\r\n}", "function _tokenExpiresIn(token) {\r\n const parsedToken = _parseToken(token);\r\n _assert(parsedToken, \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof parsedToken.exp !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n _assert(typeof parsedToken.iat !== 'undefined', \"internal-error\" /* INTERNAL_ERROR */);\r\n return Number(parsedToken.exp) - Number(parsedToken.iat);\r\n}", "isAuthenticated () {\n // Check whether the current time is past the\n // access token's expiry time\n let expiresAt = JSON.parse(localStorage.getItem('expires_at'))\n return console.log(new Date().getTime() < expiresAt)\n }", "get canReserve() {\n return (!this.api.isRequesting && this.selectedTime != '00:00:00');\n }", "function isExpired(room) {\n var time = getRelativeTime(room, -4);\n if (time['nh'] > time['h']) {\n if (time['nh'] > time['h']) {\n if (time['nh'] > time['h'] + 1) {\n return true;\n } else if (time['nm'] + 60 - time['m'] > 30) {\n return true;\n }\n }\n } else if (time['nh'] == time['h']) {\n if (time['nm'] > time['m'] + 30) {\n return true;\n }\n }\n return false;\n}", "function validateExpritation() {\n const expirationDate = store.getters.getExpDate\n const now = new Date()\n if (now.getTime() > expirationDate.getTime()) {\n // Emit an alert to main Vue component\n // EventBus.$emit('token-expired')\n store.dispatch('logOut')\n }\n}", "function isExpired() {\n _this.ballotContract.IsProposalExpired(function (error, result) {\n console.log(JSON.stringify(result) + \"...is from isproposalexpired function in ballot\")\n setTimeout(function () {\n //recursively check every 9 seconds. in the future make this a day.\n isExpired()\n }, 9000)\n })\n }", "function isNotModified () {\n return +cache.lastModified == +lastModified;\n }", "function checkTimeout(){\n\t//find the timeout\n\tvar to = readCookie(\"to\");\n\tif(to)return true;\n\telse return false;\n}", "function checkNeverCacheList(url) {\n\tif ( this.match(url) ) {\n\t\treturn false;\n\t}\n\treturn true;\n}", "function determineTense(searchTimestamp) {\n // past\n if (searchTimestamp < currentTime) {\n tense = 'was';\n }\n // future\n else if (searchTimestamp > currentTime) {\n tense = 'will be';\n }\n // present\n else {\n tense = 'is';\n }\n}", "get authenticated() {\n return this.expiration && this.expiration > new Date() || false;\n }", "function checkAmbulanceServiceTime() {\r\n var deadLine = trasanoOptions.deadLine;\r\n\r\n if (localStorage.getItem(\"serviceTime\") != null && localStorage.getItem(\"serviceTime\") != \"\") {\r\n var serviceTime = new Date();\r\n var currentTime = new Date();\r\n\r\n serviceTime.setTime(parseInt(localStorage.getItem(\"serviceTime\")) + parseInt(deadLine));\r\n if (currentTime > serviceTime) {\r\n console.log(\"trasano.checkAmbulanceServiceTime.localStorage => Inizialiced\");\r\n localStorage.removeItem(\"ambulance\");\r\n localStorage.removeItem(\"tagcode\");\r\n localStorage.removeItem(\"serviceTime\");\r\n localStorage.removeItem(\"lastClaim\");\r\n }\r\n } \r\n}", "function isSessionTimedOut() {\n var timeString = localStorage.getItem('timestamp'),\n time;\n\n if (timeString) {\n time = new Date(timeString);\n\n // Check if it's at least 115 minutes old...\n if ((new Date()) - time >= 6900000) {\n return true;\n }\n }\n return false;\n}", "checkCurrentDateActuals() {\n let currentDate = new Date()\n let currentDay = currentDate.getDate()\n\n let checkActuals = this.checkActualEnabled()\n\n // Check firebase to see if editing actuals is enabled\n // Allow user to submit entry for actuals if \n if (checkActuals || (currentDay <= 14)) {\n this.enableActuals()\n // Display error messaging\n } else {\n console.log(\"Current date is within latter half of the month!\")\n console.log(\"Data cannot be submitted without admin permissions\")\n }\n }", "function checkTTL(responseDate, ttl){\n var responseSplit = responseDate.split(\" \");\n var responseDay = responseSplit[0].substring(0,responseSplit[0].length -2);\n var responseMonth;\n if(responseSplit[1].toLowerCase().indexOf(\"jan\") > -1 ){\n responseMonth = 0;\n }else if(responseSplit[1].toLowerCase().indexOf(\"feb\") > -1 ){\n responseMonth = 1;\n }else if(responseSplit[1].toLowerCase().indexOf(\"mar\") > -1 ){\n responseMonth = 2;\n }else if(responseSplit[1].toLowerCase().indexOf(\"apr\") > -1 ){\n responseMonth = 3;\n }else if(responseSplit[1].toLowerCase().indexOf(\"may\") > -1 ){\n responseMonth = 4;\n }else if(responseSplit[1].toLowerCase().indexOf(\"jun\") > -1 ){\n responseMonth = 5;\n }else if(responseSplit[1].toLowerCase().indexOf(\"jul\") > -1 ){\n responseMonth = 6;\n }else if(responseSplit[1].toLowerCase().indexOf(\"aug\") > -1 ){\n responseMonth = 7;\n }else if(responseSplit[1].toLowerCase().indexOf(\"sep\") > -1 ){\n responseMonth = 8;\n }else if(responseSplit[1].toLowerCase().indexOf(\"oct\") > -1 ){\n responseMonth = 9;\n }else if(responseSplit[1].toLowerCase().indexOf(\"nov\") > -1 ){\n responseMonth = 10;\n }else if(responseSplit[1].toLowerCase().indexOf(\"dec\") > -1 ){\n responseMonth = 11;\n }\n\n var dateFrom = new Date(responseSplit[2], responseMonth, responseDay);\n //dateFrom = dateFrom.getTime();\n\n var dateTo = new Date();\n //Need to set the date this way, adding time, other ways are buggy.\n dateTo.setTime( dateFrom.getTime() + parseInt(ttl) * 86400000 );\n\n var today = new Date().getTime();\n\n if( today >= dateFrom && today <= dateTo){\n return true;\n }else{\n return false;\n }\n\n}", "function inTime (userTimeSignature, allowedTimeThreshold) {\n currentTime = Math.floor(new Date().getTime()/1000);\n allowedTime = currentTime - allowedTimeThreshold;\n return userTimeSignature > allowedTime\n}", "function inLiveHours(){\n var now = new Date();\n var hour = now.getHours()\n return ((hour >= LIVE_SOD) && (hour < LIVE_EOD))\n}", "function expired(time, expire){\n\tvar current = new Date().getTime();\n\treturn (current - time) > expire;\n}", "getNextDisabled() {\n let data = this.state.data.slice();\n let planReqs = this.state.currentPlan.requirements;\n let extras = data.filter(item => !planReqs.includes(item.code));\n let expired = extras.every(req => {\n return req.timeRemaining === 0;\n })\n return ((this.state.data.length - this.state.currentPlan.requirements.length) === 0 || this.state.elapsedTime === 5 || expired) ? true : false;\n }", "function ifInFuture(someTime) {\r\n const currentTime = new Date().getTime();\r\n\r\n const givenHours = someTime.split(\":\")[0];\r\n const givenMinutes = someTime.split(\":\")[1];\r\n const givenTime = new Date().setHours(givenHours, givenMinutes, 0, 0)\r\n\r\n if (givenTime>currentTime) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function checkExpireStatus(key) {\n\t\tif (key && key !== '') {\n\t\t\tvar current = new Date();\n\t\t\t/* Get Schedule */\n\t\t\tvar storedExpiretime = localStorage.getItem(key + '_expires');\n\t\t\t/* Expired */\n\t\t\tif (storedExpiretime && storedExpiretime < current.getTime()) {\n\t\t\t\t/* Remove */\n\t\t\t\tremoveLocalStorage(key);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t/* Storage still valid */\n\t\t\treturn false;\n\t\t} else {\n\t\t\t/* couldn't validate */\n\t\t\tstatusLog('checkExpireStatus error: required parameter \"key\" is null of empty. The localstore could not be validated.');\n\t\t}\n\t\treturn 'invalid';\n\t}", "function filterOne(stopName) {\n\n var actualTime = new Date();\n var hours = actualTime.getHours() * 3600;\n var minutes = actualTime.getMinutes() * 60;\n var secs = actualTime.getSeconds();\n\n var seconds = hours + minutes + secs;\n var departureTimes = app.yourStopInfo.timetable.timetables;\n return departureTimes[stopName].reduce(function (prev, curr) {\n\n return prev || curr.departures[1].reduce(function (prev, curr) {\n var toSeconds = curr.split(\":\");\n var pure = (+toSeconds[0]) * 60 * 60 + (+toSeconds[1]) * 60;\n\n var dTime = pure - seconds;\n return prev || (dTime <= 1200 && dTime >= 0);\n }, false)\n\n || curr.departuresOnWayBack[1].reduce(function (prev, curr) {\n var toSeconds = curr.split(\":\");\n var pure = (+toSeconds[0]) * 60 * 60 + (+toSeconds[1]) * 60;\n\n var dTime = pure - seconds;\n return prev || (dTime <= 1200 && dTime >= 0);\n }, false);\n\n }, false);\n\n }", "_shouldCheckForUpdateOnResume() {\n // In case a pause event was missed, assume it didn't make the cutoff\n if (!localStorage.getItem('reloaderLastPause')) {\n return false;\n }\n\n // Grab the last time we paused\n const lastPause = Number(localStorage.getItem('reloaderLastPause'));\n\n // Calculate the cutoff timestamp\n const idleCutoffAt = Number( Date.now() - this._options.idleCutoff );\n\n return (\n this._options.idleCutoff &&\n lastPause < idleCutoffAt &&\n this._options.check === 'everyStart'\n );\n }", "checkIfShouldNotify(user){\n let start = moment.unix(user.start_date);\n let now = moment();\n console.log('start', start, 'difference in hours for notification: ', now.diff(start, 'hours') % 24);\n return (now.diff(start, 'hours') % 24 >= NOTIFY_TIME)\n }", "function oldEnough() {\n var ageLimit = moment().subtract(21, 'years').calendar();\n var birthDate = age.month + \" \" + age.day + \" \" + age.year;\n var oldEnough = moment(birthDate, \"MM DD YYYY\").isBefore(ageLimit, 'day');\n\n if (oldEnough) {\n // cookie.set('validAge', 'true');\n\n setCookie('popupCookie', 'submited', 1);\n\n\n\n $('#ageModal').modal('hide');\n } else {\n // cookie.set('validAge', 'false');\n console.log(\"it is false\");\n }\n }", "isOnline(lastUsed) {\n return utils.xSecondsAgoUTC(12) < lastUsed ? true : false\n }", "function dueSoon() {\n\t$.each($('li'), function(i,v) {\n\t\t\tif( (allItems[i].due.getTime() - Date.now()) < 86400000 ) {\n\t\t\t\t$(this).find('span').addClass('due-soon');\n\t\t\t}\n\t\t});\n}", "function dataIsOld(otherTime)\r\n{\r\n var MSECS_ALLOWED = 1000 * 60 * 60; // 60 minutes\r\n var rightNow = new Date();\r\n //GM_log('otherTime: ' + otherTime);\r\n //GM_log('dataIsOld::rightNow: ' + rightNow.getTime());\r\n if(Math.abs(Date.parse(otherTime) - rightNow.getTime()) > MSECS_ALLOWED)\r\n return true;\r\n else\r\n return false;\r\n}", "isOffspring(vampire) {\n return this.offspring.includes(vampire);\n }" ]
[ "0.63156515", "0.59460473", "0.5745443", "0.5693015", "0.56757474", "0.55865324", "0.55576295", "0.5487151", "0.5472766", "0.54438704", "0.54003155", "0.5389266", "0.5375843", "0.53474784", "0.534482", "0.5264681", "0.5250081", "0.5219429", "0.52010095", "0.52005845", "0.51973635", "0.5184466", "0.5182896", "0.51562494", "0.5148885", "0.51470023", "0.51270646", "0.5106654", "0.5106654", "0.5078882", "0.5062541", "0.50574505", "0.5038786", "0.50387454", "0.50370914", "0.5023335", "0.49924964", "0.49568015", "0.49568015", "0.49558872", "0.49522045", "0.49384674", "0.49345812", "0.49345222", "0.49300647", "0.49248964", "0.4922586", "0.4918822", "0.49150446", "0.4909503", "0.48992237", "0.48951766", "0.48943296", "0.48852947", "0.487314", "0.48703444", "0.4867681", "0.48670167", "0.48637953", "0.48637953", "0.48632887", "0.48558018", "0.4839494", "0.48382777", "0.48234737", "0.48220956", "0.4809168", "0.4809168", "0.4809168", "0.48089868", "0.4806518", "0.4806518", "0.47945222", "0.4794161", "0.47940448", "0.4790149", "0.47811788", "0.4763952", "0.47592682", "0.47589532", "0.47452626", "0.47444904", "0.47420594", "0.47336346", "0.47264597", "0.47258472", "0.47198474", "0.47163892", "0.47109684", "0.47059944", "0.4705482", "0.47024962", "0.4701279", "0.46935967", "0.46916676", "0.4680287", "0.46746615", "0.4672763", "0.46629387", "0.46624908" ]
0.6629535
0
Exits the Spire after completing the specified cell.
function exitSpireCell() { if(isActiveSpireAT() && game.global.lastClearedCell >= getPageSetting('ExitSpireCell')-1) endSpire(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exitSpireCell() { \n if(game.global.world == 200 && game.global.spireActive && game.global.lastClearedCell >= getPageSetting('ExitSpireCell')-1) \n endSpire(); \n}", "function exit() {\r\n if (\r\n snake[0].x < 0 ||\r\n snake[0].x > boardSize - cellSize ||\r\n snake[0].y < 0 ||\r\n snake[0].y > boardSize - cellSize\r\n ) {\r\n window.alert(\"dead\");\r\n resetGlobal();\r\n location.reload();\r\n }\r\n}", "function clickOnCell() {\n const clickedCell = event.target;\n const clickedCellIndex = clickedCell.dataset.index;\n cellPlayed(clickedCell, clickedCellIndex);\n resultValidation();\n \n clickedCell.removeEventListener('click', clickOnCell);\n return;\n}", "BunnyAtExit() {\n if (this.UpdatePoppedEggCount()) {\n this.Complete();\n } else {\n ui.AlarmEggCount();\n ui.Tip(\"You haven't got all the eggs yet - go back in\");\n }\n }", "end(){\n this.request({\"component\":this.component,\"method\":\"end\",\"args\":[\"\"]})\n this.running = false\n }", "function fire() {\n let coordinates = getInputValue(); \n let cell = document.getElementsByClassName('row-' + coordinates[1] + ' col-' + coordinates[0]);\n console.log(cell);\n cell = cell[0];\n console.log(cell);\n if (cell.classList.contains('fired')) {\n alert(\"you have already fired on this cell\");\n return false;\n }\n if (cell.classList.contains('ship')) {\n cell.style.background = \"red\";\n cell.classList.remove('ship');\n cell.classList.add('sunk');\n toggleModal('hit', true);\n updateShipIndicators();\n checkWinCondition();\n } else {\n cell.style.background = \"grey\";\n toggleModal('miss', true);\n }\n cell.classList.add('fired')\n}", "doneEditingCell(element) {\n const cell = closest(element, CELL_SELECTOR);\n if (this._currentlyEditing === cell) {\n this.editing.next(null);\n }\n }", "function finalize()\r\n {\r\n $(\".cell\").css('cursor', 'default');\r\n $(\".turn\").css('visibility', 'hidden');\r\n gameOver = true;\r\n }", "function endgame(){\n $('#guess-box').prop('disabled', true)\n $('span.element').show();\n $('#element-list').show();\n $('.cell').not('.success').addClass('fail').removeClass('s d p f');\n }", "function cancelPress(cell) {\n if (gCellsLeft !== 0) {\n cell.draggable = false;\n setSmiley('def');\n }\n}", "function endGame() {\n console.log(\"BOOM\");\n console.log(\"GAME OVER\");\n renderAllCells(\"bomb-cell\");\n renderAllCells(\"isRevealed\");\n toggleBombPanel(\"hide\");\n}", "endGame() {\n\t\tfor (let i = 1; i < this.cell.length; i++) {\n\t\t\tif (this.x == this.cell[i].x && this.y == this.cell[i].y) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "endGame() {\n this.inProgress = false;\n this.currentPlayer = null;\n this.pendingChip = null;\n this.emit('game:end');\n this.type = null;\n if (this.debug) {\n this.columnHistory.length = 0;\n }\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "exit() {\n this.exit();\n }", "function cellClicked(elCell, i, j) {\n // doesn't let you click when game isn't active i.e when you win or get a game over\n if (!gGame.isOn) return;\n\n // starting timer on first click\n if (gFirstClicked === true) {\n // makes sure first click is not a bomb\n while (gBoard[i][j].isBomb) {\n init(gSize, gBombAmount);\n }\n // starts running the timer\n timer();\n\n gFirstClicked = false;\n }\n\n // stops user from unmarking a flagged cell\n if (gBoard[i][j].isFlagged) return;\n\n // In the case a hint was requested\n if (gIsHint) {\n hints(i, j); // displays the hint in this location\n gIsHint = false;\n elHintButton.style.removeProperty('background-color');\n return;\n }\n\n // when clicked an empty cell opens an expansion\n if (gBoard[i][j].neighBombs === EMPTY && !gBoard[i][j].isBomb) expandShown(gBoard, i, j);\n else revealCell(gBoard, i, j);\n\n // finishes game when bomb is clicked\n if (gBoard[i][j].isBomb) {\n var elBombs = document.querySelectorAll('.bomb.hide');\n for (let k = 0; k < elBombs.length; k++) {\n elBombs[k].classList.remove('hide');\n elBombs[k].innerHTML = BOMB;\n }\n gameOver(gBoard);\n }\n isWin(); // checks if game was won\n}", "function clearCell(x,y){}", "finish() {\n\t\tthis.IS_STARTED = false;\n\t}", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n }", "function endgame() {\n inquirer\n //ask if the user would like to continue via a y or n prompt \n .prompt({\n name: \"continue\",\n type: \"confirm\",\n message: \"Would you like to order more beans?\",\n })\n .then(function(answer) {\n // based on their answer, either run queryBeans function (i.e. start over) or end the connection and exit the app\n if (answer.continue === true) {\n queryBeans();\n }\n else{\n connection.end();\n return;\n }\n });\n }", "function finish() {\n\t if (!isIn) element.hide();\n\t reset();\n\t if (cb) cb.apply(element);\n\t }", "\"ClassBody:exit\"() {\n stack.pop();\n }", "endTease() {\r\n this.endScript();\r\n this.cycler.end();\r\n }", "function finish() {\n process.exit(0);\n }", "function finish() {\n// if (--finished == 0) {\n if (!isFinished) {\n isFinished = true;\n Physics.there.style(self.from.getContainerBodyId(), {\n opacity: 0\n });\n\n self.dfd.resolve();\n }\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "wait_AnimationEnd() {\n if (this.tmpPiece.parabolic.end == true) {\n this.unvalidateCells();\n this.check_GameOver();\n this.check_Reset();\n this.checkSelected();\n this.locked = true;\n }\n }", "function endGame(){\n gameOver = true;\n gameStarted = false;\n allEnemies = [];\n allFruit = [];\n pickedFruit = [];\n //displayResult();\n resultMessage();\n updateInfo();\n}", "terminating() {}", "function EndComputerGame(){\n flag=false;//set flag as a false value ** to be computer game **\n clearBox2();}", "die() {\n this.resetJump();\n this.setDirection(Constants.SKIER_DIRECTIONS.DEAD);\n }", "function secondCell(e) {\n //get position of the second icon\n secondPos = e.target.id.split('-');\n secondPos[0] = parseInt(secondPos[0]);\n secondPos[1] = parseInt(secondPos[1]);\n fireTreasure = true;\n countConsecutive = 0;\n\n \n for (let i = 1; i <= 8; i++) {\n for (let j = 1; j <= 8; j++) {\n if (document.getElementById(i+'-'+j).classList.contains('hints')) {\n document.getElementById(i+'-'+j).classList.remove('hints');\n }\n }\n }\n \n //This is the freeSwapItemHandler\n if (fireFreeSwap == true) {\n //add sound effects\n if (allowSound) { setTimeout(playFreeSwapUsed.play(), 120) };\n \n swap();\n autoCheck();\n\n //change cursor back to normal\n document.querySelector('.game-container').style.cursor = \"pointer\";\n \n let countFreeSwap = parseInt(document.getElementById('free-swap').textContent);\n countFreeSwap--;\n document.getElementById('free-swap').textContent = countFreeSwap;\n \n //add grey background if this item is unavailable\n if (document.getElementById('free-swap').textContent == 0) {\n document.querySelector('.free-swap-item').classList.add('unavailable-item');\n }\n \n fireFreeSwap = false;\n \n } else \n \n //This is basically the dynamiteBombsItemHandler\n if (firstPos[0] == secondPos[0] && firstPos[1] == secondPos[1] && fireDynamiteBombs == true) {\n //add sound effects\n if (allowSound) { setTimeout(playDynamiteBombsUsed.play(), 50) };\n \n for (let i = firstPos[0] - 2; i <= firstPos[0] + 2; i++) {\n for (let j = firstPos[1] - 2; j <= firstPos[1] + 2; j++) {\n if (i >= 1 && i <= 8 && j >= 1 && j <= 8) {\n arr[i][j] = 'removed'\n }\n }\n }\n autoCheck();\n autoCheck();//need to call autoCheck function again because I can't set 'check' to 'true'\n \n //change cursor back to normal\n document.querySelector('.game-container').style.cursor = \"pointer\";\n \n let countDynamiteBombs = parseInt(document.getElementById('dynamite-bombs').textContent);\n countDynamiteBombs--;\n document.getElementById('dynamite-bombs').textContent = countDynamiteBombs;\n \n //add grey background if this item is unavailable\n if (document.getElementById('dynamite-bombs').textContent == 0) {\n document.querySelector('.dynamite-bombs-item').classList.add('unavailable-item');\n }\n \n fireDynamiteBombs = false;\n \n } else\n \n //check if it's a valid move\n if (checkValidMove(firstPos, secondPos)) {\n countMoves++;\n moves.textContent = countMoves;\n //count down bombs moves after every swap\n for (let i = 1; i <= 8; i++) {\n for (let j = 1; j <= 8; j++) {\n if (arr[i][j] == 8) {\n let countdown = parseInt(document.getElementById(i+'-'+j+'-bomb').textContent);\n countdown--;\n document.getElementById(i+'-'+j+'-bomb').textContent = countdown;\n }\n }\n }\n \n //swap elements\n swap();\n //find combo and erase\n checkTwoPosition(firstPos, secondPos);\n \n } else {\n //alert invalid move!\n if (allowSound) { playInvalidMoveNoComboMove.play() };\n }\n \n\n //give a random item if consecutive >= 3\n setTimeout(() => {\n if (countConsecutive >= 4) {\n giveARandomItem();\n //alert('You won a random item')\n document.querySelector('.alert-won-item').style.display = 'block';\n setTimeout(() => {\n document.querySelector('.alert-won-item').style.display = 'none';\n }, 1500)\n }\n }, 300)\n \n //check if game is over\n setTimeout(() => {\n if (countLife <= 0) {\n endGame();\n } else if (findAllHints().length == 0 &&\n document.getElementById('bombs-cooler').textContent == 0 &&\n document.getElementById('treasure').textContent == 0 &&\n document.getElementById('shuffle').textContent == 0 &&\n document.getElementById('free-swap').textContent == 0 &&\n document.getElementById('dynamite-bombs').textContent == 0\n ) {\n resetGame();\n countLife--;\n document.getElementById('life').textContent = countLife;\n document.querySelector('.alert-won-item').style.display = 'block';\n document.querySelector('.alert-won-item').textContent = 'No More Move!';\n setTimeout(() => {\n document.querySelector('.alert-won-item').style.display = 'none';\n document.querySelector('.alert-won-item').textContent = 'You have just won an item!'\n }, 1500)\n }\n }, 700)\n \n //find out if there's any exploded bombs\n let i = 1;\n let gameOver = false;\n while (i <= 8 && !gameOver) {\n let j = 1;\n while (j <= 8 && !gameOver) {\n if (arr[i][j] == 8 && document.getElementById(i+'-'+j+'-bomb').textContent <= 0) {\n endGame();\n gameOver = true;\n }\n j++;\n }\n i++;\n }\n \n}", "halt() {\n if (this.continuing_) {\n this.completeContinue_(false);\n }\n }", "placeExit(x, y) {\n this.gameBoard[x][y].setType('exit');\n }", "function endGame() {\n verifyLine();\n verifyColumn();\n // verifyDiagonalUp();\n // verifyDiagonalDown();\n }", "onResponderTerminate() {\n this.resetMovingItem();\n // console.log(\"responder terminated\");\n }", "function aboutToPress(cell) {\n cell.draggable = false;\n setSmiley('o');\n}", "function endGame(pos) {\n $('#' + pos + \" .gauge-fill\").height(0);\n $('#' + pos + ' .icon').css(\"display\", \"none\");\n if(enlarged != \"\") {\n hideCurrGame();\n }\n delete activeArray[pos];\n onFire += 1;\n if(onFire == 5){\n onFireAction();\n }\n if(activeArray.length == 0){\n cleanSweepAction();\n }\n}", "function exit() {\n sensor.unexport();\n process.exit();\n}", "endGame() {\r\n setTimeout(function () {\r\n alert(currentEnnemy.name + ' a gagné. Cliquez sur OK pour relancer la partie'),\r\n window.location.reload()\r\n }, 200)\r\n }", "function complete(){\n clearInterval(timer);\n timer = null;\n}", "function clickCell(cell, player, computer, row, column){\n //If cell isn't already filled\n if(cell.className !== 'hit' && cell.className !== 'miss'){\n //Player 1's Turn\n //If ship hit\n if(hasShip(computer.grid, row, column)){\n cell.className = 'hit'\n cell.innerText = 'X'\n player.score++\n if(checkWinningPlayer(player)){\n return\n }\n } else{ //If ship NOT hit\n cell.className = 'miss'\n cell.innerText = '•'\n }\n \n //Computer's Turn\n output.innerText = \"Computer's Turn!\"\n //Added 1 second delay between player 1 and computer's turn\n let delayInMilliseconds = 1000; \n //\"Cover\" so that player can't click on computer grid when it's computer's turn\n let cover = document.getElementById('right-cover')\n cover.style.zIndex = -1\n cover.style.backgroundColor = 'rgba(156, 156, 156, 0.3)'\n setTimeout(function() {\n computerAttack(player, computer)\n output.innerText = \"Player 1's Turn!\"\n cover.style.zIndex = 1\n cover.style.backgroundColor = 'transparent'\n }, delayInMilliseconds);\n }\n}", "function exit() {\n // term`\\nDone!`\n process.exit()\n}", "function run() {\n // Check if we stopped in the middle of execution (likely due to the 5 minutes limit on google apps)\n var s = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = s.getSheetByName('Data');\n if(sheet.getRange(getFirstEmptyRow() - 1, getSheetTranslationIndex('WIP ROW')).getValue()==true){\n deleteRow(getFirstEmptyRow() - 1);\n }\n \n var match_history = findUniqueMatchIds();\n if(!match_history || match_history == 'exit') {\n return 'exit';\n }\n var result = populate(match_history);\n // indicates a partial entry so delete the most recent row\n if(result == 'exit') {\n deleteRow(getFirstEmptyRow() - 1);\n }\n}", "function endGame(win) {\n that.pause();\n running = false;\n if(win) {\n console.log(\"BOUT 2 ALERT\")\n alert(\"You've reached the highest score!\");\n console.log(\"DONE ALERTING\")\n } else {\n $(\"#ship\").height(0);\n drawBoard();\n alert(\"Looks like you got squashed. Game over!\");\n }\n submitTurk();\n }", "endCellEdit(cancelled = false) {\n if (!this._editingTd || this._editingTd.length == 0)\n return;\n var input = this._editingTd.data('input');\n var value = input.value;\n var row = this._editingTd.data('rowIndex');\n var col = this._editingTd.data('columnIndex');\n //log(\"endCell col: %s; row: %s; value: %s\", col, row, value)\n // Check if new row\n if (this._editingTd.parent().hasClass('insert-row')) {\n // If not cancelled, add another row\n if (cancelled !== true) {\n this._makeInsertRowCandidate();\n this._addInsertRow();\n }\n // Clears the value\n this.setValueAt(col, row, value);\n }\n else if (this._editingTd.parent().hasClass('insertable-row')) {\n this.setValueAt(col, row, value);\n }\n else {\n if (cancelled !== true) {\n this.setValueAt(col, row, value, true);\n }\n else {\n if (this.hasValueAt(col, row))\n this.setValueAt(col, row, this.getValueAt(col, row));\n }\n }\n if (!cancelled)\n this._editingTd.addClass('changeable-row');\n this._editingTd.data('input', null);\n this._editingTd.removeClass('editing');\n this._editingTd = null;\n }", "function continueExecution() {\n clearBoard();\n hero.positionAtHome();\n hero.setImage('normal');\n hero.setLives(hero.getLives()-1);\n hero.draw();\n isNextLife = true;\n }", "function end() {\n focusInput();\n updateInput = true;\n move(); up();\n }", "function end() {\n focusInput();\n updateInput = true;\n move(); up();\n }", "end() { }", "function quickCloseRow(row) {\r\n //console.log('Schedule quickclose ' + row);\r\n rowCloseTimers[row] = null;\r\n taskQueue.schedule(new CloseMatchTask(row, quickCloseReasonId));\r\n}", "remove(args) {\n\t\t//callback is going to remove the js cell anyways, so\n\t\targs.done();\n\t}", "escrowClosed() {\n $(\"#concludeEscrowResultSuccess\").show();\n\n addAlertElement(\"Escrow Closed successfully\",\"success\");\n\n // only visible to auctionhouse\n $(\"#destroyContractListElement\").show();\n }", "function endMoveStep (player, playerTarget, hasFire) {\n\t\tif (getCellType(board[player.y][player.x]) == CellType.Bomb) {\n\t\t\tif (playSound2) {\n\t\t\t\tbombSound.play();\n\t\t\t}\n\t\t\tendGame(false);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\n\t\tif (hasFire) {\n\t\t\tcheckPlayer1IceOrGlue();\n\t\t} else if (getCellType(board[player.y][player.x]) == CellType.Ice) {\n\t\t\tcalculatePlayerTargetPos(player, playerTarget, playerTarget.offsetX, \n\t\t\t\tplayerTarget.offsetY, player1.x, player1.y, SLIDE_STEPS_COUNT);\n\t\t}\n\t}", "function end(){\n return end;\n}", "function endCT(){\n // HERE ADD YOUR CODE\n \n return false;\n }", "endGame( curPlayer, curCellule ){\n\n if( curPlayer.curCellule != curCellule){\n console.log(\"heyeyyeye\")\n this.endTraj( curPlayer );\n\n curPlayer.addCellule(curCellule)\n }\n }", "exitWith_item(ctx) {\n\t}", "emergencyBreak() {\n this.node.report(\"item processor for item: \" + this.itemId + \" from parcel: \" + this.parcelId +\n \" :: emergencyBreak, state \" + this.processingState.val + \" itemState: \" + this.record.state.val,\n VerboseLevel.BASE);\n\n let doRollback = !this.processingState.isDone;\n\n this.processingState = ItemProcessingState.EMERGENCY_BREAK;\n\n this.stopDownloader();\n this.stopPoller();\n this.stopConsensusReceivedChecker();\n\n for (let ri of this.resyncingItems.values())\n if (!ri.isCommitFinished())\n ri.closeByTimeout();\n\n if (doRollback)\n this.rollback();\n else\n this.close();\n\n this.processingState = ItemProcessingState.FINISHED;\n }", "function uncompleteTask(row)\n{\n // grab the specific parts of the row I need\n // again - look into multiple assignment to see if I can shorten this code\n const taskNameBox = getNameBox(row);\n // remove \"completed\" class\n // removes the strikethrough\n taskNameBox.removeClass(\"completed\");\n // update the task's done value in the DOM\n const taskID = getSavedTaskID(row);\n const tasks = $(\"body\").data(\"tasks\");\n const task = tasks.active[taskID];\n task.done = 0;\n}", "function fReturn(result) {\n \tif(result != null){\n \t\tclickedCell.text(result);\n \t\tthis.edited = true;\n \t}\n }", "removeItem(x,y) { this.getCell(x,y)._mapItem = null; }", "exitCommandEnd(ctx) {\n\t}", "function end() {\n stopTime();\n promptText.innerText = \"Test Complete\";\n pegDisplay.classList.add(\"gone\");\n homeButton.classList.remove(\"gone\");\n resultsButton.classList.remove(\"gone\");\n}", "function complete(){\r\n clearInterval(timer);\r\n timer = null;\r\n}", "function runCellAndSelectBelow(_) {\n _.selectedCell.execute(function () {\n return selectNextCell(_);\n });\n return false;\n }", "async end() {\n return;\n }", "finish() {}", "end() {\n process.exit();\n }", "function killAdjacentCells(row, col){\n var cellValue = getGridCellDev(updatePlayerGridDev, row, col);\n // killing a key reduces the number of keys\n if(cellValue === KEY_CELL_DEV){\n numKeysDev--;\n if (numKeysDev === 0 && currentMutedState() !== true && unlockAudioPlayed !== true) {\n unlockedAudio.play();\n unlockAudioPlayed = false;\n }\n }\n setGridCellDev(updatePlayerGridDev, row, col, DEAD_CELL_DEV);\n setGridCellDev(renderPlayerGridDev, row, col, DEAD_CELL_DEV);\n // DEPENDING ON THE TYPE OF CELL IT IS WE'LL CHECK\n // DIFFERENT ADJACENT CELLS\n var cellType = determineCellTypeDev(row, col);\n var cellsToCheck = cellLookupDev[cellType];\n for (var counter = 0; counter < (cellsToCheck.numNeighbors * 2); counter+=2)\n {\n var neighborCol = col + cellsToCheck.cellValues[counter];\n var neighborRow = row + cellsToCheck.cellValues[counter+1];\n var neighborValue = getGridCellDev(updatePlayerGridDev, neighborRow, neighborCol);\n if (neighborValue === cellValue) {\n // Neighbor cell value is of the same type, so kill that cell too\n killAdjacentCells(neighborRow, neighborCol); // RECURSIVE CALL TO KILL CHAINED POWERUP CELLS\n }\n }\n}", "function cancel() {\n gotoReturnState();\n }", "function quit() {\n log.info('Exiting now.');\n process.nextTick(process.exit);\n }", "function autoReveal(cell) {\n var cellCoord = getCellCoord(cell.id);\n var cellI = cellCoord.i;\n var cellJ = cellCoord.j;\n recReveal(cellI,cellJ);\n\n function recReveal(i,j) {\n if(isOutOfBounds(i, j) || isFilled(i, j)){\n return;\n }\n var tdCell = document.querySelector('#cell-' + i + '-' +j);\n revealCell(tdCell);\n if (gBoard[i][j].contain === 'empty') {\n recReveal(i - 1,j);\n recReveal(i,j + 1);\n recReveal(i + 1,j);\n recReveal(i,j - 1);\n }\n }\n}", "function C007_LunchBreak_Natalie_NatalieEscape() {\r\n ActorRemoveInventory(\"Rope\");\r\n C007_LunchBreak_Natalie_IsRoped = false;\r\n}", "cellWillUnload() {\n\n }", "async finishEditing() {\n const {\n editorContext\n } = this;\n let result = false;\n\n if (editorContext) {\n const {\n column\n } = editorContext; // If completeEdit finds that the editor context has a finalize method in it,\n // it will *await* the completion of that method before completing the edit\n // so we must await completeEdit.\n // We can override that finalize method by passing the column's own finalizeCellEdit.\n\n result = await editorContext.editor.completeEdit(column.bindCallback(column.finalizeCellEdit));\n }\n\n return result;\n }", "function brushend() {\n\t\t\t\t\t\tif (brush.empty())\n\t\t\t\t\t\t\tsvg.selectAll(\".cell circle\").attr(\"class\",\n\t\t\t\t\t\t\t\t\tfunction(d) {\n\t\t\t\t\t\t\t\t\t\treturn color_class(d);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t}", "exitA91(ctx) {\n\t}", "function endgame() {\n $(\"flee-btn\").classList.add(\"hidden\");\n $(\"endgame\").classList.add(\"hidden\");\n $(\"their-card\").classList.add(\"hidden\");\n $(\"pokedex-view\").classList.remove(\"hidden\");\n qs(\"#my-card .buffs\").classList.add(\"hidden\");\n qs(\"#my-card .health-bar\").style.width = \"100%\";\n qs(\"#my-card .hp\").innerHTML = pokeHP + \"HP\";\n $(\"results-container\").classList.add(\"hidden\");\n $(\"p1-turn-results\").classList.add(\"hidden\");\n $(\"title\").innerHTML = \"Your Pokedex\";\n $(\"start-btn\").classList.remove(\"hidden\");\n }", "function endHijack() {\n\thijack = false;\n\tpromptPos = 0;\n}", "function end() {\n process.exit(0);\n}", "function onExit(err) {\n console.log('ending')\n board.close()\n process.removeAllListeners()\n process.exit()\n if (typeof err != 'undefined')\n console.log(err)\n}", "function endGame() {\n $('.home').css({ 'margin-top': '0px' });\n disappear('.instructions');\n hide('.view-button');\n disappear('.follow-circle');\n disappear('.instructions');\n state = \"view\";\n }", "finish() {\n this.done = true;\n }", "function leaveEditState() {\n var row = $(this);\n var quantityCell = row.children('td.quantity');\n quantityCell.empty().text(quantityCell.attr('data-value'));\n }", "function quit() {\n\tclearInterval(xInterval);\n}", "onEditorFocusOut(event) {\n const me = this,\n {\n grid\n } = me; // If the editor is not losing focus as a result of its tidying up process\n // And focus is moving to outside of the grid, or back to the initiating cell\n // (which indicates a click on empty space below rows), then explicitly terminate.\n\n if (me.editorContext && !me.editor.isFinishing && me.editor.inputField.owns(event.target) && (event.toWidget !== grid || grid.isLocationEqual(me.grid.focusedCell, me.editorContext.selector))) {\n if (me.blurAction === 'cancel') {\n me.cancelEditing();\n } else {\n me.finishEditing();\n }\n }\n }", "function tryAgain() {\n character.say(\"Uh...\");\n var tryAgain = Scene.createTextBillboard(0, 5, 3);\n tryAgain.setText(\"Try Again\");\n tryAgain.onActivate(function() {\n tryAgain.deleteFromScene();\n newLine();\n })\n }", "function exit(door) {\n let verticalOffset = 1;\n\n if (door === \"U\" || door === \"D\") verticalOffset = lj.realm.getSize();\n\n currentRoom = currentRoom + roomModifier[door] * verticalOffset;\n\n lj.realm.enterRoom(currentRoom);\n\n // Fade scene\n\n // When exiting hero is also entering the next room (or realm)\n enter(oppositeDoor(door));\n }", "exitMacro(ctx) {\n\t}", "exitSubscript(ctx) {\n\t}", "function endGame() {\n resetMainContainer();\n loadTemplate(\"result\", displayResults);\n}" ]
[ "0.6708773", "0.59724855", "0.5608793", "0.55897707", "0.5581135", "0.5578321", "0.5554778", "0.5473993", "0.5440729", "0.5413619", "0.53994715", "0.5396247", "0.5391786", "0.5362772", "0.53435344", "0.53435344", "0.53435344", "0.53435344", "0.5325293", "0.5319718", "0.5313416", "0.53027153", "0.52786165", "0.52786165", "0.5277795", "0.5245002", "0.5237383", "0.5223805", "0.52149576", "0.51952296", "0.519508", "0.519508", "0.519508", "0.519508", "0.51762134", "0.51742977", "0.51276976", "0.511478", "0.51100373", "0.51013887", "0.50988257", "0.5088845", "0.50864", "0.50823164", "0.5080376", "0.50725", "0.5057412", "0.5054328", "0.50350755", "0.50270456", "0.50226474", "0.5002795", "0.49964756", "0.49745578", "0.49698552", "0.49604318", "0.49604318", "0.4956975", "0.4948012", "0.49456555", "0.49396008", "0.49346757", "0.49245226", "0.4923597", "0.49206686", "0.49109343", "0.49106485", "0.49077368", "0.49075246", "0.49069124", "0.49001983", "0.48981684", "0.48966217", "0.48914266", "0.4888864", "0.48814148", "0.48792425", "0.48775077", "0.48725542", "0.4861142", "0.48602173", "0.48602143", "0.48599136", "0.48574406", "0.48562986", "0.48526362", "0.48508105", "0.48499948", "0.48473012", "0.4839124", "0.48381418", "0.48361212", "0.483548", "0.48348042", "0.48304912", "0.48296106", "0.48294923", "0.48273316", "0.48229995", "0.4818957" ]
0.717676
0
save info to firebase
function saveContactInfo(name, email, message) { let newContactInfo = contactInfo.push(); newContactInfo.set({ name: name, email: email, message: message, }); retrieveInfos(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveToDB(book) {\n\tlet firebaseID = firebaseRef.push({\n\t\ttitle: book.title,\n\t\tauthor: book.author,\n\t\tpages: book.pages,\n\t\tread: book.read,\n\t}).key;\n\tbook.firebaseKey = firebaseID; // Add Firebase Key to object to be able to find and upd items on firebase\n}", "function sendToFirebase() {\n dataRef.ref().push({\n\n trainName: trainName,\n destination: destination,\n firstTime: firstTime,\n frequency: frequency,\n tMinutesTillTrain: tMinutesTillTrain,\n nextTrainTime: nextTrainTime,\n dateAdded: firebase.database.ServerValue.TIMESTAMP\n });\n }", "function writeToFirebase(){\n //get fields\n let nameLocation = document.querySelector('#nameLocation').value; //input field\n let typeLocation = document.querySelector('#typeLocation').value; //select field\n let descLocation = document.querySelector('#descLocation').value; //input field\n let lngLocation = document.querySelector('#longitude').value; //input longitude\n let latLocation = document.querySelector('#latitude').value; //input latitude\n \n if(!utils.checkLongitude(lngLocation)){\n alert(\"Invalid longitude value.\");\n return;\n }\n if(!utils.checkLatitude(latLocation)){\n alert(\"Invalid latitude value.\");\n return;\n }\n \n //call write function of firebase\n fb.write('public', nameLocation, descLocation, typeLocation, lngLocation, latLocation); //params - auth, title, desc, type, long, lat\n}", "handleSave() {\n let curr = this.state.curr;\n\n let savedRef = firebase.database().ref('saved').child(this.props.user.uid);\n let res = {\n location: this.state.location,\n rating: curr.rating,\n price: curr.price,\n image: curr.image_url,\n url: curr.url\n }\n savedRef.child(curr.name).set(res);\n }", "function saveDetails(email, phone, points, payment, lname, fname, nickname, bday){\r\n var newUsersRef = usersRef.push();\r\n newUsersRef.set({\r\n email: email,\r\n phone: phone,\r\n points: points,\r\n payment: payment,\r\n\tlname : lname,\r\n\tfname : fname,\r\n\tnickname : nickname,\r\n\tbday : bday\r\n });\r\n}", "save(callback) {\n //console.log('DEBUG: Banner.save() this=', this);\n \n // Note: We are using this.name (e.g. tickets) instead of null for a new id from Firebase\n myFirebase.writeToFirebase(myFirebase.firebaseRef,\n 'banner',\n 'banner',\n this.toObj())\n .then((id) => {\n //Success\n callback(null, \"Banner Saved!\");\n }, (e) => {\n // Error\n callback(e);\n });\n }", "function storeJSON() {\n //delete database\n firebase.database().ref().remove();\n \n //store new data in database\n firebase.database().ref().set({\n user_JSON: user_JSON\n });\n}", "function saveMessage(userId, fstName, lstName, phone, currency){\n firebase.database().ref('Users/' + userId).set({\n firstName: fstName,\n lastName: lstName,\n phone: phone,\n currency: currency\n });\n\n console.log(\"Sent\");\n\n}", "function saveData() {\n var user = firebase.auth().currentUser;\n var curDate = new Date();\n var curTime = curDate.getTime();\n var userID = user.uid;\n\n var docData = {\n lat: latData,\n lon: lonData,\n timeStamp: curTime\n };\n\n db.collection(userID + ' tracking').doc(curTime.toString()).set(docData);\n }", "function writeData(){ \r\n var name= document.getElementById(\"Name\").value\r\n firebase.database().ref(`Students/${name}`).set({\r\n pretest: evolutionPretest(),\r\n explain1: document.getElementById(\"explain1\").value\r\n })\r\n .then(function(){\r\n alert('Submitted!');\r\n });\r\n }", "function saveData() {\n firebase.database().ref('users/' + uid + '/drafts').set(JSON.stringify(draftData));\n console.log('Data saved', draftData);\n}", "function writeNewData(value, phone, imageurl) {\n var newPhoneRef = firebase.database().ref('newphone/');\n newPhoneRef.set({\n current: 1,\n phone: phone,\n imageurl: imageurl\n })\n\n var pushRef = firebase.database().ref('update/').push();\n pushRef.set({\n updated: value,\n phone: phone,\n imageurl: imageurl\n }).then(() => {\n //console.log('write success');\n }).catch(err => {\n console.log('error :' + err);\n });\n}", "function writeCatData(formId, name, email ) {\n firebase.database().ref('newsletters/' + formId).set({\n name : name,\n email : email\n });\n }", "function writeToDb( emailw,namew ,reg_now, uid,val){\nvar dataToPut = {\n email : emailw,\n name : namew,\n regno : reg_now,\n uid : uid\n };\n firebase.database().ref(val+'/' + uid).set(dataToPut).then(function() {\n window.location.href = \"login.html\";\n });;\n}", "function pushValues() {\n // extracting the values of input\n var name = document.getElementsByClassName(\"name\")[0].value;\n var phone = document.getElementsByClassName(\"phone\")[0].value;\n var slipNumber = document.getElementsByClassName(\"slipNumber\")[0].value;\n var carNumber = document.getElementsByClassName(\"carNumber\")[0].value;\n var carModel = document.getElementsByClassName(\"carModel\")[0].value;\n\n\n firebase.database().ref(x).set({\n name: name,\n phone: phone,\n parkingSlip: slipNumber,\n carNumber: carNumber,\n carModel: carModel\n });\n console.log(x);\n }", "function WriteUserToDB() {\n var newRef;\n switch (mode) {\n case 1:\n newRef = ref.push({\n phonenumber: \"\",\n id: \"\",\n email_address: user.email_address,\n email: user.email,\n sms: user.sms,\n whatsapp: user.whatsapp,\n setting_key: settingkey2,\n });\n break;\n case 2:\n newRef = ref.push({\n phonenumber: user.phonenumber,\n id: \"\",\n email_address: \"\",\n email: 0,\n sms: user.sms,\n whatsapp: user.whatsapp,\n setting_key: settingkey2,\n });\n break;\n }\n // Add Key to Entry\n var newID = newRef.key;\n newRef.update({\n id: newID\n })\n }", "function writeData(Head, details) {\n firebase.database().ref(Head).set({ details });\n }", "function save() {\r\n var site_name = document.getElementById(\"site_Name\").value;\r\n dev_name = document.getElementById(\"dev_Name\").value;\r\n var test_num = document.getElementById(\"try_num\").value;\r\n var language = document.getElementById(\"language\").value;\r\n\r\n database.ref('test/' + dev_name).set({\r\n siteName : site_name,\r\n developer : dev_name,\r\n testNumber : test_num,\r\n lSitLanguage : language\r\n });\r\n\r\n alert('saved');\r\n }", "function writeUserData(date, meal, location, food) {\n firebase.database().ref(`masterData`).push().set({\n date : date,\n meal : meal,\n location : location,\n food : food\n });\n document.write(\"Successfully wrote \" + food + \" to master db\")\n}", "save()\n\t{\n\t\tdatabase.ref('Users/' + this.#id).set({\n\t\t\tname : this.#name,\n\t\t\tsurname : this.#surname,\n\t\t\tnickname : this.#nickname,\n\t\t\temail: this.#email\n\t\t});\n\t}", "function pushData(){\n database.ref('bets/').push({\n Name: betName,\n Friends: addFriends,\n Bet: gameBet,\n Wager: numberOfSlaps,\n dateAdded: firebase.database.ServerValue.TIMESTAMP\n });\n}", "function save(name, company, email, phone, message){\n let newInfo = info.push(); \n \n newInfo.set({\n name,\n company,\n email,\n phone,\n message\n })\n}", "function insertData() {\n set(ref(db, \"Students/\" + usn.value), {\n Name: name.value,\n Age: age.value,\n USN: usn.value\n })\n .then(() => {\n alert(\"Data stored successfully \");\n })\n .catch((err) => {\n alert(\"Unsuccessfull \");\n })\n }", "static async saveObject(key, value) {\n await FirebaseUtils.addUpdateCommand(getUserRefKeyOnFirebase() + \"/keys/\" + key, value);\n }", "function saveWarehouse(userAccount, whAddress, whName) {\n firebase.database().ref('users/' + userAccount + '/warehouse').push({\n address: whAddress\n });\n}", "saveUserSignup(){\n const {promotion} = this.state;\n const now = new Date();\n const userSignup = {\n status : 0,\n createdAtTime : now.getTime(),\n createdAt : dateFormat(now, constants.formatDate),\n }\n\n firabaseDB.child('users').child(this.props.user.uid).child('signups')\n .child(promotion.key).set(userSignup)\n .then((snap) => \n {\n userSignup.promotion = promotion.key;\n userSignup.user = this.props.user.uid;\n this.saveCampaignSignup(userSignup);\n })\n }", "function storeDataInFirebase() {\r\n var FirstName = $(\"#fname\").val();\r\n var Email = $(\"#email\").val();\r\n var Phone = $(\"#phone\").val();\r\n var Registration_Number = $(\"#reg\").val();\r\n var Age_Above_Sixteen = !document.getElementById(\"age1\").checked;\r\n\r\n\t\r\n\tvar image = document.getElementById(\"fileUpload\").files[0];\r\n\tconsole.log(image);\r\n\tvar imageName = image.name;\r\n\tvar storageRef = storage.ref(\"/images/\" + imageName);\r\n\tvar uploadTask = storageRef.put(pic);\r\n\r\n db.collection(\"users\")\r\n .doc()\r\n .set({\r\n FirstName: FirstName,\r\n Email: Email,\r\n Phone: Phone,\r\n Registration_Number: Registration_Number,\r\n Age_Above_Sixteen: Age_Above_Sixteen,\r\n })\r\n\r\n .then(() => {\r\n\t\tImageSelection();\r\n\t\tuploadTask.snapshot.ref.getDownloadURL().then(\r\n\t\t\tfunction(downloadURL) {\r\n\t\t console.log(downloadURL);\r\n\t\t}).catch(err => console.log(err));\r\n\r\n console.log(\"document written successfully\");\r\n\t\tdocument.cookie = \"name=\" + FirstName;\r\n\t\tdocument.cookie = \"email=\" + Email;\r\n\t var date = new Date();\r\n\t\tdate.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));\r\n\t\tdocument.cookie = \"expires=\" + date + \";\"\r\n $(\".loader\").hide();\r\n window.location.href = \"thankyouPage.html\";\r\n $(\"#memoForm\").trigger(\"reset\");\r\n })\r\n .catch((error) => {\r\n console.error(\"Error writing document: \", error);\r\n });\r\n }", "function fireBaseSaveFormData(markerData) {\n // get marker structure object.\n var copy = copyMarkerDataValues(markerData);\n\n var saveUpdate;\n\n if (copy.id) {\n saveUpdate = database.ref('markers/' + copy.id);\n\n // deleting id if it exists\n // because we don't want to have it as a reference in scheme\n delete copy.id;\n } else {\n saveUpdate = database.ref('markers').push();\n }\n\n\n // updating or adding post in firebase\n saveUpdate.set(copy, afterUpdateAddMarkerItem);\n }", "function storeNewStudent(id, longintude, latitude) {\n firebase.database().ref('students/' + id).set({\n Longintude: longintude,\n Latitude: latitude\n }, function (error) {\n if (error) {\n // The write failed...\n alert('Loi')\n } else {\n // Data saved successfully!\n alert('Thanh cong!!!')\n }\n });\n }", "function saveTempDataToFirebase(data) {\n db.ref('sensordatatemp/').push({\n mmac: ESP32USERS_ARRAY.indexOf(clientID), //You could add an ekstra variable to every dataFromBoard transmission with a microcontrollerID to lessen the need for authentication\n data: data, //This would be the sensor data, eg a temperature datapoint\n ip_address: IPArr[3] //What is the IP-address of the unit that logged the data\n }).then((snap) => { //When the data has been successfully saved\n console.log(\"Sensordata was saved\");\n });\n }", "updatePersonalInfo({commit}, {name, age, location, bio}) {\n let userid = firebase.auth().currentUser.uid\n let path = '/users/' + userid + '/profile/personal'\n\n let personal = {name, age, location, bio}\n\n firebase.database().ref(path).set(personal).then(() => {\n commit('setPersonal', personal)\n }).catch((error) => {\n //ERROR handling\n console.log('Error: setPersonal() - ' + error)\n })\n }", "function guardaDatos(user){\r\n\tvar usuario = {\r\n\t\tuid:user.uid,\r\n\t\tnombre:user.displayName,\r\n\t\t email:user.email,\r\n\t\t foto:user.photoURL\r\n\t}\r\n\tfirebase.database().ref(\"telmex/\"+ user.uid)\r\n\t.set(usuario)\r\n}", "function storeTrain() {\n database.ref(\"trains/\").push( {\n tName : trainName,\n tDest : trainDestination,\n tFirstTime : firstTrainTime,\n tFrequency : trainFrequency,\n dateAdded : firebase.database.ServerValue.TIMESTAMP\n })\n //Empties all the fields after pressing submit\n $(\".train-form-input\").val(\"\");\n}", "function addBookToAvaBooks(data){\n firebase.database().ref(\"availableBooks\").push().set(data)\n .then(()=>{\n console.log(\"success\")\n })\n .catch((error)=>console.log(\"error\",error.message))\n}", "function writeUserData(Firstname, Surname, email, dob, height, weight){\n\n var userId = firebase.auth().currentUser.uid;\n\n console.log(userId);\n\n database.ref().child('users/' + userId + '/AccountInfo').set({\n Firstname: Firstname,\n Surname: Surname,\n email:email,\n dob: dob,\n height: height,\n weight: weight\n });\n}", "function guardaDatos(user){\n var usuario = {\n uid:user.uid, \n nombre:user.displayName,\n email:user.email,\n foto:user.photoURL\n }\n firebase.database().ref(\"ramaPruebaJquery/\" + user.uid)\n //add data\n //.push(usuario)\n .set(usuario)\n }", "function writeUserData(unixdate,link,venue,title,pushmeetuserArr){\n var taskType = \"Duties\";\n var newTaskKey = firebase.database().ref().child('Alerts/Core/').push().key;\n firebase.database().ref('Alerts/Core/' + newTaskKey).set({\n id: newTaskKey,\n time: unixdate,\n title: title,\n location: venue, \n link: link,\n type: taskType,\n users: pushmeetuserArr\n });\n\n firebase.database().ref('Home/Notification/' + newTaskKey).set({\n id: newTaskKey,\n time: unixdate,\n title: title,\n location: venue, \n link: link,\n type: taskType,\n users: pushmeetuserArr\n });\n sendNotif();\n // alert(\"Task Posted\"); \n // window.location.reload(); \n}", "function writeUserData(userId, name, email, imageUrl){\n firebase.database().ref('users/' + userId).set({\n name: name,\n email: email,\n picture: imageUrl,\n });\n}", "function insertfb(pumpstate){\n console.log(pumpstate);\n firebase.database().ref(uid+\"/sensor/pump\").set(pumpstate);\n}", "function DB_Winner_Write(won) {\n firebase.database().ref(\"winner\").push({won:won});\n}", "function guardarDatos(user){\n var usuario ={\n uid:user.uid,\n nombre:user.displayName,\n email:user.email,\n foto:user.photoURL\n } \n firebase.database().ref(\"usuarios/\" + user.uid).set(usuario)\n}", "syncWithFirebase(){\n let userId = firebase.auth().currentUser.uid;\n firebase.database().ref('users/' + userId).update(JSON.parse(this.webStorage.getItem(userId)));\n }", "onComplete(survey, options) {\n //Write survey results into database\n/* const db = firebase.firestore();\n\n if(localStorage.getItem(\"user\")){\n db.collection(\"users\").doc(localStorage.getItem(\"user\")).set({\n survey: JSON.stringify(survey.data)\n }).then((docRef) => {\n console.log(\"success adding\")\n })\n .catch((error) => {\n console.error(\"Error adding user: \", error);\n });\n ;\n }*/\n }", "function writeUserData(userId, name, email, imageUrl) {\n firebase.database().ref('users/' + userId).set({\n username: name,\n email: email,\n profile_picture : imageUrl\n }).then(() =>\n firebase.database().ref('logins').push().set({\n userId: userId,\n email: email,\n logindate : Date()\n }) \n );\n }", "function guardarPedido3() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: Precio,\n Medida: medida,\n NombreProducto: NombreJabonManos.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonManos.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function guardarPedido() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioSuavisante1,\n Medida: medida,\n NombreProducto: NombreSuavisante1.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadSuavisante1.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function saveMessage(name, email, boulderName, grade, location, date, details){\n var newMessageRef = messagesRef.push();\n newMessageRef.set({\n name: name,\n email: email,\n boulderName: boulderName,\n grade: grade,\n location: location,\n date: date,\n details: details,\n\n });\n\n}", "function guardarPedido5() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonRey,\n Medida: medida,\n NombreProducto: NombreJabonRey.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonRey.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "static saveUserProfile(uid) {\n // Updates the values in the firebase database\n console.log(\"Here with uid: \" + uid)\n firebase.database().ref(\"users/\" + uid).update({ \n name : sessionStorage.getItem('userName'),\n favoriteMovies : [],\n isAdmin : sessionStorage.getItem('isAdmin')}, function(error) {\n if(error) {\n alert(\"There was an issue saving some of your information\")\n } else {\n window.location.replace(\"index.html\"); \n }\n })\n \n }", "function writeSPData(userId, name, tel, email, address, ic, pwd) {\n firebase.database().ref('spPrivate/' + userId).set({\n \n fullName: name,\n phone: tel,\n email: email,\n address: address,\n icNumber: ic,\n password : pwd,\n role: \"serviceProvider\"\n })\n .then (function() {\n console.log(\"SP Information Saved in database:\", userId, email);\n })\n .catch(function(error) {\n console.log(\"Error writing SP data: \", error);\n });\n}", "function guardarPedido6() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonLavadora,\n Medida: medida,\n NombreProducto: NombreJabonLavadora.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonLavadora.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function saveMessage(type,name,age,sex,bloodGroup,state,district,email, phone,address){\r\n\r\n var newMessageRef = messagesRef.push();\r\n newMessageRef.set({\r\n type:type,\r\n name: name,\r\n age:age,\r\n sex:sex,\r\n bloodGroup:bloodGroup,\r\n state:state,\r\n district:district,\r\n email:email,\r\n phone:phone,\r\n address:address\r\n });\r\n\r\n // firebasenew.initializeApp(firebaseConfig2);\r\n \r\n // Reference messages collection\r\n var messagesReftweets = firebase.database().ref('tweets');\r\n\r\n var msg= \"@BloodAid @BloodDonorsIn Urgent need of \"+bloodGroup+\" plasma for\"+\" Patient-\"+name +\" \"+sex+\" \"+age+\" \"+\" at \"+\" \"+district+\" \"+state+\" Contact: \"+phone +\" \"+email+\" at \"+address\r\n \r\n datatweet={\r\n message:msg,\r\n type:\"plasma request\",\r\n tweetstatus:\"0\"\r\n }\r\n messagesReftweets.push(datatweet)\r\n\r\n results() ;\r\n // patient_mail_sending(name,age,sex,bloodGroup,state,district,email, phone,address);\r\n }", "function guardarPedido2() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: Precio,\n Medida: medida,\n NombreProducto: NombreAmbientador.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadAmbientador.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function writeUserData(age, email, username, name) {\n firebase\n .database()\n .ref('users')\n .child(username)\n .set({\n name: name,\n email: email,\n age: age\n },\n function(error) {\n if (error) {\n console.log(\"Data could not be saved.\" + error);\n } else {\n console.log(\"Data saved successfully.\");\n }\n })\n // .push({\n // name: name,\n // email: email,\n // age: age\n // },\n // function(error) {\n // if (error) {\n // console.log(\"Data could not be saved.\" + error);\n // } else {\n // console.log(\"Data saved successfully.\");\n // }\n // })\n}", "function onSaveClicked(){\n date=document.getElementById(\"datepicker\").value;\n time=document.getElementById(\"timepicker\").value;\n aType=document.getElementById(\"a_type\").value; \n doctor=document.getElementById(\"doctor\").value;\n\n\n var edited_appointment = ref.child(key)\n if(validation()){\n edited_appointment.child(\"Date\").set(date);\n edited_appointment.child(\"Time\").set(time);\n edited_appointment.child(\"Appointment_Type\").set(aType);\n edited_appointment.child(\"Doctor\").set(doctor);\n edited_appointment.child(\"Appointment_Status\").set(\"Not Approved\");\n\n closeEditForm();\n window.alert(\"Saved! Please wait for approval.\");\n window.location.reload();\n }\n \n}", "function saveContactInfo(name, email, message) {\n contactInfo.collection(\"users\").add({\n name:name,\n email:email,\n message:message,\n });}", "function guardarPedido4() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonRopaColor,\n Medida: medida,\n NombreProducto: NombreJabonRopaColor.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonRopaColor.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function saveMessage(Firstname, Surname, email, dob, height, weight){\n var newAccountsRef = accountsRef .push();\n newAccountsRef .set({\n Firstname: Firstname,\n Surname: Surname,\n email:email,\n dob: dob,\n height: height,\n weight: weight\n });\n\n\n\n // Get the single most recent from the database and\n// update the table with its values. This is called every time the child_added\n// event is triggered on the Firebase reference, which means\n// that this will update EVEN IF you don't refresh the page. Magic.\naccountsRef.limitToLast(1).on('child_added', function(childSnapshot) {\n // Get the data from the most recent snapshot of data\n // added to the list in Firebase\n accountInfo = childSnapshot.val();\n\n // Update the HTML to display the text\n $(\"#Firstname\").html(accountInfo.Firstname)\n $(\"#Surname\").html(accountInfo.Surname)\n $(\"#email\").html(accountInfo.email)\n $(\"#DOB\").html(accountInfo.dob)\n $(\"#Height\").html(accountInfo.height)\n $(\"#Weight\").html(accountInfo.weight)\n\n});\n\n\n}", "writeordersCompleted(uid,uemail,id){\n\n // A post entry.\n var postData = {\n orderid: id,\n email: uemail\n };\n\n // Get a key for a new Post.\n var newPostKey = firebase.database().ref().child('ordersCompleted').push().key;\n\n // Write the new post's data simultaneously in the posts list and the user's post list.\n var updates = {};\n\n updates['OrdersCompleted/' + uid + newPostKey] = postData;\n\n firebase.database().ref().update(updates);\n\n\n}", "function saveUserBtnClicked() {\n const entryID = document.querySelector(\".edit-entryid\").value;\n const entryRef = dbRef.child('foodlog/' + entryID);\n var editedEntryObject = {}\n const editInputsUI = document.querySelectorAll(\".edit-user-input\");\n editInputsUI.forEach(function(textField) {\n let key = textField.getAttribute(\"data-key\");\n let value = textField.value;\n editedEntryObject[textField.getAttribute(\"data-key\")] = textField.value\n });\n entryRef.update(editedEntryObject, function(){\n location.reload();\n console.log(\"entry has been updated\");\n\n });\n}", "function saveMessage(color, rng1, rng2, limit){\n\n var database = firebase.database();\n var newMessageRef = messagesRef.push();\n\nfirebase.database().ref('User Settings').update({\n color: color,\n rng1:rng1,\n rng2:rng2,\n limit:limit\n \n\n});\n\n\n}", "function saveMessage(name,email,phone,track){\r\n var newMessageRef= messagesRef.push();\r\n newMessageRef.set({\r\n name: name,\r\n email: email,\r\n phone: phone,\r\n track: track } );\r\n}", "function saveMessage(appid,name,dob,gname,prclass,schooltype,bsid,regID,meet){\r\n /*\r\n var newMessageRef = messagesRef.push();\r\n MessageRef.set({\r\n */\r\n firebase.database().ref('vtoix2023/' + appid).update({\r\nappid:appid.toString(),\r\nname:name,\r\ndob:dob,\r\ngname:gname,\r\nprclass:prclass,\r\nschooltype:schooltype,\r\nbsid:bsid,\r\nregID:regID,\r\nacyear:\"2023\",\r\nmeet:meet\r\n });\r\n}", "function saveProfile(email, name, password, weight, height,gender,planName,bicepWorkout,tricepWorkout,chestWorkout,lBackWorkout,uBackWorkout,shoulderWorkout,trapWorkout,coreWorkout){\n var newProgramRef = programRef.push();\n newProgramRef.set({\n email: email,\n name: name,\n password: password,\n weight: weight,\n height: height,\n gender: gender,\n planName: planName,\n bicepWorkout: bicepWorkout,\n tricepWorkout: tricepWorkout,\n chestWorkout: chestWorkout,\n lBackWorkout: lBackWorkout,\n uBackWorkout: uBackWorkout,\n shoulderWorkout: shoulderWorkout,\n trapWorkout: trapWorkout,\n coreWorkout: coreWorkout\n });\n}", "function saveMessage(firstname, lastname, email, phone, message){\r\nvar newMessageRef = messagesRef.push();\r\nnewMessageRef.set({\r\n firstname: firstname,\r\n lastname: lastname,\r\n email:email,\r\n phone:phone,\r\n message:message\r\n});\r\n}", "function saveSignupinfo(email, password){\n\n \tlet newSignupInfo = signupinfo.push(); \n\n \tnewSignupInfo.set({\n \t\temail: email,\n \t\tpassword: password,\n \t});\n\n \twindow.alert(\"Details saved.\");\n\n }", "function saveMessage(name, email, phone, message){\n var newMessageRef = messagesRef.push();\n newMessageRef.set({\n name: name,\n email: email,\n phone:phone,\n message: message\n\n });\n\n\n}", "async function firebasedb(ann_title,ann_description,ann_imageurl,ann_date){\n\t\n\tawait db.collection(\"announcement\").add({\n\n title: ann_title,\n description: ann_description,\n\timageurl: ann_imageurl,\n\tdate: ann_date\n\t\t\n\t}).then(function(docRef) {\n\t\tconsole.log(\"Document written with ID: \", docRef.id);\n\t\tconsole.log(blob);\n\t\tvar announceref = storage.ref().child(\"announcement/\"+url);\n\t\t\n\t\tannounceref.put(blob).then(function(snapshot) {\n\t\t\tconsole.log('Uploaded a blob or file!');\n\t\t});\n\t\t\n\t\t\n\t}).then(() =>{\n\t\t\n\t}).catch(function(error) {\n\t\tconsole.error(\"Error adding document: \", error);\n\t});\n}", "function sendDataToFirebase(){\n var currentURL = \"https://mmap.firebaseio.com/\";\n var dataLink = getTeam()+\"/\"+getName();\n \n currentURL += dataLink;\n Logger.log(currentURL);\n \n var database = getDatabaseByUrl(currentURL, \"rs4XlisWL1eJNTdWkuUx9LrYdH8b8xilyerrJz5B\");\n \n var data = database.getData() || def;\n\n \n database.setData(\"\",addData(data));\n \n}", "function writeDateData(date) {\n firebase.database().ref(`dateData`).push().set({\n date : date\n });\n document.write(\"Successfully wrote \" + date + \" to date db\")\n}", "function saveContactInfo (name,email,subject,message) {\n \n let newContactInfo = contactInfo.push();\n\n newContactInfo.set({\n name: name,\n email: email,\n subject: subject,\n message: message\n });\n }", "function storeScore(finishTime) {\n firebase.database().ref(\"/app/quiz/results\").push({\n username: quiz.userName ? quiz.userName : \"unknown\",\n score: quiz.score,\n startTime: quiz.startTime,\n endTime: finishTime\n }).then(() => {\n console.log(\"Successfully Saved Score\");\n }).catch((err) => {\n console.log(err);\n console.log(\"Something Went Wrong At Saving Score\");\n })\n}", "function writeUserData(userId, name, email, imageUrl, portfolio) {\n firebase.database().ref('users/' + userId).set({\n username: name,\n email: email\n //portfolio: portfolio\n });\n}", "function addBookToDatabase(data){\n let db = firebase.database();\n let ref = db.ref(\"books\");\n getNewKey().then(result => {\n let newBookRef = ref.child(result);\n newBookRef.set(data);\n })\n}", "function WriteData(user, path, data, back=false) {\n // Required to use firebase tools such as auth, storage, and database\n const firebase = require('firebase');\n require('firebase/database');\n const database = firebase.database();\n\n const ref = database.ref(user+'/'+ path).push( (path==='Projects/')? {Project_Name: {Project_Name: data}} : data,\n function(error) {\n if (error) {\n alert('The data did not submit properly');\n }\n });\n if(back)\n return ref.key;\n}", "function saveContactInfo(name, email, message){\n let newContactInfo = contactInfo.push();\n\n\n newContactInfo.set({\n name : name,\n email: email,\n message: message,\n });\n}", "function saveDataIntoDB(url) {\n // Feed the database\n var dbObj = getEntityCustomData('infoKey', dataBaseID, null);\n if(dbObj) {\n var myName = MyAvatar.displayName ? MyAvatar.displayName : \"Anonymous\";\n dbObj.dbKey[dbObj.dbKey.length] = {name: myName, score: scoreAssigned, clip_url: url};\n setEntityCustomData('infoKey', dataBaseID, dbObj);\n print(\"Feeded DB: \" + url);\n }\n }", "function saveMessage(fname, lname, age, gender, phone, email, desc) {\r\n var newMessageRef = messagesRef.push();\r\n newMessageRef.set({\r\n fname: fname,\r\n lname: lname,\r\n age: age,\r\n gender: gender,\r\n phone: phone,\r\n email: email,\r\n desc: desc\r\n });\r\n}", "function insertUserToRealTimeDB(uid) {\n\n\t\tconsole.log(\"Writing data to the realtime database\");\n\t\t\n\t\t// Create references\n\t\tconst dbRefObject = firebase.database();\n\t\t\n\t\tdbRefObject.ref(\"users\").child(uid);\n\t\tdbRefObject.ref(\"users/\" + uid).child(\"email\");\n\t\tdbRefObject.ref(\"users/\" + uid).child(\"username\");\n\t\tdbRefObject.ref(\"users/\" + uid).child(\"firstName\");\n\t\tdbRefObject.ref(\"users/\" + uid).child(\"lastName\");\n\t\tdbRefObject.ref(\"users/\" + uid).child(\"totalReviews\");\n\t\t\n\t\t\n\t\tdbRefObject.ref(\"users/\" + uid).set({\n\t\t\temail: txtEmailSignUp.value,\n\t\t\tusername: txtUsernameSignUp.value,\n\t\t\tfirstName: txtFirstNameSignUp.value,\n\t\t lastName: txtLastNameSignUp.value,\n\t\t totalReviews: 0\n\t\t});\n\n\t\tdbRefObject.ref(\"users/\" + uid).on(\"value\", function(snap) {\n\t\t\tconsole.log(\"inserted into the database\");\n\t\t\tconsole.log(snap.val());\n\t\t});\n\n\t}", "saveEmailInfo(email){\n let newContactInfo=emailInfo.push();\n newContactInfo.set({\n email:email\n })\n }", "function addBookToUnAvaBooks(data){\n console.log(data)\n firebase.database().ref(\"unavailableBooks\").push().set(data)\n .then(()=>{\n console.log(\"success\")\n })\n .catch((error)=>console.log(\"error\",error.message))\n}", "function TaskSubmit(){\n var Ttitle = document.getElementById('Ttitle').value;\n //console.log('Ttitle ='+Ttitle);\n var Ttitle2 = \"xtsx\"+Ttitle+\"xtex\";\n var videoURL = document.getElementById('videoURL').value;\n var Outline = document.getElementById('Outline').value;\n var Outline2 = 'xosx'+ Outline +'xoex';\n var Note = document.getElementById('Note').value;\n var Note2 = 'xnsx'+ Note +'xnex';\n var selectCat = document.getElementById('selectCat').value;\n// console.log(selectCat);\n var Tdata = {\n TtitleIOS : Ttitle,\n TtitleAndroid : Ttitle2,\n videoURL : videoURL,\n OutlineIOS : Outline,\n OutlineAndroid : Outline2,\n NoteIOS : Note,\n NoteAndroid : Note2,\n Category : selectCat\n }\n\n if(Ttitle == \"\" || Outline == \"\"){\n alert(\"請輸入簡介跟標題\")\n}else {\n var updates = {};\n updates['TaskInstruction/'+ selectCat + '/' + Ttitle + '/Info' ] = Tdata;\n firebase.database().ref().update(updates);\n alert('成功創新作業');\n}\n}", "async function saveTaskInFirebase() {\n if(title.trim() === \"\" || tasks.length === 0){\n notifyError()\n return\n }\n\n const newTodoList = {\n tasks: tasks,\n title: title,\n authorId: user.id,\n createdAt: moment().format('MMM DD YYYY')\n }\n\n await database.ref(`users/${user.id}/todos`).push(newTodoList)\n\n setTitle(\"\")\n setTaskContent(\"\")\n setTasks([])\n setShowTitle(false)\n\n notifySucess()\n }", "function saveMessage(title, ingredients, steps) {\n //var newMessageRef = formMessage.push();\n\n var formMessage = firebase.database().ref(\"Recipes\");\n\n formMessage.push({\n Title: title,\n\n Ingredients: ingredients,\n\n Steps: steps\n });\n}", "function saveEmail(email) {\n var newEmailRef = emailRef.push();\n newEmailRef.set({\n\n email: email\n\n });\n}", "function writeUserData(userId, name, email, imageUrl) {\n firebase.database().ref('users/' + userId).set({\n username: name,\n email: email,\n profile_picture : imageUrl\n });\n}", "function writeUserData(userId, name, email, imageUrl) {\n firebase.database().ref('users/' + userId).set({\n username: name,\n email: email,\n profile_picture : imageUrl\n });\n}", "async saveDataIntoFirebase(data, channel, pair) {\n\n if (this.logCounter < 20) {\n this.logCounter++;\n console.log(this.logCounter + \") \" + pair +\": \"+ data.id);\n }\n\n await this.fsdb.collection(\"exchange\").doc(\"Bitstamp\").collection(channel).doc(pair).collection(\"raw\").add({\n tradeid: data.id,\n mtimestamp: (data.microtimestamp / 1000),\n price: data.price,\n amount: data.amount,\n type: data.type,\n cost: data.cost,\n })\n // .then((docRef) => { this.debugMode && console.log(\"Saved into Firebase as \" + docRef.id); })\n .catch((error) => { console.error(\"Firestore Error:\\n\" + error) });\n }", "function saveMessage(name, lastName, email, phone, message, password, confirm_password) { \n var verifyUser = firebase.auth().createUserWithEmailAndPassword(email, password); \n verifyUser.then(data => {\n const { uid } = data.user;\n var messageRef2 = firebase.database().ref(`message/${uid}`); \n var newMessageRef = messageRef2.push()\n newMessageRef.set({\n name: name,\n lastName: lastName,\n email: email,\n confirm_password: confirm_password,\n phone: phone,\n message: message\n }).then((data) => {\n console.log('dta', data);\n });\n })\n}", "function addPerson(name, surname, age) {\n var personId = firebase\n .database()\n .ref(\"people\")\n .push().key;\n console.log(\"personID\", personId);\n\n firebase\n .database()\n .ref(\"people/\" + personId)\n .set({\n name: name,\n surname: surname,\n age: age\n })\n .then(function() {\n alert(\"Dodano pomyślnie\");\n getPeople();\n })\n .catch(function(error) {\n alert(\"Error \" + error.message);\n });\n}", "function submitClick(){\n //test button-worked\n // window.alert(\"Working\");\n\n var firebaseRef = firebase.database().ref();\n // firebaseRef.set(\"\");\n// get main value from main text here\n\n var messageText = mainText.value;\n// can not set value to the main object so created a key\n\n //data will be overwritten replacing the information with every click using the child method\n // firebaseRef.child(\"Text\").set(messageText);\n //push method will create a unique ID that it stores each time\n firebaseRef.push().set(messageText);\n}", "function saveProject(projectName, toSave){\n\tvar DataBaseRef = firebase.database().ref();\n\tvar user = firebase.auth().currentUser;\n\tuid = user.uid\n\tvar message = toSave;\n\tDataBaseRef.child(\"User\").child(uid).child(\"Saved\").child(projectName).set(toSave);\n\talert(\"Project Saved As: \"+projectName);\n}", "function pushToStorage(key,value){\n var convertedValue = JSON.stringify(value);\n db.setItem(key,convertedValue);\n}", "function saveMessage(type,name,age,email, phone){\n var newMessageRef = messagesRef.push();\n newMessageRef.set({\n type:type,\n name: name,\n age:age,\n email:email,\n phone:phone,\n \n });\n\n}", "save(data) {\n this.db.save(data);\n }", "function submit() {\n name = $('#js-trainName').val().trim();\n destination = $('#js-destination').val().trim();\n time = $('#js-firstTrain').val().trim();\n minutes = $('#js-minutes').val().trim();\n\n database.ref().push({\n name: name,\n destination: destination,\n frequency: minutes,\n arrival: time,\n dateAdded: firebase.database.ServerValue.TIMESTAMP\n });\n\n\n clear();\n }", "function new_book(){\r\n var book = $('#bookname').val();\r\n var auth = $('#author').val();\r\n var ed = $('#edition').val();\r\n var cor = $('#course').val();\r\n var pr = $('#price').val();\r\n // var img = $('#file').val();\r\n var con = $('input[name=radioName]:checked', '#booksForm').val()\r\n\r\n var user = firebase.auth().currentUser;\r\n var name, email, photoUrl, uid;\r\n\r\n if (user != null) {\r\n // name = user.displayName;\r\n email = user.email;\r\n uid = user.uid; // The user's ID, unique to the Firebase project. Do NOT use\r\n // this value to authenticate with your backend server, if\r\n // you have one. Use User.getToken() instead.\r\n }\r\n\r\n var newBooksKey = firebase.database().ref().child('Books').push().key;\r\n\r\n var metadata = {\r\n name: newBooksKey\r\n }\r\n\r\n // var reader = new FileReader();\r\n // var dlURL;\r\n var file = document.querySelector('input[type=file]').files[0];\r\n \r\n\r\n // var imgURL = reader.readAsDataURL(file);\r\n // alert(file);\r\n var uploadTask = firebase.storage().ref().child('Books_Images/').child(newBooksKey).put(file, metadata);\r\n\r\n uploadTask.on('state_changed', function(snapshot){\r\n var dlURL = uploadTask.snapshot.downloadURL;\r\n \r\n \r\n var booksData = {\r\n Book_Name: book,\r\n Posted_By: uid,\r\n Author: auth,\r\n Edition: ed,\r\n Course_Name: cor,\r\n Condition: con,\r\n Price: pr,\r\n ImageURL: dlURL\r\n };\r\n\r\n // Get a key for a new Post.\r\n\r\n\r\n // alert(newBooksKey);\r\n\r\n // Write the new post's data simultaneously in the posts list and the user's post list.\r\n var updates = {};\r\n updates['/Books/' + newBooksKey] = booksData;\r\n // updates['/user-books/' + uid + '/' + 'bookid'] = newBooksKey;\r\n\r\n firebase.database().ref().update(updates);\r\n });\r\n\r\n\r\n // alert(dlURL);\r\n\r\n \r\n}", "save() {\n this.db.write();\n }", "function guardar() {\n let txtnombre = document.getElementById('name').value;\n let txtapellido = document.getElementById('surename').value;\n\n db.collection('Alumnos')\n .add({\n first: txtnombre,\n last: txtapellido,\n asistencia: 'No tomada'\n })\n .then(function(docRef) {\n console.log('Document written with ID: ', docRef.id);\n document.getElementById('name').value = '';\n document.getElementById('surename').value = '';\n })\n .catch(function(error) {\n console.error('Error adding document: ', error);\n });\n}", "function save(elmnt) {\n var newTitle = document.getElementById('newTitle');\n var newDesc = document.getElementById('newDesc');\n var newDate = document.getElementById('newDate');\n var newProducts = [];\n for (var i=0; i<editedProducts.length;i++){\n newProducts.push([document.getElementById(i).value, 'false']);\n }\n\n var newNewDate = dateConvert(newDate.value);\n \n //Make the new version\n var newProjectRef = projectRef.push();\n newProjectRef.set({\n title: newTitle.value,\n desc: newDesc.value,\n date: newNewDate,\n products: newProducts\n });\n closeModal();\n // Delete the old version\n firebase.database().ref(userId+'/'+elmnt.id).remove();\n}", "function writeUserData(userId, name, email, imageUrl) {\n firebase.database().ref('users/' + userId).set({\n username: name,\n email: email,\n profile_picture: imageUrl\n });\n}" ]
[ "0.73403907", "0.7223977", "0.7133635", "0.71329314", "0.71327555", "0.7105246", "0.7085891", "0.7059027", "0.7053349", "0.7037053", "0.6972085", "0.6971323", "0.69181395", "0.6901785", "0.68614864", "0.6848471", "0.6832074", "0.6831864", "0.67889655", "0.6771658", "0.67391884", "0.6718058", "0.67132515", "0.6656097", "0.6644224", "0.6636194", "0.6631417", "0.6626152", "0.66248447", "0.66148823", "0.6607203", "0.66059136", "0.66013527", "0.6577368", "0.6566328", "0.65538085", "0.6553783", "0.6520717", "0.6517051", "0.65147364", "0.6500299", "0.64991486", "0.6493997", "0.64926314", "0.64909494", "0.64852786", "0.64788944", "0.64677334", "0.64545757", "0.6453783", "0.64513665", "0.64438367", "0.6443802", "0.64416534", "0.6440561", "0.64219654", "0.64067686", "0.6399766", "0.63927233", "0.63926005", "0.63879514", "0.6382841", "0.63785475", "0.6370149", "0.63672966", "0.63593334", "0.6353641", "0.6353229", "0.63405466", "0.6338918", "0.6333416", "0.6329588", "0.6321977", "0.6318064", "0.6314831", "0.6311902", "0.6310447", "0.6304278", "0.6300429", "0.6298265", "0.6296116", "0.62874496", "0.62849414", "0.62796175", "0.6278846", "0.6277576", "0.6277576", "0.62757564", "0.6273434", "0.62721306", "0.6265098", "0.626241", "0.6257649", "0.62510765", "0.62510395", "0.6248352", "0.62424713", "0.62417054", "0.62358457", "0.622987", "0.6227478" ]
0.0
-1
retrieves list of SIGNIFICANT biomarkers over API and updates biomarker gene
async getBiomarkerTableData(score) { const { getPlotData } = this; const { drugId1, drugId2, dataset, } = this.state; let biomarkerCheck = true; // checks is there is any biomarker data available for a given dataset if (dataset) { await fetch(`/api/biomarkers/dataset/${dataset}/${score}`) .then(response => response.json()) .then((data) => { biomarkerCheck = data.biomarkers; }) .catch(() => { console.log('Unable to check biomarker data availability'); }); } if (biomarkerCheck) { let url = `/api/biomarkers/synergy?allowAll=true&type=${score}`; if (drugId1) url = url.concat(`&drugId1=${drugId1}`); if (drugId2) url = url.concat(`&drugId2=${drugId2}`); if (dataset) url = url.concat(`&dataset=${dataset}`); fetch(url, { method: 'GET', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, }) .then(response => response.json()) .then((data) => { const occurenceObj = {}; data.forEach((row) => { const { gene, drugA, drugB } = row; const key = `${gene}-${drugA}-${drugB}`; if (!occurenceObj[key]) { occurenceObj[key] = 1; } else { occurenceObj[key] += 1; } }); const processedData = data.map((row) => { const { gene, drugA, drugB } = row; const key = `${gene}-${drugA}-${drugB}`; return { ...row, occurrences: occurenceObj[key] }; }).sort((a, b) => { if (a.occurrences > b.occurrences) return -1; if (a.occurrences < b.occurrences) return 1; return 0; }); switch (score) { case 'zip': this.setState({ zipBiomarkers: processedData, loadingTable: false, }); break; case 'bliss': this.setState({ blissBiomarkers: processedData, loadingTable: false, }); break; case 'hsa': this.setState({ hsaBiomarkers: processedData, loadingTable: false, }); break; case 'loewe': this.setState({ loeweBiomarkers: processedData, loadingTable: false, }); break; default: break; } getPlotData( processedData[0].gene, score, { name: processedData[0].dataset, id: processedData[0].idSource }, ); }) .catch((err) => { console.log(err); this.setState({ loadingTable: false, loadingGraph: false, }); }); } else { this.setState({ loadingTable: false, loadingGraph: false, biomarkersAvailable: false, }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async retrieveGeneData(gene, dataset) {\r\n const {\r\n sample, drugId1, drugId2, biomarkerGeneStorage,\r\n selectedScore,\r\n } = this.state;\r\n // Checks if biomarker gene data has already been retrieved over API\r\n if (biomarkerGeneStorage[selectedScore]\r\n && biomarkerGeneStorage[selectedScore][dataset.name]\r\n && biomarkerGeneStorage[selectedScore][dataset.name][gene]) {\r\n return biomarkerGeneStorage[selectedScore][dataset.name][gene];\r\n }\r\n try {\r\n // Retrieves data from the API and stores it in the state\r\n this.setState({ loadingGraph: true });\r\n let queryParams = `?&dataset=${dataset.id}`;\r\n if (sample) queryParams = queryParams.concat(`&sample=${sample}`);\r\n if (drugId1) queryParams = queryParams.concat(`&drugId1=${drugId1}`);\r\n if (drugId2) queryParams = queryParams.concat(`&drugId2=${drugId2}`);\r\n\r\n let synergyArray;\r\n\r\n await fetch('/api/biomarkers/association'.concat(queryParams).concat(`&gene=${gene}`), {\r\n method: 'GET',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n Accept: 'application/json',\r\n },\r\n }).then(response => response.json())\r\n .then((data) => {\r\n synergyArray = data;\r\n });\r\n // created a nested storage object with three levels\r\n // top level is synergy score, then dataset, then biomarker gene\r\n const updatedGeneStorage = { ...biomarkerGeneStorage };\r\n if (!updatedGeneStorage[selectedScore]) updatedGeneStorage[selectedScore] = {};\r\n if (!updatedGeneStorage[selectedScore][dataset.name]) {\r\n updatedGeneStorage[selectedScore][dataset.name] = {};\r\n }\r\n updatedGeneStorage[selectedScore][dataset.name][gene] = synergyArray;\r\n this.setState({ biomarkerGeneStorage: updatedGeneStorage });\r\n return synergyArray;\r\n } catch (err) {\r\n console.log(err);\r\n return [];\r\n }\r\n }", "function getBucketMarex(param) {\n\tTi.API.info('getBucketMarex');\n\tvar json = loadFile();\n\tTi.API.info('get json file: \\n' + JSON.stringify(json));\n\t//var bucketMarexs = Alloy.createCollection('bucket_marex');\n\tfor (var i = 0; i < json.length; i++) {\n\t\tif (json[i].CD_SP === param.cd_sp) {\n\t\t\t//create model\n\t\t\tvar _bucket = Alloy.createModel('bucket_marex', {\n\t\t\t\tNO_REGISTRATION : json[i].NO_REGISTRATION,\n\t\t\t\tCD_SP : json[i].CD_SP,\n\t\t\t\tL1_USER : json[i].L1_USER,\n\t\t\t\tL1_DATE : json[i].L1_DATE,\n\t\t\t\tL1_TIME : json[i].L1_TIME,\n\t\t\t\tL1_RESULT : json[i].L1_RESULT,\n\t\t\t\tL1_LEVEL : json[i].L1_LEVEL,\n\t\t\t\tL2_USER : json[i].L2_USER,\n\t\t\t\tL2_DATE : json[i].L2_DATE,\n\t\t\t\tL2_TIME : json[i].L2_TIME,\n\t\t\t\tL2_RESULT : json[i].L2_RESULT,\n\t\t\t\tL2_LEVEL : json[i].L2_LEVEL,\n\t\t\t\tL3_USER : json[i].L3_USER,\n\t\t\t\tL3_DATE : json[i].L3_DATE,\n\t\t\t\tL3_TIME : json[i].L3_TIME,\n\t\t\t\tL3_RESULT : json[i].L3_RESULT,\n\t\t\t\tL3_LEVEL : json[i].L3_LEVEL,\n\t\t\t\tSTATUS : json[i].STATUS,\n\t\t\t\tBRAND_ASTRA : json[i].BRAND_ASTRA,\n\t\t\t\tFLAG_NEW_USED : json[i].FLAG_NEW_USED,\n\t\t\t});\n\n\t\t\t//save to persistent\n\t\t\t_bucket.save();\n\t\t}\n\t}\n}", "findAll(store, type, sinceToken, snapshotRecordArray) {\n let requestBody = {};\n let token = this.get('authentication').get('token'),\n myParams = {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'user': token\n },\n response: true\n };\n\n if (snapshotRecordArray && snapshotRecordArray.adapterOptions && snapshotRecordArray.adapterOptions.import) {\n myParams.body = requestBody;\n return new Ember.RSVP.Promise((resolve, reject) => {\n _awsAmplify.API.post('CreatorsProfileAPI', '/me/badges' + '?type=GENESYS', myParams).then(result => {\n Ember.debug('api response: ', result);\n console.log(result);\n resolve(result.data.genbadges);\n }).catch(function (error) {\n console.error(error);\n (true && Ember.warn('api error: ' + error, true, {\n id: 'adapter.genbadge.findAll'\n }));\n reject(error);\n });\n });\n }\n\n return new Ember.RSVP.Promise((resolve, reject) => {\n _awsAmplify.API.get('CreatorsProfileAPI', '/me/badges' + '?type=GENESYS', myParams).then(result => {\n Ember.debug('api response: ', result);\n console.log(result);\n resolve(result.data.genbadges);\n }).catch(function (error) {\n console.error(error);\n (true && Ember.warn('api error: ' + error, true, {\n id: 'adapter.genbadge.findAll'\n }));\n reject(error);\n });\n });\n }", "function getInventoryWithRefinements(boatFilter) {\n _nationalFacets = null;\n _boatFilter = boatFilter;\n verifyCallback();\n handleRadius();\n\n var paramDealerId = boatFilter.dealerId;\n\n //initialize paramDealerId to -1 so the first call gets made for NEW makes\n paramDealerId = (boatFilter.dealerId == null || boatFilter.dealerId < 1) ? -1 : boatFilter.dealerId;\n\n //If a new dealer ID is requested, then get all new makes\n if (paramDealerId\n && $.isNumeric(paramDealerId)\n && paramDealerId != currentDealerId) {\n\n //get new makes from Algolia\n var mmFilter = BoatFilter();\n mmFilter.showModelBoats = true;\n mmFilter.conditionFacets.push(\"New\");\n\n //if paramDealerId is -1, then getting national inventory\n if (paramDealerId != -1) {\n mmFilter.dealerId = boatFilter.dealerId;\n }\n\n currentDealerId = paramDealerId;\n\n var repo = MarineMax.BoatRepository;\n repo.getInventoryWithRefinements(mmFilter).then(saveNewMakes, function () { throw \"Algolia call failed\"; });\n console.log(\"done calling all NEW makes\");\n }\n else {\n runAlgoliaQuery();\n }\n }", "function geneSave(){\n return {'genes':window.biogen,\n 'geneSets':window.bioGeneGrp}\n}", "getBreeds() {\n return this.state.api.retrieve()\n }", "function showRandomBeers(){\n\t\n\tvar numberOfRandomBeers = 8;\n\tvar randomBeers =\"\";\n\tvar finalRandomBeersEndpoint;\n\t\n\tfor(var i = 0; i<numberOfRandomBeers; i++){\n\t\t\n\t\trandomBeers += Math.floor((Math.random() * 234) + 1) + \"|\";\n\t\t\n\t}\n\tfinalRandomBeersEndpoint = randomBeers.substr(0, randomBeers.length-1);\n\tconsole.log(finalRandomBeersEndpoint);\n\tvar endpoint = `beers?ids=${finalRandomBeersEndpoint}`;\n\t\n\tbeerDatabase.ourRandomBeers(endpoint, numberOfRandomBeers);\n\t//beerDatabase.ourBeers(endpoint);\n}", "initializeDiscardedInfluencersList(base_url){\n let request = '/rest_dictionary_influencers/entries/category/--all--'\n\n axios.get(`${base_url}${request}`)\n .then((response) => {\n let myinfluencers = response.data.items.sort()\n\n myinfluencers = myinfluencers.filter((x) => x.category.trim() === 'descartats')\n myinfluencers = myinfluencers.map((influencer) => {\n return influencer.normalized_id\n })\n this.setState({\n discardedInfluencers: myinfluencers\n })\n })\n .catch((error) => {\n alert(error)\n })\n }", "function createBeerListFetches(){\n return [fetch('https://api.punkapi.com/v2/beers'), fetch('https://api.punkapi.com/v2/beers')] \n}", "function getMyBands(artist) {\n console.log(\"Get band info\");\n\n var concertURL =\n \"https://rest.bandsintown.com/artists/\" +\n artist +\n \"/events?app_id=95a3a5a0a600d61d0387aa74942b77e2\";\n axios.get(concertURL).then(function(response) {\n console.log(response);\n\n var jsonData = response.data[0];\n var concertTime = jsonData.datetime;\n var concertData = [\n divider,\n \"venue: \" + jsonData.venue.name,\n \"location:\" + jsonData.venue.city,\n \"Time of Event: \" + moment(concertTime).format(\"MM/DD/YYYY h:mm:ss a\"),\n divider\n ].join(\"\\n\\n\");\n console.log(concertData);\n });\n}", "async function getallBeers() {\n try {\n let response = await axios.get('https://api.punkapi.com/v2/beers/') //then attend que await soit fini\n for (var i = 0; i < response.data.length; i++) {\n\n let bName = response.data[i].name;\n let bTag = response.data[i].tagline;\n let bYear = response.data[i].first_brewed;\n let bImg = response.data[i].image_url;\n\n let li = document.createElement(\"li\");\n li.className = \"beerCase\";\n\n let h2 = document.createElement(\"h2\");\n let h3 = document.createElement(\"h3\");\n let p = document.createElement(\"p\");\n\n let img = new Image();\n\n let beerName = document.createTextNode(bName);\n let beerTag = document.createTextNode(bTag);\n let beerBrew = document.createTextNode(bYear);\n\n img.src = bImg;\n\n h2.appendChild(beerName);\n h3.appendChild(beerTag);\n p.appendChild(beerBrew);\n li.appendChild(h2);\n li.appendChild(h3);\n li.appendChild(p);\n li.appendChild(img);\n inside.appendChild(li);\n }\n } catch (error) {\n console.error(error);\n }\n}", "function findBikes() {\n var latitude = 38.9072;\n var longitude = -77.0369;\n var queryUrl = \"https://api.coord.co/v1/sv/location?latitude=\" +latitude + \"&longitude=\" + longitude + \"&radius_km=\" + radius + \"&access_key=\" + coord;\n request(queryUrl, function (error, response, body){\n if (!error && response.statusCode === 200){\n var jsonData = JSON.parse(body);\n console.log(jsonData, \"This is the bikeShare datat\");\n for (var i = 0; i< jsonData.features.length; i++){\n // console.log(\"Features: \" +jsonData.features[i]);\n var bikeData = jsonData.features[i].properties;\n console.log(\"Company: \" + bikeData.system_id);\n if (bikeData.system_id !== \"CapitalBikeShare\"){ //Return lat and long for dockless bikes\n console.log(\"Location: \"+ bikeData.lon, \", \" + bikeData.lat);\n }\n else {\n console.log(\"Location: \" + bikeData.name); //if CaBi, return station name\n }\n console.log(\"Bikes Available: \"+bikeData.num_bikes_available);\n if (bikeData.num_docks_available !== undefined){\n console.log(\"Number of Docks Avail: \" + jsonData.features[i].properties.num_docks_available);\n }\n }\n }\n })\n}", "function getNeighbors(req, res) {\n // variables defined in the Swagger document can be referenced using req.swagger.params.{parameter_name}\n var setId = req.swagger.params.setId.value || '';\n var treeId = req.swagger.params.treeId.value || '';\n var filter = req.swagger.params.filter.value || '';\n\n // get the url for the solr instance with setId trees\n var url = 'http://localhost:8983/solr/'+setId+'/query?rows=20000';\n url += '&fl=treeId,nodeType,gene*';\n // build a query for the given tree\n var solrQuery = '&q={!graph from=geneNeighbors to=geneRank maxDepth=1}treeId:'+treeId;\n solrQuery += ' AND geneRank:[* TO *]';\n // possibly apply filter\n if (filter) {\n solrQuery += ' AND ' + filter;\n }\n // run the query\n request(url + solrQuery, function(err, response, body) {\n if (err) {\n res.json({error: err});\n }\n var nodes = JSON.parse(body).response.docs;\n var geneByRank = {};\n nodes.forEach(function(n) {\n var rank = n.geneRank[0];\n geneByRank[rank] = {\n treeId: n.treeId,\n biotype: n.nodeType,\n geneId: n.geneId,\n location: {\n region: n.geneRegion,\n start: n.geneStart,\n end: n.geneEnd,\n strand: n.geneStrand\n }\n };\n if (n.geneName) {\n geneByRank[rank].geneName = n.geneName;\n }\n if (n.geneDescription) {\n geneByRank[rank].geneDescription = n.geneDescription;\n }\n });\n res.json(geneByRank);\n });\n}", "function getBrands(req, res) {\n return sendJsonFile('brands.json', res);\n}", "function retrieveBandsInTown(artist) {\n // Append the command to the log file\n fs.appendFile('./log.txt', `**************************************************************************\\nUser Command: node liri.js concert-this ${artist} \\n\\n`, (err) => {\n if (err) throw err;\n });\n\n var bandSearch;\n\n // Replace spaces with '' for the query string\n bandSearch = artist.split(' ').join('');\n\n if (artist === ``) {\n bandSearch = `NickiMinaj`;\n }\n\n console.log(bandSearch);\n const bandsInTownAPIKey = keys.bands.BANDS_API_KEY;\n // Construct the query string\n var queryStr = `https://rest.bandsintown.com/artists/${bandSearch}/events?app_id=${bandsInTownAPIKey}`;\n console.log(queryStr);\n\n fs.appendFile(`./log.txt`, `Query: ${queryStr} \\n\\n`, (err) => {\n if (err) throw err;\n });\n\n const options = {\n url: queryStr,\n method: \"GET\",\n headers: {\n 'Accept': 'application/json',\n 'Accept-Charset': 'utf-8'\n }\n };\n\n // Send the request to BandsInTown\n request(options, function (error, response, body) {\n var data = JSON.parse(body);\n\n if (error != null) {\n var errorStr1 = 'ERROR: Retrieving artist entry -- ' + error;\n\n // Append the error string to the log file\n fs.appendFile('./log.txt', errorStr1, (err) => {\n if (err) throw err;\n console.log(errorStr1);\n });\n return;\n } else {\n for (event in data) {\n\n const venue = data[0].venue;\n const eventInfo = data[event];\n //format the date \n const date = moment(eventInfo.datetime).format(\"MM/DD/YYYY\");\n\n //Return and Print the Concert information\n var outputStr =\n `\\n\n**************************************************************************\n Concert Information\n****************************${date}************************************\nArtist: ${eventInfo.lineup[0]} \nVenue: ${eventInfo.venue.name} \nCity: ${eventInfo.venue.city} \nState: ${eventInfo.venue.region}\nCountry: ${eventInfo.venue.country}`;\n console.log(outputStr);\n\n // Append the output to the log file\n fs.appendFile('./log.txt', `LIRI Response: ${outputStr} \\n\\n`, (err) => {\n if (err) throw err;\n });\n\n }\n\n }\n });\n}", "function getMyBonuses() {\n return new Promise((resolve, reject) => {\n unirest.get(env.BONUSLY_BASE_API + '/bonuses?receiver_email='+env.MY_COMPANY_EMAIL)\n .headers(\n { \"Authorization\": \"Bearer \" + env.BONUSLY_API_KEY })\n .end(response => {\n if (!response.ok) {\n reject(`error`);\n } else {\n let my_bonuses = [];\n response.body.result && response.body.result.forEach(element => {\n if(element.giver.manager_email){\n var temp = {\n created_at : element.created_at,\n giver : element.giver.short_name,\n reason : element.reason_decoded.replace(/([@#&\\+]\\S+)/gi,\"\").trim()\n }\n my_bonuses.push(temp);\n } \n });\n resolve(my_bonuses);\n }\n });\n });\n}", "function lexaBrain (service, search) {\n let queryUrl =\"\";\n switch (service){\n case \"spotify-this-song\":\n\n //checking to see if a song was provide, if not defaults to the sign\n let spotifySearch = \"\";\n if(search===\"\"){\n spotifySearch=\"the+sign\"\n }else{\n spotifySearch=search;\n }\n\n //call out to spotify for 5 results.\n spotify.search({ \n type: 'track', query: spotifySearch, limit: 5\n }).then(function(response) {\n\n //checking to see if any items in response, if none let user know\n if(response.track.items.length===0){\n console.log(\"No song by that name found.\")\n }\n //each song sent back, we print out the info for it.\n response.tracks.items.forEach(function(result){\n console.log();\n console.log (\"Artist(s): \"+result.artists[0].name);\n console.log (\"Song Title: \"+result.name);\n console.log (\"Album: \"+result.album.name);\n console.log (\"On Spotify: \"+result.external_urls.spotify);\n })\n \n })\n //incase something goes wrong\n .catch(function(err) {\n console.log(\"No song by that name found\");\n });\n break;\n\n case \"concert-this\":\n //using axios to call out to bandsintown and get back results\n queryUrl = \"https://rest.bandsintown.com/artists/\" + search + \"/events?app_id=codingbootcamp\";\n axios.get(queryUrl.replace(\"+\", \" \")).then(function(response){\n\n if(response.data.length === 0){\n console.log (\"No band by that name found.\");\n }\n\n //for each gig a band has, print out the info\n response.data.forEach(function(gig){\n let date = gig.datetime.split(\"T\");\n let formatedDate = moment(date[0]).format(\"MM/DD/YYYY\");\n let venue = gig.venue\n console.log(`\n Venue name: ${venue.name}\n Location: ${venue.city}, ${venue.region}, ${venue.country}\n Date of show: ${formatedDate} \n `)\n });\n })\n //if something goes wrong...\n .catch(function(err){\n console.log (\"Band not found\");\n });\n break;\n\n case \"movie-this\":\n queryUrl = \"http://www.omdbapi.com/?t=\" + search + \"&y=&plot=short&apikey=trilogy\";\n axios.get(queryUrl).then(function(response) {\n let movie = response.data\n if (movie.length === 0){\n console.log(\"No movie by that name found\");\n }\n console.log(`\n Movie Title: ${movie.Title}\n Release Date: ${movie.Released}\n IMDB Rating: ${movie.imdbRating}\n Rotten T: ${movie.Ratings[1].Value}\n Country of O: ${movie.Country}\n Language: ${movie.Language}\n Movie Plot: ${movie.Plot}\n Actors: ${movie.Actors}\n `)\n })\n //incase something goes wrong.\n .catch(function(err){\n console.log(\"No movies by that name found\");\n });\n break;\n case \"do-what-it-says\":\n console.log(\"FreeStyle huh?...lets see....\");\n //reading my file and getting its contents\n fs.readFile(\"random.txt\", \"utf8\", function(err, data) {\n if(err){\n console.log(\"I wasn't able to read that...\")\n }\n console.log(data);\n //removes \"\" around song name, then splits the command in two. one for command. one for searchterm.\n let response = data.replace(/\"+/g, '').split(\",\");;\n lexaBrain(response[0],response[1]);\n });\n break;\n default:\n console.log(\"I havent been programmed to do that yet...\");\n break;\n }\n}", "async populateBrandsData() {\n const token = await authService.getAccessToken();\n const response = await fetch('api/brand', {\n headers: !token ? {} : { 'Authorization': `Bearer ${token}` }\n });\n this.state.brands = await response.json();\n\n this.setState({ loading: false });\n }", "function getSymbol(symbol){\nrequest('GET', \"http://api.fixer.io/latest\").done(function (res) {\ndata = JSON.parse(res.getBody());\ngetGes(data,symbol)\n\n});\n}", "cancerGenesLoaded(response) {\n console.log(\"cBioPortal State: Genes loaded.\");\n this.geneList = response.data;\n var localGeneDict = []\n for (var i = 0; i < response.data.length; i++) {\n var currentGene = response.data[i];\n localGeneDict[currentGene.GeneSymbol] = currentGene\n }\n this.geneDict = localGeneDict;\n }", "function doBandInTown() {\n axios\n .get(\n \"https://rest.bandsintown.com/artists/\" + Search + \"/events?app_id=%3Fapp_id%3Db7b374713cf3e2cf710b82eac648971e\"\n )\n .then(function(response) {\n for (var i = 0; i < response.data.length; i++) {\n console.log(\"Artist/Band you choose is: \" + Search);\n console.log(\"Venue is located in: \" + response.data[i].venue.name);\n console.log(\"Venue is located in: \" + response.data[i].venue.city);\n console.log(\"Date/Time is: \" + response.data[i].datetime);\n console.log(\"-----------------------------------\");\n }\n });\n}", "addToBookMarkOrFav(key, postId, iconName, IconValueOn, IconValueOff) {\n retrieveData(key).then((value) => {\n let arrayName = JSON.parse(value);\n\n if (!arrayName) {\n arrayName = []\n arrayName.push(postId);\n updateList.call(this, key, arrayName, iconName, IconValueOn)\n }\n else {\n if (arrayName.includes(postId)) {\n arrayName.pop(postId);\n updateList.call(this, key, arrayName, iconName, IconValueOff)\n }\n else {\n arrayName.push(postId);\n updateList.call(this, key, arrayName, iconName, IconValueOn)\n }\n }\n }).catch((err) => {\n console.log(err)\n })\n }", "function getExpress(WID, y) {\n outarr.push([WID]);\n var reqURL = 'http://api.wormbase.org/rest/widget/gene/' + WID + '/expression';\n request.get({\n url: reqURL,\n json: true,\n headers: {\n 'Content-Type': 'Content-Type:application/json'\n }\n }, function(error, response, body) {\n if (error) {\n console.log(error);\n } else {\n if (body && body.fields && body.fields.expressed_in && body.fields.expressed_in.data) {\n body.fields.expressed_in.data.map(a => console.log(a.ontology_term.label))\n }\n }\n })\n}", "static getGenres() {\n return axios\n .request({\n baseURL: `${TMDB.API_URL}`,\n url: `/genre/tv/list?api_key=${TMDB.API_KEY}`,\n responseType: \"json\"\n })\n .then(response => {\n if (response.status !== 200) {\n return Promise.reject(new Error(response.statusText));\n }\n\n const { genres } = response.data;\n return Promise.resolve(genres);\n })\n .catch(err => {\n Promise.reject(err);\n });\n }", "function add_bike() {\n axios.get(`/bike?minx=${minx}&maxx=${maxx}&miny=${miny}&maxy=${maxy}`)\n .then(function (response) {\n load_geojson(response.data, 'bike');\n })\n .catch(function (error) {\n console.log(error);\n });\n}", "function getAllOffers() {\n // Connecting to infura node.\n web3 = new Web3(new Web3.providers.HttpProvider(\"https://ropsten.infura.io/v3/6d4da4e3a05d48c0b5323373510a61da\"));\n // Injected web3 provider contract.\n let contract1 = web3.eth.contract(abi).at(contractAddress);\n // Returns enght of related offer.\n var length = contract1.getAnOwnerLength(1);\n var index = 0;\n for (i = 0; i < length; i++) {\n //Smart contract function. Find the next Energy Producer.\n result = contract1.wantedValueofProductInfoStruct(index, 1);\n var table = document.getElementById(\"myTable\");\n var row = table.insertRow(1);\n var cell1 = row.insertCell(0);\n var cell2 = row.insertCell(1);\n cell1.innerHTML = result[0];\n cell2.innerHTML = result[1];\n // New index is return value of smart contract function.\n index = result[2];\n }\n\n}", "function generateGeneInformationTable(slimData, studies) {\n\n // adding gene data to html:\n $(\"#geneSymbol\").html(slimData.title);\n\n // Parsing description related fields:\n var descriptionFields = slimData.description.split(\"|\");\n $(\"#description\").html(descriptionFields[0])\n $(\"#location\").html(descriptionFields[1]);\n // Hide the Button while loading\n $(\"#impc_button\").hide();\n // Adding cytogenic region:\n var regionLink = $(\"<a></a>\").attr(\"href\", gwasProperties.contextPath + 'regions/' + descriptionFields[2]).append(descriptionFields[2]);\n $(\"#cytogenicRegion\").html(regionLink);\n\n $(\"#biotype\").html(descriptionFields[3]);\n\n // Loop through all studies and parse out Reported traits:\n var reported_traits = [];\n for ( var study of studies.docs) {\n if ($.inArray(study.traitName_s, reported_traits) == -1) {\n reported_traits.push(study.traitName_s);\n }\n }\n\n // Extracting cross-references:\n var xrefQueryURL = gwasProperties.EnsemblRestBaseURL + '/xrefs/id/' + slimData.ensemblID + '?content-type=application/json'\n var xrefData = getEnsemblREST(xrefQueryURL);\n var entrezID = \"NA\";\n var OMIMID = \"NA\";\n var impcId = getImpcDetails(slimData.title);\n //console.log('impcId->'+impcId);\n\n for ( xref of xrefData ){\n if ( xref.dbname == \"EntrezGene\" ){\n entrezID = xref.primary_id\n }\n if ( xref.dbname == 'MIM_GENE' ){\n OMIMID = xref.primary_id\n }\n }\n\n // Adding automatic cross references pointing to Ensembl:\n $(\"#ensembl_button\").attr('onclick', \"window.open('\"+gwasProperties.EnsemblURL+\"Gene/Summary?db=core;g=\"+slimData.ensemblID +\"', '_blank')\");\n $(\"#ensembl_phenotype_button\").attr('onclick', \"window.open('\"+gwasProperties.EnsemblURL+\"Gene/Phenotype?db=core;g=\"+slimData.ensemblID+\"', '_blank')\");\n $(\"#ensembl_pathway_button\").attr('onclick', \"window.open('\"+gwasProperties.EnsemblURL+\"Gene/Pathway?db=core;g=\"+slimData.ensemblID+\"', '_blank')\");\n $(\"#ensembl_regulation_button\").attr('onclick', \"window.open('\"+gwasProperties.EnsemblURL+\"Gene/Regulation?db=core;g=\"+slimData.ensemblID+\"', '_blank')\");\n $(\"#ensembl_expression_button\").attr('onclick', \"window.open('\"+gwasProperties.EnsemblURL+\"Gene/ExpressionAtlas?db=core;g=\"+slimData.ensemblID+\"', '_blank')\");\n\n // Adding automatic cross reference pointing to Open targets:\n $(\"#opentargets_button\").attr('onclick', \"window.open('\"+gwasProperties.OpenTargetsURL+ slimData.ensemblID+\"', '_blank')\");\n\n // Looping through the cross references and extract entrez id:\n if ( entrezID != \"NA\" ){\n $(\"#entrez_button\").attr('onclick', \"window.open('\"+gwasProperties.EntrezURL+ entrezID + \"', '_blank')\");\n }\n // Looping through the cross references and extract OMIM id:\n if ( OMIMID != \"NA\" ){\n $(\"#OMIM_button\").attr('onclick', \"window.open('\"+gwasProperties.OMIMURL+ OMIMID + \"', '_blank')\");\n }\n\n // Show button if MGIdentifier exists\n if (impcId != \"NA\" ) {\n $(\"#impc_button\").show();\n $(\"#impc_button\").attr('onclick', \"window.open('\"+gwasProperties.IMPC_URI+ impcId + \"', '_blank')\");\n }\n\n // OK, loading is complete:\n hideLoadingOverLay('#summary-panel-loading');\n}", "function updateCoin(fsym) {\n axios.get('https://min-api.cryptocompare.com/data/histohour', {\n params: {\n api_key: \"2ccfbedbc83b1a45687c4e6eeaa6ab79299b4ade9398cee3878b6a42c1066f73\",\n fsym: fsym,\n tsym: \"SGD\",\n limit: 20,\n }\n })\n .then(function(response) {\n let readings1 = response.data.Data;\n let arrayinfoBitcoin = [];\n\n for (x in readings1) {\n // console.log(readings1[x])\n let time_raw = readings1[x].time;\n let time = convertTimestamp(time_raw);\n let close = readings1[x].close;\n let high = readings1[x].high;\n let low = readings1[x].low;\n let open = readings1[x].open;\n let volumefrom = readings1[x].volumefrom;\n let volumeto = readings1[x].volumeto;\n let infoBitcoin = { time, close, high, low, open, volumefrom, volumeto };\n arrayinfoBitcoin.push(infoBitcoin);\n }\n // console.log(arrayinfoBitcoin);\n printdata1(arrayinfoBitcoin);\n })\n .catch(function(error) {\n console.log(error);\n })\n .then(function() {\n // always executed\n });\n} //End of Function", "function getBeerTypes() {\n fetch(\"https://foobar-jearasfix.herokuapp.com/beertypes\")\n .then((res) => res.json())\n .then((data) => {\n setBeerTypes(data);\n });\n }", "function fetchBytag(){\n fetch('./FishEyeData.json')\n .then(res => res.json())\n .then( function (datas) {\n for( data of datas.photographers){\n allPhotographers.push(data);\n let photographer = new Photographer(data.name,data.id,data.city,data.country,data.portrait,data.tagline,data.price,data.tags);\n if( photographer.tags.includes(paramsTag)){\n createCards(photographer);\n }\n photographer.tags.forEach(value => { getTagsElement(value);})\n }\n showTagsNav();\n })\n .catch(error => alert (\"Erreur : \" + error));\n}", "function getBreweryList() {\n var UserCityInput = $(\"#city\").val().trim();\n\n // The encodeURIComponent method replaces any spaces in the city name with the correct URL code for a space (%20). \n // Open Brewery DB doesn't allow spaces in their search terms.\n var queryCity = encodeURIComponent(UserCityInput);\n\n // Define queryURL to includes breweries are in the city inputed by the user, have the type as a micro brewery, and will return up to 25 results. \n var queryURL = \"https://api.openbrewerydb.org/breweries?by_city=\" + queryCity + \"&by_type=micro&per_page=25&page=1\";\n\n // AJAX call to get breweries from the API.\n $.ajax({\n url: queryURL,\n method: \"GET\"\n })\n\n // Promise statement waiting for requested information to be processed and returned from API.\n .then(function (response) {\n\n var breweryCount = 0;\n // Create a for loop to go through the array and pick the breweries that have lat and lng details. \n for (i = 0; i < response.length; i++) {\n\n //Declare variables for each brewery. \n var breweryName = response[i].name;\n var breweryLat = response[i].latitude;\n var breweryLng = response[i].longitude;\n var breweryLatLng = response[i].latitude + \",\" + response[i].longitude;\n var breweryStreet = response[i].street;\n var breweryCity = response[i].city;\n var breweryState = response[i].state;\n var breweryPostalCode = response[i].postal_code;\n var breweryPhone = response[i].phone;\n var breweryWebsite = response[i].website_url;\n var breweryIndex = breweryCount;\n\n // If brewery has lat and lng coordinates (not null) then add their details (as an object) to the breweryList array. \n if (breweryLat !== null) {\n addBreweryToList = {\n name: breweryName,\n lat: breweryLat,\n lng: breweryLng,\n street: breweryStreet,\n city: breweryCity,\n state: breweryState,\n zipCode: breweryPostalCode,\n latlng: breweryLatLng,\n phone: breweryPhone,\n website: breweryWebsite,\n indexInArray: breweryIndex\n }\n\n // Keeps track of number of breweries in list and index of each brewery. \n breweryCount++;\n // Push brewery object to the breweryList array.\n breweryList.push(addBreweryToList);\n }\n\n }\n\n });\n}", "async function getAllReimbursementRequests() {\n try {\n const result = await API.graphql( {\n query: listReimbursements,\n } );\n\n if ( result.data.listReimbursements.items ) {\n const reimbursements = result.data.listReimbursements.items\n\n // generate signed urls for images \n const reqsWithSignedUrls = await Promise.all( reimbursements.map( async el => {\n const signedUrl = await Storage.get( el.imageUrl )\n return { ...el, imageUrl: signedUrl }\n } ) )\n setRequests( reqsWithSignedUrls );\n }\n } catch ( err ) {\n console.log( err );\n }\n }", "function getBurgers(req, res, next) {\n burger.select(\"burgers\", function(data) {\n req.burger = data;\n next();\n })\n}", "fetchBeersByPage (page) {\n return axios.get(api_url + 'beers', { params: { page: page, per_page: per_page } })\n .then(response => response.data)\n }", "async getIngredients({ commit }) {\n try {\n const res = await Api.get('/ingredients')\n commit('setIngredients', res.data)\n } catch (err) {\n return err.response.data\n }\n }", "getListItems(){\n const INGREDIENTS_API_URL = 'https://www.themealdb.com/api/json/v2/8673533/list.php?i=list';\n axios.get(INGREDIENTS_API_URL)\n .then((res) => {\n const apiListItems = [];\n res.data.meals.forEach(item => {\n apiListItems.push(item.strIngredient);\n });\n this.setState({\n listItems:apiListItems,\n });\n });\n }", "function createGenresList(bookISBN, element){\n $.ajax({\n url: '/books/' + bookISBN + '/genres',\n type: 'GET',\n dataType: 'json',\n success: (data) => { \n if(data){ \n for(let i=0; i<data.length; i++){\n element.textContent = element.textContent + data[i].name;\n if(i<data.length-1){ element.textContent = element.textContent + \", \"; }\n }\n }\n }\n });\n}", "getAvailableBanks() {\n return this.api.send('GET', 'banks');\n }", "function atRiskAPICall() {\n\tvar data = {\n\t\t\"data\": {\n\t\t\t\"filters\": [\n\t\t\t\t{\n\t\t\t\t\"fieldName\": \"animals.priority\",\n\t\t\t\t\"operation\": \"lessthan\",\n\t\t\t\t\"criteria\": 1\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t};\n\t$.ajax({\n\t\turl: rgUrl + \"search/available/dogs/haspic?include=pictures&limit=50\",\n\t\tmethod: \"POST\",\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/vnd.api+json\",\n\t\t\t\"Authorization\": rgKey,\n\t\t},\n\t\tdata: JSON.stringify(data)\n\t}).then(function(response) {\n\t\tatRiskPets(response);\n\t});\n}", "findInstances(token) {\n // load preference and make url for fetching books\n let url = hostUrl.url + '/instance-storage/instances?limit=10&query=';\n var len = this.state.resources.length;\n for (i = 0; i < len; i++) {\n if (this.state.resources[i].checked) {\n url = url + \"instanceTypeId=\" + this.state.resources[i].id + '%20or%20';\n }\n }\n len = this.props.navigation.state.params.languages.length;\n for (i = 0; i < len; i++) {\n if (this.props.navigation.state.params.languages[i].checked) {\n url = url + \"languages=\" + this.props.navigation.state.params.languages[i].name + '%20or%20';\n }\n }\n url = url.substring(0, url.length - 8);\n console.log(url);\n\n // get books from folio\n axios.get(url, {\n headers: {\n 'X-Okapi-Tenant': 'diku',\n 'X-Okapi-Token': token,\n },\n })\n .then((response) => {\n if (response.status === 200) {\n const instances = response.data.instances;\n this.setState({\n books: instances,\n });\n } else {\n Alert.alert('Something went wrong 1');\n }\n })\n // fetch identifier-types such as ISBN from folio\n .then(() => {\n const url = hostUrl.url + '/identifier-types?limit=30';\n axios.get(url, {\n headers: {\n 'X-Okapi-Tenant': 'diku',\n 'X-Okapi-Token': token,\n },\n })\n .then((response) => {\n var types = response.data.identifierTypes;\n this.setState({\n idTypes: types,\n });\n })\n .then(() => {\n this.getRenderItems(token)\n })\n })\n }", "getSemesters() {\n return this.#fetchAdvanced(this.#getSemestersURL()).then((responseJSON) => {\n let semesterBOs = SemesterBO.fromJSON(responseJSON);\n return new Promise(function (resolve) {\n resolve(semesterBOs);\n })\n })\n }", "getTaxableEntities () {\n API.TaxableEntities.GetTaxableEntities().then(response => {\n this.setTaxableEntities(response)\n })\n }", "returnGene(index)\n {\n let retGene = this.gens[index];\n return retGene;\n }", "function VirusDiPermukaanBenda(agent) {\n return connectToDatabase().then((connection) => {\n return queryDatabase(connection).then((result) => {\n console.log(result);\n if (result.length === 0) {\n agent.add(\"kata-kunci tidak ditemukan di basis-data\");\n }\n result.map((content) => {\n if (keywords === content.keyword) {\n agent.add(`${content.results}`);\n }\n });\n connection.end();\n });\n });\n }", "function makeBeerList() {\n $scope.allBeers = [];\n $scope.breweries.map(function (brewery, index) {\n if (brewery.beers) {\n brewery.beers.map(function (beer) {\n beer.brewery = brewery.brewery.name;\n $scope.allBeers.push(beer);\n });\n }\n });\n }", "function getNuberOfPokemons(gen) {\r\n fetch(`https://pokeapi.co/api/v2/${gen}`)\r\n .then(result => {\r\n return result.json();\r\n })\r\n .then(data => {\r\n return pokemonsInTheGenerations = data.pokemon_species;\r\n })\r\n .then(pokemonsInTheGenerations => {\r\n gameEl.classList.remove(`hidden`);\r\n getRandomPokemon();\r\n })\r\n .catch(error => {\r\n console.error(`There has been a problem with your fetch operation: ${error}`);\r\n });\r\n}", "function displayBurgers() {\n axios.get('/api/burgers')\n .then(function (response) {\n\n const nonDevouredBurgers = response.data.filter(function(value){\n\n return value.devoured === false;\n\n });\n\n const allBurgers = nonDevouredBurgers.map(burgers => `<div id=\"burgerList\">${burgers.burger_name}</div><button onclick=\"eatBurger(${burgers.id})\">Devour</button>`);\n const burgerListEl = document.getElementById(\"burgerList\");\n const burgerListHTML = allBurgers.join(\"<br>\");\n burgerListEl.innerHTML = burgerListHTML;\n\n const devouredBurgers = response.data.filter(function(value){\n\n return value.devoured === true;\n\n });\n\n const allDevouredBurgers = devouredBurgers.map(burgers => `<div id=\"burgerList\">${burgers.burger_name}</div>`);\n const devouredBurgersIDEl = document.getElementById(\"devouredBurgersID\");\n const devouredBurgerHTML = allDevouredBurgers.join(\"<br>\");\n devouredBurgersIDEl.innerHTML = devouredBurgerHTML;\n\n console.log(allBurgers);\n\n console.log(response);\n console.log(burgerList);\n\n })\n .catch(function (error) {\n console.log(error);\n });\n}", "function InfoCovidProvinsi(agent) {\n return axios({\n method: \"get\",\n url:\n \"https://services5.arcgis.com/VS6HdKS0VfIhv8Ct/arcgis/rest/services/COVID19_Indonesia_per_Provinsi/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&f=json\",\n }).then((data) => {\n var simpan = \"\";\n\n for (var i = 0; i < data.data.features.length - 1; i++) {\n simpan +=\n data.data.features[i].attributes.Provinsi +\n \". Kasus Positif : \" +\n data.data.features[i].attributes.Kasus_Posi +\n \", Kasus Sembuh : \" +\n data.data.features[i].attributes.Kasus_Semb +\n \", Kasus meninggal : \" +\n data.data.features[i].attributes.Kasus_Meni +\n \"\\n\\n\";\n }\n agent.add(\n \"List Data Covid-19 Per Provinsi \" +\n \"\\n\\n\" +\n simpan +\n \"\\n\" +\n \"SUMBER : https://bnpb-inacovid19.hub.arcgis.com/datasets/data-harian-kasus-per-provinsi-covid-19-indonesia/geoservice?selectedAttribute=Provinsi\"\n );\n });\n }", "static requestBiomasSogamoso() {\n return GeoServerAPI.requestWFSBiotablero('Sogamoso_Biomas');\n }", "function getTags(){\n\n let url ='http://bluetag.foteex.com/api/recently-tags'\n\n fetch(url)\n .then(function(response) {\n return response.json();\n })\n .then(function(values) {\n console.log(values);\n values.forEach(el =>{\n el.value = el.tag_value\n })\n // tagify.settings.whitelist = values;\n whitelist = values;\n // if(!tagify ) tagifyInit(values)\n // tagify.dropdown.show.call(tagify, value); // render the suggestions dropdown\n // renderSuggestionsList()\n });\n}", "async function getproductticker ( restapiserver, productid ) {\n\n async function restapirequest ( method, requestpath, body ) { // make rest api request.\n \n // create the prehash string by concatenating required parts of request.\n let timestamp = Date.now() / 1000;\n let prehash = timestamp + method + requestpath;\n if ( body !== undefined ) { prehash = prehash + body; }\n // created the prehash.\n \n // base64 decode the secret.\n let base64decodedsecret = Buffer(secret, 'base64');\n // secret decoded.\n \n // create sha256 hmac with the secret.\n let hmac = crypto.createHmac('sha256',base64decodedsecret);\n // created sha256 hmac.\n \n // sign the require message with the hmac and base64 encode the result.\n let signedmessage = hmac.update(prehash).digest('base64');\n // signed message.\n \n // define coinbase required headers.\n let headers = {\n 'ACCEPT': 'application/json',\n 'CONTENT-TYPE': 'application/json',\n 'CB-ACCESS-KEY': key,\n 'CB-ACCESS-SIGN': signedmessage,\n 'CB-ACCESS-TIMESTAMP': timestamp,\n 'CB-ACCESS-PASSPHRASE': passphrase,\n };\n // defined coinbase required headers. yes... content-type is required.\n // see https://docs.prime.coinbase.com/#requests for more information.\n \n // define request options for http request.\n let requestoptions = { 'method': method, headers };\n if ( body !== undefined ) { requestoptions['body'] = body; }\n // defined request options for http request.\n \n // define url and send request.\n let url = restapiserver + requestpath;\n let response = await fetch(url,requestoptions);\n let json = await response.json();\n // defined url and sent request.\n \n return json;\n \n } // made rest api request.\n\n\n // make request.\n let ticker = await restapirequest ( 'GET', '/products/' + productid + '/ticker' );\n // made request.\n\n // handle response.\n if ( Object.keys(ticker).length === 0 ) { console.log('unable to retrieve information'); }\n else if ( Object.keys(ticker).length === 1 ) { console.log('the Coinbase response is \"' + ticker.message + '\"'); }\n else {\n\n // report ticker.\n return ticker; \n // reported ticker.\n\n }\n // handled response.\n\n}", "function get() {\n const {getBrands} = require('node-car-api');\n const {getModels} = require('node-car-api');\n var allCars = [];\n\n async function getAllBrands () {\n const brands = await getBrands();\n return brands;\n }\n\n async function getBrandModels (brand, callback) {\n console.log('\\nBrand : ' + brand)\n const models = await getModels(brand);\n\n if(models.length == 0) {\n console.log(\"-> 0 result\")\n }\n else {\n models.forEach((model) => {\n console.log(\"-> \" + model.model);\n model.volume = Number(model.volume); //convert volume into a number\n allCars.push(model);\n })\n }\n setTimeout(() => {\n callback();\n }, 500);\n }\n\n getAllBrands().then(function(brands) {\n brands.reduce((promise, item) => {\n return promise.then(() => new Promise((resolve) => {\n getBrandModels(item, resolve)\n }))\n }, Promise.resolve())\n .then(() => {\n //Push each model into elasticsearch\n allCars.forEach((car, index) => {\n setTimeout(() => {\n client.index({\n index: 'caradisiac',\n id: car.uuid,\n type: 'model',\n body: car\n },function(err,resp,status) {\n console.log(resp);\n });\n }, index*5)\n })\n })\n })\n}", "function processGenomeData(data) {\n // Grab the json object and point to it\n species = data;\n\n // Go through each species and make a link within each gene to the species that have that same gene\n species.forEach(function(s,i,species){\n s.className = s.name.toLowerCase();\n s.children = [];\n s.genes.forEach(function(g,ii, genes){\n g.speciesClass = s.className;\n g.connectedNodes = [];\n g.className = getGeneClassName(s.name, g.name);\n s.children.push(g);\n maxGeneLength = Math.max(g.length, maxGeneLength);\n if(!geneLinks[g.name]) {\n geneLinks[g.name] = {name: g.name, orgs:[s], genes:[g]};\n } else {\n geneLinks[g.name].orgs.push(s);\n geneLinks[g.name].genes.push(g);\n }\n });\n });\n\n species.forEach(function(s,i,species){\n s.links = [];\n s.genes.forEach(function(g,ii, genes){\n var gl = geneLinks[g.name];\n if(gl){\n for(var o = 0; o < gl.orgs.length; o++){\n if(gl.orgs[o] != s){\n var link = {type: s.name+\"-\"+ gl.orgs[o].name+\"-link\", source: g, target: gl.genes[o]};\n g.connectedNodes.push(gl.genes[o]);\n s.links.push(link);\n }\n }\n }\n });\n });\n\n var selectSpecies = [species[9], species[6], species[2], species[3]];\n drawGeneChart(selectSpecies);\n\n}", "function GETAll (app) {\n return app.$axios.$get(\n 'oferta'\n ).then(oferta => {\n return imagecontroller.GETAll(app).then(imagen => {\n let imagenes = {}\n oferta.data.forEach(offer => {\n imagenes[offer.IDEN_PUBLICACION] = imagen.imagen.data.find(img => img.IDEN_PUBLICACION === offer.IDEN_PUBLICACION)\n })\n return {\n offers: oferta.data,\n images: imagenes\n }\n })\n }).catch(errors => {\n console.log(errors)\n })\n}", "function createGenresList(bookISBN, element){\n $.ajax({\n url: '/books/' + bookISBN + '/genres',\n type: 'GET',\n dataType: 'json',\n success: (data) => { \n if(data){ \n for(let i=0; i<data.length; i++){\n element.textContent = element.textContent + data[i].value;\n if(i<data.length-1){ element.textContent = element.textContent + \", \"; }\n }\n }\n }\n });\n}", "function retrieveVillagers(nickname, msg) {\n let url = `${process.env.API_ENDPOINT}${villagerEndpoint}`;\n console.log(url);\n return fetch(url).then(res => {\n console.log(\"retrieved villager data\");\n res.json().then(villagers => {\n // if villagers have been retrieved\n if (villagers) {\n console.log(\"i got some villagers!\");\n // read csv file to retrieve ids\n fs.readFile(\"./villagerData.csv\", (err, data) => {\n if (err) console.error(err);\n parse(data, { columns: false, trim: true }, (err, rows) => {\n if (err) console.error(err);\n for (const row of rows) {\n // retrieve each villager's id\n console.log(row);\n if (row[0] !== \"file_name\") {\n let id = row[0];\n let villager = villagers[id];\n console.log(\"line 39, villager: \", villager);\n if (villager) {\n if (villager.personality === \"Jock\") jockVillagers.push(villager);\n else if (villager.personality === \"Uchi\") uchiVillagers.push(villager);\n }\n }\n }\n\n // exit loop\n\n console.log(\"jock villagers amt: \", jockVillagers.length);\n console.log(\"uchi villagers amt: \", uchiVillagers.length);\n\n // pick random jock and uchi villagers\n const jockIndex = Math.floor(Math.random() * jockVillagers.length);\n const uchiIndex = Math.floor(Math.random() * uchiVillagers.length);\n\n // retrieve random villagers\n const jockVillager = jockVillagers[jockIndex];\n const uchiVillager = uchiVillagers[uchiIndex];\n\n console.log(jockVillager);\n console.log(uchiVillager);\n\n // assign them base friendship values\n jockVillager.friendship = 0; uchiVillager.friendship = 0;\n\n // stringify json to add to table\n const initVillagers = [jockVillager, uchiVillager];\n const stringInitVillagers = JSON.stringify(initVillagers);\n\n // update table\n Table.Users.update({ villagers: stringInitVillagers }, { where: { user_id: msg.author.id }}).then(updatedUser => {\n if (updatedUser > 0) {\n // if user could be found to update\n console.log(\"messaging user\");\n initVillagers.forEach(villager => {\n let villagerEmoji = emojis.find(emoji => emoji.name === villager[\"name\"][\"name-USen\"].toLowerCase());\n embed.IMAGE(villager[\"bubble-color\"], titles.VILLAGER_ENTER, `${msg.author.toString()}, **${villager[\"name\"][\"name-USen\"]}** has joined you! ${villagerEmoji.rawEmoji}`, villager.image_uri, msg.channel);\n })\n }\n else {\n embed.error(\"Could not find user to assign villagers to.\", msg.channel);\n }\n }).catch(error => console.error(error));\n });\n });\n }\n else {\n console.log(\"i didn't actually get villagers i am a liar\");\n }\n }).catch(err => console.error(err));\n }).catch(error => console.error(error));\n\n}", "function getBurgers() {\n $.get(\"/api/burger\", function(data) {\n burgers = data;\n initializeRows();\n });\n }", "function bands(input) {\n\n var bandName;\n if (input === undefined) {\n bandName = \"Judah & the Lion\";\n } else {\n bandName = input;\n }\n\n //Setting the Bandsintown API query URL \n var queryURL = \"https://rest.bandsintown.com/artists/\" + bandName + \"/events?app_id=codingbootcamp&tracker_count=10\";\n\n request(queryURL, function (error, response, body) {\n\n if (!error && response.statusCode === 200){\n\n var jsData = JSON.parse(body);\n for (i = 0; i < jsData.length; i++) {\n var dTime = jsData[i].datetime;\n var month = dTime.substring(5, 7);\n var day = dTime.substring(8, 10);\n var year = dTime.substring(0, 4);\n var dateFormat = month + \"-\" + day + \"-\" + year;\n\n logged(\"\\n---------\\n\");\n logged(\"Band:\" + bandName);\n logged(\"Date: \" + dateFormat);\n logged(\"Venue: \" + jsData[i].venue.name);\n logged(\"City: \" + jsData[i].venue.city);\n logged(\"Country: \" + jsData[i].venue.country);\n logged(\"\\n---------\\n\");\n\n }\n }\n });\n}", "function getBankEntity() {\n \n console.info(\"MultiPaymentMethodController:getBankEntity:PopulateEntidadesFromObject\");\n Visualforce.remoting.Manager.invokeAction(\n \"taOrderController.PopulateEntidadesFromObject\", mpmc.financialPromotionsList,\n function(result) {\n console.info('Bancos: ', result.options);\n mpmc.entidadesBancarias = result.options;\n },\n {escape: false} // No escaping, please\n );\n }", "function getBrewery(selectedCity) {\n let city = selectedCity;\n let queryURL = \"https://api.openbrewerydb.org/breweries?by_city=\" + city;\n\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function(response) {\n //print out the results to verify functionality \n console.log(response);\n //adds list of breweries into an array\n //OBDB returns 20 results or less, we only need to grab 5\n for (i = 0; i < response.length; i ++) {\n breweryNameArray.push(response[i].name);\n }\n\n\n // Functions to write to HTML goes HERE\n\n });\n}", "getFromApi() {\n // Defining the forEach iterator function...\n if (!Object.prototype.forEach) {\n Object.defineProperty(Object.prototype, 'forEach', {\n value: function (callback, thisArg) {\n if (this == null) {\n throw new TypeError('Not an object');\n }\n thisArg = thisArg || window;\n for (var key in this) {\n if (this.hasOwnProperty(key)) {\n callback.call(thisArg, this[key], key, this);\n }\n }\n }\n });\n }\n // Getting our currencies from our free api\n fetch(this.url + 'currencies')\n .then((res) => {\n return res.json();\n })\n .then((res) => {\n res.results.forEach((value, key) => {\n this.currencies.push(value);\n });\n })\n .then(() => {\n // Setting data on IndexBD\n this.dbPromise.then((db) => {\n const tx = db.transaction('currencies', 'readwrite');\n const currenciesStore = tx.objectStore('currencies');\n this.currencies.forEach((value, key) => {\n currenciesStore.put(value, value.id);\n })\n return tx.complete;\n }).then(() => {\n this.getFromIDB();\n });\n })\n .catch((error) => {\n this.getFromIDB();\n });\n }", "async index (request, response){\n const ongs = await connection('ongs').select('*');\n \n return response.json(ongs);\n }", "async function getAllBeers(){\n return new Promise(async function (resolve, reject){\n let {pagination, products} = await vinmonopolet.getProducts({facet: vinmonopolet.Facet.Category.BEER})\n while (pagination.hasNext) {\n const response = await pagination.next()\n products = products.concat(response.products)\n pagination = response.pagination\n }\n\n db.beginTransaction(function(err, transaction) {\n db.run(\"UPDATE beers SET active = 0 WHERE active = 1\");\n async function insert(){\n var t0 = Date.now(); //used for time measurement\n for(i=0; i<products.length; i++) {\n var code = products[i].code\n var name = products[i].name\n var type = products[i].mainSubCategory.name\n var price = products[i].price\n var abv = products[i].abv\n var json = jsonData(products[i].url,products[i].containerSize)\n var vmp_data = JSON.stringify(json);\n var isNew = 0\n if(products[i].newProduct == true){\n isNew = 1\n }\n // transaction.run('INSERT OR IGNORE INTO beers VALUES (?,?,?,?,?,?,?,?,?,?,?,?)', [code,name,\"placeholder\",null,null,null,null,null,price,type,abv,vmp_data.toString()])\n transaction.run('INSERT INTO beers VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT (vmp_id) DO UPDATE SET active = 1, new = excluded.new',\n [code,name,\"placeholder\",null,null,null,null,null,price,type,abv,vmp_data,null,null,1,null,isNew])\n }\n //END TRANSACTION\n transaction.commit(function(err) {\n if(err){\n reject(err.message);\n } else {\n var t1 = Date.now();\n resolve(true);\n }\n });\n }\n insert();\n });\n })\n}", "function getBandsInTown(artist) {\n\n var artist = userSearch;\n var bandsInTownUrl = \"https://rest.bandsintown.com/artists/\" + artist + \"/events?app_id=codingbootcamp\"\n\n axios.get(bandsInTownUrl).then(function (response) {\n //console.log(response.data)\n console.log(\"****************************************************\");\n console.log(\"Name of the Band: \" + userSearch + \"\\r\\n\")\n console.log(\"Name of the Venue: \" +response.data[0].venue.name+\"\\r\\n\");\n console.log(\"Venue location: \" + response.data[0].venue.city + \"\\r\\n\");\n console.log(\"Date of the Event :\" + moment(response.data[0].datetime).format('MM/DD/YYYY') + \"\\r\\n\");\n\n //Appends the search results to a text file name \"log\"\n var logConcert = (\"*****Bands In Town Log Entry*****\" + \n \"\\nMusician - \" + userSearch + \n \"\\nVenue - \" + response.data[0].venue.name + \n \"\\nDate -\" + moment(response.data[0].datetime).format('MM/DD/YYYY')+ \"\\n\" + \"\\r\\n\");\n fs.appendFile(\"log.txt\", logConcert, function (err){\n if(err) throw err\n});\n\n })\n}", "function getBeerData() {\n let data = FooBar.getData();\n beers = JSON.parse(data).beertypes;\n //This is for Section 5: \n beerInfo();\n}", "function bands(){\n var queryUrl = \"https://rest.bandsintown.com/artists/\" + title + \"/events?app_id=codingbootcamp\";\n axios.get(queryUrl).then(\n function (response){\n console.log(response.data);\n if (response.data.length == 0){\n console.log(\"sorry try again\");\n return;\n }\n console.log(\"concerts for \" + title);\n for (var i =0 ; i < response.data.length; i++){\n console.log(response.data[i].venue.city + \",\" + (response.data[i].venue.region || response.data[i].venue.country) + \" at \" + response.data[i].venue.name + \" on the following day \" + moment(response.data[i].datetime).format(\"MM/DD/YYYY\"))\n }\n }\n );\n\n}", "function fetchExchangeSymbols() {\n axios.get('https://api.binance.com/api/v1/exchangeInfo')\n .then(response => {\n //filter coins to get only certain quote asset pairs\n let symbols = response.data.symbols.filter(item => {\n if (item.quoteAsset === 'BTC' || item.quoteAsset === 'ETH' || item.quoteAsset === 'USDT') {\n return item\n }\n });\n //badSymbols don't have logos on CMC\n let badSymbols = ['BCHSV', 'BQX', 'HSR', 'IOTA', 'RPX', 'YOYO']\n // filter coins again to remove duplicate baseasset coins\n symbols = symbols.filter((item, i, self) => {\n return i === self.findIndex(t => {\n return t.baseAsset === item.baseAsset && !badSymbols.includes(item.baseAsset);\n })\n })\n\n //save symbol pairs to db for later use\n // need to add promise.all here?\n symbols.map(item => {\n pool.query(`INSERT INTO \"symbols\" (\"symbol\", \"base_asset\", \"quote_asset\")\n VALUES($1, $2, $3);`, [item.symbol, item.baseAsset, item.quoteAsset])\n .then(() => {\n }).catch(err => {\n console.log('error in symbols query:', err);\n res.sendStatus(500);\n })\n })\n\n // baseSymbols used to get logos from CMC\n let baseSymbols = symbols.map(item => {\n return item.baseAsset\n });\n // dont request logos for symbols without them\n baseSymbols = baseSymbols.filter(item => {\n return !badSymbols.includes(item);\n })\n baseSymbols = baseSymbols.join(',');\n axios.get(`https://pro-api.coinmarketcap.com/v1/cryptocurrency/info?CMC_PRO_API_KEY=${process.env.CMC_API_KEY}&symbol=${baseSymbols}`).then(resp => {\n let obj = resp.data.data;\n\n for (let key in obj) {\n pool.query(`UPDATE \"symbols\"\n SET \"logo\" = $1, \"symbol_name\" = $2\n WHERE \"base_asset\" = $3;`, [obj[key].logo, obj[key].name, key])\n .then(result => {\n }).catch(err => {\n console.log('error in insert cmc', err);\n\n })\n }\n res.sendStatus(201)\n }).catch(err => {\n console.log('error in cmc get:', err);\n res.sendStatus(500);\n })\n }).catch(err => {\n console.log('error:', err);\n })\n}", "function fetchBurgers() {\n fetch('http://localhost:3000/burgers')\n .then(function(response) {\n return response.json();\n })\n .then(function(myJson) {\n renderAllBurgers(myJson);\n });\n }", "function getMarketMovers(){\n fetch(baseStockUrl + \"gainers?\" + financialModelAPIKey)\n .then(function(response) {\n if (response.ok) {\n response.json().then(function (data) {\n renderGainers(data.splice(0,3))\n });\n } else {\n console.log(\"Error\" + response.statusText);\n }\n })\n .catch(function (error) {\n console.log(\"unable to connect to financial model\");\n }); \n fetch(baseStockUrl + \"losers?\" + financialModelAPIKey)\n .then(function(response) {\n if (response.ok) {\n response.json().then(function (data) {\n renderLosers(data.splice(0,3))\n });\n } else {\n console.log(\"Error\" + response.statusText);\n }\n })\n .catch(function (error) {\n console.log(\"unable to connect to financial model\");\n }); \n}", "function fetchDataPhotographer(){\n fetch('./FishEyeData.json')\n .then(res => res.json())\n .then( function (datas) {\n for( data of datas.photographers){\n allPhotographers.push(data);\n let photographer = new Photographer(data.name,data.id,data.city,data.country,data.portrait,data.tagline,data.price,data.tags);\n createCards(photographer);\n photographer.tags.forEach(value => { getTagsElement(value);})\n }\n showTagsNav();\n })\n .catch(error => alert (\"Erreur : \" + error));\n}", "devices(req, res) {\n var response = []\n this.remotes.forEach((remote) => {\n var decorated = {};\n decorated.name = remote.name;\n decorated.buttons = [];\n remote.bodes.forEach((code, key) => {\n decorated.buttons.push(key);\n });\n });\n res.send(decorated);\n }", "fetch () {\n return Api().get('signatures/');\n }", "function getSelectedBrand(req, res) {\n Store.Get.GetSelectedBrand(req.params.brandId, (error, stores) => {\n if (error)\n return res.status(500).send(error);\n res.json(stores);\n })\n}", "async function fetchPhotographersTags() {\n\t\tconst request = await axios({\n\t\t\tmethod: \"get\",\n\t\t\turl: \"/api/photographers/tags\",\n\t\t\tbaseURL: \"http://34.251.153.147:5000\",\n\t\t});\n\t\tsetNavTags(request.data);\n\t}", "function getBrands(res, mysql, context, complete){\r\n mysql.pool.query(\"SELECT brand_name, country_of_origin, website FROM brands\", function(error, results, fields){\r\n if(error){\r\n res.write(JSON.stringify(error));\r\n res.end();\r\n }\r\n context.brands = results;\r\n complete();\r\n });\r\n }", "componentDidMount() {\n\n const { loadBrands } = this.props\n\n axios({\n method: 'get',\n url: `http://100.1.253.16:8000/Manufacturer/`,\n headers: { 'Authorization': 'Bearer SDhm0d95wxYxnBzeFIEXL2Fbev14GW' },\n })\n .then(res => {\n console.log(res.data)\n const manufacturerCodes = [];\n res.data.forEach(element => {\n manufacturerCodes.push(element.manufacturerCode);\n })\n loadBrands(manufacturerCodes)\n })\n\n // axios({\n // method: 'get',\n // url: `http://100.1.253.16:8000/OProductlist/?Electrical`,\n // headers: { 'Authorization': 'Bearer SDhm0d95wxYxnBzeFIEXL2Fbev14GW' },\n // })\n // .then(res => {\n // console.log(res.data)\n // const manufacturerCodes = [];\n // res.data.forEach(element => {\n // manufacturerCodes.push(element.manufacturerCode);\n // })\n // loadBrands(manufacturerCodes)\n // })\n\n }", "getAllBenefits ({ commit }) {\n benefitsAPI.getBenefits(benefit => {\n commit(mutationType.SHOW_ALL_BENEFITS, benefit)\n })\n }", "@wire(getBrandList)\n loadBrandList({data,error}){\n \n if(data){\n this.brandListToDisplay = [{value : '', label:'Select'}];\n\n data.forEach(element => {\n\n const brand = {};\n \n brand.label = element.Name;\n \n // console.log(\"Enterd brandListToDisplay label\",brand.label);\n \n brand.value = element.Id;\n \n this.brandListToDisplay.push(brand);\n // console.log(\"Enterd Brand list\",JSON.stringify(this.brandListToDisplay));\n });\n }\n else if(error){\n console.log('Error',error.body.message , 'error');\n }\n }", "function getBreweries(noGeo) {\n\n $scope.breweries = [];\n $scope.addBeerForm = [];\n $scope.allBeers = [];\n\n\n // TODO ERROR HANDLING\n\n // Setup the loader\n $ionicLoading.show({\n content: 'Loading',\n animation: 'fade-in',\n });\n\n if (noGeo) {\n console.log(\"Abfrage ohne Ortung\");\n // Cancel beer search request\n $rootScope.canceled = true;\n\n // Reset beer search request\n $timeout(function () {\n $rootScope.canceled = false;\n },1000);\n\n breweryDB.getBreweriesNearCoordinates($rootScope.userSettings).then(result => {\n $scope.breweries = result;\n\n $ionicLoading.hide();\n\n if (result) {\n $scope.noData = false;\n\n // Resize\n $ionicScrollDelegate.resize();\n\n // Update beer array, if beer screen is shown\n if ($rootScope.currentListView == \"Biere\") {\n beeroundService.getBeerRatingByBrewerielist(result).then(newList => {\n $scope.breweries = newList;\n makeBeerList();\n })\n }\n }\n\n else {\n\n let alertPopup = $ionicPopup.alert({\n title: 'Suche nicht erfolgreich!',\n template: 'Bitte passe deine Suchanfrage an. '\n });\n\n alertPopup.then(function (res) {\n $scope.noData = true;\n });\n }\n\n }, err => {\n console.log(\"No Data found\");\n $ionicLoading.hide();\n\n let alertPopup = $ionicPopup.alert({\n title: 'Suche nicht erfolgreich!',\n template: 'Bitte passe deine Suchanfrage an. '\n });\n\n alertPopup.then(function (res) {\n $scope.noData = true;\n });\n });\n }\n else {\n // Don't wait till death\n let posOptions = {timeout: 15000, enableHighAccuracy: false};\n\n\n // Geolocation\n $cordovaGeolocation\n .getCurrentPosition(posOptions)\n .then(function (position) {\n\n $rootScope.userSettings = {\n lat: position.coords.latitude,\n lng: position.coords.longitude,\n radius: 30 // standard\n };\n\n $http.get('https://nominatim.openstreetmap.org/reverse?lat=' + $rootScope.userSettings.lat + '&lon=' + $rootScope.userSettings.lng + '&format=json').then(result => {\n $rootScope.location = result.data.address;\n\n // GET BREWERIES\n breweryDB.getBreweriesNearCoordinates($rootScope.userSettings).then(result => {\n\n $scope.breweries = result;\n $ionicLoading.hide();\n\n // Update beer array, if beer screen is shown\n if ($rootScope.currentListView == \"Biere\") {\n beeroundService.getBeerRatingByBrewerielist($scope.breweries).then(result => {\n $scope.breweries = result;\n makeBeerList();\n })\n }\n\n // Resize\n $ionicScrollDelegate.resize();\n\n }, function () {\n $ionicLoading.hide();\n\n let alertPopup = $ionicPopup.alert({\n title: 'Keine Biere gefunden. Versuche es erneut!',\n });\n });\n }, function (err) {\n $ionicLoading.hide();\n\n $scope.connectionError = true;\n\n\n let alertPopup = $ionicPopup.alert({\n title: 'Bitte überprüfe deine Verbindungen!',\n });\n });\n\n\n },function () {\n\n // NO GEO Access\n console.log(\"no Access\");\n $rootScope.userSettings = {\n lat: \"49.35357\",\n lng: \"9.15106\",\n radius: 30\n };\n\n // GET BREWERIES\n breweryDB.getBreweriesNearCoordinates($rootScope.userSettings).then(result => {\n\n $scope.breweries = result;\n $ionicLoading.hide();\n\n // Update beer array, if beer screen is shown\n if ($rootScope.currentListView == \"Biere\") {\n beeroundService.getBeerRatingByBrewerielist($scope.breweries).then(result => {\n $scope.breweries = result;\n makeBeerList();\n })\n }\n\n // Resize\n $ionicScrollDelegate.resize();\n\n }, function () {\n $ionicLoading.hide();\n\n let alertPopup = $ionicPopup.alert({\n title: 'Keine Biere gefunden. Versuche es erneut!',\n });\n });\n\n let alertPopup = $ionicPopup.alert({\n title: 'Ortung nicht erlaubt!',\n template: 'Bitte erlaube Beeround, auf deinen Standort zuzugreifen. Als Standort wurde nun Mosbach gesetzt.',\n\n });})\n }\n }", "searchGenes() {\n this.setState({molecularOptions: [], mutationOptions: []});\n let geneList = this.state.geneListString.replace(/(\\r\\n\\t|\\n|\\r\\t)/gm, \"\").toUpperCase().split(\" \");\n geneList.forEach(function (d, i) {\n if (d.includes(\"ORF\")) {\n geneList[i] = d.replace(\"ORF\", \"orf\")\n }\n });\n // check for which profiles data is available for the entered HUGOSymbols\n this.props.rootStore.molProfileMapping.getDataContainingProfiles(geneList, dataProfiles => {\n this.props.rootStore.availableProfiles.forEach(d => {\n if (d.molecularAlterationType === \"MUTATION_EXTENDED\") {\n this.updateMutationCheckBoxOptions(dataProfiles.includes(d.molecularProfileId));\n }\n else {\n this.updateMolecularCheckBoxOptions(d.molecularProfileId, dataProfiles.includes(d.molecularProfileId));\n }\n });\n });\n }", "async function fetchBreweries(page) {\n checkBreweryAPIConfiguration();\n\n const apiUrl = `${BREWERY_DB.API_ENDPOINT}/breweries?key=${BREWERY_DB.API_KEY}&p=${page}&withAlternateNames=Y&withLocations=Y`;\n return rp({ uri: apiUrl, json: true });\n}", "fetchBestSellers () {\n axios.get(`${url_rec}/best`)\n .then((res) => {\n var products = res.data.output\n this.setBestSellers(products)\n })\n .catch((error) => {\n console.error(error.message)\n })\n }", "async index(req, res) {\n let iems = null\n const search = req.query.search\n\n try {\n if (search) {\n iems = await Iem.findAll({\n where: {\n [Op.or]: ['brand', 'name'].map((key) => ({\n [key]: { [Op.like]: `%${search}%` }\n }))\n }\n })\n } else {\n iems = await Iem.findAll()\n }\n\n iems = iems.map((iem) => ({\n id: iem.id,\n brand: iem.brand,\n name: iem.name,\n price: iem.price,\n imageUrl: iem.imageUrl\n }))\n\n res.send(iems)\n } catch (err) {\n res.status(500).send({\n error: 'Error fetching IEMs'\n })\n }\n }", "function getBuList() {\n $http.get(ApiUrlPrefix + \"fetchbusinessunitmasterlist\").success(function (data) {\n $scope.getBuList = data;\n });\n }", "getMyGenresFromIndex() {\n\t\tvar query = `\n\t\tSELECT * FROM genres\n\t\t\tLEFT JOIN json USING (json_id)\n\t\t\tWHERE directory=\"data/users/${userAuthAddress}\"\n\t\t\tORDER BY date_added ASC\n\t\t`;\n\t\n\t\treturn this.cmdp(\"dbQuery\", [query]);\n\t}", "function tickers(){\n request(dataIndo, function(error, response, body){\n // handle errors if any\n if(error){\n console.log(error);\n } else {\n // parse json\n let data = JSON.parse(body);\n // get last price\n indo={\n meninggal : data[0].meninggal,\n sembuh : data[0].sembuh,\n positif : data[0].positif\n }\n }\n });\n\n request(dataProv, function(error, response, body){\n if(error){\n console.log(error);\n } else {\n let dataProv = JSON.parse(body);\n prov = (dataProv)\n //console.log(dataProv);\n }\n });\n}", "getAll(request, response) {\n _database.collection(gifCollection).find({}).toArray(function(err, data) {\n response.json(data);\n });\n }", "function getAllBerriesCallback(response){\n\tconsole.log(response.count);\n\tresponse.results.forEach(function(berry){\n\t\tconsole.log(berry.name);\n\t})\n}", "function getSimilarBooksJSON(related_items,eventCallback) {\r\n\r\n\tvar list_of_books = [];\r\n\tvar list_of_titles = [];\r\n\tvar rank_count = 1;\r\n\tvar completed_requests = 0;\r\n\tvar getlength = related_items.length\r\n\r\n\tif (related_items.length > 5){\r\n\t\tgetlength = 5;\r\n\t}\r\n\r\n\tfor (var i = 0,length = getlength; i < length; i++ ) {\r\n\t\r\n\t\trequest.get({\r\n\t\t\turl: \"https://www.googleapis.com/books/v1/volumes?q=\" + related_items[i].ASIN +\"&orderBy=relevance&key=APIKEY\"\r\n\t\t\t}, function(err, response, body) {\r\n\t\t\t\t\r\n\r\n\t\t\tif (body){\r\n\t\t\t\ttry{\r\n\t\t\t\t\tbody = JSON.parse(body);\r\n\t\t\t\t}catch(e){\r\n\t\t\t\t\tvar empty_array = [];\r\n\t\t\t\t\teventCallback(empty_array);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\r\n\t\t\t\t//console.log(body)\r\n\t\t\t\tcompleted_requests++;\r\n\t\t\t\tvar book_details={};\r\n\t\t\t\tvar title;\r\n\r\n\t\t\t\ttitle = body.items[0].volumeInfo.title ;\r\n\t\t\t\tif (list_of_titles.indexOf(title)> 0) { \t\t\t\t\r\n\t\t\t\t\treturn; \r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (typeof body.items[0].volumeInfo.authors=== 'undefined') { \t\t\t\t\r\n\t\t\t\t\treturn; \r\n\t\t\t\t}\r\n\r\n\t\t\t\tlist_of_titles[i] = title;\r\n\t\t\t\tbook_details.title = title;\t\r\n\t\t\t\tbook_details.titleupper = title.toUpperCase();\r\n\r\n\t\t\t\tvar author_string = \"\"; \r\n\t\t\t\tvar author_array = body.items[0].volumeInfo.authors;\r\n\t\t\t\t\r\n\t\t\t\tfor (var k = 0, klength = author_array.length; k < klength; k++){\r\n\t\t\t\t\tauthor_string = author_string + author_array[k] + \" and \" ;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tauthor_string = author_string.slice(0, -5);\r\n\t\t\t\tbook_details.author = author_string;\t\t\t\t\r\n\t\t\t\tbook_details.contributor = \"by \" + author_string;\r\n\r\n\t\t\t\tvar isbns_string = \"\";\r\n\t\t\t\tvar isbns_array = body.items[0].volumeInfo.industryIdentifiers;\r\n\r\n\t\t\t\tfor (var j = 0, jlength = isbns_array.length; j < jlength; j++){\r\n\t\t\t\t\tif (isbns_array[j].type === 'ISBN_10'){\r\n\t\t\t\t\t\tbook_details.primary_isbn10 = isbns_array[j].identifier;\r\n\t\t\t\t\t\tisbns_string = isbns_string + isbns_array[j].identifier + ',';\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tbook_details.primary_isbn13 = isbns_array[j].identifier;\r\n\t\t\t\t\t\tisbns_string = isbns_string + isbns_array[j].identifier + ',';\r\n\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tisbns_string = isbns_string.slice(0, -1);\r\n\t\t\t\tbook_details.isbns_string = isbns_string;\r\n\r\n\t\t\t\tvar description = \". No description available.\";\r\n\t\t\t\t\t\t\r\n\t\t\t\tif (typeof(body.items[0].searchInfo) !=='undefined'){\r\n\t\t\t\t\tif (typeof(body.items[0].searchInfo.textSnippet) !=='undefined'){\r\n\t\t\t\t\t\tdescription = \". Here's a brief description of the book, \" + body.items[0].searchInfo.textSnippet;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbook_details.description = book_details.title + description;\r\n\r\n\t\t\t\tbook_details.description = book_details.title + \", \" + book_details.contributor + description;\r\n\t\t\t\t\t\r\n\r\n\t\t\t\tbook_details.rank = rank_count;\r\n\t\t\t\tlist_of_books[rank_count-1] = book_details;\r\n\t\t\t\trank_count++;\r\n\r\n\t\t\t\tconsole.log(\"book details title:\" + book_details.title);\r\n\t\t\t\tconsole.log(\"list of books count:\" + list_of_books.length);\r\n\r\n\t\t\t\tconsole.log(completed_requests);\r\n\t\t\t\tconsole.log(getlength);\r\n\t\t\t\t\tif (completed_requests === getlength) {\r\n\t\t\t\t\t\t// All download done, process responses array\r\n\t\t\t\t\t\tstringify(list_of_books);\r\n\r\n\t\t\t\t\t\teventCallback(list_of_books);\r\n\t\t\t\t\t}\r\n\t\t\t\r\n\t\t\t}).on('err', function (e) {\r\n \tconsole.log(\"Got error: \", e);}\r\n\t\t\r\n\t\t\r\n\t\t);\r\n\t}\r\n\r\n}", "getGenresFromIndex() {\n\t\tvar query = `\n\t\tSELECT * FROM genres\n\t\t\tLEFT JOIN json USING (json_id)\n\t\t\tORDER BY date_added ASC\n\t\t`;\n\t\n\t\treturn this.cmdp(\"dbQuery\", [query]);\n\t}", "getAllBeers() {\n console.log('get beers');\n fetch('/api/beers/')\n .then(res => res.json())\n .then((res) => {\n this.setState({\n beersData: res.data,\n beersLoaded: true,\n });\n console.log({ 'Beers Api': res.data});\n })\n .catch(err => console.log(err));\n }", "function fetchGenreList() {\n // const params=new URLSearchParams()\n // params.set('userID',)\n fetch('./api/genre')\n .then(response => response.json())\n .then(genres => {\n populateDropdown(selection1, genres);\n populateDropdown(selection2, genres);\n populateDropdown(selection3, genres);\n })\n}", "function listMakes() {\r\n var requestData = {};\r\n requestData.langCode = \"en\";\r\n gapi.client.vehicleApi.listTypes(requestData).execute(function(response) {\r\n if (!response.code) {\r\n console.log(response);\r\n response.items = response.items || [];\r\n var result ='';\r\n for (var i=0;i<response.items.length;i++) {\r\n result = result + openRow + openColumn + '<img src=\"' + response.items[i].image + '\" style=\"height: 50px\"/>' + closeColumn\r\n + openColumn + response.items[i].name + closeColumn\r\n + openColumn + response.items[i].country + closeColumn;\r\n result = result + closeRow;\r\n }\r\n document.getElementById('make-table').innerHTML = result;\r\n }\r\n });\r\n}", "async fetchBeers({ commit, state }, pageNumber) {\n const beers = state.indexedPages[pageNumber] ?? await this.$api.getBeers(pageNumber).then(res =>\n res.json()\n )\n commit('addPage', { pageNumber, beers });\n }", "async model(params){\n // alert(params.gemeente)\n // return this.store.query('r', params.subriddit);\n // return this.store.findRecord('population2021', `${params.gemeente}`);\n const response = await fetch(`/api/population2021.json`).then(\n response => response.json().then((data,error) => {\n if(error){\n console.log(error)\n }else{\n console.log(data);\n return data\n }\n }));\n return response\n // alert(gemeente_id)\n }", "function getFavorites() {\n if (localStorage.getItem('book') === null) {\n } else {\n storageArr = storageArr.concat(JSON.parse(localStorage.getItem('book')));\n console.log(storageArr);\n\n for (var i = 0; i < storageArr.length; i++) {\n var requestUrl = `https://www.googleapis.com/books/v1/volumes?q=isbn:${storageArr[i]}`;\n\n fetch(requestUrl)\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n console.log(data);\n var bookCard = document.createElement('li');\n bookCard.setAttribute('class', 'card cell medium-2 small-4 result-card');\n\n var linkBook = document.createElement('a');\n linkBook.href = data.items[0].volumeInfo.infoLink;\n linkBook.setAttribute('target', '_blank');\n bookCard.append(linkBook);\n\n console.log(data.items[0].volumeInfo.imageLinks.thumbnail);\n var thumbImg = document.createElement('img');\n thumbImg.setAttribute('alt', `${data.items[0].volumeInfo.title}`)\n thumbImg.src = data.items[0].volumeInfo.imageLinks.thumbnail;\n linkBook.append(thumbImg);\n\n var favoriteEl = document.createElement('span');\n favoriteEl.setAttribute('class', 'label warning');\n favoriteEl.textContent = 'Remove';\n bookCard.append(favoriteEl);\n\n var isbnNumber = document.createElement('span');\n isbnNumber.textContent = data.items[0].volumeInfo.industryIdentifiers[0].identifier;\n isbnNumber.setAttribute('style', 'display: none');\n bookCard.append(isbnNumber);\n\n favoriteMenu.append(bookCard);\n })\n }\n }\n}", "async function fetchGenre() {\n let response = await fetch(props.baseUrl + \"genres\", {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Cache-Control\": \"no-cache\",\n }\n })\n response = await response.json();\n setGenres(response.genres);\n }", "async index(request, response) {\n const ongs = await conection('ongs').select('*');\n \n return response.json(ongs);\n }", "async getABI(){\n const ApiKey='ZPRBBU2E6Z4QMEXPI7BWMCMVK7I6XZ6ZXE';\n fetch('https://api-rinkeby.etherscan.io/api?module=contract&action=getsourcecode&address='+this.props.Address+'&apikey='+ApiKey)\n .then(res =>res.json())\n .then((data)=> { \n this.setState({electionABI:JSON.parse(data.result[0].ABI)})\n }).catch(console.log)\n }", "function getSkiddleGigs(name) {\n axios.get(`https://cors-anywhere.herokuapp.com/www.skiddle.com/api/v1/artists/?api_key=${process.env.API_KEY}&name=${name}`)\n .then(resp => {\n const skiddleId = resp.data.results[0].id\n axios.get(`https://cors-anywhere.herokuapp.com/www.skiddle.com/api/v1/events/search/?api_key=${process.env.API_KEY}&a=${skiddleId}&country=GB`)\n .then(resp => {\n const data = resp.data.results\n const test = resp.data.results.map((gig) => {\n return gig.venue.town\n })\n\n const cities = test.filter((a, b) => test.indexOf(a) === b)\n const newData = []\n\n for (let i = 0; i < cities.length; i++) {\n newData.push({ [cities[i]]: [] })\n for (let j = 0; j < data.length; j++) {\n if (cities[i] === data[j].venue.town) {\n newData[i][cities[i]].push(data[j])\n }\n }\n }\n setCities(cities)\n setGigs(newData)\n })\n })\n }" ]
[ "0.5867201", "0.51226395", "0.50003886", "0.49300683", "0.4908202", "0.48789683", "0.4871747", "0.4869367", "0.48645556", "0.4862381", "0.48595357", "0.48576158", "0.48504704", "0.48414898", "0.4810649", "0.47929314", "0.47552264", "0.47494516", "0.47177842", "0.47174838", "0.47115743", "0.47039446", "0.46942514", "0.46937376", "0.46935037", "0.46847236", "0.46749407", "0.4673482", "0.46638924", "0.46630841", "0.46613824", "0.46432707", "0.46396238", "0.4635073", "0.46350443", "0.46327525", "0.46315777", "0.46032116", "0.4595143", "0.45840338", "0.4578383", "0.4576939", "0.4551882", "0.45491475", "0.45470065", "0.4541115", "0.45363796", "0.45356768", "0.45349532", "0.453392", "0.4530688", "0.4527227", "0.45241526", "0.45181704", "0.45121983", "0.45005637", "0.44994426", "0.44978836", "0.4496174", "0.4494322", "0.4494058", "0.4491095", "0.44905853", "0.44896385", "0.44892663", "0.4486158", "0.44820523", "0.44812799", "0.44778854", "0.44765422", "0.44753587", "0.44739866", "0.44730273", "0.4471611", "0.446913", "0.44687933", "0.44674024", "0.44616327", "0.44580078", "0.445332", "0.4448481", "0.44466144", "0.4445941", "0.44379652", "0.44366378", "0.44335213", "0.4432608", "0.44302", "0.442995", "0.44142896", "0.4413565", "0.44110882", "0.4407159", "0.44066727", "0.44013745", "0.44013083", "0.4399219", "0.43933886", "0.4391685", "0.43909255" ]
0.4802124
15
Updates state with data that is needed to render expression profile plot, box plot and slider for a given gene
async getPlotData(gene, score, dataset) { try { const { retrieveGeneData } = this; const synergyArray = await retrieveGeneData(gene, dataset); // *************************** // Sets plot range // *************************** const paddingPercent = 0.05; let lowestFPKM = 0; let highestFPKM = 0; let lowestSynScore = 0; let highestSynScore = 0; synergyArray.forEach((item) => { if (item.fpkm < lowestFPKM) lowestFPKM = item.fpkm; if (item.fpkm > highestFPKM) highestFPKM = item.fpkm; if (item[score] < lowestSynScore) lowestSynScore = item[score]; if (item[score] > highestSynScore) highestSynScore = item[score]; }); const rangeFPKM = highestFPKM - lowestFPKM; let xRange; if (rangeFPKM) { xRange = [ lowestFPKM - rangeFPKM * paddingPercent, highestFPKM + rangeFPKM * paddingPercent, ]; } else { xRange = [-1, 1]; } const rangeSynScore = highestSynScore - lowestSynScore; const yRange = [ lowestSynScore - rangeSynScore * paddingPercent, highestSynScore + rangeSynScore * paddingPercent, ]; const synScoreArray = synergyArray.map(item => item[score]); const boxPlotData = synergyArray.map(item => ({ score: item[score], fpkm: item.fpkm })); synScoreArray.sort((a, b) => a - b); boxPlotData.sort((a, b) => a.score - b.score); const defaultThreshold = calculateThreshold(synScoreArray); this.setState({ selectedBiomarker: gene, selectedDataset: dataset, selectedScore: score, loadingTable: false, loadingGraph: false, biomarkerData: synergyArray, xRange, yRange, defaultThreshold, confirmedThreshold: null, boxPlotData, biomarkersAvailable: true, }); } catch (err) { console.log(err); this.setState({ loadingGraph: false, biomarkersAvailable: true, }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Changed(newSample) {\n// Fetch new data each time a new sample is selected\nbuildPlot(newSample);\noptionChanged(newSample);\n}", "addGenes() {\n const mappingTypes = this.state.mutationOptions.filter(d => d.selected).map(d => d.id);\n const profiles = this.state.molecularOptions.filter(d => d.selected).map(d => d.profile);\n const variables = this.props.rootStore.molProfileMapping.getMultipleProfiles(profiles, mappingTypes);\n variables.forEach(variable => {\n this.props.variableManagerStore.addVariableToBeDisplayed(variable);\n this.props.variableManagerStore.toggleSelected(variable.id);\n });\n this.setState({geneListString: \"\", showCheckBoxOptions: false});\n }", "function optionChanged(state) {\n // console.log(state);\n buildPlot(state);\n insChart(state);\n}", "addGenes() {\n this.getOnDemandVariables().forEach((variable) => {\n this.props.variableManagerStore.addVariableToBeDisplayed(variable);\n this.props.variableManagerStore.toggleSelected(variable.id);\n });\n this.geneListString = '';\n this.showAvailableData = false;\n }", "function updateViolinChart(gene) {\n console.log('updateViolinChart was called with gene: ', gene);\n violinPlot.updateViolinPlot(gene);\n }", "function optionChanged(newID) {\n buildtable(newID);\n plotbar(newID);\n plotbubble(newID);\n buildGauge(newID);\n \n}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange();\n this.handleAChange();\n this.handleidCapture();\n this.handleimgCapture();\n this.handleConfigChange();\n this.idcaptureVal();\n this.imgcaptureVal();\n }", "function buildMetadata(state){\n d3.json(\"prices.json\").then((data) => {\n var priceData = data.data;\n var stateName = data.index;\n var cptCode = data.columns;\n // sets stateIndex equal to the index number of the state being passed in. this allows us to access the correct price data. \n var stateIndex = stateName.indexOf(state);\n\n var PANEL = d3.select(\"#sample-metadata\");\n //ensures contents are cleared when another id number is chosen\n PANEL.html(\"\");\n\n //combines cptCode array with priceData array at correct index \n var priceInfo = cptCode.concat(priceData[stateIndex]);\n\n var newArray = priceData[stateIndex];\n\n //maps cptCode to pricing info for correct state \n var priceArray = cptCode.map((e, i) => e + newArray[i]);\n\n //updates panel with pricing info\n priceArray.forEach((price) => {\n PANEL.append(\"h6\").text(price)\n });\n });\n}", "function nextState(){\n for (var i = 3; i<=91; i++){\n $(\"#MathJax-Span-\"+i).css(\"color\",\"black\"); \n }\n var points = model.get_current_state_array();\n var pointdict = model.get_current_state();\n var numpoints = points.length;\n var newstate = [];\n \n state++;\n updateGraph();\n \n $(\".next-state\").attr(\"disabled\",false);\n $(\".previous-state\").attr(\"disabled\",false);\n \n $(\".span7\").append(\"<a name='bottom'><div class='chart-container chart\"+state+\"'></div></a>\");\n setupGraph(state);\n updateTopBubbles(state);\n setupSideLabels(state);\n $(\".span7\").append(\"<div class='row-fluid continue-row'><button class='arrow-transition btn btn-large'>See Transition Model</button></div>\");\n $(\".arrow-transition\").css(\"visibility\",\"visible\");\n $(\".arrow-transition\").on(\"click\",function(){\n $(this).closest('.row-fluid').remove();\n $('.num-label'+state).remove(); $('.first-prob'+state).remove(); //to remove the duplicate\n firstupdate(state);\n updateFirstInputRow(\"rest\");\n })\n }", "searchGenes() {\n this.setState({molecularOptions: [], mutationOptions: []});\n let geneList = this.state.geneListString.replace(/(\\r\\n\\t|\\n|\\r\\t)/gm, \"\").toUpperCase().split(\" \");\n geneList.forEach(function (d, i) {\n if (d.includes(\"ORF\")) {\n geneList[i] = d.replace(\"ORF\", \"orf\")\n }\n });\n // check for which profiles data is available for the entered HUGOSymbols\n this.props.rootStore.molProfileMapping.getDataContainingProfiles(geneList, dataProfiles => {\n this.props.rootStore.availableProfiles.forEach(d => {\n if (d.molecularAlterationType === \"MUTATION_EXTENDED\") {\n this.updateMutationCheckBoxOptions(dataProfiles.includes(d.molecularProfileId));\n }\n else {\n this.updateMolecularCheckBoxOptions(d.molecularProfileId, dataProfiles.includes(d.molecularProfileId));\n }\n });\n });\n }", "function optionChanged(sample){\r\n \r\n buildplot(sample);\r\n \r\n \r\n }", "function setInfobox(props){\r\n \r\n var infoValue, i = infoValue = 0;\r\n do {\r\n var infoValue = parseFloat(props[expressed]).toFixed(i);\r\n i++;\r\n }\r\n while (infoValue <= 0);\r\n \r\n if (isNaN(infoValue)) {\r\n var infoValue, infoAcres = infoValue = 0;\r\n } else {\r\n var infoValue = comma(parseFloat(props[expressed]).toFixed(i));\r\n var infoAcres = comma(props[displayed]);\r\n }\r\n\r\n var infoDesc2 = \"Acreage \" + drop2Choice;\r\n var infoDesc1 = \"Total Acreage of \" + drop1Choice;\r\n \r\n //label content\r\n var infoAttribute1 = '<h2><span id=\"inf\">' + infoDesc1 + ': </span> ' + infoAcres + '</h2>';\r\n var infoAttribute2 = '<h2><span id=\"inf\">' + infoDesc2 + ': </span> ' + infoValue + '</h2>';\r\n var stateName = '<h2>' + props.geo_name + '</h2>';\r\n \r\n //create info label div\r\n var infolabel = d3.select(\"body\")\r\n .append(\"div\")\r\n .attr(\"class\", \"infolabel\")\r\n .attr(\"id\", props.geo_id + \"_label\")\r\n .html(stateName);\r\n\r\n var stateName = infolabel.append(\"div\")\r\n .attr(\"class\", \"infogoo\")\r\n .html(infoAttribute1);\r\n var stateName = infolabel.append(\"div\")\r\n .attr(\"class\", \"infogoo\")\r\n .html(infoAttribute2);\r\n }", "function optionChanged(newsample) {\n buildPlots(newsample);\n buildMetadataInfo(newsample);\n}", "updateValues() {\n const { selectedkey, cdata, onEdit } = this.props;\n let currentcomponent = { ...cdata[selectedkey] };\n let newvalues = getValues(\n this.CurveSelect.value,\n parseFloat(this.totalEnergyEntry.value.replace(\",\", \".\")),\n currentcomponent.values\n );\n currentcomponent.values = newvalues;\n onEdit(selectedkey, currentcomponent);\n }", "function optionChanged(newData){\n sample_metadata(newData);\n plotData(newData);\n}", "function VisGene(u, w, pn, dataDir) {\n if(arguments.callee.instance){\n return arguments.callee.instance;\n }\n arguments.callee.instance = this;\n // this.showWarning = false;\n this.isApplet = false;\n this.base = u;\n this.context = null;\n this.showWarning = w;\n this.pluginName = pn;\n this.dataDir = dataDir;\n\n this.VERSION = \"0.0.2\";\n this.notice = \"Copyright Chris Poultney 2004, ported by Radhika Mattoo and Dennis McDaid 2016\";\n this.DEFAULT_DATA_DIR = null;\n\n this.init = function(){\n // Potentially implement.\n\n // console.log(this.extAttrib);\n // if (this.dataDir === null) {\n // dataDir = this.DEFAULT_DATA_DIR;\n // }\n // if (!this.dataDir.endsWith(\"/\")) {\n // this.dataDir += \"/\"\n // }\n\n //TODO: Not sure what form set up will be like, will def have to parseData\n //more than one form element for dataU property\n // this.dataU = document.getElementById(/*TODO: Something Here. */).value;\n this.dataU = \"./\";\n\n // prepare data source.\n var statsF = null; //TODO: See if this works.\n this.src = new DataSource(this.dataU);\n this.geneList = new GeneList();\n\n // buildGUI\n // this.desk = null; // Should be new JDesktopPane\n // this.setContentpoane(this.desk);\n var sungearObj = (function(){\n return require('sungear');\n }());\n\n this.gear = new sungearObj.Sungear(this.geneList, statsF);\n\n };\n\n this.run = function(){\n // Load the passed data file, if there is one.\n if (this.extAttrib !== null && this.exAttrb.get(\"sungearU\") !== null) {\n this.src.setAttributes(this.extAttrib, this.dataU);\n }\n };\n this.destroyAll = function (){\n var c = p.getComponents();\n for (var i = 0; i < c.length; i++) {\n if (c[i] instanceof Container) {\n destroyAll(c[i]);\n }\n }\n p.removeAll();\n if (p instanceof Window) {\n p.dispose();\n }\n // TODO: JInternalFrame MAYBE\n };\n\n this.destroy = function(){\n console.log(\"destory enter\");\n // this.super.destroy();\n this.topFrame = null;\n this.destroyAll(this.getContentPane());\n this.desk = null;\n this.l1.cleanup();\n this.l1 = null;\n this.geneF = null;\n this.sungearM = null;\n this.controlM = null;\n this.geneM = null;\n this.gear.cleanup();\n this.gear = null;\n this.sungearF = null;\n this.go.cleanup();\n this.gear = null;\n this.go = null;\n this.goF = null;\n this.goM = null;\n this.control.cleanup();\n this.control = null;\n this.export.cleanup();\n this.export = null;\n this.controlF = null;\n // this.geneLightsF = null;\n this.src.cleanup();\n this.src = null;\n this.geneList.cleanup();\n this.geneList = null;\n console.log(\"CSPgenes done\");\n };\n\n this.openFile = function(attrib){\n console.log(\"data file: \" + attrib.get(\"sungearU\"));\n var f = null; // should be JOptionPane ???\n var status = new StatusDialog(f, this);\n var t = new LoadThread(attrib, status);\n t.start();\n status.setVisible(true);\n if (t.getException() !== null) {\n console.log(t.getException);\n } else {\n var iL = attrib.get(\"itemsLabel\", \"items\");\n var cL = attrib.get(\"categoriesLabel\", \"categories\");\n // TODO: Frame shit.\n var r = this.src.getReader();\n if (this.showWarning && r.missingGenes.length + r.dupGenes.length > 0) {\n var msg = \"There are inconsistencies in this data file:\";\n if (r.missingGenes.length > 0) {\n msg += \"\\n\" + r.missingGenes.length + \" input \" + iL + \" unknown to Sungear have been ignored.\";\n }\n if (r.dupGenes.length > 0) {\n msg += \"\\n\" + r.dupGenes.length + \" \" + iL + \" duplicated in the input file; only the first occurrence of each has been used.\";\n }\n msg += \"\\nThis will not prevent Sungear from running, but you may want to resolve these issues.\";\n msg += \"\\nSee Help | File Info for details about the \" + iL + \" involved.\";\n console.log(msg); // TODO: Display this somewhere relevant.s\n }\n }\n };\n\n this.capFirst = function(s){\n if (s.length > 1) {\n return s[0].toUpperCase() + s.substring(1);\n } else if (s.length == 1) {\n return s.toUpperCase();\n } else {\n return s;\n }\n };\n\n this.showAbout = function(){\n var f = \"\";// document.getElementById(/*TODO: Something Here. */);\n try {\n var aboutU; // TODO: Fix this.\n var text = \"\";//document.getElementById(/*TODO: Something Here. */).value;\n var vs = \"[VERSION]\";\n var pl = \"[PLUGINLIST]\";\n var l = text.indexOf(vs);\n if (l != -1) {\n text.replace(vs, VisGene.VERSION);\n }\n var ps = \"\";\n for (var it = this.plugin.iterator(); it.hasNext(); ) {\n var p = it.next();\n // TODO: Make sure this works.\n ps = ps + (ps === \"\" ? \"\" : \", \") + p.getPluginName() + \" (\" + p.getClass().getName() + \")\";\n }\n if(ps === \"\") {\n ps = \"(none)\";\n }\n l = text.indexOf(pl);\n if (l != -1) {\n text.replace(pl, ps);\n }\n // TODO: Implement JEditorPane stuff.\n } catch (e) {\n console.log(\"Error reading about pane text:\");\n }\n };\n }//end Singleton", "function optionChanged(newState){\n buildMetadata(newState);\n buildCharts(newState);\n}", "function regionUpdate(){\n setPlot(regionSel.value);\n}", "function init() {\n console.log('state', state)\n\n // + SCALES\n xScale = d3.scaleLinear()\n .domain(d3.extent(state.data, d => d.age))\n .range([margin.left, width - margin.right])\n // console.log(\"xScale\", xScale, xScale(67))\n\n yScale = d3.scaleLinear()\n .domain(d3.extent(state.data, d => d.bmi))\n .range([height - margin.bottom, margin.top])\n\n // + AXES\n const xAxis = d3.axisBottom(xScale)\n const yAxis = d3.axisLeft(yScale)\n\n // + CREATE SVG ELEMENT\n svg = d3.select(\"#d3-container\")\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n\n // + CALL AXES\n svg.append(\"g\")\n .attr(\"class\", \"xAxis\")\n .attr(\"transform\", `translate(${0}, ${height - margin.bottom})`)\n .call(xAxis)\n .attr(\"font-size\", \"14\")\n .append(\"text\")\n .text(\"Age\")\n .attr(\"transform\", `translate(${width / 2}, ${40})`)\n .attr(\"fill\", \"black\")\n\n svg.append(\"g\")\n .attr(\"class\", \"yAxis\")\n .attr(\"transform\", `translate(${margin.left}, ${0})`)\n .call(yAxis)\n .attr(\"font-size\", \"14\")\n .append(\"text\")\n .text(\"BMI\")\n .attr(\"transform\", `translate(${-30}, ${height / 2})`)\n .attr(\"fill\", \"black\")\n\n draw();\n // + UI ELEMENT SETUP\n const dropdown = d3.select(\"#dropdown\")\n // .on(\"change\", function () {\n // // `this` === the selectElement\n // // 'this.value' holds the dropdown value a user just selected\n\n // state.selection = this.value\n // console.log(\"new value is\", this.value);\n // draw(); // re-draw the graph based on this new selection\n\n // add in dropdown options from the unique values in the data\n d3.select(\"#dropdown\")\n .selectAll(\"option\")\n .data([\"All\", \"Had stroke\", \"Never had stroke\"]) // + ADD UNIQUE VALUES\n .join(\"option\")\n .attr(\"value\", d => d)\n .text(d => d);\n\n dropdown.on(\"change\", event => {\n // console.log(\"dropdown changed!\", event.target.value)\n state.selectStatus = event.target.value\n draw();\n })\n\n draw(); // calls the draw function\n}", "function updateData() {\n d3.selectAll(\".genre-icon\")\n .on('click', function() {\n var genre_id = d3.select(this).attr('id')\n current_genre = genre_id;\n\n // Make all icons (except this) transparent\n if($('.genre-icon').not(this).hasClass(\"selected\")) {\n $(\".genre-icon\").removeClass(\"selected\")\n }\n // Make this opaque\n if (!$(this).hasClass(\"selected\")){\n $(this).addClass(\"selected\")\n }\n\n // removing state map and statistics\n d3.selectAll(\"svg#statesvg > *\").remove();\n d3.selectAll(\"svg#stats > *\").remove();\n\n if(genre_id == \"top\") {\n stats.top(\"top\")\n\n } else {\n stats.draw(genre_id)\n }\n // adding new maps depending on geo_level\n if (geo_level == \"state\") {\n uStates.draw(genre_id);\n updateInfoBox();\n updateSums(genre_id);\n } else if (geo_level == \"county\") {\n usCounties.recalculateGenres(genre_id);\n updateInfoBox(current_state);\n updateSums(genre_id);\n } else if (geo_level == \"venue\") {\n usVenues.draw(genre_id);\n updateInfoBox(current_county);\n updateSums(genre_id);\n }\n // if (genre_id != \"top\") {\n // updateInfoBox(GENRES[genre_id].label);\n // } else {\n // updateInfoBox(\"music\");\n //}\n });\n}", "async setState(state) {\n\n const chrChanged = !this.state || this.state.chr1 !== state.chr1 || this.state.chr2 !== state.chr2\n this.state = state\n // Possibly adjust pixel size\n const minPS = await this.minPixelSize(this.state.chr1, this.state.chr2, this.state.zoom)\n this.state.pixelSize = Math.max(state.pixelSize, minPS)\n\n let hicEvent = new HICEvent(\"LocusChange\", {\n state: this.state,\n resolutionChanged: true,\n chrChanged: chrChanged\n })\n\n this.update(hicEvent)\n this.eventBus.post(hicEvent)\n }", "function optionChanged (sample) {\ndemographic_panel(sample);\ncreate_charts(sample);\n}", "function loadState(){\n var state = $.deparam.fragment();\n grid = state.grid;\n \n if(typeof state.variant !== \"undefined\"){\n options.variant = state.variant;\n }\n \n if(typeof state.level !== \"undefined\"){\n options.level = state.level;\n } else {\n options.level = 1;\n }\n \n $theInputs = $('.game-cell-input');\n $theInputs.each(function(){ // iterate over each input, putting saved value in.\n var num = $(this).data('num');\n if(typeof grid !== \"undefined\" && typeof grid[num] !== \"undefined\" && grid[num] !== \"\"){\n $(this).val( grid[num].val );\n $(this).data('special', grid[num].special );\n } else {\n $(this).val('');\n $(this).data('special', 0 );\n }\n decorateInput($(this));\n });\n \n $('#level').val(options.level);\n }", "function OnGenChanged(gen) {\n selectionsGenerations = gen;\n OnFilterCriteriaChanged();\n}", "render() {\n const { classes, vizTable, expandSubviewer, data } = this.props;\n if (!data) return null; // Empty component if no data yet\n const { hoveredIdx, selectedIdx } = this.state;\n\n const { kvpairs } = data;\n const model = Object.entries(kvpairs).map(([key, value], idx) => {\n return {\n text: key,\n isHovered: hoveredIdx === idx,\n isSelected: selectedIdx === idx,\n onClick: () => this.setState({ selectedIdx: idx }),\n onDoubleClick: () => expandSubviewer(value),\n onMouseEnter: () => this.setState({ hoveredIdx: idx }),\n onMouseLeave: () => this.setState({ hoveredIdx: null }),\n };\n });\n\n return (\n <div className={classes.container}>\n <Typography className={classes.header}>Output properties: </Typography>\n <SequenceViz\n model={model}\n showIndices={false}\n startMotif={'['}\n endMotif={']'}\n itemMaxWidth={75}\n />\n </div>\n );\n }", "function sample_form_update(extent, total_samples, total_patients, sample_list){\n var plot_id = $(svg[0]).parents('.plot').attr('id').split('-')[1];\n\n $(svg[0]).parents('.plot').find('.selected-samples-count').html('Number of Samples: ' + total_samples);\n $(svg[0]).parents('.plot').find('.selected-patients-count').html('Number of Participants: ' + total_patients);\n $('#save-cohort-' + plot_id + '-modal input[name=\"samples\"]').attr('value', sample_list);\n $(svg[0]).parents('.plot')\n .find('.save-cohort-card').show()\n .attr('style', 'position:absolute; top: '+ (y(extent[1][1]) + 180)+'px; left:' +(extent[1][0] + 90)+'px;');\n\n if (total_samples > 0){\n $(svg[0]).parents('.plot')\n .find('.save-cohort-card').find('.btn').prop('disabled', false);\n } else {\n $(svg[0]).parents('.plot')\n .find('.save-cohort-card').find('.btn').prop('disabled', true);\n }\n\n }", "function optionChanged(sample) {\n // The parameter being passed in this function is new sample id from dropdown menu\n\n // Update metadata with newly selected sample USE ON CHANGE\n buildMetadata(sample);\n // Update charts with newly selected sample\n buildCharts(sample);\n}", "function optionChanged(sample) {\n createChart(sample);\n createMetaData(sample);\n // createGauge(sample)\n}", "function handleChange(){\n var selection = sampleID.property(\"value\"); // numbers\n console.log(selection); // number has been converted to string\n\n // (2) Change the url for the metadata (include sample)\n var urlMeta1 = `/metadata/${selection}`;\n console.log(urlMeta1);\n\n // (3) Use the new url to populate the HTML table\n d3.json(urlMeta1).then(function(trace){\n var data = [trace];\n\n // Get the values that match the index of the selected item in the array\n var tdAge = d3.select(\"#age\");\n var tdGender = d3.select(\"#gender\");\n var tdEvent = d3.select(\"#sampling-event\");\n var tdBBType = d3.select(\"#bbtype\");\n var tdLocation = d3.select(\"#location\");\n var tdID = d3.select(\"#id\");\n\n var tdList = [tdAge, tdBBType, tdEvent, tdGender, tdID, tdLocation];\n var catList = [\"age\", \"bbtype\", \"sampling_event\", \"gender\", \"sample\", \"location\"];\n\n // Populate the HTML table with the values from the data array\n for (var i = 0; i < tdList.length; i ++){\n tdList[i].text(data[0][catList[i]])\n };\n });\n\n // (4) Change the url for the sample data\n var urlSamples1 = `/samples/${selection}`;\n console.log(urlSamples1);\n\n // (5) Use the new URL to create the pie chart\n d3.json(urlSamples1).then(function(trace){\n var data = [trace];\n data[0][\"type\"] = \"pie\";\n data[0][\"labels\"] = data[0][\"labels\"].slice(0,10);\n data[0][\"values\"] = data[0][\"values\"].slice(0,10);\n data[0][\"hoverinfo\"] = \"label\";\n console.log(data);\n \n var layout = {\n title: `Proportions of the top 10 OTU in Sample ${selection}`,\n showlegend: false\n };\n \n Plotly.newPlot(\"pie\", data, layout)\n });\n\n // (6) Use the new URL to create a bubble chart\n d3.json(urlSamples1).then(function(trace){\n var data = [trace];\n data[0][\"type\"] = \"scatter\";\n data[0][\"mode\"] = \"markers\";\n data[0][\"x\"] = data[0][\"labels2\"];\n data[0][\"y\"] = data[0][\"values\"];\n data[0][\"text\"] = data[0][\"labels\"];\n data[0][\"marker\"] ={\n \"size\": data[0][\"marker_size\"].slice(0,20),\n \"color\": data[0][\"labels2\"].slice(0,20)\n };\n data[0][\"x\"] = data[0][\"x\"].slice(0,20); // Retain only the top 20 OTUs\n data[0][\"y\"] = data[0][\"y\"].slice(0,20); // Retain only the top 20 OTUs\n data[0][\"text\"] = data[0][\"labels\"].slice(0,20); // Retain only the top 20 OTUs\n delete data[0][\"labels\"]; // Remove the variables for pie chart\n delete data[0][\"values\"]; // Remove the variables for pie chart\n console.log(data);\n\n var layout = {\n title: `Frequencies of the top 20 OTUs in Sample ${selection}`,\n xaxis: {title: \"OTU_ID\"},\n yaxis: {\n title: \"Frequencies of each OTU_ID\"\n }\n };\n \n Plotly.newPlot(\"bubble\", data, layout)\n });\n\n }", "function init() {\n // + SCALES\n\n xScale = d3\n .scaleLinear()\n .domain(d3.extent(state.data, d => d.v2x_polyarchy))\n .range([margin.left, width - margin.right]);\n\n yScale = d3\n .scaleLinear()\n .domain(d3.extent(state.data, d => d.v2x_freexp_thick))\n .range([height - margin.bottom, margin.top]);\n\n // + AXES\n\n const xAxis = d3.axisBottom(xScale);\n const yAxis = d3.axisLeft(yScale);\n\n\n // + UI ELEMENT SETUP\n\n const selectElement = d3.select(\"#dropdown\").on(\"change\", function () {\n // `this` === the selectElement\n // 'this.value' holds the dropdown value a user just selected\n\n state.selection = this.value\n console.log(\"new value is\", this.value);\n draw(); // re-draw the graph based on this new selection\n });\n\n const selectElement_dem = d3.select(\"#dropdown_dem\").on(\"change\", function () {\n // `this` === the selectElement\n // 'this.value' holds the dropdown value a user just selected\n\n state.selection_dem = this.value\n console.log(\"new value is\", this.value);\n draw(); // re-draw the graph based on this new selection\n });\n\n // add in dropdown options from the unique values in the data\n selectElement\n .selectAll(\"option\")\n .data(state.gender_i) // + ADD UNIQUE VALUES\n .join(\"option\")\n .attr(\"value\", d => d)\n .text(d => d);\n\n selectElement_dem\n .selectAll(\"option\")\n .data(state.dem_index)\n .join(\"option\")\n .attr(\"value\", d => d)\n .text(d => d)\n\n // + CREATE SVG ELEMENT\n\n svg = d3\n .select(\"#d3-container\")\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height);\n\n // + CALL AXES\n\n // add the xAxis\n svg\n .append(\"g\")\n .attr(\"class\", \"axis x-axis\")\n .attr(\"transform\", `translate(0,${height - margin.bottom})`)\n .call(xAxis)\n .append(\"text\")\n .attr(\"class\", \"axis-label\")\n .attr(\"x\", \"50%\")\n .attr(\"dy\", \"3em\")\n .text(\"Freedom of Expression Index\");\n\n // To what extent does government respect press & media freedom, the freedom of ordinary people to \n //discuss political matters at home and in the public sphere, as well as the freedom of academic and \n //cultural expression? \n\n // add the yAxis\n svg\n .append(\"g\")\n .attr(\"class\", \"axis y-axis\")\n .attr(\"transform\", `translate(${margin.left},0)`)\n .call(yAxis)\n .append(\"text\")\n .attr(\"class\", \"axis-label\")\n .attr(\"y\", \"50%\")\n .attr(\"dx\", \"-3em\")\n .attr(\"writing-mode\", \"vertical-rl\")\n .text(\"Electoral Democracy Index\");\n\n //To what extent is the ideal of electoral democracy in its fullest sense achieved? \n\n\n draw(); // calls the draw function\n}", "function update_state() {\n \"use strict\"\n // Only update if we are actually changing states\n if (current_slide != new_slide) {\n // Go from slide 0 to slide 1\n if (new_slide == 1) {\n // Reset zoom, then load second slide\n reset_zoom(to_second_slide, current_slide)\n } else if (new_slide == 2) {\n // Load third slide\n reset_zoom(to_third_slide, current_slide)\n } else if (new_slide == 3) {\n // Load fourth slide\n reset_zoom(to_fourth_slide, current_slide)\n } else if (new_slide == 4) {\n // Load fifth slide\n // Add zoom capabilities for the points\n zoom.on(\"zoom\", zoomed)\n // canvas.call(zoom)\n to_fifth_slide(current_slide)\n } else if (new_slide == 5) {\n // Load sixth slide\n reset_zoom(to_sixth_slide, current_slide)\n } else if (new_slide == 6) {\n // Load seventh slide\n reset_zoom(to_seventh_slide, current_slide)\n } else if (current_slide != -1 & new_slide == 0) {\n // Add zoom capabilities for the points\n zoom.on(\"zoom\", zoomed)\n // svg.call(zoom)\n // canvas.call(zoom)\n to_first_slide(current_slide)\n }\n current_slide = new_slide\n }\n}", "function update() {\n \n // data\n var key = Object.keys(ids).find( key => ids[key] == this.value) ;\n var newId = data.id[key];\n var newValue = data.value[key];\n var newDemo = data.demographics[key];\n \n // bar chart\n Plotly.restyle('bar', 'x', [newValue.slice(0,10).reverse()]);\n Plotly.restyle('bar', 'y', [newId.slice(0,10).reverse().map( i => 'OTU ' + i.toString() )]);\n\n // bubble chart\n Plotly.restyle('bubble', 'x', [newId]);\n Plotly.restyle('bubble', 'y', [newValue]);\n\n // info panel\n d3.selectAll('#sample-metadata text').remove();\n Object.entries(newDemo).forEach( v => {\n d3.select('#sample-metadata')\n .append('text')\n .text(`${v[0]} : ${v[1]}`)\n .append('br');\n });\n\n // gauge\n Plotly.restyle('gauge', 'value', [newDemo.wfreq]);\n Plotly.restyle('gauge', 'title', [{ text: `Scrubs per Week | Participant: ${newDemo.id}` }]);\n\n }", "function optionChanged(changedSample){\n demographicInfo(changedSample);\n barChart(changedSample);\n bubbleChart(changedSample);\n}", "function optionChanged(newSample){\n console.log(newSample);\n buildMetadata(newSample);\n //buildCharts(newSample);\n}", "handleChange(e) {\n e.persist();\n let myObj = Object.assign({}, this.state.notebook);\n myObj[e.target.name] = e.target.value;\n this.setState({notebook:myObj});\n this.trueChange(e.target.name, e.target.value)\n }", "onStateChange() {\r\n // Get value of drop-down menu\r\n let state = document.getElementById(\"dashboard-select\").value;\r\n // Query the data of State and update right chart\r\n d3.json(`http://127.0.0.1:5000/get_state_data/${state}`).then((data) => {\r\n this.initRightChart(data);\r\n })\r\n }", "function optionChanged(newSampleID)\n\n { \n //Log new selection\n console.log(`User selected ${newSampleID}`) ;\n\n //Run functions to display data\n FillMetaData(newSampleID) ;\n\n DrawBarGraph(newSampleID) ;\n\n DrawBubbleChart(newSampleID) ;\n\n }", "function stateChange(state, expression) {\n let extent = getStateMapExtent(state);\n goToExtent(extent);\n countiesLyr.definitionExpression = expression;\n countiesLyr.visible = true;\n megaLyr.visible = true;\n urbanLyr.visible = true;\n statesLyr.visible = false;\n censusblockLyr.visible = false;\n view.popup.close();\n removeLegend();\n removeTable();\n setDefaultCategory();\n customize = $.extend(true, {}, defaultMapSettings);\n $method[0].sumo.selectItem('natural-breaks');\n $('.nav-tabs a[href=\"#fields\"]').tab('show');\n $cbNumOne.hide();\n $cbNumTwo.hide();\n hideFieldDesign();\n }", "function optionChanged(newSample) { \r\n buildMetadata(newSample);\r\n buildCharts(newSample);\r\n\r\n }", "function optionChanged(newSample){\n //alert(newSample);\n chartBuilder(newSample);\n metadataBuilder(newSample);\n }", "function update_interactiveness() {\n var interactive = document.getElementById('interactive').checked;\n// if (!(interactive)) { \n// eb.hide(); \n// } else {\n// eb.show();\n// }\n if (wt.instance.raw) { // && wt.filename) {\n var filename = wt.instance.filename;\n var path = wt.instance.path;\n var current_value = editor.getValue();\n var new_editor = set_data(null, current_value);\n new_editor.instance.filename = filename;\n new_editor.instance.path = path;\n }\n }", "function updateState() {\n [molInchi, molStructure] = JSON.parse(this.responseText);\n viewer.loadMoleculeStr(undefined, molStructure);\n // Allow new requests to be sent.\n buttonsOn = true;\n}", "materialPicker(event){\n const material = event.target.value;\n let config = this.state.dice[this.state.current]\n config.material = material;\n this.setState({ [config]: config }, () => {\n this.pixar();\n })\n }", "function onchange()\r\n{\r\n window.updateHeatmap();\r\n window.updateBar();\r\n window.updateLine();\r\n}", "function stateChange(e) {\n setArticleParams();\n getArticle();\n }", "function optionChanged (newsample){\n createchart(newsample) \n metadata(newsample)\n}", "function optionChanged() {\n // Obtain selected sample from dropdown\n var selectedSample = Plotly.d3.select('select').property('value'); \n console.log('selectsamle_value : ' , selectedSample)\n // Call plot function with the new sample value\n fillOutTable(selectedSample);\n buildCharts(selectedSample);\n buildGauges(selectedSample);\n}", "function refresh() {\n\tstate = Engine.new_scenario();\n\tEngine.update_min_weight_val();\n\tPlotError.update_error_line();\n\tPlotError.update_true_weight_line();\n PlotData.update_target_line();\n PlotData.update_hypothesis_line();\n\tPlotData.update_training_circles();\n\tupdate_sliders();\n\treset_sgd();\n\tPlotError.update_batch_error_line();\n}", "function optionChanged(newSample) {\n buildMetadata(newSample);\n buildCharts(newSample);\n}", "function optionChanged(newSample) {\n buildMetadata(newSample);\n buildCharts(newSample);\n}", "function optionChanged(newSample) {\n buildMetadata(newSample);\n buildCharts(newSample);\n}", "function optionChanged(NextSample){\n ChartInfo(NextSample);\n AllData(NextSample);\n\n }", "function optionChanged(newSampleID) {\n\n // Verify event handler\n // console.log(`User selected ID (${newSampleID}).`);\n\n // Call functions to draw bar graph plot, bubble chart plot, update demographic info panel, and gauge chart\n drawBarGraph(newSampleID);\n drawBubbleChart(newSampleID);\n updateDemographicInfo(newSampleID);\n drawGaugeChart(newSampleID);\n\n}", "function optionChanged() {\n\n //assign the value of the dropdown menu option to a variable\n var dropdownMenu = d3.select(\"#selDataset\");\n var dataset = dropdownMenu.property(\"value\");\n\n // console.log(dropdownMenu);\n // console.log(importedData);\n\n //filter the data by the value in the dropdown menu\n newSamplesData = importedData.samples.filter(sample =>sample.id === dataset);\n newMetadata = importedData.metadata.filter(meta => meta.id === parseInt(dataset));\n\n // console.log(newSamplesData);\n // console.log(newMetadata);\n \n //clear the output\n PanelBody.html(\"\");\n \n //update the bio according to the value in the dropdown menu \n newMetadata.forEach((bio) => {\n //var row = PanelBody.append(\"ul\");\n Object.entries(bio).forEach(\n ([key,value]) => {\n var row = PanelBody.append(\"ul\");\n var cell = row.append(\"il\");\n cell.text(`${key} : ${value}`);\n }\n )\n })\n \n //restyle the bar and bubble charts \n var updateSamples = newSamplesData[0]\n\n var barUpdate = {\n x: [updateSamples.sample_values.slice(0,10)],\n y: [updateSamples.otu_ids.slice(0,10).map(d => \"OTU \" + d)],\n text: [updateSamples.otu_labels.slice(0,10)]\n }\n\n //console.log(barUpdate)\n var bubbleUpdate ={\n x: [updateSamples.otu_ids],\n y: [updateSamples.sample_values],\n 'marker.size' : [updateSamples.sample_values],\n 'marker.color': [updateSamples.otu_ids],\n text: [updateSamples.otu_labels]\n }\n\n //update the charts acccording to the value in th dropdown menu\n Plotly.restyle(\"bar\", barUpdate);\n Plotly.restyle(\"bubble\", bubbleUpdate);\n }", "searchGenes() {\n this.molecularOptions = [];\n this.mutationOptions = [];\n const geneList = this.geneListString.replace(/(\\r\\n\\t|\\n|\\r\\t)/gm, '').toUpperCase().split(' ');\n geneList.forEach((d, i) => {\n if (d.includes('ORF')) {\n geneList[i] = d.replace('ORF', 'orf');\n }\n });\n // check for which profiles data is available for the entered HUGOSymbols\n let callback = (dataProfiles) => {\n this.props.rootStore.availableProfiles.forEach((d) => {\n if (d.molecularAlterationType === 'MUTATION_EXTENDED') {\n this.updateMutationCheckBoxOptions(dataProfiles\n .includes(d.molecularProfileId));\n } else {\n this.updateMolecularCheckBoxOptions(d.molecularProfileId, dataProfiles\n .includes(d.molecularProfileId));\n }\n });\n };\n if (this.props.rootStore.isOwnData) {\n this.props.rootStore.molProfileMapping.getDataContainingProfiles(geneList, callback);\n } else {\n this.props.rootStore.molProfileMapping.getDataContainingProfiles(geneList, callback, this.props.rootStore.studyAPI.accessTokenFromUser);\n }\n }", "function optionChanged(newSample) {\n // Fetch new data each time a new sample is selected\n console.log(\"MOAR SCIENCE\")\n buildCharts(newSample);\n buildMetadata(newSample);\n}", "function init() {\n console.log('state', state)\n // + DEFINE SCALES\nconst xScale = d3.scaleLinear()\n.domain(d3.extent(state.data, d=> d.ideologyScore2020))\n.range([])\n\n // + DEFINE AXES\n\n // + UI ELEMENT SETUP\n // + add dropdown options\n // + add event listener for 'change'\n\n // + CREATE SVG ELEMENT\n\n // + CREATE AXES\n\n // draw(); // calls the draw function\n}", "function update(field) {\n // sort values\n if (field == 'Sex+Survived') {\n // http://jsfiddle.net/RFontana/bZX7Q/\n function compareValues(a, b) {\n return a.Survived - b.Survived;\n }\n\n var nested = d3.nest()\n .key(function (d) {\n return d.Sex;\n })\n .sortKeys(d3.ascending)\n .sortValues(compareValues)\n .entries(data);\n var filtered = nested.reduce(function (a, b) {\n return a.concat(b.values);\n }, []);\n } else {\n var filtered = data.sort(function (a, b) {\n return d3.ascending(eval(\"a.\" + field), eval(\"b.\" + field));\n });\n }\n\n // creates hexagons according to the data\n // each data point is correlated to one hexagon\n var hexagons = svg.selectAll('hexagon')\n .data(filtered, key_func);\n\n // remove hexagons from earlier visualization\n hexagons.exit().remove();\n\n // fill color, hint to each hexagon according to select option\n // create an infobox with data overview\n color = [];\n hint = [];\n for (var i = 0; i < d3.keys(filtered).length; i++) {\n if (field == 'Sex+Survived') {\n if (d3.values(filtered)[i].Sex == \"male\") {\n if (d3.values(filtered)[i].Survived == \"1\") {\n color.push(\"578399\");\n hint.push(\"Survivor Male\");\n } else {\n color.push(\"93C7DE\");\n hint.push(\"Perished Male\");\n }\n } else {\n if (d3.values(filtered)[i].Survived == \"1\") {\n hint.push(\"Survivor Female\");\n color.push(\"E892C4\");\n } else {\n color.push(\"FFCBE0\");\n hint.push(\"Perished Female\");\n }\n }\n\n d3.select(\"#panel_infobox\")\n .html(\"<br><table class=\\\"w3-table-all w3-tiny\\\">\" +\n \"<tr><th></th><th>Male</th><th>Female</th></tr>\" +\n \"<tr><td>Count</td><td>577</td><td>314</td></tr>\" +\n \"<tr><td>Survivor</td><td>109</td><td>233</td></tr>\" +\n \"<tr><td>Casual.</td><td>468</td><td>81</td></tr>\" +\n \"<tr><td>Surv. %</td><td>18.9%</td><td>74.2%</td></tr>\" +\n \"</table>\");\n\n } else if (field == 'Sex') {\n if (d3.values(filtered)[i].Sex == \"male\") {\n color.push(\"6A9AB1\");\n hint.push(\"Male\");\n } else {\n color.push(\"F099CC\");\n hint.push(\"Female\");\n }\n\n d3.select(\"#panel_infobox\")\n .html(\"<br><table class=\\\"w3-table-all w3-tiny\\\">\" +\n \"<tr><th></th><th>Male</th><th>Female</th></tr>\" +\n \"<tr><td>Count</td><td>577</td><td>314</td></tr>\" +\n \"<tr><td>%</td><td>64.76%</td><td>35.24%</td></tr>\" +\n \"</table>\");\n\n } else if (field == 'Survived') {\n if (d3.values(filtered)[i].Survived == \"1\") {\n color.push(\"#b2b2b2\");\n hint.push(\"Survivor\");\n } else {\n color.push(\"#DFDFDF\");\n hint.push(\"Perished\");\n }\n\n d3.select(\"#panel_infobox\")\n .html(\"<br><table class=\\\"w3-table-all w3-tiny\\\">\" +\n \"<tr><th></th><th>Survivor</th><th>Casual.</th></tr>\" +\n \"<tr><td>Count</td><td>342</td><td>548</td></tr>\" +\n \"<tr><td>%</td><td>38.38%</td><td>61.62%</td></tr>\" +\n \"</table>\");\n }\n }\n\n // set no color to remaining hexagons (with no data)\n for (var j = i; j < 900; j++) {\n color.push(\"white\")\n }\n\n // start drawing the hexagons\n hexagons.enter()\n .append(\"hexagon\")\n .data(hexbin(points))\n .enter().append(\"path\")\n .attr(\"class\", \"hexagon\")\n .attr(\"d\", function (d) {\n return \"M\" + d.x + \",\" + d.y + hexbin.hexagon();\n })\n .attr(\"stroke\", function (d, i) {\n return \"#fff\";\n })\n .attr(\"stroke-width\", \"1px\")\n .style(\"fill\", function (d, i) {\n return color[i];\n })\n .on(\"mouseover\", function mover(d, i) {\n var el = d3.select(\"#legend\")\n .html(hint[i]);\n })\n }", "function optionChanged(newSample){\n buildCharts(newSample);\n MetaData(newSample);\n}", "function optionChanged(newSample) {\n buildMetadata(newSample);\n barChart(newSample);\n bubbleChart(newSample);\n \n}", "function optionChanged(newSample) { \n // Clear all charts & data\n clearAll();\n // Fetch new data each time a new sample is selected\n buildCharts(newSample);\n buildMetadata(newSample);\n}", "handleExchange(data){\n var tempRNAsequence = tryConvert('DNA', 'RNA', data);\n var tempAAsequence = tryConvert('RNA', 'AMINO ACID', tempRNAsequence)\n this.setState({legendName: 'DNA', sequence: data, DNAsequence: data, RNAsequence: tempRNAsequence, AAsequence: tempAAsequence});\n }", "function optionChanged(newSample) {\n buildCharts(newSample);\n buildMetadata(newSample);\n}", "function updateAll(){refreshSliderDimensions();ngModelRender();}", "function change_state() { \n cur_json_data = \"\";\n cur_state = \"\";\n cur_county = \"\";\n $(\"#county_select, .pie_chart h3, .pig_e\").html(\"\"); \n $('input').val('');\n load_data();\n}", "update(selectedStates, dataType, activeYear){\n\n let _this = this;\n this.activeYear = activeYear;\n\n // ******* TODO: PART V *******\n //Display the names of selected states in a list\n\n //******** TODO: PART VI*******\n //Use the shift data corresponding to the selected years and sketch a visualization\n //that encodes the shift information\n\n //******** TODO: EXTRA CREDIT I*******\n //Handle brush selection on the year chart and sketch a visualization\n //that encodes the shift informatiomation for all the states on selected years\n\n //******** TODO: EXTRA CREDIT II*******\n //Create a visualization to visualize the shift data\n //Update the visualization on brush events over the Year chart and Electoral Vote Chart\n console.log(selectedStates);\n let text = \"\";\n let span = d3.select(\"#stateList\");\n\n let yrSelection;\n let statesSelection;\n\n\n if(dataType == \"year\")\n {\n if(selectedStates == \"\"){\n _this.yearText = \"\", _this.yearSelection = \"\";\n if(_this.evText == \"\"){\n _this.statesSelection = \"\";\n }\n else{\n _this.yearSelection = \"\";\n if(_this.statesSelection)\n _this.chartViz(_this, _this.statesSelection);\n }\n }\n else {\n _this.yearSelection = selectedStates;\n text += \"<ul>\";\n selectedStates.forEach((row)=>{\n if(row)\n text += \"<li>\" + row + \"</li>\";\n });\n text += \"</ul>\";\n _this.yearText = text;\n\n yrSelection = _this.yearSelection;\n if(_this.evText) {\n if(yrSelection)\n _this.chartViz(_this, _this.statesSelection, yrSelection);\n else\n _this.chartViz(_this, _this.statesSelection);\n }\n }\n }\n else if(dataType == \"ev\")\n {\n if(selectedStates == \"\")\n _this.evText = \"\", _this.selectedStates = \"\";\n else {\n _this.statesSelection = selectedStates;\n text += \"<ul>\"\n selectedStates.forEach((row)=>{\n if(row.State)\n text += \"<li>\" + row.State + \"</li>\"\n });\n text += \"</ul>\";\n _this.evText = text;\n yrSelection = _this.yearSelection;\n statesSelection = _this.statesSelection;\n if(yrSelection)\n _this.chartViz(_this, _this.statesSelection, yrSelection);\n else\n _this.chartViz(_this, _this.statesSelection);\n\n }\n }\n\n yrSelection = _this.yearText ? _this.yearText : \"\";\n statesSelection = _this.evText ? _this.evText : \"\";\n span.html(yrSelection + statesSelection);\n\n\n }", "function optionChanged(sample) {\n console.log(sample)\n getPlots(sample);\n getInfo(sample);\n}", "function optionChanged(newNeighborhood) {\n // Trigger all formulas so that the charts and colors all populate\n priceSummaryData(newNeighborhood);\n bedroomsSummaryData(newNeighborhood);\n bathroomsSummaryData(newNeighborhood);\n buildHistogram(newNeighborhood);\n buildBoxplot(newNeighborhood);\n buildPieChartPropertyType(newNeighborhood);\n buildPieChartRoomType(newNeighborhood);\n buildPieChartCancellation(newNeighborhood);\n buildPieChartBedType(newNeighborhood);\n buildPieChartSuperhost(newNeighborhood);\n buildPieChartIDVerfified(newNeighborhood);\n buildListingCountHistogram(newNeighborhood);\n buildWordCloud(newNeighborhood);\n neighborhood = newNeighborhood;\n set_chart_color();\n setBackgroundColor();\n }", "function optionChanged(sample) {\n // Pull metadata and sample, then filter by dropdown selection\n d3.json(\"static/Data/samples.json\").then((data)=> {\n var metadata = data.metadata.filter(meta => meta.id.toString() === sample)[0];\n var samples = data.samples.filter(s => s.id.toString() === sample)[0];\n var wfreq=metadata.wfreq\n // Feed data into display functions\n barplot(samples);\n bubbleplot(samples);\n table(metadata);\n gauge(wfreq);\n });\n}", "function update(){\n document.getElementById(\"gen\").value = organisms[0].genes;\n\t\n \n window.requestAnimationFrame(update)\n}", "handleMutation(index) {\n const plot = App.game.farming.plotList[index];\n const currentStage = plot.stage();\n let newAge = 0;\n if (currentStage !== PlotStage.Seed) {\n newAge = App.game.farming.berryData[this.mutatedBerry].growthTime[currentStage - 1] + 1;\n }\n plot.berry = this.mutatedBerry;\n plot.age = newAge;\n plot.notifications = [];\n App.game.farming.unlockBerry(this.mutatedBerry);\n }", "function optionChanged(newSample) {\n buildMetadata(newSample);\n buildCharts(newSample);\n}", "function updateValuesAndStates() {\n [values, states] = generateDefaultStateArray(getItemCount());\n}", "function displayGUI(){\n var gui = new dat.GUI();\n /*var jar;\n\n var parameters = {\n a: \"NosePoints\",\n b: \"Eyebrows\",\n c: false\n }*/\n var str = \"-\";\n var controller = new function(){\n this.Nose = str;\n this.Eyebrows = str;\n this.Check = false;\n this.Print = false;\n }();\n var labels = gui.addFolder('Labels')\n labels.add(controller, 'Nose', str).onChange(function(){ //\n state = 1; //global state for Nose\n (controller.Nose) = noseArray; //see verts/edges from array in gui\n });\n //labels.add(parameters, 'a').name('NosePoints');\n labels.add(controller, 'Eyebrows', str).onChange(function(){\n state = 2;\n (controller.Eyebrows) = eyebrowArray;\n });\n labels.add(controller, 'Check', false).onChange(function(){\n state = 0; //Null state\n });\n labels.add(controller, 'Print', false).onChange(function(){ //Print vert/edge indices\n console.log(\"Nose: \" + noseArray);\n console.log(\"Eyebrows: \" + eyebrowArray);\n });\n gui.open();\n}", "function updateGraphics() {\n ui.cellColorAlive = $(\"input[name=colorAliveCellHexagon]\").val();\n ui.cellColorDead = $(\"input[name=colorDeadCellHexagon]\").val();\n ui.cellColorStroke = $(\"input[name=colorOutlineHexagon\").val(); \n ui.draw();\n }", "function optionChanged(newsampleID)\n{\n console.log(\"Dropdown changed to:\", newsampleID);\n \n DrawBarGraph(newsampleID);\n DrawBubbleChart(newsampleID);\n ShowMetaData(newsampleID);\n}", "_render() {\n\t\tthis.tracker.replaceSelectedMeasures();\n }", "handleNewGraph() {\n this.setState((prevState, props) => {\n prevState.points = {};\n prevState.links = {};\n prevState.tooltips = {};\n prevState.currentHistoryName = null;\n return prevState;\n });\n }", "function updatePage() {\n d3.event.preventDefault();\n // extract the data from json file\n d3.json(\"static/data/samples.json\").then((data) => {\n // save the City to a variable\n chosenCity = cityDropdown.property('City');\n \n // variable for City info\n // let metadata = data.metadata;\n let metadataCity = (data.filter(record => record.city == chosenCity));\n dataCity = metadataCity[0];\n\n // variables for line chart\n var xValues = dataCity.date;\n var yValuesLeft = dataCity.uv-index;\n var yValuesRight = dataCity.max-temperature;\n\n // restyle the linegraph with chosen city data\n Plotly.restyle();\n\n // update gauge chart\n Plotly.restyle(\"gaugeChart\", \"value\", [dataCity.uv-index]);\n });\n}", "onChangeQuality(e) {\n console.log(e,\"targetvalie\")\n let { newProductData } = this.state;\n newProductData.quality = e.target.value;\n this.setState({ newProductData });\n }", "function optionChanged(newSample) {\n buildCharts(newSample);\n buildMetadata(newSample);\n}", "populate(asset) {\n const cls = this.constructor\n\n // Clear the current state component\n this._destroyStateComponent()\n\n // Update the asset and input value\n this._asset = asset\n\n // Set up the viewer\n const behaviourMap = this._gallery.constructor.behaviours\n const behaviour = this.parentBehaviours.viewer\n this._viewer = behaviourMap.viewer[behaviour](this)\n this._viewer.init()\n\n // Set up event handlers for the viewer\n $.listen(\n this._viewer.viewer,\n {\n 'download': () => {\n // Build a link to trigger a file download\n const a = $.create(\n 'a',\n {\n 'download': '',\n 'href': this.getAssetProp('downloadURL'),\n 'target': '_blank'\n }\n )\n a.click()\n },\n\n 'edit': () => {\n\n const imageEditorBehaviour = this.parentBehaviours\n .imageEditor\n const imageEditor = behaviourMap\n .imageEditor[imageEditorBehaviour](this)\n imageEditor.init()\n imageEditor.show()\n\n $.listen(\n imageEditor.overlay,\n {\n 'okay': () => {\n const {transforms} = imageEditor\n const {previewDataURI} = imageEditor\n\n previewDataURI.then(([dataURI, sizeInfo]) => {\n\n // Set the preview image\n this._viewer.imageURL = dataURI\n\n // Set base transforms against the image\n this.setAssetProp(\n 'transforms',\n imageEditor.transforms\n )\n\n // Set the preview URL\n this.setAssetProp('previewURL', dataURI)\n\n imageEditor.hide()\n })\n },\n 'cancel': () => {\n imageEditor.hide()\n },\n 'hidden': () => {\n imageEditor.destroy()\n }\n }\n )\n },\n\n 'metadata': () => {\n const metaBehaviour = this.parentBehaviours.metadata\n const metadata = behaviourMap\n .metadata[metaBehaviour](this)\n metadata.init()\n metadata.show()\n\n $.listen(\n metadata.overlay,\n {\n 'okay': () => {\n // Apply any metadata changes\n const {props} = metadata\n for (let key in props) {\n this.setAssetProp(key, props[key])\n }\n\n // Hide the medata overlay\n metadata.hide()\n },\n 'cancel': () => {\n metadata.hide()\n },\n 'hidden': () => {\n metadata.destroy()\n }\n }\n )\n },\n\n 'remove': () => {\n // Remove the item\n this.destroy()\n\n // Dispatch the removed event\n $.dispatch(this.item, 'removed', {'item': this})\n }\n }\n )\n\n // Set the new state\n this._state = 'viewing'\n\n // Flag element as populated in the DOM\n this.item.classList.add(cls.css['populated'])\n\n // Dispatch a populated event\n $.dispatch(this.item, 'populated', {'item': this})\n }", "function optionChanged(newSampleID) {\n showDemographicInfo(newSampleID); \n drawBarGraph(newSampleID);\n drawBubbleChart(newSampleID); \n\n console.log(\"Dropdown changed to:\", newSampleID);\n}", "function applySourceDataChanges(){\n var composer = document.getElementById(\"composer\").value;\n var title = document.getElementById(\"title\").value;\n var location = document.getElementById(\"location\").value;\n var ownership = document.getElementById(\"ownership\").value;\n var date = document.getElementById(\"date\").value;\n var publicationstatus = document.getElementById(\"publicationstatus\").value;\n var medium = document.getElementById(\"medium\").value;\n var x = document.getElementById(\"x\").value;\n var y = document.getElementById(\"y\").value;\n var unit = document.getElementById(\"unit\").value;\n var condition = document.getElementById(\"condition\").value;\n var extent = document.getElementById(\"extent\").value;\n var language = document.getElementById(\"language\").value;\n var handwriting = document.getElementById(\"handwriting\").value;\n \n if(composer){\n currentSource.composer = composer;\n }\n if(title){\n currentSource.title = title;\n }\n if(location){\n currentSource.location = location;\n }\n if(ownership){\n currentSource.ownership = ownership;\n }\n if(date){\n currentSource.date = date;\n }\n if(publicationstatus){\n currentSource.publicationstatus = publicationstatus;\n }\n if(medium){\n currentSource.medium = medium;\n }\n if(x){\n currentSource.x = x;\n }\n if(y){\n currentSource.y = y;\n }\n if(unit){\n currentSource.unit = unit;\n }\n if(condition){\n currentSource.condition = condition;\n }\n if(extent){\n currentSource.extent = extent;\n }\n if(language){\n currentSource.language = language;\n }\n if(handwriting){\n currentSource.handwriting = handwriting;\n }\n \n document.getElementById(\"input\").innerHTML = sourceDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}", "updateGraphicsData() {\n // override\n }", "function optionChanged(newSample) {\n var dropDownMenu = d3.select('#selDataset');\n var subject = dropDownMenu.property('value');\n createBarChart(subject);\n createBubbleChart(subject);\n createDemographics(subject);\n createGaugeChart(subject);\n}", "function updateViz() {\n background(\"seashell\");\n\n loadImage(\"USVizLegend.png\", displayLegend);\n if (stateArray.length > 0) {\n for (let i = 1; i < stateArray.length; i++) {\n stateArray[i].display();\n }\n }\n else { //handles error if stateArray does not contain data\n text(\"Waiting to load data files...\", width / 2, height / 2);\n }\n}", "function optionChanged(val) {\n updateMetaTable(val);\n updateBarChart(val);\n updateBubbleChart(val);\n updateGaugeChart(val);\n}", "reloadViewer (newOptions)\n {\n const queuedEvents = [];\n\n newOptions = this.optionsValidator.getValidatedOptions(this.settings, newOptions);\n\n // Set the zoom level if valid and fire a ZoomLevelDidChange event\n if (this.hasChangedOption(newOptions, 'zoomLevel'))\n {\n this.viewerState.oldZoomLevel = this.settings.zoomLevel;\n this.viewerState.options.zoomLevel = newOptions.zoomLevel;\n queuedEvents.push([\"ZoomLevelDidChange\", newOptions.zoomLevel]);\n }\n\n // Set the pages per row if valid and fire an event\n if (this.hasChangedOption(newOptions, 'pagesPerRow'))\n {\n this.viewerState.options.pagesPerRow = newOptions.pagesPerRow;\n queuedEvents.push([\"GridRowNumberDidChange\", newOptions.pagesPerRow]);\n }\n\n // Update verticallyOriented (no event fired)\n if (this.hasChangedOption(newOptions, 'verticallyOriented'))\n this.viewerState.options.verticallyOriented = newOptions.verticallyOriented;\n\n // Show/Hide non-paged pages\n if (this.hasChangedOption(newOptions, 'showNonPagedPages'))\n {\n this.viewerState.options.showNonPagedPages = newOptions.showNonPagedPages;\n }\n\n // Update page position (no event fired here)\n if ('goDirectlyTo' in newOptions)\n {\n this.viewerState.options.goDirectlyTo = newOptions.goDirectlyTo;\n\n if ('verticalOffset' in newOptions)\n this.viewerState.verticalOffset = newOptions.verticalOffset;\n\n if ('horizontalOffset' in newOptions)\n this.viewerState.horizontalOffset = newOptions.horizontalOffset;\n }\n else\n {\n // Otherwise the default is to remain on the current page\n this.viewerState.options.goDirectlyTo = this.settings.currentPageIndex;\n }\n\n if (this.hasChangedOption(newOptions, 'inGrid') || this.hasChangedOption(newOptions, 'inBookLayout'))\n {\n if ('inGrid' in newOptions)\n this.viewerState.options.inGrid = newOptions.inGrid;\n\n if ('inBookLayout' in newOptions)\n this.viewerState.options.inBookLayout = newOptions.inBookLayout;\n\n queuedEvents.push([\"ViewDidSwitch\", this.settings.inGrid]);\n }\n\n // Note: prepareModeChange() depends on inGrid and the vertical/horizontalOffset (for now)\n if (this.hasChangedOption(newOptions, 'inFullscreen'))\n {\n this.viewerState.options.inFullscreen = newOptions.inFullscreen;\n this.prepareModeChange(newOptions);\n queuedEvents.push([\"ModeDidSwitch\", this.settings.inFullscreen]);\n }\n\n this.clearViewer();\n this.updateViewHandlerAndRendering();\n\n if (this.viewerState.renderer)\n {\n // TODO: The usage of padding variables is still really\n // messy and inconsistent\n const rendererConfig = {\n pageLayouts: getPageLayouts(this.settings),\n padding: this.getPadding(),\n maxZoomLevel: this.settings.inGrid ? null : this.viewerState.manifest.maxZoom,\n verticallyOriented: this.settings.verticallyOriented || this.settings.inGrid,\n };\n\n const viewportPosition = {\n zoomLevel: this.settings.inGrid ? null : this.settings.zoomLevel,\n anchorPage: this.settings.goDirectlyTo,\n verticalOffset: this.viewerState.verticalOffset,\n horizontalOffset: this.viewerState.horizontalOffset\n };\n\n const sourceProvider = this.getCurrentSourceProvider();\n\n if (debug.enabled)\n {\n const serialized = Object.keys(rendererConfig)\n .filter(function (key)\n {\n // Too long\n return key !== 'pageLayouts' && key !== 'padding';\n })\n .map(function (key)\n {\n const value = rendererConfig[key];\n return key + ': ' + JSON.stringify(value);\n })\n .join(', ');\n\n debug('reload with %s', serialized);\n }\n\n this.viewerState.renderer.load(rendererConfig, viewportPosition, sourceProvider);\n }\n\n queuedEvents.forEach( (params) =>\n {\n this.publish.apply(this, params);\n });\n\n return true;\n }", "function init() {\n // Append options for users to select based on ids\n d3.json(\"/api/ins-us\").then(function (ins) {\n d3.json(\"/api/mmr-us\").then(function (data) {\n usData = data;\n insData = ins\n // console.log(insData);\n\n\n var filterState = ins.filter(event => event.year === 2009);\n filterState.forEach(element => {\n state = element.location;\n states.push(state);\n });\n var filterYear = ins.filter(event => event.location.trim() === \"California\");\n filterYear.forEach(element => {\n year = element.year;\n years.push(year);\n })\n\n var selection = d3.select(\"#selDataset\");\n\n states.forEach(item => {\n var options = selection.append(\"option\");\n options.property(\"value\", item);\n options.text(item);\n });\n\n var selection2 = d3.select(\"#selYear\")\n\n years.forEach(item => {\n var options2 = selection2.append(\"option\");\n options2.property(\"value\", item);\n options2.text(item);\n });\n\n\n buildPlot(selection.property(\"value\"));\n insChart(selection.property(\"value\"));\n state1Chart(selection2.property(\"value\"));\n });\n });\n}", "function optionChanged(newSample){\n getData(newSample);\n getDemoData(newSample);\n\n}", "function optionChanged(newSample){\n\n d3.json(\"samples.json\").then((data) => {\n var importedData = data; \n\n var ddMenu = d3.select(\"#selDataset\");\n var DataSelection = ddMenu.property(\"value\");\n\n //for loop for data selection\n for(var i = 0; i < importedData.names.length; i++){\n if(DataSelection === importedData.names[i]){\n d3.select(\"#sample-metadata\").selectAll(\"li\")\n .remove();\n //populate demographic info from metadata for selection made\n var li1 = d3.select(\"#sample-metadata\").append(\"li\").text(\"ID: \" + importedData.metadata[i].id)\n var li2 = d3.select(\"#sample-metadata\").append(\"li\").text(\"Ethnicity: \" + importedData.metadata[i].ethnicity)\n var li3 = d3.select(\"#sample-metadata\").append(\"li\").text(\"Gender: \" + importedData.metadata[i].gender)\n var li4 = d3.select(\"#sample-metadata\").append(\"li\").text(\"Age: \" + importedData.metadata[i].age)\n var li5 = d3.select(\"#sample-metadata\").append(\"li\").text(\"Location: \" + importedData.metadata[i].location)\n var li6 = d3.select(\"#sample-metadata\").append(\"li\").text(\"Bbtype: \" + importedData.metadata[i].bbtype)\n var li7 = d3.select(\"#sample-metadata\").append(\"li\").text(\"Wfreq: \" + importedData.metadata[i].wfreq)\n\n //sample values for selection made\n var sampleValues = importedData.samples[i].sample_values.slice(0,10).reverse();\n var IDs = importedData.samples[i].otu_ids.slice(0,10).reverse();\n var otuIDs = IDs.map(d => \"OTU \" + d);\n var labels = importedData.samples[i].otu_labels.slice(0,10);\n\n console.log(sampleValues)\n console.log(IDs)\n\n //bar chart\n var trace = {\n x: sampleValues,\n y: otuIDs,\n text: labels,\n type: \"bar\",\n orientation: \"h\",\n\n };\n \n var data = [trace];\n\n var layout = {\n title: \"OTU Data\",\n xaxis: { title: \"Sample Values\"},\n yaxis: { title: \"OTU IDs\"},\n margin:{\n l: 100,\n r:100,\n t:100,\n b:30\n },\n bargap: .5\n\n }\n\n Plotly.newPlot('bar', data, layout);\n\n //bubble chart\n var trace2 = {\n x: importedData.samples[i].otu_ids,\n y: importedData.samples[i].sample_values,\n mode: \"markers\",\n marker:{\n size: importedData.samples[i].sample_values,\n color: importedData.samples[i].otu_ids,\n },\n text: importedData.samples[i].otu_labels\n };\n \n var data2 = [trace2];\n \n var layout2 = {\n title: \"OTU Data\",\n showlegend: false,\n height: 600,\n width: 1000\n };\n \n Plotly.newPlot(\"bubble\", data2, layout2);\n }\n }\n });\n}", "function plotSetState(p, state) {\r\n\t//log.info(\"MG Setting state for \"+p);\r\n\t\r\n\tvar plots = this.data.plots;\r\n\tplots[p].state = state;\r\n\t\r\n\tif (state === \"dirty\") {\r\n\t\tdelete plots[p].growth;\r\n\t\tdelete plots[p].seed;\r\n\t\tdelete plots[p].start_grow;\r\n\t\tdelete plots[p].grow2_start;\r\n\t\tdelete plots[p].grow_time_skipped;\r\n\t\tdelete plots[p].planter;\r\n\t\tdelete plots[p].crop_time;\r\n\t\tplots[p].fertilized = false;\r\n\t}\r\n\t\r\n\tthis.broadcastConfig();\r\n}", "function geneSave(){\n return {'genes':window.biogen,\n 'geneSets':window.bioGeneGrp}\n}", "function updateData(data) {\n // data.selectedGen++;\n // model.provider.updateField(data.name, { active: data.selected });\n model.provider.toggleFieldSelection(data.name);\n }", "function update() {\r\n\r\n interactive_plot.setData([getRandomData()]);\r\n\r\n // Since the axes don't change, we don't need to call plot.setupGrid()\r\n interactive_plot.draw();\r\n if (realtime === \"on\")\r\n setTimeout(update, updateInterval);\r\n}", "function optionChanged(id){\n id_n=Number(id)\n //getting all the id's from the metadata\n d3.json(\"samples.json\").then(function(data){\n //getting the values from the data\n var metadata=Object.values(data.metadata);\n var id_list=[]\n metadata.forEach(item=>{\n id_list.push(item.id)\n })\n let index=id_list.indexOf(id_n);\n demographic_info(index);\n barchart(id);\n bubblechart(id);\n gauge_chart(index);\n })\n}", "function update(data) {\n\n updateSliders(sliderPointer++);\n if (sliderPointer === data.length) {\n sliderPointer = 0;\n }\n\n viz.data(data)\n .width(800).height(600) // Initial display size\n .haloKey(function (d) {\n return d.CMTE_ID; }) // The property that determines each PAC\n .nodeKey(function (d) {\n return d.CAND_ID; }) // The property that determines Candidate\n .nodeGroupKey(function (d) {\n return d.PTY; }) // The property that determines candidate Party affiliation\n .value(function (d) {\n return Math.abs(Number(d.TRANSACTION_AMT)); }) // The property that determines the weight/size of the link path\n .on(\"update\", onUpdate) // Callback for viz update\n .on(\"nodeover\",node_onMouseOver) // Callback for mouseover on the candidates\n .on(\"nodeout\",onMouseOut) // Callback for mouseout on from the candidate\n .on(\"arcover\",arc_onMouseOver) // Callback for mouseover on each PAC\n .on(\"arcout\",onMouseOut) // Callback for mouseout on each PAC\n .on(\"linkover\",link_onMouseOver) // Callback for mousover on each contribution\n .on(\"linkout\",onMouseOut) // Callback for mouseout on each contribution\n .on(\"nodeclick\",node_onClick)\n\n theme = vizuly.theme.halo(viz);\n\n theme.skins()[\"custom\"]=customSkin;\n theme.skin(\"custom\");\n\n viz_title = viz.selection().select(\"svg\").append(\"text\").attr(\"class\", \"title\")\n .style(\"font-family\",\"Raleway\")\n .attr(\"x\", viz.width() / 2).attr(\"y\", 40).attr(\"text-anchor\", \"middle\").style(\"font-weight\",300).text(\"\");\n\n //Update the size of the component\n changeSize(d3.select(\"#currentDisplay\").attr(\"item_value\"));\n}", "function stateCalled(e){\r\n hideSharePopUp();\r\n\r\n // update current slide number with history state slide number value\r\n presentSlideNumber = setSlideNumberFromURL();\r\n\r\n // using scene go slide since we update state in our go method\r\n window.scene.goSlide( presentSlideNumber );\r\n\r\n updateState();\r\n updateGUI();\r\n }", "function updateDemoInfo(id) {\n d3.json(\"samples.json\").then((data) => {\n\n // Filter for the selected ID\n var metadataSamples = data.metadata.filter(x => x.id === +id)[0];\n\n // Get the demographic information for the selected ID\n var sampleMetadata1 = d3.select(\"#sample-metadata\").selectAll('h1')\n var sampleMetadata = sampleMetadata1.data(d3.entries(metadataSamples))\n sampleMetadata.enter().append('h1').merge(sampleMetadata).text(d => `${d.key} : ${d.value}`).style('font-size','12px');\n\n // Get the wash frequency for the current ID \n var wFreq = metadataSamples.wfreq;\n var wFreqDeg = wFreq * 20;\n\n // Calculations for gauge pointer\n var degrees = 180 - wFreqDeg;\n var radius = 0.5;\n var radians = (degrees * Math.PI) / 180;\n var x = radius * Math.cos(degrees * Math.PI / 180);\n var y = radius * Math.sin(degrees * Math.PI / 180);\n\n // Path for gauge pointer\n var path1 = (degrees < 45 || degrees > 135) ? 'M -0.0 -0.025 L 0.0 0.025 L ' : 'M -0.025 -0.0 L 0.025 0.0 L ';\n var mainPath = path1,\n pathX = String(x),\n space = ' ',\n pathY = String(y),\n pathEnd = ' Z';\n var path = mainPath.concat(pathX,space,pathY,pathEnd);\n\n // Create trace for gauge plot\n var dataGauge = [\n {\n type: \"scatter\",\n x: [0],\n y: [0],\n marker: { size: 12, color: \"850000\" },\n showlegend: false,\n name: \"Freq\",\n text: wFreq,\n hoverinfo: \"text+name\"\n },\n {\n values: [50 / 9, 50 / 9, 50 / 9, 50 / 9, 50 / 9, 50 / 9, 50 / 9, 50 / 9, 50 / 9, 50],\n rotation: 90,\n text: [\"8-9\", \"7-8\", \"6-7\", \"5-6\", \"4-5\", \"3-4\", \"2-3\", \"1-2\", \"0-1\", \"\"],\n textinfo: \"text\",\n textposition: \"inside\",\n marker: {\n colors: [\n \"rgba(0, 105, 11, .5)\",\n \"rgba(10, 120, 22, .5)\",\n \"rgba(14, 127, 0, .5)\",\n \"rgba(110, 154, 22, .5)\",\n \"rgba(170, 202, 42, .5)\",\n \"rgba(202, 209, 95, .5)\",\n \"rgba(210, 206, 145, .5)\",\n \"rgba(232, 226, 202, .5)\",\n \"rgba(240, 230, 215, .5)\",\n \"rgba(255, 255, 255, 0)\"\n ]\n },\n labels: [\"8-9\", \"7-8\", \"6-7\", \"5-6\", \"4-5\", \"3-4\", \"2-3\", \"1-2\", \"0-1\", \"\"],\n hoverinfo: \"label\",\n hole: 0.5,\n type: \"pie\",\n showlegend: false\n }\n ];\n // Create layout for gauge plot\n var layoutGauge = {\n shapes: [\n {\n type: \"path\",\n path: path,\n fillcolor: \"850000\",\n line: {\n color: \"850000\"\n }\n }\n ],\n title: \"<b>Belly Button Washing Frequency</b> <br> Scrubs per Week\",\n // height: 500,\n // width: 500,\n xaxis: {\n zeroline: false,\n showticklabels: false,\n showgrid: false,\n range: [-1, 1]\n },\n yaxis: {\n zeroline: false,\n showticklabels: false,\n showgrid: false,\n range: [-1, 1]\n }\n };\n var config = {responsive:true}\n\n // Plot the new gauge chart\n Plotly.newPlot('gauge', dataGauge,layoutGauge,config);\n\n });\n}", "function updatePage() {\n var dropdownMenu = d3.selectAll(\"#selSubject\").node();\n var selectedID = dropdownMenu.value;\n d3.json(\"data/samples.json\").then((data) => {\n\n // pull and slice data for bar chart \n var subject_IDs = data.samples.map(x => x.id);\n var sample_values = data.samples.map(x => x.sample_values.slice(0,10));\n var otu_ids = data.samples.map(x => x.otu_ids.slice(0,10));\n var otu_labels2 = data.samples.map(x => x.otu_labels.slice(0,10));\n \n // pull data for bubble chart\n var bub_sample_values = data.samples.map(x => x.sample_values);\n var bub_otu_ids = data.samples.map(x => x.otu_ids);\n var bub_otu_labels = data.samples.map(x => x.otu_labels);\n \n // pull data for demographic display\n var demodata = data.metadata\n \n // function to return the index of the subject id selected\n function selectedIndex(x) {\n return x==selectedID;\n }\n \n // tranformed variables for the bar graph\n var subjectIndex = subject_IDs.findIndex(selectedIndex);\n var y_selected = otu_ids[subjectIndex];\n var ry_selected = y_selected.reverse();\n var rys_selected = ry_selected.toString(ry_selected);\n var ryss_selected = rys_selected.split(',');\n var y2_selected = ryss_selected.map(x => 'OTU ' + x);\n \n// displaying the demographics based on the selected sample id\n var demographics = d3.select(\"#sample-metadata\")\n var demoSelected = demodata[subjectIndex]\n console.log(\"demographics: \", demoSelected)\n demographics.selectAll(\"div\").remove();\n Object.entries(demoSelected).forEach(([key, value]) => demographics.append(\"div\").text(`${key}: ${value}`))\n\n// Bar graph \n var trace1 = {\n y: y2_selected,\n x: sample_values[subjectIndex].reverse(),\n text: otu_labels2[subjectIndex].reverse(),\n name: \"test\",\n type: \"bar\",\n orientation: \"h\"\n };\n \n // Bubble Graph \n var trace2 = {\n y: bub_sample_values[subjectIndex],\n x: bub_otu_ids[subjectIndex],\n text: bub_otu_labels[subjectIndex],\n name: \"bubble\",\n mode: \"markers\",\n marker: {size: bub_sample_values[subjectIndex],\n color: bub_otu_ids[subjectIndex] \n }\n };\n\n var chartData1 = [trace1];\n var chartData2 = [trace2];\n\n var layout1 = {\n title: `Top 10 OTUs found in Subject ID: ${selectedID}`, \n }; \n var layout2 = {\n title: `All OTUs Sample Values for Subject ID: ${selectedID}`, \n }; \n\n Plotly.newPlot(\"bar\", chartData1, layout1);\n Plotly.newPlot(\"bubble\", chartData2, layout2);\n\n console.log(subject_IDs);\n console.log(selectedID);\n console.log(subjectIndex)\n })}" ]
[ "0.59132713", "0.5899463", "0.5863856", "0.58184355", "0.56355625", "0.5582816", "0.55715245", "0.5563501", "0.5562832", "0.55531603", "0.5546761", "0.5513617", "0.5490715", "0.5444991", "0.5418182", "0.5382886", "0.5379203", "0.53773487", "0.5363989", "0.5345762", "0.5334844", "0.53166956", "0.5299476", "0.5298026", "0.52864015", "0.52859575", "0.52750957", "0.5268189", "0.5267484", "0.5259868", "0.5249816", "0.5243985", "0.52392477", "0.5236761", "0.52352667", "0.5227096", "0.5215171", "0.521056", "0.5207182", "0.51999694", "0.5199442", "0.5199391", "0.51982796", "0.51979107", "0.5197359", "0.51959443", "0.5183772", "0.5182664", "0.5168837", "0.5168837", "0.5168837", "0.5168408", "0.5166542", "0.5164382", "0.51641154", "0.5161802", "0.51589864", "0.51573575", "0.51539767", "0.5147306", "0.5144233", "0.51362026", "0.51354796", "0.51296633", "0.5126456", "0.5115492", "0.5115297", "0.5114393", "0.5108552", "0.51050055", "0.51039386", "0.51004547", "0.5093922", "0.50869703", "0.5085951", "0.50835294", "0.5083027", "0.50757796", "0.50726676", "0.5070565", "0.5070475", "0.5060284", "0.505138", "0.5048706", "0.5046387", "0.5044939", "0.5043987", "0.5041032", "0.5038163", "0.5034787", "0.5031405", "0.50304973", "0.50228065", "0.50177574", "0.50158805", "0.5009377", "0.500667", "0.50062686", "0.4998946", "0.4998044", "0.49940503" ]
0.0
-1
eturn data that is needed for expression profile and box plot
async retrieveGeneData(gene, dataset) { const { sample, drugId1, drugId2, biomarkerGeneStorage, selectedScore, } = this.state; // Checks if biomarker gene data has already been retrieved over API if (biomarkerGeneStorage[selectedScore] && biomarkerGeneStorage[selectedScore][dataset.name] && biomarkerGeneStorage[selectedScore][dataset.name][gene]) { return biomarkerGeneStorage[selectedScore][dataset.name][gene]; } try { // Retrieves data from the API and stores it in the state this.setState({ loadingGraph: true }); let queryParams = `?&dataset=${dataset.id}`; if (sample) queryParams = queryParams.concat(`&sample=${sample}`); if (drugId1) queryParams = queryParams.concat(`&drugId1=${drugId1}`); if (drugId2) queryParams = queryParams.concat(`&drugId2=${drugId2}`); let synergyArray; await fetch('/api/biomarkers/association'.concat(queryParams).concat(`&gene=${gene}`), { method: 'GET', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, }).then(response => response.json()) .then((data) => { synergyArray = data; }); // created a nested storage object with three levels // top level is synergy score, then dataset, then biomarker gene const updatedGeneStorage = { ...biomarkerGeneStorage }; if (!updatedGeneStorage[selectedScore]) updatedGeneStorage[selectedScore] = {}; if (!updatedGeneStorage[selectedScore][dataset.name]) { updatedGeneStorage[selectedScore][dataset.name] = {}; } updatedGeneStorage[selectedScore][dataset.name][gene] = synergyArray; this.setState({ biomarkerGeneStorage: updatedGeneStorage }); return synergyArray; } catch (err) { console.log(err); return []; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareBoxplotData(rawData, opt) {\n\t opt = opt || {};\n\t var boxData = [];\n\t var outliers = [];\n\t var boundIQR = opt.boundIQR;\n\t var useExtreme = boundIQR === 'none' || boundIQR === 0;\n\t\n\t for (var i = 0; i < rawData.length; i++) {\n\t var ascList = asc(rawData[i].slice());\n\t var Q1 = quantile(ascList, 0.25);\n\t var Q2 = quantile(ascList, 0.5);\n\t var Q3 = quantile(ascList, 0.75);\n\t var min = ascList[0];\n\t var max = ascList[ascList.length - 1];\n\t var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);\n\t var low = useExtreme ? min : Math.max(min, Q1 - bound);\n\t var high = useExtreme ? max : Math.min(max, Q3 + bound);\n\t var itemNameFormatter = opt.itemNameFormatter;\n\t var itemName = isFunction(itemNameFormatter) ? itemNameFormatter({\n\t value: i\n\t }) : isString(itemNameFormatter) ? itemNameFormatter.replace('{value}', i + '') : i + '';\n\t boxData.push([itemName, low, Q1, Q2, Q3, high]);\n\t\n\t for (var j = 0; j < ascList.length; j++) {\n\t var dataItem = ascList[j];\n\t\n\t if (dataItem < low || dataItem > high) {\n\t var outlier = [itemName, dataItem];\n\t outliers.push(outlier);\n\t }\n\t }\n\t }\n\t\n\t return {\n\t boxData: boxData,\n\t outliers: outliers\n\t };\n\t }", "function prepareBoxplotData(rawData, opt) {\n opt = opt || {};\n var boxData = [];\n var outliers = [];\n var boundIQR = opt.boundIQR;\n var useExtreme = boundIQR === 'none' || boundIQR === 0;\n\n for (var i = 0; i < rawData.length; i++) {\n var ascList = Object(number[\"b\" /* asc */])(rawData[i].slice());\n var Q1 = Object(number[\"p\" /* quantile */])(ascList, 0.25);\n var Q2 = Object(number[\"p\" /* quantile */])(ascList, 0.5);\n var Q3 = Object(number[\"p\" /* quantile */])(ascList, 0.75);\n var min = ascList[0];\n var max = ascList[ascList.length - 1];\n var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);\n var low = useExtreme ? min : Math.max(min, Q1 - bound);\n var high = useExtreme ? max : Math.min(max, Q3 + bound);\n var itemNameFormatter = opt.itemNameFormatter;\n var itemName = Object(util[\"w\" /* isFunction */])(itemNameFormatter) ? itemNameFormatter({\n value: i\n }) : Object(util[\"C\" /* isString */])(itemNameFormatter) ? itemNameFormatter.replace('{value}', i + '') : i + '';\n boxData.push([itemName, low, Q1, Q2, Q3, high]);\n\n for (var j = 0; j < ascList.length; j++) {\n var dataItem = ascList[j];\n\n if (dataItem < low || dataItem > high) {\n var outlier = [itemName, dataItem];\n outliers.push(outlier);\n }\n }\n }\n\n return {\n boxData: boxData,\n outliers: outliers\n };\n}", "function getTheData() {\n if(expensesR) {\n\tmod3L.remove();\n\tmod3R.remove();\n }\n // get the data\n expensesP = d3.select('#expensesP')\n .property('value');\n expensesR = d3.select('#expensesR')\n .property('value');\n // use the function to show the painting\n show(parseInt(expensesP),parseInt(expensesR));\n}", "function transformEndBoxData(data, x) {\n var hash = {};\n x = x.split(',');\n data.forEach(function(el) { \n l = boxLabel(el, x);\n if (!!hash[l]) {\n hash[l].push(el[0]);\n } else {\n hash[l] = [el[0]];\n }\n });\n\n var data = [];\n for (var k in hash) {\n var vals = hash[k];\n vals.sort(function(a, b) { return a - b; });\n data.push([k, vals[0], vals[Math.floor(vals.length / 4)], vals[Math.floor(vals.length / 4) * 3], vals[vals.length-1]]);\n }\n console.log(data);\n return data;\n}", "function getBoxValues(data) {\n var boxValues = [];\n boxValues.push(Math.min.apply(Math, data));\n boxValues.push(getPercentile(data, 25));\n // console.log(\"Median\",getPercentile(data, 50)[0] ) \n boxValues.push(getPercentile(data, 50));\n boxValues.push(getPercentile(data, 75));\n boxValues.push(Math.max.apply(Math, data));\n return boxValues;\n }", "function boxPlotChart(responsedata,window,id) {\n\t return d3BoxPlot(responsedata,trimBoxplot,window,id,null,null);\n}", "function showBoxData(){\n state.boxArr.forEach(function(box){\n\n if(box.selected){\n inpX.value = box.x;//box.x;\n inpY.value = box.y;//box.y;\n inpW.value = box.w;//box.w;\n inpH.value = box.h;//box.h;\n inpText.value = box.text;\n inpKey.value = box.key;\n inpItem.value = box.item;\n inpXskew.value = box.xSkew;\n }\n })\n inpPaddingX.value = xPadding;\n inpPaddingY.value = yPadding;\n }", "function visualize(errors, data) {\n data.forEach(function(d) {\n d.value = +d[BASE_YEAR]\n })\n\n data = data.filter((d)=> d.value > 0)\n\n data.sort(function(a, b){ return d3.ascending(a.value, b.value) })\n //x.domain(d3.extent(data, d => d.val1))\n //y.domain([0, d3.max(data, d => d.val2)])\n let boxes = [],\n squares = [],\n el_count = 0\n \n data.forEach(function(d, i) {\n if (eval(LIMITER) && boxes.length < MAX_DISPLAYED) {\n row_num = Math.floor(boxes.length / box_per_row);\n col_num = Math.floor(boxes.length / box_per_col);\n box_x = col_num * (box_width + horiz_box_margin) + horiz_box_margin;\n box_y = (boxes.length % box_per_col) * (box_height + vert_box_margin) + box_height;\n //box_x = (boxes.length % box_per_row) * (box_width + horiz_box_margin);\n //box_y = row_num * (box_height + vert_box_margin) + box_height;\n boxes.push({\n 'label': d.Vote + ' $' + value_label(d.value),\n 'value': d.value,\n 'x': box_x,\n 'y': box_y\n });\n\n for (var j=0; j < d.value; j+=10000) {\n jj = j / 10000;\n colour = 'steelblue';\n sq_row_num = Math.floor(jj / sq_per_row);\n sq_x = (jj % sq_per_row) * (sq_width + sq_margin) + box_x;\n sq_y = sq_row_num * (sq_height + sq_margin) + box_y;\n squares.push({\n 'x':sq_x,\n 'y':sq_y,\n 'colour':colour\n })\n }\n }\n })\n console.log(boxes)\n\n svg\n .selectAll(\".circles\")\n .data(squares)\n .enter().append(\"circle\")\n .attr(\"cx\", d => d.x + (sq_width / 2))\n .attr(\"cy\", d => d.y)\n .attr(\"r\", sq_width / 2)\n .attr(\"height\", sq_height)\n .attr(\"fill\", 'steelblue')\n\n svg\n .selectAll(\".labels\")\n .data(boxes)\n .enter().append(\"text\")\n .attr(\"x\", d => d.x)\n .attr(\"y\", d => d.y - 7.5)\n .attr(\"font-size\", \"10px\")\n .text(d => d.label)\n}", "function getBoxValues(data) {\n var boxValues = [];\n boxValues.push(Math.min.apply(Math, data));\n boxValues.push(getPercentile(data, 25));\n boxValues.push(getPercentile(data, 50));\n boxValues.push(getPercentile(data, 75));\n boxValues.push(Math.max.apply(Math, data));\n return boxValues;\n }", "function demographics(selector) {\n var filter1 = data.metadata.filter(value => value.id == selector);\n var div = d3.select(\".panel-body\")\n div.html(\"\");\n div.append(\"p\").text(`ID: ${filter1[0].id}`)\n div.append(\"p\").text(`ETHNICITY: ${filter1[0].ethnicity}`)\n div.append(\"p\").text(`GENDER: ${filter1[0].gender}`)\n div.append(\"p\").text(`AGE: ${filter1[0].age}`)\n div.append(\"p\").text(`LOCATION: ${filter1[0].location}`)\n div.append(\"p\").text(`BELLY BUTTON TYPE: ${filter1[0].bbtype}`)\n div.append(\"p\").text(`WASHING FREQUENCY: ${filter1[0].wfreq}`)\n \n}", "function getTheData() {\n if(totalSale) {\n\tmod1.remove();\n }\n //get the data\n totalSale = d3.select(\"#totalRealSales\")\n .property(\"value\");\n totalTarget = d3.select(\"#totalTargetSales\")\n .property(\"value\");\n //use the function to show the painting\n show(parseInt(totalSale),parseInt(totalTarget));\n}", "function DrawMultiLine_wage(position){\n \n position = './data/' + position\n \n d3.tsv(position, function(error, data) {\n if (error) throw error;\n \n //console.log(data)\n \n // grab non date keys \n color.domain(d3.keys(data[0]).filter(function(key) {\n return key !== \"Age\";\n \n }));\n\n // grab x,y values for top 5 and other \n var originData = color.domain().map(function(name) {\n return {\n name: name,\n values: data.map(function(d) {\n return {\n Age: d.Age,\n wage: +d[name]\n };\n })\n };\n });\n \n // // filter out, only need wage\n var wages = originData.slice(0);\n //console.log(originData)\n // remove stats, only keep wage\n wages.splice(0,2)\n wages.splice(1,2)\n //console.log(wages)\n\n // stats, not used here \n var stats = originData.slice(0);\n stats.splice(2,1)\n stats.splice(4,1)\n //console.log(stats)\n \n // give domain to axis \n x.domain(data.map(function(d) { return d.Age; }));\n\n y.domain([\n d3.min(wages, function(c) {\n return d3.min(c.values, function(v) {\n return v.wage;\n });\n }),\n d3.max(wages, function(c) {\n return d3.max(c.values, function(v) {\n return v.wage;\n });\n })\n ]);\n \n // remove all before drawing again\n var r = d3.selectAll('legendbox');\n r = r.remove();\n var lb = d3.selectAll('.label')\n lb = lb.remove();\n var lt = d3.selectAll('.title')\n lt = lt.remove();\n var yt = d3.selectAll('.ytitle')\n yt = yt.remove();\n var xt = d3.selectAll('.xtitle')\n xt = xt.remove(); \n var t = d3.selectAll('legendtext');\n t = t.remove();\n var c = d3.selectAll('circle');\n c = c.remove();\n var l = d3.selectAll('path')\n l = l.remove();\n var lg = d3.selectAll('.league')\n lg = lg.remove()\n var xa = d3.selectAll('.xaxis')\n xa = xa.remove();\n var ya = d3.selectAll('.yaxis')\n ya = ya.remove();\n \n var m1 = d3.selectAll('.mouse-over-effects')\n m1 = m1.remove();\n var m2 = d3.selectAll('.mouse-per-line2')\n m2 = m2.remove(); \n var m3 = d3.selectAll('.mouse-line')\n m3 = m3.remove(); \n \n // lenged\n var legend = svgLine.selectAll('g')\n .data(wages)\n .enter()\n .append('g')\n .attr('class', 'legend');\n \n // legend box \n legend.append('rect')\n .attr(\"class\",\"legendbox\")\n .attr('x', width - 20)\n .attr('y', function(d, i) {\n return i * 20;\n })\n .attr('width', 10)\n .attr('height', 10)\n .style('fill', function(d) {\n return color(d.name);\n });\n \n // legend words\n legend.append('text')\n .attr(\"class\",\"legendtext\")\n .attr(\"font-size\", \"10px\")\n .attr('x', width - 8)\n .attr('y', function(d, i) {\n return (i * 20) + 9;\n })\n .text(function(d) {\n return d.name;\n });\n \n // add line svg \n svgLine.append(\"g\")\n .attr(\"class\", \"xaxis\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(xAxis);\n\n svgLine.append(\"g\")\n .attr(\"class\", \"yaxis\")\n .call(yAxis)\n .append(\"text\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 6)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n \n // y axis title \n svgLine.append(\"text\")\n //.attr(\"transform\", \"rotate(-90)\")\n .attr('class','ytitle')\n .attr(\"y\", -20)\n .attr(\"x\",5)\n .attr(\"dy\", \"1em\")\n .style(\"fill\",'#9f0000')\n .style(\"text-anchor\", \"middle\")\n .style(\"font-family\",'\"Lato\", sans-serif')\n .style(\"font-size\",\"12px\")\n .text(\"Wage €\"); \n \n // x-axis label\n svgLine.append(\"text\") \n .attr('class','xtitle')\n .attr(\"transform\",\"translate(\" + (width/2) + \" ,\" + \n (height+25) + \")\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-family\",'\"Lato\", sans-serif')\n .style(\"font-size\",\"12px\")\n .style(\"fill\",'#9f0000')\n .text(\"Age\");\n \n // draw line\n var league = svgLine.selectAll(\".league\")\n .data(wages)\n .enter().append(\"g\")\n .attr(\"class\", \"league\");\n \n league.append(\"path\")\n .attr(\"class\", \"line\")\n .attr(\"d\", function(d) {\n return line(d.values);\n })\n .style(\"stroke\", function(d) {\n return color(d.name);\n });\n \n // for displaying the blue box indicating current selected position \n var fieldposition = ''\n if(position === 'ST_wage.tsv'){\n fieldposition = 'Field Position: Striker'\n }\n if(position === 'CM_wage.tsv'){\n fieldposition = 'Field Position:Midfielder'\n }\n if(position === 'CB_wage.tsv'){\n fieldposition = 'Field Position:Defender'\n }\n if(position === 'GK_wage.tsv'){\n fieldposition = 'Field Position:Goalkeeper'\n }\n \n var box = svgLine.append(\"rect\")\n .attr(\"class\", \"label\")\n \t\t\t.attr(\"x\", width/20)\n \t\t\t.attr(\"y\", -20)\n \t\t\t.attr(\"height\", 20)\n \t\t\t.attr(\"width\", fieldposition.length*6.7)\n \t\t\t.style(\"stroke\", 'blue')\n \t\t\t.style(\"fill\", \"blue\")\n .style('fill-opacity',0.3)\n \t\t\t.style(\"stroke-width\", 1);\n \n var title = svgLine.append(\"text\")\n\t\t\t\t.attr(\"class\", \"title\")\n\t\t\t\t//.attr('transform', `translate(${cfg.legend.translateX},${cfg.legend.translateY})`)\n\t\t\t\t.attr(\"x\", width/19)\n\t\t\t\t.attr(\"y\", -6)\n\t\t\t\t.attr(\"font-size\", \"13px\")\n\t\t\t\t.attr(\"fill\", \"#404040\")\n .style(\"font-family\", \"arial\")\n .style(\"font-weight\", \"bold\")\n\t\t\t\t.text(fieldposition);\n \n // mouse interaction \n var mouseG = svgLine.append(\"g\")\n .attr(\"class\", \"mouse-over-effects\");\n \n // this is the black vertical line to follow mouse\n mouseG.append(\"path\") \n .attr(\"class\", \"mouse-line\")\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", \"1px\")\n .style(\"opacity\", \"0\");\n \n // variable to get class of current mouse \n var lines = document.getElementsByClassName('line');\n\n var mousePerLine = mouseG.selectAll('.mouse-per-line2')\n .data(wages)\n .enter()\n .append(\"g\")\n .attr(\"class\", \"mouse-per-line2\");\n \n // add circle at point of hover \n mousePerLine.append(\"circle\")\n .attr('class','a')\n .attr(\"r\", 7)\n .style(\"stroke\", function(d) {\n return color(d.name);\n })\n .style(\"fill\", \"none\")\n .style(\"stroke-width\", \"1px\")\n .style(\"opacity\", \"0\");\n\n // add text at point of hover \n mousePerLine.append(\"text\")\n .attr('class','b')\n .attr(\"transform\", \"translate(10,3)\");\n\n // append rect to catch mouse movements on canvas\n // because cant catch mouse events on a g element\n mouseG.append('svg:rect') \n .attr('width', width)\n .attr('height', height)\n .attr('fill', 'none')\n .attr('pointer-events', 'all')\n .on('mouseout', function() { // on mouse out hide line, circles and text\n d3.select(\".mouse-line\")\n .style(\"opacity\", \"0\");\n d3.selectAll(\".mouse-per-line2 circle\").filter('.a')\n .style(\"opacity\", \"0\");\n d3.selectAll(\".mouse-per-line2 text\").filter('.b')\n .style(\"opacity\", \"0\");\n })\n .on('mouseover', function() { // on mouse in show line, circles and text\n d3.select(\".mouse-line\")\n .style(\"opacity\", \"1\");\n d3.selectAll(\".mouse-per-line2 circle\").filter('.a')\n .style(\"opacity\", \"1\");\n d3.selectAll(\".mouse-per-line2 text\").filter('.b')\n .style(\"opacity\", \"1\");\n })\n .on('mousemove', function() { // mouse moving over canvas\n var mouse = d3.mouse(this);\n d3.select(\".mouse-line\")\n .attr(\"d\", function() {\n var d = \"M\" + mouse[0] + \",\" + height;\n d += \" \" + mouse[0] + \",\" + 0;\n return d;\n });\n\n // find the actual values as mouse hovers over, using a invert technic \n d3.selectAll(\".mouse-per-line2\")\n .attr(\"transform\", function(d, i) {\n //console.log(width/mouse[0])\n //var xDate = x.invert(mouse[0]),\n var xDate = scaleBandInvert(x)(mouse[0]);\n bisect = d3.bisector(function(d) { return d.wage; }).right;\n idx = bisect(d.values, xDate);\n \n var beginning = 0,\n end = lines[i].getTotalLength(),\n target = null;\n\n while (true){\n target = Math.floor((beginning + end) / 2);\n pos = lines[i].getPointAtLength(target);\n if ((target === end || target === beginning) && pos.x !== mouse[0]) {\n break;\n }\n if (pos.x > mouse[0]) end = target;\n else if (pos.x < mouse[0]) beginning = target;\n else break; //position found\n }\n \n d3.select(this).select('text')\n .text(y.invert(pos.y).toFixed(2));\n \n return \"translate(\" + mouse[0] + \",\" + pos.y +\")\";\n });\n });\n \n // function for invert scaleBand \n function scaleBandInvert(scale) {\n var domain = scale.domain();\n var paddingOuter = scale(domain[0]);\n var eachBand = scale.step();\n return function (value) {\n var index = Math.floor(((value - paddingOuter) / eachBand));\n return domain[Math.max(0,Math.min(index, domain.length-1))];\n }\n }\n \n });\n }", "function missingLogicEvaluation(){\n $scope.logicEvaluation = dqFactory.completeness.numericalPlot.logicEvaluation;\n var data = [];\n $scope.nameX = dqFactory.completeness.numericalPlot.nameX;\n $scope.nameY = dqFactory.completeness.numericalPlot.nameY;\n\n var actualContent = dqFactory.getActualContent();\n\n $scope.optionPlot.chart.xDomain = getRange(actualContent, $scope.nameX);\n $scope.optionPlot.chart.yDomain = getRange(actualContent, $scope.nameY);\n // console.log(\"olit range: \", $scope.optionPlot.chart.xDomain);\n\n data.push({key: \"Present\", color: dqFactory.completeness.color.present, values: []});\n data.push({key: \"Missing\", color: dqFactory.completeness.color.missing, values: []});\n\n\n //checking variable.show\n var noneShow = 0;\n var show = [];\n angular.forEach(dqFactory.completeness.variables, function (variable) {\n if(variable.state.show) {\n noneShow +=1;\n show.push(variable.name);\n }\n });\n\n\n if(noneShow == 0){ //none is shown, plot only x, y (not missing) variable\n //console.log(\"No variable shown\");\n angular.forEach(actualContent, function (entry) {\n if (dqFactory.hasMeaningValue(entry[$scope.nameX]) //not null\n && dqFactory.hasMeaningValue(entry[$scope.nameY]) //not null\n ) {\n data[0].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n });\n }\n });\n }\n\n else if(noneShow == 1) {\n //console.log(\"Shown only one variable\");\n angular.forEach(actualContent, function (entry) {\n if (dqFactory.hasMeaningValue(entry[$scope.nameX]) //not null\n && dqFactory.hasMeaningValue(entry[$scope.nameY]) //not null\n ) {\n\n angular.forEach(dqFactory.completeness.variables, function (variable) {\n if (variable.state.selected\n && variable.state.show\n && variable.name != $scope.nameX\n && variable.name != $scope.nameY) {\n if (dqFactory.hasMeaningValue(entry[variable.name])) { //variable value is not null\n data[0].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n });\n }\n else{ //variable value is null\n data[1].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n });\n }\n }\n });\n }\n });\n }\n\n else { //more than one, we need to make AND/OR visualisation\n\n //console.log(\"show: \", show);\n\n angular.forEach($scope.variables, function(variable){\n if(variable.state.show){\n //console.log(\"else\");\n variable.optionSharingX.chart.xDomain = $scope.optionPlot.chart.xDomain;\n variable.optionSharingX.chart.width = $scope.optionPlot.chart.width;\n }\n });\n\n\n\n\n if($scope.logicEvaluation === \"AND\") {\n //console.log(\"Data in AND\");\n\n angular.forEach(actualContent, function (entry) {\n\n //calculate only if x an y are not missing\n if (dqFactory.hasMeaningValue(entry[$scope.nameX])\n && dqFactory.hasMeaningValue(entry[$scope.nameY])) {\n\n var inAnd = true;\n var control = true; //for breaking the loop: we need only one variable that is not true\n var controlIndex = 0;\n\n\n\n angular.forEach(show, function (variable) {\n //console.log(\"xDomain: \", $scope.optionPlot.chart.width);\n\n\n\n //console.log(variable);\n if (dqFactory.hasMeaningValue(entry[variable])) { // if not null break the check\n inAnd = false;\n control = false; //necessary to stop like break because if the last is true but in the middle we have a false we lost it\n }\n if (controlIndex == show.length) {\n //console.log(\"end forEach \", controlIndex);\n control = false;\n }\n controlIndex += 1;\n\n\n });\n\n\n\n if (inAnd) { // all values of shown variable are missing\n data[1].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n })\n }\n else { // at least one value is present\n data[0].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n })\n }\n }\n })\n }\n else if($scope.logicEvaluation === \"OR\") {\n //console.log(\"Data in OR\");\n angular.forEach(actualContent, function (entry) {\n\n //calculate only if x an y are not missing\n if (dqFactory.hasMeaningValue(entry[$scope.nameX])\n && dqFactory.hasMeaningValue(entry[$scope.nameY])) {\n\n var inOr = true;\n var control = true; //for breaking the loop: we need only one variable that is not true\n var controlIndex = 0;\n\n\n angular.forEach(show, function (variable) {\n //console.log(variable);\n if (!dqFactory.hasMeaningValue(entry[variable])) { // if not null break the check\n inOr = false;\n control = false; //necessary to stop like break because if the last is true but in the middle we have a false we lost it\n }\n if (controlIndex == show.length) {\n //console.log(\"end forEach\");\n control = false;\n }\n controlIndex += 1;\n });\n\n\n\n if (inOr) { // all values of shown variable are missing\n data[0].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n })\n }\n else { // at least one value is present\n data[1].values.push({\n x: entry[$scope.nameX],\n y: entry[$scope.nameY],\n size: dqFactory.completeness.numericalPlot.sizeSinglePoint,\n shape: dqFactory.completeness.numericalPlot.marker.circle\n })\n }\n }\n })\n }\n }\n\n\n //console.log(\"data missing/present: \", data);\n\n $scope.noneShow = noneShow;\n\n return data;\n }", "function plot_time_to_acc_in_div(canvas_id, esb_type, esb_size) {\n var net_arch = inputObject.network_archeticture;\n var dataset = inputObject.dataset;\n var h_sizes = inputObject.horizontal;\n var v_sizes = inputObject.vertical;\n\n // Get the index of columns we are going to display\n var indexes = get_indexes();\n\n var types = [];\n if (inputObject.horizontal.length > 0) {\n types.push(\"horizontal\");\n }\n if (inputObject.vertical.length) {\n types.push(\"vertical\");\n }\n\n t = [net_arch, dataset, esb_type, esb_size];\n json_filename = 'data/time_to_acc/' + t.join('_') + '.json';\n var ret = readTextFile(json_filename);\n var json = JSON.parse(ret);\n var x_values = json.x_values;\n var y_sgl = json.total_time_sgl;\n var y_esb = json.total_time_esb;\n var esb_win = json.esb_win;\n\n var x_values_t = [];\n for (let i of indexes) {\n x_values_t.push(x_values[i]);\n }\n var y_sgl_t = [];\n for (let i of indexes) {\n y_sgl_t.push(y_sgl[i]);\n }\n var y_esb_t = [];\n for (let i of indexes) {\n y_esb_t.push(y_esb[i]);\n }\n var esb_win_t = [];\n for (let i of indexes) {\n esb_win_t.push(esb_win[i]);\n }\n console.log('esb win', esb_win_t);\n\n var xs = [];\n var sgl_time = [];\n var esb_time = [];\n for (let i in esb_win) {\n if (esb_win_t[i] === 1) {\n xs.push(x_values_t[i]);\n sgl_time.push(y_sgl_t[i]);\n esb_time.push(y_esb_t[i]);\n }\n }\n\n // Time of single\n var trace1 = {\n x: xs,\n y: sgl_time,\n name: 'single',\n type: 'bar',\n opacity: 0.5,\n marker: {\n color: 'rgb(251,180,174)',\n line: {\n // color: 'rgb(8,48,107)',\n width: 1.5\n }\n }\n };\n // Time of ensemble\n var trace2 = {\n x: xs,\n y: esb_time,\n name: 'ensemble',\n type: 'bar',\n marker: {\n color: 'rgba(204,235,197,0.5)',\n line: {\n // color: 'rgb(8,48,107)',\n width: 1.5\n }\n }\n };\n\n\n var data = [trace1, trace2];\n\n var layout = {\n title: 'Time To Accuracy',\n xaxis: {\n title: 'Width factor|Depth|Parameters (M)',\n type: 'category',\n tickangle: 45,\n automargin: true,\n },\n yaxis: {\n title: 'Time (s)',\n }\n };\n\n Plotly.newPlot(canvas_id, data, layout);\n\n}", "function MathRecognitionData() {\n }", "function myPlottingData(){\n\tthis['ResQTL'] = \"\", \n\tthis['ResRel'] = \"\",\n\tthis['ResRelbetweenC'] = \"\",\n\tthis['ResgMean'] = \"\",\n\tthis['Summary'] = \"\",\n\tthis['RespMean'] = \"\",\n\tthis['ResAccBVE'] = \"\",\n\tthis['confidence'] = false,\n\tthis['legend'] = true\n}", "function createTrace(data, key){\n\n\t\tvar trace = {\n\t\t y: data,\n\t\t type: 'box',\n\t\t name: key,\n\t\t marker: {\n\t\t color: 'rgb(8,81,156)',\n\t\t outliercolor: 'rgba(219, 64, 82, 0.6)',\n\t\t line: {\n\t\t outliercolor: 'rgba(219, 64, 82, 1.0)',\n\t\t outlierwidth: 2\n\t\t }\n\t\t },\n\t\t boxpoints: 'suspectedoutliers'\n\t\t};\n\n\t\treturn trace;\n\t}", "function createEigenSpec(eigenData, width, height) \n{\n return {\n \"$schema\": \"https://vega.github.io/schema/vega/v5.json\",\n \"description\": \"A basic bar chart example, with value labels shown upon mouse hover.\",\n \"width\": width * 0.35,\n \"height\": height * 0.6,\n \"padding\": 0,\n \"title\": {\n \"text\": \"Variance Explained\"\n },\n \"data\": [\n {\n \"name\": \"table\",\n \"values\": eigenData\n }\n ],\n \n \"signals\": [\n {\n \"name\": \"tooltip\",\n \"value\": {},\n \"on\": \n [\n {\"events\": \"rect:mouseover\", \"update\": \"datum\"},\n {\"events\": \"rect:mouseout\", \"update\": \"{}\"}\n ]\n },\n {\n \"name\": \"external_select_x\",\n \"value\": 1\n },\n {\n \"name\": \"external_select_y\",\n \"value\": 2\n }\n ],\n \n \"scales\": [\n {\n \"name\": \"xscale\",\n \"type\": \"band\",\n \"domain\": {\"data\": \"table\", \"field\": \"name\"},\n \"range\": \"width\",\n \"padding\": 0.05,\n \"round\": true\n },\n {\n \"name\": \"yscale\",\n \"domain\": {\"data\": \"table\", \"field\": \"eigen\"},\n \"range\": \"height\"\n }\n ],\n \n \"axes\": [\n { \"orient\": \"bottom\", \"scale\": \"xscale\" },\n { \"orient\": \"left\", \"scale\": \"yscale\" }\n ],\n \n \"marks\": [\n {\n \"type\": \"rect\",\n \"from\": {\"data\":\"table\"},\n \"encode\": {\n \"enter\": {\n \"x\": {\"scale\": \"xscale\", \"field\": \"name\"},\n \"width\": {\"scale\": \"xscale\", \"band\": 1},\n \"y\": {\"scale\": \"yscale\", \"field\": \"eigen\"},\n \"y2\": {\"scale\": \"yscale\", \"value\": 0}\n },\n \"update\": {\n \"fill\": [ {\"test\": \"datum.name == external_select_x || datum.name == external_select_y\", \"value\": \"LightSlateGray\"}, {\"value\": \"LightGrey\"} ]\n }\n }\n },\n {\n \"type\": \"text\",\n \"from\": {\"data\":\"table\"},\n \"encode\": {\n \"enter\": {\n \"align\": {\"value\": \"center\"},\n \"baseline\": {\"value\": \"bottom\"},\n \"fill\": {\"value\": \"#333\"}\n },\n \"update\": {\n \"x\": {\"scale\": \"xscale\", \"field\": \"name\", \"band\": 0.5},\n \"y\": {\"scale\": \"yscale\", \"field\": \"eigen\", \"offset\": -2},\n \"text\": {\"field\": \"eigen\"},\n \"fillOpacity\": [\n {\"test\": \"datum.name == external_select_x || datum.name == external_select_y\", \"value\": 1},\n {\"value\": 0}\n ]\n }\n }\n }\n ]\n };\n}", "function makedata() {\n\n d3.select(`#${lineID}`).html('')\n d3.select(`#${barID}`).html('')\n d3.select(\"#outbody\").html('')\n d3.select(\"#pip\").style('color','black').text('Please Wait')\n d3.select(\"#money\").style('color','black').text('Please Wait')\n d3.select(\"#action\").style('color','black').style('font-weight','normal').text('Please Wait')\n all_dict = ['Initial', '-', '-', '-', '-', '-', '10000']\n tabelizer()\n \n\n pts = [], avg = [], y0 = [], y1 = [], x0 = [], x1 = [], color = []\n dinero = 10000\n signif = false\n movemoveit = false\n trend = 0\n wait = Array(10).fill(0)\n avg = []\n e2 = xrange\n actual = [], minute = [], poschange = [], negchange = [], shapes = [], shapeact = []\n max = 0\n pipchange = null, reco = null, profit = [], mvmt = []\n \n e = 0\n s = 0\n\n data.forEach(zz => {\n\n actual.push(zz['actual'])\n var change = zz['change']\n\n if (change < 0) {\n negchange = change \n poschange = 0\n }\n else {\n poschange = change\n negchange = 0\n }\n\n });\n\n clock()\n}", "function transformBoxData(data) {\n var hash = {};\n data.forEach(function(el) { \n if (!!hash[el.x]) {\n hash[el.x].push(el.y);\n } else {\n hash[el.x] = [el.y];\n }\n });\n\n var data = [];\n for (var k in hash) {\n var vals = hash[k];\n vals.sort(function(a, b) { return a - b; });\n data.push([parseInt(k, 10), vals[0], vals[Math.floor(vals.length / 4)], vals[Math.floor(vals.length / 4) * 3], vals[vals.length-1]]);\n }\n console.log(data);\n return data;\n}", "function processData(data, tt) {\n console.log(\"Starting processing...\")\n\n // ************************** GRID ***************************** //\n\n /* ----------- X AND Y AXES ----------- */\n var yScale3d = d3._3d()\n .shape('LINE_STRIP')\n .origin(origin)\n .rotateY(startAngle)\n .rotateX(-startAngle)\n .scale(scale);\n\n var xScale3d = d3._3d()\n .shape('LINE_STRIP')\n .origin(origin)\n .rotateY(startAngle)\n .rotateX(-startAngle)\n .scale(scale);\n\n\n /* -------------- y-Scale -------------- */\n var yScale = svg.selectAll('path.yScale').data(data[1]);\n yScale\n .enter()\n .append('path')\n .attr('class', '_3d yScale')\n .merge(yScale)\n .attr('stroke', 'black')\n .attr('stroke-width', 1)\n .attr('d', yScale3d.draw);\n\n yScale.exit().remove();\n\n\n /* --------------- x-Scale --------------- */\n var xScale = svg.selectAll('path.xScale').data(data[2]);\n xScale\n .enter()\n .append('path')\n .attr('class', '_3d yScale')\n .merge(xScale)\n .attr('stroke', 'black')\n .attr('stroke-width', 1)\n .attr('d', xScale3d.draw);\n\n xScale.exit().remove();\n\n\n /* -------------- y-Scale Text -------------- */\n var yText = svg.selectAll('text.yText').data(data[1][0]);\n yText\n .enter()\n .append('text')\n .attr('class', '_3d yText')\n .attr('dx', '.3em')\n .merge(yText)\n .each(function (d) {\n d.centroid = { x: d.rotated.x, y: d.rotated.y, z: d.rotated.z };\n })\n .attr('x', function (d) { return d.projected.x; })\n .attr('y', function (d) { return d.projected.y; })\n .text(function (d, i) {\n if( i < yLabel.length){\n return yLabel[i];\n }\n });\n yText.exit().remove();\n\n\n /* ----------- x-Scale Text ----------- */\n var xText = svg.selectAll('text.xText').data(data[2][0]);\n xText\n .enter()\n .append('text')\n .attr('class', '_3d xText')\n .attr('dx', '.3em')\n .merge(xText)\n .each(function (d) {\n d.centroid = { x: d.rotated.x, y: d.rotated.y, z: d.rotated.z };\n })\n .attr('x', function (d) { return d.projected.x; })\n .attr('y', function (d) { return d.projected.y; })\n .text(function (d, i) {\n if ((i + 1) % yLabel.length == 0) {\n return xLabel[(i + 1) / yLabel.length - 1];\n }\n });\n xText.exit().remove();\n\n\n // ************************** CUBES ***************************** //\n\n var cubes = cubesGroup.selectAll('g.cube').data(data[0], function (d) { return d.id });\n\n var ce = cubes\n .enter()\n .append('g')\n .attr('class', 'cube')\n .attr('fill', function (d) { console.log(\"MY COLOR SHOULD BE\", d.ycolor);\n return color(d.ycolor);\n })\n .attr('stroke', function (d) { return d3.color(color(d.ycolor)).darker(2);})\n .merge(cubes)\n .sort(cubes3D.sort)\n\n /** THIS IS THE INFO ON THE PREVIOUS TOOLTIP\n .html('<div style=\"font-size: 2rem; font-weight: bold\">'+ d.id +'</div>')\n .style('left', (origin[0]-400) + 'px')\n .style('top', (300) + 'px') ***/\n\n // --------------------- NEW ON-CLICK OPTIONS --------------------- //\n\n .on('click', function (d) {\n\n // IF NOTHING IS SELECTED\n if (arraySize == 0) {\n tempColor = this.style.fill;\n // temp_colors[0] = tempColor;\n // console.log(\"This cube color is selected\", temp_colors[0]);\n selected[0] = this\n arraySize = 1;\n console.log(\"This cube is selected\", selected);\n\n //SELECT THE CURRENT CUBE\n d3.select(this)\n .style('fill', 'yellow')\n\n //DISPLAY THE TEXT\n draw_information(d, \"visible\");\n }\n\n // IF SELECTED AGAIN\n else if(arraySize == 1 && Object.is(this, selected[0])){\n\n //REMOVE THE TEXT OF THE TOOLTIP\n draw_information(d, \"hidden\");\n\n //AND RESTORE THE COLOR\n d3.select(this)\n .style('fill', tempColor)\n arraySize = 0;\n console.log(\"This cube is selected again\", selected[0]);\n }\n\n //IF ANOTHER CUBE IS SELECTED\n else if(!Object.is(this, selected[0])){\n draw_information(d, \"hidden\")\n tempColor = this.style.fill;\n console.log(\"another cube is selected\", selected[0]);\n var tempCube = selected[0]\n\n //the text is hidden automatically\n\n //AND RESTORE THE COLOR\n d3.select(tempCube)\n .style('fill', tempColor)\n\n //SELECT THE CURRENT CUBE\n selected[0] = this;\n d3.select(this)\n .style('fill', 'yellow')\n\n //ADD NEW TEXT TO THE TOOLTIP\n draw_information(d, \"visible\");\n\n }\n\n })\n\n\n /* --------- FACES ---------*/\n\n var faces = cubes\n .merge(ce)\n .selectAll('path.face')\n .data(function(d){ return d.faces; }, function(d){ return d.face; });\n\n faces\n .enter()\n .append('path')\n .attr('class', 'face')\n .attr('fill-opacity', 0.95)\n .classed('_3d', true)\n .merge(faces)\n .transition().duration(tt)\n .attr('d', cubes3D.draw);\n\n faces.exit().remove();\n\n console.log(\"exiting the svg\")\n cubes.exit().remove(); //VERY IMPORTANT STEP\n\n /* --------- SORT TEXT & FACES ---------*/\n\n ce.selectAll('._3d').sort(d3._3d().sort);\n console.log(\"The very last step\")\n }", "function buildFlatData(data) {\n\tvar aa1, aa2, val, result;\n\tfor(var i = 0; i < data.analysisAxis.length; i++) {\n\t\tif(data.analysisAxis[i].index === 1) {\n\t\t\taa1 = data.analysisAxis[i].data;\n\t\t} else if(data.analysisAxis[i].index === 2) {\n\t\t\taa2 = data.analysisAxis[i].data;\n\t\t} else {\n\t\t\tconsole.log('Does not support more than 2 axis for now');\n\t\t}\n\t}\n\tresult = {};\n\tresult.aa1 = buildDimensionFlatData(aa1);\n\tresult.aa2 = buildDimensionFlatData(aa2);\n\tresult.mg = [];\n\n\tfor(var i = 0; i < data.measureValuesGroup.length; i++) {\n\t\tvar mg = data.measureValuesGroup[i].data;\n\t\tresult.mg = result.mg.concat(buildMeasureFlatData(mg));\n\t}\n\n\treturn result;\n}", "function dataVisFunc(data) {\n\n d3.select(\"svg\").remove();\n\n // set the dimensions and margins of the graph\n var width = 400\n height = 300\n margin = 35\n\n // The radius of the pieplot is half the width or half the height (smallest one). I subtract a bit of margin.\n var radius = Math.min(width, height) / 2 - margin;\n\n // append the svg object to 'timeVis' div in popup.html\n var svg = d3.select(\"#timeVis\")\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + width / 2 + \",\" + height / 2 + \")\");\n\n // Create dummy data\n var data2 = {a: 9, b: 20, c:30, d:8, e:12, f:3, g:7, h:14}\n console.log(\"dummy data pls be the same\")\n console.log(data2);\n //var data = ourTaskList;\n console.log(\"does it go till here?yay\");\n console.log(data)\n //var data_obj = Object.fromEntries(ourTaskList);\n //console.log(\"datta entries :))\");\n //console.log(data_obj)\n\n // set the color scale\n var color = d3.scaleOrdinal()\n //.domain([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"])\n //.domain(Object.keys(data))\n .domain(Object.getOwnPropertyNames(data))\n .range(d3.schemeSet2);\n\n console.log(\"test object.keys(data))\")\n console.log(Object.keys(data));\n console.log(\"dummy data version\")\n console.log(Object.keys(data2));\n console.log(\"test get own property names\");\n console.log(Object.getOwnPropertyNames(data));\n console.log(\"DUMMY: test get own property names\");\n console.log(Object.getOwnPropertyNames(data2));\n console.log(\"type of our data\" + typeof data + \"type of dummy\" + typeof data2)\n\n //console.log(data);\n //console.log(\"data.keys()\");\n\n // Compute the position of each group on the pie:\n var pie = d3.pie()\n .sort(null) // Do not sort group by size\n .value(function(d) {return d.value; })\n var data_ready = pie(d3.entries(data))\n console.log(\"d3 enties here!!\")\n console.log(d3.entries(data));\n\n // The arc generator\n var arc = d3.arc()\n .innerRadius(radius * 0.5) // This is the size of the donut hole\n .outerRadius(radius * 0.8)\n\n // Another arc that won't be drawn. Just for labels positioning\n var outerArc = d3.arc()\n .innerRadius(radius * 0.9)\n .outerRadius(radius * 0.9)\n\n // Build the pie chart: Basically, each part of the pie is a path that we build using the arc function.\n svg\n .selectAll('allSlices')\n .data(data_ready)\n .enter()\n .append('path')\n .attr('d', arc)\n .attr('fill', function(d){ return(color(d.data.key)) })\n .attr(\"stroke\", \"black\")\n .style(\"stroke-width\", \"2px\")\n .style(\"opacity\", 1.0)\n\n // Add the polylines between chart and labels:\n svg\n .selectAll('allPolylines')\n .data(data_ready)\n .enter()\n .append('polyline')\n .attr(\"stroke\", \"white\")\n .style(\"fill\", \"none\")\n .attr(\"stroke-width\", 1)\n .attr('points', function(d) {\n var posA = arc.centroid(d) // line insertion in the slice\n var posB = outerArc.centroid(d) // line break: we use the other arc generator that has been built only for that\n var posC = outerArc.centroid(d); // Label position = almost the same as posB\n var midangle = d.startAngle + (d.endAngle - d.startAngle) / 2 // we need the angle to see if the X position will be at the extreme right or extreme left\n posC[0] = radius * 0.95 * (midangle < Math.PI ? 1 : -1); // multiply by 1 or -1 to put it on the right or on the left\n return [posA, posB, posC]\n })\n\n // Add the polylines between chart and labels:\n svg\n .selectAll('allLabels')\n .data(data_ready)\n .enter()\n .append('text')\n .text( function(d) { console.log(d.data.key) ; return d.data.key } )\n .attr('transform', function(d) {\n var pos = outerArc.centroid(d);\n var midangle = d.startAngle + (d.endAngle - d.startAngle) / 2\n pos[0] = radius * 0.99 * (midangle < Math.PI ? 1 : -1);\n return 'translate(' + pos + ')';\n })\n .style('text-anchor', function(d) {\n var midangle = d.startAngle + (d.endAngle - d.startAngle) / 2\n return (midangle < Math.PI ? 'start' : 'end')\n })\n .style('fill', 'white')\n }", "function genData() {\n var type = ['Relief Measures'];\n var unit = [' B'];\n var cat = ['Unity', 'Resilience', 'Solidarity', 'Fortitude'];\n var amt = [6.4,48.4,5.1,33];\n var desc = [\n '<h3>Unity Budget</h3><p>Delivered on 18 February 2020</p><p>The <a href=\"https://www.mti.gov.sg/COS-2020/Stabilisation-and-Support-Package\" target=\"_blank\">Stabilisation and Support Package</a> was rolled out, including S$4 billion set aside to help workers and companies weather near-term economic uncertainties due to Covid-19. The new package will include job and cash-flow support to help firms retain and retrain workers.</p>',\n '<h3>Resilience Budget</h3><p>Delivered on 26 March 2020</p><p>A slew of measures were rolled out to support businesses, sectors most affected by Covid-19 – including aviation, tourism, food services and arts & cultural sector – and help workers stay employed. For instance, qualifying commercial properties badly affected by the virus outbreak, such as hotels and serviced apartments, will pay no property tax for 2020. Various financing schemes for companies such as the <a href=\"https://www.enterprisesg.gov.sg/financial-assistance/loans-and-insurance/loans-and-insurance/enterprise-financing-scheme/overview\" target=\"_blank\">Enterprise Financing Scheme</a> and the <a href=\"https://www.enterprisesg.gov.sg/financial-assistance/loans-and-insurance/loans-and-insurance/temporary-bridging-loan-programme/overview\" target=\"_blank\">Temporary Bridging Loan Programme</a>, will also be enhanced to ensure access to credit.</p>',\n '<h3>Solidarity Budget</h3><p>Delivered on 6 April 2020</p><p>Another S$5.1 billion was earmarked to help cushion the impact of Covid-19 on Singapore. This also marked the first time the Singapore Government has released three budgets in less than two months. Additional measures, such as enhancing the <a href=\"https://www.singaporebudget.gov.sg/docs/default-source/budget_2020/download/pdf/resilience-budget-enhanced-jobs-support-scheme.pdf\" target=\"_blank\">Job Support Scheme</a> to subsidise wages and help companies keep their employees, and increasing rental waivers, were introduced.</p>',\n '<h3>Fortitude Budget</h3><p>Delivered on 26 May 2020</p><p>The central focus of this Budget, announced as Singapore prepares to open its economy after a “circuit breaker” period of almost two months, is jobs. The Government launched a new <a href=\"https://www.wsg.gov.sg/SGUnited.html\" target=\"_blank\">SGUnited Jobs and Skills Package</a> that will create more than 40,000 jobs in the public and private sectors, 25,000 traineeships and 30,000 skills training opportunities. Support for businesses were also strengthened on three fronts: cash flow, costs and credit.</p>' \n ];\n \n var dataset = new Array();\n\n for (var i = 0; i < type.length; i++) {\n var data = new Array();\n var total = 0;\n\n for (var j = 0; j < cat.length; j++) {\n var value = amt[j];\n total += value;\n data.push({\n \"cat\": cat[j],\n \"val\": value,\n \"desc\": desc[j]\n });\n }\n\n dataset.push({\n \"type\": type[i],\n \"unit\": unit[i],\n \"data\": data,\n \"total\": total\n });\n }\n return dataset;\n }", "function _getNoAxixProcessMultilineMetaData(valueData, subjectIndex, xaxisIndex, datanameIndex, title) {\n var subjects = [];\n var graphData = {};\n\n var categories = [];\n var arryWithData = []; //array to be used by all subjects to initialize individial arrays\n $.each(valueData['data'], function (index, dataArray) {\n var sub = dataArray[subjectIndex];\n if ($.inArray(sub, categories) != -1) {\n // graphData['' + sub + ''][dataArray[xaxisIndex] - 1] = Number(dataArray[datanameIndex]);\n } else {\n categories.push(sub);\n arryWithData.push(null);\n }\n\n });\n\n $.each(valueData['data'], function (index, dataArray) {\n var sub = dataArray[subjectIndex];\n if ($.inArray(sub, subjects) != -1) {\n var subIndex = categories.indexOf(sub);\n graphData['' + sub + ''][subIndex] = Number(dataArray[datanameIndex]);\n } else {\n subjects.push(sub);\n graphData['' + sub + ''] = JSON.parse(JSON.stringify(arryWithData));\n var subIndex = categories.indexOf(sub);\n graphData['' + sub + ''][subIndex] = Number(dataArray[datanameIndex]);\n }\n\n });\n\n var processedGraphData = [];\n\n $.each(graphData, function (key, value) {\n var t = {}\n t['name'] = key;\n t['data'] = value;\n processedGraphData.push(t);\n });\n\n console.log(\"final dataa\");\n console.log(processedGraphData);\n return [processedGraphData, categories, title];\n}", "function Analytics(reference, data){\n // console.log(data.a);\n // var width = $(reference).width();\n // var margin = {top:10, right:10, bottom: 40, left:40};\n // var height = 270 - margin.top - margin.bottom;\n // var svg = d3.select(\"#Analytics\")\n // .append(\"svg\")\n // .attr(\"width\", width);\n // console.log(\"Data is loaded in Analytics()\");\n // console.log(width);\n // console.log(height);\n\n // var data_cols = data.col;\n var fake_data = [data.key];\n // fake_data = [data.key];\n // dummy values\n var fake_data_split = fake_data[0];\n fake_data_split = fake_data_split.match(/\\w+([.*a-z0-9\\-0-9+])*(\\[.*?\\])?/g);\n\n console.log(fake_data_split)\n\n fake_data_split = fake_data_split.slice(0,fake_data_split.length-2);\n const matrica = []\n\n for (i=0;i< (fake_data_split.length);i+=2){\n\n matrica.push([fake_data_split[i], fake_data_split[i+1]]);\n\n }\n console.log(matrica)\n\n var table = d3.select(\"#Analytics\")\n .append('table')\n .selectAll('tr')\n .data(matrica);\n\n //table.setAttribute('class', 'result_table');\n\n table.enter().append('tr')\n .selectAll('td')\n .data(d => d)\n .enter()\n .append('td')\n .text(d => d);\n\n\n table.exit()\n .remove();\n\n jQuery(\"tr\").addClass(\"result_table\");\n\n var cells = table.selectAll('td')\n .data(function (d) {return d;})\n .text(function (d) {return d;});\n\n cells.enter()\n .append(\"td\")\n .text(function(d) { return d; });\n\n cells.exit().remove();\n\nvar width = $(reference).width();\n var margin = {top:10, right:10, bottom: 10, left:10};\n var height = 370 - margin.top - margin.bottom;\n var svg2 = d3.select(\"#Analytics\")\n .append(\"svg\")\n .attr(\"width\", 300)\n .attr(\"height\", 20)\n .attr(\"x\", 200)\n .attr(\"y\", 100)\n .attr(\"class\", \"result_table\");\n\n var words = 'These are the coefficients for the variable you selected'\n\n svg2.append('text')\n .style('text-anchor', 'middle')\n .text(words)\n .attr(\"transform\", function(d) { return \"translate(135,10)\";});\n }", "function populateDataset(sum, array) {\n xArray = [];\n for (i = 0; i < array.length; i++) {\n xVal = array[i] / sum;\n xArray.push(xVal);\n }\n coordinates = [{\n xCoordinates: xArray,\n yCoordinates: array\n }];\n //console.log(\"coordinates object (y coordinates array): \" + coordinates.yCoordinates);\n console.log(coordinates[0].xCoordinates);\n console.log(coordinates[0].yCoordinates);\n}", "createVis(debugData, otherDebugData, cp_idx, tc_idx) {\n\t\t// Deep copy object arrays. Transform it to\n\t\t// be able to differentiate between the current\n\t\t// run's and the other run's data\n\t\tvar dataArr1 = debugData.dataArray.map((el, i) => {\n\t\t\treturn JSON.parse(JSON.stringify(el));\n\t\t});\n\t\tvar dataArr2 = otherDebugData.dataArray.map((el, i) => {\n\t\t\treturn JSON.parse(JSON.stringify(el));\n\t\t});\n\n\t\tvar data1 = dataArr1.map((el, i) => {\n\t\t\tif (el[\"@current\"] === undefined) el[\"@current\"] = true;\n\t\t\treturn el;\n\t\t});\n\t\tvar data2 = dataArr2.map((el, i) => {\n\t\t\tif (el[\"@current\"] === undefined) el[\"@current\"] = false;\n\t\t\treturn el;\n\t\t});\n\n\t\t// Trick to maintain the color saliency of rendering; if we have\n\t\t// the display of data of another run overlaid, we want to maintain\n\t\t// the color mapping of (blue: another run result, orange: this run result)\n\t\t//var data = data2.concat(data1);\n\t\tvar data = data2.concat(data1);\n\n\t\t// If the student changed the variable names...\n\t\tvar varDataSet1 = debugData.localVarNames;\n\t\tvar varDataSet2 = otherDebugData.localVarNames;\n\t\tvar varData = Array.from(new Set(function*() { yield* varDataSet1; yield* varDataSet2; }()));\n\t\tvarData.push(\"@line no.\");\n\t\tvarData.push(\"@execution step\");\n\n\t\tvar width = 780,\n\t\t\theight = 780,\n\t\t\tpadding = 20,\n\t\t size = (width - 2 * padding) / varData.length;\n\t\t\n\t\tvar x = d3.scale.linear()\n\t\t .range([padding / 2, size - padding / 2]);\n\n\t\tvar y = d3.scale.linear()\n\t\t .range([size - padding / 2, padding / 2]);\n\n\t\tvar xAxis = d3.svg.axis()\n\t\t .scale(x)\n\t\t .orient(\"bottom\")\n\t\t .ticks(6);\n\n\t\tvar yAxis = d3.svg.axis()\n\t\t .scale(y)\n\t\t .orient(\"left\")\n\t\t .ticks(6);\n\n\t\tvar color = d3.scale.category10();\n\n\t\tvar domainByVarName = {},\n\t\t\tvarNames = d3.values(varData),\n\t\t\tn = varData.length;\n\n\t\tvarData.forEach(function (name) {\n\t\t\tvar tmpDomain = d3.extent(data, function(d) { return d[name]; });\n\t\t\tif (tmpDomain[0] === tmpDomain[1]) { // If there's only value in the domain, extend it\n\t\t\t\t\t\t\t\t\t\t\t\t // by including its -1 and +1 values\n\t\t\t\tdomainByVarName[name] = [tmpDomain[0] - 1, tmpDomain[1] + 1];\n\t\t\t} else {\n\t\t\t\tdomainByVarName[name] = tmpDomain;\n\t\t\t}\n\t\t});\n\n\t\txAxis.tickSize(size * n);\n\t\tyAxis.tickSize(-size * n);\n\t\t\n\t\t// Remove the old SVG\n\t\td3.select(\"#cross-vis-div-svg\" + cp_idx + \"-\" + tc_idx).remove();\n\n\t\t// Create a new one\n\t\tvar svg = d3.select(\"#cross-vis-div\" + cp_idx + \"-\" + tc_idx)\n\t\t\t\t .append(\"svg\")\n\t\t\t\t .attr(\"id\", () => { return \"cross-vis-div-svg\" + cp_idx + \"-\" + tc_idx; })\n\t\t\t\t\t.attr(\"width\", width)\n\t\t\t\t\t.attr(\"height\", height)\n\t\t\t\t\t.append(\"g\")\n\t\t\t\t\t.attr(\"transform\", \"translate(\" + padding + \",\" + padding + \")\");\n\n\t\tvar brush = d3.svg.brush()\t\t\n\t\t .x(x)\t\t\n\t\t .y(y)\t\t\n\t\t .on(\"brushstart\", brushstart)\n\t\t .on(\"brush\", (p) => { // Highlight the selected circles.\n\t\t\t\tvar e = brush.extent();\n\t\t\t\tvar brushedCircleLines1 = new Set();\n\t\t\t\tvar brushedCircleLines2 = new Set();\n\t\t\t\tsvg.selectAll(\"circle\").classed(\"hidden\", function(d) {\n\t\t\t\t\t// NOTE: e[0][0] = x0, e[0][1] = y0, e[1][0] = x1, e[1][1] = y1,\n\t\t\t\t\t// where [x0, y0] is the top-left corner\n\t\t\t\t\t// and [x1, y1] is the bottom-right corner\n\t\t\t\t\tif (e[0][0] > d[p.x] || d[p.x] > e[1][0]\n\t\t\t\t\t|| e[0][1] > d[p.y] || d[p.y] > e[1][1]) {\n\t\t\t\t\t\t// Hide the circles\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\td[\"@current\"] ? brushedCircleLines1.add(d[\"@line no.\"])\n\t\t\t\t\t\t\t\t : brushedCircleLines2.add(d[\"@line no.\"]);\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\n\t\t\t\tthis.removeMouseupGutterHighlights();\n\t\t\t\tthis.highlightCodeLines(Array.from(brushedCircleLines1));\n\t\t\t\tthis.highlightCodeLinesInDiffView(Array.from(brushedCircleLines2));\n\t\t })\n\t\t .on(\"brushend\", () => { // If the brush is empty, select all circles.\n\t\t \tif (brush.empty()) {\n\t\t \t\tsvg.selectAll(\".hidden\").classed(\"hidden\", false);\n\t\t \t\tthis.removeMouseupGutterHighlights();\n\t\t \t\tthis.dehighlightPrevCodeLinesInDiffView();\n\t\t \t}\n\t\t });\n\n\t\tsvg.selectAll(\".x.axis\")\n\t\t\t.data(varNames)\n\t\t.enter().append(\"g\")\n\t\t\t.attr(\"class\", \"x axis\")\n\t\t\t.attr(\"transform\", function(d,i) { return \"translate(\" + (n - i - 1) * size + \",0)\"; })\n\t\t\t.each(function(d) { x.domain(domainByVarName[d]); d3.select(this).call(xAxis); });\n\n\t\tsvg.selectAll(\".y.axis\")\n\t\t\t.data(varNames)\n\t\t.enter().append(\"g\")\n\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t.attr(\"transform\", function(d, i) { return \"translate(0,\" + i * size + \")\"; })\n\t\t\t.each(function(d) { y.domain(domainByVarName[d]); d3.select(this).call(yAxis); });\n\n\t\tvar cell = svg.selectAll(\".cell\")\n\t\t\t\t\t.data(this.cross(varNames, varNames))\n\t\t\t\t.enter().append(\"g\")\n\t\t\t\t\t.filter(function(d) { return d.i > d.j; })\n\t\t\t\t\t.attr(\"class\", \"cell\")\n\t\t\t\t\t.attr(\"transform\", function(d) { return \"translate(\" + (n - d.i - 1) * size + \",\" + d.j * size + \")\"; });\n\n\t\t// y axis labels\n\t\tcell.filter(function(d) { return (d.i - d.j) === 1; })\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", function(d, i) { return d.i * size + padding; })\n\t\t\t.attr(\"y\", function(d, i) { return size / 2; })\n\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t.text(function(d) { return d.y; });\n\n\t\t// x axis labels\n\t\tcell.filter(function(d) { return (d.i - d.j) === 1; })\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", function(d, i) { return padding; })\n\t\t\t.attr(\"y\", function(d, i) { return (n - 1 - d.j) * size + padding; })\n\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t.text(function(d) { return d.x; });\n\n\t\tcell.call(brush);\n\t\tcell.each(plot);\n\t\tcell.selectAll(\"circle\")\n\t\t .on(\"mouseover\", function() {\n\t\t \treturn tooltip.style(\"visibility\", \"visible\");\n\t\t })\n\t \t\t.on(\"mousemove\", (d) => {\n\t \t\t\tconsole.log(cell);\n\t \t\t\tvar cell = d3.select(this); // we replaced this with the outer context by using the (d) => {} function...\n\t \t\t\t//console.log(d);\n\t \t\t\t//console.log(cell.data()[0]);\n\t \t\t\t//console.log(cell.data());\n\t \t\t\t//var x = cell.data()[0].x;\n\t \t\t\t//var y = cell.data()[0].y;\n\n\t \t\t\t//var translate = d3.transform(cell.attr(\"transform\")).translate;\n\t \t\t\tvar coordinates = d3.mouse(svg.node()); // position relative to the svg element\n\t \t\t\t\n\t \t\t\ttooltip.html(\"<p><strong>Execution step\" + \": \" + d[\"@execution step\"] + \"</strong></p><p><strong>Code line: \" + d[\"@line no.\"] + \"</strong></p>\");\n\t \t\t\tthis.removeMouseupGutterHighlights();\n\t \t\t\td[\"@current\"] ? this.highlightCodeLines([d[\"@line no.\"]])\n\t \t\t\t\t\t\t : this.highlightCodeLinesInDiffView([d[\"@line no.\"]]);\n\n\t \t\t\treturn tooltip.style(\"top\", (coordinates[1] + 500) + \"px\")\n\t \t\t\t\t\t\t .style(\"left\", coordinates[0] + \"px\");\n\t \t\t})\n\t \t\t.on(\"mouseout\", () => {\n\t \t\t\tthis.removeMouseupGutterHighlights();\n\t \t\t\tthis.dehighlightPrevCodeLinesInDiffView();\n\t \t\t\treturn tooltip.style(\"visibility\", \"hidden\");\n\t \t\t});\n\n\t\tvar svgContainer = d3.select(\"#cross-vis-div\" + cp_idx + \"-\" + tc_idx);\n\t\tvar tooltip = svgContainer.append(\"div\")\n\t\t\t\t\t\t\t\t .style(\"position\", \"absolute\")\n\t\t\t\t\t\t\t\t .style(\"z-index\", \"1001\")\n\t\t\t\t\t\t\t\t .style(\"visibility\", \"hidden\");\n\n\t\tvar brushCell;\n\n\t\tfunction plot(p) {\n\t\t\tvar cell = d3.select(this);\n\n\t\t\tx.domain(domainByVarName[p.x]);\n\t\t\ty.domain(domainByVarName[p.y]);\n\n\t\t\tcell.append(\"rect\")\n\t\t\t .attr(\"class\", \"frame\")\n\t\t\t .attr(\"x\", padding / 2)\n\t\t\t .attr(\"y\", padding / 2)\n\t\t\t .attr(\"width\", size - padding)\n\t\t\t .attr(\"height\", size - padding)\n\t\t\t .style(\"pointer-events\", \"none\");\n\n\t\t\t// Cross for other data\n\t\t\tcell.selectAll(\"path\")\n\t\t\t .data(data)\n\t\t\t .enter().append(\"path\")\n\t\t\t .filter(function(d) { return (d[p.x] !== undefined) && (d[p.y] !== undefined) && !d[\"@current\"]; })\n\t\t\t \t.attr(\"d\", d3.svg.symbol()\n\t\t\t \t\t.size(function(d) { return 5 * 5; }) // size in square pixels\n\t\t\t \t\t.type(function(d) { return \"diamond\"; }))\n\t\t\t \t.attr(\"transform\", function(d) { return \"translate(\" + x(d[p.x]) + \",\" + y(d[p.y]) +\")\"; })\n\t\t\t .style(\"fill\", function(d) { return d3.rgb(82,209,255,0.2); });\n\n\t\t\t// Dot for current data\n\t\t\tcell.selectAll(\"circle\")\n\t\t\t .data(data)\n\t\t\t .enter().append(\"circle\")\n\t\t\t .filter(function(d) { return (d[p.x] !== undefined) && (d[p.y] !== undefined) && d[\"@current\"]; })\n\t\t\t .attr(\"cx\", function(d) { return x(d[p.x]); })\n\t\t\t .attr(\"cy\", function(d) { return y(d[p.y]); })\n\t\t\t .attr(\"r\", 2)\n\t\t\t .style(\"fill\", function(d) { return d3.rgb(255,127,80,0.2); });\n\t\t}\n\n\t\t// Clear the previously-active brush, if any.\n\t\tfunction brushstart(p) {\n\t\t\tif (brushCell !== this) {\t\t\n\t\t\t\td3.select(brushCell).call(brush.clear());\t\t\n\t\t\t\tx.domain(domainByVarName[p.x]);\t\t\n\t\t\t\ty.domain(domainByVarName[p.y]);\t\t\n\t\t\t\tbrushCell = this;\t\t\n\t\t\t}\t\t\n\t\t}\n\t}", "function boxplotVisual(ecModel, api) {}", "function insChart(state) {\n var filterData = insData.filter(choice =>\n choice.location.trim() === state);\n var employerData = [];\n var medicaidData = [];\n var medicareData = [];\n var militaryData = [];\n var nonGroupData = [];\n var uninsuredData = [];\n var yearData = [];\n //filter usData for MMR rate to add to insurance chart\n var filterMMRData = usData.filter(event => event.state === state);\n var mmrData = [];\n filterMMRData.forEach(item => {\n mmr = item.mmr;\n mmrData.push(mmr);\n });\n\n filterData.forEach(item => {\n employer = item.employer;\n medicaid = item.medicaid;\n medicare = item.medicare;\n military = item.military;\n nonGroup = item.non_group;\n uninsured = item.uninsured;\n year = item.year;\n\n employerData.push(employer);\n medicaidData.push(medicaid);\n medicareData.push(medicare);\n militaryData.push(military);\n nonGroupData.push(nonGroup);\n uninsuredData.push(uninsured);\n yearData.push(year);\n });\n // console.log(yearData);\n\n var trace3 = {\n x: yearData,\n y: medicaidData,\n name: \"Medicaid\",\n type: \"scatter\",\n mode: \"lines+markers\",\n line: {\n color: 'rgb(60, 179, 113)',\n }\n }\n\n var trace6 = {\n x: yearData,\n y: uninsuredData,\n name: \"Uninsured\",\n type: \"scatter\",\n mode: \"lines+markers\",\n line: {\n color: 'rgb(25, 25, 112)',\n }\n }\n\n var data = [trace3, trace6];\n\n var layout = {\n title: `<b>${state} Health Insurance Coverage 2009–2019: Females 19–64`,\n yaxis: {\n title: \"<b>Percentage</b>\",\n },\n xaxis: {\n title: \"<b>Year</b>\",\n type: \"date\",\n tickvals: years,\n ticktext: [\"2009\", \"2010\", \"2011\", \"2012\", \"2013\", \"2014\", \"2015\", \"2016\", \"2017\", \"2018\", \"2019\"],\n },\n shapes: [\n {\n type: \"line\",\n x0: \"2014\",\n y0: 0,\n x1: \"2014\",\n y1: 25,\n line: {\n dash: \"dot\"\n }\n\n },\n ]\n };\n\n var config = {responsive: true, displayModeBar: false };\n\n Plotly.newPlot(\"insChart\", data, layout, config);\n}", "function generateLines() { \n \t\t\tlet obj = {};\n \t\t\tlet arr = [];\n \t\t\tfor(let i = 0; i < rawData[selectedMeasures[0]].length; i++) { \n \t\t\t\tarr[i] = {}; \n \t\t\t\tfor(let j = 0; j < selectedMeasures.length; j++) {\n \t\t\t\t\tarr[i][selectedMeasures[j]] = rawData[selectedMeasures[j]][i];\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\treturn arr; \n \t}", "generateSpectraVisData(bounds, values){\n var fluxPlotData = [];\n var tablePlotData = [];\n for(var i=0;i<bounds.length-1;++i){\n fluxPlotData.push({ x: bounds[i], y: values[i]});\n fluxPlotData.push({ x: bounds[i+1], y: values[i]});\n tablePlotData.push({\n lowerEnergy: bounds[i], \n upperEnergy: bounds[i+1], \n value: values[i]\n });\n }\n\n return [fluxPlotData, tablePlotData];\n }", "parsedMetrics() {\n const newGridData = [];\n for (const metric of this.parsedMetrics) {\n for (const elem of this.defaultGridData) {\n if (elem.metric === metric) {\n newGridData.push(elem);\n }\n }\n }\n this.gridData = newGridData;\n\n // We select from sampleValues all the metrics thath\n // corespond to the result from tree menu (gridData)\n const metricsDependingOnGrid = [];\n const gridMetricsName = [];\n\n for (const metric of this.gridData) {\n gridMetricsName.push(metric.metric);\n }\n\n for (const metric of this.sampleArr) {\n if (gridMetricsName.includes(metric.name)) {\n metricsDependingOnGrid.push(metric);\n }\n }\n // The top level metric is taken as source in\n // computing stories.\n const storiesName = this.getStoriesByMetric(this\n .gridData[0].metric);\n const labelsName = this.columnsForChosenDiagnostic;\n const obj = this.computeDataForStackPlot(metricsDependingOnGrid,\n storiesName, labelsName);\n this.plotStackBar(obj, newGridData[0].metric);\n // From now on the user will be aible to switch between\n // this 2 types of plot (taking into consideration that\n // the scope of the tree-menu is to analyse using the\n // the stacked plot and bar plot, we avoid for the moment\n // other types of plot that should be actually used without\n // using the tree menu)\n this.typesOfPlot = ['Bar chart plot', 'Stacked bar plot',\n 'Cumulative frequency plot', 'Dot plot'];\n this.chosenTypeOfPlot = 'Stacked bar plot';\n }", "function init() {\n\n if (group != null){\n group.selectAll(\"*\").remove();\n d3.select(\".cubes\").selectAll(\"*\").remove();\n }\n\n // SET THE SCALE (AUTO OR MANUAL)\n if(frozen == 0){\n if(hasAdjusted == 0){\n findScale();\n } else{\n hasAdjusted = 0;\n }\n }\n\n\n //******* CREATE THE CUBES AND PUSH THEM ********\n\n // ARRAYS OF ELEMENTS FOR EACH OBJECT IN THE IMAGE\n // VERTICES\n cubesData = [];\n yLine = [];\n xLine = [];\n // STRING\n xLabel = [];\n yLabel = [];\n\n // CUBE VARIABLES; ID, COLOR, ATTRIBUTE\n var cnt = 0;\n var ycolor;\n var xattr;\n\n // DATA VARIABLES; USER CHOICE, LENGTH OF DATA VARIABLES\n var results = getResult();\n var q = getLength(results[0]);\n var p = getLength(results[1]);\n\n var con = []; // STORES VALUES OF THE YEAR 2007 FOR USE IN CALCULATING GROWTH\n\n for (var z = 0; z < q; z++) {\n\n firstData = first(results, z); // OBTAIN FIRST VARIABLE'S DATA\n xattr = xLabel[z] // RETRIEVE X LABEL FOR THE CURRENT CUBE\n console.log(\"ITS OVER HERE\");\n\n for (var x = 0; x < p; x++) {\n\n secData = second(firstData, results[1], x); // OBTAIN SECOND VARIABLE'S DATA\n\n // ------------------------ CUBE ------------------------------\n\n var y = parseFloat((-1 * (secData) / diviser).toFixed(5)); // NUMBER OF DIGITS TO APPEAR AFTER DECIMAL POINT = 5 (10000)\n var a = 5 * x - 5*(p/2); // ADJUST SIZE\n var b = 5 * z - 5*(q/2); // ADJUST SIZE\n\n // ADJUST DATA TO SHOW GROWTH\n if(datatype == 1){\n if(z == 0){ // YEAR 2007\n con.push(secData);\n y=0;\n } else{\n // CALCULATIONS FOR GROWTH GO HERE\n // USE THE VALUES IN CON AND SECDATA\n // TO CALCULATE THE NEW Y FOR GROWTH\n\n var val;\n val = ((secData-con[x])/con[x])*100\n y = (-val)/10\n }\n }\n\n // MAKE THE CUBE\n var _cube = makeCube(a, y, b); // MAKE THE CUBE USING BASE (X,Y,Z)\n _cube.id = 'cube_' + cnt++; // THE NAME OF THE CUBE i.e cube_1\n _cube.height = y; // RECORDS THE HEIGHT OF THE CUBE\n ycolor = yLabel[x];\n console.log(\"ARE WE UNDEFINED?\", yLabel)\n _cube.ycolor = ycolor;\n _cube.xattr = xattr;\n cubesData.push(_cube); // ADDS CUBE TO ARRAY\n\n // ------------------------ LINES ------------------------------\n\n var x_line_edge = 5 * (p - 1)- 5*(p/2) + 5;\n var y_line_edge = 5 * (q - 1)- 5*(q/2) + 5;\n\n xLine.push([x_line_edge, 1, b]);\n yLine.push([a, 1, y_line_edge]);\n }\n\n }\n console.log(cubesData.length);\n\n var allData = [\n cubes3D(cubesData),\n yScale3d([yLine]),\n xScale3d([xLine]),\n ];\n ycolorLegend();\n\n console.log(\">>>>>>>>>>>> xLabel: \", xLabel);\n console.log(\">>>>>>>>>>>> yLabel: \", yLabel);\n processData(allData, 1000); // DRAW THE SVG\n }", "function plotData(m) {\n d = [];\n var axis = y;\n if (m == \"apdex\") \n axis = apdex;\n else if (m == \"rpm\")\n axis = throughputScale; \n\n for (i = 0; i < $data.timeslices.length; i++) {\n d[i] = { time: x($data.timeslices[i].time), val: axis($data.timeslices[i][m]) };\n }\n return d;\n }", "function waffle_plot_ecm(svg_name,indicator,data,svg_area,svg_title){\n var data_ENIF2018 = get_data(data,indicator);\n var aux=\"\";\n if (data_ENIF2018.length==0){\n aux=\"Non available data for this filter.\";\n svg_name.append(\"text\")\n .attr(\"y\",aux_size*1.5*margin.top)\n .attr(\"x\",xScale(6))\n .attr(\"class\",\"legend\")\n .style(\"text-anchor\",\"middle\")\n .style(\"font-size\",\"14px\")\n .text(aux);\n }\n else{\n var total = get_total(data_ENIF2018);\n var squareSize = total/(columns*rows);\n var units = get_units(data_ENIF2018,indicator);\n var data_points = gen_points_data(rows,columns,squareSize,units);\n\n\n svg_name.selectAll(\"rect\")\n .data(data_points)\n .enter()\n .append(\"rect\")\n .append(\"title\")\n .text(function(d){\n var aux=\"\";\n if(d[5]==\"color_this\"){aux = \"Estimated inhabitants with the service: \"+numberWithCommas(units);}\n else {aux = \"Estimated inhabitants without the service: \"+numberWithCommas(total-units);};\n return aux;\n });\n\n svg_name.selectAll(\"rect\")\n .data(data_points)\n .attr(\"x\",function(d){return xScale(d[0]);})\n .attr(\"y\",function(d){return yScale(d[1]);})\n .transition()\n .ease(d3.easeElastic)\n .duration(1000)\n .delay(function(d,i) { return i*4;})\n .attr(\"x\",function(d){return xScale(d[0]);})\n .attr(\"y\",function(d){return yScale(d[1]);})\n .attr(\"class\",function(d){return d[5];})\n .attr(\"height\", (plotHeight-aux_size*margin.bottom)/(columns+1)-1)\n .attr(\"width\", (plotWidth-aux_size*margin.left)/(rows+1)-1);\n\n svg_name.append(\"text\")\n .attr(\"y\",1.05*plotHeight)\n .attr(\"x\",0.7*plotWidth)\n .attr(\"class\",\"legend\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-size\", \"10px\")\n .text(\"1 square: \"+numberWithCommas(squareSize)+\" inhabitants\");\n\n svg_name.append(\"text\")\n .attr(\"y\",1.3*aux_size*margin.top)\n .attr(\"x\",xScale(6))\n .attr(\"class\",\"legend\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-size\", \"12px\")\n .text(\"Percentage of population: \"+Math.round(units/total*10000)/100+\"%\");\n\n svg_name.append(\"text\")\n .attr(\"y\",aux_size*margin.top)\n .attr(\"x\",xScale(6))\n .attr(\"class\",\"legend\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-size\", \"14px\")\n .text(svg_title);\n\n};\n\n}", "async function createGeneralInformationBoxes(){\n const chartData=(await getChartsData());\n \n const reduceAllTimeData=(dayInfoArray)=>{\n const reducer = (accumulator, currentValue) => accumulator + currentValue;\n return dayInfoArray.reduce(reducer);\n\n }\n\n\n const totalCases={\n title:'סה\"כ מאומתים (נדבקים)',\n // main:chartData.allCurveData[chartData.allCurveData.length-1].totalCases,\n main:reduceAllTimeData(chartData.allCurveData.map(dayInfo=>dayInfo.newCases)),\n fromMidnight:chartData.allCurveData[chartData.allCurveData.length-1].newCases,\n fromYesterday:chartData.allCurveData[chartData.allCurveData.length-2].newCases,\n moderate:'none',\n critical:chartData.allSeriousCases[chartData.allSeriousCases.length-1].critical\n }\n \n const respirators={\n title:'מונשמים',\n main:chartData.allSeriousCases[chartData.allSeriousCases.length-1].respirators,\n fromMidnight:\n chartData.allSeriousCases[chartData.allSeriousCases.length-1].respirators-\n chartData.allSeriousCases[chartData.allSeriousCases.length-2].respirators,\n allData:chartData.allSeriousCases.map(({date,respirators}) => ([Date.parse(date),respirators]))\n }\n\n \n const totalDeaths={\n title:'נפטרים',\n main:reduceAllTimeData(chartData.allSeriousCases.map(dayInfo=>dayInfo.deaths)),\n fromMidnight: chartData.allSeriousCases[chartData.allSeriousCases.length-1].deaths,\n allData:chartData.allSeriousCases.map(({date,deaths}) => ([Date.parse(date),deaths]))\n }\n\n\n const totalRecoverdCases={\n title:'החלימו עד כה',\n main:reduceAllTimeData(chartData.allCurveData.map(dayInfo=>dayInfo.recoverdCases)),\n fromMidnight:chartData.allCurveData[chartData.allCurveData.length-1].recoverdCases,\n allData:chartData.allCurveData.map(({date,recoverdCases}) => ([Date.parse(date),recoverdCases]))\n }\n \n const totalTestsYesterday={\n title:'כלל הבדיקות שהתבצעו אתמול',\n main:chartData.allTestsToLocatePatients[chartData.allTestsToLocatePatients.length-2].testsAmount,\n fromMidnight:chartData.allTestsToLocatePatients[chartData.allTestsToLocatePatients.length-1].testsAmount\n }\n \n const activeCases={\n title:'חולים פעילים',\n main:totalCases.main-totalRecoverdCases.main,\n fromMidnight:\n //newCases-recoverdCases-deaths\n chartData.allCurveData[chartData.allCurveData.length-1].newCases-\n chartData.allCurveData[chartData.allCurveData.length-1].recoverdCases-\n chartData.allSeriousCases[chartData.allSeriousCases.length-1].deaths,\n //where\n home:'none',\n hotel:'none',\n hospital:'none'\n }\n \n \n \n \n createInfoBox(totalTestsYesterday);\n createInfoBox(totalRecoverdCases,true);\n createInfoBox(totalDeaths,true);\n createInfoBox(respirators,true);\n createInfoBox(activeCases);\n createInfoBox(totalCases);\n}", "function crossHairDataPrep(selectedTeam){\n // step 8.5 Calulate averages for x any y plots --- next function down\n//=======================================================\n var winsAveX = Math.round(d3.mean(selectedTeam, d => d.wins));\n var winsMaxX = Math.round(d3.max(selectedTeam, d => d.wins))\n var winsMinX = Math.round(d3.min(selectedTeam, d => d.wins))\n\n\n var cost_perAveY = Math.round(d3.mean(selectedTeam, d => d.cost_per_win));\n var cost_perMaxY= Math.round(d3.max(selectedTeam, d => d.cost_per_win)) \n var cost_perMinY= Math.round(d3.min(selectedTeam, d => d.cost_per_win)) \n\n console.log(`average of wins : ${winsAveX}`)\n console.log(`Max of wins : ${winsMaxX}`)\n\n console.log(`average of cost per win : ${cost_perAveY}`)\n console.log(`Max of costperwin : ${cost_perMaxY }`)\n console.log(`Min of costperwin : ${cost_perMinY}`)\n\n //gridPlotX(winsAveX, cost_perMaxY, cost_perMinY)\n //gridPlotY(winsMaxX, winsMinX, cost_perAveY,cost_perMaxY,cost_perMaxY);\n\n}", "function getPollData(data) {\n pollData = d3.nest()\n .key(function(d) { return d.pollutant; })\n .rollup(function(v) { return {\n val: d3.mean(v, function(d) { return d.val; })\n }; })\n .entries(data);\n // console.log(JSON.stringify(pollData), pollData.length);\n}", "function GetData(error, response) {\n if (error) throw error;\n\n //parsing data to JSON\n var display = JSON.parse(response[0].responseText);\n console.log(display);\n\n //creating lists, to store information for each variable\n list_countries = []\n list_variables_axes = []\n Life_Quality_mark = []\n Employement_Rate = []\n Voter_turnout = []\n\n // obtaining variables for the axes (total of three)\n variables_axes = display.dataSets[0].observations\n for (var i = 0; i < 10; i++)\n {\n for (var j = 0; j < 3; j++)\n {\n observation = i + \":\" + j + \":0:0\"\n list_variables_axes.push(variables_axes[observation][0])\n }\n }\n\n // storing ax variable 'Life_Quality_mark' in own list\n for (var i = 2; i < 30; i+=3){\n Life_Quality_mark.push(list_variables_axes[i])\n }\n\n // storing ax variable 'Voter_turnout' in own list\n for (var i = 0; i < 30; i+=3){\n\n Voter_turnout.push(list_variables_axes[i])\n }\n\n // storing ax variable 'Employement_Rate' in own list\n for (var i = 1; i < 30; i+=3){\n\n Employement_Rate.push(list_variables_axes[i])\n }\n\n // obtaining countries of DOM, and storing in a list\n countries = display.structure.dimensions.observation[0].values\n for (i = 0; i <10; i++){\n\n list_countries.push(countries[i]['name'])\n }\n\n // creating list (array in array), for all the variables\n dataset=[]\n\n // pushing all the variables to the list of the dataset\n for (i =0; i < 10; i++){\n dataset.push([list_countries[i],Life_Quality_mark[i],Voter_turnout[i],Employement_Rate[i]])\n }\n\n // creating list for dict\n dict = []\n\n // writing the data to a dictenory, called dict\n for(var data = 0; data < dataset.length; data++)\n {\n dict.push({\n \"Country\" : dataset[data][0],\n \"Life_Quality_mark\" : dataset[data][1],\n \"Voter_turnout\" : dataset[data][2],\n \"Employement_Rate\" : dataset[data][3],\n })\n }\n\n // calling the build function which gets the parameter dict\n build (dict);\n}", "function gotData(data) {\n // console.log(data);\n subData_ = data;\n timeline.unshift(new sR(subData_));\n island = [];\n //remap values for subredditSubscribers to 2, 1500\n //it will draw a minimum of 2 voronoi cells and a max of 1500 v. cells\n subMapped = map(timeline[0].subredditSubscribers, 1, maxSub, 36, 1500, true);\n //remap subredditSubscribers values to determinate the distance of the v. cell\n //more subredditSubscribers less distance, less subredditSubscribers more distance\n subMappedDist = map(timeline[0].subredditSubscribers, 1, maxSub, 50, 10, true);\n for (var i = 0; i < cellColors.length; i++){\n if (cellColors[i][3] == 'land'){\n island.push(cells[sites[i].voronoiId]);\n }\n }\n if (timeline.length == 1 || timeline[0].subredditSubscribers != timeline[1].subredditSubscribers){\n b = true;\n nameGenerator()\n }\n if (timeline.length > 1){\n b = false;\n }\n if (timeline.length > 2) {\n timeline.pop();\n }\n}", "function DrawTherapyDistribution(data, container) {\n $('#pharma_TherapyDistribution').empty();\n let medication = data.medication;\n // if (medication.toLowerCase() != 'all') {\n let patientDataefficacy = data.patientData.filter(function(a) {\n return (a.Medication == medication);\n });\n // console.log(analyticsPatientsData['efficacy']);\n // //\"8,12,16,24,48\"\n // var totalData = patientDataefficacy.filter(function(a) {\n // return (a.Medication == medication && a.isCured != null);\n // });\n // // console.log(totalData);\n\n // var curedData = patientDataefficacy.filter(function(a) {\n // return (a.Medication == medication && a.isCured == 1);\n // });\n\n let groupedDatatreatmentPeriod = _.groupBy(patientDataefficacy, 'treatmentPeriod');\n let groupedDataGenotype = _.groupBy(patientDataefficacy, 'genotype');\n\n let xvalues = [];\n let dataplot = [];\n\n for (let item in groupedDataGenotype) {\n let jsonObj = {};\n let itemdata = [];\n jsonObj['name'] = item;\n groupedDatatreatmentPeriod = _.groupBy(groupedDataGenotype[item], 'treatmentPeriod');\n for (let keys in groupedDatatreatmentPeriod) {\n var eff = 0;\n\n var totalData = groupedDatatreatmentPeriod[keys].filter(function(a) {\n return (a.isCured != null);\n });\n // console.log(totalData);\n\n var curedData = groupedDatatreatmentPeriod[keys].filter(function(a) {\n return (a.isCured == 1);\n });\n\n\n if (parseFloat(curedData.length) > 0 && parseFloat(totalData.length) > 0) {\n eff = (parseFloat(curedData.length) * 100) / parseFloat(totalData.length);\n }\n itemdata.push(eff);\n }\n jsonObj['data'] = itemdata;\n dataplot.push(jsonObj);\n // sum = 0;\n // if (parseFloat(groupedDataGenotype[item].length) > 0 && parseFloat(totalData.length) > 0) {\n // sum = (parseFloat(groupedDataGenotype[item].length) * 100) / parseFloat(totalData.length);\n // }\n // itemdata.push(sum);\n }\n //console.log(dataplot);\n for (let keys in groupedDatatreatmentPeriod) {\n xvalues.push(keys);\n }\n //console.log(dataplot);\n Highcharts.chart(container, {\n chart: {\n type: 'column'\n },\n title: {\n text: ' '\n },\n xAxis: {\n categories: xvalues\n },\n credits: {\n enabled: false\n },\n yAxis: {\n min: 0,\n title: {\n text: 'Efficacy %'\n },\n stackLabels: {\n enabled: true,\n formatter: function() {\n return parseFloat(this.total).toFixed(2) + \" %\";\n },\n style: {\n fontWeight: 'bold',\n color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'\n }\n }\n },\n legend: {\n // align: 'right',\n // x: -30,\n // verticalAlign: 'top',\n // y: 25,\n // floating: true,\n // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',\n // borderColor: '#CCC',\n // borderWidth: 1,\n // shadow: false\n show: false\n },\n tooltip: {\n formatter: function() {\n var s = '<b> Week : ' + this.x + '</b>';\n\n $.each(this.points, function(i, point) {\n s += '<br/><b> ' + point.series.name + ': </b>' + parseFloat(point.y).toFixed(2) + \" %\";\n });\n\n return s;\n },\n shared: true\n },\n plotOptions: {\n column: {\n // stacking: 'normal'\n dataLabels: {\n enabled: true,\n formatter: function() {\n return this.y.toFixed(2) + ' %';\n }\n }\n }\n },\n series: dataplot\n });\n\n // }\n}", "function processData(allRows) {\n console.log(allRows);\n \n var data = [];\n var penPos = [];\n var penNeg = [];\n var strPos = [];\n var strNeg = [];\n var neoPos = [];\n var neoNeg = [];\n // all the positive grain stain result MIC levels placed in array\n // all the negative grain stain result MIC levels placed in array\n for (var i = 0; i < allRows.length; i++) {\n var row = allRows[i];\n var x = row['Gram Staining '];\n if (x == 'positive') {\n penPos.push(Math.log(row['Penicilin']));\n strPos.push(Math.log(row['Streptomycin ']));\n neoPos.push(Math.log(row['Neomycin']));\n } else {\n penNeg.push(Math.log(row['Penicilin']));\n strNeg.push(Math.log(row['Streptomycin ']));\n neoNeg.push(Math.log(row['Neomycin']));\n }\n }\n // total amount of pencilin MIC levels (positive and negative)\n var pen = [];\n // total amount of streptomycin MIC levels (positive and negative)\n var str = [];\n // total amount of neomycin MIC levels (positive and negative)\n var neo = [];\n\n for (var i = 0; i < penPos.length; i++) {\n pen.push(penPos[i]);\n }\n for (var i = 0; i < penNeg.length; i++) {\n pen.push(penNeg[i]);\n }\n for (var i = 0; i < strPos.length; i++) {\n str.push(strPos[i]);\n }\n for (var i = 0; i < strNeg.length; i++) {\n str.push(strNeg[i]);\n }\n for (var i = 0; i < neoPos.length; i++) {\n neo.push(neoPos[i]);\n }\n for (var i = 0; i < neoNeg.length; i++) {\n neo.push(neoNeg[i]);\n }\n\n makeBarGraph(penPos, penNeg, strPos, strNeg, neoPos, neoNeg);\n makePlotly(penPos, penNeg, strPos, strNeg, neoPos, neoNeg);\n make3dPlot(pen, str, neo);\n }", "function makeVLSpec(data, domain, axis) {\n let vlSpec = {\n $schema: 'https://vega.github.io/schema/vega-lite/v3.json',\n \"width\": $('#plot').width(),\n \"height\": get_height()*.7,\n \"autosize\": {\n \"type\": \"fit\",\n \"contains\": \"padding\"\n },\n \"data\": data,\n\n \"layer\": [// Each Entry in the Layers define a plot\n {\n // Cat 4 drought area layer\n \"mark\": {\n \"opacity\": 1.0,\n \"type\": \"area\",\n \"color\": legend[\"D4\"]\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"d4\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": axis,\n },\n \"y2\": {\n \"field\": \"d5\",\n \"type\": \"quantitative\"\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n },\n \"tooltip\": null\n }\n }, {\n // Cat 3 drought area layer\n \"mark\": {\n \"opacity\": 1.0,\n \"type\": \"area\",\n \"color\": legend[\"D3\"]\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"d3\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"\",\n \"tickCount\": axis.tickCount\n }\n },\n \"y2\": {\n \"field\": \"d4\",\n \"type\": \"quantitative\"\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n },\n \"tooltip\": null\n }\n }, {\n // Cat 2 drought area layer\n \"mark\": {\n \"opacity\": 1.0,\n \"type\": \"area\",\n \"color\": legend[\"D2\"]\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"d2\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"\",\n \"tickCount\": axis.tickCount\n }\n },\n \"y2\": {\n \"field\": \"d3\",\n \"type\": \"quantitative\"\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n },\n \"tooltip\": null\n }\n }, {\n // Cat 1 drought area layer\n \"mark\": {\n \"opacity\": 1.0,\n \"type\": \"area\",\n \"color\": legend[\"D1\"]\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"d1\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"\",\n \"tickCount\": axis.tickCount\n }\n },\n \"y2\": {\n \"field\": \"d2\",\n \"type\": \"quantitative\"\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n },\n \"tooltip\": null\n }\n }, {\n // Cat 0 drought area layer\n \"mark\": {\n \"opacity\": 1.0,\n \"type\": \"area\",\n \"color\": legend[\"D0\"]\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"d0\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"\",\n \"tickCount\": axis.tickCount\n }\n },\n \"y2\": {\n \"field\": \"d1\",\n \"type\": \"quantitative\"\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n },\n \"tooltip\": null\n }\n }, {\n // Not in drought area layer\n \"mark\": {\n \"opacity\": 1.0,\n \"type\": \"area\",\n \"color\": legend[\"DN\"]\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"d0\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"\",\n \"tickCount\": axis.tickCount\n }\n },\n \"y2\": {\n \"field\": \"dn\",\n \"type\": \"quantitative\"\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n },\n \"tooltip\": null\n }\n }, {\n // NDMI Line\n \"mark\": {\n \"type\": \"line\",\n \"color\": \"#000000\",\n \"opacity\": 1.0,\n \"strokeDash\": [1, 10],\n \"point\": {\n \"type\": \"circle\",\n \"size\": 500,\n \"color\": \"#000000\",\n \"opacity\": 1.0\n }\n },\n \"encoding\": {\n \"y\": {\n \"field\": \"NDMI\",\n \"scale\": {\n \"domain\": domain\n },\n \"type\": \"quantitative\",\n \"axis\": {\n \"title\": \"\",\n \"tickCount\": axis.tickCount\n }\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"Date\",\n \"labelFontSize\": 24,\n \"titleFontSize\": 24,\n \"format\": \"%m/%d/%y\",\n \"labelAngle\": -60,\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n }\n }\n }, {\n // SMAP line\n \"mark\": {\n \"type\": \"line\",\n \"color\": \"#BB9999\",\n \"size\": \"3\",\n \"point\": {\n \"type\": \"square\",\n \"color\": \"#BB9999\",\n \"size\": \"75\"\n }\n },\n \"selection\": {\n // SELECTION IS HERE\n \"brush\": {\n \"type\": \"interval\",\n \"bind\": \"scales\",\n \"encodings\": [\"x\"]\n }\n },\n \"encoding\": {\n \"y\": {\n \"scale\": {\n \"domain\": domain\n },\n \"field\": \"moisture\",\n \"type\": \"quantitative\",\n },\n \"x\": {\n // This defines the x-axis and label\n \"field\": \"date1\",\n \"type\": \"temporal\",\n \"axis\": {\n \"title\": \"\",\n },\n \"scale\": {\n \"domain\": {\n \"selection\": \"brush\"\n }\n }\n }\n }\n }, ],\n // \"resolve\": {\n // \"scale\": {\n // \"y\": \"independent\"\n // }\n // }\n };\n return vlSpec;\n}", "function chart(selection) {\n selection.each(function (data) {\n // We can use the boundingClientRect to get a computed width and height\n // (even if this isn't explicitly set)\n width = this.getBoundingClientRect().width;\n height = this.getBoundingClientRect().height;\n\n // Set the scale domain & range based on the data extent\n xScale.domain(d3.extent(data, xValue))\n .range([0, width-margin.left-margin.right]);\n\n yScale.domain(d3.extent(data, function(d) {return yValue(d, yk0);}))\n .range([height-margin.top-margin.bottom, 0]);\n\n // Let's append the SVG object that will be our plot\n var svg = d3.select(this)\n .append(\"svg\")\n .attr(\"height\", height)\n .attr(\"width\", width)\n\n // Add a group with margins to hold the plot curve\n g = svg.append(\"g\")\n .attr(\"id\", \"chartbox\")\n .attr(\"transform\", \"translate(\"+margin.left+\",\"+margin.top+\")\");\n\n var bottom_axis = svg.append(\"g\") // Add the bottom axis \n .datum(data)\n .attr(\"class\", \"axis--x\")\n .attr(\"transform\", \"translate(\"+margin.left+\",\"+(height-margin.bottom-margin.top)+\")\")\n .call(xAxis);\n\n var left_axis = svg.append(\"g\") // Add the left axis \n .attr(\"transform\", \"translate(\"+margin.left+\",0)\")\n .call(yAxis);\n \n // Draw our primary line\n g.append(\"path\")\n .datum(data)\n .attr(\"class\", \"curve primary\")\n .attr(\"stroke\", \"#f2aa1f\")\n .attr(\"d\", line\n .y(function(d) {return yScale(yValue(d, yk0));}));\n \n // Add extra lines if the two extra keys are set\n if (yk1 != \"\") {\n g.append(\"path\")\n .datum(data)\n .attr(\"class\", \"curve secondary\")\n .attr(\"stroke\", \"#767a88\")\n .attr(\"d\", line\n .y(function(d) {return yScale(yValue(d, yk1));}));\n }\n if (yk2 != \"\") {\n g.append(\"path\")\n .datum(data)\n .attr(\"class\", \"curve tertiary\")\n .attr(\"stroke\", \"#767a88\")\n .attr(\"d\", line\n .y(function(d) {return yScale(yValue(d, yk2));}));\n }\n\n // Make sure the brush only covers the chart area\n brush.extent([[0,0], [width-margin.right-margin.left, height-margin.top-margin.bottom]]);\n \n // Add a brush event\n g.append(\"g\")\n .attr(\"class\", \"brush\")\n .call(brush\n .on(\"end\", function() {\n var s = d3.event.selection; // Grab the area selected\n if(s) {\n // Convert the selected area into a domain\n var domain = s.map(xScale.invert, xScale);\n // Scale the x domain\n xScale.domain(domain);\n // Scale the x axis\n g.select('.axis--x')\n .transition(t)\n .call(xAxis);\n\n // Scale the three curves\n g.select(\".primary\")\n .transition(t)\n .attr(\"d\", line\n .y(function(d) {return yScale(yValue(d, yk0));}));\n g.select(\".secondary\")\n .transition(t)\n .attr(\"d\", line\n .y(function(d) {return yScale(yValue(d, yk1));}));\n g.select(\".tertiary\")\n .transition(t)\n .attr(\"d\", line\n .y(function(d) {return yScale(yValue(d, yk2));}));\n \n // Reset the brush\n g.select('.brush').call(brush.move, null)\n }\n }));\n });\n }", "function processData() {\n\n\n maxYear = d3.max(data, function(d) { return d3.max(d.memberships, function(inner) { return inner.end }) });\n minYear = d3.min(data, function(d) { return d3.min(d.memberships, function(inner) { return inner.start; }) });\n scales.years = d3.scale.linear()\n .domain([ minYear,maxYear])\n .range([ padding.left, wid - padding.right ]);\n\n\n\n totalmemberships = d3.sum(data, function(d){return d.memberships.length});\n\n\n\n if (controls.height == \"memberships\")\n {\n hei = (totalmemberships* boxHeight) + 100;\n }\n else{\n\n hei = (data.length * boxHeight)+100;\n }\n\n\n barHeight = (hei - padding.top - padding.bottom) / data.length;\n\n scales.indexes = d3.scale.linear()\n .domain([ 0, totalmemberships- 1 ])\n .range([ padding.top, hei - padding.bottom - barHeight ]);\n\n\n scales.colorsScale = d3.scale.category20();\n\n\n scales.politicians = function(a) {\n return barHeight ;\n }\n\n scales.areas = function(a) {\n var percentage = a / totals.area;\n var range = hei - padding.top - padding.bottom;\n return range * percentage;\n }\n\n scales.popPercents = function(a) {\n if (isNaN(a)) a = defaultPopPercent;\n var percentage = a / totals.popPercent;\n var range = hei - padding.top - padding.bottom;\n return range * percentage;\n }\n\n\n //clear all;\n memberships = [];\n //find all other memberships by region and province\n var membershipsArray = data.map(function(d) { return d.memberships.map( function(z){ return z.role + \"-\" + z.organization.name }); })\n //and now we remove duplicates\n membershipsArray = d3.merge(membershipsArray);\n $.each(membershipsArray, function(i, el){\n if($.inArray(el, memberships) === -1) memberships.push(el);\n });\n //now we order them\n memberships.sort(function(a, b){ return d3.ascending(a, b);});\n\n\n\n\n\n // calculate ordering items\n var y_area = padding.top;\n // Height\n var y_popPercent = padding.top;\n for(i = 0; i < data.length; i++) {\n data[i].position = i;\n //Check sort by date\n d = data[i].memberships = data[i].memberships.sort(function(a, b){ return d3.ascending(a.start, b.start); });\n for (var j = 0; j < d.length; j++) {\n d[j].area_y = y_area;\n\n y_area += scales.areas(d[j].Land_area_million_km2);\n\n d[j].popPercent_y = y_popPercent;\n if (isNaN(d[j].Percent_World_Population)) y_popPercent += scales.popPercents(defaultPopPercent);\n else y_popPercent += scales.popPercents(d[j].Percent_World_Population);\n\n d[j].politician = data[i];\n d[j].parent = i;\n\n d[j].position = j;\n //Post Position\n d[j].membershipsPosition = memberships.indexOf(d[j].role + \"-\" + d[j].organization.name);\n\n\n //Save previous year reference to be uses on carrear compare\n\n if (j -1 >=0){\n d[j].pre = d[j-1];\n }\n else{\n d[j].pre = {start:0, pre:0, tx:0} ;\n }\n\n\n };\n\n\n }\n\n\n\n\n}", "function initBoxPlot(vizData, lookups) {\n var chaptersData = vizData[\"chaptersData\"]\n var chaptersNames = lookups[\"chaptersNames\"]\n var users = lookups[\"users\"]\n var usersEmailHash = lookups[\"usersEmailHash\"]\n var weeksData = vizData[\"weeksData\"]\n var weeksNames = lookups[\"weeksNames\"]\n var numOfWeeks = weeksData.length\n var text = users.map(x => x.first_name + \" \" + x.last_name + \"<\" + x.email + \">\")\n var dataTables = null;\n var currentBoxTab = 'weeks';\n\n function createDataTables(chosenStudentsInfo, caption) {\n var caption = caption || \"\"\n\n if ($(\".students_caption\").length) {\n $(\".students_caption\").text(caption);\n } else {\n $('#students_info').append('<caption style=\"caption-side: top\" class=\"students_caption\">' + caption + '</caption>');\n }\n\n return $('#students_info').DataTable({\n destroy: true,\n data: chosenStudentsInfo,\n columns: [\n { title: \"Fist Name\" },\n { title: \"Last Name\" },\n { title: \"Email\" },\n { title: \"Reading time\" }\n ]\n });\n }\n\n function clearDataTables(dataTables) {\n if ($(\".students_caption\").length) {\n $(\".students_caption\").text(\"\");\n }\n\n dataTables.rows()\n .remove()\n .draw();\n }\n\n // plotly data\n var plotlyBoxData = []\n var weeksVisible = []\n var chaptersVisible = []\n // Add weeks\n for (var i = 0; i < weeksData.length; i++) {\n var result = {\n name: weeksNames[i],\n width: 0.5,\n quartilemethod: \"inclusive\",\n type: 'box',\n y: weeksData[i],\n text: text,\n hoverinfo: \"all\",\n hovertemplate: \"%{text}<br>%{y:.2f} mins<extra></extra>\",\n boxpoints: 'all',\n boxmean: \"sd\",\n jitter: 0.2,\n whiskerwidth: 0.2,\n fillcolor: 'cls',\n marker: {\n outliercolor: 'rgb(255, 0, 0)',\n size: 3,\n symbol: '0',\n opacity: 1\n },\n selectedpoints: [],\n selected: {\n marker: {\n size: 7,\n color: 'rgb(255, 0, 0)'\n }\n },\n line: {\n width: 1\n },\n hoverlabel: {\n font: { size: 15 }\n }\n };\n plotlyBoxData.push(result);\n weeksVisible.push(true)\n chaptersVisible.push(false)\n };\n\n // Add chapters\n for (var i = 0; i < chaptersData.length; i++) {\n var result = {\n name: chaptersNames[i],\n width: 0.5,\n quartilemethod: \"inclusive\",\n type: 'box',\n y: chaptersData[i],\n text: text,\n hoverinfo: \"all\",\n hovertemplate: \"%{text}<br>%{y:.2f} mins<extra></extra>\",\n boxpoints: 'all',\n boxmean: \"sd\",\n jitter: 0.2,\n whiskerwidth: 0.2,\n fillcolor: 'cls',\n marker: {\n outliercolor: 'rgb(255, 0, 0)',\n size: 3,\n symbol: '0',\n opacity: 1\n },\n selectedpoints: [],\n selected: {\n marker: {\n size: 7,\n color: 'rgb(255, 0, 0)'\n }\n },\n line: {\n width: 1\n },\n hoverlabel: {\n font: { size: 15 }\n },\n visible: false\n };\n plotlyBoxData.push(result);\n weeksVisible.push(false)\n chaptersVisible.push(true)\n };\n\n // plotly menu\n var updatemenus = [\n {\n buttons: [\n {\n name: 'weeks',\n args: [{ 'visible': weeksVisible }, {\n 'title': 'Total time students spend on OpenDSA materials per week.'\n }],\n label: 'Weeks',\n method: 'update'\n },\n {\n name: 'chapters',\n args: [{ 'visible': chaptersVisible }, {\n 'title': 'Total time students spend on OpenDSA materials per chapter.'\n }],\n label: 'Chapters',\n method: 'update'\n }\n ],\n direction: 'left',\n pad: { 'r': 10, 't': 10 },\n showactive: true,\n type: 'buttons',\n x: 1,\n xanchor: 'right',\n y: 1.2,\n yanchor: 'top'\n },\n {\n buttons: [\n {\n name: 'reset',\n label: 'Reset',\n method: 'skip',\n execute: false\n },\n {\n name: '25',\n label: '25th percentile',\n method: 'skip',\n execute: false\n },\n {\n name: '50',\n label: '50th percentile',\n method: 'skip',\n execute: false\n }\n ],\n direction: 'left',\n pad: { 'r': 10, 't': 10 },\n showactive: false,\n type: 'buttons',\n x: 0,\n xanchor: 'left',\n y: 1.2,\n yanchor: 'top'\n }\n ]\n\n // plotly layout\n var plotlyBoxLayout = {\n 'title': 'Total time students spend on OpenDSA materials per week.',\n updatemenus: updatemenus,\n yaxis: {\n title: 'Reading time in mins.',\n autorange: true,\n showgrid: true,\n zeroline: true,\n gridcolor: 'rgb(255, 255, 255)',\n gridwidth: 1,\n zerolinecolor: 'rgb(255, 255, 255)',\n zerolinewidth: 2\n },\n margin: {\n l: 40,\n r: 30,\n b: 80,\n t: 100\n },\n paper_bgcolor: 'rgb(243, 243, 243)',\n plot_bgcolor: 'rgb(243, 243, 243)',\n showlegend: true,\n legend: {\n x: 1.07,\n xanchor: 'right',\n y: 1\n }\n }\n\n // get the index(es) of the active trace(s)\n function getActiveTraces() {\n var calcdata = plotlyBoxDiv.calcdata\n var activeTraces = []\n for (var i = 0; i < calcdata.length; i++) {\n if (calcdata[i][0]['x'] != undefined)\n activeTraces.push(i)\n }\n return activeTraces\n }\n\n function updateBoxPlot(chosenStudents) {\n var chosenStudents = chosenStudents || []\n var traceIndex = getActiveTraces()\n\n for (var i = 0; i < traceIndex.length; i++) {\n plotlyBoxData[traceIndex[i]]['selectedpoints'] = chosenStudents\n }\n Plotly.update(plotlyBoxDiv, plotlyBoxData, plotlyBoxLayout)\n };\n\n //\n // selectize code\n // initialize selectize for box plot\n $selectize = $('#select-for-box')\n .selectize({\n plugins: ['remove_button'],\n persist: false,\n maxItems: null,\n valueField: 'email',\n labelField: 'name',\n searchField: ['first_name', 'last_name', 'email'],\n sortField: [\n { field: 'first_name', direction: 'asc' },\n { field: 'last_name', direction: 'asc' }\n ],\n options: users,\n render: {\n item: function (item, escape) {\n var name = formatName(item);\n return '<div>' +\n (name ? '<span class=\"name\">' + escape(name) + '</span>' : '') +\n (item.email ? '<span class=\"email\">' + escape(item.email) + '</span>' : '') +\n '</div>';\n },\n option: function (item, escape) {\n var name = formatName(item);\n var label = name || item.email;\n var caption = name ? item.email : null;\n return '<div>' +\n '<span class=\"label\">' + escape(label) + '</span>' +\n (caption ? '<span class=\"caption\">' + escape(caption) + '</span>' : '') +\n '</div>';\n }\n },\n createFilter: function (input) {\n var regexpA = new RegExp('^' + REGEX_EMAIL + '$', 'i');\n var regexpB = new RegExp('^([^<]*)\\<' + REGEX_EMAIL + '\\>$', 'i');\n return regexpA.test(input) || regexpB.test(input);\n },\n create: function (input) {\n if ((new RegExp('^' + REGEX_EMAIL + '$', 'i')).test(input)) {\n return { email: input };\n }\n var match = input.match(new RegExp('^([^<]*)\\<' + REGEX_EMAIL + '\\>$', 'i'));\n if (match) {\n var name = $.trim(match[1]);\n var pos_space = name.indexOf(' ');\n var first_name = name.substring(0, pos_space);\n var last_name = name.substring(pos_space + 1);\n\n return {\n email: match[2],\n first_name: first_name,\n last_name: last_name\n };\n }\n return false;\n }\n })\n\n var selectize = $selectize[0].selectize;\n\n // show current values in multi input dropdown\n $('select#select-for-box.selectized')\n .each(function () {\n var update = function (e) {\n var selectedStudents = $(this).val();\n if (selectedStudents) {\n var chosenStudents = [];\n for (var i = 0; i < selectedStudents.length; i++) {\n chosenStudents.push(usersEmailHash[selectedStudents[i]]);\n }\n updateBoxPlot(chosenStudents)\n if (dataTables) {\n clearDataTables(dataTables)\n }\n }\n }\n\n $(this).on('change', update);\n });\n\n // plotly initialize\n var plotlyBoxDiv = $(\"#plotlyBoxDiv\")[0]\n var promise = new Promise((resolve, reject) => {\n Plotly.newPlot(plotlyBoxDiv, plotlyBoxData, plotlyBoxLayout)\n .then(() => {\n resolve()\n })\n })\n\n // event handler to select points and show dataTables\n plotlyBoxDiv.on('plotly_buttonclicked', function (e) {\n var buttonName = e.button.name;\n var plotMean = null;\n var plotQ1 = null;\n var traceIndex = null\n var chosenStudents = [];\n var chosenStudentsInfo = [];\n var studentInfo = {};\n selectize.clear()\n\n if (['weeks', 'chapters'].includes(buttonName)) {\n currentBoxTab = buttonName;\n if (dataTables) {\n clearDataTables(dataTables)\n }\n } else {\n traceIndex = getActiveTraces()[0]\n\n plotMean = plotlyBoxDiv.calcdata[traceIndex][0]['med'];\n plotQ1 = plotlyBoxDiv.calcdata[traceIndex][0]['q1'];\n\n var tabIndex = (traceIndex + 1 > numOfWeeks) ? traceIndex - numOfWeeks : traceIndex;\n var refData = vizData[(currentBoxTab == 'weeks') ? 'weeksData' : 'chaptersData'][tabIndex]\n var refName = (currentBoxTab == 'weeks') ? weeksNames[tabIndex] : chaptersNames[tabIndex]\n if (buttonName == '25') {\n for (var i = 0; i < refData.length; i++) {\n if (refData[i] <= plotQ1) {\n chosenStudents.push(i);\n studentInfo = users[i]\n chosenStudentsInfo.push([studentInfo['first_name'], studentInfo['last_name'], studentInfo['email'], refData[i]])\n }\n }\n dataTables = createDataTables(chosenStudentsInfo, \"Students reading time less than 25th percentile for \" + refName)\n } else if (buttonName == '50') {\n for (var i = 0; i < refData.length; i++) {\n if (refData[i] <= plotMean) {\n chosenStudents.push(i);\n studentInfo = users[i]\n chosenStudentsInfo.push([studentInfo['first_name'], studentInfo['last_name'], studentInfo['email'], refData[i]])\n }\n }\n dataTables = createDataTables(chosenStudentsInfo, \"Students reading time less than 50th percentile for \" + refName)\n } else {\n chosenStudents = []\n if (dataTables) {\n clearDataTables(dataTables)\n }\n }\n\n plotlyBoxData[traceIndex]['selectedpoints'] = chosenStudents\n Plotly.update(plotlyBoxDiv, plotlyBoxData, plotlyBoxLayout);\n }\n })\n return promise\n }", "function addScatterPlotDetailed(fetch_data_array){\r\n\t\r\nvar margin = {top: 20, right: 20, bottom: 30, left: 80},\r\n width = 1200 - margin.left - margin.right,\r\n height = 1800 - margin.top - margin.bottom;\r\n\r\n/* \r\n * value accessor - returns the value to encode for a given data object.\r\n * scale - maps value to a visual display encoding, such as a pixel position.\r\n * map function - maps from data value to display value\r\n * axis - sets up axis\r\n */\r\n\r\n\r\n\r\n// setup x \r\nvar xValue = function(d) { return d.male;}, // data -> value\r\n xScale = d3.scale.linear().range([0, width]), // value -> display\r\n xMap = function(d) { return xScale(xValue(d));}, // data -> display\r\n xAxis = d3.svg.axis().scale(xScale).orient(\"bottom\");\r\n\t\r\n// setup y\r\nvar yValue = function(d) { return d.female;}, // data -> value\r\n yScale = d3.scale.linear().range([height, 0]), // value -> display\r\n yMap = function(d) { return yScale(yValue(d));}, // data -> display\r\n yAxis = d3.svg.axis().scale(yScale).orient(\"left\");\r\n\t\r\n\t// setup fill color\r\nvar cValue = function(d) { return d.cancertypedetailed;},\r\n color = d3.scale.category10();\r\n\t\r\n// add the graph canvas to the body of the webpage\r\n\r\nvar svg = d3.select(\"body\").append(\"svg\")\r\n .attr(\"width\", width + margin.left + margin.right)\r\n .attr(\"height\", height + margin.top + margin.bottom)\r\n .append(\"g\")\r\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\r\n\t\r\n\r\n\t// add the tooltip area to the webpage\r\nvar tooltip = d3.select(\"body\").append(\"div\")\r\n .attr(\"class\", \"tooltip\")\r\n .style(\"opacity\", 0);\r\n\r\n fetch_data_array.forEach(function(d) {\r\n\td.male = +d.male;\r\n d.female = +d.female;\r\n\t\r\n});\r\n\r\n\r\n // don't want dots overlapping axis, so add in buffer to data domain\r\n xScale.domain([d3.min(fetch_data_array, xValue)-1, d3.max(fetch_data_array, xValue)+1]);\r\n yScale.domain([d3.min(fetch_data_array, yValue)-1, d3.max(fetch_data_array, yValue)+1]); \r\n\r\n // x-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"x axis\")\r\n .attr(\"transform\", \"translate(0,\" + height + \")\")\r\n .call(xAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"x\", width)\r\n .attr(\"y\", -6)\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Male Count\");\r\n\t \r\n\t // y-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"y axis\")\r\n .call(yAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"transform\", \"rotate(-90)\")\r\n .attr(\"y\", 66)\r\n .attr(\"dy\", \".71em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Female Count\");\r\n \r\n// draw dots\r\n svg.selectAll(\".dot\")\r\n .data(fetch_data_array)\r\n .enter().append(\"circle\")\r\n .attr(\"class\", \"dot\")\r\n .attr(\"r\", 6.5)\r\n .attr(\"cx\", xMap)\r\n .attr(\"cy\", yMap)\r\n .style(\"fill\", function(d) { return color(cValue(d));}) \r\n .on(\"mouseover\", function(d) {\r\n tooltip.transition()\r\n .duration(200)\r\n .style(\"opacity\", .9);\r\n tooltip.html(d[\"cancertypedetailed\"] + \"<br/> (\" + xValue(d) \r\n\t + \", \" + yValue(d) + \")\")\r\n .style(\"left\", (d3.event.pageX + 5) + \"px\")\r\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\r\n })\r\n .on(\"mouseout\", function(d) {\r\n tooltip.transition()\r\n .duration(500)\r\n .style(\"opacity\", 0);\r\n });\r\n\r\n// draw legend\r\n var legend = svg.selectAll(\".legend\")\r\n .data(color.domain())\r\n .enter().append(\"g\")\r\n .attr(\"class\", \"legend\")\r\n .attr(\"transform\", function(d, i) { return \"translate(0,\" + i * 20 + \")\"; }); \r\n\r\n // draw legend colored rectangles\r\n legend.append(\"rect\")\r\n .attr(\"x\", width - 18)\r\n .attr(\"width\", 18)\r\n .attr(\"height\", 18)\r\n .style(\"fill\", color); \r\n\t \r\n\t \r\n\r\n // draw legend text\r\n legend.append(\"text\")\r\n .attr(\"x\", width - 24)\r\n .attr(\"y\", 9)\r\n .attr(\"dy\", \".35em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(function(d) { return d;}) \r\n\t \r\n\t//d3.select(\"svg\").remove();\r\n\r\n}", "function getDataFrame(performance_measurements) {\n var data = {};\n\n // shadow_blur * total bounding box area\n data[\"SHADOW_BLUR_TIMES_AREA\"] = [];\n\n // shadow_blur^2 * total bounding box area\n data[\"SHADOW_BLUR_SQUARED_TIMES_AREA\"] = [];\n\n // shadow_blur^2 * total shadow bounding box area\n data[\"SHADOW_BLUR_SQUARED_TIMES_SHADOW_AREA\"] = [];\n\n // the number of draw calls that have a shadow\n data[\"NUM_SHADOWS\"] = [];\n\n data[\"CALL_TYPE\"] = [];\n\n for (var i = 0; i < performance_measurements.length; i++) {\n var performance_measurement = performance_measurements[i];\n for (var j = 0; j < performance_measurement.parameters.length; j++) {\n var p = performance_measurement.parameters[j];\n var call_type = p.call_type + \"_\" + p.draw_sub_type;\n var call_type_area = p.call_type + \"_\" + p.draw_sub_type + \"_AREA\";\n\n data[call_type] = [];\n data[call_type_area] = [];\n\n if (p.call_type == CALL_TYPE.PATH) {\n data[p.fill_style] = [];\n data[p.fill_style + \"_AREA\"] = [];\n }\n }\n }\n\n for (var i = 0; i < performance_measurements.length; i++) {\n var performance_measurement = performance_measurements[i];\n for (var j = 0; j < performance_measurement.parameters.length; j++) {\n var p = performance_measurement.parameters[j];\n for (var key in data) {\n data[key].push(0);\n }\n\n var call_type = p.call_type + \"_\" + p.draw_sub_type;\n var call_type_area = p.call_type + \"_\" + p.draw_sub_type + \"_AREA\";\n\n data[call_type][i] += p.quantity;\n\n data[call_type_area][i] += p.total_bounding_box_area;\n\n if (p.call_type == CALL_TYPE.PATH) {\n data[p.fill_style][i] += p.quantity;\n data[p.fill_style + \"_AREA\"][i] += p.total_bounding_box_area;\n }\n\n if (p.call_type == CALL_TYPE.PATH || p.call_type == CALL_TYPE.IMAGE) {\n data[\"NUM_SHADOWS\"][i] += (p.shadow_blur > 0.0) ? p.quantity : 0;\n\n data[\"SHADOW_BLUR_TIMES_AREA\"][i] +=\n p.total_bounding_box_area * p.shadow_blur;\n\n data[\"SHADOW_BLUR_SQUARED_TIMES_AREA\"][i] +=\n p.total_bounding_box_area * p.shadow_blur * p.shadow_blur;\n\n data[\"SHADOW_BLUR_SQUARED_TIMES_SHADOW_AREA\"][i] +=\n p.total_shadow_bounding_box_area * p.shadow_blur * p.shadow_blur;\n }\n\n data[\"CALL_TYPE\"][i] = p.call_type;\n }\n }\n\n return data;\n}", "function showInfo( data ) {\n\t// get current date and extract year\n\tvar today = new Date(),\n\t\tcurr_year = today.getFullYear();\n\n\t// create a variable to parse year with D3\n\tvar parseYear = d3.timeParse( \"%Y\" );\n\tconsole.log( \"Spreadsheet data loaded on\", today.toJSON() );\n\n\t/****\n\t LOAD DATA INTO VARIABLES\n\t****/\n\t// load individual sheet elements into variables\n\tvar exportImportData = data.all_exports_ng_exports_net_imports.elements;\n\t/*windHydroCapData = data.wind_over_hydro_cap.elements,\n\twindHydroGenData = data.wind_over_hydro_gen.elements,*/\n\t// console.table( exportImportData );\n\n\t// create universal color scale\n\tvar lineColors = d3.scaleOrdinal()\n\t\t.range( chart_colors );\n\n\t/****\n\t DRAW CHART #1: Exports vs. NG exports vs. net imports vs. NG vs. crude oil prod\n\t****/\n\t// set oldest year to get data from\n\tvar minYr = 1997;\n\n\t// set units for Y axis values\n\tvar yUnits = \"Quadrillion Btu\",\n\t\tyUnitsAbbr = \"quads\";\n\n\t// declare arrays for separate data\n\tvar primaryExports = [], // primary energy exports data\n\t\tnetImports = [], // primary energy net imports data\n\t\tngProd = [], // NG (dry) production data\n\t\tcrudeProd = [], // crude oil production data\n\t\tallExpImpProd = []; // combined data\n\n\t/* CONTAINER DIV + CHART DIMENSIONS*/\n\t// get chart container width\n\tvar contWidth = chart_container.width();\n\n\t// set default container width as fallback\n\tif ( contWidth == undefined || isNaN( contWidth ) ) {\n\t\tcontWidth = 600;\n\t}\n\n\tvar iepWidth = contWidth - chart_margins.left - chart_margins.right;\n\n\t// adjust chart width based on device width\n\tif ( contWidth < mobile_threshold ) {\n\t\tiepWidth = iepWidth * 0.70;\n\t} else if ( contWidth < tablet_threshold ) {\n\t\tiepWidth = iepWidth * 0.75;\n\t} else if ( contWidth < large_threshold ) {\n\t\tiepWidth = iepWidth * 0.85;\n\t}\n\n\t// calculate heights in proportion to the width\n\tvar contHeight = Math.ceil( ( contWidth * graphic_aspect_height ) / graphic_aspect_width ),\n\t\tiepHeight = Math.ceil( ( iepWidth * graphic_aspect_height ) / graphic_aspect_width );\n\n\t// reset container height\n\tchart_container.height( contHeight );\n\n\t/* ACCESS DATA AND POPULATE VARIABLES */\n\t// loop through each row of data\n\texportImportData.forEach( function ( d, i ) {\n\t\t// parse date to year\n\t\tvar wDate = new Date( d.year );\n\t\td.year = wDate.getUTCFullYear();\n\n\t\tif ( d.year >= minYr ) {\n\t\t\tprimaryExports[ i ] = d[ \"Total Energy Exports\" ];\n\t\t\tnetImports[ i ] = d[ \"Net Energy Imports\" ];\n\t\t\tngProd[ i ] = d[ \"Total Energy Net Imports\" ];\n\t\t\tcrudeProd[ i ] = d[ \"Net Energy Imports\" ];\n\t\t}\n\t} );\n\n\t// filter out data starting at minYr\n\texportImportData = exportImportData.filter( e => e.year >= minYr );\n\n\t// concatenate all data into one array\n\tallExpImpProd = primaryExports.concat( netImports ).concat( ngProd ).concat( crudeProd );\n\tallMinMax = d3.extent( allExpImpProd );\n\n\t// assign chart colors to data\n\tlineColors.domain( d3.keys( exportImportData[ 0 ] ).filter( function ( key ) {\n\t\t// filter through the keys excluding certain columns, e.g. x-axis data\n\t\treturn key !== \"year\" && key !== \"Natural Gas Exports\";\n\t} ) );\n\n\t/* NUMBER OF TICKS */\n\t// set number of ticks on x-axis based on data\n\tvar num_x_ticks = exportImportData.length; // include one tick for each year\n\n\t// set constant number of ticks for smaller devices\n\tif ( contWidth < mobile_threshold ) {\n\t\tnum_x_ticks = 5;\n\t} else if ( contWidth < tablet_threshold ) {\n\t\tnum_x_ticks = 7;\n\t}\n\n\t// clear out existing chart (important for redraw)\n\tchart_container.empty();\n\n\t// select container div by ID + create SVG and main g elements within\n\tvar impExpProd = d3.select( \"#export-import-prod\" ),\n\t\t// create SVG viewport\n\t\tg = impExpProd.append( \"svg:svg\" )\n\t\t.attr( \"id\", \"import-export-prod-chart\" )\n\t\t.attr( \"width\", iepWidth )\n\t\t.attr( \"height\", iepHeight );\n\n\t// append definitions\n\tg.append( \"defs\" )\n\t\t.append( \"clipPath\" )\n\t\t.attr( \"id\", \"lines-clip\" )\n\t\t.append( \"rect\" )\n\t\t.attr( \"width\", iepWidth + chart_margins.left )\n\t\t.attr( \"height\", iepHeight + ( chart_margins.bottom * 4 ) )\n\t\t.attr( \"x\", -chart_margins.left / 2 )\n\t\t.attr( \"y\", -chart_margins.top / 2 );\n\n\t// append g element container for intro text\n\tvar chartIntro = g.append( \"svg:g\" )\n\t\t.attr( \"class\", \"chart-intro\" );\n\n\t// append chart title to intro group\n\tchartIntro.append( \"svg:text\" )\n\t\t.attr( \"y\", chart_margins.top / 2 )\n\t\t.attr( \"class\", \"titles_chart-main\" )\n\t\t.text( chart_title );\n\n\t// append chart summary to intro group\n\tchartIntro.append( \"svg:text\" )\n\t\t.attr( \"class\", \"titles_chart-summary\" )\n\t\t.text( chart_intro )\n\t\t.call( wrap, iepWidth, 4, 1.5 );\n\n\t// append main g element container for the chart\n\tvar chart = g.append( \"svg:g\" )\n\t\t.attr( \"transform\", \"translate(\" + chart_margins.left + \",\" + ( chart_margins.top * 2 ) + \")\" )\n\t\t.attr( \"class\", \"chart-wrapper\" );\n\n\t// X axis: scale + axis function variables\n\tvar iepX = d3.scaleTime()\n\t\t.domain( d3.extent( exportImportData, function ( d ) {\n\t\t\treturn parseYear( d.year );\n\t\t} ) )\n\t\t.range( [ -chart_margins.left / 2, iepWidth + ( chart_margins.right / 2 ) ] );\n\n\txAxis = d3.axisBottom( iepX )\n\t\t.ticks( num_x_ticks );\n\n\t// Y axis: scale + axis function variables\n\tvar iepY = d3.scaleLinear()\n\t\t.domain( [ 0, allMinMax[ 1 ] ] )\n\t\t.range( [ iepHeight, 0 ] ),\n\t\tyAxis = d3.axisRight( iepY )\n\t\t.ticks( 5 ) // specify the scale of the axis\n\t\t.tickSizeInner( iepWidth + chart_margins.left ) // scale ticks across chart width\n\t\t.tickPadding( 6 )\n\t\t.tickFormat( function ( d ) {\n\t\t\treturn ( d );\n\t\t} );\n\n\t// create custom function for Y axis\n\tfunction customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tchart.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tchart.call( yAxis );\n\t\tchart.select( \".domain\" );\n\t\tchart.attr( \"text-anchor\", \"end\" );\n\t\tchart.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tchart.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t} // appends y-axis to chart group\n\n\t// formula to create lines\n\tvar line = d3.line()\n\t\t.x( function ( d ) {\n\t\t\treturn iepX( parseYear( d.year ) );\n\t\t} )\n\t\t.y( function ( d ) {\n\t\t\treturn iepY( d.btu );\n\t\t} );\n\n\t// map data to individual lines\n\tvar sourceLines = lineColors.domain().map( function ( source ) {\n\t\treturn {\n\t\t\tsource: source,\n\t\t\tvalues: exportImportData.map( function ( s ) {\n\t\t\t\treturn {\n\t\t\t\t\tyear: s.year,\n\t\t\t\t\tbtu: +s[ source ]\n\t\t\t\t};\n\t\t\t} )\n\t\t}\n\t} );\n\n\tvar allSources = [],\n\t\tsourceById = [];\n\t// loop through source data to parse sources and IDs (keys) for each source\n\tsourceLines.forEach( function ( d, i ) {\n\t\tallSources[ i ] = d.source;\n\t\tsourceById[ d.source ] = i;\n\t} );\n\n\t/* append SVG elements */\n\t// append X axis element: calls xAxis function\n\tchart.append( \"g\" )\n\t\t.attr( \"id\", \"iep-x-axis\" )\n\t\t.attr( \"transform\", \"translate(0, \" + iepHeight + \")\" )\n\t\t.call( xAxis )\n\t\t.select( \".domain\" ).remove();\n\n\t// append Y axis element: calls yAxis function\n\tchart.append( \"g\" )\n\t\t.attr( \"id\", \"iep-y-axis\" )\n\t\t.call( customYAxis )\n\t\t.append( \"text\" ) // add axis label\n\t\t.attr( \"transform\", \"rotate(-90)\" ) // rotate level 90º counterclockwise\n\t\t.attr( \"x\", -( iepHeight / 2 ) ) // center label vertically\n\t\t.attr( \"y\", -35 )\n\t\t.attr( \"dy\", \".71em\" )\n\t\t.attr( \"class\", \"titles_axis-y\" )\n\t\t.text( yUnits );\n\n\t// add containers for lines and markers\n\tchart.append( \"g\" )\n\t\t.attr( \"id\", \"lines\" )\n\t\t.attr( \"clip-path\", \"url(#lines-clip)\" );\n\n\t// draw/append all data lines\n\tvar sourceLine = chart.select( \"#lines\" )\n\t\t.selectAll( \".source\" )\n\t\t.data( sourceLines )\n\t\t.enter().append( \"g\" )\n\t\t.attr( \"class\", \"source\" );\n\n\t// add lines for each source group\n\tvar linePath = chart.selectAll( \".source\" )\n\t\t.append( \"path\" )\n\t\t.attr( \"class\", \"line\" )\n\t\t.attr( \"d\", function ( d ) {\n\t\t\treturn line( d.values );\n\t\t} )\n\t\t.style( \"stroke-width\", function ( d ) {\n\t\t\t// assign stroke width based on source value\n\t\t\treturn stroke_widths[ sourceById[ d.source ] ];\n\t\t} )\n\t\t.style( \"stroke\", function ( d ) {\n\t\t\treturn lineColors( d.source );\n\t\t} );\n\n\tchart.selectAll( \".line\" )\n\t\t.attr( \"id\", function ( d ) {\n\t\t\treturn d.source;\n\t\t} )\n\t\t.call( transition ); // call function to animate lines\n\n\t// declare function to animate the lines\n\tfunction transition( path ) {\n\t\tpath.attr( \"stroke-dashoffset\", pathLength ) // set full length first for ltr anim\n\t\t\t.transition()\n\t\t\t.duration( 3000 )\n\t\t\t.attrTween( \"stroke-dasharray\", dashArray )\n\t\t\t.attr( \"stroke-dashoffset\", 0 );\n\t}\n\n\t// declare function to calculate stroke dash array\n\tfunction dashArray() {\n\t\tvar l = this.getTotalLength(),\n\t\t\ti = d3.interpolateString( \"0,\" + l, l + \",\" + l );\n\t\treturn function ( t ) {\n\t\t\treturn i( t );\n\t\t};\n\t}\n\n\t// declare function to calculate full length of path\n\tfunction pathLength() {\n\t\tvar l = this.getTotalLength();\n\t\treturn -l;\n\t}\n\n\t// add line labels group\n\tchart.append( \"g\" )\n\t\t.attr( \"id\", \"line-labels\" );\n\n\t// draw/append labels for every line\n\tvar lineLabels = chart.select( \"#line-labels\" )\n\t\t.selectAll( \".line-label\" )\n\t\t.data( sourceLines )\n\t\t.enter().append( \"text\" )\n\t\t.attr( \"class\", \"line-label\" )\n\t\t.datum( function ( d ) {\n\t\t\treturn {\n\t\t\t\tsource: d.source,\n\t\t\t\tvalue: d.values[ 0 ]\n\t\t\t};\n\t\t} )\n\t\t.text( function ( d ) {\n\t\t\treturn d.source;\n\t\t} )\n\t\t.attr( \"transform\", function ( d ) {\n\t\t\treturn \"translate(\" + ( iepX( parseYear( d.value.year ) ) + 5 ) + \",\" + ( iepY( d.value.btu ) + 3 ) + \")\";\n\t\t} )\n\t\t.style( \"fill\", function ( d ) {\n\t\t\treturn lineColors( d.source );\n\t\t} )\n\t\t.style( \"font-weight\", function ( d ) {\n\t\t\t// assign font weight based on source value\n\t\t\treturn font_weights[ sourceById[ d.source ] ];\n\t\t} )\n\t\t.call( wrap, 115, .05, 1.1 );\n\n\t// create custom function for Y axis\n\tfunction customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tg.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tg.call( yAxis );\n\t\tg.select( \".domain\" );\n\t\tg.attr( \"text-anchor\", \"end\" );\n\t\tg.selectAll( \".tick:not(:first-of-type) line\" ).attr( \"stroke\", \"#777\" ).attr( \"stroke-dasharray\", \"2,2\" );\n\t\tg.selectAll( \".tick text\" ).attr( \"x\", -4 ).attr( \"dy\", 0 );\n\t}\n\n\t// draw/append tooltip container\n\tvar tooltip = d3.select( \"#export-import-prod\" )\n\t\t.append( \"div\" )\n\t\t// .attr( \"transform\", \"translate(-100,-100)\" )\n\t\t.attr( \"class\", \"tooltip\" )\n\t\t.style( \"pointer-events\", \"none\" );\n\n\t// append container div for text\n\tvar tooltip_text = tooltip.append( \"div\" )\n\t\t.attr( \"class\", \"tooltip_text\" );\n\n\t// append paragraph for year\n\ttooltip_text.append( \"p\" )\n\t\t.attr( \"class\", \"tooltip_title\" );\n\n\t// append paragraph for point value\n\ttooltip_text.append( \"p\" )\n\t\t.attr( \"class\", \"tooltip_data\" );\n\n\t// append div for pointer/marker\n\ttooltip.append( \"div\" )\n\t\t.attr( \"class\", \"tooltip_marker\" );\n\n\t/* VORONOI for rollover effects */\n\t// create array variable for flattened data\n\tvar flatData = [];\n\t// flatten all data into one array\n\tfor ( k in sourceLines ) {\n\t\tvar k_data = sourceLines[ k ];\n\t\tk_data.values.forEach( function ( d ) {\n\t\t\tif ( d.year >= minYr ) flatData.push( {\n\t\t\t\tname: k_data.source,\n\t\t\t\tyear: d.year,\n\t\t\t\tvalue: d.btu\n\t\t\t} );\n\t\t} );\n\t} // END for k loop\n\t// console.log( \"FLAT DATA\", flatData );\n\n\t// nest flattened data for voronoi\n\tvar voronoiData = d3.nest()\n\t\t.key( function ( d ) {\n\t\t\treturn iepX( parseYear( d.year ) ) + \",\" + iepY( d.value );\n\t\t} )\n\t\t.rollup( function ( v ) {\n\t\t\treturn v[ 0 ];\n\t\t} )\n\t\t.entries( flatData )\n\t\t.map( function ( d ) {\n\t\t\treturn d.value;\n\t\t} );\n\t// console.log( \"VORONOI DATA\", voronoiData );\n\n\t// initiate the voronoi function\n\tvar voronoi = d3.voronoi()\n\t\t.x( function ( d ) {\n\t\t\treturn iepX( parseYear( d.year ) );\n\t\t} )\n\t\t.y( function ( d ) {\n\t\t\treturn iepY( d.value );\n\t\t} )\n\t\t.extent( [ [ -chart_margins.left / 2, -chart_margins.top / 2 ], [ iepWidth + chart_margins.left, iepHeight + chart_margins.top ]\n\t\t\t] );\n\tvar voronoiOutput = voronoi( voronoiData );\n\t// console.log( \"VORONOI OUTPUT\", voronoiOutput );\n\n\t// append the voronoi group element and map to points\n\tvar voronoiGroup = chart.append( \"g\" )\n\t\t.attr( \"class\", \"voronoi\" )\n\t\t.selectAll( \"path\" )\n\t\t.data( voronoiOutput.polygons() )\n\t\t.enter().append( \"path\" )\n\t\t.attr( \"class\", \"voronoi_cells\" )\n\t\t.attr( \"d\", function ( d ) {\n\t\t\treturn d ? \"M\" + d.join( \"L\" ) + \"Z\" : null;\n\t\t} )\n\t\t.on( \"mouseover\", mouseover )\n\t\t.on( \"mouseout\", mouseout );\n\n\t// add mouseover action for tooltip\n\tfunction mouseover( d ) {\n\t\t// set x and y location\n\t\tvar dotX = iepX( parseYear( d.data.year ) ),\n\t\t\tdotY = iepY( d.data.value ),\n\t\t\tdotBtu = d3.format( \".2f\" )( d.data.value ),\n\t\t\tdotYear = d.data.year,\n\t\t\tdotSource = d.data.name;\n\n\t\t// console.log( \"SOURCE:\", dotSource, index( lineColors( dotSource ) ) );\n\n\t\t// add content to tooltip text element\n\t\t/*tooltip.select( \".tooltip_text\" )\n\t\t\t.style( \"border-color\", lineColors( [ dotSource ] - 2 ) );*/\n\n\t\ttooltip.select( \".tooltip_title\" )\n\t\t\t.text( dotYear )\n\t\t/*.style( \"color\", lineColors( dotSource ) )*/\n\t\t;\n\n\t\ttooltip.select( \".tooltip_data\" )\n\t\t\t.text( dotBtu + \" \" + yUnitsAbbr );\n\n\t\ttooltip.select( \".tooltip_marker\" )\n\t\t\t.text( \"▼\" )\n\t\t/*.style( \"color\", lineColors( dotSource ) )*/\n\t\t;\n\n\t\t//Change position of tooltip and text of tooltip\n\t\ttooltip.style( \"visibility\", \"visible\" )\n\t\t\t.style( \"left\", dotX + ( chart_margins.left / 2 ) + \"px\" )\n\t\t\t.style( \"top\", dotY + ( chart_margins.top / 2 ) + \"px\" );\n\t} //mouseover\n\n\tfunction mouseout() {\n\t\ttooltip.style( \"visibility\", \"hidden\" );\n\t}\n\n\t// append tooltip elements\n\tvar tooltipValue = g.append( \"g\" )\n\t\t.attr( \"transform\", \"translate(-100,-100)\" )\n\t\t.attr( \"class\", \"tooltip_value\" )\n\t\t.style( \"pointer-events\", \"none\" );\n\ttooltipValue.append( \"circle\" )\n\t\t.attr( \"class\", \"tooltip_circle\" )\n\t\t.attr( \"r\", 2 );\n\ttooltipValue.append( \"text\" )\n\t\t.attr( \"class\", \"tooltip_title\" )\n\t\t.attr( \"y\", -15 );\n\n\t/* DATA SOURCE SECTION */\n\t// draw/append tooltip container\n\tvar sources = d3.select( \"#chart-sources\" );\n\n\tsources.append( \"h5\" )\n\t\t.text( \"SOURCE: \" );\n\n\tsources.append( \"p\" )\n\t\t.attr( \"class\", \"source-content\" );\n\n\tsources.select( \".source-content\" )\n\t\t.text( \"U.S. Energy Information Administration (EIA), \" )\n\t\t.append( \"a\" )\n\t\t.attr( \"href\", \"http://www.eia.gov/totalenergy/data/monthly/\" )\n\t\t.text( \"Monthly Energy Review, tables 1.4a & 1.4b\" );\n}", "function buildPlot(testSubject) {\n\n d3.json(\"samples.json\").then(function(data) {\n \n var selectedID = testSubject\n\n var topSampleValues = Object.values(data.samples[selectedID].sample_values.slice(0,10).reverse());\n var topOtuIDs = Object.values(data.samples[selectedID].otu_ids.slice(0,10).reverse());\n var topOtuLabels = Object.values(data.samples[selectedID].otu_labels.slice(0,10).reverse());\n \n\n// fill demo data \n\n var demoBox = document.getElementById(\"sample-metadata\");\n\n demoBox.innerHTML = `id: ${Object.values(data.metadata[selectedID])[0]}<br>\n ethnicity: ${Object.values(data.metadata[selectedID])[1]}<br>\n gender: ${Object.values(data.metadata[selectedID])[2]}<br>\n age: ${Object.values(data.metadata[selectedID])[3]}<br>\n location: ${Object.values(data.metadata[selectedID])[4]}<br>\n bbtype: ${Object.values(data.metadata[selectedID])[5]}<br>\n wfreq:${Object.values(data.metadata[selectedID])[6]}<br>`;\n\n console.log(Object.values(data.metadata[selectedID]))\n\n//bar chart\n // trace for horizontal bar chart\n var traceBar = {\n x: topSampleValues,\n y: topOtuIDs,\n text: topOtuLabels,\n name: \"Top 10 OTU Samples\",\n type: \"bar\",\n orientation: \"h\"\n };\n\n // data\n var chartData = [traceBar];\n\n // Apply the group bar mode to the layout\n var barLayout = {\n title: \"Top 10 OTU Samples\",\n width: 500,\n height: 800,\n margin: {\n l: 100,\n r: 100,\n t: 100,\n b: 100\n },\n yaxis: {\n type: 'category',\n title: {\n text: \"OTU Names\",\n standoff: 20\n },\n automargin: true,\n },\n xaxis: {\n title: {\n text: \"Sample Measurement\",\n standoff: 20\n },\n automargin: true,\n }\n };\n\n // Render the plot to the div tag with id \"plot\"\n Plotly.newPlot(\"bar\", chartData, barLayout);\n\n// bubble chart \n\n var sampleValues = Object.values(data.samples[selectedID].sample_values);\n var otuIDs = Object.values(data.samples[selectedID].otu_ids);\n var otuLabels = Object.values(data.samples[selectedID].otu_labels);\n\n var traceBubble = {\n x: otuIDs,\n y: sampleValues,\n text: otuLabels,\n mode: 'markers',\n marker: {\n color: otuIDs,\n size: sampleValues,\n }\n };\n \n var data = [traceBubble];\n \n var bubbleLayout = {\n title: 'All Samples by OTU ID',\n showlegend: false,\n height: 600,\n width: 1000,\n xaxis: {\n title: {\n text: \"OTU ID\",\n standoff: 20\n },\n automargin: true,\n }\n };\n \n Plotly.newPlot('bubble', data, bubbleLayout);\n\n\n}); \n\n}", "function get_emission_gases_stacked_data(country)\n{\n data = get_country_data(world_2011_data, country);\n stacked_gases_data = {}\n\n //For some reasons number don't add up, total_emissions != co2+no2+methan+other. I will recompute the total\n total_gases = data.total_other_gases + data.total_co2 + data.total_methane + data.total_no2;\n\n bar_data = [\n {\n name: country,\n CO2: data.total_co2/ total_gases,\n Methane: data.total_methane/ total_gases,\n NO2: data.total_no2/ total_gases,\n Other: data.total_other_gases/ total_gases\n }\n ]\n\n //The fields for the stack bar. A stacked bar needs the data in a special format, an\n //array of objects of arrays. This next part creates that\n var fields = [\"CO2\", \"Methane\", \"NO2\", \"Other\"];\n\n var mapped_gases_data = fields.map(function(key, index)\n {\n return bar_data.map(function(d,i)\n {\n return {\n x: d.name,\n y: d[key],\n gas_type: key\n };\n })\n });\n\n //Transform it into SVG x, y and y0. The following function computes the y0\n stacked_gases_data = d3.layout.stack()(mapped_gases_data);\n\n //Return the appropriately stacked data\n return stacked_gases_data;\n}", "function plotParamData(){\n\n var newData =[];\n var minTickSize = Math.ceil((dsEnd - dsStart)/msecDay/7);\n\n if( height_check.checked ){\n newData.push({label: \"height (in)\",\n data: gaitData[0],\n color: pcolors[0], \n lines: { lineWidth: 3}\n });\n }\n else{\n // So that yaxis is always used...\n newData.push({label: \"height (in)\",\n data: gaitData[0],\n color: pcolors[0], \n lines: {lineWidth: 0} \n });\n }\n if( st_check.checked){\n\n newData.push({label: \"stride time (sec)\",\n data: gaitData[1],\n yaxis: 2,\n color: pcolors[1], \n lines: {show: drawlines.checked, lineWidth: 3},\n points: { show: drawpoints.checked, fill: true, radius: 1 }});\n\n if( conf_check.checked){\n newData.push({label: \"st_95_ub (sec)\",\n data: gaitData[8],\n yaxis: 2,\n color: pcolors[1], lines: {lineWidth: 1}});\n\n newData.push({label: \"st_95_lb (sec)\",\n data: gaitData[9],\n yaxis: 2,\n color: pcolors[1], lines: {lineWidth: 1}});\n }\n }\n if( sl_check.checked){\n\n newData.push({label: \"stride length (cm)\",\n data: gaitData[2],\n color: pcolors[2], \n lines: {show: drawlines.checked, lineWidth: 3},\n points: { show: drawpoints.checked, fill: true, radius: 1 }});\n\n if( conf_check.checked){\n newData.push({label: \"sl_95_ub (cm)\",\n data: gaitData[6],\n color: pcolors[2], lines: {lineWidth: 1}});\n\n newData.push({label: \"sl_95_lb (cm)\",\n data: gaitData[7],\n color: pcolors[2], lines: {lineWidth: 1}});\n }\n }\n if( as_check.checked){\n\n newData.push( {label: \"average speed (cm/sec)\",\n data: gaitData[3],\n color: pcolors[3], \n lines: {show: drawlines.checked, lineWidth: 3},\n points: { show: drawpoints.checked, fill: true, radius: 1 }});\n\n if( conf_check.checked){\n newData.push({label: \"as_95_ub (cm/sec)\",\n data: gaitData[4],\n color: pcolors[3], lines: {lineWidth: 1}});\n\n newData.push({label: \"as_95_lb (cm/sec)\",\n data: gaitData[5],\n color: pcolors[3], lines: {lineWidth: 1}}); \n }\n }\n\n newData.push({label: \"system down time\",\n data: gaitData[10], \n lines: {lineWidth: 1, fill: true, fillColor: \"rgba(100, 100, 100, 0.4)\"} });\n\n if( alert_check.checked ){\n newData.push({\n data: alertsToPlot,\n color: \"rgb(0,0,0)\",\n yaxis: 1,\n lines: {show: false},\n points: {show: true, radius: 4} });\n }\n\n paramGraph = $.plot($(\"#flot1\"),\n newData,\n\n { \n grid: {\n color: \"#000\",\n borderWidth: 0,\n hoverable: true\n },\n\n xaxis: {\n mode: \"time\",\n timeformat: \"%m/%d/%y\",\n minTickSize: [minTickSize,\"day\"],\n ticks: 7,\n min: dsStart,\n max: dsEnd\n },\n yaxes: [{\n min:20, max: 100, position:\"left\", tickSize: 10 \n },\n {\n\n min:1, max: 2.4, position:\"right\", alignTicksWithAxis: 1\n }],\n legend: {\n show: false\n },\n hooks: { draw : [draw_alerts] }\n }\n );\n\n $.plot($(\"#smallgraph\"),\n newData,\n {\n xaxis: {\n mode: \"time\",\n show:false\n },\n yaxes: [{\n min:20, max: 100, position:\"left\", tickSize: 10, show: false \n },\n {\n\n min:1, max: 2.4, position:\"right\", alignTicksWithAxis: 1, show: false\n }],\n legend:{\n show:false \n },\n grid:{\n color: \"#666\",\n borderWidth: 2\n },\n rangeselection:{\n color: pcolors[4], //\"#feb\",\n start: dsStart,\n end: dsEnd,\n enabled: true,\n callback: rangeselectionCallback\n }\n }\n );\n\n}", "function plotData(data) {\r\n\t//handles getting and parsing file if user wants to input a file different\r\n\t//then the one automatically loaded\r\n\tdocument.getElementById('files').addEventListener('change',\r\n\t\t\thandleFileSelect, false);\r\n\t//these functions plot the charts\r\n\tmostCommonIncident(data);\r\n\tnumIncidentTypeinZipcode(data);\r\n\ttimeModel(data);\r\n\tresponseTimeAnalysis();\r\n\t//this function handles predicting the unit type\r\n\t//needed for a given invident\r\n\tzipcodeIncidentResponse();\r\n}", "transform() {\n let xaxis = [];\n const xaxisIndex = 0;\n for (let row of this.raw) {\n xaxis.push(row[xaxisIndex]);\n }\n xaxis.shift();\n console.log(`Horizontal axis: ${xaxis}`);\n \n let series = [];\n /* series is an array storing the data series to be rendered.\n * Each element of an array is an object: { seriesName: 'SERIES NAME', data: [ numbers of the series ] }\n */\n let seriesIndex = [];\n \n // Find indices from series name, store them into seriesIndex[]\n if (Array.isArray(this.selected))\n this.selected.map( (seriesName) => seriesIndex.push(this.header.indexOf(seriesName) + 1));\n // +1? this.header has the first element stripped. As we will use this index to retrieve the data in this.raw, we need to add back 1.\n else\n seriesIndex.push(this.header.indexOf(this.selected) + 1);\n \n // Extract data from raw, store them into series[]\n seriesIndex.map ( (seriesI) => {\n series.push({ seriesName: this.header[seriesI - 1], data: [] }); // -1 to retrieve series name from this.header\n if (!this.activeChartDefinition.scatterTransform) {\n // Extract data for general charts\n this.raw.map( (row) => {\n series[series.length - 1].data.push(row[seriesI]);\n })\n }\n else {\n // Extract data for scatter charts\n this.raw.map( (row, i) => {\n series[series.length - 1].data.push({ x: xaxis[i - 1], y: row[seriesI] })\n })\n }\n series[series.length - 1].data.shift();\n } );\n \n console.log(series);\n \n return { xaxis, series };\n }", "function showVisual(dataset, xView, yView){\n \n // load dataset\n dataset.map(d => {\n dataset.state = dataset.state;\n dataset.abbr = dataset.abbr;\n dataset.poverty = +d[xView];\n dataset.healthcare = +d[yView];\n console.log(dataset.poverty);\n });\n \n // print loaded dataset\n console.log(dataset.poverty);\n\n var xValues = dataset.map(d => parseFloat(d[xView]));\n var yValues = dataset.map(d => parseFloat(d[yView]));\n console.log(\"xValues\");\n console.log(xValues);\n console.log(\"yValues\");\n console.log(yValues);\n\n //scale the data to fit the plot\n var xLinearScale = d3.scaleLinear() \n .domain([d3.min(xValues)-1, d3.max(xValues)+0.5])\n .range([margin.left, width + margin.left]);\n\n var yLinearScale = d3.scaleLinear()\n .domain([d3.min(yValues)-1, d3.max(yValues)+0.5])\n .range([height - margin.top, margin.top]); \n\n console.log(\"yLinearScale\");\n console.log(yLinearScale);\n \n // Create axis functions\n var xAxis = d3.axisBottom(xLinearScale);\n var yAxis = d3.axisLeft(yLinearScale);\n \n console.log(\"yAxis\");\n console.log(yAxis);\n \n svg.append(\"g\")\n .attr(\"class\", \"xAxis\")\n .attr(\"transform\", `translate(${0}, ${height - margin.bottom-30})`)\n .call(xAxis);\n\n svg.append(\"g\")\n .attr(\"class\", \"yAxis\")\n .attr(\"transform\", `translate(${margin.left+10}, ${0})`)\n .call(yAxis);\n \n \n // create chart\n var scatter = svg.selectAll(\"circle\")\n .data(dataset)\n .enter()\n .append(\"circle\")\n .attr(\"cx\", d => xLinearScale(d[xView]))\n .attr(\"cy\", d => yLinearScale(d[yView]))\n .attr(\"r\", 10)\n .attr(\"fill\", \"#0066cc\")\n .attr(\"opacity\", \".5\")\n\n\n \n // print state abbreviation \n svg.append(\"text\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-size\", \"10px\")\n .style(\"font-weight\", \"bold\")\n .style(\"font-family\", \"arial\")\n .selectAll(\"tspan\")\n .data(dataset)\n .enter()\n .append(\"tspan\")\n .attr(\"x\", function(data) {\n return xLinearScale(data.poverty - 0);\n })\n .attr(\"y\", function(data) {\n return yLinearScale(data.healthcare - 0.1);\n })\n .text(function(data) {\n return data.abbr\n }); \n \n // Append x-axis labels\n svg.append(\"text\")\n .style(\"font-family\", \"arial\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-size\", \"20px\")\n .attr(\"transform\", `translate(${width/2}, ${height - margin.top + 40})`)\n .attr(\"class\", \"axisText\")\n .text(\"Poverty\");\n\n // Append y-axis labels\n svg.append(\"text\")\n .style(\"font-family\", \"arial\")\n .style(\"text-anchor\", \"middle\")\n .style(\"font-size\", \"20px\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 0 + 5)\n .attr(\"x\", 0 - (height/2))\n .attr(\"dy\",\"1em\")\n .attr(\"class\", \"axisText\")\n .text(\"Healthcare\");\n \n\n console.log(\"data\", dataset[xView]); \n \n \n}", "function buildmixedPlot() {\n\n const url = \"/api/housing_data\";\n d3.json(url).then(function (myData) {\n\n var date = myData[0].Date;\n var rate = myData[0].Interest_Rate;\n var price = myData[0].Average_Home_Price;\n\n var options = {\n series: [{\n name: 'Average Home Price',\n type: 'column',\n data: price\n }, {\n name: 'Interest Rate',\n type: 'line',\n data: rate\n }],\n chart: {\n height: 400,\n type: 'line',\n },\n stroke: {\n width: [0, 4]\n },\n title: {\n text: 'History of Home price & Interest Rates'\n },\n dataLabels: {\n enabled: true,\n enabledOnSeries: [1]\n },\n labels: date,\n xaxis: {\n type: 'datetime'\n },\n yaxis: [{\n title: {\n text: 'Average Home Price',\n },\n\n }, {\n opposite: true,\n title: {\n text: 'Interest Rate'\n }\n }]\n };\n\n var chart = new ApexCharts(document.querySelector(\"#linecolumn\"), options);\n chart.render();\n });\n}", "function getResultDetailed(){\r\n\t\r\n\tif (processDone) {\r\n \r\n\t\t for(var key in Obj_Fetch)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tvar temp_var={};\r\n\t\t\t\t\t\ttemp_var.cancertypedetailed=key;\r\n\t\t\t\t\t\ttemp_var.male=Obj_Fetch[key].MALE;\r\n\t\t\t\t\t\ttemp_var.female=Obj_Fetch[key].FEMALE;\r\n\t\t\t\t\t\tfetch_data_array.push(temp_var);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\taddScatterPlotDetailed(fetch_data_array);\r\n\t\t\t\t\t\tconsole.log(fetch_data_array);\r\n\r\n } else {\r\n setTimeout(getResult, 250);\r\n }\r\n }", "function getCurrentDataAsDict() {\n\tfunction naArray(len) {\n\t\tvar ret = [];\n\t\tfor(var i in len) { ret.push(\"N/A\"); }\n\t\treturn ret;\n\t}\n\n\tvar tbl = {}\n\tvar names = [];\n\tif(viewerVars.plotType == viewerVars.plotTypeEnum.SCATTER_2D) {\n\t\tfor(i in myDiv.data) {\n\t\t\tvar data = myDiv.data[i];\n\t\t\tvar dlen = data.x.length;\n\t\t\tnames.push(data.name);\n\t\t\tfor(j = 0; j < dlen; j++) {\n\t\t\t\tvar t = new Date(data.x[j]).toISOString();\n\t\t\t\tif(!(t in tbl)) { tbl[t] = naArray(myDiv.data); }\n\t\t\t\ttbl[t][i] = data.y[j];\n\t\t\t}\n\t\t}\n\t\treturn [names, tbl];\n\t} else {\n\t\tnames.push(viewerVars.pvs[0]); // We only support one waveform for now...\n\t\tvar maxColumnNum = 0;\n\t\tvar numSamples = viewerVars.pvData[pvName].secs.length;\n\t\tfor(var j = 0; j < numSamples; j++) {\n\t\t\tvar t = new Date(viewerVars.pvData[pvName].secs[j]).toISOString();\n\t\t\tvar val = viewerVars.pvData[pvName].vals[j];\n\t\t\tif(val.length > maxColumnNum) { maxColumnNum = val.length; }\n\t\t\tif(!(t in tbl)) { tbl[t] = naArray(val.length); }\n\t\t\tfor(var k = 0; k < val.length; k++) {\n\t\t\t\ttbl[t][k] = val[k];\n\t\t\t}\n\t\t}\n\t\tfor(var n = 1; n < maxColumnNum; n++) { names.push(n); }\n\t\treturn [names, tbl];\n\t}\n}", "function reformatData(data) {\n var finalData = [];\n for (var i = 0; i<data.length; i++ ) {\n var point = data[i];\n if (point.value !== undefined && point.collection_time !== undefined) {\n finalData.push({x:new Date(point.collection_time),y:point.value});\n }\n }\n console.log(finalData);\n // this is an odd undocumented requirement of angular-chartjs: http://stackoverflow.com/questions/38239877/unable-to-parse-color-in-line-chart-angular-chart-js\n return [finalData];\n}", "function plot(input)\r\n{\r\n\tvar exp_arr = new Array();//array to store expectaion values\r\n\t\r\n\tvar sum_actual = 0;//sum of actual values of the data points \r\n\t\r\n\tvar sum_exp = 0;//sum of expectation values of data points\r\n\t\r\n\tvar max_x=0;//maximum value of x(to determine max range on x axis)\r\n\t\r\n\tvar max_val = 0;//maximum value of data points(to determine maximum range on y axis)\r\n\t\r\n\t\tfor(j=0;j<input[\"data\"] .length;j++)\r\n\t\t{\r\n\t\t\texp_arr[j] = new Array();\r\n\t\t\t\r\n\t\t\tif(j==0) sum_actual += input[\"data\"][j][1];\r\n\t\t\telse \r\n\t\t\t\tsum_actual += input[\"data\"][j-1][1] ;\r\n\r\n\t\t\tif(j==0) exp_arr [j][1] = sum_actual;\r\n\t\t\telse\r\n\t\t\t\texp_arr [j][1] = sum_actual * input[\"imp_f\"] / (j+1) ;\r\n\t\t\t\t\r\n\t\t\texp_arr [j][0] = input[\"data\"] [j][0] ;\r\n\t\t\t\t\r\n\t\t\tsum_exp += exp_arr [j][1];\r\n\t\t\t\r\n\t\t\tmax_val = input[\"data\"] [j][1]>max_val? input[\"data\"] [j][1] : max_val;\r\n\t\t\tmax_val = exp_arr [j][1]>max_val? exp_arr [j][1] : max_val;\r\n\t\t\tmax_x = input[\"data\"] [j][0]>max_x? input[\"data\"] [j][0] : max_x;\r\n\t\t}\r\n\t\tvar output = new Array();\r\n\t\toutput[\"si\"] = sum_actual / sum_exp;\r\n\r\n\t\tplots = $.jqplot(input[\"target_id\"] , [input[\"data\"] , exp_arr ], { \r\n\t\t\t\t title:input[\"title\"] , \r\n\t\t\t\t seriesDefaults: {showMarker:false}, \r\n\t\t\t\t series:[\r\n\t\t\t\t\t {},\r\n\t\t\t\t\t {yaxis:'y2axis'}, \r\n\t\t\t\t\t {yaxis:'y3axis'}\r\n\t\t\t\t ], \r\n\t\t\t\t highlighter: {\r\n\t\t\t\t\tshow: true,\r\n\t\t\t\t\tsizeAdjust: 7.5\r\n\t\t\t\t },\r\n\t\t\t\t cursor: {\r\n\t\t\t\t\tshow: false,\r\n\t\t\t\t }, \r\n\t\t\t\t axesDefaults:{useSeriesColor: true}, \r\n\t\t\t\t axes:{\r\n\t\t\t\t\t xaxis:{min:0, max:max_x, numberTicks:input[\"n_x\"] }, \r\n\t\t\t\t\t yaxis:{min:0, max:max_val, numberTicks:input[\"n_ticks\"] }, \r\n\t\t\t\t\t y2axis:{\r\n\t\t\t\t\t\t min:0, \r\n\t\t\t\t\t\t max:max_val, \r\n\t\t\t\t\t\t numberTicks:input[\"n_ticks\"] , \r\n\t\t\t\t\t\t tickOptions:{showGridline:false}\r\n\t\t\t\t\t }, \r\n\t\t\t\t\t y3axis:{}\r\n\t\t\t\t } \r\n\t\t\t\t \r\n\t\t\t });\r\n\t\t\t \r\n\toutput[\"sum\"] = sum_actual;\r\n\t\r\n\treturn output;\r\n}", "function visualize() {\n d3.selectAll(\"svg > *\").remove();\n\n var color = d3.scaleLinear()\n .domain([0, 5])\n .range([\"hsl(152,80%,80%)\", \"hsl(228,30%,40%)\"])\n .interpolate(d3.interpolateHcl)\n\n var format = d3.format(\",d\")\n\n var width = document.getElementById('chart').clientWidth;\n var height = width\n\n var pack = data => d3.pack()\n .size([width, height])\n .padding(10)\n\n (d3.hierarchy(data)\n .sum(d => d.value)\n .sort((a, b) => b.value - a.value))\n\n tooltip = d3.select(\"body\")\n\t.append(\"div\")\n\t.style(\"position\", \"absolute\")\n\t.style(\"z-index\", \"10\")\n\t.style(\"visibility\", \"hidden\")\n .classed(\"card\", true)\n .classed(\"group\", true)\n .on(\"mouseover\", function() {\n return tooltip.style(\"visibility\", \"visible\");\n })\n\n tooltipName = tooltip\n .append(\"h5\")\n .classed(\"name\", true)\n\n tooltipEmail = tooltip\n .append(\"div\")\n .classed(\"email\", true)\n\n tooltipDescription = tooltip\n .append(\"div\")\n .classed(\"description\", true)\n \n tooltipRole = tooltip\n .append(\"select\")\n .classed(\"role\", true)\n .classed(\"form-control\", true)\n .attr(\"id\", \"tooltip-role-sel\")\n\n var tooltipRoleMember = tooltipRole\n .append(\"option\")\n .attr(\"value\", \"Member\")\n .text(\"Member\")\n var tooltipRoleManager = tooltipRole\n .append(\"option\")\n .attr(\"value\", \"Manager\")\n .text(\"Manager\")\n var tooltipRoleOwner = tooltipRole\n .append(\"option\")\n .attr(\"value\", \"Owner\")\n .text(\"Owner\")\n\n tooltipLink = tooltip\n .append(\"a\")\n .classed(\"link\", true)\n .text(\"Click to view more\")\n\n tooltipButtons = tooltip\n .append(\"div\")\n .classed(\"flex\", true)\n\n tooltipAddMember = tooltipButtons\n .append(\"button\")\n .classed(\"btn\", true)\n .classed(\"btn-collapse\", true)\n .attr(\"id\", \"add-member-btn\")\n\n var tooltipAddMemberSpan = tooltipAddMember\n .append(\"span\")\n .attr(\"data-hover\", \"Add member\")\n var tooltipAddMemberIcon = tooltipAddMemberSpan\n .append(\"i\")\n .classed(\"fa\", true)\n .classed(\"fa-user-plus\", true)\n\n tooltipRemove = tooltipButtons\n .append(\"button\")\n .classed(\"btn\", true)\n .classed(\"btn-collapse\", true)\n .attr(\"id\", \"remove-btn\")\n\n var tooltipRemoveSpan = tooltipRemove\n .append(\"span\")\n .attr(\"data-hover\", \"Remove member\")\n var tooltipRemoveIcon = tooltipRemoveSpan\n .append(\"i\")\n .classed(\"fa\", true)\n .classed(\"fa-times\", true)\n\n const root = pack(data);\n var focus = root;\n var view;\n\n const svg = d3.create(\"svg\")\n .attr(\"viewBox\", `-${width / 2} -${height / 2} ${width} ${height}`)\n .style(\"display\", \"block\")\n .style(\"background\", color(0))\n .style(\"cursor\", \"pointer\")\n .style(\"max-width\", width + \"px\")\n .style(\"max-height\", height + \"px\")\n .on(\"click\", () => zoom(root));\n\n const node = svg.append(\"g\")\n .selectAll(\"circle\")\n .data(root.descendants().splice(1))\n .join(\"circle\")\n .attr(\"fill\", d => d.data.type == \"USER\" ? \"white\" : (d.data.children ? color(d.depth) : \"rgb(116, 215, 202)\"))\n .on(\"mouseover\", function(d) { \n d3.select(this).attr(\"stroke\", \"#000\");\n if (d.data.type == \"USER\") {\n makeUserTooltip(d, d.parent.data.id)\n tooltipDescription.classed(\"hidden\", true)\n tooltipRole.classed(\"hidden\", false)\n tooltipAddMember.classed(\"hidden\", true)\n } else {\n makeGroupTooltip(d, d.parent.data.id);\n tooltipRole.classed(\"hidden\", true)\n tooltipDescription.classed(\"hidden\", false)\n tooltipAddMember.classed(\"hidden\", false)\n }\n if (!d.parent.data.id) {\n tooltipRemove.classed(\"hidden\", true);\n } else {\n tooltipRemove.classed(\"hidden\", false);\n }\n var pageY = event.pageY;\n var pageX = event.pageX;\n displayTooltip = true;\n tooltip.style(\"top\", (pageY)+\"px\").style(\"left\",(pageX+10)+\"px\")\n // show hover card after 500 ms if cursor is still on the same circle\n setTimeout(function() {\n if (displayTooltip == true) return tooltip.style(\"visibility\", \"visible\");\n }, 500)\n })\n .on(\"mouseout\", function(d) { \n d3.select(this).attr(\"stroke\", null);\n displayTooltip = false;\n return tooltip.style(\"visibility\", \"hidden\");\n })\n .on(\"click\", function(d) {\n if (d.data.type != \"USER\" && d.data.children) focus !== d && (zoom(d), d3.event.stopPropagation())\n });\n\n const label = svg.append(\"g\")\n .style(\"font\", \"1.25em sans-serif\")\n .attr(\"pointer-events\", \"none\")\n .attr(\"text-anchor\", \"middle\")\n .selectAll(\"text\")\n .data(root.descendants())\n .join(\"text\")\n .style(\"fill-opacity\", d => d.parent === root ? 1 : 0)\n .style(\"display\", d => d.parent === root ? \"inline\" : \"none\")\n .text(d => d.data.name);\n\n function zoomTo(v) {\n const k = width / v[2];\n\n view = v;\n\n label.attr(\"transform\", d => `translate(${(d.x - v[0]) * k},${(d.y - v[1]) * k})`);\n node.attr(\"transform\", d => `translate(${(d.x - v[0]) * k},${(d.y - v[1]) * k})`);\n node.attr(\"r\", d => d.r * k);\n }\n\n function zoom(d) {\n const focus0 = focus;\n\n focus = d;\n\n const transition = svg.transition()\n .duration(d3.event.altKey ? 7500 : 750)\n .tween(\"zoom\", d => {\n const i = d3.interpolateZoom(view, [focus.x, focus.y, focus.r * 2]);\n return t => zoomTo(i(t));\n });\n\n label\n .filter(function(d) { return d.parent === focus || this.style.display === \"inline\"; })\n .transition(transition)\n .style(\"fill-opacity\", d => d.parent === focus ? 1 : 0)\n .on(\"start\", function(d) { if (d.parent === focus) this.style.display = \"inline\"; })\n .on(\"end\", function(d) { if (d.parent !== focus) this.style.display = \"none\"; });\n }\n\n function hovered(hover) {\n return function(d) {\n d3.selectAll(d.ancestors().map(function(d) {}));\n };\n }\n\n var chartElement = document.getElementById(\"chart\");\n while (chartElement.lastElementChild.id != \"create-btn\") {\n chartElement.removeChild(chartElement.lastChild);\n }\n chartElement.appendChild(svg.node());\n\n if (groups.length > 0) {\n zoomTo([root.x, root.y, root.r * 2]);\n } else {\n // Show no search results\n var div = document.createElement(\"div\");\n div.classList.add(\"no-search-results\")\n var p = document.createElement(\"P\");\n p.innerHTML = \"There were no results for your search.\"; \n var btn = document.createElement(\"BUTTON\");\n btn.innerHTML = \"Reset all\";\n btn.classList.add(\"btn\");\n btn.classList.add(\"btn-light\");\n btn.onclick = clearFilters;\n\n div.appendChild(p);\n div.appendChild(btn);\n chartElement.appendChild(div);\n }\n\n isLoading = false;\n setLoadingOverlay();\n\n return svg.node();\n}", "function addChartInfo(data, svgChartInfo){\n var selectBox = document.getElementById(\"type-id\");\n var type = selectBox.options[selectBox.selectedIndex].value;\n\n\tx.domain([start_year, end_year]);\n\tvar xScale = d3.scale.linear().domain([start_year, end_year]).range([0, width]);\n\tsvgChartInfo.append(\"g\").attr(\"class\", \"x axis\").attr(\"transform\", \"translate(0,\" + 0 + \")\").call(xAxis);\n\n\tfor (var j = 0; j < data.length; j++) {\n\t\tvar g = svgChartInfo.append(\"g\").attr(\"class\",\"journal\");\n\t\tvar circles = g.selectAll(\"circle\")\n\t\t .data(data[j]['cases'])\n\t\t .enter()\n\t\t .append(\"circle\");\n\t\tvar text = g.selectAll(\"text\")\n\t\t .data(data[j]['cases'])\n\t\t .enter()\n\t\t .append(\"text\");\n\n// var rScale = d3.scale.linear()\n// .domain([0, d3.max(data[j]['articles'], function(d) { return d[1]; })])\n// .range([2, 9]);\n\n\n\t\tcircles.attr(\"cx\", function(d, i) { return xScale(d[0]); })\n\t\t .attr(\"cy\", j*20+20)\n\t\t .attr(\"r\", function(d) {\n\t\t // Custom scaling because the math in rScale wasn't working correctly\n\t\t // to convert to the scale needed\n var scaled = 0\n if(d[2] == \"population\"){\n scaled = Math.sqrt(d[1]) * 0.001;\n }else if(d[2] == \"malaria_cases\" || d[2] == \"suspected_malaria_cases\"){\n scaled = Math.sqrt(d[1]) * 0.0019;\n }else{\n scaled = d[1] * 0.10\n }\n\t\t return scaled;\n })\n\t\t .style(\"fill\", function(d) { return c(j); });\n\n\t\ttext.attr(\"y\", j*20+25)\n\t\t .attr(\"x\",function(d, i) { return xScale(d[0])-5; })\n\t\t .attr(\"class\",\"value\").text(function(d){ return d[1]; })\n\t\t .style(\"fill\", function(d) { return c(j); })\n\t\t .style(\"display\",\"none\");\n\n\t\tg.append(\"text\")\n\t\t .attr(\"y\", j*20+25)\n\t\t .attr(\"x\",width+20)\n\t\t .attr(\"class\",\"label\")\n\t\t .text(truncate(data[j]['name'],30,\"...\"))\n\t\t .style(\"fill\", function(d) { return c(j); })\n\t\t .on(\"mouseover\", mouseover)\n\t\t .on(\"mouseout\", mouseout);\n\t};\n}", "function drawEndBoxData(request) {\n $.getJSON('/charts/api/get_end_box_data/', request, function(data) {\n console.log(data);\n if (!data.error) {\n data = transformEndBoxData(data.data, data.x);\n drawBoxChart(data, 'chart-div2', 'string');\n } else {\n alert(data.error);\n }\n });\n}", "function boxer(dataSetRaw,starter,recessSet){\n\t\n\tvar rawStartDate = starter;//saves it without jsonification\n\t\n\td3.select('text#unchangedLabel')\n\t\t.attr('x',0)\n\t\t.attr('text-anchor','end')\n\t\t.attr('class','axis');\n\t\n\t//other global attributes\n\tvar duration = 500;\t\n\t\n\t//constrict dataSet based on the start date\n\tstarter = parseDate(starter);\t\n\tvar dataSet = dataSetRaw.filter(function(d){return d.values[0].dateObj >=starter });\t\n\t\n\t//constrict the recessions, but also modify the start date\n\tvar recess = recessSet.filter(function(d){return d.trough >= starter });\n\tif(recess.length > 0 && recess[0].peak <= starter){\n\t\trecess[0].peak = starter };\n\t\n\t//set the width for the SVG based on the window's width\n\tvar w = 0;//placeholder\t\t\t\n\tvar win = window.innerWidth;\n\tvar wInset = 0.9; //share of the window which, at max, can be occupied\t\t\n\tvar cPad = 40; //px padding on all sides of the chart\n\tif(win < 350){cPad = 20};\n\t\n\t//update w based on innerwidth\n\tif(win >= 959){w = 959}\n\telse if(win <= 350){w = 350}\n\telse if(win < 959 && win > 350){w = win}\n\t\n\tw = (w * wInset) - cPad - cPad;\n\t\n\t//Create an array\tthat contains the number of ups and downs in the set\t\n\tvar upDown = [];\t\n\t//load the array with blanks\n\tdataSet[0].values.forEach(function(d,i){\n\t\tupDown.push({\n\t\t\t\"series\" : d.series,\n\t\t\t\"up\" : 0,\n\t\t\t\"down\" : 0,\t\t\t\t\t\t\n\t\t\t})\n\t\n\t\t});//end array-loading forEach\n\t\n\t//show where in the array a given series can be found\n\tvar downScaler = d3.scale.ordinal()\n\t\t.domain(upDown.map(function(d){return d.series}))\n\t\t.range(d3.range(0,upDown.length));\t\n\t\n\t//iterate through the dataset and pull the highest absolute percent for color-scaling purposes\n\tvar topCrit = 0;\t\t\n\tdataSet.forEach(function(d,i){\n\t\td.values.forEach(function(d,i){\n\t\t\t\t\n\t\t\t\tvar thisCrit = ab(d[sortCriteria]);\n\t\t\t\tvar rawC = d[sortCriteria];\n\t\t\t\tif(rawC>0){\n\t\t\t\t\tupDown[downScaler(d.series)].up = upDown[downScaler(d.series)].up + 1;}\t\t\t\t\n\t\t\t\tif(rawC<0){\n\t\t\t\t\tupDown[downScaler(d.series)].down = upDown[downScaler(d.series)].down + 1;}\t\t\t\t\n\t\t\t\tif(thisCrit > topCrit){\n\t\t\t\t\ttopCrit = thisCrit;\n\t\t\t\t\t}//close the conditional\n\t\t\t\t\n\t\t\t})//close the values forEach\n\t\t});//close dataSet forEach \t\n\t\n\t//This determines the opacity for each box\n\tvar opacityRange = d3.scale.sqrt()\n\t\t.domain([0,topCrit])\n\t\t.range([0.3,1.2]);\t\n\n\tdataSet.forEach(function(d,i){\n\t\td.values.forEach(function(d,i){\n\t\t\td.boxOpacity = opacityRange(ab(d.sortCriteria));\n\t\t\t})\t\t\n\t\t});\t\n\t\n\tvar longestSet = d3.max(dataSet,function(d,i){return d.values.length});\n\t\t//set scales based on sizes\n\t\t\n\tvar boxWidth = d3.scale.ordinal()\n\t\t.domain(dataSet.map(function(d){return d.key}))\n\t\t.rangeBands([0,w]);\n\n\tvar scaleX = d3.time.scale()\n\t\t.domain([(dataSet[0].values[0].dateObj),(dataSet[dataSet.length - 1].values[0].dateObj)])\n\t\t.range([0,w-boxWidth.rangeBand()]);\n\n\t\n\tvar ch = (longestSet * 2) * boxWidth.rangeBand();\t//height of the chart space, excluding padding\n\n\t//since Y is dependent on X, it gets set later\t\t\n\tvar scaleY = d3.scale.linear()\n\t\t.domain([-longestSet,longestSet])\n\t\t.range([ch,0]);\n\n\t//set up the axes\n\tvar xAxis = d3.svg.axis()\n\t\t.scale(scaleX)\n\t\t.orient('top');\n\t\n\tvar yAxis = d3.svg.axis()\n\t\t.scale(scaleY)\n\t\t.orient('left');\n\n\t//set svg and g dimensions based on sizes\n\td3.select('svg').attr('width',w + cPad + cPad)\n\t\t.attr('height',ch + cPad + cPad);\n\t\n\td3.select('g#viz')\n\t\t.attr('transform','translate(' + cPad + ',' + cPad + ')');\n\n\t//drop the recessions below everything\n\tvar recessDraw = d3.select('g#recessions').selectAll('rect')\n\t\t.data(recess,function(d){return d.recession});\t\n\t\n\trecessDraw.enter().append('rect').attr('class','recession')\n\t\t.append('title')\n\t\t.text(function(d){return d.recession});\n\n\t\t\t\n\trecessDraw.exit().remove();\n\t\t\n\t\n\trecessDraw.attr('height',ch)\n\t\t.attr('width',function(d){return scaleX(d.trough) - scaleX(d.peak)})\n\t\t.attr('x',function(d){return scaleX(d.peak)})\n\t\t.attr('y',0)\n\t\t.attr('transform','translate(' + boxWidth.rangeBand() + ',0)');\n\t\t\t//scoot recessions over to compensate for the fact that recessions begin the month after the peak begins\n\t\t\n\t\t\n\t\n\t//call both axes\n\n\td3.select('g#x').call(xAxis);\n\t//\t.attr('transform','translate(0,' + ch + ')');\n\td3.select('g#y').call(yAxis);\n\tvar unchanger = d3.select('g#y g#unch')\n\t\t.selectAll('text')\n\t\t.data(['unch']);\n\t\t\n\tunchanger.enter()\n\t\t.append('text');\n\t\t\n\tunchanger.attr('x',0)\n\t\t.attr('y',scaleY(-20))\n\t\t.text('unchg.')\n\t\t.style('text-anchor','end')\n\t\t.attr('transform','translate(-7,0)')\n\t\t.attr('class','axis')\n\t\t.attr('font-weight','light');\n\t\n\t//draw some boxes\n\tvar boxGrouper = d3.select('g#boxes').selectAll('g')\n\t\t.data(dataSet);\n\t\t\n\tboxGrouper.enter()\n\t\t.append('g')\n\t\t.attr('id',function(d){return d.key});\n\t\n\tvar boxDrawer = d3.selectAll('g#boxes g')\n\t\t.selectAll('rect')\n\t\t.data(function(d){return d.values});\n\t\t\n\tboxDrawer\n\t\t.enter()\n\t\t.append('rect')\n\t\t.append('title')\n\t\t.text(function(d){\n\t\t\tif(d.change < 0){\t\t\t\n\t\t\treturn d.label + ' fell ' + d.sortCriteria + ' in ' + d.date;}\n\n\t\t\tif(d.change > 0){\t\t\t\n\t\t\treturn d.label + ' rose ' + d.sortCriteria + ' in ' + d.date;}\n\t\t\t})//close title text\n\t\n\t//Remove both entrances should the date horizon narrow\n\tboxGrouper.exit().remove();\n\tboxDrawer.exit().remove();\n\t\t\n\tvar boxUpdater = boxDrawer\n\t\t.attr('height',boxWidth.rangeBand() * 0.9)\n\t\t.attr('width',boxWidth.rangeBand() * 0.9)\n\t\t.attr('x',function(d){\n\t\t\treturn scaleX(parseDate(d.date))})\n\t\t.attr('y',function(d){return scaleY(d.rank)})\n\t\t.attr('rx',boxWidth.rangeBand() * 0.2)\n\t\t.attr('ry',boxWidth.rangeBand() * 0.2)\t\t\n\t\t.attr('fill',function(d){return d.fill})\n\t\t.style('opacity',function(d){return d.boxOpacity})\n\t\t.attr('class',function(d){return d.series});\n\n\tboxUpdater.on('mouseover',function(d){\n\t\tvar activeSector = d3.select(this).data()[0].series;\n\t\t\t\t\n\t\td3.selectAll('g#boxes rect.' + activeSector)\n\t\t\t.style('opacity',1)\n\t\t\t.attr('stroke-width',1)\n\t\t\t.attr('stroke',function(d){return d.fill});\n\t\t\t}).on('mouseout',function(d){\n\t\td3.selectAll('g#boxes rect')\n\t\t\t.style('opacity',function(d){return d.boxOpacity})\n\t\t\t.attr('stroke-width',0)\n\t\t\t}).on('click',function(d){\n\t\tvar activeDate = d3.select(this).data()[0].date;\n\t\t//.attr('class');\n\t\t///boxer(dataSet,'01/01/2006',recessSet);\n\t\trebarrer(activeDate);\t\t\n\t\t\t\t})\n\t\t\t\t\n\t\t\n\tvar listenerBoxes = d3.select('g#listenerBoxes')\n\t\t.selectAll('rect')\n\t\t.data(dataSet,function(d){return d.key});\n\t\n\tlistenerBoxes.enter()\n\t\t.append('rect')\n\t\t.attr('id',function(d){\n\t\t\tvar thisMonth = d.values[0].date.substring(0,2);\n\t\t\tvar thisYear = d.values[0].date.substring(6,10);\n\t\t\treturn \"d\" + thisMonth + thisYear});\n\t\n\tlistenerBoxes.attr('x',function(d){return scaleX(parseDate(d.key))})\n\t\t.attr('y',0)\n\t\t.attr('height',ch)\n\t\t.style('fill','grey')\n\t\t.attr('width',boxWidth.rangeBand())\n\t\t.style('opacity',0)\n\t\t.style('pointer-events','none');\n\t\n\tlistenerBoxes\n\t\t.exit().remove();\n\n\n///////////////////////////////////\t\t\n////////BEGIN REBARRER///////////////\n///////////////////////////////////\t\t\n\t\n\t\n\tfunction rebarrer(barDate){\n\t\t\n\t\t//light up the listenerRect with the correct ID\n\t\t\n\t\tvar rebarMonth = barDate.substring(0,2);\n\t\tvar rebarYear = barDate.substring(6,10);\t\n\t\t\t\n\t\td3.selectAll('g#listenerBoxes rect')\n\t\t\t.style('opacity',0)\n\t\t\t.attr('height',ch)\n\t\t\t.attr('width',boxWidth.rangeBand());\n\t\t\t\n\t\td3.select('rect#d' + rebarMonth + rebarYear)\n\t\t\t.style('opacity',0.3)\n\t\t\t.attr('height',ch * 1.5);\n\t\t\n\t\t\n\t\t//Pull out the date-specific subset of data\t\t\t\t\t\n\t\tvar selector = d3.scale.ordinal()\n\t\t\t.domain(dataSet.map(function(d){return d.key}))\t\n\t\t\t.range(d3.range(0,dataSet.length));\n\n\t\tvar rebarSet = dataSet[selector(barDate)].values;\n\t\t\n\t\t//Add the overall up and down numbers to the subset\t\t\n\t\trebarSet.forEach(function(dbar,ibar){\n\t\t\tupDown.forEach(function(dup,iup){\n\t\t\t\tif(dbar.series == dup.series){\n\t\t\t\t\tdbar.up = dup.up;\n\t\t\t\t\tdbar.down = dup.down;\n\t\t\t\t\t}//close positive conditional\n\t\t\t\t})//close upDown foreach\n\t\t\t})//close barSet foreach\n\t\t\n\t\t//Hard-code the chart's size\n\t\tvar lh = 18; //line height governs all other vertical dimensions\n\t\tvar gh; //the height of each group will be determined responsively\n\n\t\tvar boxY;\n\t\tvar barY;\t\t\n\t\tvar labelY;\n\t\tvar circleY;\n\n\t\tvar boxX;\n\t\tvar barX;\t\t\n\t\tvar labelX;\n\t\tvar upCircleX;\n\t\tvar downCircleX;\n\t\t\n\t\tvar upFill = 'steelblue';\n\t\tvar downFill = 'red';\n\t\t\n\t\t//Scales that are dependent on the chart's size\n\n\t\tvar scaleRect = d3.scale.linear()\n\t\t\t.domain([0,d3.max(rebarSet, function(d){return d.value})]);\n\t\t\t\n\t\tvar scaleCircle = d3.scale.sqrt()\n\t\t\t.domain([0,Math.max(d3.max(rebarSet,function(d){return d.up}),d3.max(rebarSet,function(d){return d.down}))]);\n\t\tvar circleOpacity = d3.scale.linear()\t\n\t\t\t.domain([0,Math.max(d3.max(rebarSet,function(d){return d.up}),d3.max(rebarSet,function(d){return d.down}))])\n\t\t\t.range([1,0.3])\n\n\t\t\n\t\t//Resize all the things that need to be responsive\n\t\t\n\t\t//MOST SIZES\n\t\tif(w>350){\n\t\tgh = lh * 4;\t\n\t\tboxH = lh * 3;\t\t\n\t\t\t\t\t\t\n\t\tboxY = lh * 0.5;\n\t\tbarY = lh * 1.75;\n\t\tlabelY = lh * 1.25;\n\t\tcircleY = gh/2;\n\n\t\tboxX = lh * 1;\n\t\tbarX = boxH + (lh * 1.5);\n\t\tlabelX = boxH + (lh * 1.5);;\n\t\tupCircleX = w - (boxH * 2.0);\n\t\tdownCircleX = w - ((boxH * 0.8));\t\t\n\t\t\n\t\tscaleRect.range([0,upCircleX - boxX - (lh * 6)]);//five accounts for all the buffers and whatnot that we're gonna be up against\n\t\t\n\t\tscaleCircle.range([0,boxH * 0.7]);\n\n\t\t\n\t\t\t};\t\t\t\t\n\t\t\n\t\t//MOBILE\t\t\n\t\tif(w<=350){\n\t\tgh = (w * 0.75) - lh;\n\t\tboxH = w * 0.25;\n\t\t\n\t\tboxY = w * 0.3 - (boxH/2);\n\t\tbarY = w * 0.5;\n\t\tlabelY = w * 0.1;\n\t\tcircleY = w * 0.3;\n\n\t\tboxX = lh * 1;\n\t\tbarX = lh * 1;\n\t\tlabelX = lh * 1;\n\t\tupCircleX = w * 0.55;\n\t\tdownCircleX = w * 0.8;\n\t\t\n\t\tscaleRect.range([0,w-(lh * 2)]);\n\n\t\tscaleCircle.range([0,boxH * 0.6]);\n\n\n\t\t\t}\n\t\t\t\n\t\t\t\t\n\t\t\n\t\t//hardcode the X for each element based on set things\n\t\td3.select('g#barChange')\n\t\t\t.attr('transform','translate(' + boxX + ',' + (boxY) + ')');\t\n\n\t\td3.select('g#barBoxLabels')\n\t\t\t.attr('transform','translate(' + (boxH * 0.5) + ',' + (boxH * 0.5) + ')');\t\n\n\n\t\td3.select('g#sectorLabels')\n\t\t\t.attr('transform','translate(' + labelX + ',' + (labelY) + ')');\t\n\n\t\td3.select('g#barSize')\n\t\t\t.attr('transform','translate(' + (barX) + ',' + (barY) + ')');\t\n\n\t\td3.select('g#barUp')\n\t\t\t.attr('transform','translate(' + (upCircleX) + ',' + (circleY) + ')');\t\n\n\t\td3.select('g#barDown')\n\t\t\t.attr('transform','translate(' + (downCircleX) + ',' + (circleY) + ')');\t\n\n\t\t\t\n\t\tvar barsH = (gh + (0.5*lh)) * (rebarSet.length + 1); //the full height of all groups put together, the plus one if for the key\n\n\t\td3.select('svg')\n\t\t\t.attr('height', ch + cPad + cPad + barsH);\n\t\t\t\n\t\tvar rebarGroup = d3.select('g#rebarViz')\n\t\t\t.attr('transform','translate(0,' + (ch + cPad) + ')');\n\t\t\n\t\tvar shader = d3.select('g#shadedRect')\n\t\t\t.selectAll('g#shadedRect rect#shader')\n\t\t\t.data(['shadey']);\n\t\t\n\t\t//ADD SHADER\n\t\tshader\n\t\t\t.enter()\n\t\t\t.append('rect')\n\t\t\t.attr('id','shader');\n\t\t\n\t\tshader\n\t\t\t.attr('width',w)\n\t\t\t.attr('height',barsH)\n\t\t\t.attr('x',0)\n\t\t\t.attr('y',0)\n\t\t\t.style('fill','lightgrey')\n\t\t\t.style('opacity',0.8)\n\t\t\t.attr('rx',(0.5 * lh))\n\t\t\t.attr('ry',(0.5 * lh));\n\t\t\n\n\t\t//ADD BACKGROUND\n\t\tvar barBackers = d3.select('g#rebarViz g#barBackers')\n\t\t\t.selectAll('rect')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\t\t\n\t\tbarBackers.enter()\n\t\t\t.append('rect');\n\t\t\n\t\tbarBackers\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',(lh * 0.5))\n//\t\t\t.attr('rx',(lh * 0.5))\n//\t\t\t.attr('ry',(lh * 0.5))\n\t\t\t.attr('height',gh)\n\t\t\t.attr('width',w-lh)\n\t\t\t.style('fill','white')\n\t\t\t.style('opacity',1);\n\t\t\n\t\t//THE PERCENT CHANGE BOXES\t\n\t\tvar barBoxes = d3.select('g#rebarViz g#barBoxes')\n\t\t\t.selectAll('rect')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\t\t\t\n\t\tbarBoxes.enter()\n\t\t\t.append('rect');\n\t\t\n\t\tbarBoxes\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.attr('rx',(lh * 0.5))\n\t\t\t.attr('ry',(lh * 0.5))\n\t\t\t.attr('height',boxH)\n\t\t\t.attr('width',boxH)\n\t\t\t.style('fill',function(d){return d.fill})\n\t\t\t.style('opacity',function(d){return d.boxOpacity});\n\n\t\t//THE PERCENT CHANGE LABELS\n\t\tvar barBoxLabels = d3.select('g#rebarViz g#barBoxLabels')\n\t\t\t.selectAll('text')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\n\t\tbarBoxLabels.enter()\n\t\t\t.append('text');\t\t\n\t\t\n\t\tbarBoxLabels\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.text(function(d){return d.pctChange})\n\t\t\t.attr('dy','0.4em')\n\t\t\t.style('text-anchor','middle')\n\t\t\t.style('fill','white')\n\t\t\t.style('font-weight','bold')\n\t\t\t.style('font-size', boxH * 0.35);\n\n\t\t\n\t\t//THE SECTOR LABELS\n\t\tvar sectorLabels = d3.select('g#rebarViz g#sectorLabels')\n\t\t\t.selectAll('\\\\text')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\n\t\tsectorLabels.enter()\n\t\t\t.append('text');\t\t\n\t\t\n\t\tsectorLabels\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.text(function(d){return d.label})\n\t\t\t.attr('class','axis')\n\t\t\t.style('text-anchor','beginning');\n\n\t\t//SECTOR SHADER RECTS\t\n\t\tvar barRects = d3.select('g#rebarViz g#barRectShaders')\n\t\t\t.selectAll('rect')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\t\t\t\n\t\tbarRects.enter()\n\t\t\t.append('rect');\n\t\t\n\t\tbarRects\t\t\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.attr('height',boxH/2)\n\t\t\t.attr('width',scaleRect.range()[1])\n\t\t\t.style('fill','lightgrey')\n\t\t\t.style('opacity',function(d){return d.boxOpacity});\n\n\t\t\t\n\t\t//THE SECTOR SIZES\t\n\t\tvar barRects = d3.select('g#rebarViz g#barRects')\n\t\t\t.selectAll('rect')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\t\t\t\n\t\tbarRects.enter()\n\t\t\t.append('rect')\n\t\t\t.attr('width',0);\n\t\t\n\t\tbarRects\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.attr('height',boxH/2)\n\t\t\t.attr('width',function(d){return scaleRect(d.value)})\n\t\t\t.style('fill',function(d){return d.fill})\n\t\t\t.style('opacity',function(d){return d.boxOpacity});\n\n\t\t//SECTOR SIZE LABELS\n\t\tvar barRectLabels = d3.select('g#rebarViz g#barRectLabels')\n\t\t\t.selectAll('text')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\n\t\tbarRectLabels.enter()\n\t\t\t.append('text')\n\t\t\t.attr('class','axis');\t\t\n\t\t\n\t\tbarRectLabels\n\t\t\t.attr('y',function(d,i){return ((i+1) * (gh + (0.5 * lh))) + boxH * 0.25})\n\t\t\t.attr('x',function(d){return scaleRect(d.value) + 5})\n\t\t\t.text(function(d){return d3.round(d.value/1000,1) + \"m\"})\n\t\t\t.attr('dy','0.4em')\n\t\t\t.attr('id',function(d){return d.series})\n\t\t\t.style('text-anchor','beginning');\n\n\t\t//hackily select only the government text and fix it\n\t\td3.select('g#barRectLabels text#CES9000000001')\n\t\t\t.attr('transform','translate(-10,0)')\n\t\t\t.style('font-weight','bold')\n\t\t\t.style('fill','white')\n\t\t\t.style('text-anchor','end');\n\n\t\t//UP CIRCLES\n\t\tvar upCircles = d3.select('g#rebarViz g#upCircles')\n\t\t\t.selectAll('circle')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\t\t\t\n\t\tupCircles.enter()\n\t\t\t.append('circle');\n\t\t\n\t\tupCircles\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('cy',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('cx',0)\n\t\t\t.attr('r',function(d){return scaleCircle(d.up)})\n//\t\t\t.style('stroke',upFill)\n//\t\t\t.style('stroke-width','2px')\n//\t\t\t.style('fill','none');\n\t\t\t.style('fill', upFill)\n\t\t\t.style('opacity',0.3);//function(d){return circleOpacity(d.up)});\n\t\t\n\t\t//DOWN CIRCLES\n\t\tvar downCircles = d3.select('g#rebarViz g#downCircles')\n\t\t\t.selectAll('circle')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\t\t\t\n\t\tdownCircles.enter()\n\t\t\t.append('circle');\n\t\t\n\t\tdownCircles\n\t\t\t.transition()\n\t\t\t.duration(duration)\n\t\t\t.attr('cy',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('cx',0)\n\t\t\t.attr('r',function(d){return scaleCircle(d.down)})\n//\t\t\t.style('stroke',downFill)\n//\t\t\t.style('stroke-width','2px')\n//\t\t\t.style('fill','none');\n\t\t\t.style('fill', downFill)\n\t\t\t.style('opacity',0.3);//function(d){return circleOpacity(d.down)});\n\n\t\t//UP CIRCLE LABELS\n\t\tvar upCircleLabels = d3.select('g#rebarViz g#upCircleLabels')\n\t\t\t.selectAll('text')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\n\t\tupCircleLabels.enter()\n\t\t\t.append('text');\t\t\n\t\t\n\t\tupCircleLabels\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.text(function(d){return d.up})\n\t\t\t.attr('dy','0.4em')\n\t\t\t.style('text-anchor','middle')\n\t\t\t.attr('class','axis');\n\n\t\t//DOWN CIRCLE LABELS\n\t\tvar downCircleLabels = d3.select('g#rebarViz g#downCircleLabels')\n\t\t\t.selectAll('text')\n\t\t\t.data(rebarSet,function(d){return d.series});\n\n\t\tdownCircleLabels.enter()\n\t\t\t.append('text');\t\t\n\t\t\n\t\tdownCircleLabels\n\t\t\t.attr('y',function(d,i){return (i+1) * (gh + (0.5 * lh))})\n\t\t\t.attr('x',0)\n\t\t\t.text(function(d){return d.down})\n\t\t\t.attr('dy','0.4em')\n\t\t\t.style('text-anchor','middle')\n\t\t\t.attr('class','axis');\n\n\n\t\t\t\n\t\t}//end rebarrer\t\n\t\t\n\t\t\n\t//////////////////////////////\n\t///////CLOSE REBAR////////////\n\t//////////////////////////////\t\n\t\t\n\trebarrer(dataSet[dataSet.length -1].key);\n\t}//end boxer", "constructor(data) {\n this.data = data;\n this.rebuild_population();\n this.list_of_infoBoxData = [];\n }", "function myVis([data,geodata]) {\n // Plot configurations\n const height = 500;\n const width = 600;\n const margin = {top: 80, left: 50, right: 75, bottom: 20};\n\n const plotWidth = width - margin.left - margin.right;\n const plotHeight = height - margin.bottom - margin.top;\n const state_abb=[\"AGS\",\"BC\",\"BCS\",\"CAMP\",\"CHIS\",\"CHIH\",\"COAH\",\"COL\",\"CDMX\",\"DUR\",\"GTO\",\"GUE\",\"HGO\",\"JAL\",\"MICH\",\n \"MOR\",\"MEX\",\"NAY\",\"NL\",\"OAX\",\"PUE\",\"QUER\",\"QROO\",\"SLP\",\"SIN\",\"SON\",\"TAB\",\"TAM\",\"TLAX\",\"VER\",\"YUC\",\"ZAC\"]\n\n var dict_names={}\n for (i = 0; i < 32; i++) {\n dict_names[`${i+1}`] = state_abb[i];\n }\n var dict_longnames={}\n for (i = 0; i < 32; i++) {\n dict_longnames[`${i+1}`] = states[i];\n }\n\n // Geographic Data\n const projection = d3.geoAlbers()\n const geoGenerator = d3.geoPath(projection);\n projection.fitExtent([[0, 0], [650, 500]], geodata);\n projection.fitSize([650,500],geodata);\n\n // Line chart\n // X SCALE , years\n const x_scale = d3.scaleBand()\n .domain(data.map((row)=>row.year_death))\n .range([margin.right, plotWidth + 50]);\n // Y SCALE, rate\n var max_y_domain = d3.max(data, function(d) { return Math.max(d.rate)} );\n const y_scale = d3.scaleLinear()\n .domain([0,max_y_domain]) //\n \t.range([plotHeight,0]);\n\n const xAxis = d3.axisBottom()\n .scale(x_scale);\n xAxis.tickValues([1998, 2003, 2008, 2013, 2017])\n xAxis.tickSize(8);\n xAxis.ticks(5);\n\n const yAxis = d3.axisRight(y_scale);\n yAxis.tickSize(8);\n yAxis.ticks(5);\n\n function state_name (data) {return data.state_name};\n\n // SVG for chart\n const svg_chart = d3.select(\".main\")\n \t.append(\"svg\")\n .attr(\"width\", width + margin.left + margin.right +50)\n .attr(\"height\", height + margin.top + margin.bottom )\n .append(\"g\")\n .attr(\"id\", \"main_g\")\n .attr(\"transform\", `translate(${margin.left}, ${margin.top}) `)\n\n svg_chart.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,400)\")\n .call(xAxis);\n\n // todo` once the chart is back, look at the css style for the ticks, write a css style display none for the\n svg_chart.append(\"g\")\n .attr(\"class\", \"y axis\")\n .attr(\"transform\", \"translate(555,0)\")\n .call(yAxis);\n\n svg_chart\n .append('text')\n .attr('class', 'label')\n .attr('x', 300)\n .attr('y', 430)\n .attr('text-anchor', 'right')\n .attr('font-size', 15)\n .attr('font-family', 'Karla')\n .attr('font-weight', 'bold')\n .text(\"Year\");\n svg_chart\n .append('text')\n .attr(\"class\", \"label\")\n .attr(\"y\", 600)\n .attr(\"x\", -plotHeight/2 - 100)\n .attr('text-anchor', 'right')\n .attr('font-size', 14)\n .attr(\"transform\", \"rotate(-90)\")\n .attr('font-weight', 'bold')\n .text(\"Rate per 100K inhabitants\")\n\n // Function to draw lines (FROM here https://bl.ocks.org/gordlea/27370d1eea8464b04538e6d8ced39e89#index.html)\n var line = d3.line()\n .x(function(d) {\n return x_scale(d.year_death);\n })\n .y(function(d) { return y_scale(d.rate); }) // set the y values for the line generator\n .curve(d3.curveMonotoneX); // apply smoothing to the line\n\n\n let lines = svg_chart.append(\"g\")\n .attr(\"class\", \"lines\");\n\n // Transform data to have an array\n const lines_data = data.reduce((acc, row) => {\n if (!acc[row.state_name]){\n acc[row.state_name]=[] ;\n }\n\n acc[row.state_name].push(row);\n return acc;\n },{});\n\n var dataByStateByYear = d3.nest()\n \t\t.key(function(d) { return d.fips; })\n \t\t.key(function(d) { return d.year; })\n \t\t.map(data);\n// Some Brute force here :(\nlines_data['Aguascalientes'].abbrev=\"AGS\";lines_data['Baja California'].abbrev=\"BC\";lines_data['Baja California Sur'].abbrev=\"BCS\";\nlines_data['Campeche'].abbrev=\"CAMP\";lines_data['Coahuila'].abbrev=\"COAH\";lines_data['Colima'].abbrev=\"COL\";lines_data['Chiapas'].abbrev=\"CHIS\";\nlines_data['Chihuahua'].abbrev=\"CHIH\";lines_data['Distrito Federal'].abbrev=\"CDMX\";lines_data['Durango'].abbrev=\"DUR\";lines_data['Guanajuato'].abbrev=\"GTO\";\nlines_data['Guerrero'].abbrev=\"GUER\";lines_data['Hidalgo'].abbrev=\"HGO\";lines_data['Jalisco'].abbrev=\"JAL\";lines_data['México'].abbrev=\"MEX\";\nlines_data['Michoacán'].abbrev=\"MICH\";lines_data['Morelos'].abbrev=\"MOR\";lines_data['Nayarit'].abbrev=\"NAY\";lines_data['Nuevo León'].abbrev=\"NL\";\nlines_data['Oaxaca'].abbrev=\"OAX\";lines_data['Puebla'].abbrev=\"PUE\";lines_data['Querétaro'].abbrev=\"QUER\";lines_data['Quintana Roo'].abbrev=\"QROO\";\nlines_data['San Luis Potosí'].abbrev=\"SLP\";lines_data['Sinaloa'].abbrev=\"SIN\";lines_data['Sonora'].abbrev=\"SON\";lines_data['Tabasco'].abbrev=\"TAB\";\nlines_data['Tamaulipas'].abbrev=\"TAMP\";lines_data['Tlaxcala'].abbrev=\"TLAX\";lines_data['Veracruz'].abbrev=\"VER\";lines_data['Yucatán'].abbrev=\"YUC\"\nlines_data['Zacatecas'].abbrev=\"ZAC\";lines_data['National'].abbrev=\"NAT\";\n\n\n// Draw lines\nlines.selectAll(\".state-line\")\n .data(Object.values(lines_data)).enter()\n .append(\"path\")\n .attr(\"class\", \"state-line\")\n .attr(\"d\", d => line((d)))\n .attr(\"stroke\", '#D3D3D3')\n .attr(\"id\", function(d){return `state-path-${Number(d[0][\"cve_edo\"])}`;}\n )\n .attr(\"name\", function(d){return (d[0][\"state_name\"]);}\n )\n .attr( \"abbreviation\", function(d){return (d['abbrev']);})\n .attr(\"class\", \"inactive\")\n .attr(\"stroke-opacity\", 0)\n .attr(\"fill\", \"none\")\n .attr(\"stroke-width\", 1)\n ;\n// Create labels that will be placed at the end of the line\nlines.selectAll(\".myLabels\")\n .data(Object.values(lines_data)) // Source: https://www.d3-graph-gallery.com/graph/connectedscatter_multi.html\n .enter()\n .append('g')\n .append(\"text\")\n .datum(function(d) {return {name: d[\"abbrev\"], value: d[19]['rate'], year: d[19]['year_death'], id:d[19]['cve_edo'] }; }) // keep only the last value of each time serie\n .attr(\"transform\", function(d) { return \"translate(\" + x_scale(d.year) + \",\" + y_scale(d.value) + \")\"; }) // Put the text at the position of the last point\n .attr(\"x\", 3)\n .attr(\"y\", 5)\n .attr(\"id\", function(d){return `state-label-${(d.id)}`;})\n .text(function(d) { return d.name; })\n .attr (\"fill\", \"none\")\n .style(\"font-size\", 15);\n\n // SVG for map\n const svg_map = d3.select(\".main\")\n .append(\"svg\")\n .attr(\"width\", 860)\n .attr(\"height\", 800)\n .attr(\"id\", \"mapcontainer\")\n .append(\"g\")\n .attr(\"transform\", `translate(${margin.left}, ${margin.top}) `);\n\n// This is the line for the national rate\n d3.select(\"#main_g\")\n .selectAll(\"#state-path-33\")\n .attr(\"stroke\", \"red\")\n .attr(\"stroke-width\", 4)\n .style(\"stroke-dasharray\", (\"3, 3\"))\n .attr(\"stroke-opacity\", .8);\n// And its label\n d3.select(\"#main_g\")\n .selectAll(\"#state-label-33\")\n .attr(\"fill\", \"red\")\n\n// Add a tooltip for mouseover\nvar tooltip = d3.select(\"body\").append(\"main\")\n .attr(\"class\", \"tooltip\")\n .style(\"opacity\", 0);\n\n// I was playing with these colors for the choropleth\nvar green = [\"#f0f9e8\", \"#bae4bc\", \"#7bccc4\", \"#2b8cbe\"]\nvar blue = [ '#d2e2f0','#90b8da','#4d8dc3', '#2171b5']\nvar orange = ['#ffffd4','#fed98e','#fe9929','#cc4c02']\n var color = d3.scaleThreshold()\n \t\t.domain([4.3, 6.9, 7.5, 12]) // These are the thresolds for quantiles. Should be in a function\n \t\t.range(blue);\n\nvar stateshapes = svg_map.selectAll(\".state\")\n .data(geodata.features)\n .enter()\n .append('path')\n .attr(\"d\", geoGenerator)\n .attr(\"id\", function(d) { return Number(d['properties'][\"CVE_ENT\"])} )\n .attr(\"state-name\", function(d) { return (d['properties'][\"NOM_ENT\"])} )\n .attr('stroke', 'black')\n .attr('fill', function(d) {\n\t\t\t return color(d['properties'][\"Rate_2017\"])})\n .attr(\"opacity\", \".7\")\n .on(\"click\", function(d){\n var id = d3.select(this).attr('id')\n var activeClass = \"active\"; // Source for this part https://jaketrent.com/post/d3-class-operations/\n var alreadyIsActive = d3.select(this).classed(activeClass);\n d3.select(this)\n .classed(activeClass, !alreadyIsActive);\n d3.select(this)\n .attr(\"stroke-width\", d=> alreadyIsActive? .7: 2.5)\n .attr(\"stroke\", \"black\")\n .attr(\"fill-opacity\", \".8\")\n\n //console.log(id)\n d3.select(\"#main_g\").selectAll(`#state-path-${id}`)\n .attr(\"stroke\", alreadyIsActive? \"#D3D3D3\" : color(d['properties'][\"Rate_2017\"]))\n .attr(\"stroke-width\", alreadyIsActive? 1 : 3.5)\n\n .attr(\"stroke-opacity\", alreadyIsActive? 0: .8);\n d3.select(\"#main_g\")\n .selectAll(`#state-label-${id}`)\n .attr(\"fill\", alreadyIsActive ? \"#FF000000\" : \"black\" )\n });\n// Show the historic ranking with mouseover\n//Source for this part of the code: http://bl.ocks.org/dougdowson/9832019\nstateshapes.on(\"mouseover\", function(d) {\n\t\t\ttooltip.transition()\n\t\t\t.duration(250)\n\t\t\t.style(\"opacity\", .7);\n\t\t\ttooltip.html(\n\t\t\t\"<p><strong>\" + dict_longnames[d['properties']['NOM_ENT']] + \"</strong></p>\" +\n\t\t\t\"<table><tbody><tr><td class='wide'>Ranking 1998:</td><td>\" + d['properties']['Ranking_19'] + \"</td></tr>\" +\n\t\t\t\"<tr><td>Ranking 2017:</td><td>\" + d['properties']['Ranking_20'] + \"</td></tr>\" +\n\t\t\t\"<tr><td>Rate 2017:</td><td>\" + (d['properties']['Rate_2017']).toFixed(1) + \"</td></tr></tbody></table>\"\n\t\t\t)\n\t\t\t.style(\"left\", (d3.event.pageX + 15) + \"px\")\n\t\t\t.style(\"top\", (d3.event.pageY - 28) + \"px\");\n\n d3.select(this)\n .attr(\"stroke\", \"black\")\n .attr(\"fill-opacity\", \".4\")}\n )\n\t\t.on(\"mouseout\", function(d) {\n\t\t\ttooltip.transition()\n\t\t\t.duration(250)\n\t\t\t.style(\"opacity\", 0);\n d3.select(this)\n .attr(\"stroke\", \"black\")\n .attr(\"fill-opacity\", \".8\")});\n\n//Create legend for choropleth\nsvg_map.append('rect')\n .attr('class', 'First_quartile')\n .attr('height', 18)\n .attr('width', 18)\n .attr('x', 55)\n .attr('y', 340)\n .attr(\"stroke\", \"black\");\n\nsvg_map.append('rect')\n .attr('class', 'rect Second_quartile')\n .attr('height', 18)\n .attr('width', 18)\n .attr('x', 55)\n .attr('y', 370)\n .attr(\"stroke\", \"black\");\n\nsvg_map.append('rect')\n .attr('class', 'rect Third_quartile')\n .attr('height', 18)\n .attr('width', 18)\n .attr('x', 55)\n .attr('y', 400)\n .attr(\"stroke\", \"black\");\n\nsvg_map.append('rect')\n .attr('class', 'rect Fourth_quartile')\n .attr('height', 18)\n .attr('width', 18)\n .attr('x', 55)\n .attr('y', 430)\n .attr(\"stroke\", \"black\");\n\nsvg_map.append('text')\n .attr('class', 'label')\n .attr('x', 55)\n .attr('y', 300)\n .attr('text-anchor', 'right')\n .attr('font-size', 18)\n .attr('font-family', 'Karla')\n .attr('font-weight', 'bold')\n .text(\"Rates of Suicide\");\n\nsvg_map.append('text')\n .attr('class', 'label')\n .attr('x', 55)\n .attr('y', 300)\n .attr('text-anchor', 'right')\n .attr('font-size', 18)\n .attr('font-family', 'Karla')\n .attr('font-weight', 'bold')\n .attr(\"dy\", \"1em\")\n .text(\"(State Quartiles)\")\n\nsvg_map.append('text')\n .attr('class', 'label')\n .attr('x', 80)\n .attr('y', 355)\n .attr('text-anchor', 'right')\n .attr('font-size', 16)\n .attr('font-family', 'Karla')\n .text(\"< 4.3\");\n\nsvg_map.append('text')\n .attr('class', 'label')\n .attr('x', 80)\n .attr('y', 385)\n .attr('text-anchor', 'right')\n .attr('font-size', 16)\n .attr('font-family', 'Karla')\n .text(\"4.3 < X < 6.9\");\n\nsvg_map.append('text')\n .attr('class', 'label')\n .attr('x', 80)\n .attr('y', 415)\n .attr('text-anchor', 'right')\n .attr('font-size', 16)\n .attr('font-family', 'Karla')\n .text(\"6.9 < X < 7.5\");\n\nsvg_map.append('text')\n .attr('class', 'label')\n .attr('x', 80)\n .attr('y', 445)\n .attr('text-anchor', 'right')\n .attr('font-size', 16)\n .attr('font-family', 'Karla')\n .text(\"> 7.5\");\n\nsvg_map.append('text')\n .attr('class', 'title')\n .attr('x', 0)\n .attr('y', 0 )\n .attr('text-anchor', 'center')\n .attr('font-size', 28)\n .attr('font-family', 'Karla')\n .text(\"Geographic Distribution of Suicide Occurrences 2017\") ;\n\nsvg_chart.append('text')\n .attr('class', 'title')\n .attr('x', 0)\n .attr('y', height -20 )\n .attr('text-anchor', 'center')\n .attr('font-size', 28)\n .attr('font-family', 'Karla')\n .text(\"Evolution of Suicide Occurrences 1998-2017\") ;\n\nsvg_map.append('text')\n .attr('class', 'x_axis_label')\n .attr('x', (166))\n .attr('y', height )\n .attr('text-anchor', 'right')\n .attr('font-size', 14)\n .attr('font-family', 'Karla')\n .attr('text-anchor', 'middle')\n .text(\"Source: INEGI for death certificates, and CONAPO for population\") ;\n// svg_map.append('text')\n// .attr('class', 'x_axis_label')\n// .attr('x', (126))\n// .attr('y', height )\n// .attr('text-anchor', 'right')\n// .attr('font-size', 14)\n// .attr('font-family', 'Karla')\n// .attr('text-anchor', 'middle')\n// .attr(\"dy\", \"1em\")\n// .text(\"and CONAPO for population\") ;\n\n\n}", "function getResults() {\n res = microtonal_utils.parseCvt($('#expr').val());\n // The EDO case\n if (res.type == \"EDO\") {\n return [\"EDO\", [], range(1,res.edo).map(i => i + \"\\\\\" + res.edo).join(\"%0A\")];\n }\n const intv = res.type == \"interval\" ? res.intv : res.intvToRef.mul(res.ref.intvToA4);\n let [typeStr, rows, scaleWorkshopData] = [\"\", [], \"\"];\n // Add interval-specific rows\n if (res.type === \"interval\") {\n res.hertz = res.intv.mul(res.ref.hertz).valueOf();\n typeStr = \"Interval\";\n const centsLink = fmtInlineLink(\"Size in cents\", \"https://en.wikipedia.org/wiki/Cent_(music)\");\n const k = findCentsDecPlaces(res.intv, res.cents);\n rows.push([centsLink, fmtExtExprLink(fmtCents(res.cents, k))]);\n if (res.ratio) {\n const ratioLink = fmtInlineLink(\"Ratio\", \"https://en.wikipedia.org/wiki/Just_intonation\");\n rows.push([ratioLink, fmtExtExprLink(toRatioStr(res.ratio))]);\n }\n else {\n try {\n if (res.intv.toNthRoot().n <= 6) {\n rows.push([\"Expression\", fmtExtExprLink(res.intv.toNthRootString())]);\n }\n }\n catch (err) {}\n }\n if (res.intv.hasFactors()) {\n const [fact_off, fact_on] = fmtFactorization(res.intv);\n if (fact_off.length > 0) {\n if (fact_off !== fact_on) {\n rows.push([\"Prime factorization\", { hoverSwap_off: fmtExtExprLink(fact_off, fact_on)\n , hoverSwap_on : fmtExtExprLink(fact_on) }]);\n }\n else {\n rows.push([\"Prime factorization\", fmtExtExprLink(fact_on)]);\n }\n let monzo = res.intv.toMonzo();\n if (monzo.length <= 18*7) {\n if (res.intv.isFrac()) {\n const monzoLink = fmtInlineLink(\"Monzo\", \"https://en.xen.wiki/w/Monzo\");\n const str = \"|\" + monzo.join(\" \") + \"⟩\";\n rows.push([monzoLink, fmtExtExprLink(str)]);\n }\n else {\n monzo = monzo.map(x => x.toFraction());\n const monzoLink = fmtInlineLink(\"Fractional monzo\", \"https://en.xen.wiki/w/Fractional_monzo\");\n const str = \"|\" + monzo.join('<span class=\"bigspace\"></span>') + \"⟩\";\n const linkStr = \"|\" + monzo.join(\" \") + \"⟩\";\n rows.push([monzoLink, fmtExtExprLink(str, linkStr)]);\n }\n }\n }\n }\n if (res.iso) {\n const isoLink = fmtInlineLink(\"Isoharmonic\", \"https://en.xen.wiki/w/Isoharmonic_chords\") + \"/\" +\n fmtInlineLink(\"linear\", \"https://en.xen.wiki/w/Linear_chord\") + \" expression\";\n const [expr_off, expr_on] = fmtExpression(res.iso[0]);\n const [n,d] = res.iso[0].compare(1) < 0 ? [res.iso[1].n, res.iso[1].s * res.iso[1].d]\n : [res.iso[1].s * res.iso[1].n, res.iso[1].d];\n const [iso_off, iso_on] = [fmtIso(expr_off, n, d), fmtIso(expr_on, n, d)];\n rows.push([isoLink, { hoverSwap_off: fmtExtExprLink(iso_off, iso_on)\n , hoverSwap_on : fmtExtExprLink(iso_on) }]);\n }\n if (res.ratio) {\n const benedettiLink = fmtInlineLink(\"Benedetti height\", \"https://en.xen.wiki/w/Benedetti_height\");\n const tenneyLink = fmtInlineLink(\"Tenney height\", \"https://en.xen.wiki/w/Tenney_height\");\n const no2Benedetti = microtonal_utils.Interval(res.height.benedetti).factorOut(2)[1].valueOf();\n if (res.height.tenney < 50) {\n rows.push([benedettiLink, res.height.benedetti + \" (no-2s: \" + no2Benedetti + \")\"]);\n }\n rows.push([tenneyLink, +res.height.tenney.toFixed(5) + \" (no-2s: \" + +Math.log2(no2Benedetti).toFixed(5) + \")\"]);\n }\n if (res.edoSteps) {\n const edoLink = fmtInlineLink(\"EDO\", \"https://en.wikipedia.org/wiki/Equal_temperament\");\n rows.push([edoLink + \" steps\", fmtExtExprLink(fmtEDOStep(res.edoSteps))]);\n }\n }\n // Add note-specific rows\n if (res.type === \"note\") {\n typeStr = \"Note\";\n const hertzLink = fmtInlineLink(\"Frequency in hertz\", \"https://en.wikipedia.org/wiki/Hertz\");\n rows.push([hertzLink, fmtExtExprLink(fmtHertz(res.hertz, 5))]);\n rows.push([\"Tuning meter read-out\", res.tuningMeter]);\n }\n let did_merged_FJS_color = false;\n // Special case for \"colorless\" notes - the Pythagorean, FJS, and color notations are the same!\n if (res.type == \"note\" && res.symb && res.symb.py && res.symb.color\n && res.symb.py == res.symb.color) {\n const linkStr = fmtInlineLink(\"Pythagorean\", \"https://en.wikipedia.org/wiki/Pythagorean_tuning\")\n + \"/\" +\n fmtInlineLink(\"FJS\", \"https://en.xen.wiki/w/Functional_Just_System\")\n + \"/\" +\n fmtInlineLink(\"color\", \"https://en.xen.wiki/w/Color_notation\")\n + \" name\";\n rows.push([linkStr + \"\", fmtExtExprLink(res.symb.py)]);\n did_merged_FJS_color = true;\n }\n // Add any symbols\n if (res.symb) {\n if (res.symb.py && !did_merged_FJS_color) {\n const link = fmtInlineLink(\"Pythagorean\", \"https://en.wikipedia.org/wiki/Pythagorean_tuning\")\n + \"/\" +\n fmtInlineLink(\"FJS\", \"https://en.xen.wiki/w/Functional_Just_System\")\n + \" name\";\n let str = fmtExtExprLink(res.symb.py).prop('outerHTML');\n if (res.symb.py_verbose) {\n str = fmtExtExprLink(res.symb.py_verbose).prop('outerHTML') + \", \" + str;\n }\n rows.push([link, str]);\n }\n if (res.symb.FJS && !did_merged_FJS_color &&\n // for now we only have integer accidentals, since I'm not sure how\n // useful showing non-integer accidentals actually is\n !(res.symb.FJS.includes(\"root\") || res.symb.FJS.includes(\"sqrt\"))) {\n const fjsLink = fmtInlineLink(\"FJS name\", \"https://en.xen.wiki/w/Functional_Just_System\");\n const {otos, utos, pyi} = microtonal_utils.fjsAccidentals(intv);\n if (otos.length != 0 || utos.length != 0) {\n const otoStr = otos.length == 0 ? \"\" : \"<sup>\" + otos.join(\",\") + \"</sup>\";\n const utoStr = utos.length == 0 ? \"\" : \"<sub>\" + utos.join(\",\") + \"</sub>\";\n const withSupsSubs = (res.type == \"interval\" ? microtonal_utils.pySymb(pyi)\n : microtonal_utils.pyNote(pyi))\n + '<span class=\"supsub\">' + otoStr + utoStr + '</span>';\n rows.push([fjsLink, { hoverSwap_off: fmtExtExprLink(withSupsSubs, res.symb.FJS)\n , hoverSwap_on : fmtExtExprLink(res.symb.FJS) }]);\n }\n else {\n rows.push([fjsLink, fmtExtExprLink(res.symb.FJS)]);\n }\n }\n if (res.symb.NFJS &&\n // for now we only have integer accidentals, since I'm not sure how\n // useful showing non-integer accidentals actually is\n !(res.symb.NFJS.includes(\"root\") || res.symb.NFJS.includes(\"sqrt\"))) {\n const nfjsLink = fmtInlineLink(\"Neutral FJS name\", \"https://en.xen.wiki/w/User:M-yac/Neutral_Intervals_and_the_FJS\");\n let linkStr = res.symb.NFJS;\n if (res.symb.NFJS !== microtonal_utils.parseCvt(res.symb.NFJS).symb.NFJS) {\n linkStr = \"NFJS(\" + res.symb.NFJS + \")\";\n }\n const {otos, utos, pyi} = microtonal_utils.fjsAccidentals(intv, microtonal_utils.nfjsSpec);\n if (otos.length != 0 || utos.length != 0) {\n const otoStr = otos.length == 0 ? \"\" : \"<sup>\" + otos.join(\",\") + \"</sup>\";\n const utoStr = utos.length == 0 ? \"\" : \"<sub>\" + utos.join(\",\") + \"</sub>\";\n const withSupsSubs = (res.type == \"interval\" ? microtonal_utils.pySymb(pyi)\n : microtonal_utils.pyNote(pyi))\n + '<span class=\"supsub\">' + otoStr + utoStr + '</span>';\n rows.push([nfjsLink, { hoverSwap_off: fmtExtExprLink(withSupsSubs, linkStr)\n , hoverSwap_on : fmtExtExprLink(res.symb.NFJS, linkStr) }]);\n }\n else {\n rows.push([nfjsLink, fmtExtExprLink(res.symb.NFJS, linkStr)]);\n }\n }\n if (res.symb.ups_and_downs) {\n const [steps, edo] = res.type == \"interval\" ? res.edoSteps : [res.edoStepsToRef[0] + res.ref.edoStepsToA4[0], res.edoStepsToRef[1]];\n const updnsLink = fmtInlineLink(\"Ups-and-downs notation\", \"https://en.xen.wiki/w/Ups_and_Downs_Notation\");\n const fn = (res.type == \"interval\" ? microtonal_utils.updnsSymb : microtonal_utils.updnsNote);\n const offSymbs = fn(edo, steps, {useWordDesc:1, useExps:1, useHTMLExps:1});\n let [str_on, str_off] = [\"\", \"\"];\n for (let i = 0; i < res.symb.ups_and_downs.length; i++) {\n str_on += fmtExtExprLink(res.symb.ups_and_downs[i]).prop('outerHTML');\n str_off += fmtExtExprLink(offSymbs[i] + \"\\\\\" + edo, res.symb.ups_and_downs[i]).prop('outerHTML');\n if (res.symb.ups_and_downs_verbose && i < res.symb.ups_and_downs_verbose.length) {\n str_on += \" (\" + fmtExtExprLink(res.symb.ups_and_downs_verbose[i]).prop('outerHTML') + \")\";\n str_off += \" (\" + fmtExtExprLink(res.symb.ups_and_downs_verbose[i]).prop('outerHTML') + \")\";\n }\n if (i < res.symb.ups_and_downs.length - 1) {\n str_on += \"<br>\";\n str_off += \"<br>\";\n }\n }\n rows.push([updnsLink, { hoverSwap_off: str_off, hoverSwap_on: str_on }]);\n }\n }\n if (res.english && res.english.length > 0){\n let link = \"(Possible) English name\" + (res.english.length > 1 ? \"s\" : \"\");\n link += $('<sup>').html($('<a>').addClass(\"alt\").text(\"?\")\n .prop(\"href\",\"about.html#englishNames\"))\n .prop(\"outerHTML\");\n rows.push([link, res.english.join(\"<br>\")]);\n }\n // Add any color name\n if (res.symb && res.symb.color && !did_merged_FJS_color) {\n const colorLink = fmtInlineLink(\"Color notation\", \"https://en.xen.wiki/w/Color_notation\");\n let str = \"\";\n const symbFn = res.type == \"interval\" ? microtonal_utils.colorSymb\n : microtonal_utils.colorNote;\n if (res.symb.color_verbose) {\n const name = symbFn(intv, {verbosity: 1});\n const dispName = symbFn(intv, {verbosity: 1, useWordNegative: true})\n .replace(\" 1sn\", \" unison\")\n .replace(\" 8ve\", \" octave\");\n str += fmtExtExprLink(dispName, name).prop('outerHTML') + \", \";\n }\n const abbrevName = symbFn(intv, {useExps: true});\n const withSupsSubs = symbFn(intv, {useHTMLExps: true});\n if (withSupsSubs !== abbrevName) {\n const str_off = str + fmtExtExprLink(withSupsSubs, abbrevName).prop(\"outerHTML\");\n const str_on = str + fmtExtExprLink(abbrevName).prop(\"outerHTML\");\n rows.push([colorLink, { hoverSwap_off: str_off, hoverSwap_on: str_on }]);\n }\n else {\n str += fmtExtExprLink(res.symb.color).prop(\"outerHTML\");\n rows.push([colorLink, str])\n }\n }\n if (res.edoSteps) { rows.push([\"xen-calc page for EDO\", fmtExtExprLink(res.edoSteps[1] + \"-EDO\")]) }\n if (res.edoStepsToRef) { rows.push([\"xen-calc page for EDO\", fmtExtExprLink(res.edoStepsToRef[1] + \"-EDO\")]) }\n // Add a note's interval reference\n if (res.type === \"note\" && !res.intvToRef.equals(1)) {\n rows.push([]);\n const refSymb = microtonal_utils.pyNote(res.ref.intvToA4);\n if (res.edoStepsToRef) {\n rows.push([\"Interval from reference note\",\n fmtExtExprLink(fmtEDOStep(res.edoStepsToRef))]);\n }\n else {\n const [expr_off, expr_on] = fmtExpression(res.intvToRef);\n rows.push([\"Interval from reference note\", { hoverSwap_off: fmtExtExprLink(expr_off, expr_on)\n , hoverSwap_on : fmtExtExprLink(expr_on) }]);\n }\n rows.push([\"Reference note and frequency\", refSymb + \" = \" + fmtHertz(res.ref.hertz, 2)])\n }\n // Format the interval for use in Scale Workshop\n if (res.type == \"interval\") {\n if (res.edoSteps) { scaleWorkshopData = fmtEDOStep(res.edoSteps); }\n else if (res.ratio) { scaleWorkshopData = toRatioStr(res.ratio); }\n else { scaleWorkshopData = res.cents; }\n }\n if (res.type == \"note\") {\n if (res.edoStepsToRef) { scaleWorkshopData = fmtEDOStep(res.edoStepsToRef); }\n else if (res.intvToRef.isFrac()) { scaleWorkshopData = toRatioStr(res.intvToRef.toFrac()); }\n else { scaleWorkshopData = res.intvToRef.toCents().toFixed(13); }\n }\n return [typeStr, rows, scaleWorkshopData];\n}", "function selectFullData(){\n\n // bar chart\n var rates = getCheckedRadioValue('malware');\n listdatacollector(minTime,maxTime,rates);\n updatelist_data();\n //behavoiur graph\n bartobehavior(rates);\n // theread graph\n var temp = getDataForTimeFrame(minTemp,maxTemp);\n generateThreadGraph([temp],minTemp,maxTemp);\n\n}", "function drawBoxData(request) {\n $.getJSON('/charts/api/get_box_data/', request, function(data) {\n console.log(data);\n if (!data.error) {\n data = transformBoxData(data.data);\n drawBoxChart(data, 'chart-div2');\n } else {\n alert(data.error);\n }\n });\n}", "function addAllScatterPlot(fetch_data_array){\r\n\t\r\nvar margin = {top: 20, right: 20, bottom: 30, left: 80},\r\n width = 1200 - margin.left - margin.right,\r\n height = 800 - margin.top - margin.bottom;\r\n\r\n/* \r\n * value accessor - returns the value to encode for a given data object.\r\n * scale - maps value to a visual display encoding, such as a pixel position.\r\n * map function - maps from data value to display value\r\n * axis - sets up axis\r\n */\r\n\r\n\r\n\r\n// setup x \r\nvar xValue = function(d) { return d.male;}, // data -> value\r\n xScale = d3.scale.linear().range([0, width]), // value -> display\r\n xMap = function(d) { return xScale(xValue(d));}, // data -> display\r\n xAxis = d3.svg.axis().scale(xScale).orient(\"bottom\");\r\n\t\r\n// setup y\r\nvar yValue = function(d) { return d.female;}, // data -> value\r\n yScale = d3.scale.linear().range([height, 0]), // value -> display\r\n yMap = function(d) { return yScale(yValue(d));}, // data -> display\r\n yAxis = d3.svg.axis().scale(yScale).orient(\"left\");\r\n\t\r\n\t// setup fill color\r\nvar cValue = function(d) { return d.cancertype;},\r\n color = d3.scale.category10();\r\n\t\r\n// add the graph canvas to the body of the webpage\r\nvar svg = d3.select(\"body\").append(\"svg\")\r\n .attr(\"width\", width + margin.left + margin.right)\r\n .attr(\"height\", height + margin.top + margin.bottom)\r\n .append(\"g\")\r\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\r\n\r\n\t// add the tooltip area to the webpage\r\nvar tooltip = d3.select(\"body\").append(\"div\")\r\n .attr(\"class\", \"tooltip\")\r\n .style(\"opacity\", 0);\r\n\r\n fetch_data_array.forEach(function(d) {\r\n\td.male = +d.male;\r\n d.female = +d.female;\r\n\t\r\n});\r\n\r\n // don't want dots overlapping axis, so add in buffer to data domain\r\n xScale.domain([d3.min(fetch_data_array, xValue)-1, d3.max(fetch_data_array, xValue)+1]);\r\n yScale.domain([d3.min(fetch_data_array, yValue)-1, d3.max(fetch_data_array, yValue)+1]); \r\n\r\n // x-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"x axis\")\r\n .attr(\"transform\", \"translate(0,\" + height + \")\")\r\n .call(xAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"x\", width)\r\n .attr(\"y\", -6)\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Male Count\");\r\n\t \r\n\t // y-axis\r\n svg.append(\"g\")\r\n .attr(\"class\", \"y axis\")\r\n .call(yAxis)\r\n .append(\"text\")\r\n .attr(\"class\", \"label\")\r\n .attr(\"transform\", \"rotate(-90)\")\r\n .attr(\"y\", 6)\r\n .attr(\"dy\", \".71em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(\"Female Count\");\r\n \r\n// draw dots\r\n svg.selectAll(\".dot\")\r\n .data(fetch_data_array)\r\n .enter().append(\"circle\")\r\n .attr(\"class\", \"dot\")\r\n .attr(\"r\", 6.5)\r\n .attr(\"cx\", xMap)\r\n .attr(\"cy\", yMap)\r\n .style(\"fill\", function(d) { return color(cValue(d));}) \r\n .on(\"mouseover\", function(d) {\r\n tooltip.transition()\r\n .duration(200)\r\n .style(\"opacity\", .9);\r\n tooltip.html(d[\"cancertype\"] + \"<br/> (\" + xValue(d) \r\n\t + \", \" + yValue(d) + \")\")\r\n .style(\"left\", (d3.event.pageX + 5) + \"px\")\r\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\r\n })\r\n .on(\"mouseout\", function(d) {\r\n tooltip.transition()\r\n .duration(500)\r\n .style(\"opacity\", 0);\r\n });\r\n\r\n// draw legend\r\n var legend = svg.selectAll(\".legend\")\r\n .data(color.domain())\r\n .enter().append(\"g\")\r\n .attr(\"class\", \"legend\")\r\n .attr(\"transform\", function(d, i) { return \"translate(0,\" + i * 20 + \")\"; });\r\n\r\n // draw legend colored rectangles\r\n legend.append(\"rect\")\r\n .attr(\"x\", width - 18)\r\n .attr(\"width\", 18)\r\n .attr(\"height\", 18)\r\n .style(\"fill\", color);\r\n\r\n // draw legend text\r\n legend.append(\"text\")\r\n .attr(\"x\", width - 24)\r\n .attr(\"y\", 9)\r\n .attr(\"dy\", \".35em\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(function(d) { return d;})\r\n\t \r\n\t//d3.select(\"svg\").remove();\r\n\r\n}", "createDataList(equation){\n\t\tif(!equation)\n\t\t\treturn;\n\t\tlet dataList = [];\n\t\tlet progressPoints = 100;\n\t\tfor (var i = 0; i <= progressPoints; i++) {\n\t\t\t// we need to divide the progress times three with i times 9 because of the needed amount of points\n\t\t\tlet sec = (i*3)/(progressPoints);\n\t\t\tlet pr = i/progressPoints;\n\t\t\tlet dataPoint = {\n\t\t\t\t\"x\": sec,\n\t\t\t\t\"y\": toPercentage(calculateEquation(equation)(pr)),\n\t\t\t};\n\t\t\tdataList.push(dataPoint);\n\t\t}\t\t\t\t\n\t\treturn dataList;\n\t}", "function dynamicSummary(){\n fieldArray = [];\t//\tclear array so everytime this is called we update the data\n window.guideBridge.visit(function(cmp){\n var name = cmp.name;\n if(name && isVisible(cmp)){\n var grouped = isGrouped(cmp);\n var hideLabel = isHideLabel(cmp);\n var hideLink = isHideLink(cmp);\n\n if(name.indexOf(\"block_heading_\") == 0){//\tcheck if block heading (like for the address block fields)\n fieldArray.push({\"type\":\"block_heading\",\"size\":size(cmp),\"name\":cmp.name,\"value\":$(cmp.value).html(),\"grouped\":grouped, \"hideLink\":hideLink, \"className\":cmp.className, \"cssClassName\":cmp.cssClassName,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else if(name.indexOf(\"block_\") == 0) {//\tcheck if object is a group panel\n fieldArray.push({\"type\":\"block\",\"size\":size(cmp),\"name\":cmp.name,\"title\":cmp.title, \"grouped\":grouped, \"className\":cmp.className, \"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else if(name.indexOf(\"heading_\") == 0){//\tcheck if heading\n fieldArray.push({\"type\":\"heading\",\"size\":size(cmp),\"name\":cmp.name,\"value\":$(cmp.value).html(),\"grouped\":grouped, \"hideLink\":hideLink, \"className\":cmp.className, \"cssClassName\":cmp.cssClassName,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else{\n //if(cmp.value != null){\n if(cmp.className == \"guideTextBox\"){\n fieldArray.push({\"type\":\"field\",\"name\":cmp.name,\"title\":cmp.title,\"grouped\":grouped,\"hideLabel\":hideLabel, \"hideLink\":hideLink, \"value\":((cmp.value)?cmp.value:\"Not provided\"),\"className\":cmp.className,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n if(cmp.className == \"guideRadioButton\" ||\n cmp.className == \"guideCheckBox\" ){\n fieldArray.push({\"type\":\"option\",\"name\":cmp.name,\"title\":cmp.title,\"grouped\":grouped,\"hideLabel\":hideLabel,\"hideLink\":hideLink, \"value\":((cmp.value)?cmp.value:\"Not provided\"), \"obj\":cmp,\"className\":cmp.className,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n //}\n }\n }\n });\n\n renderHTML();\t//\tthis generates the html inside the summary component\n}", "function processOneAxisValue(feed)\r\n {\r\n var dataset = [];\r\n var i, j, k;\r\n var measureData;\r\n if (feed.values.length <= 0){\r\n return dataset;\r\n }\r\n if (hasMND && !bMNDOnColor)\r\n {\r\n for(j = 0; j < feed.values[0].rows.length; ++j)\r\n { \r\n measureData = new Array(feed.values.length * feed.values[0].rows[0].length);\r\n for(k = 0; k < feed.values[0].rows[0].length; ++k)\r\n {\r\n for(i = 0 ; i < feed.values.length; ++i)\r\n {\r\n var dataPoint = {};\r\n dataPoint.val = feed.values[i].rows[j][k].val;\r\n dataPoint.ctx = feed.values[i].rows[j][k].ctx;\r\n dataPoint.info = feed.values[i].rows[j][k].info;\r\n if(bMNDInner){\r\n measureData[k * feed.values.length + i] = dataPoint;\r\n } else {\r\n measureData[i * feed.values[0].rows[0].length + k] = dataPoint; \r\n }\r\n }\r\n }\r\n dataset.push(measureData);\r\n } \r\n }\r\n else // MND on Region color or no MND\r\n {\r\n dataset = new Array(feed.values.length * feed.values[0].rows.length);\r\n\r\n for(i = 0 ; i < feed.values.length; ++i)\r\n {\r\n for(j = 0; j < feed.values[0].rows.length; ++j)\r\n { \r\n measureData = feed.values[i].rows[j];\r\n if(!hasMND || !bMNDInner){\r\n dataset[i * feed.values[0].rows.length + j] = measureData;\r\n } else {\r\n dataset[j * feed.values.length + i] = measureData;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return dataset;\r\n }", "function getPyramidData(side) {\r\n // initialise locally and globally used arrays and objects\r\n // for ALL data\r\n var nested_all_data;\r\n var nested_all_data_array = [];\r\n aleph.nested_all_data_object = {};\r\n\r\n // for MALE data\r\n var nested_male_data;\r\n var nested_male_data_array = [];\r\n aleph.nested_male_data_object = {};\r\n\r\n // for FEMALE data\r\n var nested_female_data;\r\n var nested_female_data_array = [];\r\n aleph.nested_female_data_object = {};\r\n\r\n // for all data ... filter on gender and ethnicity (more filter variables to be added later with additon of more selection lists...)\r\n var allData = aleph.data.pyramid.filter(function (d) {\r\n // if statement relates to initial (all data load and display of pyramids coming from another page, or user selection of \"All Ethnicities\" on selection list)\r\n if (\r\n aleph.pyramidCurrentScenarios[side].ethnicities.indexOf(\r\n +d[aleph.inputFieldnames.pyramid.ethnicity]\r\n ) != -1 &&\r\n aleph.pyramidCurrentScenarios[side].regions.indexOf(\r\n +d[aleph.inputFieldnames.pyramid.region]\r\n ) != -1\r\n ) {\r\n return (\r\n +d[aleph.inputFieldnames.pyramid.sex] == 1 ||\r\n +d[aleph.inputFieldnames.pyramid.sex] == 2\r\n );\r\n }\r\n }); // end filter loop\r\n\r\n // console.log(allData);\r\n\r\n var maleData = aleph.data.pyramid.filter(function (d) {\r\n // if statement relates to initial (all data load and display of pyramids coming from another page, or user selection of \"All Ethnicities\" on selection list)\r\n if (\r\n aleph.pyramidCurrentScenarios[side].ethnicities.indexOf(\r\n +d[aleph.inputFieldnames.pyramid.ethnicity]\r\n ) != -1 &&\r\n aleph.pyramidCurrentScenarios[side].regions.indexOf(\r\n +d[aleph.inputFieldnames.pyramid.region]\r\n ) != -1\r\n ) {\r\n return +d[aleph.inputFieldnames.pyramid.sex] == 1;\r\n }\r\n }); // end filter loop\r\n\r\n // console.log(maleData);\r\n\r\n var femaleData = aleph.data.pyramid.filter(function (d) {\r\n // if statement relates to initial (all data load and display of pyramids coming from another page, or user selection of \"All Ethnicities\" on selection list)\r\n if (\r\n aleph.pyramidCurrentScenarios[side].ethnicities.indexOf(\r\n +d[aleph.inputFieldnames.pyramid.ethnicity]\r\n ) != -1 &&\r\n aleph.pyramidCurrentScenarios[side].regions.indexOf(\r\n +d[aleph.inputFieldnames.pyramid.region]\r\n ) != -1\r\n ) {\r\n return +d[aleph.inputFieldnames.pyramid.sex] == 2;\r\n }\r\n }); // end filter loop\r\n\r\n // console.log(femaleData);\r\n\r\n // for each plotted year on chart ...\r\n aleph.years.forEach(function (d, i) {\r\n // locally store year value ...\r\n var year = d;\r\n\r\n // rollup nest data to count demographic per year\r\n nested_all_data = d3\r\n .nest()\r\n .key(function () {\r\n return +year;\r\n })\r\n .key(function (d) {\r\n return d.Age;\r\n })\r\n .rollup(function (leaves) {\r\n return {\r\n d: d3.sum(leaves, function (d) {\r\n return +d[year];\r\n }),\r\n };\r\n })\r\n .entries(allData);\r\n\r\n // rollup nest data to count demographic per year\r\n nested_male_data = d3\r\n .nest()\r\n .key(function () {\r\n return +year;\r\n })\r\n .key(function (d) {\r\n return d.Age;\r\n })\r\n .rollup(function (leaves) {\r\n return {\r\n d: d3.sum(leaves, function (d) {\r\n return +d[year];\r\n }),\r\n };\r\n })\r\n .entries(maleData);\r\n\r\n // rollup nest data to count demographic per year\r\n nested_female_data = d3\r\n .nest()\r\n .key(function (d) {\r\n return +year;\r\n })\r\n .key(function (d) {\r\n return d.Age;\r\n })\r\n .rollup(function (leaves) {\r\n return {\r\n d: d3.sum(leaves, function (d) {\r\n return +d[year];\r\n }),\r\n };\r\n })\r\n .entries(femaleData);\r\n\r\n //\r\n //\r\n //\r\n // ALL DATA\r\n nested_all_data_array.push({\r\n year: nested_all_data[0].key,\r\n values: nested_all_data[0].values.map(function (d, i) {\r\n return { key: d.key, value: d.value.d };\r\n }),\r\n yearGenderTotalPopulation: sumYear(nested_all_data[0].values),\r\n yearTotalPopulation: sumYear(nested_all_data[0].values),\r\n });\r\n\r\n nested_all_data_array.forEach(function (d) {\r\n var element = {\r\n values: d.values,\r\n yearGenderTotalPopulation: d.yearGenderTotalPopulation,\r\n yearTotalPopulation: d.yearTotalPopulation,\r\n };\r\n aleph.nested_all_data_object[d.year] = element;\r\n });\r\n\r\n //\r\n //\r\n //\r\n // MALE DATA\r\n nested_male_data_array.push({\r\n year: nested_male_data[0].key,\r\n values: nested_male_data[0].values.map(function (d, i) {\r\n return { key: d.key, value: d.value.d };\r\n }),\r\n yearGenderTotalPopulation: sumYear(nested_male_data[0].values),\r\n yearTotalPopulation: sumYear(nested_all_data[0].values),\r\n });\r\n\r\n nested_male_data_array.forEach(function (d, i) {\r\n var element = {\r\n values: d.values,\r\n yearGenderTotalPopulation: d.yearGenderTotalPopulation,\r\n yearTotalPopulation: d.yearTotalPopulation,\r\n };\r\n aleph.nested_male_data_object[d.year] = element;\r\n });\r\n\r\n //\r\n //\r\n //\r\n // FEMALE DATA\r\n nested_female_data_array.push({\r\n year: nested_female_data[0].key,\r\n values: nested_female_data[0].values.map(function (d, i) {\r\n return { key: d.key, value: d.value.d };\r\n }),\r\n yearGenderTotalPopulation: sumYear(nested_female_data[0].values),\r\n yearTotalPopulation: sumYear(nested_all_data[0].values),\r\n });\r\n\r\n nested_female_data_array.forEach(function (d, i) {\r\n var element = {\r\n values: d.values,\r\n yearGenderTotalPopulation: d.yearGenderTotalPopulation,\r\n yearTotalPopulation: d.yearTotalPopulation,\r\n };\r\n aleph.nested_female_data_object[d.year] = element;\r\n });\r\n }); // end forEach\r\n\r\n return;\r\n}", "function transformExperimentData() {\n let trialSelections = jsPsych.data\n .get()\n .filter({ label: 'trial' })\n .select('selection').values;\n let newData = [];\n let columnHeaders = {\n stimulus: 'trial number',\n response:\n 'trial response is whether or not the user chose the original image; 1 = correct, -1 = incorrect',\n trait: 'untrustworthy by default',\n subject:\n 'trial subject is the placement of original image; 1 = left, 2 = right',\n };\n newData.push(columnHeaders);\n for (\n let trialNumber = 0;\n trialNumber < trialSelections.length;\n trialNumber++\n ) {\n let trialResponse;\n let trialSubject;\n // If the user doesn't make a selection, we are counting it as '-1'; an untrustworthy trial.\n if (trialNumber <= NUMBER_OF_TRIALS / 2) {\n // For the first half trials, original image on left.\n trialResponse = trialSelections[trialNumber] === 'left' ? 1 : -1;\n trialSubject = 1;\n } else {\n // For the second half trials, original image on right.\n trialResponse = trialSelections[trialNumber] === 'right' ? 1 : -1;\n trialSubject = 2;\n }\n let trialRow = {\n stimulus: trialNumber + 1,\n response: trialResponse,\n trait: 'untrustworthy',\n subject: trialSubject,\n };\n newData.push(trialRow);\n }\n return newData;\n }", "function getVisData(keys, withAVG) {\n var dataTMP = [];\n //for each key\n $.each(keys, function(k ,v) {\n // for each year\n var temp = []\n $.each(rectdata, function(key, tops) {\n temp = temp.concat(tops.filter(function(t) { return t.topic == v}))\n });\n dataTMP.push(temp);\n });\n if (withAVG && dataTMP.length > 1) {\n var avgLine = []\n for (var i = 0; i < dataTMP[0].length; i++) {\n var avgPoint = {\n rank : -1,\n score : 0,\n percentage: 0,\n topic : -1,\n year : 0,\n }\n for (var j = 0; j < dataTMP.length; j++) {\n avgPoint.year = dataTMP[j][i].year;\n avgPoint.score += dataTMP[j][i].score;\n avgPoint.percentage += dataTMP[j][i].percentage;\n }\n avgPoint.score /= dataTMP.length\n avgPoint.percentage /= dataTMP.length\n avgLine.push(avgPoint);\n }\n dataTMP.push(avgLine);\n }\n return dataTMP;\n}", "function update(rawdata){\r\n dataset = rawdata;\r\n chart.selectAll(\"rect\").remove();\r\n chart.selectAll(\"text\").remove();\r\n chart.selectAll(\"axis\").remove();\r\n chart.selectAll(\"g.tick\").remove();\r\n\r\n vis.attr(\"width\", width+margin*2)\r\n .attr(\"height\", height+margin*2)\r\n .append(\"g\")\r\n .attr(\"transform\", \"translate(\" + margin + \",\" + margin + \")\");\r\n\r\n var regionalSales = [];\r\n var regionalProfit = [];\r\n var categorySales = [];\r\n var categoryProfit = [];\r\n var i = 0;\r\n\r\n for (i; i<dataset.length; i++) {\r\n var row = dataset[i];\r\n if (regionalProfit[row.region]===undefined){\r\n regionalProfit[row.region]=0;\r\n }\r\n regionalProfit[row.region]+=parseInt(row.profit);\r\n\r\n if (regionalSales[row.region]===undefined){\r\n regionalSales[row.region]=0;\r\n }\r\n regionalSales[row.region]+=parseInt(row.sales);\r\n\r\n if (categorySales[row.category]===undefined){\r\n categorySales[row.category]=0;\r\n }\r\n categorySales[row.category]+=parseInt(row.sales);\r\n\r\n if (categoryProfit[row.category]===undefined){\r\n categoryProfit[row.category]=0;\r\n }\r\n categoryProfit[row.category]+=parseInt(row.profit);\r\n }\r\n \r\n var xvar = xdropdown.value;\r\n var yvar = ydropdown.value;\r\n var chartData;\r\n\r\n if (xvar==\"Region\") {\r\n if (yvar ==\"Sales\") {\r\n chartData = regionalSales;\r\n }\r\n else {chartData = regionalProfit; }\r\n }\r\n\r\n if (xvar == \"Category\") {\r\n if (yvar == \"Sales\") {\r\n chartData = categorySales;\r\n }\r\n else { chartData = categoryProfit; }\r\n }\r\n\r\n var arr = [];\r\n for (var key in chartData) {\r\n if (chartData.hasOwnProperty(key)) {\r\n var obj = new Object();\r\n obj.xval = key;\r\n obj.yval = chartData[key];\r\n arr.push(obj); \r\n }\r\n }\r\n\r\n x.domain(arr.map(function(d){return d.xval}));\r\n y.domain([0, d3.max(arr, function(d){return d.yval;})]);\r\n var r = d3.scale.category10().range();\r\n var color = d3.scale.ordinal().range(r);\r\n console.log(color);\r\n var barWidth = width/arr.length;\r\n\r\n vis.attr(\"transform\", \"translate(5,0)\");\r\n\r\n vis.append(\"g\")\r\n .attr(\"class\", \"x axis\")\r\n .attr(\"transform\", \"translate(0,\" + height + \")\")\r\n .call(xAxis)\r\n .append(\"text\")\r\n .attr(\"dx\", \"1em\") \r\n .attr(\"y\", 35)\r\n .attr(\"x\", 150)\r\n .attr(\"font-weight\", \"bold\")\r\n .text(xvar); \r\n\r\n vis.append(\"g\")\r\n .attr(\"class\", \"y axis\")\r\n .attr(\"transform\", \"translate(360,0)\")\r\n .call(yAxis)\r\n .append(\"text\")\r\n .attr(\"transform\", \"rotate(-90)\")\r\n .attr(\"y\", 55)\r\n .attr(\"x\", -120)\r\n .attr(\"dy\", \"1em\")\r\n .attr(\"font-weight\", \"bold\")\r\n .style(\"text-anchor\", \"end\")\r\n .text(yvar);\r\n\r\n vis.selectAll(\".bar\")\r\n .data(arr)\r\n .enter().append(\"rect\")\r\n .attr(\"class\", \"bar\")\r\n .style('fill', color)\r\n .attr(\"x\", function(d) { return x(d.xval); })\r\n .attr(\"y\", function(d) { return y(d.yval); })\r\n .attr(\"height\", function(d) { return height - y(d.yval); })\r\n .attr(\"width\", x.rangeBand());\r\n}", "function getDataCurves(data) {\n var id = $rootScope.GlobalData.config.tempmessurement;\n for(i = 0; i <= data.temperature.length; i++){\n angular.forEach(data.temperature[i], function(value, key){\n if(key == 1){\n data.temperature[i][key] = $rootScope.calcunits(13, id, value)\n }\n })\n }\n var data_temperature = data.temperature;\n var position = 'right';\n\n vmCurves.flotMultiOptions = {\n xaxis:\n {\n show: true,\n mode:\"time\",\n ticks: 5,\n timezone: 'browser',\n timeformat: '%H:%M'\n },\n yaxes: [\n {\n alignTicksWithAxis: 1,\n show: true,\n position: position,\n min: 0\n },\n {\n min: 0,\n }\n ],\n legend: {\n show:true,\n container: '#chartFeeder',\n placement: 'outsideGrid'\n },\n colors: [\"#1ab394\"],\n grid: {\n hoverable: true\n },\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n x = new Date(xval);\n shortTime = x.getHours() + ':' + x.getMinutes();\n return shortTime + ' | ' + yval + ' ' + label;\n },\n onHover: function (flotItem, $tooltipEl) {\n }\n }\n };\n\n var tempEinheit = vmCurves.tempEinheit == 1 ? '11' : '13';\n vmCurves.flotMultiData = [\n {\n label: $rootScope.getEinheiten($rootScope.GlobalData.config.tempmessurement),\n data: data_temperature,\n lines: {\n show:true,\n lineWidth: '3'\n },\n points: {\n show: true,\n },\n color: 'red',\n yaxis: 2,\n }\n ];\n\n //Feeding\n if (data.amount) {\n $scope.leftYLabel = $rootScope.getLabel('amount');\n $scope.amountLabel = $rootScope.getEinheiten($rootScope.GlobalData.einheiten['1']);\n\n vmCurves.flotMultiData.push({\n label: $rootScope.getEinheiten($rootScope.GlobalData.einheiten['1']),\n bars: {\n show:true,\n barWidth: 24,\n fill: true,\n fillColor: {\n colors: [\n {\n opacity: 0.8\n },\n {\n opacity: 0.8\n }\n ]\n }\n },\n yaxis: 1,\n data: data.amount\n });\n }\n //Process\n if (data.pressure) {\n $scope.leftYLabel = $rootScope.getLabel('pressure'),\n $scope.amountLabel = $rootScope.getLabel('bar');\n vmCurves.flotMultiData.push({\n label:$rootScope.getLabel('bar'),\n data: data.pressure,\n lines: {\n show: true,\n lineWidth: '3',\n },\n points: {\n show: true\n },\n yaxis: 1\n });\n }\n\n }", "function data_elaboration_to_display_scutterplot_pca(start_data){\n var output_data = [];\n for(i=0; i<start_data.length; i++){\n var total = (start_data[i]['Air Cancer'] + \n start_data[i]['Chronic Respiratory Diseases'] +\n start_data[i]['Pneumoconiosis']+\n start_data[i]['Asthma']+\n start_data[i]['Interstitial Lung Disease and Pulmonary Sarcoidosis']+\n start_data[i]['Other Chronic Respiratory Diseases']) /\n start_data[i]['Total Deaths']\n output_data.push(\n {\n \"Country\" : start_data[i]['Country'],\n \"Y1\" : start_data[i]['PCA first component'],\n \"Y2\" : start_data[i]['PCA second component'],\n \"Death Percentage\" : total\n }\n )\n }\n return output_data;\n}", "function drawVisualization() {\r\n var style = \"bar-color\";//document.getElementById(\"style\").value;\r\n var showPerspective = true;//document.getElementById(\"perspective\").checked;\r\n // var withValue = [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\r\n\r\n // Create and populate a data table.\r\n data = [];\r\n\r\n var color = 0;\r\n var steps = 3; // number of datapoints will be steps*steps\r\n var axisMax = 8;\r\n var axisStep = axisMax / steps;\r\n for (var x = 0; x <= axisMax; x += axisStep+1) {\r\n for (var y = 0; y <= axisMax; y += axisStep) {\r\n var z = Math.random();\r\n if (true) {\r\n data.push({\r\n x: x,\r\n y: y,\r\n z: z,\r\n style: {\r\n fill: colors[color],\r\n stroke: colors[color+1]\r\n }\r\n });\r\n }\r\n else {\r\n data.push({ x: x, y: y, z: z });\r\n }\r\n }\r\n color+=1;\r\n }\r\n\r\nvar category = [\"A\",\"B\",\"C\",\"D\"];\r\nvar cat_count = 0;\r\n // specify options\r\n var options = {\r\n width:'100%',\r\n style: style,\r\n xBarWidth: 2,\r\n yBarWidth: 2,\r\n showPerspective: showPerspective,\r\n showShadow: false,\r\n keepAspectRatio: true,\r\n verticalRatio: 0.5,\r\n xCenter:'55%',\r\n yStep:2.5,\r\n xStep:3.5,\r\n animationAutoStart:true,\r\n animationPreload:true,\r\n showShadow:true,\r\n \r\n yLabel: \"Categories (of Abuse)\",\r\n xLabel: \"Groups\",\r\n zLabel: \"Reports\",\r\n yValueLabel: function (y) {\r\n if(y == 0){\r\n return \"Category \" + category[y];\r\n }else{\r\n return \"Category \" +category[Math.ceil(y/3)];\r\n }\r\n },\r\n \r\n xValueLabel: function(x) {\r\n if(x == 0){\r\n return \"Group 1\";\r\n }else{\r\n return \"Group \" + (Math.ceil(x/3));\r\n }\r\n },\r\n tooltip: function(data){\r\n var res = \"\";\r\n if(data.x == 0){\r\n res += \"<strong>Group 1</strong>\";\r\n }else{\r\n res += \"<strong>Group</strong> \" + (Math.ceil(data.x/3));\r\n }\r\n\r\n if(data.y == 0){\r\n res+= \"<br><strong>Category</strong> \" + category[data.y];\r\n }else{\r\n res+= \"<br><strong>Category</strong> \" +category[Math.ceil(data.y/3)];\r\n }\r\n\r\n res+= \"<br><strong>Reports</strong> \" + data.z;\r\n return res;\r\n }\r\n };\r\n\r\n\r\n var camera = graph ? graph.getCameraPosition() : null;\r\n\r\n // create our graph\r\n var container = document.getElementById(\"mygraph\");\r\n graph = new vis.Graph3d(container, data, options);\r\n\r\n if (camera) graph.setCameraPosition(camera); // restore camera position\r\n/*\r\n document.getElementById(\"style\").onchange = drawVisualization;\r\n document.getElementById(\"perspective\").onchange = drawVisualization;\r\n document.getElementById(\"xBarWidth\").onchange = drawVisualization;\r\n document.getElementById(\"yBarWidth\").onchange = drawVisualization;*/\r\n}", "function ready(error, data) {\n if (error) throw error;\n\n var margin = 20\n\n xScale.domain([d3.min(data, xValue)-margin, d3.max(data, xValue)+margin]);\n yScale.domain([d3.min(data, yValue)-margin, d3.max(data, yValue)+margin]);\n\n\n // draw dots\n svg.selectAll(\".dot\")\n .data(data)\n .enter().append(\"circle\")\n .attr(\"class\", \"dot\")\n //.attr(\"r\", pointSize)\n .attr(\"r\", function(d) { return topCandidates.includes(d.label) ? pointSize*2.5 : pointSize; })\n .attr(\"cx\", xMap)\n .attr(\"cy\", yMap)\n .style(\"fill\", colorManager)\n .on(\"mouseover\", function(d) {\n tooltip.transition()\n .duration(200)\n .style(\"opacity\", .9);\n tooltip.html(d.name + \"<br/>\" + d.party)\n .style(\"left\", (d3.event.pageX + 5) + \"px\")\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\n })\n .on(\"mouseout\", function(d) {\n tooltip.transition()\n .duration(500)\n .style(\"opacity\", 0);\n })\n .on(\"click\", function(d) {\n showDetails(d);\n });\n\n}", "function scatterData (data, xaxis)\t{\n\t\tvar result = [];\n\n\t\tbio.iteration.loop(data, function (d)\t{\n\t\t\tbio.iteration.loop(d, function (key, value)\t{\n\t\t\t\tif (xaxis.indexOf(key) > -1)\t{\n\t\t\t\t\tresult.push({ x: key, y: value.months, value: value.status });\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn result;\n\t}", "function processData(data) {\n mapData = data[0]\n incidence = data[1];\n mortality = data[2]\n for (var i = 0; i < mapData.features.length; i++) {\n mapData.features[i].properties.incidenceRates = incidence[mapData.features[i].properties.adm0_a3];\n mapData.features[i].properties.mortalityRates = mortality[mapData.features[i].properties.adm0_a3];\n }\n drawMap()\n}", "function setupData() {\n $scope.assessmentOverallPerformance = {};\n $scope.assessmentOverallMatrix = \"\";\n $scope.userOrderList = \"\";\n\n GroupStatisticsFactory.getAssessmentOverallPerformance($scope.selectedAssessment).then(\n function(performanceBySubject) {\n // Este forEach() preenche completamente o $scope.assessmentOverallPerformance\n performanceBySubject.forEach(\n function(user, userIndex, userArray) {\n var listBySubject = user.listBySubject;\n $scope.assessmentOverallPerformance[user.username] = [];\n for (var i = 0; i < listBySubject.length; i++) {\n if (listBySubject[i].subject !== \"Espanhol\") {\n questionList = listBySubject[i].questionList;\n for (var j = 0; j < questionList.length; j++)\n questionList[j] = {\n questionNumber: questionList[j].questionNumber,\n isUserRight: questionList[j].userAnswer === questionList[j].correctAnswer ? 1 : 0\n };\n $scope.assessmentOverallPerformance[user.username] = $scope.assessmentOverallPerformance[user.username].concat(questionList);\n }\n }\n $scope.assessmentOverallPerformance[user.username].sort(function(a, b) {\n if (a.questionNumber < b.questionNumber)\n return -1;\n return +1;\n });\n }\n );\n // Agora preenchemos a matriz numérica, para o Octave, e a lista da ordem de usuários (para saber o que é cada linha da matriz)\n for (username in $scope.assessmentOverallPerformance) {\n $scope.userOrderList += username + \"\\n\";\n for (var i = 0; i < $scope.assessmentOverallPerformance[username].length; i++)\n $scope.assessmentOverallMatrix += $scope.assessmentOverallPerformance[username][i].isUserRight + \" \";\n $scope.assessmentOverallMatrix += \";\\n\";\n }\n }\n );\n }", "function curveData() {\n //console.log(\"curveData\");\n for (var i = 0; i < linesData.length; i++) { \n //console.log(\"Target imf \",linesData[i].partnercountrycode);\n var targetCounty=dataset.filter(function(el){\n return el.imfcode==linesData[i].partnercountrycode;\n });\n //console.log(\"Target \",targetCounty);\n linesData[i].lon=targetCounty[0].lon;\n linesData[i].lat=targetCounty[0].lat;\n //console.log(\"linesdata\",linesData[i])\n }\n linesData=linesData.slice(1, numTrades+1);\n //console.log(linesData)\n }", "function makePlotly(penPos, penNeg, strPos, strNeg, neoPos, neoNeg) {\n var plotDiv = document.getElementById(\"plot\");\n var dataNames = ['Pencilin Positive', 'Penicilin Negative', 'Streptomycin Positive', 'Streptomycin Negative', 'Neomycin Positive', 'Neomycin Negative'];\n var dataValues = [penPos, penNeg, strPos, strNeg, neoPos, neoNeg];\n var data = [];\n // iterating thru dataNames and dataValues to plot each marker with correlated information\n for (var i = 0; i < dataNames.length; i++) {\n var plot = {\n name: dataNames[i],\n y: dataValues[i],\n mode: 'markers',\n type: 'box',\n boxpoints: 'all', \n };\n data.push(plot);\n }\n\n // the layout of the box chart graph \n var layout = {\n xaxis: {\n title: 'Gram Stain'\n },\n yaxis: {\n title: 'MIC Level (log-transformed)',\n },\n hovermode: 'closest'\n };\n\n // plotting the Plotly graph\n Plotly.newPlot('graph2', data, layout, {staticPlot: true});\n\n}", "function chart(data, d3) {\n \n // DECLARE CONTAINERS\n var lists = {\n population: [],\n emission: [],\n capita: []\n }\n\n // FETCH THE YEARS FOR TOOLTIPS\n var years = Object.keys(data.overview);\n\n // LOOP THROUGH & FILL THE LISTS\n years.forEach(year => {\n lists.population.push(data.overview[year].population);\n lists.emission.push(data.overview[year].emission);\n lists.capita.push(data.overview[year].emission / data.overview[year].population);\n });\n\n // CONVERT ARRAY DATA TO CHARTS\n generate_charts(lists, years, d3);\n}", "function loadData(data) {\n data.forEach(convertData);\n\n // Initially setup the domains\n x.domain(d3.extent(data.map(function(d) { return d.ticker.now; })));\n var maximum = d3.max(data.map(function(d) { return d.ticker.avg.value; })),\n minimum = d3.min(data.map(function (d) { return d.ticker.avg.value; }));\n y.domain([minimum - 10, maximum + 10]);\n x2.domain(x.domain());\n y2.domain(y.domain());\n\n // Set up the graph components\n path1 = focus.append(\"path\")\n .attr(\"clip-path\", \"url(#clip)\");\n\n gx1 = focus.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(xAxis);\n\n gy1 = focus.append(\"g\")\n .attr(\"class\", \"y axis\");\n\n path2 = context.append(\"path\");\n\n gx2 = context.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,\" + height2 + \")\");\n\n gy2 = context.append(\"g\")\n .attr(\"class\", \"x brush\")\n .call(brush)\n .selectAll(\"rect\")\n .attr(\"y\", -6)\n .attr(\"height\", height2 + 7);\n\n // Add label\n focus.append(\"text\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 6)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .text(\"Price\");\n\n // Add tooltip\n tooltip = d3.select('body').append('div')\n .attr('class', 'tooltip')\n .style('opacity', 0);\n}", "function convertoChart(data){\n\t\t\t\n\t\t\treturn data.Rows.map(function(item, index){\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.Value,\n\t\t\t\t\tattribute: labels[index]\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t\n\t\t}", "function display_results(val){\n\n var i,data,metadata,tmp;\n var n=val.component_vectors[0].length;\n if (n>10) n=10;\n \n //principal components\n data=[];\n for (i=0;i<val.component_vectors.length;i++){\n tmp=val.component_vectors[i].slice(0,n);\n tmp.unshift(val.times[i]);\n data.push({values: tmp});\n }\n eg_pc.load({data: data});\n eg_pc.renderGrid(\"tablecontent_pc\", \"table table-hover\");\n \n //loadings\n metadata=[ {name:'desc', label:'Description', datatype:'string', editable:'false'},\n {name:'expl', label:'Expl. Power', datatype:'double(%,2)', editable:'false'} ];\n \n for (i=0;i<val.headers.length;i++){\n tmp={name:val.headers[i], label:val.headers[i], datatype:'double(%,4)', editable:'true'}\n metadata.push(tmp);\n }\n data=[];\n for (i=0;i<n;i++){\n tmp=val.loadings[i].slice();\n tmp.unshift(val.rel_variances[i]*100);\n tmp.unshift(\"Comp \" + (i+1));\n data.push({values: tmp});\n } \n eg_loadings.load({data: data, metadata:metadata});\n eg_loadings.renderGrid(\"tablecontent_loadings\", \"table table-hover\");\n \n //scenarios\n //data for editable grid\n metadata=[ {name:'desc', label:'Description', datatype:'string', editable:'false'} ];\n \n //data for papa parse (export functionality)\n fields=[ \"Description\" ];\n var export_data=[];\n \n for (i=0;i<val.headers.length;i++){\n tmp={name:val.headers[i], label:val.headers[i], datatype:'double(%,4)', editable:'true'}\n metadata.push(tmp);\n fields.push(val.headers[i]);\n }\n data=[];\n\n var lab;\n for (i=0;i<val.scenarios.length;i++){\n tmp=val.scenarios[i].slice();\n lab=((i % 2) != 0) ? \"Comp \" + ((i+1)/2) + \" down\" : \"Comp \" + (i/2+1) + \" up\"\n tmp.unshift(lab);\n data.push({values: tmp});\n export_data.push(tmp);\n } \n eg_scenarios.load({data: data,metadata:metadata});\n eg_scenarios.renderGrid(\"tablecontent_scenarios\", \"table table-hover\");\n\n // make data available for export function, Papa.unparse needs object with entries \"data\" and \"fields\"\n g_scenarios= {data: export_data,fields:fields};\n\n update_chart(val);\n}", "function graphData(data) {\n console.log(\"render graphs\");\n _.take(data,10).forEach(function (o) {\n //data.forEach(function (o) {\n var dataRecord = {\n \"c\": o.test,\n \"v\": o.april,\n };\n\n\n // console.log(dataRecord);\n transformedDataFiltered.push(dataRecord);\n });\n}", "function loadData() {\n\t\t// Show dots while data is crunched\n\t\t$('#dots').show();\n\t\t$(\"svg\").remove();\n\t\tvar surveyData = [];\n\t\td3.csv(\"assets/data/\"+params.question+\".csv\", function(d,i,columns) {\n\t\t\tfor (var i = 7, n = columns.length; i < n; ++i) d[columns[i]] = +d[columns[i]];\n\t\t \treturn d;\n\t\t}).then(function(data) {\n\n\t\t\t// special scenario for q12\n\t\t\tif (params.question == \"q12\") {\n\n\t\t\t\t// check if any filtering is applied\n\t\t\t\tif (params.filter != \"None\" && params.filterOption != undefined) {\n\t\t\t\t\tif (params.filter == \"Users\") {\n\t\t\t\t\t\tparams.filterName = \"Facebook Users and Non-users\";\n\t\t\t\t\t}\n\t\t\t\t\tfilteredData = data.filter(function(d) { return d[params.filterName] == params.filterOption });\n\t\t\t\t\tfilteredData.columns = data.columns;\n\t\t\t\t\tdata = filteredData;\n\t\t\t\t}\n\n\t\t\t\t// check if any compare filter is selected\n\t\t\t\tif (params.compare == \"None\") {\n\n\t\t\t\t\t// aggregate data\n\t\t\t\t\tvar nestedData = d3.nest()\n\t\t\t\t\t\t.key(function(d) {return d[\"Question\"];})\n\t\t\t\t\t\t.key(function(d) {return d[\"Answer\"];})\n\t\t\t\t\t\t.sortKeys(d3.ascending)\n\t\t\t\t\t\t.rollup(function(v) {return d3.sum(v,function(d) {return d.Total})})\n\t\t\t\t\t\t.entries(data)\n\t\t\t\t\tsurveyData.columns = [];\n\n\t\t\t\t\t// construct the data array to pass along to the chart\n\t\t\t\t\tfor(var i=0;i<nestedData.length;i++) {\n\t\t\t\t\t\tsurveyData[i] = {};\n\t\t\t\t\t\tsurveyData[i].Answer=nestedData[i].key;\n\t\t\t\t\t\tsurveyData[i].Value=nestedData[i].values[1].value / (nestedData[i].values[1].value + nestedData[i].values[0].value)\n\t\t\t\t\t\tsurveyData.columns.push(nestedData[i].key);\n\t\t\t\t\t}\n\t\t\t\t\tsurveyData.type=\"single\";\n\n\t\t\t\t\t// draw the plot and add the table output\n\t\t\t\t\tdrawPlot(surveyData);\n\t\t\t\t\tappendTable(surveyData); \n\n\t\t\t\t} else if (params.compare != \"None\") {\n\n\t\t\t\t\t// aggregate data including the compare filter selection\n\t\t\t\t\tvar nestedData = d3.nest()\n\t\t\t\t\t\t.key(function(d) {return d[\"Question\"];})\n\t\t\t\t\t\t.key(function(d) { return d[\"Answer\"];})\n\t\t\t\t\t\t.key(function(d) { return d[params.compare];})\n\t\t\t\t\t\t.sortKeys(d3.ascending)\n\t\t\t\t\t\t.rollup(function(v) { return d3.sum(v,function(d) {return d.Total});})\n\t\t\t\t\t\t.entries(data);\n\n\t\t\t\t\t// construct the data array to pass along to the chart\n\t\t\t\t\tfor(var i=0;i<nestedData.length;i++) {\n\t\t\t\t\t\tsurveyData[i] = {};\n\t\t\t\t\t\tsurveyData[i][\"Answer\"]=nestedData[i].key;\n\t\t\t\t\t\tfor(var j=0;j<nestedData[0].values[1].values.length;j++) {\n\t\t\t\t\t\t\tsurveyData[i][nestedData[i].values[1].values[j].key] = nestedData[i].values[1].values[j].value/(nestedData[i].values[1].values[j].value+nestedData[i].values[0].values[j].value);\t\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\n\t\t\t\t\t\n\t\t\t\t\tsurveyData.columns = Object.keys(surveyData[0]);\n\t\t\t\t\tsurveyData.columns.splice(0, 1);\n\t\t\t\t\tsurveyData.type=\"grouped\";\n\t\t\t\t\t\n\t\t\t\t\t// draw the plot and add the table output\n\t\t\t\t\tdrawPlot(surveyData);\n\t\t\t\t\tappendTable(surveyData);\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif (params.compare == \"None\") {\n\n\t\t\t\t\t// check if any filtering is applied\n\t\t\t\t\tif (params.filter != \"None\" && params.filterOption != undefined) {\n\t\t\t\t\t\tif (params.filter == \"Users\") {\n\t\t\t\t\t\t\tparams.filterName = \"Facebook Users and Non-users\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfilteredData = data.filter(function(d) { return d[params.filterName] == params.filterOption });\n\t\t\t\t\t\tfilteredData.columns = data.columns;\n\t\t\t\t\t\tdata = filteredData;\n\t\t\t\t\t}\n\n\t\t\t\t\t// prepopulate the final array\n\t\t\t\t\tvar answerKeys = data.columns.slice(6);\n\t\t\t\t\t\tfor(var i=0;i<answerKeys.length;i++) {\n\t\t\t\t\t\t\tsurveyData[answerKeys[i]] = 0;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t// aggregate data including the compare filter selection\n\t\t\t\t\tvar nestedData = d3.nest()\n\t\t\t\t\t\t.key(function(d) { return d[\"Answer\"];})\n\t\t\t\t\t\t.rollup(function(v) { return d3.sum(v,function(d) {return d.Total});})\n\t\t\t\t\t\t.entries(data);\n\n\t\t\t\t\tvar total = 0;\n\t\t\t\t\tnestedData.forEach(function(d) {\n\t\t\t\t\t\ttotal += d.value;\n\t\t\t\t\t});\n\n\t\t\t\t\t// populate the final array\n\t\t\t\t\tsurveyData.columns = [];\n\t\t\t\t\tfor(var i=0;i<nestedData.length;i++) {\n\t\t\t\t\t\tsurveyData[i] = {};\n\t\t\t\t\t\tsurveyData[i].Answer = nestedData[i].key;\n\t\t\t\t\t\tsurveyData[i].Value = nestedData[i].value/total;\n\t\t\t\t\t\tsurveyData.columns.push(nestedData[i].key);\n\t\t\t\t\t};\n\t\t\t\t\tsurveyData.type=\"single\";\n\n\t\t\t\t\t// draw chart and append data table\n\t\t\t\t\tdrawPlot(surveyData);\n\t\t\t\t\tappendTable(surveyData);\n\n\t\t\t\t} else if (params.compare != \"None\") {\n\n\t\t\t\t\t// check if any filtering is applied\n\t\t\t\t\tif (params.filter != \"None\" && params.filterOption != undefined) {\n\t\t\t\t\t\tif (params.filter == \"Users\") {\n\t\t\t\t\t\t\tparams.filterName = \"Facebook Users and Non-users\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfilteredData = data.filter(function(d) {return d[params.filterName] == params.filterOption});\n\t\t\t\t\t\tfilteredData.columns = data.columns;\n\t\t\t\t\t\tdata = filteredData;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// identify answer keys for the question\n\t\t\t\t\tvar answerKeys = data.columns.slice(6);\n\n\t\t\t\t\t// calculate totals to be used in the calculation for the final array\n\t\t\t\t\tvar totalCounts = d3.nest()\n\t\t\t\t\t\t.key(function(d) { return d[params.compare];})\n\t\t\t\t\t\t.sortKeys(d3.ascending)\n\t\t\t\t\t\t.rollup(function(v) { return d3.sum(v, function(d) {return d.Total});})\n\t\t\t\t\t\t.entries(data);\n\n\t\t\t\t\t// check if enough data exists\n\t\t\t\t\tvar valid = 1;\n\t\t\t\t\ttotalCounts.forEach(function(count) {\n\t\t\t\t\t\tif (count.value < 50) {\n\t\t\t\t\t\t\tvalid = 0;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t});\n\t\t\t\t\tif (valid == 0) {\n\t\t\t\t\t\tsampleError();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// aggregate data\n\t\t\t\t\tvar nestedData = d3.nest()\n\t\t\t\t\t\t.key(function(d) { return d[\"Answer\"];})\n\t\t\t\t\t\t.key(function(d) { return d[params.compare];})\n\t\t\t\t\t\t.sortKeys(d3.ascending)\n\t\t\t\t\t\t.rollup(function(v) { return d3.sum(v,function(d) {return d.Total});})\n\t\t\t\t\t\t.entries(data);\n\n\t\t\t\t\t// populate the final array to pass along to the chart\n\t\t\t\t\tfor(var i=0;i<nestedData.length;i++) {\n\t\t\t\t\t\tsurveyData[i] = {};\n\t\t\t\t\t\tsurveyData[i][\"Answer\"]=nestedData[i].key;\n\t\t\t\t\t\tfor(var j=0;j<nestedData[0].values.length;j++) {\n\t\t\t\t\t\t\tsurveyData[i][nestedData[i].values[j].key] = nestedData[i].values[j].value/totalCounts[j].value;\t\n\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//add columns\n\t\t\t\t\tsurveyData.columns = Object.keys(surveyData[0]);\n\t\t\t\t\tsurveyData.columns.splice(0, 1);\n\t\t\t\t\tsurveyData.type=\"grouped\";\n\n\t\t\t\t\t// draw chart and append data table\n\t\t\t\t\tdrawPlot(surveyData);\n\t\t\t\t\tappendTable(surveyData);\n\n\t\t\t\t}\t \t\t\t\t\t\t\n\t\t\t}\n\n\t\t});\n\t}", "function plot_time_per_epoch_in_div(canvas_id, esb_type, esb_size) {\n var net_arch = inputObject.network_archeticture;\n var dataset = inputObject.dataset;\n\n // Get the index of columns we are going to display\n var indexes = get_indexes();\n\n var types = [];\n if (inputObject.horizontal.length > 0) {\n types.push(\"horizontal\");\n }\n if (inputObject.vertical.length) {\n types.push(\"vertical\");\n }\n\n // Plot\n t = [net_arch, dataset, esb_type, esb_size];\n json_filename = 'data/time_per_epoch_barchart/' + t.join('_') + '.json';\n var ret = readTextFile(json_filename);\n var json = JSON.parse(ret);\n var x_values = json.x_values;\n var sgl_train_time = json.sgl_train_time;\n var sgl_data_time = json.sgl_data_time;\n var esb_train_time = json.esb_train_time;\n var esb_data_time = json.esb_data_time;\n\n var x_values_t = [];\n for (let i of indexes) {\n x_values_t.push(x_values[i]);\n }\n var sgl_train_time_t = [];\n for (let i of indexes) {\n // sgl_train_time_t.push(-sgl_train_time[i]);\n sgl_train_time_t.push(sgl_train_time[i]);\n }\n var sgl_data_time_t = [];\n for (let i of indexes) {\n // sgl_data_time_t.push(-sgl_data_time[i]);\n sgl_data_time_t.push(sgl_data_time[i]);\n }\n var esb_data_time_t = [];\n for (let i of indexes) {\n esb_data_time_t.push(esb_data_time[i]);\n }\n var esb_train_time_t = [];\n var new_line;\n for (let line of esb_train_time) {\n new_line = [];\n for (let i of indexes) {\n new_line.push(line[i]);\n }\n esb_train_time_t.push(new_line);\n }\n\n var data = [];\n // training time of single network\n var trace1 = {\n x: x_values_t,\n y: sgl_train_time_t,\n name: 'single<br>network<br>training',\n type: 'bar',\n opacity: 0.5,\n marker: {\n color: 'rgb(254,224,210)',\n line: {\n width: 1.5\n }\n },\n };\n // data loading of single network\n var trace2 = {\n x: x_values_t,\n y: sgl_data_time_t,\n name: 'data<br>loading',\n type: 'bar',\n opacity: 0.5,\n marker: {\n color: 'rgb(252,146,114)',\n line: {\n width: 1.5\n }\n },\n };\n data.push(trace2, trace1);\n\n // Color dic for ensemble chart\n console.log(esb_size);\n var color_dic;\n if (esb_size == 4){\n color_dic = color_dic_esb_4;\n } else if (esb_size == 6){\n color_dic = color_dic_esb_6;\n } else if (esb_size == 8){\n color_dic = color_dic_esb_8;\n }\n console.log('color dic: ', color_dic);\n\n var trace;\n // data loading time of ensemble network\n trace = {\n x: x_values_t,\n y: esb_data_time_t,\n name: 'data<br>loading',\n type: 'bar',\n opacity: 0.5,\n marker: {\n color: color_dic[0],\n line: {\n width: 1.5\n }\n },\n xaxis: 'x2',\n yaxis: 'y2',\n };\n data.push(trace);\n\n // training time of each subnet of ensemble\n for (var i = 0; i < esb_size; i++) {\n trace = {\n x: x_values_t,\n y: esb_train_time_t[i],\n name: 'network ' + i + '<br>training',\n type: 'bar',\n opacity: 0.5,\n marker: {\n color: color_dic[i+1],\n line: {\n width: 1.5\n }\n },\n xaxis: 'x2',\n yaxis: 'y2',\n };\n data.push(trace);\n }\n var layout = {\n title: 'Comparing Time Per Epoch',\n barmode: 'stack',\n // barmode: 'relative',\n xaxis: {\n title: 'Width factor|Depth|Parameters (M)',\n type: 'category',\n tickangle: 45,\n automargin: true,\n },\n yaxis: {\n title: 'Time (s)',\n domain: [0, 0.48],\n },\n\n xaxis2: {\n visible: false,\n anchor: 'y2',\n },\n yaxis2: {\n domain: [0.52, 1],\n }\n };\n Plotly.newPlot(canvas_id, data, layout);\n}", "function get_floor_values(current_instance) {\n var xValues = [], pu_values = [];\n var current_profile = Object.values(current_instance);\n var floors = Object.keys(current_instance);\n for(var j = 0; j < current_profile.length; j++) {\n var current_floor = Object.values(current_profile[j]);\n var half_floors = Object.keys(current_profile[j]);\n for(var k = 0; k < current_floor.length; k++) {\n var current_half_floor = Object.values(current_floor[k]);\n var current_xLabel = [], current_pu_values = [];\n\n function add(a, b) {\n return a + b;\n }\n for (var i = 0; i < current_half_floor.length; i++) {\n var current_floor_pu_values;\n if(i == 0) {\n (Object.values(current_half_floor[i].CTRL)).forEach(function(val) {\n current_xLabel.push(val);\n });\n (Object.values(current_half_floor[i].DATA)).forEach(function(val) {\n current_xLabel.push(val);\n });\n }\n else if(i == 1) {\n (Object.values(current_half_floor[i])).forEach(function(val) {\n current_xLabel.push(val);\n });\n }\n else {\n current_floor_pu_values = Object.values(current_half_floor[i]);\n var sum = (current_floor_pu_values).reduce(add, 0);\n var avg = sum/current_floor_pu_values.length;\n current_xLabel.push(avg);\n current_pu_values.push(current_floor_pu_values);\n }\n \n }\n pu_values.push(current_pu_values);\n xValues.push(current_xLabel);\n }\n }\n return [xValues, pu_values];\n }", "function getAnalysis (xAxis, yAxis) {\n\n // clear previous Data Analysis section\n refreshExistElemt(articleGroup);\n\n // create new article Group\n articleGroup = d3.select(\".article\").append(\"span\");\n \n // reformat axes names\n xAxis = xAxis.charAt(0).toUpperCase() + \n xAxis.slice(1);\n\n yAxis = yAxis.charAt(0).toUpperCase() + \n yAxis.slice(1);\n\n // make title\n analysisTitle = articleGroup\n .append(\"h1\")\n .classed(\"aTitle\", true)\n .text(`${xAxis} vs. ${yAxis}: `)\n .append(\"hr\");\n \n // pull analysis from object and parse onto article area\n currSelect = xAxis.concat(yAxis.charAt(0).toUpperCase() + \n yAxis.slice(1));\n\n analysisContent = articleGroup\n .append(\"p\")\n .classed(\"aContent\", true)\n .html(analysisMaster[currSelect]);\n}", "function convertDataToDataset(data) {\n var dataset = [];\n for (var i = 0; i < data.pressure.length; i++) {\n dataset[i] = {\n label: 'pressure' + i,\n data: data.pressure[i],\n borderColor: borderColors[i],\n fill: false\n };\n }\n return dataset;\n}", "function DataTournageArdt(data) {\n\tvar result = Object.keys(data.result).map(function(key) { \n\t\t\t\t\treturn [data.result[key],(key)]; });\n\t\tvar tabTemp = result.sort(compareNombres);\n\t\t\n\t\tfor (var i = 0; i < tabTemp.length; i++) {\n\t\t\tdataTournageArdt.push({\n\t\t\t\ty : tabTemp[i][0],\n\t\t\t\tlabel : tabTemp[i][1]\n\t\t\t});\n\t\t}\n\t}", "function formatData(X,Y) {\n\t \n\t if (X == null) {\n\t\t return '';\n\t }\n\t \n\t var str = '';\n\t var Xt = math.transpose(X);\n\t //var Y = mlData.Y;\n\t \n\t var numFeatures = getNumFeatures()[0]; //(Xt.size()[1] - 1) / mlParams.degrees;\n\t\n\t \n\t var row = [];\n\t \n\t Xt.forEach(function(el,ind) {\n\t\t \n\t\t var i = ind[0]; //row num\n\t\t \n\t\t if (ind[1] == 0) {//first element in row\n\t\t row = [el];\n\t\t }\n\t\t else {\n\t\t\t row.push(el);\n\t\t }\n\t\t \n\t\t \n\t\t if (ind[1] == Xt.size()[1] -1) { //last element in row\n\t\t\t \n\t\t \n\t\t \n\t\t// for (var i = 0;i < Xt.size()[0];++i) {\n\t\t//\t var row = mRow(Xt,i,true); //seemed quite slow!!\n\t\t\t \n\t\t\t \n\t\t\t var firstDegree = true;\n\t\t\t row = row.map(function(el,j) {\n\t\t\t\t if (j == 0) {\n\t\t\t\t\t el = '[' + el + ']';\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t\t\t if ((j - 1) % numFeatures == 0) {\n\t\t\t\t\t\t if (!firstDegree) {\n\t\t\t\t\t\t el = '[' + el;\n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t if (j % numFeatures == 0) {\n\t\t\t\t\t\t if (!firstDegree) {\n\t\t\t\t\t\t\tel = el + ']';\n\t\t\t\t\t\t }\n\t\t\t\t\t\t firstDegree = false;\n\t\t\t\t\t }\n\t\t\t\t \n\t\t\t\t }\n\t\t\t\t return el;\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t });\n\t\t\t //row.push(Y.get([i]));\n\t\t\t var ySeparator = '=>';\n\n\t\t\t if (Y) {\n\n\t\t\t\t row.push(ySeparator);\n\n\t\t\t\t if (mlParams.module == 'neu') {\n\n\t\t\t\t\t var yColumn = mCol(Y, i, true);\n\t\t\t\t\t if (yColumn.length == 1) {\n\t\t\t\t\t\t row.push(yColumn); //just binary value\n\t\t\t\t\t }\n\t\t\t\t\t else {\n\t\t\t\t\t\t //multi output layers\n\t\t\t\t\t\t var yVal = -1;\n\t\t\t\t\t\t for (var k = 0; k < yColumn.length; ++k) {\n\t\t\t\t\t\t\t if (yColumn[k] == 1) {\n\t\t\t\t\t\t\t\t yVal = k + 1;\n\t\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t row.push(yVal);\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t\t\t row.push(mCol(Y, i, true));\n\t\t\t\t }\n\t\t\t }\n\t\t\t else {\n\t\t\t\t row.push(ySeparator);\n\t\t\t }\n\n\t\t\t str+= arrayToString(row);\n\t\t\t if (i < Xt.size()[0] - 1) {\n\t\t\t\t str+= '\\n';\n\t\t\t }\n\t\t\t \n\t\t \n\t\t}\n\t \n\t});\n\t\n\t return str;\n\t //el('trainingInput').value = str;\n\t\t \n\t \n\t \n }", "function parseRawData(data) {\n var out = []\n // Interate though the rows of the sheet\n for(var i = 0; i < data.length; i++) {\n var type = getTypeID(data[i][0])\n if(type == -1) { break; }\n \n // Difrent gen for dif types\n if(type == 3) {\n var options = data[i][3].split(\",\")\n out.push([type, data[i][1], data[i][2], options])\n } else if (type == 2) {\n out.push([type, data[i][1], data[i][2], data[i][3]])\n } else {\n out.push([type, data[i][1], data[i][2]])\n }\n }\n \n return out\n}", "function controlBox(selection) {\n selection.each(function(data) {\n var sel = d3.select(this);\n data = relationship[data];\n\n var w = 100;\n var h = 100;\n\n // scale clicks to param values\n var mouseToParam = d3.scale.linear()\n .domain([0,w/2])\n .range([0,maxParam]);\n\n // INITIAL BUILD\n\n var g = sel.selectAll('g.inner')\n .data([data])\n .enter()\n .append('g.inner')\n .attr(\"transform\", \"translate(\" + w/2 + \",\" + h/2 + \")\");\n\n g.append('path.x.axis').attr('d', line([[-w/2,0],[w/2,0]]));\n g.append('path.y.axis').attr('d', line([[0,-h/2],[0,h/2]]));\n g.append('rect.frame')\n .attr('x', -w/2)\n .attr('y', -h/2)\n .attr('width', w)\n .attr('height', h);\n\n // label quadrants accd to J. C. Sprott\n // http://sprott.physics.wisc.edu/pubs/paper277.pdf\n g.append('text').attr('x', w/4).attr('y', -h/4).attr('dy', '.3em').text('EAGER')\n g.append('text').attr('x', w/4).attr('y', h/4).attr('dy', '.3em').text('NARCISSIST')\n g.append('text').attr('x', -w/4).attr('y', -h/4).attr('dy', '.3em').text('CAUTIOUS')\n g.append('text').attr('x', -w/4).attr('y', h/4).attr('dy', '.3em').text('HERMIT')\n\n g.append('text.title').attr('y',-(h/2 + 10)).text(data.name.toUpperCase());\n g.append('text.prose.one').attr('y', h/2 + 10);\n g.append('text.prose.two').attr('y', h/2 + 20);\n g.append('circle.current').attr('r', 2);\n\n var drag = d3.behavior.drag().on('drag', clickOrDrag);\n g.on('click', clickOrDrag).call(drag);\n\n update();\n\n function clickOrDrag(d) {\n\n // remove instruction to do this\n d3.select('.instructions .params').remove();\n\n // coefficient for own feeling\n var a = mouseToParam(d3.mouse(this)[0]);\n d.coefficients[d.dim] = a;\n\n // coefficient for other's feeling\n var b = mouseToParam(-d3.mouse(this)[1]);\n d.coefficients[(d.dim==='x' ? 'y' : 'x')] = b;\n\n update();\n }\n\n // UPDATE\n function update() {\n\n var a = data.coefficients[data.dim];\n var b = data.coefficients[(data.dim==='x' ? 'y' : 'x')];\n\n var hisHer = data.name == 'Romeo' ? 'his' : 'her';\n var heShe = data.name == 'Romeo' ? 'he' : 'she';\n var other = data.name == 'Romeo' ? 'Juliet' : 'Romeo';\n\n // this text also comes from\n // http://sprott.physics.wisc.edu/pubs/paper277.pdf\n var prose1, prose2;\n if(a > 0 && b > 0) {\n prose1 = 'is encouraged by '+hisHer+' own feelings';\n prose2 = 'as well as '+ other +'’s';\n } else if(a > 0 && b < 0) {\n prose1 = 'wants more of what '+heShe+' feels';\n prose2 = 'but retreats from '+ other +'’s feelings';\n } else if(a < 0 && b > 0) {\n prose1 = 'retreats from '+hisHer+' own feelings';\n prose2 = 'but is encouraged by '+other+'’s';\n } else if(a < 0 && b < 0) {\n prose1 = 'retreats from '+hisHer+' own feelings';\n prose2 = 'as well as '+other+'’s';\n }\n\n sel.select('circle.current')\n .attr('cx', mouseToParam.invert(a))\n .attr('cy', mouseToParam.invert(-b))\n\n sel.select('.prose.one').text(prose1);\n sel.select('.prose.two').text(prose2);\n\n // update symbolic equation\n d3.select('.symbolics').call(renderSymbolics);\n\n // clear phase space field trails\n ctx.save();\n ctx.fillStyle = '#fff';\n ctx.globalAlpha = .8;\n ctx.fillRect(-width/2,-height/2,width,height);\n ctx.restore();\n // reset seeds for phase space trails\n lesserRelationships = d3.range(20).map(newPoint);\n\n }\n\n })\n}" ]
[ "0.6345036", "0.6102414", "0.5885389", "0.58116937", "0.57201636", "0.5688615", "0.5674354", "0.56702757", "0.5669321", "0.5609144", "0.56041586", "0.55990803", "0.5579146", "0.5547881", "0.5510071", "0.5503642", "0.547955", "0.54794556", "0.547929", "0.5467214", "0.54609644", "0.5459794", "0.54539984", "0.5452272", "0.543556", "0.5430081", "0.54098374", "0.5409752", "0.5406651", "0.5406455", "0.54026353", "0.5387432", "0.53725654", "0.53650576", "0.5343553", "0.5336265", "0.5314638", "0.5309198", "0.5307745", "0.5298787", "0.5279792", "0.52554125", "0.52506834", "0.5248964", "0.52479947", "0.5229202", "0.52243245", "0.5221218", "0.52153164", "0.52070093", "0.5185569", "0.5181987", "0.5174763", "0.5152567", "0.51519865", "0.5135386", "0.5132992", "0.5128013", "0.5115669", "0.51107156", "0.50969064", "0.50904906", "0.5089418", "0.5084193", "0.50821286", "0.5080316", "0.5078333", "0.50670874", "0.50544035", "0.50529057", "0.505224", "0.504927", "0.5047697", "0.50426924", "0.5042104", "0.50417405", "0.5036501", "0.5036345", "0.5036245", "0.5027605", "0.50238043", "0.50229424", "0.50221074", "0.5021576", "0.5016698", "0.5015473", "0.5014753", "0.5014028", "0.50119936", "0.50094324", "0.5007157", "0.5006881", "0.50058657", "0.5005412", "0.5001023", "0.49989602", "0.49980885", "0.4995083", "0.4991516", "0.49908495", "0.49907786" ]
0.0
-1
build markov machine; read in text.
constructor(text) { let words = text.split(/[ \r\n]+/); let markovChain = this.makeChains(words); this.words = words; this.markovChain = markovChain; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createText(text){\n let mm = new markov.MarkovMachine(text)\n console.log(mm.makeText())\n}", "function generateText(text) {\n let mm = new MarkovMachine(text);\n console.log(mm.makeText());\n}", "function fileMarkov(path) {\n fs.readFile(path, 'utf8', (err, data) => {\n if (err) {\n console.log(\"Error\", err);\n process.exit(1);\n }\n \n let fileContent = new MarkovMachine(data)\n console.log(fileContent.makeText())\n })\n}", "constructor(text) {\n const words = text.split(/[ \\r\\n]+/);\n this.markovChains = this.makeChains(words);\n\n }", "function readTextFile(path) {\n fs.readFile(path, 'utf8', function(err, data) {\n if (err) {\n console.error(`Error reading ${path}: ${err}`);\n process.exit(1);\n } else {\n let mm = new MarkovMachine(data);\n console.log(mm.makeTextNgram());\n }\n });\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.chains = {};\n this.makeChains();\n }", "function gen_markov() {\n // Scrape CL missed connections headlines\n request('http://austin.craigslist.org/mis/', function(error, response, body) {\n var final_text = [];\n if (!error && response.statusCode == 200) {\n var $ = cheerio.load(body);\n // Scrape the response HTML according to craigslist's (incredibly fucking messy) DOM layout\n var links = $(body).find('a.hdrlnk').each(function(i, elem){\n var split_link = $(this).text().split(' -');\n final_text.push((split_link[0]));\n });\n } \n // make the markov *after* the request. Thanks, async\n post_to_twitter(markov(final_text));\n });\n}", "generate() {\n this.len *= 0.5; //So the tree becomes denser instead of larger.\n this.branchValue += 1; //To ensure increased thickness of trunk.\n let nextSentence = \"\";\n for (let i = 0; i < this.sentence.length; i++) {\n let current = this.sentence.charAt(i);\n if (current === current.toLowerCase()) {\n current = current.toUpperCase();\n }\n let found = false;\n\n if (current === this.rules1.letter) {\n found = true;\n nextSentence += this.rules1.becomes;\n } else if (current === this.rules2.letter) {\n found = true;\n nextSentence += this.rules2.becomes;\n } else if (current === this.rules3.letter) {\n found = true;\n nextSentence += this.rules3.becomes;\n }\n\n if (!found) {\n nextSentence += current;\n }\n }\n this.sentence = nextSentence;\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n this.makeBigrams();\n }", "constructor(text) {\n console.log(\"constructor ran, this is text:\", text);\n this.words = text.split(/[ \\r\\n]+/);\n this.chains = {};\n this.text = \"\";\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.chains = this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.chains = this.makeChains();\n }", "async function create_model(text) {\n /* data prep */\n text = text.toLowerCase()\n console.log('corpus length:', text.length)\n\n let words = text.replace(/(\\r\\n\\t|\\n|\\r\\t)/gm,\" \").split(\" \")\n words = words.filter((value, index, self) => self.indexOf(value) === index)\n words = words.sort()\n words = words.filter(String)\n\n console.log(\"total number of unique words\", words.length)\n\n const word_indices = {}\n const indices_word = {}\n for (let e0 of words.entries()) {\n const idx = e0[0]\n const word = e0[1]\n word_indices[word] = idx\n indices_word[idx] = word\n }\n\n console.log(\"maxlen: \" + maxlen, \" step: \" + step)\n\n const sentences = []\n const sentences1 = []\n\n const next_words = []\n let list_words = text.toLowerCase().replace(/(\\r\\n\\t|\\n|\\r\\t)/gm, \" \").split(\" \")\n list_words = list_words.filter(String)\n console.log('list_words ' + list_words.length)\n\n for (var i = 0; i < (list_words.length - maxlen); i += step) {\n var sentences2 = list_words.slice(i, i + maxlen).join(\" \")\n sentences.push(sentences2)\n next_words.push(list_words[i + maxlen])\n }\n console.log('nb sequences(length of sentences):', sentences.length)\n console.log('length of next_word', next_words.length)\n\n console.log('Vectorization...')\n const X = nj.zeros([sentences.length, maxlen, words.length])\n console.log('X shape' + X.shape)\n const y = nj.zeros([sentences.length, words.length])\n console.log('y shape' + y.shape)\n for (let e of sentences.entries()) {\n const i = e[0]\n const sentence = e[1]\n for (let e2 of sentence.split(\" \").entries()) {\n const t = e2[0]\n const word = e2[1]\n X.set(i, t, word_indices[word], 1)\n }\n y.set(i, word_indices[next_words[i]], 1)\n }\n\n console.log('Creating model... Please wait.')\n\n console.log(\"MAXLEN \" + maxlen + \", words.length \" + words.length)\n const model = tf.sequential()\n model.add(tf.layers.lstm({\n units: 128,\n returnSequences: true,\n inputShape: [maxlen, words.length]\n }))\n model.add(tf.layers.dropout(0.2))\n model.add(tf.layers.lstm({\n units: 128,\n returnSequences: false\n }))\n model.add(tf.layers.dropout(0.2))\n model.add(tf.layers.dense({units: words.length, activation: 'softmax'}))\n\n model.compile({loss: 'categoricalCrossentropy', optimizer: tf.train.rmsprop(0.002)})\n\n x_tensor = tf.tensor3d(X.tolist(), null, 'bool')\n //x_tensor.print(true)\n y_tensor = tf.tensor2d(y.tolist(), null, 'bool')\n //y_tensor.print(true)\n\n /* training */\n await model.fit(x_tensor, y_tensor, {\n epochs: 100,\n batchSize: 32,\n callbacks: {\n onEpochEnd: async (epoch, logs) => {\n console.log(logs.loss + \",\")\n }\n }\n })\n\n /* prediction */\n const start_index = Math.floor(Math.random() * (list_words.length - maxlen - 1))\n const diversity = 0.5\n console.log('----- diversity:', diversity)\n let generated = ''\n const sentence = list_words.slice(start_index, start_index + maxlen + 1)\n generated += sentence.join(\" \")\n console.log(generated)\n let str = \"\"\n for (let i = 0; i < 100; i++) {\n let x_pred = nj.zeros([1, maxlen, words.length])\n let str_b = \"\"\n for (e3 of sentence.entries()) {\n t = e3[0]\n word = e3[1]\n x_pred.set(0, t, word_indices[word], 1)\n str_b += '(0, ' + t + \", \" + word_indices[word] + \"), \"\n }\n const test = tf.tensor3d(x_pred.tolist())\n const output = model.predict(test)\n const output_data = await output.dataSync()\n const preds = Array.prototype.slice.call(output_data)\n const next_index = sample(preds, diversity)\n const next_word = indices_word[next_index]\n generated += \" \" + next_word\n sentence.shift()\n str += next_word + \" \"\n }\n console.log(str)\n}", "function callCreate() {\n\n multiMarkov.createMarkov(myval);\n\n\n}", "function TextMachine( options ) {\n\tthis.program = options.program ;\n\tthis.api = options.api || {} ;\n\tthis.stateStack = null ;\n\n\t// TODO\n\t//this.offset = 0 ;\n\t//this.savedStateStack = [] ;\n\n\tthis.reset() ;\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter((c) => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "function makeFinalMarkov(textStamps, markovText){\n var output = [];\n for(var i = 0; i < markovText.length; i++){\n var curWord = markovText[i];\n var chooseArr = textStamps[curWord];\n output.push(chooseArr[Math.floor(Math.random() * chooseArr.length)]);\n }\n return output;\n}", "constructor(text) {\n\t\tlet words = text.split(/[ \\r\\n]+/);\n\t\tthis.words = words.filter((c) => c !== \"\");\n\t\tthis.makeChains();\n\t}", "parseAndAdd(line) {\n\n // WORKING HERE 9/14 (is this RiTa.this.tokenizer?)\n this.tokenizer.tokenize(line, ' ');\n let type = this.tokenizer.nextToken();\n\n if (type === \"S\" || type === \"P\") {\n this.stateMachine[this.numStates++] = this.createState(type, this.tokenizer);\n } else if (type === \"I\") {\n let index = parseInt(this.tokenizer.nextToken());\n if (index != this.numStates) {\n throw Error(\"Bad I in file.\");\n } else {\n let c = this.tokenizer.nextToken();\n this.letterIndex[c] = index;\n }\n //log(type+\" : \"+c+\" : \"+index + \" \"+this.letterIndex[c]);\n } else if (type == \"T\") {\n this.stateMachine = [];\n this.stateMachineSize = parseInt(this.tokenizer.nextToken());\n }\n }", "function generateMetadata(state, paraIndex, textData) {\n /* state - \n words:\n A map of all non-trivial words in the document, each entry containing an array of indexes\n where that word is found.\n Sentences:\n Each sentence has a start pos, length and the first word. \n paragraphs: \n Each paragraph contains the start pos, the first word.\n */\n //console.log(\"Analize: \" + paraIndex + \": \" + JSON.stringify(textData));\n\n textData.forEach(function(sentenceData) {\n //console.log(\"Words: \" + JSON.stringify(state.words));\n\n sentenceData.words.forEach(function(wordData) {\n // Add index to this word's list\n if (state.words[wordData.text]) {\n state.words[wordData.text].push([paraIndex, wordData.start]);\n } else {\n // Ignore this word if it's on the filler-words list\n if ( ! fillerWordsList.find(function(item) {\n return item === wordData.text;\n })) {\n // Lookup lemma\n wordNet.lookup(wordData.text, function(error, result) {\n var lemma;\n if (error) {\n // Not found in database Add the raw word\n lemma = wordData.text;\n console.log(\"Unknown word: \" + wordData.text);\n state.unknownWords.push(lemma);\n } else {\n //console.log(\"Word Lookup result for: \" + wordData.text + \": \" + JSON.stringify(result, null, 4));\n //console.log(\"Word Lookup lemma for: \" + wordData.text + \": \" + result.lemma);\n if (result.length > 0) {\n if (result[0].lemma) {\n lemma = result[0].lemma;\n //console.log(\"Found word: \" + wordData.text + \" Lemma: \" + lemma);\n }\n }\n if ( ! lemma) {\n lemma = wordData.text;\n //console.log(\"Empty result for word: \" + wordData.text);\n }\n }\n // Add word lemma\n state.words[lemma] = [[paraIndex, wordData.start]];\n });\n }\n }\n });\n\n state.sentences.push({\n para: paraIndex,\n start: sentenceData.start,\n length: sentenceData.length,\n firstWord: sentenceData.words[0].text\n });\n });\n\n state.paragraphs.push({\n index: paraIndex,\n firstWord: textData[0].words[0].text\n });\n\n}", "defineStates() {\n // Maximum stack calls\n let maxStackCalls = 400;\n\n // Acquisition lambdas\n let queue = i => {\n return this.text.charAt(i);\n };\n let store = c => {\n this.buffer += c;\n };\n let flush = t => {\n if (this.buffer.length > 0) {\n // Special treatment for id tokens that contain only numbers\n let numberToken = t == Token.ID && !isNaN(this.buffer);\n this.list.push(\n new Token(numberToken ? Token.NUMBER : t, this.buffer, line)\n );\n }\n this.buffer = \"\";\n };\n\n // Line number updater\n let line = 0;\n let newline = i => {\n line++;\n };\n\n // State definitions\n let state = {\n // Transference function\n transference: (i, phase) => {\n if (i < this.text.length) {\n // Prevent stack overflow\n if (i % maxStackCalls == 0 && phase != true) {\n this.index = i;\n return;\n }\n\n // Transfer to the identifier state\n state.identifier(i);\n } else {\n flush(Token.ID);\n this.index = i;\n return;\n }\n },\n\n // For IDs\n identifier: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case '\"':\n case \"'\":\n flush(Token.ID);\n state.string(i + 1, c);\n return;\n case \"\\\\\":\n flush(Token.ID);\n state.extension(i);\n return;\n case \" \":\n case \";\":\n flush(Token.ID);\n state.delimiter(i);\n return;\n case \"#\":\n flush(Token.ID);\n state.comment(i + 1);\n return;\n case \"(\":\n case \")\":\n flush(Token.ID);\n state.parenthesis(i, c);\n return;\n default:\n store(c);\n state.transference(i + 1);\n }\n },\n\n // For strings\n string: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case phase:\n flush(Token.STRING);\n state.transference(i + 1, c);\n return;\n case \"\\\\\":\n state.extension(i + 1);\n return;\n default:\n store(c);\n state.string(i + 1, phase);\n }\n },\n\n // For escape characters\n extension: (i, phase) => {\n let c = queue(i);\n\n store(\"\\\\\" + c);\n state.transference(i + 1);\n },\n\n // For comments\n comment: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case \";\":\n newline();\n flush(Token.COMMENT);\n state.transference(i + 1);\n return;\n default:\n store(c);\n state.comment(i + 1);\n }\n },\n\n // For parenthesis\n parenthesis: (i, phase) => {\n let c = queue(i);\n\n store(c);\n if (phase == \"(\") flush(Token.OPEN);\n else if (phase == \")\") flush(Token.CLOSE);\n state.transference(i + 1);\n },\n\n // For whitespaces and linefeeds\n delimiter: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case \";\":\n newline();\n case \" \":\n store(c);\n state.delimiter(i + 1);\n return;\n default:\n flush(Token.SPACE);\n state.transference(i);\n }\n }\n };\n this.state = state;\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n console.log(words);\n // MORE CODE HERE\n this.words = words;\n this.chain = this.makeChains();\n\n }", "function generateText() {\n\n words.clear()\n var textFile = document.getElementById(\"inputFile\")\n //console.log(textFile)\n parseFile(textFile)\n\n}", "function tm() {\n function State () {\n this.transitions = new Array();\n };\n \n function Transition (inputSymbol, outputSymbol, stateChange, moveDirection) {\n this.input = inputSymbol;\n this.output = outputSymbol;\n this.state = stateChange;\n this.direction = moveDirection;\n };\n \n this.states = new Array();\n this.currentState = 0; //Current state is either positive integer N, -1 for accepting state or -2 for rejecting state\n this.currentChar = 0; //Gives character in input to be examined in nextStep()\n this.tape = new Array(null);\n \n this.setInput = function (chars) {\n var i = 0;\n this.tape = new Array(null);\n for (i = 0; i < chars.length; i++) {\n this.tape.push(chars[i]);\n }\n };\n \n this.resetMachine = function () {\n this.currentState = 0;\n this.currentChar = 0;\n };\n \n this.addState = function () {\n this.states.push(new State());\n return this.states.length - 1;\n };\n \n this.addTransition = function (startState, input, output, endState, move) {\n this.states[startState].transitions.push(new Transition(input, output, endState, move));\n };\n \n this.nextStep = function () {\n var i = 0, moved = false;\n if (this.currentChar == this.tape.length) {\n this.tape.push(null);\n }\n if (this.currentState >= 0 && this.currentChar >= 0) {\n while (moved === false && i < this.states[this.currentState].transitions.length) {\n if (this.states[this.currentState].transitions[i].input === this.tape[this.currentChar]) {\n this.tape[this.currentChar] = this.states[this.currentState].transitions[i].output;\n if (this.states[this.currentState].transitions[i].direction === \"L\") {\n this.currentChar -= 1;\n } else if (this.states[this.currentState].transitions[i].direction === \"R\") {\n this.currentChar += 1;\n }\n this.currentState = this.states[this.currentState].transitions[i].state;\n moved = true;\n }\n i++;\n }\n if (moved == false) {\n this.currentState = -2;\n }\n }\n };\n \n this.runToEnd = function () {\n while(this.currentState >= 0) {\n this.nextStep();\n }\n \n return this.currentState;\n }\n \n this.output = function () {\n if (this.currentState == -1) {\n return this.tape.slice(1);\n } else {\n return null;\n }\n }\n}", "function setup() {\n createCanvas(600,200);\n\n line1 = new RiGrammar();\n line2 = new RiGrammar();\n line3 = new RiGrammar();\n lexicon = new RiLexicon();\n line1.addRule('<start>', '<l1w1> <l1w2> <l1w3>', 1);\n line1.addRule('<l1w1>', lexicon.randomWord(\"nn\",2), 1);\n line1.addRule('<l1w2>', lexicon.randomWord(\"vbz\",1), 1);\n line1.addRule('<l1w3>', lexicon.randomWord(\"rb\",2), 1);\n\n line2.addRule('<start>', '<l2w1> <l2w2> <l2w3> <l2w4> <l2w5>', 1);\n line2.addRule('<l2w1>', lexicon.randomWord(\"dt\",1), 1);\n line2.addRule('<l2w2>', lexicon.randomWord(\"jj\",2), 1);\n line2.addRule('<l2w3>', lexicon.randomWord(\"nn\",1), 1);\n line2.addRule('<l2w4>', lexicon.randomWord(\"vbz\",1), 1);\n line2.addRule('<l2w5>', lexicon.randomWord(\"rb\",2), 1);\n\n line3.addRule('<start>', '<l3w1> <l3w2> <l3w3>', 1);\n line3.addRule('<l3w1>', lexicon.randomWord(\"rb\",1), 1);\n line3.addRule('<l3w2>', lexicon.randomWord(\"vbz\",2), 1);\n line3.addRule('<l3w3>', lexicon.randomWord(\"nn\",2), 1);\n}", "function makeText(state) {\n \n //get the coordinates based on configuration on paths file\n\t\t\t\tvar coords = m.utilities.getTextCoords(state);\n \n //make the Raphael object for the text object\n if (typeof (m.stateLabelObjs) === \"undefined\") {m.stateLabelObjs = {}; }\n\t\t\t\tm.stateLabelObjs[state] = m.paper.text(coords[0], coords[1], state);\n\t\t\t\tm.stateLabelObjs[state].attr({\n\t\t\t\t\t\"font-size\": 28,\n\t\t\t\t\t\"font-family\": m.fontFamily\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif (typeof(m.labelsToHide) !== \"undefined\") {\n\t\t\t\t\tif (typeof(m.labelsToHide[state]) !== \"undefined\") {\n\t\t\t\t\t\tif (m.labelsToHide[state] === 1) {\n\t\t\t\t\t\t\tm.stateLabelObjs[state].attr(\"opacity\",0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//store raphael IDs of each label\n if (typeof (m.stateTextIDs === \"undefined\")) {m.stateTextIDs = {}; }\n\t\t\t\tm.stateTextIDs[state] = m.stateLabelObjs[state].node.raphaelid;\n \n //and for reverse lookup\n if (typeof (m.stateByRaphaelTextID === \"undefined\")) {m.stateByRaphaelTextID = {}; }\n\t\t\t\tm.stateByRaphaelTextID[m.stateLabelObjs[state].node.raphaelid] = state;\n\t\t\t}", "function GenerateNewText() {\n this.sentences = [\n \"Nice.\",\n \"Do you have a sound test?\",\n \"Check out my sound test.\",\n \"Instead of asking for a keyboard rec, try building your own keyboard.\",\n \"What switches are those?\",\n \"I don’t know, I’m still waiting on a group buy.\",\n \"My GMK set is delayed.\",\n \"Well regardless, those caps are nice.\",\n \"Please check out my interest check!\",\n \"I built it myself.\",\n \"Sadly, I had to pay after market prices for these.\",\n \"I’m a tactile person myself.\",\n \"This is end game, for sure.\",\n \"I have one pair of hands but 24 keyboards.\",\n \"Specs?\",\n \"I need something to test out my new soldering iron.\",\n \"There’s a new group buy coming up that I’m waiting for.\",\n \"GMK is delayed by a year.\",\n \"Yeah once the caps come in, I’ll have this keyboard done.\", \n \"How much was your latest build?\",\n \"Wow do you use all those keyboards?\",\n \"I forgot to lube my switches.\",\n \"Been thinking about getting a custom handmade wrist rest to match my keyboard.\",\n \"It was supposed to be a budget build.\",\n \"You're a fool if you think the first build will be your last.\",\n \"Hopefully there will be a round 2 for that.\",\n \"I'm pretty sure I saw that on someone's build stream.\",\n \"That's a really nice build.\",\n \"Yeah, I have a custom coiled cable to match my custom mechanical keyboard and custom wrist rest that all fit nicely in my custom keyboard case.\",\n \"Finally had some time to lube these switches.\",\n \"Are those Cherry MX Browns?\",\n \"Really loving the caps!\",\n \"I wonder how long it took for everything to arrive.\", \n \"I find lubing switches to be therapeutic.\",\n \"I'm already thinking about my next build.\",\n \"You have to lube your switches though.\", \n \"Cool build.\",\n \"Thinking about getting an IKEA wall mount to display my boards.\",\n \"I bought that in a group buy a year ago.\",\n \"You won't believe how much shipping was.\",\n \"Not sure when my keyboard will come in honestly.\",\n \"Listen to the type test of this board.\",\n \"Soldered this PCB myself.\",\n \"Imagine buying GMK sets to flip them.\",\n \"My keyboard is stuck in customs.\",\n \"I have a collection of desk mats and only 1 desk.\",\n \"I've seen some cursed builds out there.\",\n \"Keyboards made me broke.\",\n \"I fell in too deep in the rabbit hole.\",\n \"I'm about to spend $500 on a rectangle.\",\n \"Not sure if this is a hobby or hell.\",\n \"Give me some feedback on my first build!\",\n \"The group buy is live now.\",\n \"I think I just forgot to join a group buy.\",\n \"RNG gods please bless me.\",\n \"It's gasket-mounted.\",\n \"But actuation force though.\",\n \"Never really thought of it that way now that you say it.\",\n \"Lots of people get into this hobby without doing their research and it shows.\",\n \"A custom keyboard can change your life, I would know.\",\n \"Group buys have taught me a different type of patience I didn't know I had.\",\n \"This was a group buy, you can't really find this unless you search after market.\"\n ]\n}", "function readInp(){\n\tvar inp = document.getElementById(\"cfg\").value;\n\tvar without = interpret(inp);\n\tvar SymSet = new SymbolSet(without);\n\tvar startSym = SymSet.findSym(\"S\");\n\tvar sentence = SymSet.writeSymbol(startSym);\n\t//console.log(sentence);\n\tdocument.getElementById(\"output\").innerHTML += \"<li>\" + sentence + \"</li>\";\n}", "function newWord(){\n textInput = \"\";\n letters = {};\n topNode = 0;\n nodes = [];\n objectsList = [];\n}", "function init() {\n vm.game.task = task;\n processText(task.text);\n var text = document.getElementById('text');\n text.addEventListener('mouseup', function() {\n var selection = window.getSelection();\n if (selection.rangeCount > 0) {\n var baseNode = selection.baseNode.parentNode;\n var extentNode = selection.extentNode.parentNode;\n var base = baseNode.getAttribute('id');\n base = +(base.split('-').slice(-1)[0]);\n var extent = extentNode.getAttribute('id');\n extent = +(extent.split('-').slice(-1)[0]);\n var start = Math.min(base, extent);\n start = start || -1;\n var end = Math.max(base, extent);\n for (var i = start + 1; i <= end; i++) {\n vm.game.marked[i] = !vm.game.marked[i];\n }\n remark();\n }\n });\n }", "function mkup(txt) {\n if(!txt || txt == '') return '';\n marked.setOptions({\n gfm: true,\n tables: true,\n breaks: true,\n pedantic: false,\n sanitize: false,\n smartLists: true,\n langPrefix: 'language-',\n highlight: function(code, lang) {\n if (lang === 'js') {\n return highlighter.javascript(code);\n }\n return code;\n }\n });\n return marked(txt);\n}", "function GenerateNewText() {\n\n this.choices = []; // create this so we don't duplicate the sentences chosen\n\n // Add property to the object\n this.sentences =\n [\n \"The term \\\"tested in an ABM mode\\\" used in Article II of the Treaty refers to: (a) an ABM interceptor missile if while guided by an ABM radar it has intercepted a strategic ballistic missile or its elements in flight trajectory regardless of whether such intercept was successful or not; or if an ABM interceptor missile has been launched from an ABM launcher and guided by an ABM radar. If ABM interceptor missiles are given the capability to carry out interception without the use of ABM radars as the means of guidance, application of the term \\\"tested in an ABM mode\\\" to ABM interceptor missiles in that event shall be subject to additional discussion and agreement in the Standing Consultative Commission; (b) an ABM launcher if it has been used for launching an ABM interceptor missile; (c) an ABM radar if it has tracked a strategic ballistic missile or its elements in flight trajectory and guided an ABM interceptor missile toward them regardless of whether the intercept was successful or not; or tracked and guided an ABM interceptor missile; or tracked a strategic ballistic missile or its elements in flight trajectory in conjunction with an ABM radar, which is tracking a strategic ballistic missile or its elements in flight trajectory and guiding an ABM interceptor missile toward them or is tracking and guiding an ABM interceptor missile.\",\n \"EWO launch: If sequence does not start after coordinated key turn, refer to Fig 2-1 and Notify command post of type deviation, ETOR, and intent to perform TCCPS; Post ETOR to EWO documents.\",\n \"(For classified information on the RV, refer to the 11N series Technical Orders.)\",\n \"Here's my strategry on the Cold War: we win, they lose.\",\n \"The only thing that kept the Cold War cold was the mutual deterrance afforded by nuclear weapons.\",\n \"The weapons of war must be abolished before they abolish us.\",\n \"Ours is a world of nuclear giants and ethical infants.\",\n \"The safety and arming devices are acceleration-type, arming-delay devices that prevent accidental warhead detonation.\",\n \"The immediate fireball reaches temperatures in the ranges of tens of millions of degrees, ie, as hot as the interior temperatures of the sun.\",\n \"In a typical nuclear detonation, because the fireball is so hot, it immediately begins to rise in altitude. As it rises, a vacuum effect is created under the fireball, and air that had been pushed away from the detonation rushes back toward the fireball, causing an upward flow of air and dust that follows it.\",\n \"The RV/G&C van is used to transport and remove/replace the RV and the MGS for the MM II weapon system.\",\n \"Computer components include a VAX 11/750 main computer, an Intel 80186 CPU in the buffer, and the Ethernet LAN which connects the buffer with the main computer.\",\n \"The Specific Force Integrating Receiver (SFIR) is one of the instruments within the IMU of the Missile G&C Set (MGCS) which measures velocity along three orthogonal axes.\",\n \"The SFIR incorporates a pendulous integrating gyro having a specific mass unbalance along the spin axis, and provides correction rates to the Missile Electronics Computer Assembly (MECA) which provides ouputs to the different direction control units resulting in control of the missile flight.\",\n \"SAC has directed that all VAFB flight test systems and the PK LSS will be compatible with the SAC ILSC requirement.\",\n \"The ground shock accompanying the blast is nullified in the control center by a three-level, steel, shock-isolation cage, which is supported by eight shock mounts hung from the domed roof.\",\n \"(Prior to MCL 3252) Fixed vapor sensing equipment consists of an oxidizer vapor detector, a fuel vapor detector, a vapor detector annunciator panel, and associated sensing devices located throughout the silo area.\",\n \"The LAUNCH CONTROL AND MONITOR section contains switches to lock out the system, select a target, initiate a lunch, shutdown and reset.\",\n \"The CMG-1 chassis contains the logic required to control launch.\",\n \"Attention turned to the Nike X concept, a layered system with more than one type of missile.\",\n \"At this point a fight broke out between the Air Force and Army over who had precedence to develop land-based ABM systems.\",\n \"It is such a big explosion, it can smash in buildings and knock signboards over, and break windows all over town, but if you duck and cover, like Bert [the Turtle], you will be much safer.\",\n \"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.\",\n \"The living will envy the dead.\",\n \"Frequent fear of nuclear war in adolescents seems to be an indicator for an increased risk for common mental disorders and deserves serious attention.\",\n \"The Peacekeeper was the first U.S. ICBM to use cold launch technology.\",\n \"The Protocol to the Agreement with regard to Article III, entitled the United States to have no more than 710 SLBM launchers on 44 modern ballistic missile submarines, and the USSR, no more than 950 SLBM launchers on 62 submarines.\",\n \"Well hell, I'd piss on a spark plug if you thought it would do any good.\",\n \"Do you want to play a game?\",\n \"Gentlemen! You can't fight in here! This is the war room!\",\n \"I do not avoid women, Mandrake. But I do deny them my essence.\",\n \"Mr. Ryan, be careful what you shoot at. Most things here don't react well to bullets.\",\n \"If OPERATE OK on the BVLC does not light in step 5, verify that the proper code is inserted.\",\n \"PEACETIME launch: If abnormal indications occur prior to step 8, report to Launch Director and proceed as directed.\",\n \"The missile silo (figure 1-2) is a reinforced, concrete structure with inside dimensions of approximately 146 feet in depth and 55 feet in diameter.\",\n \"General, you are listening to a machine.\",\n \"The mechanism is... Oh James, James... Will you make love to me all the time in England?\",\n \"I never joke about my work, 007.\", \n \"Eventually Kwajalein Island was selected, as it was 4,800 miles from California, perfect for ICBMs, and already had a US Navy base with considerable housing stocks and an airstrip.\",\n \"From Stettin in the Baltic to Trieste in the Adriatic an iron curtain has descended across the Continent.\",\n \"Whether you like it or not, history is on our side. We will bury you.\",\n \"I like Mr. Gorbachev. We can do business together.\",\n \"Mr. Gorbachev, tear down this wall!\",\n \"Gort! Klaatu barada nikto!\",\n \"It is no concern of ours how you run your own planet. But if you threaten to extend your violence, this Earth of yours will be reduced to a burned-out cinder.\",\n \"The remaining base in North Dakota, the Stanley R. Mickelsen Safeguard Complex, became active on 1 April 1975 and fully operational on 1 October 1975. By that time the House Appropriations Committee had already voted to deativate it. The base was shutdown on 10 February 1976.\"\n\n\n ];\n\n console.log(\"How many sentences? \",this.sentences.length);\n}", "function BFVM(options) {\n\n // options\n // TODO: in BFVM: more options\n var length = 30000; // length of data tape\n var bytes = 1; // size of data tape cell in bytes\n if (options) {\n if (options.Size)\n size = options.Size;\n if (options.Bytes)\n bytes = options.Bytes;\n }\n\n // fields\n\n var commands = new CommandSet(); // vm commands\n fillCommandSet();\n\n // TODO: in BFVM: states\n var state = 'stopped'; // also 'running', and 'waiting' states possible\n var data = []; // data tape\n var code = []; // code tape\n var input = []; // user input queue (stores character codes)\n var output = ''; // output string\n var dp = 0; // data pointer\n var cp = 0; // code pointer\n\n // properties\n this.State = function() {\n return state;\n };\n\n this.Load = function(byteArr) {\n code = byteArr;\n data = new Array(length);\n for (var i = 0; i < length; i++) {\n data[i] = 0;\n }\n dp = 0;\n cp = 0;\n };\n\n this.Run = function() {\n output = '';\n while(cp < code.length) {\n commands.ById(code[cp]).Exec();\n cp++;\n }\n console.log(output);\n return output;\n };\n //TODO: in BFVM: pausing and interrupts\n this.Pause = function() {\n\n };\n //TODO: in BFVM: input logic\n this.Read = function(str) {\n if(typeof(str) !== 'string' || str.length === 0) {\n throw new Error('only non-empty strings are acceptable for input');\n }\n for (var i = 0; i < str.length; i++) {\n input.unshift(str.charCodeAt(i));\n }\n };\n\n function waitForInput() {\n\n }\n\n function fillCommandSet() {\n commands.Add(new Command(0, 'nop', 0, function() {\n //do nothing\n }));\n commands.Add(new Command(1, 'right', 0, function() {\n dp++;\n }));\n commands.Add(new Command(2, 'left', 0, function() {\n dp--;\n }));\n commands.Add(new Command(3, 'inc', 0, function() {\n data[dp]++;\n }));\n commands.Add(new Command(4, 'dec', 0, function() {\n data[dp]--;\n }));\n commands.Add(new Command(5, 'put', 0, function() {\n output += String.fromCharCode(data[dp]);\n }));\n commands.Add(new Command(6, 'get', 0, function() {\n data[dp] = input.pop();\n }));\n commands.Add(new Command(7, 'loopstart', 0, function() {\n if (data[dp] === 0) {\n var counter = 1;\n while (counter > 0) {\n cp++;\n if (code[cp] === 7) // [\n counter++;\n else if (code[cp] === 8) // ]\n counter--;\n }\n }\n }));\n commands.Add(new Command(8, 'loopend', 0, function() {\n if (data[dp] !== 0) {\n var counter = 1;\n while (counter > 0) {\n cp--;\n if (code[cp] === 8) // ]\n counter++;\n else if (code[cp] === 7) // [\n counter--;\n }\n }\n }));\n commands.Add(new Command(9, 'rightby', 1, function(){\n var shift = code[++cp];\n dp += shift;\n }));\n commands.Add(new Command(10, 'leftby', 1, function(){\n var shift = code[++cp];\n dp -= shift;\n }));\n commands.Add(new Command(11, 'farrightby', 2, function(){\n var bigshift = code[++cp];\n var smallshift = code[++cp];\n dp += (bigshift * 256 + smallshift);\n }));\n commands.Add(new Command(12, 'farleftby', 2, function(){\n var bigshift = code[++cp];\n var smallshift = code[++cp];\n dp -= (bigshift * 256 + smallshift);\n }));\n commands.Add(new Command(13, 'incby', 1, function(){\n var delta = code[++cp];\n data[dp] += delta;\n }));\n commands.Add(new Command(14, 'decby', 1, function(){\n var delta = code[++cp];\n data[dp] -= delta;\n }));\n }\n\n}", "constructor(songs){\n\t\t// a dictionary which maps each token (note or timestep) to an array of pairs,\n\t\t// where each pair is {token: occurences} (i.e. a single entry in a dictionary)\n\t\t// I called it a map because it maps things (as dictionaries do) and it's a nice alliteration\n\t\tthis.markovMap = {};\n\n\t\tfor(let songIndex = 0; songIndex < songs.length; songIndex++){\n\t\t\tlet tokens = songs[songIndex].split(\" \"); // each entry is a string representing either a note or a timestep\n\n\t\t\tthis.updateProbabilities(\"start\", tokens[0]);\n\t\t\tfor(let i = 0; i < tokens.length-2; i++){ // for each token except the last two\n\t\t\t\tthis.updateProbabilities(tokens[i], tokens[i+1]);\n\t\t\t}\n\t\t\tthis.updateProbabilities(tokens[tokens.length-2], \"end\"); // for the penultimate token (the last one is a dummy)\n\t\t}\n\t}", "function mowersParser(lines) {\n let mowers = [];\n let mower = {};\n let index = 0;\n\n // To improve\n for (let i = 0; i < lines.length; i++) {\n let line = lines[i];\n if (index === 0) {\n let initLine = line.split(' ');\n mower.init = { x: initLine[0], y: initLine[1], directions: initLine[2] };\n index += 1;\n } else {\n mower.instructions = [];\n let instructions = line.split('');\n instructions.forEach((instruction) => {\n mower.instructions.push(instruction);\n });\n\n mowers.push(mower);\n mower = {};\n index = 0;\n }\n }\n return mowers;\n}", "function TextParser() {}", "function TextParser() {}", "function textToInstructions(text, startingLine) {\n let labels = {}, instructions = {}; // dictionaries to contain memory related information\n let memoryOffset = 0; // compensate for lines which shouldn't increment memory\n \n let lines = text.split('\\n'); // create array of newline delimited lines\n let linesLength = lines.length;\n let pcToLine = {};\n for(let i = 0; i < linesLength; i++) { // iterate over each line of code\n // handle non-instruction lines\n // remove comments\n let hashtag = lines[i].indexOf('#');\n if(hashtag != -1) lines[i] = lines[i].slice(0, hashtag);\n\n let colon = lines[i].indexOf(':'); // find colon to detect a label\n if(colon != -1) { // if a colon exists\n // error checking\n let label = lines[i].slice(0, colon).trim(); // get label before colon\n if(label in labels) // duplicate label location error\n return syntaxError(startingLine + i, 'Two labels cannot have the same name!', label + ': 0x' + (TEXT_START_ADDRESS + (i - memoryOffset) * 4).toString(16));\n if(Object.values(labels).includes(TEXT_START_ADDRESS + (i - memoryOffset) * 4)) // duplicate label error\n return syntaxError(startingLine + i, 'Two labels cannot resolve to the same memory location!', labels[TEXT_START_ADDRESS + (i - memoryOffset) * 4] + ': 0x' + (TEXT_START_ADDRESS + (i - memoryOffset) * 4).toString(16), label + ': 0x' + (TEXT_START_ADDRESS + (i - memoryOffset) * 4).toString(16));\n\n // no errors\n labels[TEXT_START_ADDRESS + (i - memoryOffset) * 4] = label; // add (memory, label) to labels dictionary\n let remaining = lines[i].slice(colon + 1).trim(); // get remaining line after label\n if(remaining == '') {\n memoryOffset++; // labels do not consume memory\n continue; // skip remaining line, no more information\n }\n else lines[i] = remaining;\n }\n if(lines[i].trim() == '') {\n memoryOffset++; // newlines and comments do not consume memory\n continue; // skip this line\n }\n \n // extract fields from instruction\n let fields = lines[i].trim().split(','); // create array of comma delimited fields\n let fieldsLength = fields.length;\n for(let j = 0; j < fieldsLength; j++) fields[j].toLowerCase();\n if(!(fieldsLength == 1 && fields[0].trim().split(' ').length == 1)) {\n let opFirstField = fields.splice(0, 1)[0]; // get and remove opcode and first field of instruction from fields\n let firstSpace = opFirstField.indexOf(' ');\n let opcode = opFirstField.slice(0, firstSpace);\n fields.unshift(opcode, opFirstField.slice(firstSpace).trim());\n fieldsLength++;\n }\n \n // remove whitespace around fields\n for(let j = 0; j < fieldsLength; j++) fields[j] = fields[j].trim();\n\n // store array of fields at address of memory it goes in\n let machineCodeInstruction = assemblyToMachine(startingLine + i, i + TEXT_START_ADDRESS, fields);\n if(machineCodeInstruction == -1) return -1;\n instructions[TEXT_START_ADDRESS + (i - memoryOffset) * 4] = machineCodeInstruction;\n pcToLine[TEXT_START_ADDRESS + (i - memoryOffset) * 4] = startingLine + i;\n }\n return [labels, instructions, pcToLine];\n}", "analyse() {\n let currentState = new UndecidedState(this);\n\n while (this._pos < this._text.length && typeof currentState !== 'undefined') {\n let ch = this._text.charAt(this._pos);\n this.skipAheadBy(1);\n currentState = currentState.next(ch);\n }\n\n // Give state chance to store its token.\n if (typeof currentState !== 'undefined') {\n currentState.terminate();\n }\n\n return this._tokens;\n }", "createNew() {\n this.fading = 0;\n // Splitting sentence in multiple lines\n var splitted = this.sentence.split(' ');\n this.line = [];\n this.lineOffesets = [];\n var k = 0;\n this.line[0] = splitted[0];\n var constOffeset = this.canvasWidth / 2;\n\n // 50 chars they say is helps readbility\n for (var i = 1; i < splitted.length; i++) {\n // First condition for mobile second on desktop\n if (this.getTextWidth(this.line[k] + splitted[i], this.size + this.font) < (this.canvasWidth - this.X - 15) && this.line[k].length < 50) {\n this.line[k] += \" \" + splitted[i];\n } else {\n this.lineOffesets[k] = constOffeset - (this.getTextWidth(this.line[k]) / 2);\n k++;\n this.line[k] = splitted[i];\n }\n }\n // One last time, because the incrementing logic if offset by one\n this.lineOffesets[k] = constOffeset - (this.getTextWidth(this.line[k]) / 2);\n\n if (this.author != null) {\n k++;\n this.line[k] = this.author;\n this.lineOffesets[k] = constOffeset - (this.getTextWidth(this.line[k]) / 2);\n }\n }", "function TextParser() { }", "function parseText(input) {\n console.log('processing1!' + site.page.key());\n var ignoreWords = [\"i\", \"use\"];\n var TfIdf = natural.TfIdf;\n var tfidf = new TfIdf();\n tokenizer = new natural.WordTokenizer();\n // split the string into an array\n var tokenized = [];\n for(i in input) {\n\n var token = tokenizer.tokenize(input[i]);\n\n if (token !== \"\") {\n //console.log(\"This is the token: \" + '\"' + token + '\"');\n tokenized.push(tokenizer.tokenize(input[i]));\n }\n }\n\n var keyWords = [];\n\n var tagger = new Tagger(lexicon_file, rules_file, default_category, function(error) {\n if (error) {\n console.log(error);\n }\n else {\n for(i in tokenized) {\n if(tokenized[i]){\n //console.log(tagger.tag(tokenized[i]));\n var result = tagger.tag(tokenized[i]);\n\n for(j in result) {\n if(result[j][1] === \"NN\" || result[j][1] === \"NNP\" || result[j][1] === \"NNPS\" || result[j][1] === \"NNS\" ) {\n var lowerCase = result[j][0].toLowerCase();\n\n //If it's a word we should ignore\n var ignore = false;\n for(i in ignoreWords) {\n if(lowerCase === ignoreWords[i]) {\n ignore = true;\n }\n }\n\n // If its not one of the words we want to ignore\n if(!ignore) {\n var stemmed = natural.PorterStemmer.stem(lowerCase);\n keyWords.push(stemmed);\n }\n }\n }\n }\n }\n countKeyWords(keyWords);\n\n }\n });\n}", "function start_learning(content) {\n for (let i = 0; i < content.length; i++) {\n for (let i2 = 0; i2 < content[i].split(\" \").length; i2++) {\n let statement = content[i].split(\" \");\n let word = cleanup(statement[i2]);\n if (!WORD_STACK.includes(word)) {\n WORD_STACK.push(word);\n WORD_PROM[WORD_STACK.indexOf(word)] = 1;\n let formatted_context = content[i].split(\" \");\n let statement_push = [];\n for (let i3 = 0; i3 < formatted_context.length; i3++) {\n statement_push.push(cleanup(formatted_context[i3]));\n } WORD_CONTEXT.push([statement_push]);\n } else {\n WORD_PROM[WORD_STACK.indexOf(word)] = WORD_PROM[WORD_STACK.indexOf(word)] + 1;\n let formatted_context = content[i].split(\" \");\n let statement_push = [];\n for (let i3 = 0; i3 < formatted_context.length; i3++) {\n statement_push.push(cleanup(formatted_context[i3]));\n } WORD_CONTEXT.push([statement_push]);\n WORD_CONTEXT[WORD_STACK.indexOf(word)].push(content[i].split(\" \"));\n }\n }\n }\n}", "constructor(consoleFlag = false) {\n log.debug(\"Constructing semantic...\");\n \n this._currentToken = \"\";\n this._nextToken = \"\";\n this._consoleFlag = consoleFlag;\n \n //so I feel like I'm really \"starting\".\n this.start();\n \n }", "function loadMachine () {\n\n machine_name = 'Untitled'\n var lines = myCodeMirror.getValue().split( /\\r\\n|\\r|\\n|\\n\\r/ );\n new_final_states = \"\";\n new_initial_state = \"\";\n var new_ntapes = -1;\n var transitions_defined = false;\n\n var errmsg;\n var warnings = \"Warnings:\\n\\r\";\n new_transitions = new Array();\n var antecedent;\n var consequent;\n\n var comment_lines = 1;\n error = false;\n for ( i = 0; i < lines.length && !error; i += comment_lines + 1 ) {\n error = false;\n original_line = lines[ i ].replace( /\\s+/g, '' );\n if ( original_line.indexOf( '//' ) == 0 || original_line.length == 0 ) {\n comment_lines = 0;\n }\n else {\n line = original_line.toLowerCase();\n if ( line.indexOf( 'init:' ) == 0 ) {\n if ( line.length <= 5 ) {\n error = true;\n errmsg = \"The <strong>initial state</strong> is not defined\";\n }\n else {\n new_initial_state = original_line.split( ':' )[ 1 ];\n }\n comment_lines = 0;\n }\n\n else if ( line.indexOf( 'accept:' ) == 0 ) {\n if ( line.length <= 7 ) {\n error = true;\n errmsg = \"There are no <strong>final states</strong> defined\";\n }\n else {\n new_final_states = original_line.split( ':' )[ 1 ].split( ',' );\n }\n comment_lines = 0;\n }\n\n else if ( line.indexOf( 'name:' ) == 0 ) {\n machine_name = lines[ i ].split( ':' )[ 1 ].replace( /^\\s+|\\s+$/g, '' );\n comment_lines = 0;\n }\n\n else {\n if ( new_ntapes == -1 ) {\n new_ntapes = line.split( ',' ).length - 1\n if ( new_ntapes < 1 ) {\n error = true;\n errmsg = \"Incorrect instruction in line \" + (i + 1) + \": \" + line;\n }\n }\n if ( !error ) {\n if ( line.indexOf( \"//\" ) > 0 ) {\n line = line.substring( 0, line.indexOf( \"//\" ) );\n original_line = original_line.substring( 0, original_line.indexOf( \"//\" ) );\n }\n transitions_defined = true;\n antecedent = original_line.split( ',' );\n comment_lines = 1;\n\n while ( lines[ i + comment_lines ] && (lines[ i + comment_lines ].indexOf( \"//\" ) == 0) || lines[ i + comment_lines ].length == 0 ) {\n comment_lines++;\n }\n\n if ( lines[ i + comment_lines ] ) {\n consequent_line = lines[ i + comment_lines ].replace( /\\s+/g, '' );\n if ( consequent_line.indexOf( \"//\" ) >= 0 ) {\n consequent_line = consequent_line.substring( 0, consequent_line.indexOf( \"//\" ) );\n }\n consequent = consequent_line.split( ',' );\n }\n\n else {\n error = true;\n errmsg = \"<br/> The second part of the transition in line \" + (i + 1) + \" is not defined\";\n }\n\n if ( !error ) {\n if ( antecedent.length != new_ntapes + 1 ) {\n error = true;\n errmsg = \"Incorrect number of elements in line \" + (i + 1);\n }\n else {\n for ( var j = 1; j < new_ntapes + 1 && !error; j++ ) {\n if ( antecedent[ j ].length != 1 ) {\n error = true;\n errmsg = \"Incorrect element in line \" + (i + 1) + \": symbols must be single characters\";\n if ( antecedent[ j ].length == 0 ) {\n errmsg += \"Use underscore to represent a blank cell\"\n }\n }\n }\n }\n if ( !error ) {\n if ( consequent.length != 2 * new_ntapes + 1 ) {\n error = true;\n errmsg = \"Incorrect number of elements in line \" + (i + comment_lines + 1);\n }\n else {\n for ( var j = 1; j < new_ntapes + 1; j++ ) {\n if ( consequent[ j ].length != 1 ) {\n error = true;\n errmsg =\n \"Incorrect element in line \" + (i + comment_lines + 1) + \": symbols must be single characters\";\n if ( consequent[ j ].length == 0 ) {\n errmsg += \"Use underscore to represent a blank cell\"\n }\n }\n }\n ;\n }\n }\n if ( !error ) {\n for ( var j = 1; j < new_ntapes + 1 && !error; j++ ) {\n if ( consequent[ new_ntapes + j ] != 'l' && consequent[ new_ntapes + j ] != 'r' && consequent[ new_ntapes + j ] != '-' ) {\n error = true;\n errmsg =\n \"Incorrect transition in line \" + (i + comment_lines + 1) + \". Movements must be left (<), right (>) or center (-).\";\n }\n }\n }\n }\n if ( !error ) {\n if ( new_transitions[ original_line ] ) {\n if ( new_transitions[ original_line ] != lines[ i + 1 ].replace( /\\s+/g, '' ) ) {\n error = true;\n errmsg = \"Transition in line \" + (i + 1) + \" is already defined\";\n }\n\n else {\n warnings += \"\\n\\r - Transition in line \" + (i + 1) + \" already defined\";\n }\n\n }\n new_transitions[ original_line ] = lines[ i + comment_lines ].replace( /\\s+/g, '' );\n }\n else {\n comment_lines = 0;\n }\n }\n }\n }\n }\n\n if ( !error ) {\n\n if ( new_initial_state.length == 0 ) {\n error = true;\n errmsg = \"The initial state is not defined\";\n }\n\n else if ( new_final_states.length == 0 ) {\n error = true;\n errmsg = \"No final states defined\";\n }\n\n else if ( !transitions_defined ) {\n error = true;\n errmsg = \"There are no transitions defined\";\n }\n\n else {\n final_states = new_final_states;\n initial_state = new_initial_state;\n ncells = new_ncells;\n n_tapes = new_ntapes;\n state = initial_state;\n transitions = new_transitions;\n machine_loaded = true;\n ready_tapes = 2 * n_tapes;\n return true;\n }\n }\n\n if ( error ) {\n show_messages( '<strong>Error</strong>: ' + errmsg );\n return false;\n }\n}", "function main(data){\n\tvar stack = [[\"main\",0]];\n\tvar next_time = sound.context.currentTime;\n\tvar address = stack[stack.length-1];\n\tvar f_name, line, f;\n\tvar termination_flag = false;\n\twhile(true){\n\t\taddress = stack[stack.length-1];\n\t\tf_name = address[0];\n\t\tline = address[1];\n\t\tf = data.machine[f_name];\n\t\tvar cmd = f[line];\n\t\tconsole.log(stack.toString()\t)\n\t\tconsole.log(\"> \", cmd);\n\t\targs = cmd.split(\" \");\n\n\t\t// terminate \n\t\tif(args[0]==\"terminate\"){\n\t\t\tbreak;\n\t\t}\n\n\t\t// label\n\t\tif(args[0]==\"label\"){\n\t\t\t// nothing needs to be done\n\t\t}\n\n\t\t// jump\n\t\tif(args[0]==\"goto\"){\n\t\t\tgo_here = \"\";\n\t\t\tif(args.length == 2){\n\t\t\t\t// goto label_name\n\t\t\t\tgo_here = args[1]\n\t\t\t}else{\n\t\t\t\t// goto A 0.4\n\t\t\t\t// goto X 0.5 Y 0.2 Z 0.1\n\t\t\t\tr = Math.random(); // number between 0 and 1\n\t\t\t\tprob_sum = 0; \n\t\t\t\tfor(var k=1; k<args.length-1;k+=2){\n\t\t\t\t\t// sum the probabilities as we go\n\t\t\t\t\tprob = parseFloat(args[k+1].replace(\",\",\"\"));\n\t\t\t\t\tprob_sum += prob;\n\t\t\t\t\t// if sum is greater than r, this is our choice.\n\t\t\t\t\tif(prob_sum > r){\n\t\t\t\t\t\t// this is the chosen path\n\t\t\t\t\t\tgo_here = args[k]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(go_here){\n\t\t\t\t// find label\n\t\t\t\tfor(c in f){\n\t\t\t\t\t_args = f[c].split(\" \");\n\t\t\t\t\tif(_args[0] == \"label\" && _args[1] == go_here){\n\t\t\t\t\t\t// update the current stack address to this line\n\t\t\t\t\t\taddress[1] = parseInt(c)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.log(\"jumped to \" + go_here + \", \" + c)\n\t\t\t\tcontinue; // next command, please.\n\t\t\t}else{\n\t\t\t\t// no jump, continue on to next line.\n\t\t\t}\n\t\t}\n\n\t\t// subroutine\n\t\tif(args[0]==\"f\"){\n\t\t\tvar f_name = args[1] \n \t\tstack.push([f_name,0]); // that's all we have to do!\n \t\tcontinue; \n\t\t}\n\n\t\t// play \n\t\tif(args[0]==\"play\"){\n\t\t\tvar section_name = args[1]\n \t\tsound.queueSegment({\n \t\t\twhen: next_time, \n \t\t\tstart: parseFloat(data.sections[section_name].start.toFixed(6)), \n \t\t\tduration: parseFloat(data.sections[section_name].duration.toFixed(6)), \n \t\t\tcallback_onended: null, gain: 1, layer: 0})\n \t\tnext_time += parseFloat(data.sections[section_name].duration.toFixed(6))\n\t\t}\n\n\t\t// determine next address in the stack\n\t\t// 1. advance one line,\n\t\t// 2. check if line exists\n\t\t// \t\t- if not, pop the stack and return to old position in parent subroutine.\n\t\t// 3. repeat until we find a line that exists\n\t\t// 4. if stack is empty, terminate\n\t\twhile(true){\n\t\t\tline += parseInt(1) // 1. advance one line in the subroutine\n\t\t\tif(f.length <= line){\n\t\t\t\t// 2. there are no more lines in the subroutine\n\t\t\t\t// subroutine has finished\n\t\t\t\t// remove it from stack\n\t\t\t\tstack.pop();\n\t\t\t\tif(stack.length==0){\n\t\t\t\t\t// stack is empty\n\t\t\t\t\t// main has finished\n\t\t\t\t\t// nothing more to do, terminate\n\t\t\t\t\ttermination_flag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}else{\n\t\t\t\t\t// return to old position in parent subroutine\n\t\t\t\t\taddress = stack[stack.length-1];\n\t\t\t\t\tf_name = address[0];\n\t\t\t\t\tf = data.machine[f_name];\n\t\t\t\t\tline = address[1];\n\t\t\t\t\tcontinue; \n\t\t\t\t\t// 3. loop around, repeat until we find a line that exists\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t// we found a line!\n\t\t\t\taddress[1] = line // update stack with new line\n\t\t\t\tbreak; // leave the loop\n\t\t\t}\n\t\t}\n\t\tif(termination_flag) break;\n\t}\n\n\tconsole.log(\"done\");\n}", "parse() {\n while (this.shouldContinue()) {\n const c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case Tokenizer_State.Text: {\n this.stateText(c);\n break;\n }\n case Tokenizer_State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case Tokenizer_State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case Tokenizer_State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case Tokenizer_State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case Tokenizer_State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case Tokenizer_State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case Tokenizer_State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case Tokenizer_State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case Tokenizer_State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case Tokenizer_State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case Tokenizer_State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case Tokenizer_State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case Tokenizer_State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case Tokenizer_State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case Tokenizer_State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case Tokenizer_State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case Tokenizer_State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case Tokenizer_State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case Tokenizer_State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case Tokenizer_State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case Tokenizer_State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case Tokenizer_State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case Tokenizer_State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case Tokenizer_State.InNamedEntity: {\n this.stateInNamedEntity(c);\n break;\n }\n case Tokenizer_State.BeforeEntity: {\n this.stateBeforeEntity(c);\n break;\n }\n case Tokenizer_State.InHexEntity: {\n this.stateInHexEntity(c);\n break;\n }\n case Tokenizer_State.InNumericEntity: {\n this.stateInNumericEntity(c);\n break;\n }\n default: {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n }\n this.index++;\n }\n this.cleanup();\n }", "getText(numWords = 100) {\n const objKeys = Object.keys(this.markovChain);\n // console.log(\"objKeys = \", objKeys);\n let chosenWord;\n let currNumWords = text.length;\n let randomKeyIdx = this._getRandomNum(objKeys);\n let key = objKeys[randomKeyIdx];\n let text = [];\n\n while (chosenWord !== null && currNumWords <= numWords) {\n console.log(\"key = \", key);\n let wordList = this.markovChain[key];\n console.log(\"wordlist = \", wordList);\n let randomWordIdx = this._getRandomNum(wordList);\n\n if (wordList.length === 1) chosenWord = wordList[0];\n \n chosenWord = wordList[randomWordIdx];\n // console.log(\"chosenWord = \", chosenWord);\n \n key = chosenWord;\n text.push(chosenWord);\n currNumWords = text.length;\n }\n console.log(\"text = \", text.join(' '));\n return text.join(' ');\n }", "function doWhatItSays() {\n //create intruct object\n var instruction = {\n cmd: \"\",\n search: \"\"\n };\n\n //Load Text and write data temp variable\n fs.readFile(\"random.txt\", \"utf8\", function(error, data) {\n //Check error\n if (error) {\n return console.log(error);\n }\n //No error, read data.\n else {\n instruction.cmd = data.split(\",\")[0];\n instruction.search = data.split(\",\")[1];\n\n switch (instruction.cmd) {\n case \"spotify-this-song\":\n spotifyThis(instruction.search);\n break;\n case \"concert-this\":\n concertThis(instruction.search);\n break;\n case \"movie-this\":\n movieThis(instruction.search);\n break;\n }\n }\n });\n}", "static fromString(mnemonic) {\n return new Mnemonic(mnemonic.split(\" \"));\n }", "function analyze(sourceCode) {\n machineState = 1;\n currentLineNumber = 1;\n currentLexemeCode = 1;\n definedIdns = [];\n $('.errors-container').empty();\n var lexemes = parseLexemes(sourceCode);\n lexemes = setIdnsConstsCodes(lexemes);\n lexemes = fixMinus(lexemes);\n lexemes = setLexemeCodes(lexemes);\n printLexemes(lexemes);\n printConsts(lexemes);\n printIdns(lexemes);\n var syntaxAnalyzer = new SyntaxAnalyzer(lexemes);\n syntaxAnalyzer.analyze();\n printSyntaxErrors(syntaxAnalyzer.errors);\n\n const lexemeChain = lexemes.map((lexeme) => {\n let type = '';\n switch (lexeme.lexemeCode) {\n case 32: type = 'idn'; break;\n case 33: type = 'con'; break;\n default: type = 'operation'; break;\n }\n return new PolizItem(lexeme.lexemeName, type);\n });\n\n const polizBuilder = new PolizBuilder();\n const poliz = polizBuilder.build(lexemeChain);\n $('#poliz-chain').empty();\n poliz.chain.forEach(item => {\n $('#poliz-chain').append(item.token + ' ');\n });\n\n $('#poliz-history tbody').empty();\n polizBuilder.history.forEach(historyItem => {\n $('#poliz-history tbody').append(\n `<tr><td>${historyItem.lexeme.token}</td>\n <td>${historyItem.stack}</td>\n <td>${historyItem.poliz}</td>\n </tr>`\n );\n });\n\n $('#poliz-labels tbody').empty();\n poliz.polizLabels.forEach(label => {\n $('#poliz-labels tbody').append(\n `<tr><td>${label.label}</td>\n <td>${label.position}</td>\n </tr>`\n );\n });\n\n const polizExecutor = new PolizExecutor(\n poliz.chain, poliz.polizLabels, poliz.polizCells, idns\n );\n\n polizExecutor.execute();\n $('#console').empty();\n polizExecutor.outputData.forEach(item => {\n $('#console').append(\n `<div>${item.token} ${item.value}</div>`);\n });\n\n $('#poliz-execution-history tbody').empty();\n polizExecutor.history.forEach(item => {\n $('#poliz-execution-history tbody').append(\n `<tr><td>${item.lexeme}</td>\n <td>${item.stack}</td>\n </tr>`\n );\n });\n Array.prototype.last = function() {\n return this[this.length-1];\n };\n Array.prototype.clone = function() {\n return this.slice(0);\n };\n\n}", "analyze(text) {\n this.text = this.purify(text);\n this.index = 0;\n this.list = [];\n this.buffer = \"\";\n\n while (this.index < this.text.length) {\n this.state.transference(this.index, true);\n }\n return this.list;\n }", "function processText(text) {\n var displayText = \"\";\n var offset = 0;\n var start = -1;\n var positiveRanges = [];\n var negativeRanges = [];\n var marked = [];\n\n for (var i = 0; i < text.length; i++) {\n var char = text[i];\n var array = null;\n\n switch (char) {\n case Importance.POSITIVE:\n array = positiveRanges;\n break;\n case Importance.NEGATIVE:\n array = negativeRanges;\n break;\n default:\n displayText += char;\n marked.push(false);\n continue;\n }\n\n var relIndex = i - offset;\n if (start === -1) {\n start = relIndex;\n } else {\n array.push({\n start: start,\n end: relIndex\n });\n start = -1;\n }\n offset++;\n }\n\n vm.game.displayText = displayText;\n vm.game.marked = marked;\n vm.game.ranges = {\n positive: positiveRanges,\n negative: negativeRanges\n };\n }", "function doIt() {\n\n // read instructions from random.txt \n fs.readFile(\"random.txt\", \"utf8\", function(error, data) {\n\n if (error) {\n return console.log(error);\n }\n\n // split data into two indexes\n var dataArr = data.split(\",\");\n\n // assign data to original purposes\n command = dataArr[0];\n input = dataArr[1];\n\n // call song for new data\n switch (command) {\n case \"concert-this\":\n concert();\n break;\n \n case \"spotify-this-song\":\n song();\n break;\n \n case \"movie-this\":\n movie();\n }\n })\n}", "static* all_predictors(string, max_depth) {\n let init_ctx = first_chars(string, max_depth)\n let predictor = new Predictor(init_ctx, max_depth)\n yield predictor\n for (let i = max_depth; i < string.length; i++) {\n predictor = predictor.read(string[i])\n yield predictor\n }\n }", "function PredictiveParsing(text, M) {\n let cursor = 0,\n root = {'rule': 'Expr', 'production': []},\n // a node and its rule name are kept in alternating sequence inside stack\n // in order to construct a concrete syntax tree\n // source: https://stackoverflow.com/a/27206881/1374078\n stack = ['$', root, 'Expr'];\n\n text += '$';\n\n while(topOf(stack) !== '$') {\n if(topOf(stack) === text[cursor]) {\n let value = stack.pop();\n let node = stack.pop();\n cursor += 1;\n while(cursor < text.length && isDigit(node.rule) && isDigit(text[cursor])) {\n value += text[cursor];\n cursor += 1;\n }\n node.production.push(value);\n } else {\n let production = [].concat(M[topOf(stack)][text[cursor]]);\n let node_name = stack.pop();\n let node = stack.pop();\n\n production.forEach(term => {\n node.production.push({'rule': term, 'production': []});\n });\n\n if(production[0] !== 'Epsilon') {\n node.production.slice().reverse().forEach(node => {\n stack.push(node);\n stack.push(node.rule);\n });\n }\n }\n }\n\n return root;\n}", "function lexer(strings)\n{ \n var words = strings;\n\n //define a series of look up tables\n\n // all the tinctures\n var tinctures = new Array(new tincture(\"azure\",\"blue\",false,\"#003399\"),new tincture(\"gules\",\"red\",false,\"#CC0000\"), new tincture(\"sable\",\"black\",false,\"#000000\"), new tincture(\"purpure\",\"purple\",false,\"#990099\"),new tincture(\"vert\",\"green\",false,\"#339933\"), new tincture(\"or\",\"gold/yellow\",true,\"#FFCC00\"),new tincture(\"argent\",\"silver/white\",true,\"#E8E8E8\"));\n\n \n var partitions = new Array(new partition(\"bend\",\"split diagonally from upper left to lower right\",2,draw_bend), new partition(\"fess\",\"halved horizontally\",2,draw_fess), new partition(\"pale\",\"halved vertically\",2,draw_pale), new partition(\"saltire\",\"quartered diagonally like an x\",4,draw_saltire), new partition(\"cross\",\"divided into four quarters like a +\",4,draw_cross), new partition(\"quarterly\",\"divided into four quarters like a +\",4), new partition(\"chevron\",\"divided like a chevron a ^ shape\",2), new partition(\"pall\",\"divided into three parts in a Y shape\",3) );\n\n var linetypes = new Array(new linetype(\"wavy\",\"in a wavy pattern\"), new linetype(\"indented\",\"in a spikey pattern\"), new linetype(\"invected\",\"in a bumpy pattern\"), new linetype(\"sengrailed\",\"in an inverted bumpy pattern\"), new linetype(\"nebuly\",\"in a bloby pattern\"), new linetype(\"embattled\",\"in a square pattern\"), new linetype(\"dovetailed\",\"in a dovetail shape pattern\"), new linetype(\"potenty\",\"in a T shaped pattern\"));\n\n var charge_prefixis = new Array( new prefix(\"a\",1), new prefix(\"one\",1), new prefix(\"two\",2) ,new prefix(\"three\",3), new prefix(\"four\",4), new prefix(\"five\",5),new prefix(\"six\",6), new prefix(\"seven\",7),new prefix(\"eight\",8), new prefix(\"nine\",9));\n\n var secondary_prefixis = new Array(\"between\", \"beneath\");\n var ordinarys = new Array(new ordinary(\"bend\",\"bendy\",\"diagonal bar going from upper left to lower right\",draw_ordinary_bend), new ordinary(\"bar\",\"barry\",\"horizontal bar\",draw_ordinary_bar), new ordinary(\"pale\",\"pallets\",\"vertical bar\",draw_ordinary_pale), new ordinary(\"saltire\",\"\",\"solid x shape\",draw_ordinary_saltire), new ordinary(\"cross\",\"\",\"solid + shape\",draw_ordinary_cross), new ordinary(\"chevron\",\"chevronny\",\"inverted V shape\"), new ordinary(\"pall\",\"\",\"solid Y shape\"), new ordinary(\"chief\",\"\",\"horizontal bar at the top of the field\",draw_ordinary_chief), new ordinary(\"bordure\",\"\",\"solid border around the current field\"), new ordinary(\"escutcheon\",\"escutcheons\",\"shield\"), new ordinary(\"mullet\",\"mullets\",\"five poited star\"), new ordinary(\"delf\",\"check\",\"a square\", draw_ordinary_square ) ,new ordinary(\"bee\",\"bees\",\"a bee\", draw_image) );\n\n console.log(\"Right here mofo\");\n console.log(ordinarys[0]);\n\n var tokens = new Array();\n\n // for each word\n for(var i=0; i<strings.length; i++)\n {\n\n // SYNTAX ANALYSIS (Small amonut)\n\n // check that party and parted are corectly followed by per\n if (words[i]===\"party\" || words[i]===\"parted\") \n {\n if (words[i+1]!==\"per\") \n {\n alert(words[i] + \" must be followed by per.\");\n }\n }\n\n //check that per is correctly followed by a partition\n if (words[i]===\"per\")\n {\n var is_partition = false\n for(var x = 0; x<partitions.length; x++)\n { \n //console.log(partitions[x].blazon);\n //console.log(x);\n if (words[i+1]===partitions[x].blazon)\n {\n //console.log(\"true\");\n is_partition= true;\n }\n } \n if(!is_partition)\n {\n alert(\"The word following \\\"per\\\" must be a type of partition.\");\n } \n \n // should really have poped the per into a token but untill refactor this works\n \n // most hackey work around of all time but still...\n i++;\n\n // check that the word after the partition is either:\n // another partition \n // a tincture\n // a fur \n // a type of line for the division (ensure the next word is one of the above)\n\n // build tokens of line tpyes\n //console.log(\"build tokens of line types\");\n for(var j=0; j<partitions.length; j++) \n {\n //console.log(strings[i]);\n //console.log(partitions[j].blazon);\n\n if(words[i]===partitions[j].blazon)\n {\n if (words[i-1]!==\"per\") \n {\n alert(\"Partitions must be prefixed by \\\"per\\\".\");\n return;\n } \n //create a new partition to be as a token for parsing\n var current_token = clone_partition(partitions[j]);\n // bend can be reversed with the postfix sinister\n if(words[i]==\"bend\" && words[i+1]==\"sinister\")\n {\n //concatonate sinister to the current charge\n words[i]=\"bend sinister\";\n //remove the word at i + one (sinister)\n words.splice(i+1,1);\n current_token.blazon=\"bend sinister\";\n current_token.description=\"split diagonally from upper right to lower left\";\n current_token.draw = draw_bend_sinister;\n //console.log(words);\n }\n else\n {\n if(words[i+1]===\"sinister\")\n {\n alert(\"The postfix \\\"sinister\\\" can only be applied to bend\");\n } \n }\n var has_linetype = false;\n for(var x = 0; x < linetypes.length; x++)\n {\n if(words[i+1] === linetypes[x].name)\n {\n has_linetype = true;\n current_token.linetype= new linetype(linetypes[x].name,linetypes[x].description);\n console.log(\"generate token \" + words[i] + \" \" + words[i+1] );\n words.splice(i,2);\n }\n }\n if(!has_linetype)\n {\n console.log(\"generate token \" + words[i]);\n words.splice(i,1);\n }\n tokens.push(current_token);\n console.log(tokens.toString());\n i--; // move index back due to removing from array\n }//if words[i] is a partition\n }\n }\n\n\n //console.log(\"check for charges\");\n // check for charges\n check_for_charges:\n for (var j=0; j< charge_prefixis.length; j++)\n {\n // if this word is a prefix\n if(words[i]===charge_prefixis[j].string)\n {\n console.log(\"prefix found \\\"\" + words[i] + \"\\\"\");\n\n // the token we are going to build\n var current_token;\n\n // the next word an ordinary?\n var is_ordinary = false;\n for (var x = 0; x < ordinarys.length; x++)\n {\n if(words[i+1]===ordinarys[x].blazon || words[i+1]===(ordinarys[x].plural))\n {\n current_token = clone_ordinary(ordinarys[x]);\n current_token.quantity=charge_prefixis[j].quantity;\n if((words[i+1]===\"bend\" || words[i+1]===\"bendy\") && words[i+2]===\"sinister\" )\n {\n //concatonate sinister to the current charge\n words[i+1]=\"bend sinister\";\n //remove the word at i + 2 (sinister)\n words.splice(i+2,1);\n current_token.blazon=\"bend sinister\";\n current_token.description=\"split diagonally from upper right to lower left\";\n current_token.draw = draw_ordinary_bend_sinister;\n }\n\n console.log(\"charge is an ordinary or geometric \\\"\"+ words[i+1]+ \"\\\"\");\n is_ordinary = true;\n }\n }\n\n\n // if the charge is an ordinary the next word can be either a line type\n // or a tincture or both\n if (is_ordinary)\n {\n console.log(\"charge is still an ordinary.\");\n var valid_ordinary = false;\n //check if the next word is a tincture\n //console.log(words[i+2]);\n check_tincture:\n for (var x = 0; x < tinctures.length; x++)\n {\n //console.log(words[i+2]);\n //console.log(tinctures[x].tincture);\n if(words[i+2]===tinctures[x].tincture)\n {\n //console.log(\"tincture found \" +tinctures[x].tincture);\n current_token.tincture = clone_tincture(tinctures[x]); \n\n\n valid_ordinary = true;\n\n words.splice(i,3);\n i--;\n console.log(words.toString());\n break check_tincture;\n }\n } \n //check for line tpye\n check_for_line_type:\n for(var x = 0; x < linetypes.length; x++)\n {\n if(words[i+2] === linetypes[x].name)\n {\n current_token.linetype=linetypes[x];\n\n // check for ticture after line type\n for (var x = 0; x < tinctures.length; x++)\n {\n if(words[i+3]==tinctures[x].tincture)\n {\n current_token.tincture = clone_tincture(tinctures[x]); \n valid_ordinary = true;\n console.log(words.toString());\n words.splice(i,4);\n i--;\n console.log(words.toString());\n break check_for_line_type;\n }\n } \n\n }\n }//for\n if (valid_ordinary)\n {\n tokens.push(current_token);\n console.log(tokens);\n break check_for_charges;\n }\n }\n\n\n // If the next word isn't an ordinary then it may or may not be \n // a semi formal charge in which case panic\n else //(!is_ordinary)\n {\n console.log(\"Non-ordinary charge\");\n\n // keep going through the set of strings untill:\n // two tinctures or furs adjacent to each other \n // a new partition\n // a new charge pre-fix\n // current_token = new ordinary(blazon,plural,description,draw)\n\n var blazon = \" \"; \n\n var x =1;\n\n while(words[i+x]!=\"per\" && i+x < words.length)\n {\n console.log(\"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\");\n\n for(var y = 0; y < charge_prefixis.length; y++)\n {\n if(words[i+x] == charge_prefixis[y])\n {\n break end_of_charge;\n }\n }\n for (var y = 0; y < tinctures.length; y++)\n {\n\n if(words[i+x]==tinctures[x].tincture && words[i+x+1]==tinctures[y].tincture)\n {\n break end_of_charge;\n }\n } \n\n // add this word to the description\n blazon=blazon.concat(\" \");\n blazon=blazon.concat(words.splice(i+x));\n x++;\n console.log(\"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\");\n }\n end_of_charge:\n current_token = new ordinary(blazon,\"\",blazon,null);\n tokens.push(current_token);\n }\n }\n }// check for charges\n\n // check for tinctures and furs remaining \n var has_revemoved = false;\n for (var x = 0; x < tinctures.length; x++) {\n if (words[i]===tinctures[x].tincture) \n {\n console.log(words.toString());\n console.log(\"found ticture \" + tinctures[x].tincture)\n var current_token = clone_tincture(tinctures[x]); \n tokens.push(current_token);\n words.splice(i,1);\n i--;\n console.log(words.toString());\n console.log(tokens);\n console.log(tokens[0]);\n \n break;\n }\n }//checking for tictures\n }//for loop\n\n return tokens;\n}//lexing function", "function analyze(str) {\n function createResultRecord() {\n resultsArr.push(`(${getToken(currentState)}, ${tokenString})`)\n }\n const initStrArr = str.trim().split(\"\")\n\n // Array contains previous states. Used to go back if sequence failed\n let statesBuffer = []\n let currentState = 0\n let tokenString = \"\"\n let resultsArr = [] // Results array in format [\"(number, 2)\", (id, asd), ...]\n \n for(let index = 0; index < initStrArr.length; index++) {\n function iterateBack() {\n let prevStep = 1\n let revercedBufferArr = statesBuffer.slice(1).reverse()\n\n // From the end of buffered states iterate and find first successful state\n while(!getToken(revercedBufferArr[prevStep]) &&\n prevStep <= revercedBufferArr.length) {\n prevStep += 1\n }\n // Set params to last known successfull state\n currentState = revercedBufferArr[prevStep]\n tokenString = tokenString.substr(0, tokenString.length - prevStep)\n createResultRecord()\n tokenString = \"\"\n currentState = 0\n index -= prevStep + 1\n }\n\n const char = initStrArr[index]\n const newState = getNewState(currentState, char)\n statesBuffer.push(currentState)\n\n if (char == \" \") { continue; }\n \n if (newState) {\n currentState = newState\n tokenString += char\n } else {\n if (!tokenTable[currentState]) {\n iterateBack(); continue;\n }\n createResultRecord()\n tokenString = char\n currentState = 0\n currentState = getNewState(currentState, char)\n }\n \n if(index === initStrArr.length - 1) {\n if(getToken(currentState)) {\n createResultRecord()\n } else {\n statesBuffer.push(currentState)\n index += 1\n iterateBack()\n }\n }\n }\n return resultsArr.join(\"; \") \n}", "function callGenerateandOutput() {\n\n multiMarkov.generate();\n outputResult(multiMarkov);\n\n}", "function runProgram() {\n\t// Clear the canvas\n\tbackground(255);\n\n\t// TODO: Get the phrase in the text box and convert it to upper case\n\tvar words;\n\t//... add your code here.\n\n // Draw the Matrix\n\tdrawMatrix(words)\n}", "function mel(hljs) {\n return {\n name: 'MEL',\n keywords:\n 'int float string vector matrix if else switch case default while do for in break ' +\n 'continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic ' +\n 'addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey ' +\n 'affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve ' +\n 'alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor ' +\n 'animDisplay animView annotate appendStringArray applicationName applyAttrPreset ' +\n 'applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx ' +\n 'artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu ' +\n 'artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand ' +\n 'assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface ' +\n 'attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu ' +\n 'attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp ' +\n 'attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery ' +\n 'autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults ' +\n 'bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership ' +\n 'bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType ' +\n 'boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu ' +\n 'buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge ' +\n 'cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch ' +\n 'catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox ' +\n 'character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp ' +\n 'checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip ' +\n 'clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore ' +\n 'closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter ' +\n 'cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color ' +\n 'colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp ' +\n 'colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem ' +\n 'componentEditor compositingInterop computePolysetVolume condition cone confirmDialog ' +\n 'connectAttr connectControl connectDynamic connectJoint connectionInfo constrain ' +\n 'constrainValue constructionHistory container containsMultibyte contextInfo control ' +\n 'convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation ' +\n 'convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache ' +\n 'cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel ' +\n 'cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver ' +\n 'cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor ' +\n 'createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer ' +\n 'createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse ' +\n 'currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx ' +\n 'curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface ' +\n 'curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox ' +\n 'defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete ' +\n 'deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes ' +\n 'delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo ' +\n 'dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable ' +\n 'disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected ' +\n 'displayColor displayCull displayLevelOfDetail displayPref displayRGBColor ' +\n 'displaySmoothness displayStats displayString displaySurface distanceDimContext ' +\n 'distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct ' +\n 'doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator ' +\n 'duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression ' +\n 'dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor ' +\n 'dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers ' +\n 'editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor ' +\n 'editorTemplate effector emit emitter enableDevice encodeString endString endsWith env ' +\n 'equivalent equivalentTol erf error eval evalDeferred evalEcho event ' +\n 'exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp ' +\n 'expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof ' +\n 'fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo ' +\n 'filetest filletCurve filter filterCurve filterExpand filterStudioImport ' +\n 'findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster ' +\n 'finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar ' +\n 'floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo ' +\n 'fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint ' +\n 'frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss ' +\n 'geometryConstraint getApplicationVersionAsFloat getAttr getClassification ' +\n 'getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes ' +\n 'getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender ' +\n 'glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl ' +\n 'gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid ' +\n 'gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap ' +\n 'HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor ' +\n 'HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached ' +\n 'HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel ' +\n 'headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey ' +\n 'hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender ' +\n 'hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox ' +\n 'iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ' +\n 'ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ' +\n 'ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform ' +\n 'insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance ' +\n 'instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp ' +\n 'interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf ' +\n 'isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect ' +\n 'itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx ' +\n 'jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner ' +\n 'keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx ' +\n 'keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx ' +\n 'keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx ' +\n 'keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor ' +\n 'layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList ' +\n 'lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep ' +\n 'listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory ' +\n 'listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation ' +\n 'listNodeTypes listPanelCategories listRelatives listSets listTransforms ' +\n 'listUnselected listerEditor loadFluid loadNewShelf loadPlugin ' +\n 'loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log ' +\n 'longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive ' +\n 'makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext ' +\n 'manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx ' +\n 'manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout ' +\n 'menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp ' +\n 'mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move ' +\n 'moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute ' +\n 'nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast ' +\n 'nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint ' +\n 'normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect ' +\n 'nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref ' +\n 'nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType ' +\n 'objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface ' +\n 'offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit ' +\n 'orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier ' +\n 'paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration ' +\n 'panelHistory paramDimContext paramDimension paramLocator parent parentConstraint ' +\n 'particle particleExists particleInstancer particleRenderInfo partition pasteKey ' +\n 'pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture ' +\n 'pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo ' +\n 'pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult ' +\n 'pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend ' +\n 'polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal ' +\n 'polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge ' +\n 'polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge ' +\n 'polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet ' +\n 'polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet ' +\n 'polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection ' +\n 'polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge ' +\n 'polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet ' +\n 'polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix ' +\n 'polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut ' +\n 'polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet ' +\n 'polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge ' +\n 'polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex ' +\n 'polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection ' +\n 'polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection ' +\n 'polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint ' +\n 'polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate ' +\n 'polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge ' +\n 'polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing ' +\n 'polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet ' +\n 'polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace ' +\n 'popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer ' +\n 'projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx ' +\n 'propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd ' +\n 'python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection ' +\n 'radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl ' +\n 'readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference ' +\n 'referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE ' +\n 'registerPluginResource rehash reloadImage removeJoint removeMultiInstance ' +\n 'removePanelCategory rename renameAttr renameSelectionList renameUI render ' +\n 'renderGlobalsNode renderInfo renderLayerButton renderLayerParent ' +\n 'renderLayerPostProcess renderLayerUnparent renderManip renderPartition ' +\n 'renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor ' +\n 'renderWindowSelectContext renderer reorder reorderDeformers requires reroot ' +\n 'resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget ' +\n 'reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx ' +\n 'rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout ' +\n 'runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage ' +\n 'saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale ' +\n 'scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor ' +\n 'sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable ' +\n 'scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt ' +\n 'searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey ' +\n 'selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType ' +\n 'selectedNodes selectionConnection separator setAttr setAttrEnumResource ' +\n 'setAttrMapping setAttrNiceNameResource setConstraintRestPosition ' +\n 'setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr ' +\n 'setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe ' +\n 'setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag ' +\n 'setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject ' +\n 'setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets ' +\n 'shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare ' +\n 'shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField ' +\n 'shortNameOf showHelp showHidden showManipCtx showSelectionInTitle ' +\n 'showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface ' +\n 'size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep ' +\n 'snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound ' +\n 'soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort ' +\n 'spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString ' +\n 'startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp ' +\n 'stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex ' +\n 'stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex ' +\n 'stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString ' +\n 'stringToStringArray strip stripPrefixFromName stroke subdAutoProjection ' +\n 'subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV ' +\n 'subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror ' +\n 'subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease ' +\n 'subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring ' +\n 'surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton ' +\n 'symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext ' +\n 'texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext ' +\n 'texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text ' +\n 'textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList ' +\n 'textToShelf textureDisplacePlane textureHairColor texturePlacementContext ' +\n 'textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath ' +\n 'toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower ' +\n 'toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper ' +\n 'trace track trackCtx transferAttributes transformCompare transformLimits translator ' +\n 'trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence ' +\n 'twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit ' +\n 'unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink ' +\n 'uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane ' +\n 'viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex ' +\n 'waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire ' +\n 'wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform',\n illegal: '</',\n contains: [\n hljs.C_NUMBER_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n {\n className: 'string',\n begin: '`', end: '`',\n contains: [hljs.BACKSLASH_ESCAPE]\n },\n { // eats variables\n begin: '[\\\\$\\\\%\\\\@](\\\\^\\\\w\\\\b|#\\\\w+|[^\\\\s\\\\w{]|{\\\\w+}|\\\\w+)'\n },\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ]\n };\n}", "function mel(hljs) {\n return {\n name: 'MEL',\n keywords:\n 'int float string vector matrix if else switch case default while do for in break ' +\n 'continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic ' +\n 'addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey ' +\n 'affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve ' +\n 'alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor ' +\n 'animDisplay animView annotate appendStringArray applicationName applyAttrPreset ' +\n 'applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx ' +\n 'artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu ' +\n 'artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand ' +\n 'assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface ' +\n 'attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu ' +\n 'attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp ' +\n 'attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery ' +\n 'autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults ' +\n 'bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership ' +\n 'bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType ' +\n 'boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu ' +\n 'buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge ' +\n 'cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch ' +\n 'catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox ' +\n 'character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp ' +\n 'checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip ' +\n 'clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore ' +\n 'closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter ' +\n 'cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color ' +\n 'colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp ' +\n 'colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem ' +\n 'componentEditor compositingInterop computePolysetVolume condition cone confirmDialog ' +\n 'connectAttr connectControl connectDynamic connectJoint connectionInfo constrain ' +\n 'constrainValue constructionHistory container containsMultibyte contextInfo control ' +\n 'convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation ' +\n 'convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache ' +\n 'cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel ' +\n 'cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver ' +\n 'cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor ' +\n 'createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer ' +\n 'createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse ' +\n 'currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx ' +\n 'curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface ' +\n 'curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox ' +\n 'defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete ' +\n 'deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes ' +\n 'delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo ' +\n 'dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable ' +\n 'disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected ' +\n 'displayColor displayCull displayLevelOfDetail displayPref displayRGBColor ' +\n 'displaySmoothness displayStats displayString displaySurface distanceDimContext ' +\n 'distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct ' +\n 'doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator ' +\n 'duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression ' +\n 'dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor ' +\n 'dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers ' +\n 'editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor ' +\n 'editorTemplate effector emit emitter enableDevice encodeString endString endsWith env ' +\n 'equivalent equivalentTol erf error eval evalDeferred evalEcho event ' +\n 'exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp ' +\n 'expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof ' +\n 'fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo ' +\n 'filetest filletCurve filter filterCurve filterExpand filterStudioImport ' +\n 'findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster ' +\n 'finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar ' +\n 'floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo ' +\n 'fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint ' +\n 'frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss ' +\n 'geometryConstraint getApplicationVersionAsFloat getAttr getClassification ' +\n 'getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes ' +\n 'getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender ' +\n 'glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl ' +\n 'gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid ' +\n 'gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap ' +\n 'HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor ' +\n 'HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached ' +\n 'HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel ' +\n 'headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey ' +\n 'hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender ' +\n 'hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox ' +\n 'iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ' +\n 'ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ' +\n 'ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform ' +\n 'insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance ' +\n 'instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp ' +\n 'interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf ' +\n 'isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect ' +\n 'itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx ' +\n 'jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner ' +\n 'keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx ' +\n 'keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx ' +\n 'keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx ' +\n 'keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor ' +\n 'layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList ' +\n 'lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep ' +\n 'listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory ' +\n 'listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation ' +\n 'listNodeTypes listPanelCategories listRelatives listSets listTransforms ' +\n 'listUnselected listerEditor loadFluid loadNewShelf loadPlugin ' +\n 'loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log ' +\n 'longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive ' +\n 'makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext ' +\n 'manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx ' +\n 'manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout ' +\n 'menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp ' +\n 'mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move ' +\n 'moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute ' +\n 'nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast ' +\n 'nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint ' +\n 'normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect ' +\n 'nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref ' +\n 'nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType ' +\n 'objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface ' +\n 'offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit ' +\n 'orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier ' +\n 'paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration ' +\n 'panelHistory paramDimContext paramDimension paramLocator parent parentConstraint ' +\n 'particle particleExists particleInstancer particleRenderInfo partition pasteKey ' +\n 'pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture ' +\n 'pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo ' +\n 'pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult ' +\n 'pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend ' +\n 'polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal ' +\n 'polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge ' +\n 'polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge ' +\n 'polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet ' +\n 'polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet ' +\n 'polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection ' +\n 'polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge ' +\n 'polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet ' +\n 'polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix ' +\n 'polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut ' +\n 'polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet ' +\n 'polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge ' +\n 'polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex ' +\n 'polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection ' +\n 'polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection ' +\n 'polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint ' +\n 'polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate ' +\n 'polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge ' +\n 'polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing ' +\n 'polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet ' +\n 'polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace ' +\n 'popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer ' +\n 'projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx ' +\n 'propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd ' +\n 'python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection ' +\n 'radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl ' +\n 'readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference ' +\n 'referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE ' +\n 'registerPluginResource rehash reloadImage removeJoint removeMultiInstance ' +\n 'removePanelCategory rename renameAttr renameSelectionList renameUI render ' +\n 'renderGlobalsNode renderInfo renderLayerButton renderLayerParent ' +\n 'renderLayerPostProcess renderLayerUnparent renderManip renderPartition ' +\n 'renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor ' +\n 'renderWindowSelectContext renderer reorder reorderDeformers requires reroot ' +\n 'resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget ' +\n 'reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx ' +\n 'rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout ' +\n 'runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage ' +\n 'saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale ' +\n 'scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor ' +\n 'sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable ' +\n 'scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt ' +\n 'searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey ' +\n 'selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType ' +\n 'selectedNodes selectionConnection separator setAttr setAttrEnumResource ' +\n 'setAttrMapping setAttrNiceNameResource setConstraintRestPosition ' +\n 'setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr ' +\n 'setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe ' +\n 'setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag ' +\n 'setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject ' +\n 'setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets ' +\n 'shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare ' +\n 'shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField ' +\n 'shortNameOf showHelp showHidden showManipCtx showSelectionInTitle ' +\n 'showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface ' +\n 'size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep ' +\n 'snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound ' +\n 'soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort ' +\n 'spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString ' +\n 'startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp ' +\n 'stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex ' +\n 'stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex ' +\n 'stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString ' +\n 'stringToStringArray strip stripPrefixFromName stroke subdAutoProjection ' +\n 'subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV ' +\n 'subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror ' +\n 'subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease ' +\n 'subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring ' +\n 'surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton ' +\n 'symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext ' +\n 'texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext ' +\n 'texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text ' +\n 'textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList ' +\n 'textToShelf textureDisplacePlane textureHairColor texturePlacementContext ' +\n 'textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath ' +\n 'toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower ' +\n 'toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper ' +\n 'trace track trackCtx transferAttributes transformCompare transformLimits translator ' +\n 'trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence ' +\n 'twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit ' +\n 'unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink ' +\n 'uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane ' +\n 'viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex ' +\n 'waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire ' +\n 'wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform',\n illegal: '</',\n contains: [\n hljs.C_NUMBER_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n {\n className: 'string',\n begin: '`', end: '`',\n contains: [hljs.BACKSLASH_ESCAPE]\n },\n { // eats variables\n begin: '[\\\\$\\\\%\\\\@](\\\\^\\\\w\\\\b|#\\\\w+|[^\\\\s\\\\w{]|{\\\\w+}|\\\\w+)'\n },\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ]\n };\n}", "function mel(hljs) {\n return {\n name: 'MEL',\n keywords:\n 'int float string vector matrix if else switch case default while do for in break ' +\n 'continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic ' +\n 'addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey ' +\n 'affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve ' +\n 'alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor ' +\n 'animDisplay animView annotate appendStringArray applicationName applyAttrPreset ' +\n 'applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx ' +\n 'artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu ' +\n 'artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand ' +\n 'assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface ' +\n 'attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu ' +\n 'attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp ' +\n 'attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery ' +\n 'autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults ' +\n 'bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership ' +\n 'bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType ' +\n 'boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu ' +\n 'buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge ' +\n 'cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch ' +\n 'catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox ' +\n 'character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp ' +\n 'checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip ' +\n 'clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore ' +\n 'closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter ' +\n 'cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color ' +\n 'colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp ' +\n 'colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem ' +\n 'componentEditor compositingInterop computePolysetVolume condition cone confirmDialog ' +\n 'connectAttr connectControl connectDynamic connectJoint connectionInfo constrain ' +\n 'constrainValue constructionHistory container containsMultibyte contextInfo control ' +\n 'convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation ' +\n 'convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache ' +\n 'cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel ' +\n 'cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver ' +\n 'cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor ' +\n 'createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer ' +\n 'createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse ' +\n 'currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx ' +\n 'curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface ' +\n 'curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox ' +\n 'defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete ' +\n 'deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes ' +\n 'delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo ' +\n 'dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable ' +\n 'disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected ' +\n 'displayColor displayCull displayLevelOfDetail displayPref displayRGBColor ' +\n 'displaySmoothness displayStats displayString displaySurface distanceDimContext ' +\n 'distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct ' +\n 'doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator ' +\n 'duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression ' +\n 'dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor ' +\n 'dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers ' +\n 'editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor ' +\n 'editorTemplate effector emit emitter enableDevice encodeString endString endsWith env ' +\n 'equivalent equivalentTol erf error eval evalDeferred evalEcho event ' +\n 'exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp ' +\n 'expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof ' +\n 'fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo ' +\n 'filetest filletCurve filter filterCurve filterExpand filterStudioImport ' +\n 'findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster ' +\n 'finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar ' +\n 'floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo ' +\n 'fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint ' +\n 'frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss ' +\n 'geometryConstraint getApplicationVersionAsFloat getAttr getClassification ' +\n 'getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes ' +\n 'getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender ' +\n 'glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl ' +\n 'gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid ' +\n 'gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap ' +\n 'HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor ' +\n 'HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached ' +\n 'HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel ' +\n 'headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey ' +\n 'hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender ' +\n 'hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox ' +\n 'iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ' +\n 'ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ' +\n 'ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform ' +\n 'insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance ' +\n 'instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp ' +\n 'interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf ' +\n 'isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect ' +\n 'itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx ' +\n 'jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner ' +\n 'keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx ' +\n 'keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx ' +\n 'keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx ' +\n 'keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor ' +\n 'layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList ' +\n 'lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep ' +\n 'listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory ' +\n 'listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation ' +\n 'listNodeTypes listPanelCategories listRelatives listSets listTransforms ' +\n 'listUnselected listerEditor loadFluid loadNewShelf loadPlugin ' +\n 'loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log ' +\n 'longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive ' +\n 'makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext ' +\n 'manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx ' +\n 'manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout ' +\n 'menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp ' +\n 'mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move ' +\n 'moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute ' +\n 'nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast ' +\n 'nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint ' +\n 'normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect ' +\n 'nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref ' +\n 'nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType ' +\n 'objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface ' +\n 'offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit ' +\n 'orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier ' +\n 'paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration ' +\n 'panelHistory paramDimContext paramDimension paramLocator parent parentConstraint ' +\n 'particle particleExists particleInstancer particleRenderInfo partition pasteKey ' +\n 'pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture ' +\n 'pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo ' +\n 'pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult ' +\n 'pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend ' +\n 'polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal ' +\n 'polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge ' +\n 'polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge ' +\n 'polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet ' +\n 'polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet ' +\n 'polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection ' +\n 'polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge ' +\n 'polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet ' +\n 'polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix ' +\n 'polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut ' +\n 'polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet ' +\n 'polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge ' +\n 'polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex ' +\n 'polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection ' +\n 'polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection ' +\n 'polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint ' +\n 'polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate ' +\n 'polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge ' +\n 'polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing ' +\n 'polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet ' +\n 'polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace ' +\n 'popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer ' +\n 'projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx ' +\n 'propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd ' +\n 'python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection ' +\n 'radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl ' +\n 'readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference ' +\n 'referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE ' +\n 'registerPluginResource rehash reloadImage removeJoint removeMultiInstance ' +\n 'removePanelCategory rename renameAttr renameSelectionList renameUI render ' +\n 'renderGlobalsNode renderInfo renderLayerButton renderLayerParent ' +\n 'renderLayerPostProcess renderLayerUnparent renderManip renderPartition ' +\n 'renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor ' +\n 'renderWindowSelectContext renderer reorder reorderDeformers requires reroot ' +\n 'resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget ' +\n 'reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx ' +\n 'rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout ' +\n 'runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage ' +\n 'saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale ' +\n 'scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor ' +\n 'sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable ' +\n 'scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt ' +\n 'searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey ' +\n 'selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType ' +\n 'selectedNodes selectionConnection separator setAttr setAttrEnumResource ' +\n 'setAttrMapping setAttrNiceNameResource setConstraintRestPosition ' +\n 'setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr ' +\n 'setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe ' +\n 'setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag ' +\n 'setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject ' +\n 'setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets ' +\n 'shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare ' +\n 'shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField ' +\n 'shortNameOf showHelp showHidden showManipCtx showSelectionInTitle ' +\n 'showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface ' +\n 'size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep ' +\n 'snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound ' +\n 'soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort ' +\n 'spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString ' +\n 'startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp ' +\n 'stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex ' +\n 'stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex ' +\n 'stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString ' +\n 'stringToStringArray strip stripPrefixFromName stroke subdAutoProjection ' +\n 'subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV ' +\n 'subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror ' +\n 'subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease ' +\n 'subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring ' +\n 'surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton ' +\n 'symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext ' +\n 'texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext ' +\n 'texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text ' +\n 'textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList ' +\n 'textToShelf textureDisplacePlane textureHairColor texturePlacementContext ' +\n 'textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath ' +\n 'toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower ' +\n 'toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper ' +\n 'trace track trackCtx transferAttributes transformCompare transformLimits translator ' +\n 'trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence ' +\n 'twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit ' +\n 'unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink ' +\n 'uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane ' +\n 'viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex ' +\n 'waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire ' +\n 'wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform',\n illegal: '</',\n contains: [\n hljs.C_NUMBER_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [ hljs.BACKSLASH_ESCAPE ]\n },\n { // eats variables\n begin: /[$%@](\\^\\w\\b|#\\w+|[^\\s\\w{]|\\{\\w+\\}|\\w+)/\n },\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ]\n };\n}", "function mel(hljs) {\n return {\n name: 'MEL',\n keywords:\n 'int float string vector matrix if else switch case default while do for in break ' +\n 'continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic ' +\n 'addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey ' +\n 'affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve ' +\n 'alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor ' +\n 'animDisplay animView annotate appendStringArray applicationName applyAttrPreset ' +\n 'applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx ' +\n 'artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu ' +\n 'artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand ' +\n 'assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface ' +\n 'attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu ' +\n 'attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp ' +\n 'attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery ' +\n 'autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults ' +\n 'bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership ' +\n 'bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType ' +\n 'boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu ' +\n 'buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge ' +\n 'cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch ' +\n 'catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox ' +\n 'character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp ' +\n 'checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip ' +\n 'clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore ' +\n 'closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter ' +\n 'cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color ' +\n 'colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp ' +\n 'colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem ' +\n 'componentEditor compositingInterop computePolysetVolume condition cone confirmDialog ' +\n 'connectAttr connectControl connectDynamic connectJoint connectionInfo constrain ' +\n 'constrainValue constructionHistory container containsMultibyte contextInfo control ' +\n 'convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation ' +\n 'convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache ' +\n 'cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel ' +\n 'cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver ' +\n 'cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor ' +\n 'createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer ' +\n 'createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse ' +\n 'currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx ' +\n 'curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface ' +\n 'curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox ' +\n 'defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete ' +\n 'deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes ' +\n 'delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo ' +\n 'dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable ' +\n 'disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected ' +\n 'displayColor displayCull displayLevelOfDetail displayPref displayRGBColor ' +\n 'displaySmoothness displayStats displayString displaySurface distanceDimContext ' +\n 'distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct ' +\n 'doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator ' +\n 'duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression ' +\n 'dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor ' +\n 'dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers ' +\n 'editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor ' +\n 'editorTemplate effector emit emitter enableDevice encodeString endString endsWith env ' +\n 'equivalent equivalentTol erf error eval evalDeferred evalEcho event ' +\n 'exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp ' +\n 'expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof ' +\n 'fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo ' +\n 'filetest filletCurve filter filterCurve filterExpand filterStudioImport ' +\n 'findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster ' +\n 'finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar ' +\n 'floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo ' +\n 'fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint ' +\n 'frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss ' +\n 'geometryConstraint getApplicationVersionAsFloat getAttr getClassification ' +\n 'getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes ' +\n 'getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender ' +\n 'glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl ' +\n 'gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid ' +\n 'gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap ' +\n 'HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor ' +\n 'HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached ' +\n 'HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel ' +\n 'headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey ' +\n 'hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender ' +\n 'hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox ' +\n 'iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ' +\n 'ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ' +\n 'ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform ' +\n 'insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance ' +\n 'instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp ' +\n 'interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf ' +\n 'isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect ' +\n 'itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx ' +\n 'jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner ' +\n 'keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx ' +\n 'keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx ' +\n 'keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx ' +\n 'keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor ' +\n 'layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList ' +\n 'lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep ' +\n 'listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory ' +\n 'listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation ' +\n 'listNodeTypes listPanelCategories listRelatives listSets listTransforms ' +\n 'listUnselected listerEditor loadFluid loadNewShelf loadPlugin ' +\n 'loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log ' +\n 'longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive ' +\n 'makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext ' +\n 'manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx ' +\n 'manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout ' +\n 'menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp ' +\n 'mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move ' +\n 'moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute ' +\n 'nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast ' +\n 'nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint ' +\n 'normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect ' +\n 'nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref ' +\n 'nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType ' +\n 'objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface ' +\n 'offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit ' +\n 'orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier ' +\n 'paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration ' +\n 'panelHistory paramDimContext paramDimension paramLocator parent parentConstraint ' +\n 'particle particleExists particleInstancer particleRenderInfo partition pasteKey ' +\n 'pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture ' +\n 'pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo ' +\n 'pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult ' +\n 'pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend ' +\n 'polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal ' +\n 'polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge ' +\n 'polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge ' +\n 'polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet ' +\n 'polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet ' +\n 'polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection ' +\n 'polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge ' +\n 'polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet ' +\n 'polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix ' +\n 'polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut ' +\n 'polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet ' +\n 'polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge ' +\n 'polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex ' +\n 'polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection ' +\n 'polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection ' +\n 'polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint ' +\n 'polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate ' +\n 'polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge ' +\n 'polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing ' +\n 'polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet ' +\n 'polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace ' +\n 'popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer ' +\n 'projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx ' +\n 'propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd ' +\n 'python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection ' +\n 'radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl ' +\n 'readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference ' +\n 'referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE ' +\n 'registerPluginResource rehash reloadImage removeJoint removeMultiInstance ' +\n 'removePanelCategory rename renameAttr renameSelectionList renameUI render ' +\n 'renderGlobalsNode renderInfo renderLayerButton renderLayerParent ' +\n 'renderLayerPostProcess renderLayerUnparent renderManip renderPartition ' +\n 'renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor ' +\n 'renderWindowSelectContext renderer reorder reorderDeformers requires reroot ' +\n 'resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget ' +\n 'reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx ' +\n 'rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout ' +\n 'runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage ' +\n 'saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale ' +\n 'scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor ' +\n 'sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable ' +\n 'scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt ' +\n 'searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey ' +\n 'selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType ' +\n 'selectedNodes selectionConnection separator setAttr setAttrEnumResource ' +\n 'setAttrMapping setAttrNiceNameResource setConstraintRestPosition ' +\n 'setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr ' +\n 'setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe ' +\n 'setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag ' +\n 'setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject ' +\n 'setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets ' +\n 'shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare ' +\n 'shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField ' +\n 'shortNameOf showHelp showHidden showManipCtx showSelectionInTitle ' +\n 'showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface ' +\n 'size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep ' +\n 'snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound ' +\n 'soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort ' +\n 'spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString ' +\n 'startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp ' +\n 'stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex ' +\n 'stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex ' +\n 'stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString ' +\n 'stringToStringArray strip stripPrefixFromName stroke subdAutoProjection ' +\n 'subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV ' +\n 'subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror ' +\n 'subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease ' +\n 'subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring ' +\n 'surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton ' +\n 'symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext ' +\n 'texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext ' +\n 'texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text ' +\n 'textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList ' +\n 'textToShelf textureDisplacePlane textureHairColor texturePlacementContext ' +\n 'textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath ' +\n 'toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower ' +\n 'toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper ' +\n 'trace track trackCtx transferAttributes transformCompare transformLimits translator ' +\n 'trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence ' +\n 'twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit ' +\n 'unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink ' +\n 'uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane ' +\n 'viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex ' +\n 'waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire ' +\n 'wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform',\n illegal: '</',\n contains: [\n hljs.C_NUMBER_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [ hljs.BACKSLASH_ESCAPE ]\n },\n { // eats variables\n begin: /[$%@](\\^\\w\\b|#\\w+|[^\\s\\w{]|\\{\\w+\\}|\\w+)/\n },\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ]\n };\n}", "function readInFile() {\n var fileInput = document.getElementById('fileInput');\n var fileDisplayArea = document.getElementById('fileDisplayArea');\n\n fileInput.addEventListener('change', function(e) { \n var file = fileInput.files[0];\n var textType = /text.*/;\n \n if (file.type.match(textType)) {\n \t\tvar reader = new FileReader(); \n\n \t\treader.onload = function(e) {\n \t\t//The stuff in here is now mine.\n \t\t\t//try to read the file line by line into an array\n \t\t\tvar wordArray = reader.result.split(/[\\n\\r]/);\n \t\t\t\n \t\t\t//now we put the words into the word list randomly\n \t\t\t//it needs to be random since I use a binary tree.\n \t\t\t//It's slow but necessary.\n \t\t\tputWordsIntoDictionary(wordArray);\n \t\t}\n \t\n \t reader.readAsText(file); \n\t\n\t } else {\n \t\tfileDisplayArea.innerText = \"File not supported!\";\n\t }\n });\n}", "function create_instructions(input){\n //proof of concept\n var lineEnds = [\"SEMICOLON\", \"END_OF_LINE\", \"END_OF_FILE\"];\n var lexeme;\n var priorPathTruth = false; //used to check elif/else branching options\n var notReturnStatement = true;\n while(input.length > 0 && notReturnStatement){\n lineTokens = []; //reset array \n let instr_line = \" \";\n lexeme = getToken(input, true);\n instr_line += lexeme.id + \" \";\n appendTokenList(lexeme);\n input = input.slice(lexeme.length);\n let openParenCount = 0;\n switch(lexeme.type){ //switch to find out which method to jump to, based off CFG\n case \"BINARY\": //all of these should cascade to math operation or comparison\n case \"OCTAL\":\n case \"HEX\":\n case \"NUMBER\":\n case \"FLOAT\":\n case \"STRING\":\n case \"ID\": //some assign statement or function call\n openParenCount = 0;\n while(!lineEnds.includes(lexeme.type) || openParenCount !== 0){ //a line can be \"a = ( 6 + \\n 6) a still be treated as a single instruction\n lexeme = getToken(input, true);\n if(!lineEnds.includes(lexeme.type)){ //don't push a line end token to the list getting resolved, but it will be sliced\n instr_line += lexeme.id + \" \";\n appendTokenList(lexeme);\n if(lexeme.type === \"LPAREN\")\n openParenCount++;\n if(lexeme.type === \"RPAREN\")\n openParenCount--;\n }\n input = input.slice(lexeme.length);\n }\n pushInstr(\"Instruction\" + instr_line, \"\", cmdCount, lexeme.line_no, 0); //this pushes the line being resolved before actualy step wise resolution\n order_assign_statement(lineTokens);\n lineTokens = [];\n break;\n case \"IF\": priorPathTruth = false; //new if statement, reset this value\n case \"ELIF\":\n case \"ELSE\":\n case \"DEF\":\n case \"WHILE\":\n openParenCount = 0;\n while(lexeme.type !== \"COLON\" || openParenCount !== 0){\n lexeme = getToken(input, true);\n if(lexeme.type !== \"COLON\"){\n instr_line += lexeme.id + \" \";\n appendTokenList(lexeme);\n if(lexeme.type === \"LPAREN\")\n openParenCount++;\n if(lexeme.type === \"RPAREN\")\n openParenCount--;\n }\n input = input.slice(lexeme.length);\n }\n instr_line += lexeme.id + \" \"; //we want to see : on the instruction, but not he following line break\n appendTokenList(lexeme);\n input = input.slice(lexeme.length);\n \n pushInstr(\"Instruction\" + instr_line, \"\", cmdCount, lexeme.line_no, 0); //this pushes the line being resolved before actualy step wise resolution\n if(lineTokens[0].type === \"WHILE\")\n input = order_while_loop(lineTokens, input);\n else if(lineTokens[0].type === \"IF\" || lineTokens[0].type === \"ELIF\" || lineTokens[0].type === \"ELSE\"){\n let vals = order_if_statement(lineTokens, input, priorPathTruth);\n input = vals.inputSlice;\n priorPathTruth = vals.pathTruth;\n }else if(lineTokens[0].type === \"DEF\")\n input = order_cust_function(lineTokens, input);\n lineTokens = [];\n break;\n case \"PRINT\":\n let isQuote = false;\n let isApost = false;\n openParenCount = 0;\n openParenCount = 0;\n while(!lineEnds.includes(lexeme.type) || openParenCount !== 0){ //a line can be \"a = ( 6 + \\n 6) a still be treated as a single instruction\n lexeme = getToken(input, true);\n if(!lineEnds.includes(lexeme.type)){ //don't push a line end token to the list getting resolved, but it will be sliced\n instr_line += lexeme.id + \" \";\n appendTokenList(lexeme);\n if(!isApost && lexeme.type === \"QUOTE\")\n isQuote = !isQuote;\n if(!isQuote && lexeme.type === \"APOSTROPHE\")\n isApost = !isApost;\n if(!isApost && !isQuote){\n if(lexeme.type === \"LPAREN\")\n openParenCount++;\n if(lexeme.type === \"RPAREN\")\n openParenCount--;\n }\n }\n input = input.slice(lexeme.length);\n }\n pushInstr(\"Instruction\" + instr_line, \"\", cmdCount, lexeme.line_no, 0); //this pushes the line being resolved before actualy step wise resolution\n order_print_statement(lineTokens);\n lineTokens = [];\n break;\n case \"IMPORT\"://not fully implemented yet, treated like a comment for now\n case \"HASH_TAG\": //free floating comments, slice off entire line\n case \"QUOTE\":\n while(!lineEnds.includes(lexeme.type) || lexeme.type === \"SEMICOLON\"){ //a line can be \"a = ( 6 + \\n 6) a still be treated as a single instruction\n lexeme = getToken(input, true);\n input = input.slice(lexeme.length);\n }\n lineTokens = [];\n break;\n case \"SEMICOLON\": //usually sliced at end of instruction lnie, this catches \";;\"\n case \"SPACE\":\n case \"END_OF_LINE\": input = skipEmptyLines(input);\n break;\n default: \n if(reservedWords.includes(lexeme.id) || userDefFunc.includes(lexeme.id)){\n console.log(lexeme.id);\n if(lexeme.id === \"return\")\n notReturnStatement = false; //used to avoid executing dead code\n openParenCount = 0;\n while(!lineEnds.includes(lexeme.type) || openParenCount !== 0){ //a line can be \"a = ( 6 + \\n 6) a still be treated as a single instruction\n lexeme = getToken(input, true);\n if(!lineEnds.includes(lexeme.type)){ //don't push a line end token to the list getting resolved, but it will be sliced\n instr_line += lexeme.id + \" \";\n appendTokenList(lexeme);\n if(lexeme.type === \"LPAREN\")\n openParenCount++;\n if(lexeme.type === \"RPAREN\")\n openParenCount--;\n }\n input = input.slice(lexeme.length);\n }\n pushInstr(\"Instruction\" + instr_line, \"\", cmdCount, lexeme.line_no, 0); //this pushes the line being resolved before actualy step wise resolution\n order_assign_statement(lineTokens);\n lineTokens = [];\n }else{\n console.log(\"Error\");\n console.log(lexeme.id + \" \" + lexeme.type);\n while(!lineEnds.includes(lexeme.type) || lexeme.type === \"SEMICOLON\"){ //a line can be \"a = ( 6 + \\n 6) a still be treated as a single instruction\n lexeme = getToken(input, true);\n input = input.slice(lexeme.length);\n }\n }\n break;\n }\n cmdCount++;\n }\n return instrList;\n}", "function train() {\n // gets net and training data\n var net = new brain.NeuralNetwork();\n var trainingDataRaw = fs.readFileSync('./excerpts.js');\n var trainingData = JSON.parse(trainingDataRaw);\n \n // gets a few excerpts\n var selectData = [];\n for (i = 0; i < 20; i++) {\n var next = trainingData[Math.floor((Math.random() * trainingData.length))];\n selectData.push(next);\n }\n // maps encoded training data\n selectData = compute(selectData);\n \n // trains network and returns it\n net.train(selectData, {\n log: true\n });\n \n return net;\n}", "function parse(words){\n\n\n\n}", "function parse() {\n\tprayerOfTheDay.innerHTML = getSubset(\"Prayer of the Day\", \"Amen.\") + \"<strong>Amen.</strong>\";\n\tfirstReading.innerHTML = readingify(getSubset(\"First Reading:\", \"Psalm:\"));\n\tvar psalmText = getSubset(\"Psalm:\", \"Second Reading:\");\n\tif (psalmCheck.checked == false) {//psalm should not be singable\n\t\tpsalmText = psalmText.replace(/\\|/g, \"\");//removes |'s from psalm\n\t}\n\t//TODO: The following DON'T WORK because replace() only replaces the first occurance of a string.\n\t//you will need to figure out REGEX for these next two:\n\tpsalmText = psalmText.replace(/(\\-\\s*)/g, \"\");//removes - between syllables\n\tpsalmText = psalmText.replace(/\\.\\sR/g, \".\");//removes R for refrains (hopefully not beginning of sentences because those have number before)\n\tpsalm.innerHTML = psalmify(psalmText);\n\tsecondReading.innerHTML = readingify(getSubset(\"Second Reading:\", \"Gospel:\"));\n\t\n\tvar gospelEnd;\n\tif (pentecostCheck.checked == true) {\n\t\tgospelEnd = \"Semicontinuous First Reading\";\n\t} else {\n\t\tgospelEnd = \"Prayers of Intercession\";\n\t}\n\n\n\n\tgospel.innerHTML = readingify(getSubset(\"Gospel:\", gospelEnd)); //this used to be \"Semicontinuous First Reading:\"\n\t//experiment:\n\t//var experimentString = getSubset(\"First Reading:\", \"Psalm:\");\n\t//console.log(experimentString);//works\n\t//var startPoint = experimentString.search(/\\d(?=[a-zA-Z])/);\n\t//var expSub = experimentString.substring(startPoint, startPoint + 30);\n\texplainerSection.classList.add(\"hidden\");\n\toutputSection.classList.remove(\"hidden\");\n\n\n}", "function tokenize() {\n\n // 8.1. Descriptor tokeniser: Skip whitespace\n collectCharacters(regexLeadingSpaces);\n\n // 8.2. Let current descriptor be the empty string.\n currentDescriptor = \"\";\n\n // 8.3. Let state be in descriptor.\n state = \"in descriptor\";\n\n while (true) {\n\n // 8.4. Let c be the character at position.\n c = input.charAt(pos);\n\n // Do the following depending on the value of state.\n // For the purpose of this step, \"EOF\" is a special character representing\n // that position is past the end of input.\n\n // In descriptor\n if (state === \"in descriptor\") {\n // Do the following, depending on the value of c:\n\n // Space character\n // If current descriptor is not empty, append current descriptor to\n // descriptors and let current descriptor be the empty string.\n // Set state to after descriptor.\n if (isSpace(c)) {\n if (currentDescriptor) {\n descriptors.push(currentDescriptor);\n currentDescriptor = \"\";\n state = \"after descriptor\";\n }\n\n // U+002C COMMA (,)\n // Advance position to the next character in input. If current descriptor\n // is not empty, append current descriptor to descriptors. Jump to the step\n // labeled descriptor parser.\n } else if (c === \",\") {\n pos += 1;\n if (currentDescriptor) {\n descriptors.push(currentDescriptor);\n }\n parseDescriptors();\n return;\n\n // U+0028 LEFT PARENTHESIS (()\n // Append c to current descriptor. Set state to in parens.\n } else if (c === \"\\u0028\") {\n currentDescriptor = currentDescriptor + c;\n state = \"in parens\";\n\n // EOF\n // If current descriptor is not empty, append current descriptor to\n // descriptors. Jump to the step labeled descriptor parser.\n } else if (c === \"\") {\n if (currentDescriptor) {\n descriptors.push(currentDescriptor);\n }\n parseDescriptors();\n return;\n\n // Anything else\n // Append c to current descriptor.\n } else {\n currentDescriptor = currentDescriptor + c;\n }\n // (end \"in descriptor\"\n\n // In parens\n } else if (state === \"in parens\") {\n\n // U+0029 RIGHT PARENTHESIS ())\n // Append c to current descriptor. Set state to in descriptor.\n if (c === \")\") {\n currentDescriptor = currentDescriptor + c;\n state = \"in descriptor\";\n\n // EOF\n // Append current descriptor to descriptors. Jump to the step labeled\n // descriptor parser.\n } else if (c === \"\") {\n descriptors.push(currentDescriptor);\n parseDescriptors();\n return;\n\n // Anything else\n // Append c to current descriptor.\n } else {\n currentDescriptor = currentDescriptor + c;\n }\n\n // After descriptor\n } else if (state === \"after descriptor\") {\n\n // Do the following, depending on the value of c:\n // Space character: Stay in this state.\n if (isSpace(c)) {\n\n // EOF: Jump to the step labeled descriptor parser.\n } else if (c === \"\") {\n parseDescriptors();\n return;\n\n // Anything else\n // Set state to in descriptor. Set position to the previous character in input.\n } else {\n state = \"in descriptor\";\n pos -= 1;\n\n }\n }\n\n // Advance position to the next character in input.\n pos += 1;\n\n // Repeat this step.\n } // (close while true loop)\n }", "run({\n inputLines, inputOffset, context, inputSource, initialState,\n}) {\n /*\n Run the state machine on `input_lines`. Return results (a list).\n\n Reset `self.line_offset` and `self.current_state`. Run the\n beginning-of-file transition. Input one line at a time and check for a\n matching transition. If a match is found, call the transition method\n and possibly change the state. Store the context returned by the\n transition method to be passed on to the next transition matched.\n Accumulate the results returned by the transition methods in a list.\n Run the end-of-file transition. Finally, return the accumulated\n results.\n\n Parameters:\n\n - `input_lines`: a list of strings without newlines, or `StringList`.\n - `input_offset`: the line offset of `input_lines` from the beginning\n of the file.\n - `context`: application-specific storage.\n - `input_source`: name or path of source of `input_lines`.\n - `initial_state`: name of initial state.\n */\n this.runtimeInit();\n if (inputLines instanceof StringList) {\n this.inputLines = inputLines;\n// console.log(inputLines);\n } else if (inputLines == null) {\n throw new InvalidArgumentsError('inputLines should not be null or undefined');\n } else {\n if (!isIterable(inputLines)) {\n inputLines = [inputLines];\n }\n /* note: construct stringist with inputSource */\n\n this.inputLines = new StringList(inputLines, inputSource);\n// console.log(this.inputLines);\n }\n this.inputOffset = inputOffset;\n this.lineOffset = -1;\n this.currentState = initialState || this.initialState;\n if (!this.currentState) {\n // console.log('No current state');\n }\n if (this.debug) {\n this.debugFn(`\\nStateMachine.run: input_lines (line_offset=${this.lineOffset}):\\n| ${this.inputLines.join('\\n| ')}`);\n }\n let transitions;\n const results = [];\n let state = this.getState();\n let nextState;\n let result;\n try {\n if (this.debug) {\n this.debugFn('\\nStateMachine.run: bof transition');\n }\n [context, result] = state.bof(context);\n if (!Array.isArray(context)) {\n throw new Error('expecting array');\n }\n// console.log(context);\n results.push(...result);\n /* eslint-disable-next-line no-constant-condition */\n while (true) {\n try {\n try {\n this.nextLine();\n if (this.debug) {\n if (Number.isNaN(this.lineOffset)) {\n /* istanbul ignore if */\n throw new Error();\n }\n\n const rinfo = this.inputLines.info(\n this.lineOffset,\n);\n if (!isIterable(rinfo)) {\n /* istanbul ignore if */\n throw new Error();\n }\n const [source, offset] = rinfo;\n this.debugFn(`\\nStateMachine.run: line (source=${source}, offset=${offset}):\\n| ${this.line}`);\n }\n// console.log(context);\n /* istanbul ignore if */\n if (!Array.isArray(context)) {\n throw new Error('context should be array');\n }\n\n const r = this.checkLine(context, state, transitions);\n /* istanbul ignore if */\n if (!isIterable(r)) {\n throw new Error(`Expect iterable result, got: ${r}`);\n }\n [context, nextState, result] = r;\n /* istanbul ignore if */\n if (!Array.isArray(context)) {\n throw new Error('context should be array');\n }\n /* istanbul ignore if */\n if (!isIterable(result)) {\n throw new Error(`Expect iterable result, got: ${result}`);\n }\n results.push(...result);\n } catch (error) {\n if (error instanceof EOFError) {\n if (this.debug) {\n this.debugFn(`\\nStateMachine.run: ${state.constructor.name}.eof transition`);\n }\n result = state.eof(context);\n results.push(...result);\n break;\n } else {\n throw error;\n }\n }\n } catch (error) {\n if (error instanceof TransitionCorrection) {\n this.previousLine();\n transitions = [error.args[0]];\n /* if self.debug:\n print >>self._stderr, (\n '\\nStateMachine.run: TransitionCorrection to '\n 'state \"%s\", transition %s.'\n % (state.__class__.__name__, transitions[0])) */\n /* Cant continue, makes no sense? ?? */\n /* eslint-disable-next-line no-continue */\n continue;\n } else if (error instanceof StateCorrection) {\n this.previousLine();\n nextState = error.args[0];\n if (error.args.length === 1) {\n transitions = null;\n } else {\n transitions = [error.args[1]];\n }\n /* if self.debug:\n print >>self._stderr, (\n '\\nStateMachine.run: StateCorrection to state '\n '\"%s\", transition %s.'\n % (next_state, transitions[0]))\n */\n } else {\n throw error;\n }\n }\n /* we need this somehow, its part of a try, except, else */\n // transitions = undefined\n state = this.getState(nextState);\n }\n } catch (error) {\n throw error;\n }\n this.observers = [];\n return results;\n }", "function readIt() {\n\t\tdisplayText(false); \n\t\tcount++;\n\n\t\tif (count >= input.length) { // stop when the input reaches the last word\n\t\t\tcount = 0;\n\t\t\tstop();\n\t\t}\n\t}", "static parse (input) {\n const diagram = new Diagram()\n diagram.encodedInput = Diagram.encode(input)\n return diagram\n }", "function doIt() {\n fs.readFile('random.txt', 'utf8', function(error, data) {\n\n if (error) {\n console.log(error);\n }\n// TODO: parse format of text in random.txt so it will be accepted as a command/input pair and allow for using other commands as well\n console.log(data)\n \n dataArr = data.split(',');\n\n console.log(dataArr[0]);\n\n input = dataArr[1];\n\n switch(dataArr[0]) { // get command in random.txt and compare with commands in switch cases\n case 'my-tweets':\n twitter();\n break;\n\n case 'spotify-this-song':\n spotify(input);\n break;\n\n case 'movie-this':\n movie(input);\n break;\n }\n appendToLog(data);\n });\n\n}", "function makeMarkovJson(markovString, textList){\n var outputJson = {};\n\n markovString = markovString.split(\" \");\n\n for(var i = 0; i < textList.length; i++){\n outputJson[textList[i]] = [];\n }\n\n for(var i = 0; i < (markovString.length) - 1; i++){\n var index = textList.indexOf(markovString[i+1]);\n outputJson[markovString[i]].push(index);\n }\n return outputJson;\n}", "constructor(str, data)\n {\n this.errors = [];\n let lines = str.split('\\n');\n\n let tokenizer = new Tokenizer(lines);\n for ( var i = 0; i < tokenizer.errors.length; i++ )\n {\n this.errors.push(tokenizer.errors[i]);\n if ( i === tokenizer.errors.length - 1 )\n return;\n }\n\n let expressions = [];\n for ( var i = 0; i < tokenizer.lines.length; i++ )\n expressions.push(new Expression(tokenizer.lines[i], i+1));\n\n let leave = false;\n for ( var i = 0; i < expressions.length; i++ )\n {\n if ( expressions[i].valid === false && expressions[i].err === false )\n {\n expressions.splice(i--, 1);\n continue;\n }\n\n if ( expressions[i].err )\n {\n this.errors.push(expressions[i].err);\n leave = true;\n }\n }\n\n if ( leave )\n return;\n\n try\n {\n let parsedState = parser(expressions);\n this.program = new Program(parsedState, data);\n }\n catch(e)\n {\n this.errors.push(e);\n }\n }", "function tokenize() {\n\n\t\t\t// 8.1. Descriptor tokeniser: Skip whitespace\n\t\t\tcollectCharacters(regexLeadingSpaces);\n\n\t\t\t// 8.2. Let current descriptor be the empty string.\n\t\t\tcurrentDescriptor = \"\";\n\n\t\t\t// 8.3. Let state be in descriptor.\n\t\t\tstate = \"in descriptor\";\n\n\t\t\twhile (true) {\n\n\t\t\t\t// 8.4. Let c be the character at position.\n\t\t\t\tc = input.charAt(pos);\n\n\t\t\t\t// Do the following depending on the value of state.\n\t\t\t\t// For the purpose of this step, \"EOF\" is a special character representing\n\t\t\t\t// that position is past the end of input.\n\n\t\t\t\t// In descriptor\n\t\t\t\tif (state === \"in descriptor\") {\n\t\t\t\t\t// Do the following, depending on the value of c:\n\n\t\t\t\t // Space character\n\t\t\t\t // If current descriptor is not empty, append current descriptor to\n\t\t\t\t // descriptors and let current descriptor be the empty string.\n\t\t\t\t // Set state to after descriptor.\n\t\t\t\t\tif (isSpace(c)) {\n\t\t\t\t\t\tif (currentDescriptor) {\n\t\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\t\tcurrentDescriptor = \"\";\n\t\t\t\t\t\t\tstate = \"after descriptor\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// U+002C COMMA (,)\n\t\t\t\t\t// Advance position to the next character in input. If current descriptor\n\t\t\t\t\t// is not empty, append current descriptor to descriptors. Jump to the step\n\t\t\t\t\t// labeled descriptor parser.\n\t\t\t\t\t} else if (c === \",\") {\n\t\t\t\t\t\tpos += 1;\n\t\t\t\t\t\tif (currentDescriptor) {\n\t\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t// U+0028 LEFT PARENTHESIS (()\n\t\t\t\t\t// Append c to current descriptor. Set state to in parens.\n\t\t\t\t\t} else if (c === \"\\u0028\") {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t\tstate = \"in parens\";\n\n\t\t\t\t\t// EOF\n\t\t\t\t\t// If current descriptor is not empty, append current descriptor to\n\t\t\t\t\t// descriptors. Jump to the step labeled descriptor parser.\n\t\t\t\t\t} else if (c === \"\") {\n\t\t\t\t\t\tif (currentDescriptor) {\n\t\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t// Anything else\n\t\t\t\t\t// Append c to current descriptor.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t}\n\t\t\t\t// (end \"in descriptor\"\n\n\t\t\t\t// In parens\n\t\t\t\t} else if (state === \"in parens\") {\n\n\t\t\t\t\t// U+0029 RIGHT PARENTHESIS ())\n\t\t\t\t\t// Append c to current descriptor. Set state to in descriptor.\n\t\t\t\t\tif (c === \")\") {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t\tstate = \"in descriptor\";\n\n\t\t\t\t\t// EOF\n\t\t\t\t\t// Append current descriptor to descriptors. Jump to the step labeled\n\t\t\t\t\t// descriptor parser.\n\t\t\t\t\t} else if (c === \"\") {\n\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t// Anything else\n\t\t\t\t\t// Append c to current descriptor.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t}\n\n\t\t\t\t// After descriptor\n\t\t\t\t} else if (state === \"after descriptor\") {\n\n\t\t\t\t\t// Do the following, depending on the value of c:\n\t\t\t\t\t// Space character: Stay in this state.\n\t\t\t\t\tif (isSpace(c)) {\n\n\t\t\t\t\t// EOF: Jump to the step labeled descriptor parser.\n\t\t\t\t\t} else if (c === \"\") {\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t// Anything else\n\t\t\t\t\t// Set state to in descriptor. Set position to the previous character in input.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate = \"in descriptor\";\n\t\t\t\t\t\tpos -= 1;\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Advance position to the next character in input.\n\t\t\t\tpos += 1;\n\n\t\t\t// Repeat this step.\n\t\t\t} // (close while true loop)\n\t\t}", "function tokenize() {\n\n\t\t\t// 8.1. Descriptor tokeniser: Skip whitespace\n\t\t\tcollectCharacters(regexLeadingSpaces);\n\n\t\t\t// 8.2. Let current descriptor be the empty string.\n\t\t\tcurrentDescriptor = \"\";\n\n\t\t\t// 8.3. Let state be in descriptor.\n\t\t\tstate = \"in descriptor\";\n\n\t\t\twhile (true) {\n\n\t\t\t\t// 8.4. Let c be the character at position.\n\t\t\t\tc = input.charAt(pos);\n\n\t\t\t\t// Do the following depending on the value of state.\n\t\t\t\t// For the purpose of this step, \"EOF\" is a special character representing\n\t\t\t\t// that position is past the end of input.\n\n\t\t\t\t// In descriptor\n\t\t\t\tif (state === \"in descriptor\") {\n\t\t\t\t\t// Do the following, depending on the value of c:\n\n\t\t\t\t\t// Space character\n\t\t\t\t\t// If current descriptor is not empty, append current descriptor to\n\t\t\t\t\t// descriptors and let current descriptor be the empty string.\n\t\t\t\t\t// Set state to after descriptor.\n\t\t\t\t\tif (isSpace(c)) {\n\t\t\t\t\t\tif (currentDescriptor) {\n\t\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\t\tcurrentDescriptor = \"\";\n\t\t\t\t\t\t\tstate = \"after descriptor\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// U+002C COMMA (,)\n\t\t\t\t\t\t// Advance position to the next character in input. If current descriptor\n\t\t\t\t\t\t// is not empty, append current descriptor to descriptors. Jump to the step\n\t\t\t\t\t\t// labeled descriptor parser.\n\t\t\t\t\t} else if (c === \",\") {\n\t\t\t\t\t\tpos += 1;\n\t\t\t\t\t\tif (currentDescriptor) {\n\t\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t// U+0028 LEFT PARENTHESIS (()\n\t\t\t\t\t\t// Append c to current descriptor. Set state to in parens.\n\t\t\t\t\t} else if (c === \"\\u0028\") {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t\tstate = \"in parens\";\n\n\t\t\t\t\t\t// EOF\n\t\t\t\t\t\t// If current descriptor is not empty, append current descriptor to\n\t\t\t\t\t\t// descriptors. Jump to the step labeled descriptor parser.\n\t\t\t\t\t} else if (c === \"\") {\n\t\t\t\t\t\tif (currentDescriptor) {\n\t\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t// Anything else\n\t\t\t\t\t\t// Append c to current descriptor.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t}\n\t\t\t\t\t// (end \"in descriptor\"\n\n\t\t\t\t\t// In parens\n\t\t\t\t} else if (state === \"in parens\") {\n\n\t\t\t\t\t// U+0029 RIGHT PARENTHESIS ())\n\t\t\t\t\t// Append c to current descriptor. Set state to in descriptor.\n\t\t\t\t\tif (c === \")\") {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t\tstate = \"in descriptor\";\n\n\t\t\t\t\t\t// EOF\n\t\t\t\t\t\t// Append current descriptor to descriptors. Jump to the step labeled\n\t\t\t\t\t\t// descriptor parser.\n\t\t\t\t\t} else if (c === \"\") {\n\t\t\t\t\t\tdescriptors.push(currentDescriptor);\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t// Anything else\n\t\t\t\t\t\t// Append c to current descriptor.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrentDescriptor = currentDescriptor + c;\n\t\t\t\t\t}\n\n\t\t\t\t\t// After descriptor\n\t\t\t\t} else if (state === \"after descriptor\") {\n\n\t\t\t\t\t// Do the following, depending on the value of c:\n\t\t\t\t\t// Space character: Stay in this state.\n\t\t\t\t\tif (isSpace(c)) {\n\n\t\t\t\t\t\t// EOF: Jump to the step labeled descriptor parser.\n\t\t\t\t\t} else if (c === \"\") {\n\t\t\t\t\t\tparseDescriptors();\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t// Anything else\n\t\t\t\t\t\t// Set state to in descriptor. Set position to the previous character in input.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate = \"in descriptor\";\n\t\t\t\t\t\tpos -= 1;\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Advance position to the next character in input.\n\t\t\t\tpos += 1;\n\n\t\t\t\t// Repeat this step.\n\t\t\t} // (close while true loop)\n\t\t}", "function generate() {\n // With every new sentence we want to make tree branches smaller\n leng = 0.5*leng;\n // We also want to randomize angle a bit\n angle += random(-PI/9, PI/9);\n var newSentence = \"\";\n // Every character in sentence we need to change according to recursion rules and\n // write it dow to a new sentence\n for (var c in sentence) {\n let current = sentence.charAt(c);\n var found = false;\n for (var r in rules) {\n if (current == rules[r].a) {\n newSentence += rules[r].b;\n found = true;\n break;\n }\n }\n if (!found) {\n newSentence += current;\n }\n }\n sentence = newSentence;\n drawSentence();\n}", "function Parser() {\n\n\tvar VISIBILITY_TOKENS = [ 'Show', 'Hide' ];\n var CONTINUE_TOKEN = 'Continue';\n\tvar FILTER_TOKENS = [\n 'ItemLevel', 'DropLevel', 'Quality', 'Rarity', 'Class', 'BaseType', 'Sockets', 'LinkedSockets', 'SocketGroup',\n 'Width', 'Height', 'Identified', 'Corrupted', 'ElderItem', 'ShaperItem', 'ShapedMap', 'HasExplicitMod', 'MapTier',\n 'GemLevel', 'StackSize', 'ElderMap', 'Prophecy', 'FracturedItem', 'SynthesisedItem', 'AnyEnchantment', 'HasEnchantment',\n 'BlightedMap', 'HasInfluence',\n 'Mirrored', 'CorruptedMods', 'AreaLevel',\n 'EnchantmentPassiveNode',\n 'AlternateQuality', 'Replica', 'GemQualityType',\n 'EnchantmentPassiveNum',\n ];\n\tvar MODIFIER_TOKENS = [\n\t 'SetBackgroundColor', 'SetBorderColor', 'SetTextColor', 'PlayAlertSound', 'PlayAlertSoundPositional',\n\t 'SetFontSize', 'DisableDropSound', 'CustomAlertSound', 'MinimapIcon', 'PlayEffect' ];\n\tvar RARITY_TOKENS = [ 'Normal', 'Magic', 'Rare', 'Unique' ];\n var INFLUENCE_TOKENS = [ 'shaper', 'elder', 'crusader', 'redeemer', 'hunter', 'warlord' ];\n\tvar SOUND_TOKENS = [ 'ShAlchemy', 'ShBlessed', 'ShChaos', 'ShDivine', 'ShExalted', 'ShFusing', 'ShGeneral', 'ShMirror', 'ShRegal', 'ShVaal' ];\n var COLOR_TOKENS = [ 'Red', 'Green', 'Blue', 'Brown', 'White', 'Yellow', 'Grey', 'Pink', 'Cyan', 'Purple', 'Orange' ]\n var ICON_SHAPE_TOKENS = [ 'Circle', 'Diamond', 'Hexagon', 'Square', 'Star', 'Triangle', 'Kite', 'Cross', 'Pentagon', 'Moon', 'UpsideDownHouse' ]\n\n\tthis.currentLineNr = 0;\n\tthis.currentRule = null;\n\n\tthis.ruleSet = [];\n\tthis.errors = [];\n\tthis.warnings = [];\n\tthis.lineTypes = [];\n \n // clear last stored area level when getting new parser\n currentAreaLevel = null;\n this.setAreaLevel = function(level) {\n currentAreaLevel = level;\n } \n\n\tthis.parse = function (lines) {\n\t\tthis.currentRule = null;\n\t\tthis.ruleSet = [];\n\t\tthis.errors = [];\n\t\tthis.warnings = [];\n\t\tthis.lineTypes = [];\n\n\t\tfor (var i = 0; i < lines.length; i++) {\n \n if(this.errors.length > 100) {\n // too many errors, this probably isn't a valid filter - stop now\n break;\n }\n \n\t\t\tthis.currentLineNr = i;\n\t\t\tvar line = lines[i];\n\n\t\t\tif (line.trim() === '') {\n\t\t\t\tthis.lineTypes[i] = 'Empty';\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (line.trim()[0] === '#') {\n\t\t\t\tthis.lineTypes[i] = 'Comment';\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tline = removeComment( line );\n\n\t\t\tif (VISIBILITY_TOKENS.indexOf( line.trim() ) >= 0) {\n\t\t\t\tif (this.currentRule !== null) {\n\t\t\t\t\tparseEndOfRule( this );\n\t\t\t\t}\n\t\t\t\tparseVisibility( this, line );\n\t\t\t}\n\t\t\telse if (CONTINUE_TOKEN === line.trim()) {\n\t\t\t\tif (this.currentRule !== null) {\n this.currentRule.continue = true;\n\t\t\t\t\tparseEndOfRule( this );\n\t\t\t\t} else {\n reportParseError( this, line.trim(), 'Continue without current rule' );\n }\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this.currentRule === null) {\n\t\t\t\t\treportTokenError( this, line.trim(), 'Show or Hide' );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tparseFilterOrModifier( this, line );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.currentRule !== null) {\n\t\t\t\tthis.currentRule.codeLines.push( i );\n\t\t\t}\n\t\t}\n\t\tparseEndOfRule( this );\n\t};\n\n\tfunction removeComment (line) {\n\t\tvar commentStart = line.indexOf(\"#\");\n\t\tif (commentStart < 0) {\n\t\t\treturn line;\n\t\t}\n\t\treturn line.substring( 0, commentStart );\n\t}\n\n\tfunction parseVisibility (self, line) {\n\t\tvar token = line.trim();\n\t\tif (VISIBILITY_TOKENS.indexOf( token ) < 0) {\n\t\t\treportTokenError( self, token, 'Show or Hide' );\n\t\t\treturn;\n\t\t}\n\n\t\tself.lineTypes[self.currentLineNr] = 'Visibility';\n\t\tself.currentRule = new Rule();\n\t}\n\n\tfunction parseEndOfRule (self) {\n\t\tif (self.currentRule !== null) {\n\t\t\tself.ruleSet.push( self.currentRule );\n\t\t\tself.currentRule = null;\n\t\t}\n\t}\n\n\tfunction parseFilterOrModifier (self, line) {\n\t\tvar tokens = line.trim().split(' ', 1);\n\n\t\tif (tokens.length == 0) {\n\t\t\treportTokenError( self, '', 'filter or modifier' );\n\t\t\treturn;\n\t\t}\n\n\t\tvar token = tokens[0].trim();\n\t\tvar arguments = line.trim().substring( token.length, line.length );\n\n\t\tif (FILTER_TOKENS.indexOf( token ) >= 0) {\n\t\t\tparseFilter( self, token, arguments );\n\t\t}\n\t\telse if (MODIFIER_TOKENS.indexOf( token ) >= 0) {\n\t\t\tparseModifier( self, token, arguments );\n\t\t}\n\t\telse {\n\t\t\treportTokenError( self, token, 'filter or modifier' );\n\t\t}\n\t}\n\n\t// ----------- FILTERS ---------------------------------------------------\n\n\tfunction parseFilter (self, token, arguments) {\n\t\tself.lineTypes[self.currentLineNr] = 'Filter';\n\n\t\tvar filters = {\n\t\t\t'ItemLevel': ItemLevelFilter,\n\t\t\t'DropLevel': DropLevelFilter,\n\t\t\t'Quality': QualityFilter,\n\t\t\t'Rarity': RarityFilter,\n\t\t\t'Class': ClassFilter,\n\t\t\t'BaseType': BaseTypeFilter,\n\t\t\t'LinkedSockets': LinkedSocketsFilter,\n \n // this is intentional - with 3.9 filter type update,\n // much of the logic for between two filters is shared\n\t\t\t'Sockets': SocketGroupFilter,\n\t\t\t'SocketGroup': SocketGroupFilter,\n \n\t\t\t'Width': WidthFilter,\n\t\t\t'Height': HeightFilter,\n\t\t\t'Identified': IdentifiedFilter,\n\t\t\t'Corrupted': CorruptedFilter,\n\t\t\t'ElderItem': ElderItemFilter,\n\t\t\t'ShaperItem': ShaperItemFilter,\n\t\t\t'ShapedMap': ShapedMapFilter,\n\t\t\t'ElderMap': ElderMapFilter,\n\t\t\t'HasExplicitMod': HasExplicitModFilter,\n\t\t\t'MapTier': MapTierFilter,\n\t\t\t'GemLevel': GemLevelFilter,\n\t\t\t'StackSize': StackSizeFilter,\n 'Prophecy': ProphecyFilter,\n 'FracturedItem': FracturedItemFilter,\n 'SynthesisedItem': SynthesisedItemFilter,\n 'AnyEnchantment': AnyEnchantmentFilter,\n 'HasEnchantment': HasEnchantmentFilter,\n 'BlightedMap': BlightedMapFilter,\n 'HasInfluence' : HasInfluenceFilter,\n 'Mirrored' : MirroredFilter,\n 'CorruptedMods' : CorruptedModsFilter,\n 'AreaLevel' : AreaLevelFilter,\n 'EnchantmentPassiveNode' : HasEnchantmentFilter,\n 'AlternateQuality' : AlternateQualityFilter,\n 'Replica' : ReplicaFilter,\n 'GemQualityType' : GemQualityTypeFilter,\n 'EnchantmentPassiveNum' : EnchantmentPassiveNumFilter\n\t\t};\n\n\t\tswitch (token) {\n\t\t\tcase 'ItemLevel':\n\t\t\tcase 'DropLevel':\n\t\t\tcase 'Quality':\n\t\t\tcase 'LinkedSockets':\n\t\t\tcase 'Width':\n\t\t\tcase 'Height':\n\t\t\tcase 'MapTier':\n\t\t\tcase 'GemLevel':\n\t\t\tcase 'StackSize':\n case 'CorruptedMods':\n case 'AreaLevel':\n\t\t\tcase 'EnchantmentPassiveNum':\n\t\t\t\tparseNumericFilter( self, filters[token], arguments );\n\t\t\t\treturn;\n\n\t\t\tcase 'Rarity':\n\t\t\t\tparseRarityFilter( self, filters[token], arguments );\n\t\t\t\treturn;\n\n\t\t\tcase 'Class':\n\t\t\tcase 'BaseType':\n\t\t\tcase 'HasExplicitMod':\n case 'Prophecy':\n\t\t\tcase 'HasEnchantment':\n case 'EnchantmentPassiveNode':\n case 'GemQualityType':\n\t\t\t\tparseMultiStringFilter( self, filters[token], arguments );\n\t\t\t\treturn;\n\n\t\t\tcase 'Sockets':\n\t\t\t\tparseSocketGroupFilter( self, filters[token], arguments, \"unlinked\" );\n\t\t\t\treturn;\n\t\t\tcase 'SocketGroup':\n\t\t\t\tparseSocketGroupFilter( self, filters[token], arguments, \"linked\" );\n\t\t\t\treturn;\n\n\t\t\tcase 'Identified':\n\t\t\tcase 'Corrupted':\n\t\t\tcase 'ElderItem':\n\t\t\tcase 'ShaperItem':\n\t\t\tcase 'ShapedMap':\n case 'ElderMap':\n\t\t\tcase 'FracturedItem':\n\t\t\tcase 'SynthesisedItem':\n case 'AnyEnchantment':\n case 'BlightedMap':\n case 'Mirrored':\n case 'AlternateQuality':\n case 'Replica':\n\t\t\t\tparseBoolFilter( self, filters[token], arguments );\n\t\t\t\treturn;\n \n\t\t\tcase 'HasInfluence':\n\t\t\t\tparseInfluenceFilter( self, filters[token], arguments );\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\t// We can only get to this function if token is valid\n\t\t\t\treportTokenError( self, token, 'this should never happen' );\n\t\t}\n\t}\n\n\tfunction parseNumericFilter (self, filter, arguments) {\n\t\tvar args = parseOperatorAndValue( self, arguments );\n\t\tif (args !== null) {\n\t\t\tif (isNaN( args.value )) {\n\t\t\t\treportTokenError( self, args.value, 'number' );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tself.currentRule.filters.push( new filter( args.comparer, parseInt( args.value ) ) );\n\t\t}\n\t}\n\n\tfunction parseMultiStringFilter (self, filter, arguments) {\n\t\tvar args = parseStringArguments( self, arguments );\n\t\tif (args === null) return;\n\t\tif (args.length === 0) {\n\t\t\treportUnexpectedEndOfLine( self, 'one or more strings' );\n\t\t\treturn;\n\t\t}\n\n\t\tself.currentRule.filters.push( new filter( args ) );\n\t}\n\n\tfunction parseRarityFilter (self, filter, arguments) {\n\t var tokens = getArgumentTokens(arguments);\n\t if (tokens.length == 0) {\n\t reportTokenError( self, arguments, 'rarity')\n\t return;\n\t }\n\n\t // If the first argument is an operator, we can use the parseOperatorAndValue function\n\t if (OPERATOR_TOKENS.includes( tokens[0] )) {\n\t args = parseOperatorAndValue( self, arguments );\n if (args != null) {\n if (RARITY_TOKENS.indexOf( args.value ) < 0) {\n reportTokenError( self, args.value, 'operator or rarity' );\n return;\n }\n self.currentRule.filters.push( new filter( args.comparer, Rarity[args.value] ) );\n return;\n }\n }\n\n // Otherwise, the arguments must be a list of rarities.\n var rarities = [];\n for (var i=0; i < tokens.length; i++) {\n if (!RARITY_TOKENS.includes(tokens[i])) {\n reportTokenError( self, tokens[i], 'rarity')\n return;\n }\n rarities.push( Rarity[tokens[i]] );\n }\n\n // In that case, we create a custom comparer that checks if a rarity is in that list\n var comparer = function(a,b) { return b.includes(a); }\n self.currentRule.filters.push( new filter( comparer, rarities ) );\n\t}\n \n\tfunction parseInfluenceFilter (self, filter, arguments) {\n\t var tokens = getArgumentTokens(arguments);\n\t if (tokens.length == 0) {\n\t reportTokenError( self, arguments, 'influence')\n\t return;\n\t }\n \n var comparer; \n \n if(tokens[0] === \"==\") {\n tokens.shift(); // remove operator\n comparer = function(a,b) {\n // strict equality - must contain all influences specified to match\n for(var i = 0; i < b.length; i++) {\n if(!a.includes(b[i])) return false;\n }\n return true;\n }\n } else {\n comparer = function(a,b) { \n // match if any of the specified influences are found\n for(var i = 0; i < a.length; i++) {\n if(b.includes(a[i])) return true;\n }\n return false;\n }\n }\n\n // the arguments must be a list of influences\n var influences = [];\n for (var i = 0; i < tokens.length; i++) {\n var inf = tokens[i].toLowerCase().replace(/\"/g, '');\n if(inf === \"none\") {\n influences = \"none\";\n break;\n }\n if (!INFLUENCE_TOKENS.includes(inf)) {\n reportTokenError( self, tokens[i], 'influence')\n return;\n }\n influences.push(inf);\n }\n\n self.currentRule.filters.push( new filter( comparer, influences ) );\n\t}\n \n\tfunction parseSocketGroupFilter (self, filter, arguments, mode) {\n \n\t var tokens = getArgumentTokens(arguments);\n\t if (tokens.length == 0) {\n\t reportTokenError( self, arguments, 'influence')\n\t return;\n\t }\n \n var operator = null;\n \n\t\t\tif (OPERATOR_TOKENS.includes(tokens[0])) {\n operator = tokens.shift();\n // single equals: no operator needed, match any of the arguments\n if(operator === \"=\") {\n operator = null;\n }\n }\n \n var groups = tokens.map( tok => { return StrUtils.replaceAll(tok.toUpperCase(), '\"', \"\"); } );\n \n var isInvalid = groups.some( function(socketGroup) {\n if (!StrUtils.consistsOf( socketGroup, '0123456RGBWDA' )) {\n reportInvalidSocketGroup( self, socketGroup );\n return true;\n }\n return false;\n } );\n \n if (!isInvalid) { \n groups = groups.map( group => {\n var sorted = StrUtils.sortChars(group);\n return {\n count: sorted.replace(/[RGBWDA]/g, \"\"),\n sockets: sorted.replace(/[0123456]/g, \"\")\n };\n });\n self.currentRule.filters.push( new filter( operator, groups, mode ) );\n }\n \n\t} \n\n\tfunction parseBoolFilter (self, filter, arguments) {\n\t\tvar args = parseStringArguments( self, arguments );\n\t\tif (args === null) return;\n\t\tif (args.length === 0) {\n\t\t\treportUnexpectedEndOfLine( self, 'expected True or False' );\n\t\t\treturn;\n\t\t}\n\n\t\targs = args.map( function(a) { return a.toUpperCase(); } );\n\n\t\tif (args[0] !== 'TRUE' && args[0] !== 'FALSE') {\n\t\t\treportTokenError( self, arguments, 'True or False' );\n\t\t\treturn;\n\t\t}\n\n\t\tself.currentRule.filters.push( new filter( args[0] === 'TRUE' ) );\n\t}\n\n\t// ----------- MODIFIERS ---------------------------------------------------\n\n\tfunction parseModifier (self, token, arguments) {\n\t\tself.lineTypes[self.currentLineNr] = 'Modifier';\n\n\t\tvar modifiers = {\n\t\t\t'SetBackgroundColor': SetBackgroundColorModifier,\n\t\t\t'SetBorderColor': SetBorderColorModifier,\n\t\t\t'SetTextColor': SetTextColorModifier,\n\t\t\t'SetFontSize': SetFontSizeModifier\n\t\t};\n\n\t\tswitch (token) {\n\t\t\tcase 'SetBackgroundColor':\n\t\t\tcase 'SetBorderColor':\n\t\t\tcase 'SetTextColor':\n\t\t\t\tparseColorModifier( self, modifiers[token], arguments );\n\t\t\t\tbreak;\n\n\t\t\tcase 'SetFontSize':\n\t\t\t\tparseNumericModifier( self, modifiers[token], arguments );\n\t\t\t\tbreak;\n\n case 'MinimapIcon':\n case 'PlayEffect':\n\t\t\tcase 'PlayAlertSound':\n\t\t\tcase 'PlayAlertSoundPositional':\n\t\t\tcase 'DisableDropSound':\n case 'CustomAlertSound':\n case 'CustomAlertSoundOptional':\n case 'DisableDropSoundIfAlertSound':\n case 'EnableDropSoundIfAlertSound':\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t// We can only get to this function if token is valid\n\t\t\t\treportTokenError( self, token, 'this should never happen' );\n\t\t}\n\t}\n\n\tfunction parseColorModifier (self, modifier, arguments) {\n\t\tvar numbers = parseNumbers( self, arguments );\n\t\tif (numbers === null) return;\n\t\tif (numbers.length < 3 || numbers.length > 4) {\n\t\t\treportTokenError( self, arguments, 'three or four numbers' );\n\t\t\treturn;\n\t\t}\n\n\t\tif (numbers.some( function(c) { return c < 0 || c > 255; } )) {\n\t\t\treportParseError( self, arguments, 'color values must be between 0 and 255' );\n\t\t\treturn;\n\t\t}\n\n\t\tvar color = { r:numbers[0], g:numbers[1], b:numbers[2], a:255 };\n\t\tif (numbers.length === 4) {\n\t\t\tcolor['a'] = numbers[3];\n\t\t}\n\n\t\tself.currentRule.modifiers.push( new modifier( color ) );\n\t}\n\n function parsePlayEffectModifier (self, modifier, arguments) {\n var tokens = arguments.trim().split(' ');\n if (tokens.length > 2) {\n reportTokenError( self, arguments, 'COLOR Temp' );\n return;\n }\n\n var color = tokens[0].trim();\n if (!COLOR_TOKENS.includes(color)) {\n reportTokenError( self, color, 'Color name');\n return;\n }\n\n var temp = false;\n if (tokens.length > 1) {\n if (tokens[1] !== 'Temp') {\n reportTokenError( self, tokens[1], 'Temp');\n return;\n }\n temp = true;\n }\n\n self.currentRule.modifiers.push( new modifier( color, temp ));\n }\n\n\tfunction parseMinimapIconModifier (self, modifier, arguments) {\n\t var tokens = arguments.trim().split(' ');\n\t if (tokens.length !== 3) {\n\t reportTokenError( self, arguments, 'SIZE COLOR SHAPE' );\n\t return;\n\t }\n\n\t var size = tokens[0];\n\t if (size !== '0' && size !== '1' && size !== '2') {\n\t reportParseError( self, size, 'SIZE must be 0, 1 or 2' );\n\t return;\n\t }\n\n\t var color = tokens[1];\n\t if (!COLOR_TOKENS.includes(color)) {\n\t reportParseError( self, color, 'COLOR must be one of: ' + COLOR_TOKENS.join(', '));\n\t return;\n\t }\n\n\t var shape = tokens[2];\n\t if (!ICON_SHAPE_TOKENS.includes(shape)) {\n\t reportParseError( self, shape, 'SHAPE must be one of: ' + ICON_SHAPE_TOKENS.join(', '));\n\t return;\n\t }\n\n\t self.currentRule.modifiers.push( new modifier( parseInt(size), color, shape ) );\n\t}\n\n\tfunction parseAlertSoundModifier (self, modifier, arguments) {\n\t var tokens = getArgumentTokens( arguments );\n\t if (tokens.length < 1 || tokens.length > 2) {\n\t reportTokenError( self, arguments, 'sound id + optional volume' );\n\t return;\n\t }\n\n\t var soundId = parseSoundId( self, tokens[0] );\n\t if (soundId === null) return;\n\n\t var volume = 100;\n\t if (tokens.length === 2) {\n\t if (isNaN(tokens[1])) {\n\t reportParseError( self, arguments, 'volume must be a number' );\n\t return;\n\t }\n\n\t volume = parseInt(tokens[1]);\n\t if (volume < 0 || volume > 300) {\n\t reportParseError( self, arguments, 'volume must be between 0 and 300' );\n\t return;\n\t }\n\t }\n\n\t\tself.currentRule.modifiers.push( new modifier( soundId, volume ) );\n\t}\n\n function parseSoundId (self, token) {\n if (SOUND_TOKENS.indexOf( token ) >= 0) {\n return token;\n }\n\n if (isNaN(token)) {\n reportParseError( self, token, 'Sound ID must be a number between 1 and 16, or a valid Sound ID name' );\n return;\n }\n return parseInt( token );\n }\n\n\tfunction parseNumericModifier (self, modifier, arguments) {\n\t\tvar numbers = parseNumbers( self, arguments );\n\t\tif (numbers === null) return;\n\t\tif (numbers.length != 1) {\n\t\t\treportTokenError( self, arguments, 'one number' );\n\t\t\treturn;\n\t\t}\n\n\t\tself.currentRule.modifiers.push( new modifier( numbers[0] ) );\n\t}\n\n\tfunction parseKeywordModifier (self, modifier, arguments) {\n\t\tif (arguments.trim().length > 0) {\n\t\t\treportTokenError( self, arguments, 'Unexpected argument' );\n\t\t\treturn;\n\t\t}\n\n\t\tself.currentRule.modifiers.push( new modifier() );\n\t}\n\n\tfunction parseFilenameModifier (self, modifier, arguments) {\n\t var argumentTokens = parseStringArguments( self, arguments );\n\t if (argumentTokens.length == 0) {\n\t reportUnexpectedEndOfLine( self, arguments, 'Path or Filename' );\n\t return;\n\t }\n\t if (argumentTokens.length > 1) {\n\t reportParseError( self, arguments, 'Unexpected argument: \"' + argumentTokens[1] + '\"' );\n\t return;\n\t }\n\n\t self.currentRule.modifiers.push( new modifier(argumentTokens[0]) );\n\t}\n\n\t// ------------------------ GENERIC PARSING ---------------------------------\n\n function getArgumentTokens (arguments) {\n return arguments\n\t\t\t.trim()\n\t\t\t.split(' ')\n\t\t\t.filter( function (element, index, array) { return element.trim().length > 0; } );\n }\n\n\tfunction parseOperatorAndValue (self, arguments) {\n\t\tvar tokens = getArgumentTokens( arguments );\n\t\tvar operator, value;\n\n\t\tif (tokens.length == 1) {\n\t\t\t// Special case: For equality checks, you specify only the value\n\t\t\toperator = '=';\n\t\t\tvalue = tokens[0];\n\t\t}\n\t\telse if (tokens.length == 2) {\n\t\t\toperator = tokens[0];\n\t\t\tvalue = tokens[1];\n\t\t}\n\t\telse {\n\t\t\treportTokenError( self, arguments, 'operator and value' );\n\t\t\treturn null;\n\t\t}\n\n\t\tif (OPERATOR_TOKENS.indexOf( operator ) < 0) {\n\t\t\treportTokenError( self, operator, 'operator' );\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { comparer : COMPARERS[operator], value : value };\n \n\t}\n\n\tfunction parseNumbers (self, arguments) {\n\t\tvar tokens = getArgumentTokens( arguments );\n\n\t\tif (tokens.some( isNaN )) {\n\t\t\treportTokenError( self, arguments, 'numbers' );\n\t\t\treturn null;\n\t\t}\n\n\t\treturn tokens.map( function(n) { return parseInt( n ); } );\n\t}\n\n\tfunction parseStringArguments (self, arguments) {\n\t\tvar tokens = arguments\n\t\t\t.trim()\n\t\t\t.split(' ');\n\t\t\t// Don't remove empty tokens because they might represent multiple spaces inside quoted strings\n\n\t\tvar actualTokens = [];\n\t\tvar numQuotes = 0;\n\t\tvar currentToken = '';\n\t\tfor (var i=0; i < tokens.length; i++) {\n\t\t\tnumQuotes += StrUtils.countChar( '\"', tokens[i] );\n\t\t\tvar withoutQuotes = StrUtils.replaceAll( tokens[i], '\"', '' );\n\n\t\t\tif (currentToken.length > 0) {\n\t\t\t\tcurrentToken += ' ' + withoutQuotes;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcurrentToken = withoutQuotes;\n\t\t\t}\n\n\t\t\tif (numQuotes % 2 == 0) {\n\t\t\t\tactualTokens.push( currentToken );\n\t\t\t\tcurrentToken = '';\n\t\t\t}\n\t\t}\n\n\t\tif (numQuotes % 2 != 0) {\n\t\t\treportParseError( self, arguments, 'no matching quote' );\n\t\t\tactualTokens.push( currentToken );\n\t\t}\n\n\t\t// Remove any empty or pure whitespace tokens.\n\t\t// These may happen with certain unicode characters.\n\t\tactualTokens = actualTokens.filter( function(token) { return token.trim().length > 0; } );\n\n\t\treturn actualTokens;\n\t}\n\n\t// ------------------- ERROR MESSAGES --------------------------------------\n\n\tfunction reportTokenError (self, token, expected) {\n\t\tself.errors.push( 'Invalid token \"' + token + '\" at line ' + self.currentLineNr.toString() + ' (expected ' + expected + ')' );\n\t\tself.lineTypes[self.currentLineNr] = 'Error';\n\t}\n\n\tfunction reportUnexpectedEndOfLine (self, expected) {\n\t\tself.errors.push( 'Unexpected end of line (expected ' + expected + ' in line ' + self.currentLineNr.toString() + ')');\n\t\tself.lineTypes[self.currentLineNr] = 'Error';\n\t}\n\n\tfunction reportInvalidSocketGroup (self, socketGroup) {\n\t\tself.errors.push( 'Invalid socket group \"' + socketGroup + '\" + at line ' + self.currentLineNr.toString() + ' (allowed characters are R,G,B)' );\n\t\tself.lineTypes[self.currentLineNr] = 'Error';\n\t}\n\n\tfunction reportParseError (self, text, reason) {\n\t\tself.errors.push( 'Cannot parse \"' + text + '\" (' + reason + ')' );\n\t\tself.lineTypes[self.currentLineNr] = 'Error';\n\t}\n\n\tfunction reportWarning (self, text) {\n\t\tself.warnings.push( text );\n\t}\n}", "makeChains(words) {\n let chain = {};\n let keyWord;\n let nextWord;\n\n for (let i = 0; i < words.length; i++) {\n keyWord = words[i];\n nextWord = words[i + 1] || null;\n\n //returns removed punctuation or false for no need to change\n let noPuncKeyWord = MarkovMachine.hasPunctuation(keyWord);\n\n if (noPuncKeyWord !== true) {\n keyWord = noPuncKeyWord;\n nextWord = null;\n }\n\n //initialize array if doesn't exist in object\n if (chain[keyWord] === undefined) {\n chain[keyWord] = [];\n }\n\n //if nextword is not null, check if there is punctuation. if it is null, keep as null.\n if (nextWord !== null) {\n let noPuncNextWord = MarkovMachine.hasPunctuation(nextWord);\n\n if (noPuncNextWord !== true) {\n nextWord = noPuncNextWord;\n }\n }\n\n chain[keyWord].push(nextWord);\n }\n\n return chain;\n }", "function markov_parse(array, n, sta) {\n\tvar ret_dict = [],\n\t\tret_obj = {};\n\t//Abstract singular states as numbers\n\tarray.forEach(function(state){\n if(sta == \"rn\") {\n if(ret_dict.findIndex((el)=>{return ((el[1] == state[1]) && (array_equals(el[0], state[0])));}) == -1) { //If the state can't already be found in the \"dictionary array\", push it. \n //TIL there's no function built into Javascript for comparing two arrays.\n\t\t\t ret_dict.push(state);\n }\n }\n else if(ret_dict.indexOf(state) == -1) {\n ret_dict.push(state);\n }\n\t});\n\tarray.forEach(function(state, index) {\n\t\tif(array[index + n]) {\n \n //basically we're just mapping multiple states (index to index + n) to indices in the ret_dict \n //however because Javascript doesn't want us to compare arrays with == we have to do it the hard way\n //meaning element by element\n\t\t\tvar a = array.slice(index, index+n).map(function(obj) {return (sta == \"rn\") ? ret_dict.findIndex((el)=>{return ((el[1] == obj[1]) && (array_equals(el[0], obj[0])));}) : (ret_dict.indexOf(obj));}); //Abstract to numbers\n\t\t\tif(!ret_obj[a]) {\n\t\t\t\tret_obj[a] = [];\n\t\t\t}\n\t\t\t\tret_obj[a].push((sta == \"rn\") ? ret_dict.findIndex((el)=>{return ((el[1] == array[index + n][1]) && (array_equals(el[0], array[index + n][0])));}) : ret_dict.indexOf(array[index + n]));\n\t\t}\n\t});\n\tret_obj[\"~n_order\"] = n;\n\tret_obj[\"~state\"] = sta;\n\treturn [ret_dict, ret_obj];\n\t}", "function tokenize() {\n // 8.1. Descriptor tokeniser: Skip whitespace\n collectCharacters(regexLeadingSpaces); // 8.2. Let current descriptor be the empty string.\n\n currentDescriptor = \"\"; // 8.3. Let state be in descriptor.\n\n state = \"in descriptor\";\n\n while (true) {\n // 8.4. Let c be the character at position.\n c = input.charAt(pos); // Do the following depending on the value of state.\n // For the purpose of this step, \"EOF\" is a special character representing\n // that position is past the end of input.\n // In descriptor\n\n if (state === \"in descriptor\") {\n // Do the following, depending on the value of c:\n // Space character\n // If current descriptor is not empty, append current descriptor to\n // descriptors and let current descriptor be the empty string.\n // Set state to after descriptor.\n if (isSpace(c)) {\n if (currentDescriptor) {\n descriptors.push(currentDescriptor);\n currentDescriptor = \"\";\n state = \"after descriptor\";\n } // U+002C COMMA (,)\n // Advance position to the next character in input. If current descriptor\n // is not empty, append current descriptor to descriptors. Jump to the step\n // labeled descriptor parser.\n\n } else if (c === \",\") {\n pos += 1;\n\n if (currentDescriptor) {\n descriptors.push(currentDescriptor);\n }\n\n parseDescriptors();\n return; // U+0028 LEFT PARENTHESIS (()\n // Append c to current descriptor. Set state to in parens.\n } else if (c === \"\\u0028\") {\n currentDescriptor = currentDescriptor + c;\n state = \"in parens\"; // EOF\n // If current descriptor is not empty, append current descriptor to\n // descriptors. Jump to the step labeled descriptor parser.\n } else if (c === \"\") {\n if (currentDescriptor) {\n descriptors.push(currentDescriptor);\n }\n\n parseDescriptors();\n return; // Anything else\n // Append c to current descriptor.\n } else {\n currentDescriptor = currentDescriptor + c;\n } // (end \"in descriptor\"\n // In parens\n\n } else if (state === \"in parens\") {\n // U+0029 RIGHT PARENTHESIS ())\n // Append c to current descriptor. Set state to in descriptor.\n if (c === \")\") {\n currentDescriptor = currentDescriptor + c;\n state = \"in descriptor\"; // EOF\n // Append current descriptor to descriptors. Jump to the step labeled\n // descriptor parser.\n } else if (c === \"\") {\n descriptors.push(currentDescriptor);\n parseDescriptors();\n return; // Anything else\n // Append c to current descriptor.\n } else {\n currentDescriptor = currentDescriptor + c;\n } // After descriptor\n\n } else if (state === \"after descriptor\") {\n // Do the following, depending on the value of c:\n // Space character: Stay in this state.\n if (isSpace(c)) ; else if (c === \"\") {\n parseDescriptors();\n return; // Anything else\n // Set state to in descriptor. Set position to the previous character in input.\n } else {\n state = \"in descriptor\";\n pos -= 1;\n }\n } // Advance position to the next character in input.\n\n\n pos += 1; // Repeat this step.\n } // (close while true loop)\n\n }", "function interpret(input) {\n console.log(\"calling interpret\");\n var cmd = {},\n tokens = input.trim().toLowerCase().split(\" \");\n cmd.action = tokens.shift();\n cmd.target = tokens.join(\" \");\n return cmd;\n}", "function getTokenStream(sourceCode) {\n //s1 is the start state\n var state = 's1';\n //Clear tokens\n var tokens = [];\n //Start with empty string to track keywords\n var currentString = \"\";\n //Line number count starts at 1\n var lineNumber = 1;\n //Not currently reading in a \"string literal\"\n var stringMode = false;\n //We use two different DFAs, one regular one and one for string literals.\n //Both start with state s1.\n var DFAtype = (function () {\n function DFAtype() {\n }\n return DFAtype;\n })();\n //The current DFA is the default one. Will switch to the string DFA if needed.\n var currentDFA = new DFAtype();\n currentDFA = DFA;\n //For each source code character...\n for (var i = 0; i < sourceCode.length; i++) {\n //Get the character and the one after it\n var c = sourceCode.charAt(i);\n var cnext = sourceCode.charAt(i + 1);\n //If newline, add to line number count\n if (c == \"\\n\") {\n lineNumber++;\n }\n else {\n //Based on current state and current character, get the next state\n state = currentDFA[state][c];\n //If there is no next state, the string is illegal\n if (typeof state === \"undefined\") {\n var t = new Token(\"T_unknown\", currentString, lineNumber);\n tokens.push(t);\n return tokens;\n }\n //If this is an accepting state and there is no path to continue from here, create a token\n if ((currentDFA[state]['accept'] !== null) && (typeof currentDFA[state][cnext] === \"undefined\" || cnext === '' || cnext === ' ')) {\n //&& DFA[state][cnext] === null && DFA[state][cnext]['accept'] === null //try-catch here\n //Add to current string\n currentString += c;\n //Other check for illegality\n if (typeof currentDFA[state] !== \"undefined\") {\n //If found a space and NOT reading in a \"string literal\"\n if (currentDFA[state]['accept'] === \"T_space\" && !stringMode) {\n }\n else if (currentDFA[state]['accept'] === \"T_quoteString\") {\n //Make a new token and add it\n var t = new Token(currentDFA[state]['accept'], currentString, lineNumber);\n //If string mode is off, set it to on. If string mode is on, set it to off.\n stringMode = stringMode ? false : true;\n //Switch to the DFA for reading in strings, or the default one.\n if (stringMode) {\n currentDFA = stringDFA;\n }\n else {\n currentDFA = DFA;\n }\n tokens.push(t);\n }\n else {\n var t = new Token(currentDFA[state]['accept'], currentString, lineNumber);\n tokens.push(t);\n }\n }\n else {\n var t = new Token(\"T_unknown\", currentString, lineNumber);\n tokens.push(t);\n return tokens;\n }\n //Reset current string and go back to start state to look for more tokens\n currentString = \"\";\n state = 's1';\n }\n else {\n currentString += c;\n }\n }\n }\n return tokens;\n}", "function main() {\n var m_temp = readLine().split(' ');\n var m = parseInt(m_temp[0]);\n var n = parseInt(m_temp[1]);\n magazine = readLine().split(' ');\n ransom = readLine().split(' ');\n if (canCreateNote(ransom, magazine)) {\n console.log('Yes');\n } else {\n console.log('No');\n }\n}", "function analyzer (text) {\n var sentences = text.split('.');\n var cleanedText = processPhrase(sentences);\n var result = mapper(cleanedText);\n console.log(result);\n}", "function Lexer(a){this.tokens=[],this.tokens.links={},this.options=a||Marked.defaults,this.rules=block.normal,this.options.gfm&&(this.options.tables?this.rules=block.tables:this.rules=block.gfm)}", "constructor() {\n this.mm = require('marky-mark');\n }", "function Pspm(pssm) {\n //variable prototype\n this.alph_length = 0;\n this.motif_length = 0;\n this.pspm = new Array();\n //function prototype\n this.copy = Pspm_copy;\n this.reverse_complement = Pspm_reverse_complement;\n this.get_stack = Pspm_get_stack;\n this.get_stack_ic = Pspm_get_stack_ic;\n this.get_motif_length = Pspm_get_motif_length;\n this.get_alph_length = Pspm_get_alph_length;\n this.toString = Pspm_to_string;\n //construct\n var pspm_header = /letter-probability matrix:\\s+alength=\\s+(\\d+)\\s+w=\\s+(\\d+)\\s+/;\n var is_prob = /^((1(\\.0+)?)|(0(\\.\\d+)?))$/;\n var is_empty = /^\\s*$/;\n var lines = pssm.split(/\\s*\\n\\s*/);\n var read_pssm = false;\n var line_num = 0;\n var col_num = 0;\n for (line_index in lines) {\n var line = lines[line_index];\n if (is_empty.test(line)) {\n continue;\n }\n if (!read_pssm) {\n var header_match = pspm_header.exec(line);\n if (header_match != null) {\n read_pssm = true;\n this.alph_length = (+header_match[1]);\n this.motif_length = (+header_match[2]);\n this.pspm = new Array(this.motif_length);\n }\n continue;\n }\n if (line_num >= this.motif_length) {\n throw \"TOO_MANY_ROWS\";\n }\n this.pspm[line_num] = new Array(this.alph_length);\n col_num = 0;\n var parts = line.split(/\\s+/);\n for (part_index in parts) {\n var prob = parts[part_index];\n if (!is_prob.test(prob)) continue;\n if (col_num >= this.alph_length) {\n throw \"TOO_MANY_COLS\";\n }\n this.pspm[line_num][col_num] = (+prob);\n col_num++;\n }\n if (col_num != this.alph_length) {\n throw \"TOO_FEW_COLS\";\n }\n line_num++;\n }\n if (line_num != this.motif_length) {\n throw \"TOO_FEW_ROWS\";\n }\n}", "function createTree() {\n const states = {};\n\n states[5] = {descriptor: 'style'}\n states[6] = {descriptor: 'solid'}\n states[7] = {descriptor: 'isInset=false'}\n states[8] = {descriptor: 'material'}\n states[9] = {descriptor: 'mdf'}\n states[10] = {descriptor: 'cost'}\n states[11] = {descriptor: 'profile'}\n states[12] = {descriptor: 'soft maple'}\n states[15] = {descriptor: 'walnut'}\n states[18] = {descriptor: 'alder'}\n states[21] = {descriptor: 'panel'}\n states[22] = {descriptor: 'isInset=true'}\n states[24] = {descriptor: 'shaker'}\n states[25] = {descriptor: 'mdfCore'}\n states[26] = {descriptor: 'soft maple'}\n states[27] = {descriptor: 'nonMdfCore'}\n states[28] = {descriptor: 'soft maple'}\n states[29] = {descriptor: 'walnut'}\n states[30] = {descriptor: 'alder'}\n\n states[32] = {descriptor: 'isInset (type===Inset)'}\n states[33] = {descriptor: 'magnet'}\n\n\n const dTree = new DecisionTree('root');\n const dNode = dTree.root();\n const statess = dTree.addStates(states);\n const style = dNode.then(5);\n const solid = style.then(6);\n const material = solid.then([7,8])[1];\n const materials = material.then([9,12,15,18]);\n materials[0].then([10,11]);\n materials[1].addChildren(9);\n materials[2].addChildren(materials[1]);\n materials[3].addChildren(materials[0].stateConfig());\n dTree.toString();\n\n const panel = style.then(21);\n panel.then(22);\n const profile = panel.then(11);\n const shaker = profile.then(24);\n shaker.then(25).then(26);\n const nonMdfCore = shaker.then(27);\n const alder = nonMdfCore.then([28,29,30])[2];\n\n dNode.then(32).then(33);\n\n return dTree;\n}", "constructor(text) {\n this.text = text;\n this.words = [];\n \n }", "function processing(hljs) {\n return {\n name: 'Processing',\n keywords: {\n keyword: 'BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color ' +\n 'double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject ' +\n 'Object StringDict StringList Table TableRow XML ' +\n // Java keywords\n 'false synchronized int abstract float private char boolean static null if const ' +\n 'for true while long throw strictfp finally protected import native final return void ' +\n 'enum else break transient new catch instanceof byte super volatile case assert short ' +\n 'package default double public try this switch continue throws protected public private',\n literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI',\n title: 'setup draw',\n built_in: 'displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key ' +\n 'keyCode pixels focused frameCount frameRate height width ' +\n 'size createGraphics beginDraw createShape loadShape PShape arc ellipse line point ' +\n 'quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint ' +\n 'curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex ' +\n 'endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap ' +\n 'strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased ' +\n 'mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour ' +\n 'millis minute month second year background clear colorMode fill noFill noStroke stroke alpha ' +\n 'blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY ' +\n 'screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ' +\n 'ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle ' +\n 'pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf ' +\n 'nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset ' +\n 'box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings ' +\n 'loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput ' +\n 'createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings ' +\n 'saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale ' +\n 'shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal ' +\n 'pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap ' +\n 'blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont ' +\n 'loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil ' +\n 'constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees ' +\n 'radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed'\n },\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE\n ]\n };\n}" ]
[ "0.75802875", "0.7417897", "0.6977266", "0.6777092", "0.59956497", "0.57939446", "0.5779247", "0.571849", "0.5679027", "0.56694925", "0.56502324", "0.56502324", "0.54595965", "0.5457738", "0.54551107", "0.5422826", "0.5389011", "0.5389011", "0.5389011", "0.5389011", "0.5389011", "0.5389011", "0.5389011", "0.53438234", "0.52838165", "0.52664584", "0.5260685", "0.52543604", "0.5220035", "0.5196868", "0.51930183", "0.5164059", "0.5084895", "0.50679284", "0.5045625", "0.50326246", "0.50302976", "0.5030206", "0.50253683", "0.50157034", "0.5011174", "0.49719873", "0.49375778", "0.49375778", "0.49216315", "0.4919068", "0.49140567", "0.49047467", "0.49014744", "0.48990685", "0.4886307", "0.48491606", "0.483945", "0.4827686", "0.48268133", "0.4811758", "0.4781314", "0.47804132", "0.47801447", "0.4776905", "0.47638488", "0.47632614", "0.47501826", "0.4736545", "0.47348794", "0.47321898", "0.47318974", "0.47082478", "0.47082478", "0.47082478", "0.47082478", "0.47064066", "0.47027045", "0.46927863", "0.46909901", "0.46894655", "0.46872693", "0.4677845", "0.4673398", "0.46629697", "0.46596104", "0.46593046", "0.46558538", "0.46555927", "0.46522602", "0.46400642", "0.46352884", "0.4632166", "0.4608534", "0.46040356", "0.46034455", "0.46020317", "0.45944816", "0.45944685", "0.45907032", "0.45891953", "0.45835316", "0.45814806", "0.4570307", "0.4568433" ]
0.6682317
4
Helper function to generate a random number Takes in object Returns a random number between 1 and length of object passed in
_getRandomNum(array){ // console.log("array = ", array); return Math.floor(Math.random() * Math.floor(array.length)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRandomlyNumber(){\n\treturn Math.floor(Math.random()*10)\n}", "generateRandomNumber() {\n return this.generateRandom(0, 10);\n }", "function randNumber () {\n\treturn Math.floor(Math.random() * 10);\n}", "function randomNumberGenerator() {\n\treturn (Math.floor(((Math.random() * 9) + 1)));\n}", "function generateTarget(number) {\n return Math.floor(Math.random() * 10); \n}", "function generaNumero(num) {\n\n nRandom = parseInt(Math.random() * num + 1);\n\n return nRandom;\n}", "function generateTarget(){\n return Math.floor(Math.random() * 10);\n}", "function randomNumberGenerator(){\n return (10+ Math.floor(Math.random()*(99-10+1)));\n}", "randomLikeGenerator() {\n return Math.floor(Math.random() * 10) + 1\n }", "function generateTarget(num){\r\n return Math.floor(Math.random() * 10);\r\n}", "function generateTarget(num){\r\n return Math.floor(Math.random() * 10);\r\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n }", "function randomNumber(int) {\n return Math.floor(Math.random() * int);\n }", "function randomNumber() {\n return Math.floor(Math.random() * 10 + 1);\n}", "function getRandomNum() {\n return Math.floor(1 + Math.random() * 10);\n}", "function randomNumber() {\n return Math.floor(Math.random() * 10) + 1;\n\n}", "function generateTarget(){\n return Math.floor(Math.random() * 10);\n}", "function generateTarget(){\n return Math.floor(Math.random() * 10);\n}", "function randoNum(end) {\n\treturn Math.floor(Math.random() * end);\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function getRandomNr() {\n return Math.floor(Math.random() * 10) + 300\n}", "function generateTarget(){\n return Math.floor(Math.random () * 10)\n}", "function generateRandomNumber(num){\r\n return Math.floor(Math.random() * num)\r\n}", "generateRandomNumber (){\n let number = Math.floor((Math.random() * 10) + 1);\n return number;\n }", "function generateTarget(){\n return Math.floor(Math.random()*10)\n \n}", "function randomNumberGenerator(){\n return Math.floor(Math.random()*1000);\n }", "function generateTarget(){\n\treturn Math.floor(Math.random()*10);\n}", "function randomNumber(upto) {\n return Math.floor(Math.random() * (upto + 1));\n }", "function rando() {\n return Math.floor(Math.random() * (people.length));\n }", "function getRandomInt(){\n return Math.floor(Math.random() * 10);\n}", "function getRandomNumber () {}", "function randnum(length){\n return Math.floor(length * (Math.random() % 1));\n }", "getRandom() {\n return Math.floor((Math.random() * 10) + 1);\n }", "function generateTarget() {\n return Math.floor(Math.random() * 10) \n}", "function generateRandNum()\n{\n return Math.ceil(Math.random() * 10)\n}", "function generateTarget() { \n return Math.floor(Math.random() * 9)\n;}", "function generateTarget() {\n return Math.floor(Math.random() * 10);\n}", "function generateTarget() {\n return Math.floor(Math.random() * 10);\n}", "function generateTarget() {\n return Math.floor(Math.random() * 10)\n}", "function genNum(){\n\trandomNum = Math.floor(Math.random() * Math.floor(numberMax + numberMin)) \n}", "function randomNumber(num){\r\n return Math.floor( Math.random() * num)\r\n}", "function generateRandomNumber(){\n return Math.floor((Math.random()*100)+1);\n }", "function myNumber(n) {\n return Math.floor(Math.random() * n);\n}", "function generateTarget() {\n return Math.floor(Math.random()*10)\n}", "function getNumber(){\n return (1 + Math.floor(48 * Math.random()));\n}", "function randomInt_1_10(){\n\treturn Math.floor(Math.random()*(10-1))+1;\n}", "function randomNumberGenerator(){\n return Math.floor(Math.random()*1000);\n}", "function generateRandomNumber(){\n return Math.random();\n}", "function generateTarget() {\n return Math.floor(Math.random() * 10);\n}", "function generateTarget() {\n return Math.floor(Math.random() * 10);\n}", "function generateNumber() {\n return 5;\n}", "function randomNumber() {\n return Math.random() * 10; \n}", "function randomNumGen(num){\n return Math.floor(Math.random() * num );\n}", "function generateTarget() {\n\treturn Math.floor(Math.random() * 10);\n}", "function randomNum_1_10(){\n\treturn Math.random()*(10-1)+1;\n}", "function randomNumberGenerator(){\n const randomNumber = Math.floor(Math.random() * 10) + 0;\n return randomNumber;\n}", "function generateNum() {\n\treturn Math.floor(Math.random()*100)\n}", "function generateTarget() {\n return Math.floor(Math.random()* 9)\n}", "function generateRandomNum(n) {\n return Math.floor(Math.random() * n)\n}", "function randomNumber(){\n return (Math.round(1 * Math.random()) + 1);\n }", "function randkey(obj){\n var rand = Math.floor(Math.random()*obj.length)\n return rand}", "function randomNr() {\n return Math.floor(Math.random() * 9999);\n}", "function randomNumber() {\n return Math.random() * 10;\n}", "function getRandom(){\r\n\treturn Math.floor(Math.random() * 10);\r\n}", "function randomNumber() {\r\n return Math.random;\r\n}", "function generateNumber() {\n\t\treturn Math.floor(Math.random() * tipsArray.length);\n\t}", "function randomNumber(){\n let rand = Math.floor(Math.random()*10);\n return(rand); \n}", "function generateTarget() {\n return Math.floor(Math.random() * 9);\n}", "function generateTarget() {\n return Math.floor(10 * Math.random());\n}", "function generaNumero(){\n let numero = Math.floor(Math.random() * 4 ) + 1;\n return numero;\n}", "function getNumber() {\n return Math.random();\n}", "function randomNumber(){\n return Math.random\n}", "function generaRandom(){\n return Math.floor(Math.random() * 5 + 1);\n}", "function genaratoreNumeriRandom(numero) {\n return Math.floor(Math.random() * numero) +1;\n}", "function random(num){\r\n randomNumber = Math.floor(Math.random()*num);\r\n}", "function GetRandomNumber(length) {\n var i = Math.floor((Math.random() * length) + 1);\n\n return i;\n}", "function crearNumeroAleatorio() {\n let number = Math.round(Math.random() * 10000);\n\n return number;\n}", "function generateRandomNumber(x) {\n return Math.floor(Math.random() * x)\n}", "genRandNumber(digitlength){\n var myNum = \"\"\n while(myNum.length < digitlength){\n myNum = (Math.round(Math.random() * Math.pow(10,digitlength))).toString()\n }\n return Number(myNum) \n }", "function numberGenerator() {\n var numero = Math.floor(Math.random() * numeroTotaleGiocate) + 1;\n return numero;\n}", "function randomNumber(){\r\n return Math.random();\r\n}", "function rand(numero) {\n\treturn Math.floor(Math.random() * numero) + 1;\n}", "function randNum(){\n\tvar num = Math.floor(Math.random() * 9) +1 ;\n\treturn num;\n\n}", "function getRandom(n){ \n return Math.floor(Math.random()*n+1) \n}", "function random(number) {\n return Math.floor(Math.random() * (number+1));\n}", "rando() {\n randomNum = Math.floor(Math.random() * 20);\n }", "function getRandNum(x) { \r\n return Math.floor(Math.random() * x);\r\n}", "function generateRandomIndex() {\n return Math.floor(Math.random() * 10);\n}", "function genRandom(a) {\n return parseInt(Math.random()*a);\n}", "function randonNumber(number) {\n return Math.floor(Math.random() * number);\n}", "function genNum() {\n // 198 = 99 - (-99)\n return Math.floor((Math.random() * 198) - 99);\n}", "function getRandomNum(){\n var number = Math.floor(Math.random() * 9) + 1;\n return number;\n}", "function randomNum(num){\n return Math.floor(Math.random()*num);\n}", "function random(number) {\n return Math.floor(Math.random() * (number+1));\n}", "function randomNumber() {\n return Math.floor(Math.random() * MAX_NUMBER) + 1;\n}" ]
[ "0.7339179", "0.7238554", "0.7232579", "0.71919245", "0.7161117", "0.71608317", "0.71505284", "0.7147857", "0.71470064", "0.7139242", "0.7139242", "0.7137532", "0.7134615", "0.7127958", "0.71106315", "0.7110365", "0.71077687", "0.71077687", "0.7087935", "0.70866597", "0.70866597", "0.70866597", "0.70866597", "0.70866597", "0.70866597", "0.70866597", "0.707429", "0.7069297", "0.70537543", "0.70442885", "0.70318836", "0.7031198", "0.70228356", "0.70121855", "0.70080006", "0.7007543", "0.7001831", "0.6998291", "0.6991961", "0.6985011", "0.698055", "0.69791263", "0.69748884", "0.69748884", "0.69678503", "0.69600695", "0.69555885", "0.69464505", "0.69464207", "0.6934942", "0.6927434", "0.6923297", "0.6921512", "0.6916734", "0.6910065", "0.6910065", "0.69027877", "0.69024587", "0.69012", "0.6890094", "0.68857235", "0.68836075", "0.68832165", "0.68818474", "0.6879694", "0.6877724", "0.6873231", "0.68704367", "0.68676114", "0.68634", "0.68592286", "0.68581164", "0.6857121", "0.68544346", "0.6853848", "0.6844274", "0.6841247", "0.6829657", "0.68198216", "0.681682", "0.6812758", "0.6811829", "0.68058014", "0.6804984", "0.68019927", "0.6800004", "0.6796428", "0.6792823", "0.67927885", "0.67875034", "0.6786368", "0.6784306", "0.6778303", "0.67761153", "0.67735183", "0.6770938", "0.67702305", "0.67675227", "0.67647904", "0.6761888", "0.67614686" ]
0.0
-1
return random text from chains
getText(numWords = 100) { const objKeys = Object.keys(this.markovChain); // console.log("objKeys = ", objKeys); let chosenWord; let currNumWords = text.length; let randomKeyIdx = this._getRandomNum(objKeys); let key = objKeys[randomKeyIdx]; let text = []; while (chosenWord !== null && currNumWords <= numWords) { console.log("key = ", key); let wordList = this.markovChain[key]; console.log("wordlist = ", wordList); let randomWordIdx = this._getRandomNum(wordList); if (wordList.length === 1) chosenWord = wordList[0]; chosenWord = wordList[randomWordIdx]; // console.log("chosenWord = ", chosenWord); key = chosenWord; text.push(chosenWord); currNumWords = text.length; } console.log("text = ", text.join(' ')); return text.join(' '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeText(numWords = 100) {\n let chains = this.makeChains(); // MM object\n \n // first word to start chaining\n let key_words = Object.keys(chains); // array of key-words in MM object to choose from\n let key_num = key_words.length; // number of words to choose from\n let key_ind = Math.floor(Math.random()*key_num); // random index in key_words array\n let curr_word = key_words[key_ind]; //current word \n let resultText = curr_word; \n for (let i = 2; i <= numWords; i++) {\n let next_word_ind = Math.floor(Math.random()*chains[curr_word].length);\n let next_word = chains[curr_word][next_word_ind];\n if (next_word) {\n resultText = [resultText, next_word].join(' ');\n curr_word = next_word; \n }\n else {\n return resultText; \n }\n }\n return resultText; \n }", "makeText(numWords = 100) {\n let keys = Object.keys(this.chains);\n let key = keys[Math.floor(Math.random() * Math.floor(keys.length))];\n let textArray = [];\n\n while (textArray.length < numWords && key !== null) {\n textArray.push(key);\n key = this.chains[key][\n Math.floor(Math.random() * Math.floor(this.chains[key].length))\n ];\n }\n return textArray.join(\" \");\n }", "makeText(numWords = 100) {\n // TODO\n const keys = Object.keys(this.chains)\n let text = ''\n let prevWord;\n for(let i = 0; i <= numWords; i++){\n if(prevWord === undefined){\n let ranKey = keys[Math.floor(Math.random() * keys.length)]\n let ranWord = this.chains[ranKey][Math.floor(Math.random() * this.chains[ranKey].length)]\n if(ranWord !== undefined){\n text = text+ranWord+' '\n prevWord = ranWord\n }\n }else{\n let ranWord = this.chains[prevWord][Math.floor(Math.random() * this.chains[prevWord].length)]\n if(ranWord !== undefined){\n text = text+ranWord+' '\n prevWord = ranWord;\n }else{\n break\n }\n }\n }\n return text.trim();\n }", "makeText(numWords = 100) {\n const numWordsAv = Object.keys(this.chains).length;\n let randNum, text;\n do {\n randNum = Math.floor(Math.random() * numWordsAv);\n text = [Object.keys(this.chains)[randNum]];\n } while (text[0] === text[0].toLowerCase())\n\n if (text[0].slice(-1) === '.') {\n return text.toString();\n }\n \n for (let i = 0; i < numWords - 1; i++) {\n let randNum = Math.floor(Math.random() * this.chains[text[i]].length);\n if (this.chains[text[i]][randNum] === null ) {\n break;\n } else {\n text.push(this.chains[text[i]][randNum])\n if (this.chains[text[i]][randNum].slice(-1) ==='.') break;\n }\n }\n return text.join(\" \")\n }", "getText(numWords = 100) {\n let outputText = [];\n \n let keys = Array.from(Object.keys(this.markovChains));\n let keyWord = MarkovMachine.randomlyPickElementNotNull(keys);\n\n while (numWords > 0) {\n let wordChoices = this.markovChains[keyWord];\n let nextWord = MarkovMachine.randomlyPickElement(wordChoices);\n\n if (nextWord === null) {\n outputText.push(`${keyWord}.`);\n keyWord = MarkovMachine.randomlyPickElementNotNull(keys);\n\n } else {\n outputText.push(keyWord);\n keyWord = nextWord;\n\n }\n\n numWords--;\n }\n\n let returnedText = outputText.join(\" \");\n return returnedText;\n\n }", "makeText(numWords = 100) {\n // TODO\n\n let chainObj = this.makeChains();\n let randomStarIdx = Math.floor(Math.random() * this.words.length);\n let randomStartWord = this.words[randomStarIdx];\n let text = [randomStartWord];\n\n for (let i = 0; i < numWords - 1; i++) {\n let value = chainObj[text[i]]\n\n if (value[0] === null) {\n return text.join(' ');\n }\n if (value.length === 1) {\n text.push(value);\n } else {\n let randomIdx = Math.floor(Math.random() * value.length);\n let randomWord = value[randomIdx];\n text.push(randomWord);\n }\n }\n\n return text.join(' ');\n }", "makeText(numWords = 100) {\n let words = Object.keys(this.chains);\n\n let capWords = words.filter(word => word[0] === word[0].toUpperCase());\n let text = this.randomPick(capWords);\n let firstWord = text;\n let nextWord = this.singleChain(firstWord);\n\n for (let i=1; i < numWords - 1; i++) {\n text += \" \";\n let bigram = `${firstWord} ${nextWord}`;\n firstWord = nextWord;\n if (this.bigrams[bigram]) {\n let pick = this.randomPick(this.bigrams[bigram]);\n nextWord = pick ? pick : this.randomPick(words);\n } else {\n nextWord = this.singleChain(firstWord);\n }\n text += nextWord;\n }\n return text;\n }", "makeText(numWords = 50) {\n let newText = \"\";\n // initially word will be a random word from words arr\n let word = this.words[Math.floor(Math.random() * this.words.length)]\n newText = newText + word + \" \";\n for (let i=0; i<numWords; i++) {\n if (this.chains[word][0] == null) {\n return newText;\n } else {\n word = this.chains[word][Math.floor(Math.random() * this.chains[word].length)]\n newText = newText + word + \" \";\n }\n }\n\n return newText;\n }", "makeText(numWords = 100) {\n const startWordIndex = Math.floor(Math.random() * Object.keys(this.startChains).length);\n let prevWord = Object.keys(this.startChains)[startWordIndex];\n let randomText = prevWord;\n\n for (let i = 1; i < numWords; i++) {\n const nextRandom = Math.floor(Math.random() * this.chains[prevWord].length);\n const nextWord = this.chains[prevWord][nextRandom];\n randomText += ' ';\n if (nextWord) {\n randomText += nextWord.toLowerCase();\n prevWord = nextWord;\n } else {\n randomText += this.makeText(numWords - i);\n break;\n }\n }\n if (prevWord.charAt(prevWord.length - 1) === ',') {\n randomText = randomText.slice(0, randomText.length - 1)\n }\n if (!END_PUNCTUATION.includes(prevWord.charAt(prevWord.length - 1))) {\n randomText += '.'\n }\n return randomText.trim()\n }", "makeText(numWords = 100) {\n\n function getRandomElement(array) {\n // Pick a random element form the array\n return array[Math.floor(Math.random() * array.length)];\n }\n\n function getRandomKey(obj) {\n // Return randomly select key from the array of keys\n return getRandomElement(Object.keys(obj))\n }\n\n const wordChain = this.makeChains(); // get a static instance of the word chain\n // console.log(wordChain);\n const wordArray = []; // the array that will be returned\n for(let i = 0; i < numWords; i++) {\n if(wordArray.length === 0) {\n wordArray.push(getRandomKey(wordChain));\n // console.log('first word in array: ', wordArray);\n } else {\n const lastWord = wordArray[wordArray.length - 1];\n // console.log(lastWord);\n const chainValue = wordChain[lastWord];\n // console.log(chainValue);\n const selectedWord = getRandomElement(chainValue);\n \n if(!selectedWord) {\n return wordArray.join(' ');\n }\n wordArray.push(selectedWord);\n }\n }\n\n return wordArray.join(' ');\n }", "makeText(numWords = 100) {\n\n let chain = this.makeChains();\n let story = [];\n let keyArray = Object.keys(chain);\n\n let randomNumber = this.getRandNum(keyArray.length);\n story.push(keyArray[randomNumber]);\n\n for(let i = 0; i < numWords-1; i++){\n let randIndex = this.getRandNum(chain[story[i]].length);\n if(chain[story[i]][randIndex] === null){\n break;\n }\n else{\n story.push(chain[story[i]][randIndex]);\n }\n }\n return story.join(' ');\n\n }", "makeText(numWords = 100) {\n let numWordsArr = []\n if (this.chain === undefined) {\n return \"\"\n }\n const Keys = Object.keys(this.chain)\n while (numWordsArr.length < numWords) {\n let randomKey = Keys[Math.floor(Math.random() * Keys.length)]\n let randomWord = this.chain[randomKey][Math.floor(Math.random() * this.chain[randomKey].length)]\n if (randomWord !== null) {\n numWordsArr.push(randomWord)\n }\n }\n return numWordsArr.join(' ')\n }", "getText(numWords = 100) {\n // MORE CODE HERE\n let textArr = [];\n let wordChoice = Array.from(this.words);\n let word = this.getRandomElement(wordChoice)\n \n \n while (textArr.length < numWords && word !== null){\n textArr.push(word)\n\n let nextWord = this.getRandomElement(this.chain.get(word))\n //append to textarr the newly defined word\n word = nextWord\n\n }\n return textArr.join(\" \");\n }", "getText(numWords = 100) {\n console.log(\"getText ran\");\n // 1. randomly select a word from this.words\n // 2. append it to this.text\n // 3. find the selected word in this.chains\n // 4. randomly select a word from this.chains[word]\n // 5. repeat steps 2-4\n\n let randomIdx = Math.floor(Math.random() * this.words.length)\n let randomWord = this.words[randomIdx];\n\n let nextWord = randomWord;\n\n for (let i=0; i<numWords && nextWord !== null; i++) {\n console.log(\"inside for loop, nextWord is:\", nextWord, nextWord === null);\n this.text += nextWord + \" \";\n nextWord = this.getNextWord(nextWord)\n }\n\n // let count = 0;\n // while (nextWord !== null && count <= numWords) {\n // console.log(\"inside while loop, nextWord is:\", nextWord, nextWord === null);\n // this.text += nextWord + \" \";\n // nextWord = this.getNextWord(nextWord)\n // count++;\n // }\n\n console.log(\"this is the result:\", this.text);\n }", "function generateRandom() {\n // some random function to generate code, hidden\n return text;\n}", "makeText(numWords = 50) {\n\t\tlet wordsObj = this.makeChains(); //This is an object\n\t\tlet arr = [];\n\t\tlet wordsObjKeys = Object.keys(wordsObj);\n\t\tlet startidx = Math.floor(Math.random() * wordsObjKeys.length);\n\t\tlet pushWord = wordsObjKeys[startidx];\n\t\tarr.push(pushWord);\n\t\twhile (numWords > arr.length) {\n\t\t\tlet val = wordsObj[pushWord];\n\t\t\tlet idx = Math.floor(Math.random() * val.length);\n\t\t\tif (val[idx] === null) {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tarr.push(val[idx]);\n\t\t\t\tpushWord = val[idx];\n\t\t\t}\n\t\t}\n\t\treturn arr.join(\" \");\n\t}", "function randomBlocText(k){\n result=\"\";\n for(var i=0;i<k;i++){\n var newWord=randomWord();\n if(i==0){\n newWord=capitalizeFirstLetter(newWord);\n }\n result+=randomPhrase();\n }\n return result;\n}", "function generateText(text) {\n let mm = new MarkovMachine(text);\n console.log(mm.makeText());\n}", "static readRandomSentence(theme) {\r\n console.log(Main.firstPartlistImpl.readRandomThemedPart(theme) + Main.secondPartListImpl.readRandomPart() + Main.thirdPartListImpl.readRandomPart()); \r\n }", "randomText(positive) {\n const posPhrases = [\n 'Goed gedaan!',\n 'Netjes!',\n 'Je doet het súper!',\n 'Helemaal goed!',\n 'Je bent een topper!'\n ]\n const negPhrases = [\n 'Ik weet dat je het kunt!',\n 'Jammer, probeer het nog eens!',\n 'Bijna goed!',\n 'Helaas pindakaas'\n ]\n\n const phrases = positive ? posPhrases : negPhrases\n const maximumNumber = phrases.length\n const randomNumber = Math.floor(Math.random() * maximumNumber)\n \n return phrases[randomNumber]\n }", "getWord(){\n\t\t//generate a randome number between 0 and 1\n\t\tvar r = Math.random();\n\t\tvar sum = 0;\n\t\t//for each of the words associated with the chain\n\t\tfor(var e of this.preds){\n\t\t\t//add the word probability to the sum\n\t\t\tsum += e.proba;\n\t\t\t//once the sum reaches r or above\n\t\t\tif(sum > r){\n\t\t\t\t//pick the word\n\t\t\t\treturn e.word;\n\t\t\t}\n\t\t}\n\t}", "function random_text(n) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n for( var i=0; i < n; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n }", "function simpleText()\n {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n for( var i=0; i < 5; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n }", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * Math.floor(5));\n const randomPhrase = this.phrases[randNum];\n return randomPhrase;\n }", "text(nChars){\n let text = \"\";\n while(text.length < nChars){\n let index = Math.floor((Math.random() * words.length));\n text += words[index] + \" \";\n }\n\n //If the text is longer cut it \n if(text.length > nChars){\n let difference = text.length - nChars;//lorem 3 \n text = text.substring(0,text.length - difference);\n }\n\n return text + \".\";\n }", "getRandomPhrase() {\n var randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber]\n }", "function makeFinalMarkov(textStamps, markovText){\n var output = [];\n for(var i = 0; i < markovText.length; i++){\n var curWord = markovText[i];\n var chooseArr = textStamps[curWord];\n output.push(chooseArr[Math.floor(Math.random() * chooseArr.length)]);\n }\n return output;\n}", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * this.phrases.length);\n const phrase = this.phrases[randNum];\n return phrase;\n }", "function randomize(text){\n var textArray=[];\n\n //first turn the string into an array\n for(var i=0;i<text.length;i++){\n textArray[i]=text.charAt(i);\n }\n \n var aux;\n var random;\n\n //For the lenght of the array, every element is randomly switched \n for(var i=0;i<text.length;i++){\n random=Math.floor(Math.random()*textArray.length);\n aux=textArray[random];\n textArray[random]=textArray[i];\n textArray[i]=aux;\n }\n\n var resp=\"\";\n\n //turn the array into a string\n for(var i=0;i<text.length;i++){\n resp=resp.concat(textArray[i]);\n }\n\n //return the mixed string\n return resp;\n}", "function randomStartingPhrase() {\n if (Math.random() < 0.33) {\n return phrases[Math.floor(Math.random() * phrases.length)]\n }\n return ''\n}", "getRandomPhrase() {\n let randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber];\n }", "getRandomPhrase(){\n \t\tconst randomIndex = Math.floor(Math.random()*this.phrases.length)\n \t\treturn this.phrases[randomIndex];\n \t}", "generateRandomSentence() {\n if (this.state.loaded) {\n var name = this.state.wubbynames[getRandomInt(0, this.state.wubbynames.length-1)].content;\n var action = this.state.sentenceActions[getRandomInt(0, this.state.sentenceActions.length-1)].content;\n var obj = this.state.sentenceObjects[getRandomInt(0, this.state.sentenceObjects.length-1)].content;\n\n var sentence = 'I want ' + name + ' to ' + action + ' with ' + obj;\n this.setState({ currentSentence: sentence });\n }\n\n }", "function randomtext() {\n var randomtxt = [\n 'Always remember, Frodo, the page is trying to get back to its master. It wants to be found. Gandalf, <a href=\"https://www.imdb.com/title/tt0120737/\"> The Lord of the Rings: The Fellowship of the Ring (2001)</a>',\n 'Webpages? Where we&apos;re going, we don&apos;t need webpages. Dr. Emmett Brown, <a href=\"https://www.imdb.com/title/tt0088763/\"> Back to the Future (1985)</a>',\n 'Where&apos;s the page, Lebowski ? Where&apos;s the page? Blond Thug, <a href=\"https://www.imdb.com/title/tt0118715/\"> The Big Lebowski (1998)</a>',\n 'What we&apos;ve got here is...failure to communicate. Captain, <a href=\"https://www.imdb.com/title/tt0061512/\"> Cool Hand Luke (1967)</a>',\n 'Lord! It&apos;s a miracle! Webpage up and vanished like a fart in the wind! Warden Norton, <a href=\"https://www.imdb.com/title/tt0111161/\"> The Shawshank Redemption (1994)</a>',\n 'What&apos;s on the page ? Detective David Mills, <a href=\"https://www.imdb.com/title/tt0114369/\"> Se7en (1995)</a>',\n 'This is not the webpage you&apos;re looking for. Obi-Wan Kenobi, <a href=\"https://www.imdb.com/title/tt0076759/\"> Star Wars: Episode IV - A New Hope (1977)</a>',\n 'Surely you can&apos;t be serious! I am serious.And don&apos;t call me Shirley. Ted Striker & Rumack, <a href=\"https://www.imdb.com/title/tt0080339/\"> Airplane! (1980)</a>',\n 'There is no page. Spoon Boy, <a href=\"https://www.imdb.com/title/tt0133093/\"> The Matrix (1999)</a>',\n 'The page did a Peter Pan right off of this website, right here. Deputy Marshal Samuel Gerard, <a href=\"https://www.imdb.com/title/tt0106977/\"> The Fugitive (1993)</a>',\n 'Well, what if there is no webpage? There wasn&apos;t one today. Phil Connors, <a href=\"https://www.imdb.com/title/tt0107048/\"> Groundhog Day (1993)</a>',\n 'He&apos;s off the map! He&apos;s off the map! Stan, <a href=\"https://www.imdb.com/title/tt0338013/\"> Eternal Sunshine of the Spotless Mind (2004)</a>',\n 'Page not found? INCONCEIVABLE. Vizzini, <a href=\"https://www.imdb.com/title/tt0093779/\"> The Princess Bride (1987)</a>',\n 'It&apos;s the one that says &apos;Page not found&apos; Jules Winnfield, <a href=\"https://www.imdb.com/title/tt0110912/\"> Pulp Fiction (1994)</a>'];\n return randomtxt[Math.floor((Math.random() * 13.99))];\n}", "getRandomPhrase () {\n const phrases = this.phrases;\n const randIndex = Math.floor(Math.random() * phrases.length);\n return phrases[randIndex];\n }", "function makeStringWithJson(markovJson, textList, len){\n var output = [];\n var curIndex = 0;\n for(var i = 0; i < len; i++){\n output.push(curIndex);\n var possiblities = markovJson[textList[curIndex]];\n curIndex = possiblities[Math.floor(Math.random()*possiblities.length)];\n }\n for(var i = 0; i < output.length; i++){\n output[i] = textList[output[i]];\n }\n return output;\n}", "getRandomPhrase() {\r\n let randomPhrase = this.phrases[Math.floor(Math\r\n .random() * this.phrases.length)];\r\n return randomPhrase;\r\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\r\n return this.phrases[Math.floor(Math.random()*this.phrases.length)];\r\n }", "function getRandomPhrase() {\n const phrase = phrases[Math.floor(Math.random() * phrases.length)];\n return phrase;\n}", "getRandomPhrase() {\n let randomOneToFive = Math.floor(Math.random() * 5);\n return this.phrases[randomOneToFive];\n }", "static generateRandomText() {\n return Math.random().toString(36).substr(2); // remove `0.`\n }", "getRandomPhrase() {\n const index1 = Math.floor(Math.random() * this.phrases.length);\n function index2(index1) {\n return Math.floor(Math.random() * game.phrases[index1].length);\n }\n if (index1 === 0) {\n this.clue = 'Video Games';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 1) {\n this.clue = 'Literature';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 2) {\n this.clue = 'Golden Girls Quotes';\n return this.phrases[index1][index2(index1)];\n } else {\n this.clue = 'Crafts';\n return this.phrases[index1][index2(index1)];\n }\n }", "getRandomPhrase() { // Gets a random phrase\n const rand = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n return rand;\n }", "words(number,asText){\n let obj;\n if(asText){\n obj = \"\";\n for(let i = 0 ; i < number ;i++){\n let index = Math.floor((Math.random() * words.length));\n obj += words[index] + \" \";\n }\n }else{\n obj = [];\n for(let i = 0 ; i < number ;i++){\n let index = Math.floor((Math.random() * words.length));\n obj.push(words[index]);\n }\n }\n return obj;\n }", "words(number,asText){\n let obj;\n if(asText){\n obj = \"\";\n for(let i = 0 ; i < number ;i++){\n let index = Math.floor((Math.random() * words.length));\n obj += words[index] + \" \";\n }\n }else{\n obj = [];\n for(let i = 0 ; i < number ;i++){\n let index = Math.floor((Math.random() * words.length));\n obj.push(words[index]);\n }\n }\n return obj;\n }", "getRandomPhrase() {\r\n let randomNumber = Math.floor(Math.random() * this.phrase.length);\r\n //console.log(randomNumber); \r\n return this.phrase[randomNumber];\r\n}", "getRandomPhrase(){\r\n const phraseIdx = Math.floor(Math.random() * this.phrases.length);\r\n return this.phrases[phraseIdx];\r\n }", "getRandomPhrase(){\n return this.phrases[Math.floor(Math.random() * this.phrases.length)];\n }", "function randomizeSentence(sentence) {\n\n}", "getRandomPhrase(){\r\n let randomNumber = Math.floor((Math.random() * 5))\r\n return this.phrases[randomNumber];\r\n }", "getRandomPhrase() {\n return this.phrases[Math.floor(Math.random() * this.phrases.length)];\n }", "getRandomPhrase() {\n return this.phrases[Math.floor(Math.random() * this.phrases.length)];\n }", "getRandomPhrase() {\n let phraseArray = this.phrases;\n let randomPhrase = phraseArray[Math.floor(Math.random() * phraseArray.length)];\n return randomPhrase;\n }", "randomSentence () {\n let sentenceArray = []\n let sentence1 = this.randomSentenceHelper();\n //sentence Array tracks each relative clause generated\n sentenceArray.push(sentence1);\n let num = Math.random();\n //loop continues to generate relative clauses until it fails to meet\n //the random check.\n while(num < Math.min(.85, this.complexity)) {\n let conj = this.randomWord(this.conjunctions);\n sentenceArray.push(conj);\n tempSentence = this.randomSentenceHelper();\n sentenceArray.push(tempSentence);\n num = Math.random();\n }\n joinedSentence = sentenceArray.join(' ');\n //change the first letter to uppercase and replace the last ',' with a '.'\n fullSentence = joinedSentence[0].toUpperCase() + joinedSentence.slice(1, joinedSentence.length -1) + '.';\n return fullSentence;\n }", "function generateContent() {\n const content = faker.lorem.text();\n return content = content[Math.floor(Math.random() * content.length)];\n}", "function selectLink (chain, prior, key) {\n // This check ends the build if a letter is usually NOT followed by other letters\n if (chain.tableLen.word[prior]) {\n var len = chain.tableLen.word[prior][key] || 1\n var idx = Math.floor(Math.random() * len)\n\n var t = 0\n for (var token in chain.word[prior][key]) {\n t += chain.word[prior][key][token]\n if (idx < t) {\n return token\n }\n }\n }\n return '~'\n}", "getRandomPhrase() {\n //Generates random number between 0 and this.phrase.length -1 \n let num = Math.floor(Math.random() * this.phrases.length);\n let randomPhrase = this.phrases[num];\n return randomPhrase;\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomPhrase = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n //return the function by calling the randomPhrase variable\n return randomPhrase;\n }", "function pick() {\r\n index = Math.floor(Math.random() * words.length);\r\n return words[index];\r\n}", "function generateSentence() {\nvar randomIndex = Math.floor(Math.random() * sentences.length);\ncurrentSentence = sentences[randomIndex];\nprompt.innerHTML = currentSentence;\n}", "function random_word(){\n var n = 4 + Math.floor(Math.random() * 6);\n return random_text(n);\n }", "function random_str() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for (var i = 0; i < 5; i++){\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n\n return text;\n }", "getRandomPhrase() {\n const randomPhrase = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomPhrase];\n }", "function getDescription() {\n const lorem = 'lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse bibendum quam non purus semper viverra. Aenean tristique rhoncus velit lobortis faucibus';\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n const loremArr = lorem.split(' ');\n const descArr = loremArr.slice(0, getRandomInt(4, loremArr.length));\n return randomSelect(chars) + descArr.join(' ') + '.';\n}", "function generateRandomString() {\n console.log('generating');\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < 6; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n}", "makeText(numWords = 100) {\n let randNum = Math.floor(Math.random() * this.words.length)\n let word = this.words[randNum]\n let str = ''\n\n for (let i = 0; i < numWords; i++) {\n str += `${word} `\n let randIdx = Math.floor(Math.random() * this.wordsObj[word].length)\n const nextWord = this.wordsObj[word][randIdx]\n if (nextWord === null) {\n // Remove the trailing space at the end of the sentence.\n str.replace(/\\s+$/, '')\n break\n }\n word = nextWord\n }\n\n return str\n }", "function generateContent() {\n const content = ['hot and sunny', 'cold and icy', 'cool and windy', 'cool and sunny'];\n return content[Math.floor(Math.random() * content.length)];\n}", "function getWords() {\n word.innerText = list[Math.floor(Math.random() * list.length)];\n}", "function getRandomDescription () {\n return sampleDescriptions[Math.floor(Math.random()*sampleDescriptions.length)];\n}", "create_random_phrase(N) {\n let phrase = \"\";\n\n for (let n = 0; n < N; n++) {\n // Selects a random number in range [0, 128)\n // and converts to a string character\n let char = String.fromCharCode(random(32, 128));\n\n phrase += char;\n }\n\n return phrase;\n }", "function nthName() {\n return \"The \" + randomChoice(data.lineage)\n}", "getNextWord(currentWord) {\n console.log(\"getNextWord ran and currentWord is:\", currentWord);\n let randomIdx = Math.floor(Math.random() * this.chains[currentWord].length);\n let newWord = this.chains[currentWord][randomIdx];\n\n return newWord;\n }", "function generate() {\n return [getRand(categories), getRand(gameType), 'where you', getRand(action), getRand(thing)].join(' ');\n}", "function generateRandomString() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for(var i = 0; i < 6; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n}", "function pickTweetText() {\n let options = [\n \"Actually... Crypto stands for CRYPTOGRAPHY!\",\n \"Hey, just a reminder, hashtag CRYPTO means cryptography 🤓\",\n \"crypto => C.R.Y.P.T.O.G.R.A.P.H.Y not cryptocurrency! 🤨\",\n \"Will you stop using hashtag *crypto* ... it's CRYPTOGRAPHY, not cryptocurrency #goStudy\",\n \"Please stop using the word *crypto* incorrectly. It stands for CRYPTOGRAPHY, not cryptocurrency 🤨\",\n \"Kind correction: crypto stands for cryptography, NOT cryptocurrency ;)\"\n ];\n return options[Math.floor(Math.random() * 5)];\n}", "function randomStr()\n{\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for( var i=0; i < 25; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n}", "function getRandom() {\n return Math.floor(Math.random() * words.length);\n}", "function randomizeLine(num){\n var result = \"\";\n while (num > 0){\n var j = Math.round(Math.random() * (num - 1) + 1);\n var randomWord = getRandomWord(j);\n result += randomWord + \" \";\n num -= j;\n }\n\n return result;\n}", "function generateChain (ngrams, word, direction, max_len) {\n var chain = []\n var nextWord = word\n var nextEntry = ngrams[word]\n var counter = 0\n while (nextWord != '.' && counter < max_len) {\n counter ++\n chain.push(nextWord)\n\n if (emptyObj(nextEntry[direction]))\n nextEntry = ngrams[nextWord]\n\n nextWord = chooseNext(nextEntry, direction,\n function(x){return x * Math.random()})\n nextEntry = nextEntry[direction][nextWord]\n }\n return chain\n}", "function createRandom(){\n\tvar random1 = Math.floor((Math.random() * startups.length));\n\tvar random2 = Math.floor((Math.random() * groups.length));\n\treturn 'A startup that is ' + startups[random1] + ', but for ' + groups[random2];\n}", "randomString() {\n var text = \"\";\n var rand = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < 5; i++) {\n text += rand.charAt(Math.floor(Math.random() * rand.length));\n }\n return text;\n }", "function clickedRandomText() {\n originText.innerHTML = texts[Math.floor(Math.random() * texts.length)];\n // It will also call the reset function to reset evrything\n reset();\n}", "function randWord(){\n var a = 'abtchyplwwah'; \n var b = 'aeyuioee';\n var c = 'eetleouiynmcc'\n var d = 'mnbceeytplttk';\n var w = [a,b,c,d];\n var str = '';\n for(var i=0; i++; i<4)\n {\n var n = (w[i][Math.floor(Math.random() * w[i].length)]);\n n = n || 'e';\n str += n;\n }\n\n }", "function generateRandomString() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < 6; i++)\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n}", "function randstr()\n{\n\tvar output = \"\";\n\tfor (var i=0; i < config.msglen; i++\t)\n\t{\n\t\toutput += alpha[rand(0,squares.length)];\n\t}\n\tconsole.log(output);\n\treturn output;\n}", "function chooseSentence (list) {\n var index = _.random(list.length - 1);\n var sentence = list[index];\n var madlibRequired = /{\\s*(?:noun|adj|buzz|num)\\s*}/i.test(sentence);\n\n if (madlibRequired) {\n sentence = madlib(sentence);\n }\n\n output(sentence);\n }", "getRandomPhrase(phraseList){\r\n const randomNumber = Math.floor(Math.random()*(this.phrases.length));\r\n return phraseList[randomNumber];\r\n }", "function generateRandomString() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < 6; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n}", "function generateRandomString(){\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for( var i=0; i < 5; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n}", "function createText(text){\n let mm = new markov.MarkovMachine(text)\n console.log(mm.makeText())\n}", "function randomSentence() {\n var sentenceIndex = Math.floor(Math.random()*self.sentences.length)\n\n if (self.currentSentence !== sentenceIndex) {\n self.currentSentence = sentenceIndex\n } else {\n randomSentence()\n }\n }", "function randHash() {\n var text = \"\";\n\t var possible = \"abcdefghijklmnopqrstuvwxyz0123456789\";\n var length = 7;\n \n\t for (var i = 0; i < length; i++) {\n\t\t text += possible.charAt(Math.floor(Math.random() * possible.length));\n\t }\n\t return text;\n }", "function pickWord(list) {\n return list[Math.floor(Math.random() * list.length)];\n}", "function generateRandomString() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for(let i = 0; i < 6; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n}", "getRandomPhrase(){\n const randomIndex = Math.floor((Math.random()*this.phrases.length));\n return new Phrase(this.phrases[randomIndex]);\n }", "function generateRandomString() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < 6; i++)\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n}" ]
[ "0.76589763", "0.76443344", "0.7599267", "0.7574173", "0.7511702", "0.7511279", "0.72814023", "0.71984774", "0.7190295", "0.71337676", "0.7123781", "0.6900931", "0.6816729", "0.6805939", "0.6632002", "0.65934294", "0.6556045", "0.65482455", "0.64869976", "0.63568276", "0.6343457", "0.6312337", "0.6292961", "0.629025", "0.6289885", "0.6264376", "0.6252548", "0.6239147", "0.62309104", "0.6224167", "0.6216894", "0.6200459", "0.6196553", "0.619185", "0.61845106", "0.6183079", "0.6177856", "0.61697793", "0.61697793", "0.61697793", "0.616326", "0.61580634", "0.613988", "0.61345786", "0.6129546", "0.61225724", "0.61218226", "0.61218226", "0.61217254", "0.611733", "0.6114295", "0.61104137", "0.6108667", "0.61072093", "0.61072093", "0.60988396", "0.6091151", "0.60702944", "0.606892", "0.6065435", "0.60582894", "0.6052874", "0.6041321", "0.6036842", "0.6031627", "0.6011052", "0.6007081", "0.5970455", "0.5953179", "0.5950678", "0.5947798", "0.59451115", "0.5943599", "0.5942539", "0.592663", "0.5914445", "0.5883428", "0.5875963", "0.5871189", "0.58611715", "0.58479726", "0.58377576", "0.5833702", "0.5831278", "0.5823147", "0.5821933", "0.58166933", "0.58166385", "0.5815485", "0.5808052", "0.5794867", "0.5787484", "0.5786319", "0.5784384", "0.57838124", "0.57807505", "0.5779191", "0.57787794", "0.5777888", "0.5769577" ]
0.7168974
9
Return the school value
getSchool() { return this.school; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getschool() {\n return this.school;\n }", "getSchool () {\n return this.school;\n }", "getSchool() {\r\n return this.school;\r\n }", "getSchool() {\n return this.school\n }", "getSchool() {\n return this.school;\n }", "getSchool(){\n \n return this.school; \n }", "getSchool() {\n return this.school;\n }", "getSchool() {\n return this.school;\n }", "getSchool() {\n return this.school;\n }", "getSchool(){\n return this.school;\n }", "getSchool(){\n return this.school;\n }", "function getSchool() {\n return \"Novi Hogeschool\";\n}", "getSchool () {\n return this.school;\n\n}", "getSchool(){\n return this.school;\n}", "function getSchool() {\r\n return $(\"#school-select\").val();\r\n}", "function School(){\n const school = {\n\n vak: [\"FRO\", \"BAP\", \"NED\"],\n opdracht: [\"Fotogallery\", \"Grid\", \"Object\", \"Login\", \"Registratie\", \"Uploaden\", \"Correspondentie 1\", \"Correspondentie 2\", \"Correspondentie 3\" ],\n cijfer: [\"6.2\", \"8.3\", \"4.6\", \"7.0\", \"9.1\", \"3.5\", \"10\", \"5\", \"8.7\" ]\n }\n}", "function calculateSchoolFacility(options) {\r\n\t\t\r\n\t\tvar facility = schoolType[options.tpSchool],\r\n\t\t\tqtStudents = options.qtStudents,\r\n\t\t\tkgCO2ePerYear = qtStudents * facility.kgCO2PerYearPerStudent;\r\n\t\tconsole.log(\"SchoolFacilities:\" + kgCO2ePerYear);\r\n\t\treturn {\r\n\t\t\tkgCO2ePerYear: kgCO2ePerYear\r\n\t\t};\r\n\t}", "function privateSchools(){\n console.log(private_schools[0].zipcode);\n}", "function displaySchool(school) {\n return `\n <li class=\"list-group-item p-4\"><span class=\"text-muted\">School: </span>${school}</li>\n `\n}", "function getSchool(schoolName) {\n let schoolRef = db.collection('schools');\n let schoolDoc = schoolRef.where('name', '==', schoolName).get().then(snapshot => {\n if (snapshot.empty) {\n return;\n }\n var schools = [];\n snapshot.forEach(doc => {\n schools.push({id: doc.id, data: doc.data()});\n });\n if (schools.length > 0) {\n return schools[0];\n } else {\n return;\n }\n })\n return schoolDoc;\n}", "async getSingleSchool (req, res, next){\n // Validating query param\n const { error } = Validator.getSchoolValidation(req.query);\n if (error) {\n return res\n .status(400)\n .send({ success: false, message: error.details[0].message });\n }\n try {\n const school = await School.findOne({\n schoolName: req.query.schoolName\n }).select('_id schoolName address phoneNum');\n \n if (!school) {\n return res.status(404).send({\n success: false,\n message: 'School Name Not Found in the Database!'\n });\n }\n res.status(200).send({\n success: true,\n data: {\n school: school\n }\n });\n } catch (err) {\n res.status(500).json({ success: false, error: err });\n }\n }", "function schoolType() {\n var calcOcc = function () {\n // Taking input\n var a = document.getElementById('schoolStrength-school').valueAsNumber;\n var b = document.getElementById('nonTeachingStaff-school').valueAsNumber;\n var c = document.getElementById('teachingStaff-school').valueAsNumber;\n // Calculating Number of People\n var result = a + b + c;\n var positiveResult = Math.abs(result);\n\n return positiveResult;\n };\n \n var occupancyResult = function () {\n // Declaring Result\n document.getElementById('resultOccupancy').innerHTML = \"Occupancy: \" + calcOcc();\n };\n \n return occupancyResult();\n}", "function School(school, degree, dates, location, majors){\n\tthis.school = school;\n\tthis.degree = degree;\n\tthis.dates = dates;\n\tthis.location = location;\n\n\tif(typeof majors === 'undefined'){\n\t\tconsole.log('majors undefined');\n\t\tmajors = [];\n\t}\n\n\tthis.majors = majors;\n}", "_getFormatedName(){\n\t\tlet { college } = this.props;\n\t\treturn college ? college.school_name.split(/\\s+/).join('_').toLowerCase() : null;\n\t}", "function School(s, i) {\n let end = s.end;\n if(end === -1) {\n end = <small>present</small>;\n }\n\n return (\n <div key={i}>\n <h5 className=\"d-flex justify-content-between\">\n {s.school}\n <div>{s.start} - {end}</div>\n </h5>\n <h6>\n {s.location}\n <br />\n <a href={s.link}>{s.degree} in {s.major}</a>\n </h6>\n <p>{s.additional}</p>\n </div>\n );\n }", "function getDataDetails(nextSchool) {\n console.log(\"getDataDetails\");\n\n var schoolName = nextSchool.School;\n var schoolCode = nextSchool.SchoolCode;\n var schoolType = nextSchool.Agency;\n var schoolLevel = nextSchool.Level;\n var schoolExpenditure = nextSchool.FakeExpend;\n var schoolSqft = nextSchool.totalSQFT;\n var schoolEnroll = nextSchool.Enrolled;\n var schoolLng = nextSchool.Longitude;\n var schoolLat = nextSchool.Latitude;\n var schoolLat = nextSchool.Latitude;\n var schoolWard = nextSchool.Ward;\n var schoolData = { \"schoolName\": schoolName, \"schoolCode\": schoolCode, \"schoolType\": schoolType, \"schoolLevel\": schoolLevel, \"schoolExpenditure\": schoolExpenditure, \"schoolSqft\": schoolSqft, \"schoolLng\": schoolLng, \"schoolLat\": schoolLat, \"schoolWard\": schoolWard };\n return schoolData;\n }", "function getSchoolLevel(array) {\r\n\t\tif (array.info.level == 'E') {\r\n\t\t\t// brown\r\n\t\t\tschool_colors = '#A34E24'\r\n\t\t}\r\n\t\telse if (array.info.level == 'M') {\r\n\t\t\t// orange\r\n\t\t\tschool_colors = '#EA7D24'\r\n\t\t}\r\n\t\telse if (array.info.level == 'H') {\r\n\t\t\t// green\r\n\t\t\tschool_colors = '#796E24'\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// purple\r\n\t\t\tschool_colors = '#9B539C'\r\n\t\t}\r\n\t\treturn school_colors;\r\n\t}", "function students(d,curdate) {\n\tif (d.properties.students) {\n\t\tvar dateloc=d.properties.students.search(niceDate(curdate));\n\t\tif (dateloc > -1) {\n\t\t\treturn Number(d.properties.students.substr(dateloc+5,3));\n\t\t} else { return \"0\";}\n\t} else {return \"0\";}\n}", "function loadSchoolInfo() {\n const schoolSearch = document.getElementById('school-search').value;\n\n // Get School Data from API.\n fetch(getLink(schoolSearch))\n .then((response) => response.text())\n .then((data) => {\n const parsedData = JSON.parse(data);\n const schools = parsedData['results'];\n\n // Get main campus\n const dataResults = getMainCampus(schools);\n\n // Basic School Information Variables.\n const ownership = getOwnership(dataResults);\n const name = getSchoolInfo(dataResults, 'name');\n const city = getSchoolInfo(dataResults, 'city');\n const state = getSchoolInfo(dataResults, 'state');\n\n // Cost Statistics Variables.\n const inStateTuition = getCostInfo(dataResults, 'in_state');\n const outOfStateTuition = getCostInfo(dataResults, 'out_of_state');\n\n // Admissions Statistics Variables.\n const acceptanceRate = getAcceptanceRate(dataResults);\n const avgSat = getSatInfo(dataResults, 'average.overall');\n const avgAct = getActInfo(dataResults, 'midpoint.cumulative');\n\n // Student Statistic Variables.\n const numStudents = getNumStudents(dataResults);\n const numMen = getGender(dataResults, 'men') * numStudents;\n const numWomen = getGender(dataResults, 'women') * numStudents;\n const graduationRate4yr = getGraduationRate(dataResults);\n const numWhiteStudents = getRace(dataResults, 'white') * numStudents;\n const numAsianStudents = getRace(dataResults, 'asian') * numStudents;\n const numBlackStudents = getRace(dataResults, 'black') * numStudents;\n const numHispanicStudents =\n getRace(dataResults, 'hispanic') * numStudents;\n const numIndigenousStudents =\n getRace(dataResults, 'aian') * numStudents;\n const numMultiracialStudents =\n getRace(dataResults, 'two_or_more') * numStudents;\n const numUnreportedRaceStudents = (getRace(dataResults, 'unknown') +\n getRace(dataResults, 'non_resident_alien')) * numStudents;\n\n // Name Section.\n schoolHeader = document.getElementById('school-name');\n schoolHeader.innerHTML = '';\n schoolHeader.append(dataResults['school.name']);\n\n // Description Section.\n const schoolDesc = document.getElementById('school-desc');\n schoolDesc.innerHTML = '';\n schoolDesc.append(`${name} is a ${ownership} University \n in ${city}, ${state}`);\n\n // Cost Section.\n const costDiv = document.getElementById('cost');\n costDiv.innerHTML = '';\n costDiv.append(`In-State Tuition: $${inStateTuition}`);\n costDiv.append(`Out-of-State Tuition: $${outOfStateTuition}`);\n\n // Admissions Section.\n const admissionsDiv = document.getElementById('admissions');\n admissionsDiv.innerHTML = '';\n admissionsDiv.append(`Acceptance Rate: ${acceptanceRate}%`);\n admissionsDiv.append(`Average SAT Score: ${avgSat}`);\n admissionsDiv.append(`Average ACT Score: ${avgAct}`);\n\n // Students Section.\n const studentsDiv = document.getElementById('students');\n studentsDiv.innerHTML = '';\n studentsDiv.append(`Population: ${numStudents} Students`);\n studentsDiv.append(`4 Year Graduation Rate: ${graduationRate4yr}%`);\n\n // Draw charts.\n drawRaceChart(numWhiteStudents, numAsianStudents, numBlackStudents,\n numHispanicStudents, numIndigenousStudents, numMultiracialStudents,\n numUnreportedRaceStudents);\n drawGenderChart(numMen, numWomen);\n });\n}", "function getSchoolsPerimeter() {\r\n if (abstand_umkr.value != \"\" && parseInt(abstand_umkr.value) <= 40000) {\r\n var schulen_gefiltert = {};\r\n schulen_gefiltert.features = [];\r\n //Schularten filtern\r\n if (umkr_GS.checked) {\r\n //alle GS-Objekte durchlaufen\r\n for (let i = 0; i < schoolData.features.length; i++) {\r\n if (schoolData.features[i].properties[\"school:de\"].includes(\"Grundschule\")) {\r\n schulen_gefiltert.features.push(schoolData.features[i]);\r\n }\r\n }\r\n }\r\n if (umkr_GY.checked) {\r\n for (let i = 0; i < schoolData.features.length; i++) {\r\n if (schoolData.features[i].properties[\"school:de\"] == \"Gymnasium\") {\r\n schulen_gefiltert.features.push(schoolData.features[i]);\r\n }\r\n }\r\n }\r\n if (umkr_RS.checked) {\r\n for (let i = 0; i < schoolData.features.length; i++) {\r\n if (schoolData.features[i].properties[\"school:de\"].includes(\"Realschule\")) {\r\n schulen_gefiltert.features.push(schoolData.features[i]);\r\n }\r\n }\r\n }\r\n if (umkr_IGS.checked) {\r\n for (let i = 0; i < schoolData.features.length; i++) {\r\n if (schoolData.features[i].properties[\"school:de\"] == \"Gesamtschule\") {\r\n schulen_gefiltert.features.push(schoolData.features[i]);\r\n }\r\n }\r\n }\r\n if (umkr_FOES.checked) {\r\n for (let i = 0; i < schoolData.features.length; i++) {\r\n if (schoolData.features[i].properties[\"school:de\"] == \"Förderschule\") {\r\n schulen_gefiltert.features.push(schoolData.features[i]);\r\n }\r\n }\r\n }\r\n if (umkr_FWS.checked) {\r\n for (let i = 0; i < schoolData.features.length; i++) {\r\n if (schoolData.features[i].properties[\"school:de\"] == \"Freie Waldorfschule\") {\r\n schulen_gefiltert.features.push(schoolData.features[i]);\r\n }\r\n }\r\n }\r\n //rote Anzeige wenn kein Schulart ausgewählt ist\r\n if ((!umkr_FOES.checked) && (!umkr_FWS.checked) && (!umkr_GS.checked) && (!umkr_GY.checked) && (!umkr_IGS.checked) && (!umkr_RS.checked)) {\r\n var keine_Eingabe = document.getElementById('keine_art_umkr');\r\n keine_Eingabe.innerHTML = \"Wähle bitte mind. eine Schulart\";\r\n keine_Eingabe.style = 'color: red';\r\n return \"\";\r\n }\r\n\r\n //Doppelte Schulen entfernen\r\n var schulen_unique = {};\r\n schulen_unique.features = schulen_gefiltert.features.filter(function (elem, index, self) {\r\n return index === self.indexOf(elem);\r\n })\r\n\r\n //Isochronen Post-Request Isochrones API OpenRouteService\r\n var mitte = [start[1], start[0]]; //Format LonLat\r\n var abstand = abstand_umkr.value;\r\n let request = new XMLHttpRequest();\r\n request.open('POST', \"https://api.openrouteservice.org/v2/isochrones/foot-walking\");\r\n request.setRequestHeader('Accept', 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8');\r\n request.setRequestHeader('Content-Type', 'application/json');\r\n request.setRequestHeader('Authorization', apiKeys[0].key);\r\n request.onreadystatechange = function () {\r\n if (this.readyState === 4) {\r\n var json = JSON.parse(this.responseText);\r\n var isochrone = json.features[0].geometry.coordinates; //Polygon\r\n isochroneTest(isochrone, schulen_unique);\r\n }\r\n };\r\n const body = '{\"locations\":[[' + mitte + ']],\"range\":[' + abstand + '],\"range_type\":\"distance\"}';\r\n request.send(body);\r\n } else {\r\n var keine_Eingabe = document.getElementById('falsche_E_abstand');\r\n keine_Eingabe.innerHTML = \"Bitte gib eine g&uuml;ltige Zahl ein\";\r\n keine_Eingabe.style = 'color: red';\r\n return \"\";\r\n }\r\n marker_address.addTo(mymap);\r\n\r\n}", "function getSTRvalue() {\n var score = -1;\n if (app.SHRFlag == 1) {\n app.prevalingSHRData.SHR.pSTR = $(\"select[name=STRForm]\").val();\n app.prevalingSHRData.SHR.pCrossWaves = $(\"select[name=STRCrossWavesForm]\").val();\n score = app.prevalingSHRData.SHR.pSTR;\n } else {\n app.esSHRData.SHR.pSTR = $(\"select[name=STRForm]\").val();\n app.esSHRData.SHR.pCrossWaves = $(\"select[name=STRCrossWavesForm]\").val();\n score = app.esSHRData.SHR.pSTR;\n }\n return score;\n}", "function schoolColor(schoolType) {\n\n \tif (schoolType ===\"charter\") {\n console.log(schoolType)\n fillColor = \"#f69705\";\n } \n else {\n fillColor = \"#d83700\";\n }\n return fillColor;\n }", "function getWHRvalue() {\n var score = -1;\n if (app.SHRFlag == 1) {\n app.prevalingSHRData.SHR.pWHR = $(\"select[name=WHRForm]\").val();\n score = app.prevalingSHRData.SHR.pWHR;\n } else {\n app.esSHRData.SHR.pWHR = $(\"select[name=WHRForm]\").val();\n score = app.esSHRData.SHR.pWHR;\n }\n return score;\n}", "constructor(name, id, emial, school) {\n super(name, id, emial);\n this.school = school;\n }", "function School (course, level) {\n this.course = course,\n this.level = level\n this.say = function () {\n console.log(`${this.course}, ${this.level} level`);\n console.log(this);\n }\n}", "async function getTeacherSchool () {\r\n try {\r\n //Get School\r\n ///The api to call to get the user's school, complete with query string parameters\r\n var api = apiRoot + \"/user/school?email=\" + userSession.auth.email;\r\n\r\n ///Getting the school via api call\r\n var school = await callGetAPI(api, \"your school\");\r\n\r\n school = school.school;\r\n\r\n ///Put the school into the school select box\r\n $(\"#school-select\").append(newSelectItem(school));\r\n\r\n ///Hide the school select box - only for admins\r\n $(\"#school-input-container\").hide();\r\n } catch (e) {\r\n generateErrorBar(e);\r\n }\r\n}", "constructor (name, id, email, school){\n super (name, id, email);\n\n this.school=school;\n }", "constructor (name, id, email, school) {\r\n super(name, id, email)\r\n this.school = school;\r\n }", "constructor(name, id, email, school) {\n super(name, id, email);\n this.school = school;\n }", "function validateSchoolCode (schoolCode) {\n // INVALID: school code is empty\n var schoolCodeStr = String(schoolCode)\n if (schoolCodeStr.length == 0) {\n return 'University Code cannot be empty';\n\n // INVALID: University Code is not length 4\n } else if (schoolCodeStr.length < 4 || schoolCodeStr.length > 4) {\n return 'University Code must have 4 digits';\n }\n\n // Valid University Code\n return '';\n }", "function generateStaffGrade(grade) {\r\n\r\n return grade;\r\n}", "function getMajor() {\n\n let UID = firebase.auth().currentUser.uid;\n\n var db = firebase.firestore();\n\n var major = \"Computer Science\"\n db.collection('users').doc(\"2zzF4Pfz01sJ6jlVhplr\").get().then(function(doc) {\n if (doc.exists) {\n var major = doc.data().major;\n } else {\n // doc.data() will be undefined in this case\n console.log(\"No such document!\");\n }\n}).catch(function(error) {\n console.log(\"Error getting document:\", error);\n});\n\n return major;\n}", "function getSubject()\n\t\t\t{\n\t\t\t\tvar subjects = {\n\t\t\t\t\t0:\"General Knowledge\",\n\t\t\t\t\t1:\"Technology\",\n\t\t\t\t\t2:\"Politics\",\n\t\t\t\t\t3:\"Arts\",\n\t\t\t\t\t4:\"Sports\",\n\t\t\t\t\t5:\"Geography\",\n\t\t\t\t\t6:\"History\"\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tvar d = new Date();\n\t\t\t\tvar day = d.getDay();\n\t\t\t\treturn subjects[day];\t\n\t\t\t}", "function getSchool(string, index) {\n\n return new Promise( async(resolve, reject) => {\n\n const nameColumn = /cell-school(.*?)<\\/td>/gs;\n const name = /(_blank\">)(.*)(<\\/a>)/s;\n\n const nameMatches = string.match(nameColumn);\n\n if (nameMatches !== null) {\n\n const schoolMatch = nameMatches[0].match(name);\n\n resolve({\n success: schoolMatch !== null ? true : false,\n name: schoolMatch !== null ? schoolMatch[2] : '',\n });\n\n } else {\n resolve({\n success: false,\n });\n }\n\n });\n\n}", "function getStudentData() {\r\n // Use Student object to retrieve all available student info\r\n var studentInfo = {\r\n career: user.Student.Career,\r\n faculty: user.Student.Faculty,\r\n departments: user.Student.Departments,\r\n plans: user.Student.PlanTitles,\r\n formOfStudy: user.Student.FormOfStudy,\r\n level: user.Student.Level,\r\n studentNum: user.Student.StudentNumber\r\n };\r\n\r\n // Can log the whole object to check what is being returned\r\n // console.log(studentInfo);\r\n\r\n // Return final result\t\r\n return studentInfo;\r\n}", "function getHonorific() {\n return getTitle() + street;\n\n}", "function getWPRvalue() {\n var score = -1;\n if (app.SHRFlag == 1) {\n app.prevalingSHRData.SHR.pWPR = $(\"select[name=WPRForm]\").val();\n score = app.prevalingSHRData.SHR.pWPR;\n } else {\n app.esSHRData.SHR.pWPR = $(\"select[name=WPRForm]\").val();\n score = app.esSHRData.SHR.pWPR;\n }\n return score;\n}", "function getSchoolData() {\n var contentURL = \"https://pinboard-5f12a.firebaseio.com/.json\";\n var apikey = \"?auth=hoTgr9OUIYENlkzXxrIn3Mnx0mFUbggkcMprba6L\";\n var queryURL = contentURL + apikey;\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function (response) {\n getClassInfo(response);\n displayNotices(response);\n displayActivities(response);\n displayCanteenMenu(response);\n })\n}", "function getStudentCity(std_name) { // \"SK\"\n var obj = data.find(function(item) { return item.name == std_name });\n\n if (obj) {\n return obj.city;\n\n } else {\n return \"NO City Found\";\n }\n}", "function MUA_InputSchoolname(el_input, event_key) {\n //console.log( \"===== MUA_InputSchoolname ========= \");\n //console.log( \"event_key\", event_key);\n\n if(el_input){\n// --- filter rows in table select_school\n const filter_dict = MUA_Filter_SelectRows(el_input.value);\n //console.log( \"filter_dict\", filter_dict);\n// --- if filter results have only one school: put selected school in el_MUA_schoolname\n const selected_pk = Number(filter_dict.selected_pk);\n if (selected_pk) {\n el_input.value = filter_dict.selected_value\n // --- put pk of selected school in mod_MUA_dict\n mod_MUA_dict.user_schoolbase_pk = selected_pk;\n mod_MUA_dict.user_schoolname = filter_dict.selected_value;\n\n MUA_headertext();\n MUA_ResetElements();\n // --- Set focus to flied 'username'\n el_MUA_username.focus()\n } // if (!!selected_pk)\n }\n }", "function getSelectedSemester(radioGroup) {\n\n\t\t\t\tvar radioSem = document.getElementsByName(radioGroup);\n\t\t\t\t\n\t\t\t\tfor ( var i = 0; i < radioSem.length; i++) {\n\t\t\t\t\tif (radioSem.item(i).checked) \n\t\t\t\t\t\treturn radioSem.item(i).value;\n\t\t\t}\n\t\t}", "getSemester() {\n return this.semester;\n }", "function Student(name, major, yearInSchool, club) {\n this.name = name; // string, (e.g. \"Jim\", \"Pam\", \"Michael\")\n this.major = major; // string, (e.g. \"Computer Science\", \"Art\", \"Business\")\n this.yearInSchool = yearInSchool; // int, (e.g. 1, 2, 3, 4)\n this.club = club; // string, (e.g. \"Improv\", \"Art\")\n}", "function returnArrayOfSchools( county ) {\n\tswitch (county) {\n case \"Carlow\": return [\"Borris Vocational School, Borris\",\"Carlow Vocational School, Carlow\",\n\t\t\t\t\t\t \"Coláiste Eoin, Hacketstown\",\"Gaelcholáiste Cheatharlach, Easca\",\n\t\t\t\t\t\t \"Presentation / De La Salle College, Muine Bheag\",\"Presentation College, Carlow\",\n\t\t\t\t\t\t \"St Mary's Academy CBS, Carlow\",\"St Mary's Knockbeg College, Knockbeg\",\n\t\t\t\t\t\t \"St. Leo's College, Carlow\",\"Tullow Community School, Tullow\",\n\t\t\t\t\t\t \"Vocational School Muine Bheag, Muine Bheag\"];\t\t\t\t\t\n\tbreak;\n\tcase \"Cavan\": return [\"Bailieborough Community School, Bailieborough\",\"Breifne College, Cavan\",\n\t\t\t\t\t\t \"Cavan Institute, Cavan\",\"Loreto College, Cavan\",\"Royal School Cavan, Cavan\",\n\t\t\t\t\t\t \"St Aidans Comprehensive School, Cootehill\",\"St Bricin's Vocational School, Belturbet\",\n\t\t\t\t\t\t \"St Clare's College, Ballyjamesduff\",\"St Patrick's College, Cavan\",\n\t\t\t\t\t\t \"St. Mogue's College, Belturbet\",\"Virginia College, Virginia\"]; \t\n\tbreak;\n\tcase \"Clare\": return [\"Coláiste Mhuire, Ennis\",\"Ennis Community College, Ennis\",\n\t\t\t\t\t\t \"Ennistymon Vocational School, Ennis\",\"Kilrush Community School, Kilrush\",\n\t\t\t\t\t\t \"Mary Immaculate Secondary School, Lisdoonvarna\",\"Meánscoil Na mBráithre, Ennistymon\",\n\t\t\t\t\t\t \"Rice College, Ennis\",\"Scariff Community College, Scariff\",\"Scoil Mhuire, Ennistymon\",\n\t\t\t\t\t\t \"Shannon Comprehensive School, Shannon\",\"St Anne's Community College, Killaloe\",\n\t\t\t\t\t\t \"St Caimin's Community School, Tullyvarraga\",\"St Flannan's College, Ennis\",\n\t\t\t\t\t\t \"St John Bosco Community College, Kildysart\",\"St Joseph's Community College, Kilkee\",\n\t\t\t\t\t\t \"St Michael's Community College, Kilmihill\",\"St. Joseph's Secondary School, Tulla\",\n\t\t\t\t\t\t \"St. Joseph's Secondary School, Milown Malbay\"];\t\t\t\t\t\n\tbreak;\n\tcase \"Cork City\": return [\"Ashton School, Cork\",\"Bishopstown Community School, Cork\",\n\t\t\t\t\t\t \"Christ King Girls' Secondary School, Cork\",\"Christian Brothers College, Cork\",\n\t\t\t\t\t\t \"Coláiste An Spioraid Naoimh, Cork\",\"Coláiste Chríost Rí, Cork\",\n\t\t\t\t\t\t \"Coláiste Daibhéid, Corcaigh\",\"Colaiste Stiofán Naofa, Cork\",\"Cork College Of Commerce, Cork\",\n\t\t\t\t\t\t \"Deerpark C.B.S., Cork\",\"Douglas Community School, Cork\",\"Gaelcholáiste Mhuire, Corcaigh\",\n\t\t\t\t\t\t \"Mayfield Community School, Cork\",\"Mount Mercy College, Cork\",\"Nagle Community College, Cork\",\n\t\t\t\t\t\t \"North Monastery Secondary School, Cork\",\"North Presentation Secondary School, Cork\",\n\t\t\t\t\t\t \"Presentation Brothers College, Cork\",\"Presentation Secondary School, Cork\",\n\t\t\t\t\t\t \"Regina Mundi College, Cork\",\"Scoil Mhuire, Cork\",\"St Aloysius School, Cork\",\n\t\t\t\t\t\t \"St John's Central College, Cork\",\"St Patricks College, Cork\",\n\t\t\t\t\t\t \"St Vincent's Secondary School, Cork\",\"St. Angela's College, Cork\",\n\t\t\t\t\t\t \"Terence Mac Swiney Community College, Cork\",\"Ursuline Secondary School, Cork\"];\n\tbreak;\n\tcase \"Cork County\": return [\"Árdscoil Phobal Bheanntrai, Bantry\",\"Árdscoil Uí Urmoltaigh, Droichead na Bandan\",\n\t\t\t\t\t\t \"Ballincollig Community School, Ballincollig\",\"Bandon Grammar School, Bandon\",\n\t\t\t\t\t\t \"Beara Community School, Beara\",\"Boherbue Comprehensive School, Mallow\",\n\t\t\t\t\t\t \"Carrigaline Community School, Carrigaline\",\"Christian Brothers Secondary School, Mitchelstown\",\n\t\t\t\t\t\t \"Christian Brothers Secondary School, Midleton\",\"Clonakilty Community College, Clonakilty\",\n\t\t\t\t\t\t \"Coachford College, Coachford\",\"Cobh Community College, Cobh\",\"Coláiste an Chraoibhin, Fermoy\",\n\t\t\t\t\t\t \"Coláiste An Chroí Naofa, Carraig na bhFear\",\"Colaiste An Phiarsaigh, Gleann Maghair\",\n\t\t\t\t\t\t \"Coláiste Choilm, Ballincollig\",\"Coláiste Cholmáin, Mainistir Fhearmuí\",\n\t\t\t\t\t\t \"Colaiste Ghobnatan, Baile Mhic Ire\",\"Colaiste Muire, Crosshaven\",\"Coláiste Muire, Cobh\",\n\t\t\t\t\t\t \"Coláiste Na Toirbhirte, Bandon\",\"Colaiste Pobail Naomh Mhuire, Cill na Mullach\",\n\t\t\t\t\t\t \"Colaiste Treasa, Kanturk\",\"Davis College, Mallow\",\"De La Salle College, Macroom\",\n\t\t\t\t\t\t \"Glanmire Community College, Glanmire\",\"Kinsale Community School, Kinsale\",\n\t\t\t\t\t\t \"Loreto Secondary School, Fermoy\",\"Mannix College, Charleville\",\n\t\t\t\t\t\t \"Maria Immaculata Community College, Dunmanway\",\"McEgan College, Macroom\",\n\t\t\t\t\t\t \"Mercy Heights Secondary School, Skibbereen\",\"Midleton College, Midleton\",\n\t\t\t\t\t\t \"Millstreet Community School, Millstreet Town\",\"Mount St Michael, Rosscarbery\",\n\t\t\t\t\t\t \"Nagle Rice Secondary School, Doneraile\",\"Patrician Academy, Mallow\",\n\t\t\t\t\t\t \"Pobalscoil na Tríonóide, Youghal\",\"Presentation Secondary School, Mitchelstown\",\n\t\t\t\t\t\t \"Rossa College, Skibbereen\",\"Sacred Heart Secondary School, Clonakilty\",\n\t\t\t\t\t\t \"Schull Community College, Schull\",\"Scoil Mhuire, Kanturk\",\"Scoil Mhuire, Béal Atha an Ghaorth\",\n\t\t\t\t\t\t \"Scoil Mhuire gan Smal, Blarney\",\"Scoil na mBráithre Chríostaí, Charleville\",\n\t\t\t\t\t\t \"St Aidan's Community College, Dublin Hill\",\"St Aloysius College, Carrigtwohill\",\n\t\t\t\t\t\t \"St Colman's Community College, Midleton\",\"St Fachtna's - De La Salle College, Skibbereen\",\n\t\t\t\t\t\t \"St Fanahan's College, Mallow\",\"St Francis Capuchin College, Rochestown\",\n\t\t\t\t\t\t \"St Goban's College, Bantry\",\"St Mary's High School, Midleton\",\"St Mary'S Secondary School, Macroom\",\n\t\t\t\t\t\t \"St Mary's Secondary School, Mallow\",\"St Peter's Community School, Passage West\",\n\t\t\t\t\t\t \"St. Brogan's College, Bandon\",\"St. Mary's Secondary School, Charleville\"];\n\tbreak;\n\tcase \"Donegal\": return [\"Abbey Vocational School, Donegal Town\",\"Carndonagh Community School, Lifford\",\n\t\t\t\t\t\t \"Carrick Vocational School, Carrick\",\"Coláiste Ailigh, Highroad\",\"Coláiste Cholmcille, Ballyshannon\",\n\t\t\t\t\t\t \"Coláiste Phobail Cholmcille, Doirí Beaga\",\"Crana College, Buncrana\",\"Deele College, Lifford\",\n\t\t\t\t\t\t \"Errigal College, Letterkenny\",\"Finn Valley College, Stranorlar\",\n\t\t\t\t\t\t \"Gaelcholaiste Chineál Eoghain, Bun Chranncha\",\"Gairm Scoil Chú Uladh, Leifear\",\n\t\t\t\t\t\t \"Gairmscoil Mhic Diarmada, Árainn Mhór\",\"Loreto Community School, Milford\",\n\t\t\t\t\t\t \"Loreto Convent, Letterkenny\",\"Magh Ene College, Bundoran\",\"Moville Community College, Moville\",\n\t\t\t\t\t\t \"Mulroy College, Letterkenny\",\"Pobalscoil Chloich Cheannfhaola, Leitir Ceanainn\",\n\t\t\t\t\t\t \"Pobalscoil Ghaoth Dobhair, Leitir Ceannain\",\"Rosses Community School, Dungloe\",\n\t\t\t\t\t\t \"Scoil Mhuire Secondary School, Buncrana\",\"St Columbas College, Stranorlar\",\n\t\t\t\t\t\t \"St Columba's Comprehensive School, Glenties\",\"St Eunan's College, Letterkenny\",\n\t\t\t\t\t\t \"St. Catherine's Vocational School, Killybegs\",\"The Royal and Prior School, Raphoe\"];\n\tbreak;\n\tcase \"Dublin 1\": return [\"Belvedere College S.J, Dublin 1\",\"Larkin Community College, Dublin 1\",\n\t\t\t\t\t\t \"Mount Carmel Secondary School, Dublin 1\",\"O'Connell School, Dublin 1\"];\n\tbreak;\n\tcase \"Dublin 2\": return [\"C.B.S. Westland Row, Dublin 2\",\"Catholic University School, Dublin 2\",\n\t\t\t\t\t\t \"Loreto College, Dublin 2\"];\n\tbreak;\n\tcase \"Dublin 3\": return [\"Holy Faith Secondary School, Dublin 3\",\"Marino College, Dublin 3\",\n\t\t\t\t\t\t\t \"Mount Temple Comprehensive School, Dublin 3\",\"St Josephs C.B.S., Dublin 3\"];\n\tbreak;\n\tcase \"Dublin 4\": return [\"John Scottus Secondary School, Dublin 4\",\"Marian College, Dublin 4\",\n\t\t\t\t\t\t\t \"Muckross Park College, Dublin 4\",\"St Conleths College, Dublin 4\",\n\t\t\t\t\t\t\t \"St Michaels College, Dublin 4\",\"Technical Institute, Dublin 4\",\n\t\t\t\t\t\t\t \"The Teresian School, Dublin 4\"];\n\tbreak;\n\tcase \"Dublin 5\": return [\"Árdscoil La Salle, Dublin 5\",\"Chanel College, Dublin 5\",\n\t\t\t\t\t\t\t \"Manor House School, Dublin 5\",\"Mercy College Coolock, Dublin 5\",\n\t\t\t\t\t\t\t \"St Marys Secondary School, Dublin 5\",\"St Pauls College, Dublin 5\",\n\t\t\t\t\t\t\t \"St. David's C.B.S., Dublin 5\"];\n\tbreak;\n\tcase \"Dublin 6\": return [\"Alexandra College, Dublin 6\",\"Gonzaga College, Dublin 6\",\n\t\t\t\t\t\t\t \"Rathmines College, Dublin 6\",\"Sandford Park School Ltd, Dublin 6\",\n\t\t\t\t\t\t\t \"St Louis High School, Dublin 6\",\"St Marys College, Dublin 6\",\n\t\t\t\t\t\t\t \"Stratford College, Dublin 6\",\"The High School, Dublin 6\"];\n\tbreak;\n\tcase \"Dublin 6W\": return [\"Prensentation College, Dublin 6W\",\"Our Ladys School, Dublin 6W\",\n\t\t\t\t\t\t\t \"St Mac Dara's Community College, Dublin 6W\",\"Templeogue College, Dublin 6W\",\n\t\t\t\t\t\t\t \"Terenure College, Dublin 6W\"];\n\tbreak;\n\tcase \"Dublin 7\": return [\"Coláiste Éanna, Dublin 7\",\"Coláiste Mhuire, Baile Atha Cliath 7\",\n\t\t\t\t\t\t\t \"St Declan's College, Dublin 7\",\"St Dominics College, Dublin 7\",\n\t\t\t\t\t\t\t \"St Josephs Secondary School, Dublin 7\",\"St Pauls C.B.S., Dublin 7\"];\n\tbreak;\n\tcase \"Dublin 8\": return [\"C.B.S. James Street, Dublin 8\",\"Liberties College, Dublin 8\",\n\t\t\t\t\t\t\t \"Mercy Secondary School, Dublin 8\",\"Presentation College, Dublin 8\",\n\t\t\t\t\t\t\t \"St Patricks Cathedral G.S, Dublin 8\",\"Christian Brothers, Dublin 8\"];\n\tbreak;\n\tcase \"Dublin 9\": return [\"Scoil Chaitriona, Baile Átha Cliath 9\",\"Trinity Comprehensive School, Dublin 9\",\n\t\t\t\t\t\t\t \"Árdscoil Rís, Dublin 9\",\"Dominican College, Dublin 9\",\n\t\t\t\t\t\t\t \"Margaret Aylward Community College, Dublin 9\",\"Maryfield College, Dublin 9\",\n\t\t\t\t\t\t\t \"Our Lady Of Mercy College, Dublin 9\",\"Plunket College, Dublin 9\",\n\t\t\t\t\t\t\t \"Rosmini Community School, Dublin 9\",\"St. Aidan's C.B.S., Dublin 9\",\n\t\t\t\t\t\t\t \"Whitehall House Senior College, Dublin 9\"];\n\tbreak;\n\tcase \"Dublin 10\": return [\"Caritas College, Dublin 10\",\"Kylemore College, Dublin 10\",\n\t\t\t\t\t\t\t \"Saint Dominic's Secondary School, Dublin 10\",\"St Johns College De La Salle, Dublin 10\"];\n\tbreak;\n\tcase \"Dublin 11\": return [\"Beneavin De La Salle College, Dublin 11\",\"Coláiste Eoin, Dublin 11\",\"Mater Christi, Dublin 11\",\n\t\t\t\t\t\t\t \"Patrician College, Dublin 11\",\"St Kevins College, Dublin 11\",\n\t\t\t\t\t\t\t \"St Mary's Secondary School, Dublin 11\",\"St Michaels Secondary School, Dublin 11\",\n\t\t\t\t\t\t\t \"St Vincents C.B.S. Glasnevin, Dublin 11\"];\n\tbreak;\n\tcase \"Dublin 12\": return [\"Assumption Secondary School, Dublin 12\",\"Greenhills College, Dublin 12\",\n\t\t\t\t\t\t\t \"Loreto College, Dublin 12\",\"Meanscoil Chroimghlinne, Dublin 12\",\"Meanscoil Iognáid Rís, Dublin 12\",\n\t\t\t\t\t\t\t \"Our Lady Of Mercy Secondary School, Dublin 12\",\"Pearse College - Colaiste an Phiarsaigh, Dublin 12\",\n\t\t\t\t\t\t\t \"Rosary College, Dublin 12\",\"St Pauls Secondary School, Dublin 12\",\"St. Kevins College, Dublin 12\"];\n\tbreak;\n\tcase \"Dublin 13\": return [\"Gealcholáiste Reachrann, Baile Atha Cliath 13\",\"Grange Community College, Dublin 13\",\n\t\t\t\t\t\t\t \"Pobalscoil Neasáin, Dublin 13\",\"Santa Sabina Dominican College, Dublin 13\",\n\t\t\t\t\t\t\t \"St Marys Secondary School, Dublin 13\",\"St. Fintan's High School, Dublin 13\",\n\t\t\t\t\t\t\t \"Sutton Park School, Dublin 13\",\"The Donahies Community School, Dublin 13\"];\n\tbreak;\n\tcase \"Dublin 14\": return [\"Da La Salle College, Dublin 14\",\"Jesus and Mary College, Dublin 14\",\n\t\t\t\t\t\t\t \"Loreto High School, Dublin 14\",\"Mount Anville Secondary School, Dublin 14\",\n\t\t\t\t\t\t\t \"Notre Dame Secondary School, Dublin 14\",\"St Kilian's Deutsche Schule, Dublin 14\"];\n\tbreak;\n\tcase \"Dublin 15\": return [\"Blakestown Community School, Dublin 15\",\"Castleknock College, Dublin 15\",\n\t\t\t\t\t\t\t \"Castleknock Community College, Dublin 15\",\"Colaiste Pobail Setanta, Dublin 15\",\n\t\t\t\t\t\t\t \"Hartstown Community School, Dublin 15\",\"Luttrellstown Community College, Dublin 15\",\n\t\t\t\t\t\t\t \"Riversdale Community College, Dublin 15\",\"Scoil Phobail Chuil Mhin, Baile Atha Cliath 15\"];\n\tbreak;\n\tcase \"Dublin 16\": return [\"Ballinteer Community School, Dublin 16\",\"Rockbrook Park School, Dublin 16\",\n\t\t\t\t\t\t\t \"Sancta Maria College, Dublin 16\",\"St Columba's College, Dublin 16\",\n\t\t\t\t\t\t\t \"St. Colmcille's Community School, Dublin 16\",\"St. Tiernan's Community School, Dublin 16\",\n\t\t\t\t\t\t\t \"Wesley College, Dublin 16\",\"Colaiste Eanna, Dublin 16\"];\n\tbreak;\n\tcase \"Dublin 17\": return [\"Coláiste Dhúlaigh, Dublin 17\"];\n\tbreak;\n\tcase \"Dublin 18\": return [\"Cabinteely Community School, Dublin 18\",\"Loreto College Foxrock, Dublin 18\",\n\t\t\t\t\t\t\t \"St Laurence College, Dublin 18\"];\n\tbreak;\n\tcase \"Dublin 20\": return [\"Mount Sackville Secondary School, Dublin 20\",\"Phobailscoil Iosolde, Dublin 20\",\n\t\t\t\t\t\t\t \"The Kings Hospital, Dublin 20\"];\n\tbreak;\n\tcase \"Dublin 22\": return [\"Coláiste Bríde, Dublin 22\",\"Coláiste Chilliain, Baile Atha Cliath 22\",\n\t\t\t\t\t\t\t \"Collinstown Park Community College, Dublin 22\",\"Deansrath Community College, Dublin 22\",\n\t\t\t\t\t\t\t \"Moyle Park College, Dublin 22\",\"St. Kevin's Community College, Dublin 22\"];\n\tbreak;\n\tcase \"Dublin 24\": return [\"Coláiste de hÍde, Baile Atha Cliath 24\",\"Firhouse Community College, Dublin 24\",\n\t\t\t\t\t\t\t \"Killinarden Community School, Dublin 24\",\"Mount Seskin Community College, Dublin 24\",\n\t\t\t\t\t\t\t \"Old Bawn Community School, Dublin 24\",\"St Aidan's Community School, Dublin 24\",\n\t\t\t\t\t\t\t \"St Marks Community School, Dublin 24\",\"Tallaght Community School, Dublin 24\"];\n\tbreak;\n\tcase \"Dublin County\": return [\"Adamstown Community College, Adamstown\",\"Ardgillan Community College, Balbriggan\",\n\t\t\t\t\t\t\t \"Balbriggan Community College, Balbriggan\",\"Blackrock College, Blackrock\",\n\t\t\t\t\t\t\t \"Christian Brothers College, Dun Laoghaire\",\"Clonkeen College, Blackrock\",\n\t\t\t\t\t\t\t \"Coláiste Choilm, Swords\",\"Coláiste Cois Life, Leamhcán\",\"Coláiste Eoin, Blackrock\",\n\t\t\t\t\t\t\t \"Coláiste Íosagáin,Blackrock\",\"Coláiste Phádraig CBS, Lucan\",\"Dominican College, Blackrock\",\n\t\t\t\t\t\t\t \"Donabate Community College, Donabate\",\"Dun Laoghaire College of, Dun Laoghaire\",\n\t\t\t\t\t\t\t \"Fingal Community College, Swords\",\"Holy Child Community School, Sallynoggin\",\n\t\t\t\t\t\t\t \"Holy Child Secondary School, Killiney\",\"Holy Family Community School, Rathcoole\",\n\t\t\t\t\t\t\t \"Loreto Abbey Secondary School, Dalkey\",\"Loreto College, Swords\",\n\t\t\t\t\t\t\t \"Loreto Secondary School, Balbriggan\",\"Lucan Community College, Lucan\",\n\t\t\t\t\t\t\t \"Malahide Community School, Malahide\",\"Newpark Comprehensive School, Blackrock\",\n\t\t\t\t\t\t\t \"Oatlands College, Mount Merrion\",\"Portmarnock Community School, Portmarnock\",\n\t\t\t\t\t\t\t \"Rathdown School, Glenageary\",\"Rockford Manor Secondary School, Blackrock\",\n\t\t\t\t\t\t\t \"Rosemont School, Blackrock\",\"Senior College Dunlaoghaire, Dun Laoghaire\",\n\t\t\t\t\t\t\t \"Skerries Community College, Skerries\",\"St Andrews College, Blackrock\",\n\t\t\t\t\t\t\t \"St Benildus College, Blackrock\",\"St Finians Community College, Swords\",\n\t\t\t\t\t\t\t \"St Joseph Of Cluny, Killiney\",\"St Josephs College, Lucan\",\"St Joseph's Secondary School, Rush\",\n\t\t\t\t\t\t\t \"St Raphaela's Secondary School, Stillorgan\",\"Willow Park School, Blackrock\"];\n\tbreak;\n\tcase \"Galway City\": return [\"Coláiste Einde, Galway\",\"Coláiste Iognáid S.J., Gaillimh\",\n\t\t\t\t\t\t\t \"Coláiste na Coiribe, Gaillimh\",\"Dominican College, Galway\",\"Galway Community College, Galway\",\n\t\t\t\t\t\t\t \"Galway Technical Institute, Galway\",\"Jesus & Mary Secondary School, Galway\",\n\t\t\t\t\t\t\t \"Meán Scoil Mhuire, Galway\",\"Presentation Secondary School, Galway\",\n\t\t\t\t\t\t\t \"St Joseph's College, Galway\",\"St. Mary's College, Galway\"];\n\tbreak;\n\tcase \"Galway County\": return [\"Archbishop McHale College, Tuam\",\"Ardscoil Mhuire, Ballinasloe\",\n\t\t\t\t\t\t\t \"Calasanctius College, Oranmore\",\"Coláiste an Chreagáin, Ballinasloe\",\n\t\t\t\t\t\t\t \"Colaiste Cholmcille, Indreabhán\",\"Colaiste Chroi Mhuire, An Spideal\",\n\t\t\t\t\t\t\t \"Coláiste Ghobnait, Oileáin Arann\",\"Coláiste Mhuire, Ballygar\",\n\t\t\t\t\t\t\t \"Coláiste Naomh Feichín, Corr na Mona\",\"Colaiste Sheosaimh, Beál Áth na Slua\",\n\t\t\t\t\t\t\t \"Dunmore Community School, Dunmore\",\"Gaelcholaiste an Eachréidh, Athenry\",\n\t\t\t\t\t\t\t \"Gairm Scoil Chilleáin Naofa, Ballinasloe\",\"Gairmscoil Éinne Oileain Arann, Árainn\",\n\t\t\t\t\t\t\t \"Gairmscoil Mhuire, Athenry\",\"Gairmscoil na bPiarsach, Ros Muc\",\n\t\t\t\t\t\t\t \"Gleanamaddy Community School, Glenamaddy\",\"Gort Community School, Gort\",\n\t\t\t\t\t\t\t \"Holy Rosary College, Mountbellew\",\"Mercy College, Woodford\",\"Portumna Community School, Portumna\",\n\t\t\t\t\t\t\t \"Presentation College, Athenry\",\"Presentation College, Headford\",\"Presentation College, Tuam\",\n\t\t\t\t\t\t\t \"Scoil Chuimsitheach Chiaráin, An Cheathrú Rua\",\"Scoil Phobail, Clifden\",\n\t\t\t\t\t\t\t \"Scoil Phobail Mhic Dara, Carna\",\"Seamount College, Kinvara\",\n\t\t\t\t\t\t\t \"St Brigids Vocational School, Loughrea\",\"St Pauls, Oughterard\",\n\t\t\t\t\t\t\t \"St Raphaels College, Loughrea\",\"St. Brigid's School, Tuam\",\"St. Cuan's College, Ballinasloe\",\n\t\t\t\t\t\t\t \"St. Jarlaths College, Tuam\"];\n\tbreak;\n\tcase \"Kerry\": return [\"C.B.S. Secondary School, Tralee\",\"Castleisland Community College, Castleisland\",\n\t\t\t\t\t\t\t \"Causeway Comprehensive School, Causeway\",\"Coláiste Bhréanainn, Cill Airne\",\n\t\t\t\t\t\t\t \"Coláiste Íde, Daingean Uí Chúis\",\"Coláiste na Sceilge, Caherciveen\",\n\t\t\t\t\t\t\t \"Community College Killorglin, Killorglin\",\"Comprehensive School, Listowel\",\n\t\t\t\t\t\t\t \"Gaelcholáiste Chiarraí, Trá Lí\",\"Killarney Community College, Killarney\",\n\t\t\t\t\t\t\t \"Listowel Community College, Listowel\",\"Mean Scoil Naomh Ioseph, Castleisland\",\n\t\t\t\t\t\t\t \"Meanscoil Nua an Leith Triuigh, Caislean Ghriaire\",\"Meanscoil Phadraig Naofa, Castleisland\",\n\t\t\t\t\t\t\t \"Mercy Secondary School, Tralee\",\"Pobalscoil Chorca Dhuibhne, An Daingean\",\n\t\t\t\t\t\t\t \"Pobalscoil Inbhear Sceine, Kenmare\",\"Presentation Secondary School, Listowel\",\n\t\t\t\t\t\t\t \"Presentation Secondary School, Tralee\",\"Presentation Secondary School, Killarney\",\n\t\t\t\t\t\t\t \"Scoil Phobail Sliabh Luachra, Rathmore\",\"St. Brigid's Secondary School, Killarney\",\n\t\t\t\t\t\t\t \"St. Joseph's Secondary School, Ballybunion\",\"St. Michael's College, Listowel\",\n\t\t\t\t\t\t\t \"The Intermediate School, Killorglin\",\"Tralee Community College, Tralee\"];\n\tbreak;\n\tcase \"Kildare\": return [\"Árdscoil na Trionóide, Athy\",\"Ardscoil Rath Iomgháin, Rathangan\",\n\t\t\t\t\t\t\t \"Athy Community College, Athy\",\"Clongowes Wood College, Naas\",\n\t\t\t\t\t\t\t \"Colaiste Lorcain, Castledermot\",\"Coláiste Naomh Mhuire, Naas\",\n\t\t\t\t\t\t\t \"Confey Community College, Leixlip\",\"Cross And Passion College, Kilcullen\",\n\t\t\t\t\t\t\t \"Curragh Post-Primary School, Curragh\",\"Gael Cholaiste Chill Dara, An Curragh\",\n\t\t\t\t\t\t\t \"Holy Family Secondary School, Newbridge\",\"Leixlip Community School, Leixlip\",\n\t\t\t\t\t\t\t \"Maynooth Post Primary School, Maynooth\",\"Meánscoil Iognáid Ris, Naas\",\n\t\t\t\t\t\t\t \"Newbridge College, Newbridge\",\"Patrician Secondary School, Newbridge\",\n\t\t\t\t\t\t\t \"Piper's Hill College, Naas\",\"Presentation Secondary School, Kildare Town\",\n\t\t\t\t\t\t\t \"Salesian College, Celbridge\",\"Scoil Dara, Kilcock\",\"Scoil Mhuire Community School, Naas\",\n\t\t\t\t\t\t\t \"St Conleth's Community College, Newbridge\",\"St Farnan's Post Primary School, Prosperous\",\n\t\t\t\t\t\t\t \"St Joseph's Academy, Kildare Town\",\"St Pauls Secondary School, Monasterevin\",\n\t\t\t\t\t\t\t \"St Wolstan's Community School, Celbridge\",\"Vocational School, Kildare Town\"];\n\tbreak;\n\tcase \"Kilkenny\": return [\"Abbey Community College, Ferrybank\",\"City Vocational School, Kilkenny\",\n\t\t\t\t\t\t\t \"Coláiste Cois Siúire, Mooncoin\",\"Coláiste Éamann Rís, Callan\",\"Coláiste Mhuire, Johnstown\",\n\t\t\t\t\t\t\t \"Coláiste Pobail Osraí, Cill Chainnigh\",\"Community School, Castlecomer\",\n\t\t\t\t\t\t\t \"Duiske College, Graignamanagh\",\"Grennan College, Thomastown\",\"Kilkenny College, Kilkenny\",\n\t\t\t\t\t\t\t \"Loreto Secondary School, Kilkenny\",\"Meánscoil na mBráithre Criostaí, Cill Chainnigh\",\n\t\t\t\t\t\t\t \"Presentation Secondary School, Loughboy\",\"Scoil Aireagail, Ballyhale\",\"St Kieran's College, Kilkenny\",\n\t\t\t\t\t\t\t \"St. Brigid's College, Callan\"];\n\tbreak;\n\tcase \"Laois\": return [\"Clonaslee Vocational School, Clonaslee\",\"Coláiste Íosagáin, Portarlington\",\"Community School, Mountmellick\",\n\t\t\t\t\t\t\t \"Heywood Community School, Portlaoise\",\"Mountrath Community School, Mountrath\",\n\t\t\t\t\t\t\t \"Portlaoise College, Portlaoise\",\"Scoil Chriost Ri, Portlaoise\",\"St Fergal's College, Rathdowney\",\n\t\t\t\t\t\t\t \"St. Mary's C.B.S., Portlaoise\"];\n\tbreak;\n\tcase \"Leitrim\": return [\"Ballinamore Post Primary Schools, Ballinamore\",\"Carrigallen Vocational School, Carrigallen\",\n\t\t\t\t\t\t\t \"Community School, Carrick-On-Shannon\",\"Lough Allen College, Drumkeerin\",\n\t\t\t\t\t\t\t \"Mohill Community College, Mohill\",\"St. Clare's Comprehensive School, Manorhamilton\",\n\t\t\t\t\t\t\t \"Vocational School, Drumshambo\",\"Vocational School, Carrick-On-Shannon\"];\n\tbreak;\n\tcase \"Limerick City\": return [\"Ardscoil Mhuire, Limerick\",\"Ardscoil Ris, Limerick\",\"Colaiste Mhichil, Limerick\",\n\t\t\t\t\t\t\t \"Crescent College Comprehensive, Limerick\",\"Gaelcholaiste Luimnigh, Luimneach\",\n\t\t\t\t\t\t\t \"Laurel Hill Coláiste FCJ, Luimneach\",\"Laurel Hill Secondary School FCJ, Limerick\",\n\t\t\t\t\t\t\t \"Limerick Senior College, Limerick\",\"Presentation Secondary School, Limerick\",\n\t\t\t\t\t\t\t \"Salesian Secondary School, Limerick\",\"Scoil Carmel, Limerick\",\"St Clements College, Limerick\",\n\t\t\t\t\t\t\t \"St Endas Community School, Limerick\",\"St Munchin's College, Limerick\",\n\t\t\t\t\t\t\t \"St Nessan's Community College, Limerick\",\"Villiers Secondary School, Limerick\"];\n\tbreak;\n\tcase \"Limerick County\": return [\"Árd Scoil Mhuire FCJ, Bruff\",\"Castletroy College, Castletroy\",\"Colaiste Chiarain, Croom\",\n\t\t\t\t\t\t\t \"Coláiste Ióasef, Kilmallock\",\"Colaiste Mhuire, Askeaton\",\"Colaiste na Trocaire, Rathkeale\",\n\t\t\t\t\t\t\t \"Coláiste Pobail Mhichíl, Cappamore\",\"Desmond College, Newcastle West\",\"Glenstal Abbey School, Murroe\",\n\t\t\t\t\t\t\t \"Hazelwood College, Dromcollogher\",\"John The Baptist Community School, Hospital\",\n\t\t\t\t\t\t\t \"Salesian Secondary College, Pallaskenry\",\"Scoil Mhuire & Íde, Newcastle West\",\n\t\t\t\t\t\t\t \"Scoil Pól, Kilfinane\",\"St Fintan's C.B.S, Doon\",\"St Ita's College, Abbeyfeale\",\n\t\t\t\t\t\t\t \"St Joseph's Secondary School, Doon\",\"St. Jospeh's Sec. School, Abbeyfeale\",\n\t\t\t\t\t\t\t \"Vocational School, Abbeyfeale\"];\n\tbreak;\n\tcase \"Longford\": return [\"Ardscoil Phadraig, Granard\",\"Ballymahon Vocational School, Ballymahon\",\"Cnoc Mhuire, Granard\",\n\t\t\t\t\t\t\t \"Lanesboro Community College, Lanesboro\",\"Meán Scoil Muire, Longford Town\",\n\t\t\t\t\t\t\t \"Mercy Secondary School, Ballymahon\",\"Moyne Community School, Moyne\",\"St. Mel's College, Longford\",\n\t\t\t\t\t\t\t \"Templemichael College, Templemichael\"];\n\tbreak;\n\tcase \"Louth\": return [\"Ardee Community School, Ardee\",\"Bush Post Primary School, Dundalk\",\"Colaiste Rís, Dún Dealgan\",\n\t\t\t\t\t\t\t \"De La Salle College, Dundalk\",\"Drogheda Grammar School, Drogheda\",\"Dundalk Grammar School, Dundalk\",\n\t\t\t\t\t\t\t \"Ó Fiaich College, Dundalk\",\"Our Ladys College, Drogheda\",\"Sacred Heart Secondary School, Drogheda\",\n\t\t\t\t\t\t\t \"Scoil Ui Mhuiri, Dunleer\",\"St Louis Secondary School, Dundalk\",\"St Mary's College, Dundalk\",\n\t\t\t\t\t\t\t \"St Mary's Diocesan School, Drogheda\",\"St Oliver's Community College, Drogheda\",\n\t\t\t\t\t\t\t \"St Vincent's Secondary School, Dundalk\",\"St. Joseph's C.B.S., Drogheda\"];\n\tbreak;\n\tcase \"Mayo\": return [\"Balla Secondary School, Castlebar\",\"Ballinrobe Community School, Ballinrobe\",\n\t\t\t\t\t\t\t \"Ballyhaunis Community School, Ballyhaunis\",\"Carrowbeg College, Westport\",\n\t\t\t\t\t\t\t \"Coláiste Cholmáin, Claremorris\",\"Colaiste Chomain, Ballina\",\"Coláiste Mhuire, Tuar Mhic Éadaigh\",\n\t\t\t\t\t\t\t \"Davitt College, Castlebar\",\"Jesus & Mary Secondary School, Crossmolina\",\"McHale College, Westport\",\n\t\t\t\t\t\t\t \"Mount St Michael, Claremorris\",\"Moyne College, Ballina\",\"Naomh Iosaef, Caisleán An Bharraig\",\n\t\t\t\t\t\t\t \"Our Lady's Secondary School, Belmullet\",\"Rice College, Westport\",\"Sacred Heart School, Westport\",\n\t\t\t\t\t\t\t \"Sancta Maria College, Louisburgh\",\"Scoil Damhnait, Acaill\",\"Scoil Muire Agus Padraig, Swinford\",\n\t\t\t\t\t\t\t \"St Joseph's Secondary School, Foxford\",\"St Josephs Secondary School, Charlestown\",\n\t\t\t\t\t\t\t \"St Louis Community School, Kiltimagh\",\"St Muredachs College, Ballina\",\n\t\t\t\t\t\t\t \"St. Brendan's College, Belmullet\",\"St. Geralds College, Castlebar\",\n\t\t\t\t\t\t\t \"St. Mary's Secondary School, Ballina\",\"St. Patrick's College, Killala\",\"St. Tiernan's College, Ballina\"];\n\tbreak;\n\tcase \"Meath\": return [\"Ashbourne Community School, Ashbourne\",\"Athboy Community School, Athboy\",\n\t\t\t\t\t\t\t \"Beaufort College, Navan\",\"Boyne Community School, Trim\",\"Colaiste na hInse, Bettystown\",\n\t\t\t\t\t\t\t \"Coláiste Pobail Rath Cairn, Athboy\",\"Community College, Dunshaughlin\",\"Eureka Secondary School, Kells\",\n\t\t\t\t\t\t\t \"Franciscan College, Gormanstown\",\"Loreto Secondary School, Navan\",\"O'Carolan College, Nobber\",\n\t\t\t\t\t\t\t \"Ratoath College, Ratoath\",\"Scoil Mhuire, Trim\",\"St Ciaran's Community School, Kells\",\n\t\t\t\t\t\t\t \"St Oliver Post Primary, Oldcastle\",\"St Patrick's Classical School, Navan\",\n\t\t\t\t\t\t\t \"St Peter's College, Dunboyne\",\"St. Fintinas Post Primary School, Enfield\",\n\t\t\t\t\t\t\t \"St. Joseph's Secondary School, Navan\"];\n\tbreak;\n\tcase \"Monaghan\": return [\"Ballybay Community College, Ballybay\",\"Beech Hill College, Monaghan\",\"Castleblayney College, Castleblayney\",\n\t\t\t\t\t\t\t \"Coláiste Oiriall, Muineachán\",\"Inver College, Carrickmacross\",\"Largy College, Clones\",\n\t\t\t\t\t\t\t \"Monaghan Collegiate School, Monaghan\",\"Our Lady's Secondary School, Castleblayney\",\n\t\t\t\t\t\t\t \"Patrician High School, Carrickmacross\",\"St Louis Secondary School, Carrickmacross\",\n\t\t\t\t\t\t\t \"St. Louis Secondary School, Monaghan\",\"St. Macartan's College, Monaghan\"];\n\tbreak;\n\tcase \"Offaly\": return [\"Ard Scoil Chiarain Naofa, Clara\",\"Colaiste Choilm, Tulach Mhor\",\"Colaiste Na Sionna, Banagher\",\n\t\t\t\t\t\t\t \"Coláiste Naomh Cormac, Kilcormac\",\"Gallen Community School, Ferbane\",\n\t\t\t\t\t\t\t \"Killina Presentation Secondary School, Tullamore\",\"Oaklands Community College, Edenderry\",\n\t\t\t\t\t\t\t \"Sacred Heart Secondary School, Tullamore\",\"St Mary's Secondary School, Edenderry\",\n\t\t\t\t\t\t\t \"St.Brendan's Community School, Birr\",\"Tullamore College, Tullamore\"];\n\tbreak;\n\tcase \"Roscommon\": return [\"Abbey Community College, Boyle\",\"C.B.S. Roscommon, Roscommon\",\"Castlerea Community School, Castlerea\",\n\t\t\t\t\t\t\t \"Elphin Community College, Castlerea\",\"Roscommon Community School, Roscommon\",\n\t\t\t\t\t\t\t \"Scoil Muire gan Smal, Roscommon\",\"Scoil Mhuire, Strokestown\",\"St Nathy's College, Ballaghaderreen\"];\n\tbreak;\n\tcase \"Sligo\": return [\"Ballinode College, Ballinode\",\"Coláiste Iascaigh, Easkey\",\"Colaiste Mhuire, Ballymote\",\n\t\t\t\t\t\t\t \"Coola Post Primary School, Via Boyle\",\"Corran College, Ballymote\",\"Grange Vocational School, Grange\",\n\t\t\t\t\t\t\t \"Jesus & Mary Secondary School, Enniscrone\",\"Mercy College, Sligo\",\n\t\t\t\t\t\t\t \"North Connaught College, Tubbercurry\",\"Sligo Grammar School, Sligo\",\n\t\t\t\t\t\t\t \"St Attracta's Community School, Tubbercurry\",\"St Marys College, Ballysadare\",\n\t\t\t\t\t\t\t \"Summerhill College, Sligo\",\"Ursuline College, Finisklin\"];\n\tbreak;\n\tcase \"Tipperary North\": return [\"Borrisokane Community College, Borrisokane\",\"C.B.S. Thurles, Thurles\",\"Cistercian College, Roscrea\",\n\t\t\t\t\t\t\t \"Coláiste Mhuire Co-Ed, Thurles\",\"Colaiste Phobáil Ros Cré, Roscrea\",\"Nenagh Vocational School, Nenagh\",\n\t\t\t\t\t\t\t \"Our Ladys Secondary School, Templemore\",\"Presentation Secondary School, Thurles\",\n\t\t\t\t\t\t\t \"St Joseph's College, Newport\",\"St Josephs College, Thurles\",\"St Mary's Secondary School, Nenagh\",\n\t\t\t\t\t\t\t \"St. Joseph's C.B.S, Nenagh\",\"St. Mary's Secondary School, Newport\",\"St. Sheelan's College, Templemore\",\n\t\t\t\t\t\t\t \"Ursuline Secondary School, Thurles\"];\n\tbreak;\n\tcase \"Tipperary South\": return [\"Árdscoil na mBráithre, Clonmel\",\"C.B.S., Carrick-On-Suir\",\"Cashel Community School, Cashel\",\n\t\t\t\t\t\t\t \"Central Technical Institute, Clonmel\",\"Colaiste Dun Iascaigh, Cahir\",\"Comeragh College, Greenside\",\n\t\t\t\t\t\t\t \"Loreto Secondary School, Clonmel\",\"Patrician Presentation, Fethard\",\n\t\t\t\t\t\t\t \"Presentation Secondary School, Clonmel\",\"Rockwell College, Cashel\",\n\t\t\t\t\t\t\t \"Scoil Mhuire, Carrick-On-Suir\",\"Scoil Ruain, Thurles\",\"St. Alibe's School, Tippearary Town\",\n\t\t\t\t\t\t\t \"St. Anne's Secondary School, Tipperary Town\",\"The Abbey School, Tipperary Town\"];\n\tbreak;\n\tcase \"Waterford City\": return [\"C.B.S. Mount Sion, Waterford\",\"De La Salle College, Waterford\",\n\t\t\t\t\t\t\t \"Gaelcholáiste Phort Lairge, Waterford\",\"Newtown School, Waterford\",\n\t\t\t\t\t\t\t \"Our Lady of Mercy Secondary School, Waterford\",\"Presentation Secondary School, Waterford\",\n\t\t\t\t\t\t\t \"St Angela's, Waterford\",\"St Paul's Community College, Waterford City\",\"Waterpark College, Waterford\"];\n\tbreak;\n\tcase \"Waterford County\": return [\"Ard Scoil na nDeise, Dungarvan\",\"Blackwater Community School, Lismore\",\n\t\t\t\t\t\t\t \"C.B.S. Tramore, Tramore\",\"Coláiste Chathail Naofa, Dungarvan\",\"Meánscoil San Nioclás, Rinn O gCuanach\",\n\t\t\t\t\t\t\t \"Scoil na mBraithre, Dungarvan\",\"St Augustines College, Dungarvan\",\n\t\t\t\t\t\t\t \"St Declan's Community College, Kilmacthomas\",\"Stella Maris, Tramore\"];\n\tbreak;\n\tcase \"Westmeath\": return [\"Athlone Community College, Athlone\",\"Castlepollard Community College, Mullingar\",\n\t\t\t\t\t\t\t \"Colaiste Mhuire, Mullingar\",\"Columba College, Killucan\",\"Loreto College, Mullingar\",\n\t\t\t\t\t\t\t \"Marist College, Athlone\",\"Meán Scoil an Chlochair, Mullingar\",\"Moate Community School, Moate\",\n\t\t\t\t\t\t\t \"Mullingar Community College, Mullingar\",\"Our Lady's Bower, Athlone\",\n\t\t\t\t\t\t\t \"St Aloysius College, Athlone\",\"St Finian's College, Mullingar\",\"St Joseph's College, Athlone\",\n\t\t\t\t\t\t\t \"St Joseph's Secondary School, Rochfortbridge\",\"Wilson's Hospital School, Multyfarnham\"];\n\tbreak;\n\tcase \"Wexford\": return [\"Bridgetown Vocational College, Bridgetown\",\"Christian Brothers Secondary School, Wexford\",\n\t\t\t\t\t\t\t \"Christian Brothers Secondary School, New Ross\",\"Coláiste Abbain, Enniscorthy\",\n\t\t\t\t\t\t\t \"Coláiste an Átha, Kilmuckridge\",\"Coláiste Bride, Enniscorthy\",\"F.C.J. Secondary School, Enniscorthy\",\n\t\t\t\t\t\t\t \"Good Counsel College, New Ross\",\"Gorey Community School, Gorey\",\"Loreto Secondary School, Wexford\",\n\t\t\t\t\t\t\t \"Meanscoil Gharman, Brownswood\",\"New Ross Vocational College, New Ross\",\n\t\t\t\t\t\t\t \"Our Lady of Lourdes Secondary School, New Ross\",\"Presentation Secondary School, Wexford\",\n\t\t\t\t\t\t\t \"Ramsgrange Community School, New Ross\",\"St Peter's College, Summerhill\",\n\t\t\t\t\t\t\t \"St. Mary's C.B.S., Enniscorthy\",\"St. Mary's Secondary School, New Ross\",\n\t\t\t\t\t\t\t \"Vocational College, Enniscorthy\",\"Vocational College Bunclody, Enniscorthy\",\n\t\t\t\t\t\t\t \"Wexford Vocational College, Wexford\"];\n\tbreak;\n\tcase \"Wicklow\": return [\"Abbey Community College, Wicklow Town\",\"Arklow CBS, Arklow\",\"Arklow Community College, Arklow\",\n\t\t\t\t\t\t\t \"Avondale Community College, Rathdrum\",\"Blessington Community College, Blessington\",\n\t\t\t\t\t\t\t \"Coláiste Bhríde Carnew, Carnew\",\"Colaiste Chraobh Abhann, Kilcoole\",\"Coláiste Raithín, Bré\",\n\t\t\t\t\t\t\t \"De La Salle College, Wicklow Town\",\"Dominican College, Wicklow Town\",\n\t\t\t\t\t\t\t \"East Glendalough School, Wicklow Town\",\"Gaelcholaiste na Mara, Arklow\",\n\t\t\t\t\t\t\t \"Loreto Secondary School, Bray\",\"Presentation College, Bray\",\"Scoil Chonglais, Baltinglass\",\n\t\t\t\t\t\t\t \"St Brendan's College, Bray\",\"St David's Holy Faith Secondary, Greystones\",\"St Gerard's School, Bray\",\n\t\t\t\t\t\t\t \"St Kevin's Community College, Dunlavin\",\"St Marys College, Arklow\",\"St Thomas' Community College, Bray\",\n\t\t\t\t\t\t\t \"St. Kilian's Community School, Bray\"];\n\tbreak;\n\t}\n}", "function getWTRvalue() {\n var score = -1;\n if (app.SHRFlag == 1) {\n app.prevalingSHRData.SHR.pWTR = $(\"select[name=WTRForm]\").val();\n score = app.prevalingSHRData.SHR.pWTR;\n } else {\n app.esSHRData.SHR.pWTR = $(\"select[name=WTRForm]\").val();\n score = app.esSHRData.SHR.pWTR;\n }\n return score;\n}", "function typeaheadSchool(query) {\n\t\tvar schs = [query];\n\t\t$('datalist[data-for=high_school_name] option[value*=\"' + query + '\"]').each(function() {\n\t\t\tschs.push($(this).attr('value'));\n\t\t})\n\n\t\treturn schs;\n\t}", "function getSchools () {\r\n\t\t\t\t\tvar url = config.schools_url;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$.ajax( {\r\n\t\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\t\turl: url\r\n\t\t\t\t\t} ).done( function ( response ) {\r\n\t\t\t\t\t\tinitialize( response );\r\n\t\t\t\t\t} );\r\n\t\t\t\t}", "function hasSchoolFilter() {\n var result = _.findWhere(vm.schools, {\n isChecked: true\n });\n return typeof result !== 'undefined';\n\n }", "function getGrade (s1, s2, s3) {\n // Code here\n var mean = (s1 + s2 + s3) / 3;\n var grade;\n if (mean >= 90) { grade = \"A\"; }\n else if (mean >= 80) { grade = \"B\"; }\n else if (mean >= 70) { grade = \"C\"; }\n else if (mean >= 60) { grade = \"D\"; }\n else { grade = \"F\"; }\n return grade;\n}", "async function register_a_school(o) {\n const {name, app_instance, verbose} = o;\n const {school_name =name} = o;\n _assert(school_name, o, `Missing school name (name:${name})`)\n const {label = name} = o;\n let {district_id} = o;\n\n _assert(school_name, o, \"Missing school name.\")\n _assert(app_instance, o, \"Missing app_instance.\")\n const {package_id, app_folder,\n schools_folder, districts_folder\n } = app_instance;\n _assert(package_id, o, \"Missing package_id.\")\n _assert(app_folder, o, \"Missing app_folder.\")\n _assert(schools_folder, o, \"Missing schools_folder.\")\n\n /*\n FIRST lookup on district\n and create a relation... TODO\n */\n\n\n\n if (!district_id && district_name) {\n district_id = await db.query(`\n select *\n from cr_folders, cr_items\n where (item_id = folder_id)\n and (parent_id = $(parent_id))\n and (name = $(name));\n `,{name:district_name, parent_id:districts_folder},{single:true})\n .then(retv =>{\n return retv && retv.folder_id;\n })\n }\n\n /*\n lookup for an existsing school.\n */\n const _schools = app_instance._schools;\n let school = _schools && _schools[school_name];\n\n if (!school) {\n school = await api.content_item__get({\n parent_id:schools_folder,\n name: school_name,\n })\n }\n\n if (!school) {\n const item_id = await api.content_item__new({\n parent_id: schools_folder,\n name: school_name,\n label: school_name,\n package_id,\n context_id: schools_folder,\n item_subtype: 'tapp.school'\n })\n .catch(err =>{\n if (err.code != 23505) throw err;\n console.log(`ALERT school@42 : `, err.detail)\n })\n }\n}", "function renderSchool(doc){\n let dib = document.createElement('div');\n let school = document.createElement('div');\n let degree = document.createElement('div'); \n let year_start = document.createElement('span');\n let year_end = document.createElement('span');\n\n dib.setAttribute('data-id', doc.id);\n school.textContent = doc.data().school;\n degree.textContent = doc.data().degree;\n year_start.textContent = doc.data().year_start + \" - \";\n year_end.textContent = doc.data().year_end;\n\n\n dib.appendChild(school);\n dib.appendChild(degree);\n dib.appendChild(year_start);\n dib.appendChild(year_end); \n\n schoollist.appendChild(dib);\n\n }", "getSummary() {\n return getSubjectSummary(this._subject, this._school, this._degree, this._course);\n }", "function showStudentAddress(address) {\n var address = student.studentAddress;\n return address;\n}", "getSalary() {\n return this.salary;\n }", "function School(){\n\tthis.distanceChance = 49;\n\tthis.feedChance = 12;\n\tthis.materialChance = 10;\n\tthis.buildingChance = 15;\n\tthis.goodTeachChance = 13;\n\t\n\tthis.available = true;\n\t\n\tthis.hasGoodTeacher = ( (Math.floor(Math.random() * (100 - 1 + 1) + 1))<= this.goodTeachChance ) ? true : false;\t\n\tthis.hasBuilding = ( (Math.floor(Math.random() * (100 - 1 + 1) + 1))<= this.buildingChance ) ? true : false;\n\tthis.hasMats = ( (Math.floor(Math.random() * (100 - 1 + 1) + 1))<= this.materialChance ) ? true : false;\n\tthis.feedStudents = ( (Math.floor(Math.random() * (100 - 1 + 1) + 1))<= this.feedChance ) ? true : false;\n\tthis.far = ( (Math.floor(Math.random() * (100 - 1 + 1) + 1))<= this.distanceChance ) ? true : false;\n\t\n\t\n\t\n\tthis.reRoll = function(){\n\t\tvar rolls = Math.floor(Math.random() * (100 - 1 + 1) + 1);\n\t\tthis.far = ( (rolls<=this.distanceChance)? true : false );\n\t\trolls = Math.floor(Math.random() * (100 - 1 + 1) + 1);\n\t\tthis.feedStudents = ( (rolls<=this.feedChance) ? true : false );\n\t\trolls = Math.floor(Math.random() * (100 - 1 + 1) + 1);\n\t\tthis.hasMats = ( (rolls<=this.materialChance) ? true : false );\n\t\trolls = Math.floor(Math.random() * (100 - 1 + 1) + 1);\n\t\tthis.hasGoodTeacher = ( (rolls<51) ? true : false );\n\t\trolls = Math.floor(Math.random() * (100 - 1 + 1) + 1);\n\t\tthis.hasBuilding = ( (rolls<=this.buildingChance) ? true : false);\n\t}\n}", "function perbandingan() {\n let nilai; \n let Student = \"Prigerio\";\n switch (Student) {\n case \"Prigerio\":\n nilai = 80;\n break;\n case \"Eric\":\n nilai = 85;\n break;\n case \"Glain\":\n nilai = 88;\n break;\n case \"Glabrian\":\n nilai = 87;\n break;\n default:\n nilai= \"Nama tidak ada\";\n }\n console.log(nilai);\n }", "function isCheckedSchool(school) {\n return _.contains(vm.checkedSchoolCodes, school.code);\n }", "function checkSchool () {\n // Clear out messages.\n document.getElementById('output').innerHTML = null\n\n // Get the user's age and set to an integer.\n userAge = document.getElementById('age-input').value\n userAge = parseInt(userAge)\n\n // Get the day, and set it to all uppercase, making it case-insensitive.\n userDay = document.getElementById('day-input').value\n userDay = userDay.toUpperCase()\n console.log(userDay)\n\n // If the user's age is not a number or not realistic, send error message.\n if (isNaN(userAge) || userAge <= 0 || userAge >= 200) {\n document.getElementById('output').innerHTML = 'Please enter a valid age, using numerical symbols.'\n\n // If the user's age is valid, spellcheck to ensure it is a day of the week.\n } else if (userDay !== 'MONDAY' && userDay !== 'TUESDAY' && userDay !== 'WEDNESDAY' && userDay !== 'THURSDAY' && userDay !== 'FRIDAY' && userDay !== 'SATURDAY' && userDay !== 'SUNDAY') {\n // If it isn't, then send this error message.\n document.getElementById('output').innerHTML = 'Please check that the day of the week has been spelled correctly.'\n\n // If age is a valid number and the day is spelled correctly, proceed.\n } else {\n // If user is both between 5 and 19 years of age, and the day is not Saturday or Sunday, send the below message.\n if ((userAge >= 5 && userAge < 18) && (userDay !== 'SATURDAY' && userDay !== 'SUNDAY')) {\n document.getElementById('output').innerHTML = 'Time for school!'\n\n // If the above conditions are false because the user is above 18, send this message.\n } else if ((userAge > 18) && (userDay !== 'SATURDAY' && userDay !== 'SUNDAY')) {\n document.getElementById('output').innerHTML = 'Time to go to work!'\n\n // If the user's age is less than 5, send this message instead.\n } else if (userAge < 5) {\n document.getElementById('output').innerHTML = 'You aren\\'t quite old enough for school yet.'\n\n // If all of those are false, send this message.\n } else {\n document.getElementById('output').innerHTML = 'Time to relax for the weekend!'\n }\n }\n}", "function getZWRvalue() {\n var score = -1;\n if (app.SHRFlag == 1) {\n app.prevalingSHRData.SHR.pZWR = $(\"select[name=ZWRForm]\").val();\n score = app.prevalingSHRData.SHR.pZWR;\n } else {\n app.esSHRData.SHR.pZWR = $(\"select[name=ZWRForm]\").val();\n score = app.esSHRData.SHR.pZWR;\n }\n return score;\n}", "function School(){\n\tvar School = [];\n\n\tthis.add = function(Person){\n\t\tSchool.push(Person);\n\t}\n\n\tthis.list= function(){\n\t\tfor(i=0;i<School.length;i++){\n\t\t\tconsole.log(School[i]);\n\t\t}\n\t}\n}", "getDetail() {\n return getSubjectDetail(this._subject, this._school, this._degree, this._course);\n }", "function getIDStudent(){\n\t//Obtenim el ID de la part superior.\n\treturn $(\"#alumnes\").val();\n}", "function getGrade(s1, s2, s3) {\n // Code here\n\n let score = (s1 + s2 + s3) / 3\n\n if (score >= 90 && score <= 100) {\n return 'A';\n } else if (score >= 80 && score <= 90) {\n return 'B';\n } else if (score >= 70 && score < 80) {\n return 'C';\n } else if (score >= 60 && score < 70) {\n return 'D';\n } else {\n return 'F';\n }\n}", "function addSiteSchoolComputes(siteSchools, schools) {\n _.forEach(siteSchools, function (siteSchool) {\n // Lookup the school associated with the site in the list of schools\n var foundSchool = _.findWhere(schools, { code: siteSchool.code });\n\n if (foundSchool) {\n _.merge(siteSchool, foundSchool);\n }\n\n var foundTransport = _.findWhere(refTransport, { code: siteSchool.transportType });\n if (foundTransport) {\n siteSchool.transport = foundTransport;\n }\n });\n }", "function getSchoolStartingWith(schoolName) {\n let schoolRef = db.collection('schools');\n let slen = schoolName.length;\n let ubound = schoolName.substring(0, slen-1) +\n String.fromCharCode(schoolName.charCodeAt(slen-1) + 1);\n let schoolDoc = schoolRef.where('name', '>=', schoolName).where('name', '<', ubound)\n .get().then(snapshot => {\n if (snapshot.empty) {\n return [];\n }\n var schools = [];\n snapshot.forEach(doc => {\n schools.push(doc.data());\n });\n return schools;\n })\n return schoolDoc;\n}", "getValue() {\n return this.powerOfTwos[0];\n }", "getValue() {\n return this.powerOfTwos[0];\n }", "function femGirlsSchool(){\n\t\n\t\n\t$.ajax({\n\t url: 'http://api.worldbank.org/v2/en/countries/WLD/indicators/SE.PRM.UNER.FE?&MRV=1&format=json',\n\t type: 'GET',\n\t \n\t \n\t failure: function(err){\n\t \treturn alert (\"Could not get the Data\");\n\n\t },\n\t success: function(response) {\n\t \tconsole.log(response);\n\t \t girlsInSchool = Math.round((response[1][0].value)/1000000);\n\t \tconsole.log(womenInParliament);\n\t \tvar htmlToAppend='<div class=\"card-container col-sm-4 col-md-4 centered\">'+\n\t\t'<div class=\"card\">'+\n\t\t\t'<h2>About</h2>'+\n\t\t '<h1>'+girlsInSchool+' Million</h1>'+\n\t\t '<h2> Girls are not going to elementary school</h2>'+\n\t\t '<a href=\"http://datatopics.worldbank.org/gender/indicators\" target=\"_blank\"><h3>Source: World Bank Data</h3></a>'+\n\t\t '<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-text=\"'+girlsInSchool+ ' million girls are not going to elementary school\" data-via=\"@worldbankdata\" data-show-count=\"false\">Tweet</a><script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>'+\n\n\t '</div>'+\n\t'</div>';\n\t \n\t addCard(girlsInSchool, htmlToAppend);\n\n\t }\n\t})\n}", "function schoolsSalaryTable(res){\n let snum = 1,\n staffSalary = res.salary.reduce((acc, sch) => {\n return {\n ...acc, \n [sch.school_id]: (+sch.salary).toLocaleString('en-NG', {style:'currency', currency:'NGN'})\n }\n }, {}),\n pay_stats = res.pay_stats ? res.pay_stats.reduce((acc, sch) => {\n return {...acc, [sch.school_id]: {pay_date: sch.pay_date, pay_id: sch.id}}\n }, {}) : [],\n totalSalary = res.salary.reduce((acc, sch) => acc += +sch.salary, 0);\n\n let schoolTable = `\n <div class='row pt-2 pb-2 mb-2 rounded'>\n <div class='col-12 col-md-4'> \n <div class='card pline'>\n <div class='card-body'>\n <h5 class='card-title'>Date: </h5>\n <h6>\n <span id='currMonth' data-val='${res.searchDate.m}'>${months[+res.searchDate.m]}</span>, \n <span id='currYear'data-val='${res.searchDate.y}'>${res.searchDate.y}</span>\n </h6>\n </div>\n </div> \n </div>\n <div class='col-12 col-md-4'>\n <div class='card pline'>\n <div class='card-body'>\n <h5 class='card-title'>Total Salary Payable: </h5>\n <h6>${totalSalary.toLocaleString('en-NG', {style:'currency', currency:'NGN'})}</h6>\n </div>\n </div>\n </div>\n <div class='col-12 col-md-4'>\n <div class='card pline'>\n <div class='card-body'>\n <h5 class='card-title'>Total Salary Approved: </h5>\n <h6>${totalSalary.toLocaleString('en-NG', {style:'currency', currency:'NGN'})}</h6>\n </div>\n </div>\n </div>\n </div>\n <div class='row pline'> \n <div class='col-md-12'><select id='chooseMonth' style='width:20% !important;'>${monthDrop}</select></div>\n <div class='col-md-12'><select id='chooseYear' style='width:20% !important;'>${yearDrop}</select></div>\n \n <div class='col-md-12 pt-1 text-center'><button class='btn btn-outline oxline' data-page='payroll' id='changeMonth'>SELECT</button></div>\n </div>\n <table class='table table-bordered table-striped table-sm mt-2' >\n <thead class='oxblood text-center'>\n <th>S/No.</th>\n <th>Name</th>\n <th>Staff Size</th>\n <th>Total Salary per Month</th>\n <th>Approval Status</th>\n <th>Bank Payment Report</th>\n <th>Process Payroll</th>\n <thead>\n <tbody>\n `;\n // console.log(staffSalary);\n res.schools.forEach(sch => schoolTable += `\n <tr id='${sch.school_id}'>\n <td>${snum++}</td>\n <td>${sch.school_name}</td>\n <td class='text-center'>${sch.staff}</td>\n <td>${staffSalary[sch.school_id]}</td>\n <td class='text-center'>${pay_stats[sch.school_id] ? 'Approved' :'Unprocessed'}</td>\n <td class='text-center'>Not Paid</td>\n <td class='text-center'>\n ${pay_stats[sch.school_id] ?\n `<button class='btn btn-outline-success btn-sm schoolReportBtn' data-val='${pay_stats[sch.school_id].pay_id}' data-sch='${sch.school_id}'>\n Report\n </button>` :\n `<button class='btn btn-outline-primary btn-sm schoolPayrollBtn' data-sch='${sch.school_id}'>\n Process\n </button>`\n }\n </td>\n </tr>\n `\n );\n schoolTable += '</tbody></table>'\n\n return schoolTable;\n}", "function ssCalc() {\n var gross = result.householdGross || ( (plan.grossAnnualIncome || 0) + (plan.spouseGrossAnnualIncome || 0)) - ((plan.user401kContribution || 0) + (plan.spouse401kContribution || 0) );\n var taxable = Math.min( gross, federal.fica.ssWageBase );\n return ( taxable * federal.fica.ssTax );\n }", "function getGrade() {\n\t\tconsole.log('getting grade');\n\t\t\n\t\t// Read the answer from the text area\n\t\tJSProblemState['answerGiven'] = $('#studentanswer').val();\n\t\t\n\t\t// Right now we're just checking to see if you can square something.\n\t\t// In practical use, you should check correctness within the problem's Python, not here.\n\t\tvar input = parseInt(JSProblemState['variable1'], 10);\n\t\tvar studentAnswer = parseInt(JSProblemState['answerGiven'], 10);\n\t\tif(studentAnswer == input*input){\n\t\t\tJSProblemState['isCorrect'] = true;\n\t\t}\n\t\t\n\t\t// Log the problem state. \n\t\t// This is called from the parent window's Javascript so that we can write to the official edX logs. \n\t\tparent.logThatThing(JSProblemState);\n\n\t\t// Return the whole problem state.\n\t\treturn JSON.stringify(JSProblemState);\n\t}", "function GradeMetricPrototype(){\n\t\t/*jshint maxcomplexity: 20*/\n\t\t//source:\n\t\t//http://en.wikipedia.org/wiki/Education_in_the_United_States\n\t\tthis.getGrade = function(text){\n\t\t\tvar grade = this.getValue(text);\n\t\t\tif(grade < -1){\n\t\t\t\treturn 'Preschool';\n\t\t\t} else if(grade <= 0){\n\t\t\t\treturn 'Pre-Kindergarten';\n\t\t\t} else if(grade <= 1){\n\t\t\t\treturn 'Kindergarten';\n\t\t\t} else if(grade <= 2){\n\t\t\t\treturn '1st Grade';\n\t\t\t} else if(grade <= 3){\n\t\t\t\treturn '2nd Grade';\n\t\t\t} else if(grade <= 4){\n\t\t\t\treturn '3rd Grade';\n\t\t\t} else if(grade <= 5){\n\t\t\t\treturn '4th Grade';\n\t\t\t} else if(grade <= 6){\n\t\t\t\treturn '5th Grade';\n\t\t\t} else if(grade <= 7){\n\t\t\t\treturn '6th Grade';\n\t\t\t} else if(grade <= 8){\n\t\t\t\treturn '7th Grade';\n\t\t\t} else if(grade <= 9){\n\t\t\t\treturn '8th Grade';\n\t\t\t} else if(grade <= 10){\n\t\t\t\treturn '9th Grade (Freshman)';\n\t\t\t} else if(grade <= 11){\n\t\t\t\treturn '10th Grade (Sophomore)';\n\t\t\t} else if(grade <= 12){\n\t\t\t\treturn '11th Grade (Junior)';\n\t\t\t} else if(grade <= 13){\n\t\t\t\treturn '12th Grade (Senior)';\n\t\t\t} else {\n\t\t\t\treturn 'Tertiary education';\n\t\t\t}\n\t\t};\n\n\t\tthis.getRoughGrade = function(text){\n\t\t\tvar grade = this.getValue(text);\n\t\t\tif(grade < 1){\n\t\t\t\treturn 'Preschool';\n\t\t\t} else if(grade <= 5){\n\t\t\t\treturn 'Elementary school';\n\t\t\t} else if(grade <= 8){\n\t\t\t\treturn 'Middle school';\n\t\t\t} else if(grade <= 12){\n\t\t\t\treturn 'High school';\n\t\t\t} else {\n\t\t\t\treturn 'Tertiary education';\n\t\t\t}\n\t\t};\n\t}", "function skill(){\r\n let skillLevel = document.getElementsByName(\"skill\");\r\n for(var i = 0; i < skillLevel.length; i++) {\r\n if(skillLevel[i].checked){\r\n return skillLevel[i].value;\r\n }\r\n }\r\n }", "function getGrade(gradeOne, gradeTwo, gradeThree) {\n let score = (gradeOne + gradeTwo + gradeThree) / 3;\n if (90 <= score) return 'A';\n if (80 <= score) return 'B';\n if (70 <= score) return 'C';\n if (60 <= score) return 'D';\n return 'F';\n}", "function getStudentInfo () {\n\t//get the currentProblemIndex\n\tcurrentProblemIndex = StudentModel.find({_id: Meteor.userId()}).fetch()[0].currentproblemindex;\n\tif (currentProblemIndex == undefined) {\n\t\tcurrentProblemIndex == 0;\n\t\tMeteor.call('updateStudentModel', 'currentproblemindex', 0);\n\t}\n\n\t//get the partialProblems\n\tpartialProblems = StudentModel.find({_id: Meteor.userId()}).fetch()[0].partialproblems;\n\tif (partialProblems == undefined) {\n\t\tmakeProblems();\n\t\tMeteor.call('updateStudentModel', 'partialproblems', partialProblems);\n\t}\n\n\t//get the currentProblem\n\tcurrentProblem = partialProblems[currentProblemIndex];\n\n\t//get the partialproofcolor\n\tcolorIndex = StudentModel.find({_id: Meteor.userId()}).fetch()[0].partialproofcolor;\n\tif (colorIndex == undefined) {\n\t\tcolorIndex = 0;\n\t\tMeteor.call('updateStudentModel', 'partialproofcolor', 0);\n\t}\n\tdocument.getElementById('colorSelectPartial').selectedIndex = colorIndex;\n\tvar currentdragcolorname = colorSchemes[colorIndex].dragcolorname;\n\tvar currentdropcolorname = colorSchemes[colorIndex].dropcolorname;\n\tvar currentrulecolorname = colorSchemes[colorIndex].rulecolorname;\n\tchangeColors(colorSchemes[colorIndex]);\n\tvar currenthtml = $('#ruleInstructionsPartial').html();\n\tvar newhtml = currenthtml.replace(currentdragcolorname, colorSchemes[colorIndex].dragcolorname);\n\tnewhtml = newhtml.replace(currentdropcolorname, colorSchemes[colorIndex].dropcolorname);\n\tnewhtml = newhtml.replace(currentrulecolorname, colorSchemes[colorIndex].rulecolorname)\n\t$('#ruleInstructionsPartial').html(newhtml);\n}", "get s() {\r\n return this.values[1];\r\n }", "countyValue(county, techSalariesMap) {\n const medianHousehold = this.state.medianIncomes[county.id],\n salaries = techSalariesMap[county.name];\n\n if (!medianHousehold || !salaries) {\n return null;\n }\n\n const median = d3.median(salaries, d => d.base_salary);\n\n return {\n countyID: county.id,\n value: median - medianHousehold.medianIncome\n };\n }", "grade(Student, subject){\n return `${Student.name} receives a perfect score on ${subject}`;\n }", "function hoverOnSchool(e){\n\tvar school = e.features[0]\n\t//do not trigger mouseevents on schools outside of selected district\n\tif(+school.properties.districtId != +getActiveDistrict()){\n\t\treturn false\n\t}\n\tif(getActiveLayers().indexOf(e.features[0].layer.id) == -1){\n\t\treturn false;\n\t}\n\tsetActiveSchool(school.properties, \"maphover\")\n}", "function getStudents () {\n\n }", "static updateSchool(userId, schoolId) {\n const req = new Request(`/api/users/${userId}/assignment`, {\n method : 'PUT',\n headers : this.requestHeaders(),\n body : this.requestBody({assignment: schoolId})\n });\n return fetch(req).then(res => this.parseResponse(res))\n .catch(err => {\n throw err;\n });\n }", "function getVals() {\n\n //Get Current Grade\n var currentGrade = document.getElementById(\"currentGrade\").value;\n currentGrade /= 100;\n\n //Get Desired Grade\n var desiredGrade = document.getElementById(\"desiredGrade\").value;\n desiredGrade /= 100;\n\n //Get Weight\n var weight = document.getElementById(\"weight\").value;\n weight /= 100;\n\n //Calcuate Final Grade\n var finalGrade = (desiredGrade - (1-weight)*currentGrade) / weight;\n finalGrade = Math.round(finalGrade * 100)\n\n\n if(finalGrade > 90){\n document.getElementById(\"result\").innerHTML = \"You need a \" + finalGrade + \"% on your final exam to get a \" + desiredGrade * 100 + \" in the class. Better start studying.\";\n } else if (finalGrade <= 90 && finalGrade > 80) {\n document.getElementById(\"result\").innerHTML = \"You need a \" + finalGrade + \"% on your final exam to get a \" + desiredGrade * 100 + \" in the class. Could be worse.\";\n } else if (finalGrade <= 80 && finalGrade > 70) {\n document.getElementById(\"result\").innerHTML = \"You need a \" + finalGrade + \"% on your final exam to get a \" + desiredGrade * 100 + \" in the class. No sweat, you got this.\";\n } else if (finalGrade <= 70 && finalGrade > 60) {\n document.getElementById(\"result\").innerHTML = \"You need a \" + finalGrade + \"% on your final exam to get a \" + desiredGrade * 100 + \" in the class. This'll be easy.\";\n } else {\n document.getElementById(\"result\").innerHTML = \"You need a \" + finalGrade + \"% on your final exam to get a \" + desiredGrade * 100 + \" in the class. Enjoy not studying!\";\n }\n\n\n }", "function getLDRvalue() {\n var score = -1;\n if (app.SHRFlag == 1) {\n app.prevalingSHRData.SHR.pLDR = $(\"select[name=LDRForm]\").val();\n score = app.prevalingSHRData.SHR.pLDR;\n } else {\n app.esSHRData.SHR.pLDR = $(\"select[name=LDRForm]\").val();\n score = app.esSHRData.SHR.pLDR;\n }\n return score;\n}", "function getClasses(school) {\n var classRef = db.collection('classes');\n var schoolRef = db.collection('schools').doc(school);\n var getDoc = classRef.where('school', '==', schoolRef).get().then(snapshot => {\n if (snapshot.empty) {\n console.log('No matching documents.');\n return { \"classes\": [] };\n }\n \n var classes = [];\n snapshot.forEach(doc => {\n classes.push(doc.data());\n });\n // Return a JSON object with the list of classes under \"classes\" \n return { \"classes\": classes };\n }).catch(err => {\n console.log('Error getting documents', err);\n })\n return getDoc;\n}", "function yourScore() {\n return fname + ' scored ' + (mid + final);\n }", "function getSchools() {\n setLoading(true)\n ref.onSnapshot((querySnapshot) => {\n const items = []\n querySnapshot.forEach((document) => {\n items.push(document.data())\n })\n setSchools(items)\n setLoading(false)\n })\n }", "function getSingleRating(hospital,ratingField){\n sort(ratingField[\"field\"],ratingField[\"order\"]);\n\n var position = getPosition(tempActualLocation,hospital);\n\n var singleRating = position/actualLocation.length*ratingField[\"weight\"]*10;\n //alert(position/actualLocation.length);\n return singleRating;\n}", "getStudentName(reverse = false) {\n let name = API.LMSGetValue(\"cmi.core.student_name\");\n let parts;\n if (!reverse)\n if (name.indexOf(\",\") !== -1) {\n parts = name.split(\",\");\n name = `${parts[1]}${parts[0]}`;\n }\n\n\n return name;\n }", "function findLetterGrade(grade) {\n var letterGrade = \"N/A\"\n if (grade >= 90) {\n letterGrade = \"A\"\n } else if (grade >= 80) {\n letterGrade = \"B\"\n } else if (grade >= 70) {\n letterGrade = \"C\"\n } else if (grade >= 60) {\n letterGrade = \"D\"\n } else {\n letterGrade = \"F\"\n };\n document.getElementById(\"WHO2\").value = letterGrade;\n}", "function getFullname(student){\n //var fullName;\n \n\n return student.lastName + \", \" + student.firstName;\n\n //return fullName;\n}" ]
[ "0.7883279", "0.7675038", "0.76711863", "0.7641319", "0.7619529", "0.7567898", "0.7478936", "0.7478936", "0.7478936", "0.7392111", "0.7392111", "0.731801", "0.7130422", "0.7116012", "0.69902337", "0.6876591", "0.6616988", "0.6229336", "0.6229148", "0.616906", "0.61309236", "0.6095324", "0.6074611", "0.6058862", "0.6057706", "0.59455454", "0.5835782", "0.5809833", "0.57632434", "0.57047683", "0.5672892", "0.5668399", "0.5657577", "0.5650282", "0.56342244", "0.5600543", "0.55245155", "0.5492793", "0.5491849", "0.5482556", "0.5456766", "0.5435984", "0.54140294", "0.5374505", "0.53672147", "0.5353166", "0.534028", "0.5326416", "0.53200746", "0.5315202", "0.53113437", "0.5302603", "0.5300054", "0.5285721", "0.5257271", "0.5255211", "0.52207583", "0.5218769", "0.52034336", "0.5189862", "0.51765496", "0.51746535", "0.5170688", "0.516802", "0.5167972", "0.5161176", "0.5132578", "0.51212806", "0.5116145", "0.51110274", "0.5097342", "0.5094269", "0.5088235", "0.5085333", "0.5063618", "0.50570005", "0.50570005", "0.5052537", "0.5043711", "0.50415426", "0.5040034", "0.503278", "0.5031054", "0.5027191", "0.50230813", "0.5018819", "0.50157195", "0.49795622", "0.49753678", "0.49742314", "0.49721634", "0.49270332", "0.4924516", "0.4903105", "0.48901626", "0.48848557", "0.48692483", "0.48595908", "0.48540974", "0.48530006" ]
0.6977147
15
bracketRegex is used to specify which type of bracket to scan should be a regexp, e.g. /[[\]]/ Note: If "where" is on an open bracket, then this bracket is ignored. Returns false when no bracket was found, null when it reached maxScanLines and gave up
function scanForBracket(cm, where, dir, style, config) { var maxScanLen = (config && config.maxScanLineLength) || 10000; var maxScanLines = (config && config.maxScanLines) || 1000; var stack = []; var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) : Math.max(cm.firstLine() - 1, where.line - maxScanLines); for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { var line = cm.getLine(lineNo); if (!line) continue; var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; if (line.length > maxScanLen) continue; if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); for (; pos != end; pos += dir) { var ch = line.charAt(pos); if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { var match = matching[ch]; if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch); else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; else stack.pop(); } } } return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scanForBracket(cm,where,dir,style,config){for(var maxScanLen=config&&config.maxScanLineLength||1e4,maxScanLines=config&&config.maxScanLines||1e3,stack=[],re=config&&config.bracketRegex?config.bracketRegex:/[(){}[\\]]/,lineEnd=dir>0?Math.min(where.line+maxScanLines,cm.lastLine()+1):Math.max(cm.firstLine()-1,where.line-maxScanLines),lineNo=where.line;lineNo!=lineEnd;lineNo+=dir){var line=cm.getLine(lineNo);if(line){var pos=dir>0?0:line.length-1,end=dir>0?line.length:-1;if(!(line.length>maxScanLen))for(lineNo==where.line&&(pos=where.ch-(dir<0?1:0));pos!=end;pos+=dir){var ch=line.charAt(pos);if(re.test(ch)&&(void 0===style||cm.getTokenTypeAt(Pos(lineNo,pos+1))==style)){var match=matching[ch];if(\">\"==match.charAt(1)==dir>0)stack.push(ch);else{if(!stack.length)return{pos:Pos(lineNo,pos),ch:ch};stack.pop()}}}}}return lineNo-dir!=(dir>0?cm.lastLine():cm.firstLine())&&null}", "function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\\]]/;\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {\n var match = matching[ch];\n if ((match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }", "function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\\]]/;\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {\n var match = matching[ch];\n if ((match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }", "function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = config && config.maxScanLineLength || 10000;\n var maxScanLines = config && config.maxScanLines || 1000;\n var stack = [];\n var re = bracketRegex(config);\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1,\n end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n\n if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {\n var match = matching[ch];\n if (match && match.charAt(1) == \">\" == dir > 0) stack.push(ch);else if (!stack.length) return {\n pos: Pos(lineNo, pos),\n ch: ch\n };else stack.pop();\n }\n }\n }\n\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }", "function scanForBracket(cm, where, dir, style, config) {\n\t\t var maxScanLen = (config && config.maxScanLineLength) || 10000;\n\t\t var maxScanLines = (config && config.maxScanLines) || 1000;\n\n\t\t var stack = [];\n\t\t var re = bracketRegex(config);\n\t\t var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n\t\t : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n\t\t for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n\t\t var line = cm.getLine(lineNo);\n\t\t if (!line) continue;\n\t\t var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n\t\t if (line.length > maxScanLen) continue;\n\t\t if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n\t\t for (; pos != end; pos += dir) {\n\t\t var ch = line.charAt(pos);\n\t\t if (re.test(ch) && (style === undefined ||\n\t\t (cm.getTokenTypeAt(Pos(lineNo, pos + 1)) || \"\") == (style || \"\"))) {\n\t\t var match = matching[ch];\n\t\t if (match && (match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n\t\t else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n\t\t else stack.pop();\n\t\t }\n\t\t }\n\t\t }\n\t\t return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n\t\t }", "function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = bracketRegex(config)\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {\n var match = matching[ch];\n if ((match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }", "function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = bracketRegex(config)\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined ||\n (cm.getTokenTypeAt(Pos(lineNo, pos + 1)) || \"\") == (style || \"\"))) {\n var match = matching[ch];\n if (match && (match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }", "function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = bracketRegex(config);\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined ||\n (cm.getTokenTypeAt(Pos(lineNo, pos + 1)) || \"\") == (style || \"\"))) {\n var match = matching[ch];\n if (match && (match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }", "function test(bracket, ph) {\n\t\t\t\t\tif (typeof bracket == 'string') {\n\t\t\t\t\t\tif (bracket.includes(ph)) placeholder.roll();\n\t\t\t\t\t} else if (bracket.test(ph)) {\n\t\t\t\t\t\tplaceholder.roll();\n\t\t\t\t\t}\n\t\t\t\t}", "matchBrackets() {\n const inputLength = this.inputExpression.length;\n for (let i = 0; i < inputLength; i++) {\n const char = this.inputExpression.charAt(i);\n switch (char) {\n case \"(\":\n case \"[\":\n case \"{\":\n this.stack.push(char);\n break;\n case \"]\":\n case \")\":\n case \"}\":\n if (!this.stack.isEmpty()) {\n const tmpChar = this.stack.pop();\n if (\n (tmpChar !== \"{\" && char == \"}\") ||\n (tmpChar !== \"[\" && char == \"]\") ||\n (tmpChar !== \"(\" && char == \")\")\n ) {\n this.isExpressionValid = false;\n this.errorCode = ErrorConstant.NO_MATCHING_OPENING_BRACKETS(\n char,\n this.inputExpression\n );\n }\n } else {\n this.isExpressionValid = false;\n this.errorCode = ErrorConstant.EXTRA_CLOSING_BRACKETS(\n char,\n this.inputExpression\n );\n }\n break;\n }\n // break the loop on the first mistake.\n if (!this.isExpressionValid) {\n break;\n }\n }\n if (this.isExpressionValid) {\n // There is still possibility that extra brackets being present here.\n if (!this.stack.isEmpty()) {\n this.isExpressionValid = false;\n this.errorCode = ErrorConstant.EXTRA_OPENING_BRACKETS(\n this.inputExpression\n );\n }\n }\n }", "function BracketMatch() {\n\n this.findMatchingBracket = function(position) {\n if (position.column == 0) return null;\n\n var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);\n if (charBeforeCursor == \"\") return null;\n\n var match = charBeforeCursor.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n if (!match) {\n return null;\n }\n\n if (match[1]) {\n return this.$findClosingBracket(match[1], position);\n } else {\n return this.$findOpeningBracket(match[2], position);\n }\n };\n\n this.$brackets = {\n \")\": \"(\",\n \"(\": \")\",\n \"]\": \"[\",\n \"[\": \"]\",\n \"{\": \"}\",\n \"}\": \"{\"\n };\n\n this.$findOpeningBracket = function(bracket, position) {\n var openBracket = this.$brackets[bracket];\n var depth = 1;\n\n var iterator = new TokenIterator(this, position.row, position.column);\n var token = iterator.getCurrentToken();\n if (!token) return null;\n \n // token.type contains a period-delimited list of token identifiers\n // (e.g.: \"constant.numeric\" or \"paren.lparen\"). Create a pattern that\n // matches any token containing the same identifiers or a subset. In\n // addition, if token.type includes \"rparen\", then also match \"lparen\".\n // So if type.token is \"paren.rparen\", then typeRe will match \"lparen.paren\".\n var typeRe = new RegExp(\"(\\\\.?\" +\n token.type.replace(\".\", \"|\").replace(\"rparen\", \"lparen|rparen\") + \")+\");\n \n // Start searching in token, just before the character at position.column\n var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;\n var value = token.value;\n \n while (true) {\n \n while (valueIndex >= 0) {\n var chr = value.charAt(valueIndex);\n if (chr == openBracket) {\n depth -= 1;\n if (depth == 0) {\n return {row: iterator.getCurrentTokenRow(),\n column: valueIndex + iterator.getCurrentTokenColumn()};\n }\n }\n else if (chr == bracket) {\n depth += 1;\n }\n valueIndex -= 1;\n }\n\n // Scan backward through the document, looking for the next token\n // whose type matches typeRe\n do {\n token = iterator.stepBackward();\n } while (token && !typeRe.test(token.type));\n\n if (token == null)\n break;\n \n value = token.value;\n valueIndex = value.length - 1;\n }\n \n return null;\n };\n\n this.$findClosingBracket = function(bracket, position) {\n var closingBracket = this.$brackets[bracket];\n var depth = 1;\n\n var iterator = new TokenIterator(this, position.row, position.column);\n var token = iterator.getCurrentToken();\n if (!token) return null;\n\n // token.type contains a period-delimited list of token identifiers\n // (e.g.: \"constant.numeric\" or \"paren.lparen\"). Create a pattern that\n // matches any token containing the same identifiers or a subset. In\n // addition, if token.type includes \"lparen\", then also match \"rparen\".\n // So if type.token is \"lparen.paren\", then typeRe will match \"paren.rparen\".\n var typeRe = new RegExp(\"(\\\\.?\" +\n token.type.replace(\".\", \"|\").replace(\"lparen\", \"lparen|rparen\") + \")+\");\n\n // Start searching in token, after the character at position.column\n var valueIndex = position.column - iterator.getCurrentTokenColumn();\n\n while (true) {\n\n var value = token.value;\n var valueLength = value.length;\n while (valueIndex < valueLength) {\n var chr = value.charAt(valueIndex);\n if (chr == closingBracket) {\n depth -= 1;\n if (depth == 0) {\n return {row: iterator.getCurrentTokenRow(),\n column: valueIndex + iterator.getCurrentTokenColumn()};\n }\n }\n else if (chr == bracket) {\n depth += 1;\n }\n valueIndex += 1;\n }\n\n // Scan forward through the document, looking for the next token\n // whose type matches typeRe\n do {\n token = iterator.stepForward();\n } while (token && !typeRe.test(token.type));\n\n if (token == null)\n break;\n\n valueIndex = 0;\n }\n \n return null;\n };\n}", "function input_bracket(bracket_type){\n console.log(\"Handling a bracket\");\n calculator.curr_display += bracket_type;\n calculator.curr_num = \"\";\n\n // so im not doing multiple true assertments if unneccessary\n if(calculator.bracket_used === false){\n calculator.bracket_used = true;\n }\n}", "function isBracketValid(Look) {\n try {\n var Bracket = new Array();\n for (var i = 0; i < Look.length; i++) {\n if (Look[i] == \"(\" || Look[i] == \")\") {\n Bracket.push(Look[i]);\n }\n }\n if (Bracket.length % 2 != 0) throw \"odd Brackets\";\n var count1 = 0, count2 = 0;\n for (i = 0; i < Bracket.length; i++) {\n if (Bracket[i] != \"(\") {\n ++count1;\n }\n if (Bracket[i] != \")\") {\n ++count2;\n }\n }\n if (count2 != count1) throw \"Brackets dispair\";\n return true;\n }\n catch(Error) {\n alert(Error);\n ClearAll();\n }\n}", "function jumpToOpeningBracket() {\n\t\t\t\n\t\t\tvar depth = 1;\n\t\t\tvar closingBracketPosition = pointerAddress;\n\t\t\tpointerAddress -= 1;\n\t\t\twhile(pointerAddress >= 0) {\t\t\t\t\t\n\t\t\t\tswitch(instructions[pointerAddress]) {\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tdepth += 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"[\":\n\t\t\t\t\t\tdepth -= 1;\n\t\t\t\t\t\tif(depth == 0) {\n\t\t\t\t\t\t\tpointerAddress += 1;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tpointerAddress -= 1;\n\t\t\t}\t\t\t\t\n\t\t\tdie(\n\t\t\t\t'Fatal error: unmatched bracket at instruction ' + \n\t\t\t\tclosingBracketPosition\n\t\t\t);\n\t\t}", "function jumpToClosingBracket() {\t\t\t\n\t\t\tvar depth = 1;\n\t\t\tvar openingBracketPosition = pointerAddress;\n\t\t\tpointerAddress += 1;\n\t\t\twhile(pointerAddress < instructions.length) {\t\t\t\t\t\n\t\t\t\tswitch(instructions[pointerAddress]) {\n\t\t\t\t\tcase \"[\":\n\t\t\t\t\t\tdepth += 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"]\":\n\t\t\t\t\t\tdepth -= 1;\n\t\t\t\t\t\tif(depth == 0) {\n\t\t\t\t\t\t\tpointerAddress += 1;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\t\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tpointerAddress += 1;\n\t\t\t}\t\t\t\t\n\t\t\tdie(\n\t\t\t\t'Fatal error: unmatched bracket at instruction ' + \n\t\t\t\topeningBracketPosition\n\t\t\t);\n\t\t}", "static validateBrackets (stringDefinition = ''){\n let leftBraceCount = (stringDefinition.match ('{') || []).length;\n let rightBraceCount = (stringDefinition.match ('}') || []).length;\n let leftParenCount = (stringDefinition.match ('(') || []).length;\n let rightParenCount = (stringDefinition.match (')') || []).length;\n let leftBoxBracketCount = (stringDefinition.match ('[') || []).length;\n let rightBoxBracketCount = (stringDefinition.match (']') || []).length;\n\n // If there are any braces, parentheses, or box brackets without pair, throw an error\n if (leftBraceCount != rightBraceCount ||\n leftParenCount != rightParenCount ||\n leftBoxBracketCount != rightBoxBracketCount) {\n\n let errorMessage = 'Not all brackets are closed';\n if (leftBraceCount != rightBraceCount) {\n errorMessage += `\\n\\tThere are ${leftBraceCount} '{' and ${rightBraceCount} '}'`;\n }\n if (leftParenCount != rightParenCount) {\n errorMessage += `\\n\\tThere are ${leftParenCount} '(' and ${rightParenCount} ')'`;\n }\n if (leftBoxBracketCount != rightBoxBracketCount) {\n errorMessage += `\\n\\tThere are ${leftBoxBracketCount} '[' and ${leftBoxBracketCount} ']'`;\n }\n throw new Error (errorMessage);\n }\n\n }", "function bracketsAllowed(str) {\n let open_bracket_idx = str.search(\"\\\\(\");\n let closed_bracket_idx = str.search(\"\\\\)\");\n if (open_bracket_idx == -1 || closed_bracket_idx == -1) {\n return true;\n }\n if (closed_bracket_idx - open_bracket_idx == 4) {\n return true;\n }\n return false;\n}", "static demo() {\n let bracketMatch = new BracketMatch(`{a+(c+d)-b}`);\n bracketMatch.matchBrackets();\n bracketMatch.displayResult();\n\n bracketMatch.setExpression(`{a+9-(c+d-e+[a+b)}`); //un-even closing\n bracketMatch.matchBrackets();\n bracketMatch.displayResult();\n\n bracketMatch.setExpression(`{a+9-(c+d-e+[a+b])}}`); //extra closing\n bracketMatch.matchBrackets();\n bracketMatch.displayResult();\n\n bracketMatch.setExpression(`{{a+9-(c+d-e+[a+b])}`); //extra opening\n bracketMatch.matchBrackets();\n bracketMatch.displayResult();\n }", "function validBraces (str){\n\tconsole.log(str);\n\tvar open = [];\n\t\n\tfor(var i = 0; i < str.length; i++){\t\n\t\tif(/[\\(\\{\\[]/g.test(str[i])){\n\t\t\topen.push(str[i]);\n\t\t}\t\n\t\t\n\t\tif(str[i] === ')'){ \n\t\t\t (open[open.length - 1] === '(' && open.length > 0) ? \n\t\t\t\t open.pop() : return false;\n\t\t}\n\t\n\t\tif(str[i] === ']'){ \n\t\t\t (open[open.length - 1] === '[' && open.length > 0) ? \n\t\t\t\t open.pop() : return false;\n\t\t}\n\t\n\t\tif(str[i] === '}'){ \n\t\t\t (open[open.length - 1] === '{' && open.length > 0) ? \n\t\t\t\t open.pop() : return false;\n\t\t}\t\n\t\t\n\t\tconsole.log(open, 'open after if tests')\n\n\t\t\n\t}\n\n\tif(open.length === 0){\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}", "function areBracketsOk(arr){\r\n let nOpen=0;\r\n let nClose=0;\r\n\r\n for (var i=0;i<arr.length;i++){\r\n if (arr[i]=='(') nOpen+=1;\r\n\r\n if (arr[i]==')') nClose+=1;\r\n\r\n if (nClose>nOpen){\r\n console.log('Opening bracket is missing');\r\n return 0;\r\n }\r\n if(i>0 && arr[i-1]=='(' && arr[i]==')'){\r\n console.log('Empty brackets detected');\r\n return 0;\r\n }\r\n\r\n if(i>0 &&(arr[i-1])==')' && (numbers.indexOf(arr[i]))!=-1){\r\n console.log('impossible to have a number after a closing bracket');\r\n return 0;\r\n }\r\n\r\n if(i>0 &&(arr[i])=='(' && (numbers.indexOf(arr[i-1]))!=-1){\r\n console.log('impossible to have a number before an opening bracket');\r\n return 0;\r\n }\r\n }\r\n return (nOpen==nClose)?1:0;\r\n}", "function isValidBrackets(expression) {\n var leftBracket = 0,\n index;\n\n for (index in expression) {\n if (expression[index] === '(') {\n leftBracket += 1;\n } else if (expression[index] === ')') {\n if (leftBracket === 0) {\n return 'incorrect';\n } else {\n leftBracket -= 1;\n }\n }\n }\n\n if (leftBracket === 0) {\n return 'correct';\n } else {\n return 'incorrect';\n }\n}", "function skipBracket() {\n\t\twhile (thisToken && thisToken != ')') {\n\t\t\tif (getRangOperation(thisToken) == 0)\n\t\t\t\tgetToken();\n\t\t\tif (!thisToken)\n\t\t\t\treturn;\n\t\t\texecut();\n\t\t}\n\t\tremoveNewLine();\n\n\t}", "function checkBraces(string) {\n\tconst stack = new Stack();\n\n\t/* if (string.length % 2 !== 0) {\n\t return false;\n\t} */\n\tfor (const brace of string) {\n\t\tif (brace === \"(\") {\n\t\t\tstack.push(brace);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (brace === \")\") {\n\t\t\tif (stack.isEmpty) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tstack.pop();\n\t\t}\n\t}\n\treturn stack.isEmpty;\n}", "function hasBalancedBrackets(s) {\n var openingBrackets = []; \n var chr;\n var closingBracket = /[\\)\\]\\}]/;\n var pairs = {\n '(': ')'\n , '{': '}'\n , '[': ']'\n };\n\n for (var i = 0; i < s.length; i++) {\n chr = s[i];\n if (pairs[chr]) {\n openingBrackets.push(chr); \n }\n if (chr.match(closingBracket)) { \n if (pairs[openingBrackets.pop()] !== chr) {\n return false;\n }\n }\n }\n\n return openingBrackets.length ? false : true;\n}", "function validBraces(braces) {\n\tvar matches = { '(': ')', '{': '}', '[': ']' };\n\tvar stack = [];\n\tvar currentChar;\n\n\tfor (var i = 0; i < braces.length; i++) {\n\t\tcurrentChar = braces[i];\n\n\t\tif (matches[currentChar]) {\n\t\t\t// opening braces\n\t\t\tstack.push(currentChar);\n\t\t} else {\n\t\t\t// closing braces\n\t\t\tif (currentChar !== matches[stack.pop()]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn stack.length === 0; // any unclosed braces left?\n}", "function bracket()\r\n{\r\nvar p=\"\";\r\nfor(var c=0;c<form.display.value.length;c++)\r\n{\r\n if(form.display.value[c]==\"(\" || form.display.value[c]==\")\")\r\n {\r\n p=p+form.display.value[c];\r\n }\r\n}\r\nvar z=isMatchingBrackets(p);\r\nreturn z;\r\n}", "function validBraces(braces){\n var matches = { '(':')', '{':'}', '[':']' };\n var stack = [];\n var currentChar;\n\n for (var i=0; i<braces.length; i++) {\n currentChar = braces[i];\n\n if (matches[currentChar]) { // opening braces\n stack.push(currentChar);\n } else { // closing braces\n if (currentChar !== matches[stack.pop()]) {\n return false;\n }\n }\n }\n\n return stack.length === 0; // any unclosed braces left?\n}", "function containsBrackets(str) {\n return !!~str.search(/\\(|\\)/);\n}", "function match(regex, expr) {\n // This is the finished implementation\n // return (new RegExp(`^${regex}$`)).test(expr)\n if (!isValidRegex(regex)) {\n throw new Error(\"hey, bad regex yo\");\n }\n if (regex.length === 0) {\n return expr === \"\";\n }\n if (regex.length === 1) {\n return expr.length === 1;\n }\n var hasWildcards = false;\n var minLength = 0;\n var segments = [];\n var phrase = \"\";\n for (var i = 0; i < regex.length; i++) {\n if (regex.charAt(i) === \"*\") {\n if (phrase.length >= 2) {\n minLength += phrase.length - 1;\n segments.push({ s: phrase.substring(0, phrase.length - 1) });\n }\n segments.push({ s: phrase.charAt(phrase.length - 1), isRepeated: true });\n hasWildcards = true;\n phrase = \"\";\n }\n else {\n phrase += regex.charAt(i);\n }\n }\n if (phrase.length > 0) {\n segments.push({ s: phrase });\n minLength += phrase.length;\n }\n // TODO: This can probably be more integrated into matchSegements, \n // since the check is only done once. It would probably be useful\n // near the tail end of segment matching. Might have to be very \n // integrated into the data structure we pass into matchSegments\n // though. \n if (expr.length < minLength) {\n return false;\n }\n // console.log(`test: ${matchSegments([{s: \"a\", isRepeated: true}], 'a')}`)\n return matchSegments(segments, expr);\n}", "function validBraces(braces) {\n\tvar close = { ')': '(', '}': '{', ']': '[' };\n\tvar operands = [];\n\tfor (let s of braces.split('')) {\n\t\tif (!close[s]) operands.push(s);\n\t\telse if (operands.pop() !== close[s]) return false;\n\t}\n\treturn operands.length === 0;\n}", "function validBraces(braces) {\n\tvar parts = { '{': '}', '[': ']', '(': ')' };\n\n\tvar stack = [];\n\n\tfor (var i = 0; i < braces.length; i++) {\n\t\tvar brace = braces[i];\n\n\t\tif (brace in parts) {\n\t\t\tstack.push(brace);\n\t\t} else {\n\t\t\tif (!stack || parts[stack.pop()] != brace) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn !stack.length;\n}", "function matchingP(math) {\n let stack = new Stack;\n\n let map = {\n '(' : ')'\n };\n\n for (let i = 0; i < math.length; i++) {\n // If character is an opening brace add it to a stack\n if(math[i] === '('){\n stack.push(math[i]);\n } \n // If that character is a closing brace, pop from the stack, which will also reduce the length of the stack each time a closing bracket is encountered.\n else {\n let last = stack.pop();\n //If the popped element from the stack, which is the last opening brace doesn’t match the corresponding closing brace in the map, then return false\n if (math[i] !== map[last]) {\n return false\n };\n }\n };\n // By the completion of the for loop after checking all the brackets of the str, at the end, if the stack is not empty then fail\n if (stack.length !== 0) {return false};\n\n return true;\n}", "function place_decoy_in_bracket(bracket, decoy){\n if (bracket.is_decoy){\n return match_c(bracket, decoy);\n }else{\n return place_in_lighter_branch(bracket, decoy); \n }\n }", "regexToken() {\r\n\t\t\t\tvar body, closed, comment, commentIndex, commentOpts, commentTokens, comments, delimiter, end, flags, fullMatch, index, leadingWhitespace, match, matchedComment, origin, prev, ref, ref1, regex, tokens;\r\n\t\t\t\tswitch (false) {\r\n\t\t\t\t\tcase !(match = REGEX_ILLEGAL.exec(this.chunk)):\r\n\t\t\t\t\t\tthis.error(`regular expressions cannot begin with ${match[2]}`, {\r\n\t\t\t\t\t\t\toffset: match.index + match[1].length\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase !(match = this.matchWithInterpolations(HEREGEX, '///')):\r\n\t\t\t\t\t\t({tokens, index} = match);\r\n\t\t\t\t\t\tcomments = [];\r\n\t\t\t\t\t\twhile (matchedComment = HEREGEX_COMMENT.exec(this.chunk.slice(0, index))) {\r\n\t\t\t\t\t\t\t({\r\n\t\t\t\t\t\t\t\tindex: commentIndex\r\n\t\t\t\t\t\t\t} = matchedComment);\r\n\t\t\t\t\t\t\t[fullMatch, leadingWhitespace, comment] = matchedComment;\r\n\t\t\t\t\t\t\tcomments.push({\r\n\t\t\t\t\t\t\t\tcomment,\r\n\t\t\t\t\t\t\t\toffsetInChunk: commentIndex + leadingWhitespace.length\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcommentTokens = flatten((function() {\r\n\t\t\t\t\t\t\tvar j, len, results;\r\n\t\t\t\t\t\t\tresults = [];\r\n\t\t\t\t\t\t\tfor (j = 0, len = comments.length; j < len; j++) {\r\n\t\t\t\t\t\t\t\tcommentOpts = comments[j];\r\n\t\t\t\t\t\t\t\tresults.push(this.commentToken(commentOpts.comment, Object.assign(commentOpts, {\r\n\t\t\t\t\t\t\t\t\theregex: true,\r\n\t\t\t\t\t\t\t\t\treturnCommentTokens: true\r\n\t\t\t\t\t\t\t\t})));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn results;\r\n\t\t\t\t\t\t}).call(this));\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase !(match = REGEX.exec(this.chunk)):\r\n\t\t\t\t\t\t[regex, body, closed] = match;\r\n\t\t\t\t\t\tthis.validateEscapes(body, {\r\n\t\t\t\t\t\t\tisRegex: true,\r\n\t\t\t\t\t\t\toffsetInChunk: 1\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tindex = regex.length;\r\n\t\t\t\t\t\tprev = this.prev();\r\n\t\t\t\t\t\tif (prev) {\r\n\t\t\t\t\t\t\tif (prev.spaced && (ref = prev[0], indexOf.call(CALLABLE, ref) >= 0)) {\r\n\t\t\t\t\t\t\t\tif (!closed || POSSIBLY_DIVISION.test(regex)) {\r\n\t\t\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else if (ref1 = prev[0], indexOf.call(NOT_REGEX, ref1) >= 0) {\r\n\t\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!closed) {\r\n\t\t\t\t\t\t\tthis.error('missing / (unclosed regex)');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\t[flags] = REGEX_FLAGS.exec(this.chunk.slice(index));\r\n\t\t\t\tend = index + flags.length;\r\n\t\t\t\torigin = this.makeToken('REGEX', null, {\r\n\t\t\t\t\tlength: end\r\n\t\t\t\t});\r\n\t\t\t\tswitch (false) {\r\n\t\t\t\t\tcase !!VALID_FLAGS.test(flags):\r\n\t\t\t\t\t\tthis.error(`invalid regular expression flags ${flags}`, {\r\n\t\t\t\t\t\t\toffset: index,\r\n\t\t\t\t\t\t\tlength: flags.length\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase !(regex || tokens.length === 1):\r\n\t\t\t\t\t\tdelimiter = body ? '/' : '///';\r\n\t\t\t\t\t\tif (body == null) {\r\n\t\t\t\t\t\t\tbody = tokens[0][1];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.validateUnicodeCodePointEscapes(body, {delimiter});\r\n\t\t\t\t\t\tthis.token('REGEX', `/${body}/${flags}`, {\r\n\t\t\t\t\t\t\tlength: end,\r\n\t\t\t\t\t\t\torigin,\r\n\t\t\t\t\t\t\tdata: {delimiter}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tthis.token('REGEX_START', '(', {\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\torigin,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.token('IDENTIFIER', 'RegExp', {\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.token('CALL_START', '(', {\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.mergeInterpolationTokens(tokens, {\r\n\t\t\t\t\t\t\tdouble: true,\r\n\t\t\t\t\t\t\theregex: {flags},\r\n\t\t\t\t\t\t\tendOffset: end - flags.length,\r\n\t\t\t\t\t\t\tquote: '///'\r\n\t\t\t\t\t\t}, (str) => {\r\n\t\t\t\t\t\t\treturn this.validateUnicodeCodePointEscapes(str, {delimiter});\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tif (flags) {\r\n\t\t\t\t\t\t\tthis.token(',', ',', {\r\n\t\t\t\t\t\t\t\toffset: index - 1,\r\n\t\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tthis.token('STRING', '\"' + flags + '\"', {\r\n\t\t\t\t\t\t\t\toffset: index,\r\n\t\t\t\t\t\t\t\tlength: flags.length\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.token(')', ')', {\r\n\t\t\t\t\t\t\toffset: end,\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.token('REGEX_END', ')', {\r\n\t\t\t\t\t\t\toffset: end,\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\t// Explicitly attach any heregex comments to the REGEX/REGEX_END token.\r\n\t\t\t\tif (commentTokens != null ? commentTokens.length : void 0) {\r\n\t\t\t\t\taddTokenData(this.tokens[this.tokens.length - 1], {\r\n\t\t\t\t\t\theregexCommentTokens: commentTokens\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn end;\r\n\t\t\t}", "function validBraces (str){\n\tvar open = [];\n var unbalanced = false;\n\t\n\tfor(var i = 0; i < str.length; i++){\t\n\t\tif(/[\\(\\{\\[]/g.test(str[i])){\n\t\t\topen.push(str[i]);\n\t\t}\t\n\t\t\n\t\tif(str[i] === ')'){ \n\t\t\t (open[open.length - 1] === '(' && open.length > 0) ? \n\t\t\t\t open.pop() : unbalanced = true;\n\t\t}\n\t\n\t\tif(str[i] === ']'){ \n\t\t\t (open[open.length - 1] === '[' && open.length > 0) ? \n\t\t\t\t open.pop() : unbalanced = true;\n\t\t}\n\t\n\t\tif(str[i] === '}'){ \n\t\t\t (open[open.length - 1] === '{' && open.length > 0) ? \n\t\t\t\t open.pop() : unbalanced = true;\n\t\t}\t\n\t\t\n\t}\n\n\tif(open.length === 0 && !unbalanced){\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}", "function isInBrackets (text) {\n return text.charAt(0) === '[' && text.charAt(text.length - 1) === ']'\n}", "function validBraces(braces) {\n\tlet re = /\\(\\)|\\{\\}|\\[\\]/;\n\treturn re.test(braces) ? validBraces(braces.replace(re, '')) : '' === braces;\n}", "function checkBrackets(value){\n var isCorrect = true;\n var leftBrackets = 0;\n var rightBrackets = 0;\n var brackets = value.split(/[^()]/).filter(Boolean);\n for (var i = 0; i < brackets.length; i++) {\n var bracket = brackets[i];\n if (bracket == '(') {\n leftBrackets++;\n } else {\n rightBrackets++;\n }\n }\n if (brackets[0] == \")\") {\n isCorrect = false;\n }\n if (leftBrackets != rightBrackets) {\n isCorrect = false;\n }\n if (isCorrect) {\n return \"correct\";\n } else {\n return \"incorrect\";\n }\n}", "function searchBackwards() {\n if (tokenizeInput[caretToToken] === \")\" || tokenizeInput[caretToToken] === \"]\") {\n var bracketIndex =0;\n var diff = 0;\n for (var i=caretToToken-1; i>=0; --i) {\n if (tokenizeInput[i] === \")\" || tokenizeInput[i] === \"]\")\n diff++;\n else if (tokenizeInput[i] === \"(\" || tokenizeInput[i] === \"[\")\n diff--;\n if (diff<0) {\n bracketIndex=i;\n i=-1; //exit loop\n }\n }\n return bracketIndex;\n } else {\n return caretToToken;\n }\n }", "function indexInRegEx(idx, regExData) {\n // regExData - the output provided by parseRegEx;\n let mid, low = 0, high = regExData.length - 1;\n while (low <= high) {\n mid = Math.round((low + high) / 2);\n const a = regExData[mid];\n if (idx >= a.start) {\n if (idx <= a.end) {\n return true;\n }\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n return false;\n}", "function bracketMatching(config = {}) {\n return [bracketMatchingConfig.of(config), bracketMatchingUnique];\n}", "function isRBrac(currToken){\n \tif(currToken.search(T_RBrac) != -1){\n \t\tvar tokenid = new newToken(currToken, \"Right Bracket\", currLineNum);\n \t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n \t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\tamIToken = true;\n\t\ttokenHole = [];\n\t}\n\t\telse{\n\n\t\t}\n}//ends function", "function balancedBrackets(string) {\n // string of all of opening brackets, check if char is opening bracket\n const openingBrackets = '([{'\n // string of all closing brackets \n const closingBrackets = ')]}'\n // hash table that maps all closing brackets to all opening brackets \n const matchingBrackets = {')': '(', ']': '[', '}': '{'}\n // stack is empty array \n const stack = []\n for (const char of string) {\n if (openingBrackets.includes(char)) {\n stack.push(char)\n } else if (closingBrackets.includes(char)) {\n if (stack.length == 0) {\n // no possible opening brackets to match \n return false\n }\n // if last value of stack is matching then we pop it\n if (stack[stack.length - 1] === matchingBrackets[char]) {\n stack.pop()\n } else {\n // otherwis it's not a matching bracket and we return false \n return false\n }\n }\n }\n // if the stack is empty we are good, if not the string is unbalanced \n return stack.length === 0 \n}", "function validBraces(braces) {\n\twhile (/\\(\\)|\\{\\}|\\[\\]/.test(braces)) {\n\t\tbraces = braces.replace(/\\(\\)|\\{\\}|\\[\\]/, '');\n\t}\n\treturn braces.length > 0 ? false : true;\n}", "function balancedBrackets(string) {\n const openingBrackets = '([{';\n const closingBrackets = ')]}';\n const matchingBrackets = {')': '(', ']': '[', '}': '{'};\n const stack = [];\n for (const char of string) {\n if (openingBrackets.includes(char)) {\n stack.push(char);\n } else if (closingBrackets.includes(char)) {\n if (stack.length == 0) {\n return false;\n }\n if (stack[stack.length - 1] === matchingBrackets[char]) {\n stack.pop();\n } else {\n return false;\n }\n }\n }\n return stack.length === 0;\n}", "function findEndpoint(tex, currentIndex) {\n var bracketDepth = 0;\n\n for (var i = currentIndex, len = tex.length; i < len; i++) {\n var c = tex[i];\n\n if (c === \"{\") {\n bracketDepth++;\n } else if (c === \"}\") {\n bracketDepth--;\n }\n\n if (bracketDepth < 0) {\n return i;\n }\n } // If we never see unbalanced curly brackets, default to the\n // entire string\n\n\n return tex.length;\n}", "checkOpenBrace (attempt = false) {\n const token = this.getToken();\n if(this.lexerClass.OPEN_BRACE !== token.type){\n if (!attempt) {\n throw SyntaxErrorFactory.token_missing_one('[', token);\n } else {\n return false;\n }\n }\n return true;\n }", "IsInComment (ss, nn)\r\n { let ii=-1, bb=0;\r\n do { ii=ss.indexOf(\"{\",ii+1); bb++; }\r\n while ((ii>=0)&&(ii<nn));\r\n ii=-1;\r\n do { ii=ss.indexOf(\"}\",ii+1); bb--; }\r\n while ((ii>=0)&&(ii<nn));\r\n return(bb);\r\n }", "function matchCond() {\n\t\tvar pattern = /^(while|if)/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null){\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function balancedParens(input) {\n var parentheses = \"[]{}()\",\n array = [];\n var character; \n var bracePosition;\n\n for(var i = 0; character = input[i]; i++) {\n bracePosition = parentheses.indexOf(character);\n\n if(bracePosition === -1) {\n continue;\n }\n\n if(bracePosition % 2 === 0) {\n array.push(bracePosition + 1); \n } else {\n if(array.length === 0 || array.pop() !== bracePosition) {\n return false;\n }\n }\n }\n\n return array.length === 0;\n}", "function matchSymbol() {\n\t\tvar pattern = /^[{}\\(\\)]/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null) {\n\t\t\treturn true;\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "function validBraces(braces) {\n\tlet pattern = /\\[\\]|\\(\\)|\\{\\}/;\n\twhile (pattern.test(braces)) {\n\t\tbraces = braces.replace(pattern, '');\n\t}\n\tif (braces === '') {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function testIfElseIndentationNoBraces(v)\n{\n /**\n * comment\n */\n if (v.isNull() == true) return fun(v);\n\n if (v.isNull() == true)\n return false;\n\n if (v.isNull() == true)\n return false;\n else\n {\n if (v.endsWith(\"(\"))\n return false;\n else if (v.endsWith(\")\"))\n return true;\n else if (v.endsWith(\"\\\"\"))\n return true;\n else if (v.endsWith(\"\\\\\"))\n return true;\n else if (v.endsWith('('))\n return false;\n else if (v.endsWith(')'))\n return true;\n else if (v.endsWith('\\''))\n return true;\n else if (v.endsWith('\\\\'))\n return true;\n else\n return false;\n\n if (v.endsWith(\"baz\"))\n return false;\n return true;\n }\n}", "function peek(tok) {\n if (typeof(tok) === 'string') {\n return input.charAt(i) === tok;\n } else {\n return !!tok.test(chunks[j]);\n }\n }", "function checkForEnd(element){ \n\tif((element.match(/\\{/) === null) && (element.match(/[(]/) === null)){\n\t\treturn true;\n\t}\n}", "function getBounds(substr,flag){\n if(flag == undefined)flag = 0;\n console.log(\"getBounds\");\n if(substr.charAt(i) != \"^\" && substr.charAt(i) != \"_\"){\n //this means there are no bounds to detect. return blank stuff\n //just here to allow for speed improvements\n console.log(\" no bounds detected\");\n return([\"\",\"\",0]); \n }\n\n //i can remove one of these once i decide on a convention instituted by mathwquill\n //i should probably keep both around because some books or external clients might have different conventions\n\n var upper = \"\";\n var lower = \"\";\n var i = 0;\n\n //get the upper bound if it leads\n if(substr.charAt(i) == \"^\"){\n console.log(\" starting with upper\");\n i++;\n if(substr.charAt(i) == \"{\"){\n inner = matchParen(substr.substring(i),\"{\",flag);\n console.log(\" upper bound inner latex: \"+inner[0]);\n upper = inner[0];\n i+= inner[1];\n }\n else{\n upper = substr.charAt(i);\n i++;\n }\n //the lower bound is assumed to follow\n console.log(\" looking for lower bound in substr: \"+substr.substring(i));\n if(substr.charAt(i) == \"_\"){\n console.log(\" found lower bound\");\n i++;\n if(substr.charAt(i) == \"{\"){\n inner = matchParen(substr.substring(i),\"{\",flag);\n console.log(\" lower bound inner latex: \"+inner[0]);\n lower = inner[0];\n i+= inner[1];\n }\n else{\n console.log(\" lower bound inner latex: \"+substr.charAt(i));\n lower = substr.charAt(i);\n i++;\n }\n }\n\n }\n //get the lower bound if it leads\n else if(substr.charAt(i) == \"_\"){\n console.log(\" starting with lower\");\n i++;\n if(substr.charAt(i) == \"{\"){\n inner = matchParen(substr.substring(i),\"{\",flag);\n console.log(\" lower bound inner latex: \"+inner[0]);\n lower = inner[0];\n i+= inner[1];\n }\n else{\n console.log(\" lower bound inner latex: \"+substr.charAt(i));\n lower = substr.charAt(i);\n i++;\n }\n //then get the upper bound is assumed to follow\n console.log(\" looking for upper bound\");\n if(substr.charAt(i) == \"^\"){\n console.log(\" upper bound found\");\n i++;\n if(substr.charAt(i) == \"{\"){\n inner = matchParen(substr.substring(i),\"{\",flag);\n console.log(\" upper bound inner latex: \"+inner[0]);\n upper = inner[0];\n i+= inner[1];\n }\n else{\n console.log(\"upper bound inner latex: \"+substr.charAt(i));\n upper = substr.charAt(i);\n i++;\n }\n }\n }\n return([upper,lower,i]);\n}", "function validParen(string) {\n\n let openCount = 0;\n let closeCount = 0;\n\n if (string.length === 0) return true;\n\n for (let idx = 0; idx < string.length; idx++) {\n \n if (closeCount > openCount) return false\n\n if (string[idx] === \"(\") {\n openCount++\n }\n else if (string[idx] === \")\") {\n rightCount++\n }\n }\n \n if (closeCount === openCount) return true\n\n}", "function regex (temp) {\n try {\n temp = RegExp.apply(null, entt(temp, true).match(rREGEX).slice(1));\n return (rBLANK !== temp.toString() ? temp : false);\n } catch (err) {\n return false;\n }\n }", "function getLengthBtwnBrackets(startIndex, openB, closeB) {\n var endIndex = indexOf2nd(startIndex, openB, closeB);\n if (endIndex === -1) synthaxError = true;\n return endIndex - startIndex;\n }", "function bracketLevel(bia, bracketPoss){\n // bia[3] = the opening brackets position in the text\n // bia[4] = the closing brackets position in the text\n // bia[5] = the opening/closing brackets position in the bracketPoss array\n // for each entry to the left of this that has an ending bracket which ends to the right of bia[5],\n // add 1 to the bracket level.\n bLevel = 0;\n\n for(var i = bia[5]; i >= 0; i--){\n if(bracketPoss[i][0] <= bia[3] && bracketPoss[i][1] >= bia[4]){\n bLevel++;\n }\n }\n\n return bLevel;\n}", "jumpToMatching(select, expand) {\n var cursor = this.getCursorPosition();\n var iterator = new TokenIterator(this.session, cursor.row, cursor.column);\n var prevToken = iterator.getCurrentToken();\n var tokenCount = 0;\n if (prevToken && prevToken.type.indexOf('tag-name') !== -1) {\n prevToken = iterator.stepBackward();\n }\n var token = prevToken || iterator.stepForward();\n\n if (!token) return;\n\n //get next closing tag or bracket\n var matchType;\n var found = false;\n var depth = {};\n var i = cursor.column - token.start;\n var bracketType;\n var brackets = {\n \")\": \"(\",\n \"(\": \"(\",\n \"]\": \"[\",\n \"[\": \"[\",\n \"{\": \"{\",\n \"}\": \"{\"\n };\n\n do {\n if (token.value.match(/[{}()\\[\\]]/g)) {\n for (; i < token.value.length && !found; i++) {\n if (!brackets[token.value[i]]) {\n continue;\n }\n\n bracketType = brackets[token.value[i]] + '.' + token.type.replace(\"rparen\", \"lparen\");\n\n if (isNaN(depth[bracketType])) {\n depth[bracketType] = 0;\n }\n\n switch (token.value[i]) {\n case '(':\n case '[':\n case '{':\n depth[bracketType]++;\n break;\n case ')':\n case ']':\n case '}':\n depth[bracketType]--;\n\n if (depth[bracketType] === -1) {\n matchType = 'bracket';\n found = true;\n }\n break;\n }\n }\n }\n else if (token.type.indexOf('tag-name') !== -1) {\n if (isNaN(depth[token.value])) {\n depth[token.value] = 0;\n }\n\n if (prevToken.value === '<' && tokenCount > 1) {\n depth[token.value]++;\n }\n else if (prevToken.value === '</') {\n depth[token.value]--;\n }\n\n if (depth[token.value] === -1) {\n matchType = 'tag';\n found = true;\n }\n }\n\n if (!found) {\n prevToken = token;\n tokenCount++;\n token = iterator.stepForward();\n i = 0;\n }\n } while (token && !found);\n\n //no match found\n if (!matchType) return;\n\n var range, pos;\n if (matchType === 'bracket') {\n range = this.session.getBracketRange(cursor);\n if (!range) {\n range = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + i - 1,\n iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + i - 1\n );\n pos = range.start;\n if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column)\n < 2) range = this.session.getBracketRange(pos);\n }\n }\n else if (matchType === 'tag') {\n if (!token || token.type.indexOf('tag-name') === -1) return;\n range = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() - 2,\n iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() - 2\n );\n\n //find matching tag\n if (range.compare(cursor.row, cursor.column) === 0) {\n var tagsRanges = this.session.getMatchingTags(cursor);\n if (tagsRanges) {\n if (tagsRanges.openTag.contains(cursor.row, cursor.column)) {\n range = tagsRanges.closeTag;\n pos = range.start;\n }\n else {\n range = tagsRanges.openTag;\n if (tagsRanges.closeTag.start.row === cursor.row && tagsRanges.closeTag.start.column\n === cursor.column) pos = range.end; else pos = range.start;\n }\n }\n }\n\n //we found it\n pos = pos || range.start;\n }\n\n pos = range && range.cursor || pos;\n if (pos) {\n if (select) {\n if (range && expand) {\n this.selection.setRange(range);\n }\n else if (range && range.isEqual(this.getSelectionRange())) {\n this.clearSelection();\n }\n else {\n this.selection.selectTo(pos.row, pos.column);\n }\n }\n else {\n this.selection.moveTo(pos.row, pos.column);\n }\n }\n }", "function readRegexp() {\n var content = \"\", escaped, inClass, start = tokPos;\n for (; ;) {\n if (tokPos >= inputLen) raise(start, \"Unterminated regular expression\");\n var ch = input.charAt(tokPos);\n if (newline.test(ch)) raise(start, \"Unterminated regular expression\");\n if (!escaped) {\n if (ch === \"[\") inClass = true;\n else if (ch === \"]\" && inClass) inClass = false;\n else if (ch === \"/\" && !inClass) break;\n escaped = ch === \"\\\\\";\n } else escaped = false;\n ++tokPos;\n }\n var content = input.slice(start, tokPos);\n ++tokPos;\n // Need to use `readWord1` because '\\uXXXX' sequences are allowed\n // here (don't ask).\n var mods = readWord1();\n if (mods && !/^[gmsiy]*$/.test(mods)) raise(start, \"Invalid regexp flag\");\n return finishToken(_regexp, new RegExp(content, mods));\n }", "isTag(tag, lineMatchIndex, line) {\n let prevChar = line.charAt(lineMatchIndex - 1)\n let nextChar = line.charAt(lineMatchIndex + tag.length)\n\n if ((nextChar == ':' || nextChar == ']' || (this._config._whitespaceTagging && (nextChar == ' ' || nextChar == \"\\t\"))) && (prevChar !== '_')) {\n return true\n } else {\n return false\n }\n }", "function isOperatorValid(Look) {\n try {\n if (isBasicOperator(Look[0]) || isBasicOperator(Look[Look.length-2])) throw \"Operator can not be at the beginning or at the last\";\n var OperatorSub = new Array();\n for (var i = 0; i < Look.length; i++) {\n if (isBasicOperator(Look[i])) {\n OperatorSub.push(i);\n }\n }\n for (var j = 0; j < OperatorSub.length; j++) {\n if (j > 0) {\n if (OperatorSub[j] - OperatorSub[j-1] == 1) throw \"Operator can not be close to each other\";\n }\n }\n for (i = 0; i < Look.length; i++) {\n if ((Look[i] == \"(\" && isBasicOperator(Look[i+1]))) {\n throw \"Operator are wrong with Bracket\";\n }\n if (i > 0) {\n if ((Look[i] == \")\" && isBasicOperator(Look[i-1]))||(Look[i] == \")\" &&Look[i+1] == \".\")) {\n throw \"Operator are wrong with Bracket\";\n }\n if (Look[i] == \"(\" && Look[i-1] == \".\") {\n throw \"Operator error with dot\";\n }\n }\n }\n return true;\n }\n catch(Error) {\n alert(Error);\n ClearAll();\n }\n}", "function matchBrackets(state, pos, dir, config = {}) {\n let maxScanDistance = config.maxScanDistance || DefaultScanDist, brackets = config.brackets || DefaultBrackets;\n let tree = syntaxTree(state), node = tree.resolveInner(pos, dir);\n for (let cur = node; cur; cur = cur.parent) {\n let matches = matchingNodes(cur.type, dir, brackets);\n if (matches && cur.from < cur.to) {\n let handle = findHandle(cur);\n if (handle && (dir > 0 ? pos >= handle.from && pos < handle.to : pos > handle.from && pos <= handle.to))\n return matchMarkedBrackets(state, pos, dir, cur, handle, matches, brackets);\n }\n }\n return matchPlainBrackets(state, pos, dir, tree, node.type, maxScanDistance, brackets);\n}", "looksObjectish(j) {\r\n\t\t\t\t\tvar end, index;\r\n\t\t\t\t\tif (this.indexOfTag(j, '@', null, ':') !== -1 || this.indexOfTag(j, null, ':') !== -1) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tindex = this.indexOfTag(j, EXPRESSION_START);\r\n\t\t\t\t\tif (index !== -1) {\r\n\t\t\t\t\t\tend = null;\r\n\t\t\t\t\t\tthis.detectEnd(index + 1, (function(token) {\r\n\t\t\t\t\t\t\tvar ref;\r\n\t\t\t\t\t\t\treturn ref = token[0], indexOf.call(EXPRESSION_END, ref) >= 0;\r\n\t\t\t\t\t\t}), (function(token, i) {\r\n\t\t\t\t\t\t\treturn end = i;\r\n\t\t\t\t\t\t}));\r\n\t\t\t\t\t\tif (this.tag(end + 1) === ':') {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}", "function validBraces(braces) {\n\twhile (/\\(\\)|\\[\\]|\\{\\}/g.test(braces)) {\n\t\tbraces = braces.replace(/\\(\\)|\\[\\]|\\{\\}/g, '');\n\t}\n\treturn !braces.length;\n}", "function main() {\n var t = parseInt(readLine());\n for(var a0 = 0; a0 < t; a0++){\n var expression = readLine();\n var ex = expression.split('');\n var memo = [];\n var len = ex.length;\n for(var i = 0; i < len; i++) {\n var found = false;\n if(ex[i] === '(' || ex[i] === '{' || ex[i] === '[') {\n memo.push(ex[i]);\n } else {\n var last = memo.pop();\n if((ex[i] === ')' && last !== '(') \n || (ex[i] === '}' && last !== '{') \n || (ex[i] === ']' && last !== '[')) {\n found = true;\n break;\n }\n }\n }\n if(!found && memo.length === 0) {\n console.log('YES');\n } else {\n console.log('NO');\n }\n }\n\n}", "function pushQBlock(_pos, _lastIndex, slash) { //eslint-disable-line\n if (slash) {\n _lastIndex = skipRegex(str, _pos)\n }\n // do not save empty strings or non-regex slashes\n if (tmpl && _lastIndex > _pos + 2) {\n mark = '\\u2057' + qblocks.length + '~'\n qblocks.push(str.slice(_pos, _lastIndex))\n prevStr += str.slice(start, _pos) + mark\n start = _lastIndex\n }\n return _lastIndex\n }", "static match_here(regexp, text) {\n var cur, next;\n [cur, next] = [regexp[0], regexp[1]];\n if (regexp.length === 0) {\n return true;\n }\n if (next === '*') {\n return Util.match_star(cur, regexp.slice(2), text);\n }\n if (cur === '$' && !next) {\n return text.length === 0;\n }\n if (text && (cur === '.' || cur === text[0])) {\n return Util.match_here(regexp.slice(1), text.slice(1));\n }\n return false;\n }", "function bracketedAligned(context) {\n let tree = context.node;\n let openToken = tree.childAfter(tree.from), last = tree.lastChild;\n if (!openToken)\n return null;\n let sim = context.options.simulateBreak;\n let openLine = context.state.doc.lineAt(openToken.from);\n let lineEnd = sim == null || sim <= openLine.from ? openLine.to : Math.min(openLine.to, sim);\n for (let pos = openToken.to;;) {\n let next = tree.childAfter(pos);\n if (!next || next == last)\n return null;\n if (!next.type.isSkipped)\n return next.from < lineEnd ? openToken : null;\n pos = next.to;\n }\n}", "function isAbbreviationValid(syntax, abbreviation) {\n if (!abbreviation) {\n return false;\n }\n if (isStyleSheet(syntax)) {\n // Fix for https://github.com/Microsoft/vscode/issues/1623 in new emmet\n if (abbreviation.endsWith(':')) {\n return false;\n }\n return cssAbbreviationRegex.test(abbreviation);\n }\n if (abbreviation.startsWith('!')) {\n return !/[^!]/.test(abbreviation);\n }\n // Its common for users to type (sometextinsidebrackets), this should not be treated as an abbreviation\n if (/^[a-z,A-Z,\\d,-,:,\\(,\\),\\.,\\$]*$/.test(abbreviation) && /\\(/.test(abbreviation) && /\\)/.test(abbreviation)) {\n return false;\n }\n return (htmlAbbreviationStartRegex.test(abbreviation) && htmlAbbreviationRegex.test(abbreviation));\n}", "function parensValid(input){\n let closing = 0;\n let opening = 0;\n\n for (let i = 0; i < input.length; i++) {\n const ele = input[i];\n if (closing > opening) {\n return false\n }\n if (ele === '(') {\n opening++\n }\n else if (ele === ')') {\n closing++\n }\n }\n\n return closing === opening\n}", "static match_here(regexp, text) {\n var cur, next;\n cur = \"\";\n next = \"\";\n [cur, next] = [regexp[0], regexp[1]];\n if (regexp.length === 0) {\n return true;\n }\n if (next === '*') {\n return Util.match_star(cur, regexp.slice(2), text);\n }\n if (cur === '$' && !next) {\n return text.length === 0;\n }\n if (text && (cur === '.' || cur === text[0])) {\n return Util.match_here(regexp.slice(1), text.slice(1));\n }\n return false;\n }", "function checkString(str){\n let bracketStack = [];\n let bracketDict = {\n '{':'}',\n '[':']',\n '(':')',\n }\n \n function closesLastBracket(current){\n if(bracketStack.length === 0) return false;\n\n let expectedLast = bracketDict[bracketStack[bracketStack.length - 1]];\n return expectedLast === current;\n }\n \n let valid = true;\n for(let i = 0; i < str.length; i++){\n switch(str[i]){\n case '{':\n case '[':\n case '(':\n bracketStack.push(str[i]);\n break;\n case '}':\n case ']':\n case ')':\n if(!closesLastBracket(str[i]))\n valid = false;\n else\n bracketStack.pop();\n break;\n }\n }\n \n if(bracketStack.length > 0) valid = false;\n\n return valid;\n}", "function findEndIf(txt) {\r\n let re = /{{IF ([\\s\\S]*?)}}|{{ENDIF}}|{{ELSE}}/;\r\n let depth = 0, loc = 0, cap = null, ifCondition = null;\r\n let ifBlock = [], elseBlock = [];\r\n if (debug) console.log(`findEndIf(${txt})`);\r\n\r\n while(loc < txt.length) {\r\n cap = re.exec(txt.slice(loc));\r\n\r\n if (cap) {\r\n loc += cap.index + cap[0].length;\r\n if (debug) console.log(`Captured text: \"${cap[0]}\"; Location to ${loc}.`);\r\n } else {\r\n if (debug) console.log('Nothing captured...');\r\n }\r\n \r\n if (cap && cap[0].startsWith('{{IF')) {\r\n depth += 1;\r\n if (depth == 1) {\r\n ifBlock.push(loc);\r\n ifCondition = cap[1];\r\n }\r\n\r\n } else if (cap && cap[0] === '{{ENDIF}}') {\r\n depth -= 1;\r\n if (depth === 0) {\r\n (elseBlock.length == 0 ? ifBlock : elseBlock).push(loc - cap[0].length);\r\n return [\r\n ifCondition,\r\n txt.slice(ifBlock[0], ifBlock[1]),\r\n elseBlock.length == 0 ? '\"\"' : txt.slice(elseBlock[0],elseBlock[1]),\r\n loc\r\n ]\r\n }\r\n\r\n } else if (cap && cap[0] === '{{ELSE}}' && depth === 1) {\r\n ifBlock.push(loc - cap[0].length);\r\n elseBlock.push(loc);\r\n\r\n } else {\r\n throw new Error('Failed to find matching {{ENDIF}}')\r\n }\r\n\r\n if (debug) console.log(`Depth = ${depth}`);\r\n\r\n }\r\n throw new Error('Failed to find matching {{ENDIF}}')\r\n }", "_stateCdataSectionBracket(cp) {\n if (cp === CODE_POINTS.RIGHT_SQUARE_BRACKET) {\n this.state = State.CDATA_SECTION_END;\n }\n else {\n this._emitChars(']');\n this.state = State.CDATA_SECTION;\n this._stateCdataSection(cp);\n }\n }", "function validParentheses(parens) {\n\n let length = parens.length;\n let position = 0;\n\n //grab the first and last element of the string \n //if they are a pair \"()\" or \")(\", then get the next elements from the beginning and end by incrementing the position counter\n while (parens[position] + parens[length - 1 - position] === '()' || parens[position] + parens[length - 1 - position] === ')(') {\n position++;\n }\n\n //if we checked all positions then we always found pairs\n if (position === length) {\n return true;\n } else {\n return false;\n }\n}", "[CDATA_SECTION_BRACKET_STATE](cp) {\n if (cp === $.RIGHT_SQUARE_BRACKET) {\n this.state = CDATA_SECTION_END_STATE;\n } else {\n this._emitChars(']');\n this._reconsumeInState(CDATA_SECTION_STATE);\n }\n }", "[CDATA_SECTION_BRACKET_STATE](cp) {\n if (cp === $.RIGHT_SQUARE_BRACKET) {\n this.state = CDATA_SECTION_END_STATE;\n } else {\n this._emitChars(']');\n this._reconsumeInState(CDATA_SECTION_STATE);\n }\n }", "[CDATA_SECTION_BRACKET_STATE](cp) {\n if (cp === $.RIGHT_SQUARE_BRACKET) {\n this.state = CDATA_SECTION_END_STATE;\n } else {\n this._emitChars(']');\n this._reconsumeInState(CDATA_SECTION_STATE);\n }\n }", "[CDATA_SECTION_BRACKET_STATE](cp) {\n if (cp === $$5.RIGHT_SQUARE_BRACKET) {\n this.state = CDATA_SECTION_END_STATE;\n } else {\n this._emitChars(']');\n this._reconsumeInState(CDATA_SECTION_STATE);\n }\n }", "function checkBasicInput(objectBracketString, inputValue) {\n\n const inputObj = regrexObj[objectBracketString];\n\n if(regrexObj.emptyString.test(inputValue)) {\n\n $(inputObj.selector).text(inputObj.emptyStringText);\n\n } else if(!inputObj.regrex.test(inputValue)) {\n\n $(inputObj.selector).text(inputObj.invalidRegrex);\n\n } else {\n\n $(inputObj.selector).empty();\n\n return true;\n }\n return false;\n}", "function validParentheses(parens){\n let stack = 0;\n for (let char of parens.split(\"\")) {\n if (char === \")\" && stack === 0) {return false;}\n else if (char === \")\") {stack--;}\n else {stack++;}\n }\n return stack === 0;\n}", "function balancedBrackets(str) {\n let stack = [];\n for (let char of str) {\n if (char == \"(\") {\n stack.push(char);\n } else if (char == \")\") {\n if (stack.length == 0) {\n return false;\n }\n stack.pop();\n }\n }\n return stack.length == 0;\n}", "function isMatch(splitQuery, grammar_entry) {\n if (splitQuery.length == 0) {\n return true;\n }\n else {\n let firstEl = splitQuery[0];\n let rest = splitQuery.slice(1);\n\n let grammar_point = grammar_entry.grammar_point;\n let grammar_alt_def = grammar_entry.alt_def;\n let grammar_meaning = grammar_entry.meaning;\n\n if (polyIncluded(firstEl, grammar_point, grammar_alt_def, grammar_meaning)) {\n return true && isMatch(rest, grammar_entry)\n }\n else {\n return false && isMatch(rest, grammar_entry)\n }\n }\n}", "consumeComment(token) {\n const comment = token.data[0];\n for (const conditional of parseConditionalComment(comment, token.location)) {\n this.trigger(\"conditional\", {\n condition: conditional.expression,\n location: conditional.location,\n });\n }\n }", "function tokenizeOpenedParenthesis(state) {\n var nextSymbolCode = state.css.charCodeAt(state.pos + 1);\n var tokensCount = state.tokens.length;\n var prevTokenCssPart = tokensCount ? state.tokens[tokensCount - 1][1] : '';\n\n if (prevTokenCssPart === 'url' && nextSymbolCode !== _globals.singleQuote && nextSymbolCode !== _globals.doubleQuote && nextSymbolCode !== _globals.space && nextSymbolCode !== _globals.newline && nextSymbolCode !== _globals.tab && nextSymbolCode !== _globals.feed && nextSymbolCode !== _globals.carriageReturn) {\n state.nextPos = state.pos;\n\n do {\n state.escaped = false;\n state.nextPos = state.css.indexOf(')', state.nextPos + 1);\n\n if (state.nextPos === -1) {\n (0, _unclosed2.default)(state, 'bracket');\n }\n\n state.escapePos = state.nextPos;\n\n while (state.css.charCodeAt(state.escapePos - 1) === _globals.backslash) {\n state.escapePos -= 1;\n state.escaped = !state.escaped;\n }\n } while (state.escaped);\n\n state.tokens.push(['brackets', state.css.slice(state.pos, state.nextPos + 1), state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);\n state.pos = state.nextPos;\n } else {\n state.nextPos = findClosedParenthesisPosition(state.css, state.length, state.pos);\n state.cssPart = state.css.slice(state.pos, state.nextPos + 1);\n\n var foundParam = state.cssPart.indexOf('@') >= 0;\n var foundString = /['\"]/.test(state.cssPart);\n\n if (state.cssPart.length === 0 || state.cssPart === '...' || foundParam && !foundString) {\n // we're dealing with a mixin param block\n if (state.nextPos === -1) {\n (0, _unclosed2.default)(state, 'bracket');\n }\n\n state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);\n } else {\n var badBracket = _globals.badBracketPattern.test(state.cssPart);\n\n if (state.nextPos === -1 || badBracket) {\n state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);\n } else {\n state.tokens.push(['brackets', state.cssPart, state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);\n state.pos = state.nextPos;\n }\n }\n }\n}", "function foundNestedPseudoClass() {\n var openParen = 0;\n for (var i = pos + 1; i < source_text.length; i++) {\n var ch = source_text.charAt(i);\n if (ch === \"{\") {\n return true;\n } else if (ch === '(') {\n // pseudoclasses can contain ()\n openParen += 1;\n } else if (ch === ')') {\n if (openParen === 0) {\n return false;\n }\n openParen -= 1;\n } else if (ch === \";\" || ch === \"}\") {\n return false;\n }\n }\n return false;\n }", "function matchPara(expression){\n const stack = new Stack;\n for (let i=0;i<expression.length;i++){\n if (expression[i] === '(' || expression[i] === '[' || expression[i] === '{'){\n stack.push(\n {\n data: expression[i],\n index: i\n }\n );\n }\n if (expression[i] === ')' || expression[i] === ']' || expression[i] === '}'){\n if (isEmpty(stack)){\n let character = '';\n if (expression[i] === ')'){\n character = '(';\n }else if (expression[i] === '}'){\n character = '{';\n }else if (expression[i] === ']'){\n character = '[';\n }\n return `missing a ${character} at ${i}`;\n }\n else{\n stack.pop();\n }\n }\n }\n if (!isEmpty(stack)){\n \n const node = stack.pop();\n let character = '';\n if (node.data === '('){\n character = ')';\n }else if (node.data === '{'){\n character = '}';\n }else if (node.data === '['){\n character = ']';\n }\n return `missing a ${character} at ${node.index}`;\n }\n return 'valid paraentheses';\n}", "function isInsideComment(sourceFile, token, position) {\n // The position has to be: 1. in the leading trivia (before token.getStart()), and 2. within a comment\n return position <= token.getStart(sourceFile) &&\n (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) ||\n isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart())));\n function isInsideCommentRange(comments) {\n return ts.forEach(comments, function (comment) {\n // either we are 1. completely inside the comment, or 2. at the end of the comment\n if (comment.pos < position && position < comment.end) {\n return true;\n }\n else if (position === comment.end) {\n var text = sourceFile.text;\n var width = comment.end - comment.pos;\n // is single line comment or just /*\n if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47 /* slash */) {\n return true;\n }\n else {\n // is unterminated multi-line comment\n return !(text.charCodeAt(comment.end - 1) === 47 /* slash */ &&\n text.charCodeAt(comment.end - 2) === 42 /* asterisk */);\n }\n }\n return false;\n });\n }\n }", "function matchParens(str, openParenIndex) {\n var stack = [];\n var esc = false;\n for (var i = openParenIndex || 0; i < str.length; i++) {\n var c = str[i];\n\n if (c === '\\\\') {\n if (!esc)\n esc = true;\n continue;\n } else if (c === '(' && !esc) {\n stack.push(1);\n } else if (c === ')' && !esc) {\n stack.pop();\n if (stack.length === 0)\n return i;\n }\n\n esc = false;\n }\n\n var ndx = str.length - 1;\n if (str.charAt(ndx) !== ')')\n throw new Error(str + ' has unbalanced parentheses');\n\n return ndx;\n}", "_grammarRegex() {\n if (this._peekTerm()) {\n let term = this._grammarTerm();\n if (this._acceptInput('|')) {\n if (this._peekRegex()) {\n return Nfa.buildUnion(term, this._grammarRegex());\n }\n } else {\n return term;\n }\n }\n\n throw new 'Exception placeholder';\n }", "function validBraces(str) {\n\tvar prev = '';\n\twhile (str.length != prev.length) {\n\t\tprev = str;\n\t\tstr = str.replace('()', '').replace('[]', '').replace('{}', '');\n\t}\n\treturn str.length === 0;\n}", "function valid_paranthesis(str) {\n\tconst stack = [];\n\tconst valid = {\n\t\t')': '(',\n\t\t']': '[',\n\t\t'}': '{',\n\t};\n\tfor (let i = 1; i < str.length; i++) {\n\t\tif ('({['.includes(str[i])) {\n\t\t\tstack.push(str[i]);\n\t\t} else if (valid[str[i]] == stack[stack.length - 1]) {\n\t\t\tstack.pop();\n\t\t}\n\t}\n\treturn stack.length == 0 ? true : false;\n}", "static balancedParenthesis(string) {\n const openParenthesesStack = new Stack();\n for (let letter of string) {\n if (letter === '(') {\n openParenthesesStack.push(letter);\n } else if (letter === ')') {\n // if there is a closing parantheses for no previous opening one return false\n if (openParenthesesStack.isEmpty()) return false;\n // if the stack isn't empty pop one of the opening parantheeses\n openParenthesesStack.pop();\n }\n }\n return openParenthesesStack.isEmpty();\n }", "function advanceSlash() {\n var regex, previous, check;\n\n function testKeyword(value) {\n return value && (value.length > 1) && (value[0] >= 'a') && (value[0] <= 'z');\n }\n\n previous = extra.tokenValues[extra.tokens.length - 1];\n regex = (previous !== null);\n\n switch (previous) {\n case 'this':\n case ']':\n regex = false;\n break;\n\n case ')':\n check = extra.tokenValues[extra.openParenToken - 1];\n regex = (check === 'if' || check === 'while' || check === 'for' || check === 'with');\n break;\n\n case '}':\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n regex = false;\n if (testKeyword(extra.tokenValues[extra.openCurlyToken - 3])) {\n // Anonymous function, e.g. function(){} /42\n check = extra.tokenValues[extra.openCurlyToken - 4];\n regex = check ? (FnExprTokens.indexOf(check) < 0) : false;\n } else if (testKeyword(extra.tokenValues[extra.openCurlyToken - 4])) {\n // Named function, e.g. function f(){} /42/\n check = extra.tokenValues[extra.openCurlyToken - 5];\n regex = check ? (FnExprTokens.indexOf(check) < 0) : true;\n }\n }\n\n return regex ? collectRegex() : scanPunctuator();\n }", "function parensValid(input) {\n var openParen = 0\n var closedParen = 0\n for (var i = 0; i < input.length; i++) {\n if (input[i] == ')' && openParen == 0) {\n return false;\n }\n else if (input[i] == '(') {\n openParen++\n }\n else if (input[i] == ')' && openParen > closedParen) {\n closedParen++\n }\n }\n if (openParen == closedParen) {\n return true;\n }\n return false;\n}", "function parensValid(string){\n // For this algorithm, we're going to use an array to keep track of our opening parentheses\n let check = [];\n\n // Now let's loop through the string we were given\n for(let i = 0; i < string.length; i++) {\n\n // We'll check if each character is an opening parentheses\n if(string[i] == \"(\") {\n // if it is, let's push it into our check array\n check.push(string[i]);\n }\n // Otherwise, let's check 2 things. 1) if the character is a closing parentheses and\n // 2) if the check array has any previously found open parentheses\n\n // If we have not found any open parentheses before, then a closing parentheses means \n // we have an invalid parentheses configuration\n else if (string[i] == \")\" && check.length == 0) {\n // And so, we exit out of everything and call it a day.\n return false;\n }\n // If we HAVE found an open parentheses before, than we have a valid open and close pair,\n // so we can remove the previous open parentheses from our check array.\n else if (string[i] == \")\" && check.length > 0 ) {\n check.pop();\n }\n }\n\n // If, after iterating through the entire string, we STILL have something in our check array, that means\n // we have open parentheses that were never closed!\n if(check.length > 0) {\n // So we say no!\n return false;\n }\n // If that check array is, in fact, empty, then we have a valid parentheses configuration\n else {\n // Hurray!\n return true;\n }\n}", "function IsRegexMatched(thisObj, sPattern, sErrorMsg, bDisplayAsterisk, iTabID) {\n\n var c = (thisObj instanceof jQuery) ? thisObj : $('#' + thisObj);\n if (c.length == 0) return true;\n\n ResetError(c);\n\n var re = new RegExp(sPattern);\n if (!c.val().match(re)) {\n AddMsgInQueue(c, sErrorMsg, bDisplayAsterisk, iTabID);\n return false;\n }\n else {\n return true;\n }\n}" ]
[ "0.6587802", "0.6267505", "0.6267505", "0.6131918", "0.6109955", "0.6094728", "0.60717857", "0.6065751", "0.59929025", "0.5840662", "0.58073765", "0.56219184", "0.54613787", "0.54366475", "0.5270894", "0.5224024", "0.5059215", "0.4968047", "0.49521586", "0.48946953", "0.48444194", "0.48407942", "0.48080805", "0.4789466", "0.47686857", "0.4739913", "0.47379008", "0.47192067", "0.46933553", "0.46742925", "0.46742332", "0.46523818", "0.4635733", "0.46344298", "0.46319816", "0.46112368", "0.4603093", "0.4601028", "0.4594289", "0.4593967", "0.45874003", "0.4541232", "0.454099", "0.45125762", "0.4511179", "0.45087296", "0.44848204", "0.44605723", "0.44543612", "0.44454536", "0.4444575", "0.4386906", "0.43811727", "0.4379755", "0.43796283", "0.43762356", "0.43626982", "0.4359943", "0.4327122", "0.43258443", "0.43255314", "0.43066442", "0.43040434", "0.42857975", "0.42732486", "0.4267598", "0.42615294", "0.4256101", "0.42424458", "0.42349485", "0.4231547", "0.42307943", "0.4230418", "0.421698", "0.4182229", "0.41660064", "0.41607383", "0.4158097", "0.41573143", "0.41573143", "0.41573143", "0.41510522", "0.41455904", "0.4145049", "0.41432542", "0.41413388", "0.41293225", "0.41287172", "0.40989533", "0.40935412", "0.40793994", "0.40668166", "0.40618885", "0.4050032", "0.40474686", "0.40469316", "0.40456665", "0.4036971", "0.40342772", "0.40341097" ]
0.6207647
3
function that adjusts the data
function combineDataFromMultipleDataSources(aSources) { return aSources[0].concat(aSources[1]).concat(aSources[2]).concat(aSources[3]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateData() {\n\t\txyData = pruneData(xyData);\n\t\tllmseFit = xyHelper.llmse(xyData, xPowers);\n\t\tupdate();\n\t}", "function updateData(data) {\n\t\t\t\t\t\t\tvar updatedData = angular.copy(data);\n\t\t\t\t\t\t\tangular\n\t\t\t\t\t\t\t\t\t.forEach(\n\t\t\t\t\t\t\t\t\t\t\tupdatedData,\n\t\t\t\t\t\t\t\t\t\t\tfunction(d) {\n\t\t\t\t\t\t\t\t\t\t\t\td.R_CONTENT_READ = ((d.R_CONTENT_READ * 100) >= 200) ? 200\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: (d.R_CONTENT_READ * 100);\n\t\t\t\t\t\t\t\t\t\t\t\td.R_FORUM_POST = ((d.R_FORUM_POST * 100) >= 200) ? 200\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: (d.R_FORUM_POST * 100);\n\t\t\t\t\t\t\t\t\t\t\t\td.R_ASN_SUB = ((d.R_ASN_SUB * 100) >= 200) ? 200\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: (d.R_ASN_SUB * 100);\n\t\t\t\t\t\t\t\t\t\t\t\td.R_SESSIONS = ((d.R_SESSIONS * 100) >= 200) ? 200\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: (d.R_SESSIONS * 100);\n\t\t\t\t\t\t\t\t\t\t\t\t// scale 0..5 scale to 0..200\n\t\t\t\t\t\t\t\t\t\t\t\td.GPA_CUMULATIVE *= 40;\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn updatedData;\n\t\t\t\t\t\t}", "function adjustData(baseOptions) {\r\n\t if (baseOptions.becomeSpreader >= baseOptions.daysOfSickness)\r\n\t\tbaseOptions.becomeSpreader = baseOptions.daysOfSickness - 1;\r\n\t if (baseOptions.symptomsAppear >= baseOptions.daysOfSickness)\r\n\t\tbaseOptions.symptomsAppear = baseOptions.daysOfSickness - 1;\r\n\t if (baseOptions.becomeSpreader + baseOptions.daysAsSpreader >= baseOptions.daysOfSickness)\r\n\t\tbaseOptions.daysAsSpreader = baseOptions.daysOfSickness - 1 - baseOptions.becomeSpreader;\r\n\t if (baseOptions.symptomsAppear + baseOptions.administrativeDelay >= baseOptions.daysOfSickness)\r\n\t\tbaseOptions.administrativeDelay = baseOptions.daysOfSickness - 1 - baseOptions.symptomsAppear;\r\n\t return baseOptions;\r\n}", "function changeNumeric(data) {\n\n data.forEach(function (row) {\n row.RECENCY = +row.RECENCY;\n row.FREQUENCY = +row.FREQUENCY;\n row.MONETARY = +row.MONETARY;\n row.id = +row.ID;\n });\n}", "update(data) {\n for (let i = 0; i < this.Offsets.length; i += 2) {\n this.Offsets[i] = data[i];\n this.Offsets[i + 1] = data[i + 1];\n }\n }", "update(startingData) {}", "function enhanceData(data) {\n\tvar initialPrice = data[0].close;\n\tvar updatedData = data.map(function(data) {\n\t\treturn {\n\t\t\tdate: data.date,\n\t\t\tclose: data.close,\n\t\t\tpctClose: (data.close - initialPrice) / initialPrice * 100,\n \tsold: 0,\n \tbought: 0\n \t};\n\t});\n\treturn updatedData;\n}", "updateAdjustment(state, data) {\n if ('adjustment' in data) {\n data = data.adjustment\n\n const ind = findIndex(state.adjustments, (r) => {\n return r.id === data.id\n })\n\n const adjustment = state.adjustments[ind]\n\n for (const prop in data) {\n adjustment[prop] = data[prop]\n }\n }\n }", "adjust() {\n adjustEntity(this);\n }", "function updata() {\n\t\t\tlastData.update(point);\n\t\t}", "function adjustDataSet() {\n\tfunction underClosePoint(element) {\n\t\treturn element < findClosePoint();\n\t}\n\tlet cut = data.set.findIndex(underClosePoint);\n\n\tdata.set.splice(0, cut);\n}", "function change (data) {\n now = Date.now();\n range = [new Date(now - step - offset), new Date(now - offset)];\n\n d3.select(that).select(\".value\")\n .text(function(){ \n var value = +data.pop().value;\n return (d.format || format)(value);\n });\n /*d3.select(that).select(\".timestamp\")\n .text(function(){ return \", \" + timestampFormat(new Date()); });*/\n\n timer && clearTimeout(timer);\n timer = setTimeout(function() {\n metric_(range[0], range[1], step, change);\n }, update(d));\n }", "update(rawData) {\n var axisPrefix = rawData[0].toLowerCase();\n var rawReading = rawData.substr(1, rawData.length - 2);\n //console.log('TabbyDRO::update ' + rawData + \" => \" + rawReading);\n if (!Number.isNaN(Number.parseFloat(rawReading))) {\n if (axisPrefix in app.axes) {\n var axis = app.axes[axisPrefix];\n axis.setRawValue(Number.parseFloat(rawReading));\n }\n }\n }", "function changeDataValues(data){\n\n\tvar topics = [\"causesofdeath\", \"education\", \"socialsecurity\"];\n\n\tfor (var i = 0; i < data.length; i++){\n\n\t\t// Get population count per province\n\t\tpopulation = data[i].population.total;\n\n\t\tfor (var j = 0; j < topics.length; j++){\n\n\t\t\t// Get subtopic\n\t\t\tvar subtopics = data[i][topics[j]];\n\n\t\t\tfor (var key in subtopics){\n\n\t\t\t\t// Calculate ratio per 1000 people for each subtopic\n\t\t\t\tsubtopics[key] = parseFloat(subtopics[key]/population*1000).toFixed(2);\n\t\t\t}\n\t\t}\n\t}\n}", "function setOrigWidth()\n{\n\tfor(var i=0; i < hdr.length; i++)\n\t{\n\t\thdr[i].width = hWidth[i];\n\t}\n\t\n\tfor(var i=0; i < drow1.length; i++)\n\t{\n\t\tdrow1[i].width = dWidth[i];\n\t}\n\t\n}", "function updateValuesToGrid(grid) {\n var data = grid.pqGrid(\"option\", \"dataModel.data\"); // this is array\n for (var i = 0; i < data.length; i++) {\n var getColModel = grid.pqGrid(\"getColModel\");\n for (var j = 0; j < getColModel.length; j++) {\n //console.log(typeof getColModel[j].numberFormat);\n if (typeof getColModel[j].numberFormat != 'undefined') {\n data[i][getColModel[j]['dataIndx']] = format2(data[i][getColModel[j].dataIndx], \"\", getColModel[j].numberFormat)\n }\n }\n }\n}", "function fixDataAvailabiity(kpiRecord) {\n if (kpiRecord[\"kpi\"].indexOf(\"Availability\") > -1) {\n kpiRecord[\"dailyAverage\"] = 100.0 - parseFloat(kpiRecord[\"dailyAverage\"]);\n if (kpiRecord[\"data\"]) {\n for (var i=0; i<kpiRecord[\"data\"].length; i++) {\n var trueHourlyData= 100 - kpiRecord[\"data\"][i][1]; // fix the value\n if (trueHourlyData < 0.0) {\n trueHourlyData = 0.0\n }\n kpiRecord[\"data\"][i][1] = trueHourlyData;\n }\n }\n }\n return kpiRecord;\n}", "function applyOffset(data)\n{\n var startingTimes = [];\n computeOffset(data, startingTimes);\n for (var i = 0; i < data.length/6; i++) { // timeline num\n for (var j = i*6; j < i*6+5; j++) { // each row for the corresponding timeline\n for (var k = 0; k < data[j][\"times\"].length; k++) { // each event in the row\n data[j][\"times\"][k][\"starting_time\"] -= startingTimes[i];\n data[j][\"times\"][k][\"ending_time\"] -= startingTimes[i];\n }\n }\n }\n return data;\n}", "function dataUpdate(data){\n\t\t\tif( !data) return;\n\t\t\tif( data.Rows[0].Label) updateLabel(data);\n\t\t\tif( !labels || !chart) return;\n\t\t\t\n\t\t\tvar dataprovider = convertoChart(data);\n\t\t\tchart.dataProvider = dataprovider; \n\t\t\tchart.validateData(); \n\t\t}", "adjust(aData, aManipulationObject) {\n\t\t//console.log(\"wprr/manipulation/adjustfunctions/control/loader/TriggerUrlRequest::adjust\");\n\t\t\n\t\t//MENOTE: do nothing\n\t\t\n\t\treturn aData;\n\t}", "function convertData(data) {\r\n\tdata.forEach(function(d) {\r\n\t\td[\"Date\"] = parseDate(d[\"Date\"])\r\n\t\td[\"Body weight\"] = +d[\"Body weight\"]\r\n\t\td[\"Weight\"] = +d[\"Weight\"]\r\n\t\td[\"Set 1\"] = +d[\"Set 1\"]\r\n\t\td[\"Set 2\"] = +d[\"Set 2\"]\r\n\t\td[\"Set 3\"] = +d[\"Set 3\"]\r\n\t\td[\"Total Weight\"] = +d[\"Total Weight\"]\r\n\t})\r\n}", "function updateData(){\r\n config.data.labels = [];\r\n for (const prop in LocalDatabase_analog){\r\n // No representar los segundos formato HH:MM \r\n if( !config.data.labels.find( element => element == LocalDatabase_analog[prop].timestamps.substr(11,5) )){\r\n config.data.labels.push( LocalDatabase_analog[prop].timestamps.substr(11,5) );\r\n }\r\n }\r\n\r\n let old_dataset = config.data.datasets;\r\n config.data.datasets = [];\r\n\r\n for(const dataset_name in old_dataset){\r\n old_dataset[dataset_name].func();\r\n }\r\n \r\n updateChart();\r\n \r\n console.log(\"actualizada la base de datos local\");\r\n \r\n}", "pushAdjustment(state, data) {\n let adjustment = data\n if ('adjustment' in data) {\n adjustment = data.adjustment\n }\n\n state.adjustments.unshift(adjustment)\n }", "updateChart(data) {\n let cleanData = this.processData(data);\n let step = cleanData.sumOfLastElements < 10 ? 1 : null;\n\n this.chart.config.options.scales.yAxes[0].ticks.stepSize = step;\n this.chart.data.datasets[0].data = cleanData.negativeLow;\n this.chart.data.datasets[1].data = cleanData.negativeMiddle;\n this.chart.data.datasets[2].data = cleanData.negativeHigh;\n this.chart.data.datasets[3].data = cleanData.positiveLow;\n this.chart.data.datasets[4].data = cleanData.positiveMiddle;\n this.chart.data.datasets[5].data = cleanData.positiveHigh;\n this.chart.update();\n }", "function updateData() {\n angular.forEach(elements, function (element, id){\n if($(document).find(element).length) {\n data[id] = {\n \"x\": element.offset().left - element.parents('.bpContainer').offset().left,\n \"y\": element.offset().top - element.parents('.bpContainer').offset().top\n }\n }\n else {\n delete elements[id];\n }\n });\n setCoordinates();\n }", "function changeValues(objectInfo, data) {\n\n if (utils.isEmptyVal(objectInfo.bill_amount)) {\n if (data == 'adjusted') {\n vm.showValidationForAdjusted = true;\n } else {\n // vm.showValidationForAdjusted = false; \n }\n if (data == 'adjustment') {\n vm.showValidationForAdjustment = true;\n } else {\n // vm.showValidationForAdjustment = false;\n }\n // if (data == 'adjustment' || data == 'adjusted') {\n // vm.showValidationForAdjustment = true;\n // vm.showValidationForAdjusted = true;\n\n // } else {\n // vm.showValidationForAdjustment = false;\n // vm.showValidationForAdjusted = false;\n // }\n // if (data == 'adjusted' || data == 'adjustment') {\n // vm.showValidationForAdjustment = true;\n // vm.showValidationForAdjusted = true;\n\n // } else {\n // vm.showValidationForAdjustment = false;\n // vm.showValidationForAdjusted = false;\n // }\n\n } else {\n\n vm.showValidationForAdjusted = false;\n vm.showValidationForAdjustment = false;\n }\n if (utils.isEmptyVal(objectInfo.bill_amount)) {\n objectInfo.adjustment_amount = \"\";\n objectInfo.adjusted_amount = \"\";\n }\n\n if (data == 'adjusted' && utils.isNotEmptyVal(objectInfo.bill_amount) && utils.isNotEmptyVal(objectInfo.adjusted_amount)) {\n objectInfo.adjustment_amount = null;\n objectInfo.adjustment_amount = Math.round((parseFloat(angular.copy(objectInfo.bill_amount)) - parseFloat(angular.copy(objectInfo.adjusted_amount))) * 100) / 100;// This fix works for two decimal places - If the decimal places is 3 then multiply and divide by 1000\n\n }\n\n if (data == 'adjustment' && utils.isNotEmptyVal(objectInfo.bill_amount) && utils.isNotEmptyVal(objectInfo.adjustment_amount)) {\n objectInfo.adjusted_amount = null;\n objectInfo.adjusted_amount = Math.round((parseFloat(angular.copy(objectInfo.bill_amount)) - parseFloat(angular.copy(objectInfo.adjustment_amount))) * 100) / 100;// This fix works for two decimal places - If the decimal places is 3 then multiply and divide by 1000\n\n }\n if (!data && utils.isNotEmptyVal(objectInfo.bill_amount) && utils.isNotEmptyVal(objectInfo.adjusted_amount)) {\n objectInfo.adjustment_amount = null;\n objectInfo.adjustment_amount = Math.round((parseFloat(angular.copy(objectInfo.bill_amount)) - parseFloat(angular.copy(objectInfo.adjusted_amount))) * 100) / 100;// This fix works for two decimal places - If the decimal places is 3 then multiply and divide by 1000\n\n }\n\n if (data == 'adjusted' && utils.isEmptyVal(objectInfo.adjusted_amount)) {\n objectInfo.adjustment_amount = null;\n }\n\n if (data == 'adjustment' && utils.isEmptyVal(objectInfo.adjustment_amount)) {\n objectInfo.adjusted_amount = null;\n }\n\n switch (objectInfo.payment_mode) {\n case 1: // paid\n objectInfo.paid_amount = utils.isNotEmptyVal(objectInfo.adjusted_amount) ? objectInfo.adjusted_amount : objectInfo.bill_amount;\n objectInfo.outstanding_amount = 0;\n break;\n case 2: // Unpaid\n objectInfo.outstanding_amount = utils.isNotEmptyVal(objectInfo.adjusted_amount) ? objectInfo.adjusted_amount : objectInfo.bill_amount;\n objectInfo.paid_amount = 0; // \n break;\n case 3: // Partial\n if (utils.isNotEmptyVal(objectInfo.adjusted_amount)) {\n if (utils.isNotEmptyVal(objectInfo.paid_amount) && utils.isNotEmptyVal(objectInfo.adjusted_amount)) {\n objectInfo.outstanding_amount = Math.round((parseFloat(objectInfo.adjusted_amount) - parseFloat(objectInfo.paid_amount)) * 100) / 100;// This fix works for two decimal places - If the decimal places is 3 then multiply and divide by 1000\n } else {\n if (utils.isNotEmptyVal(objectInfo.adjusted_amount)) {\n objectInfo.outstanding_amount = objectInfo.adjusted_amount;\n } else {\n objectInfo.outstanding_amount = (utils.isNotEmptyVal(objectInfo.paid_amount)) ? 0 : null;\n }\n }\n } else {\n if (utils.isNotEmptyVal(objectInfo.paid_amount) && utils.isNotEmptyVal(objectInfo.bill_amount)) {\n // objectInfo.outstandingamount = (parseFloat(objectInfo.totalamount) - parseFloat(objectInfo.paidamount)).toFixed(2);\n objectInfo.outstanding_amount = Math.round((parseFloat(objectInfo.bill_amount) - parseFloat(objectInfo.paid_amount)) * 100) / 100;// This fix works for two decimal places - If the decimal places is 3 then multiply and divide by 1000\n } else {\n if (utils.isNotEmptyVal(objectInfo.bill_amount)) {\n objectInfo.outstanding_amount = objectInfo.bill_amount;\n } else {\n objectInfo.outstanding_amount = (utils.isNotEmptyVal(objectInfo.paid_amount)) ? 0 : null;\n }\n }\n }\n break;\n }\n\n\n\n\n }", "function updateData1() {\n var newData = GenData1(N1, lastUpdateTime1);\n lastUpdateTime1 = newData[newData.length - 1].timestamp;\n\n for (var i = 0; i < newData.length; i++) {\n globalData1.push(newData[i]);\n }\n //console.log(globalOffset);\n globalOffset1 += newData.length;\n refreshData1();\n }", "function updateDataArray(input){\n\tconsole.log(`updateDataArray{}`);\n\t//Find row and col from the input data-col/row attributes\n\tvar col = parseInt(input.getAttribute('data-col'));\n\tvar row = parseInt(input.getAttribute('data-row'));\n\t\n\t//update dataArray with value and alt (formula)\n\tdataArray[col][row].value = input.value;\n\tdataArray[col][row].formula = input.alt;\n\tconsole.log(dataArray);\n\t\n}", "function process_data (datas) {\n for (var i in datas){\n if(typeof(datas[i].success_rate) !== typeof(12)){\n datas[i].success_rate = (Math.trunc(parseFloat(datas[i].success_rate)*10000))/100;\n }\n }\n return datas\n }", "dataSet() {\n this.state = { dataset: myData.dataset };\n let count = 0;\n \n this.state.dataset.forEach(function(element) {\n this.reducedDataset.year.indexOf(element.fields.year)\n if(this.reducedDataset.year.indexOf(element.fields.year) >=0){\n let pos = this.reducedDataset.year.indexOf(element.fields.year);\n this.reducedDataset.year[pos] = element.fields.year;\n this.reducedDataset.growth[pos]+= element.fields.cumulative_growth ? Math.round(Number(element.fields.cumulative_growth)): 0; \n }else{\n this.reducedDataset.year[count] = element.fields.year;\n this.reducedDataset.growth[count] = element.fields.cumulative_growth ? Math.round(Number(element.fields.cumulative_growth)): 0;\n count++;\n }\n }, this);\n console.log(this.reducedDataset.growth)\n \n }", "function adjustObsSetters() {\r\n\r\n }", "set data(newData){\n\t\tlet _self = this;\n\t\tif(!newData){\n\t\t\tconsole.log(\"set data with undefined\");\n\t\t\treturn;\n\t\t}\n\n\t\tif(this.dtInstance) {\n\t\t\t// this._data = this.prepareData(newData);\n\t\t\tthis._data = this.sortData(newData);\n\n\t\t\tthis.$timeout(function(){\n\t\t\t\t_self.updateTable();\n\t\t\t});\n\t\t} else {\n\t\t\tthis._data = newData;\n\t\t}\n\t}", "function updateAdjustedEstimate() {\n // Recalculate the estimate data\n $scope.selectedEstimate = $scope.truckCost * (1 + $scope.markupIncrements[$scope.selectedIndex]);\n }", "function update_offset() {\n\t\tlet totFilteredRecs = ndx.groupAll().value();\n\t\t// let end = ofs + pag > totFilteredRecs ? totFilteredRecs : ofs + pag;\n\t\tofs =\n\t\t\tofs >= totFilteredRecs\n\t\t\t\t? Math.floor((totFilteredRecs - 1) / pag) * pag\n\t\t\t\t: ofs;\n\t\tofs = ofs < 0 ? 0 : ofs;\n\t\tdataTable.beginSlice(ofs);\n\t\tdataTable.endSlice(ofs + pag);\n\t}", "function updateFlexi(){\n\n var flexiArr = filterFlexi();\n var creditArr = pullCompanyCredits(flexiArr);\n var tempArr = [];\n\n for(var i = 0 ; i < flexiArr.length ; i++){\n\n var int = flexiArr[i][4].replace(/[^\\d]/g, '');\n var num = parseInt(int[0]);\n var buffer = Math.ceil(num = num + (num * 0.2));\n var oppPlan = flexiArr[i][6];\n var num = oppPlan.replace(/[^\\d]/g, ''); \n var pax ;\n\n if (num != ''){\n pax = num;\n } else {\n pax = 1;\n }\n\n var quota ;\n\n if(oppPlan.includes('Ultra-lite')){\n quota = 3 * pax;\n }\n\n else if(oppPlan.includes('Low')){\n quota = 5 * pax;\n }\n\n else if(oppPlan.includes('Medium')){\n quota = 8 * pax;\n }\n\n else if(oppPlan.includes('High')){\n quota = 10 * pax;\n }\n\n tempArr[i] = [flexiArr[i][0],flexiArr[i][2],flexiArr[i][3],flexiArr[i][4],flexiArr[i][5],flexiArr[i][6],flexiArr[i][7], buffer , pax , quota];\n }\n\n for(var i = 0 ; i < creditArr.length ; i++){\n tempArr[i].push(creditArr[i][0], creditArr[i][1] ,creditArr[i][2])\n }\n\n flexiSheet.getRange('A2:M').clear();\n flexiSheet.getRange(2 , 1 , tempArr.length , tempArr[0].length).setValues(tempArr);\n}", "function update(data){\n\t\t//each time an empty array is initialsed\n\t\tvar data_set = [];\n\n\t\t//run through the data object that has been passed into the function\n\t\t//if the entry object is not empty then the data is pushed to the\n\t\t//dataset array\n\t\t//the dataset array is used in the rest of the funciton for the data\n\t \tdata.forEach(function(entry){\n\t \t\tif (jQuery.isEmptyObject( entry ) === false){\n\t \t\t\tdata_set.push(entry);\n\t \t\t}\n\t \t})\n\t\n\t\t//these variables hold the updated scales which have been\n\t\t//passed the new data_set\n\t\tvar xScale = xScales(data_set);\n\t\tvar yScale = yScales(data_set);\n\n\t\tvar chart = svg.selectAll('rect')\n\t\t\t.data(data_set);\n\n\t\tchart.enter()\n\t\t\t.append('rect')\n\t\t\t.attr(\"fill\", function(d){ return color(d.economy)})\n\t\t\t.attr('class', 'bar');\n\n\t\tchart.transition()\n\t\t\t.duration(1000)\n\t\t\t.attr({\n\t\t\tx: function(d){ return xScale(d.economy);},\n\t\t\twidth: xScale.rangeBand(),\n\t\t\ty: function(d){ return yScale(+d[this_value])},\n\t\t\theight: function(d){ return height - yScale(+d[this_value]);},\n\t\t\tfill: function(d){ return color(d.economy)}\n\t\t});\n\n\t\tchart.exit()\n\t\t.transition()\n\t\t.duration(1000)\n\t\t.attr('x', width + xScale.rangeBand())\n\t\t.remove();\n\n\t\t//updates the axis\n\t\tsvg.select(\".x.axis\")\n\t\t.call(xA(data_set))\n\t\t\t .selectAll(\".tick text\")\n \t\t.call(wrap, xScales(data_set).rangeBand()); //the wrap function is called to wrap\n \t\t\t\t\t\t\t\t\t\t\t\t\t//the tick text within the width of the bar\n\n\t\tsvg.select(\".y.axis\")\n\t\t\t.transition()\n\t\t\t.duration(1000)\n\t\t\t.call(yA(data_set));\n\t}", "dataPrepare() {\n this.data = this.data.map(d => ({\n year: +d.year,\n numFires: +d.numFires.replaceAll(\",\", \"\"),\n totalAcres: +d.totalAcres.replaceAll(\",\", \"\"),\n }));\n }", "function updateData() {\n\n // Select the section we want to apply our changes to\n var svg = d3.select(\"body\").transition();\n\n // Make the changes\n svg.select(\".line\")\n .duration(750)\n .style(\"transform\", \"scaleY(.6)\");\n svg.select(\".x.axis\") // change the x axis\n .duration(750)\n .call(xAxis);\n svg.select(\".y.axis\") // change the y axis\n .duration(750)\n .call(yAxis);\n \n var x = document.getElementById(\"added-food\");\n if (x.style.display === \"\" | x.style.display === \"none\") {\n x.style.display = \"inline-block\";\n }\n }", "function manageData(){\n width = \"50px\"\n }", "updateChart() {\n let tempData = [];\n let tempLabel = [];\n\n this.newData = [];\n\n rentalService.getMonthlyPrice(newdata => {\n this.newLabel.length = newdata.length;\n\n for (let i = 0; i < newdata.length; i++) {\n tempData.push(newdata[i].sumPrice);\n tempLabel.push(this.months[newdata[i].month - 1]);\n }\n\n this.newData = tempData;\n this.newLabel = tempLabel;\n });\n }", "updateData(data, unitType) {\n const mapped_foods = [\n \"Beef / buffalo\",\n \"Lamb / goat\",\n \"Pork\",\n \"Poultry (chicken, turkey, or any other bird meats)\", \n \"Fish (finfish)\", \n \"Crustaceans (e.g., shrimp, prawns, crabs, lobster)\", \n \"Mollusks (e.g., clams, oysters, squid, octopus)\", \n \"Butter\",\n \"Cheese\",\n \"Ice cream\", \n \"Cream\", \n \"Milk (cow's milk)\",\n \"Yogurt\", \n \"Eggs\",\n \"Potatoes\",\n \"Cassava / Other roots\", \n \"Soybean oil\", \n \"Palm oil\", \n \"Sunflower oil\",\n \"Rapeseed / canola oil\", \n \"Olive oil\", \n \"Beer\", \n \"Wine\", \n \"Coffee (Ground or whole bean)\", \n \"Sugar\" \n ];\n\n var final = [];\n // mapped_foods.forEach((food) => {\n // final.push({ food, count: 0 });\n // });\n\n // console.log(data);\n \n // console.log(foodElement);\n data.forEach((element) => {\n var elementCopy = Object.assign({}, element);\n // elementCopy = element;\n mapped_foods.forEach((foodElement) => {\n const units = element[\"What unit of weight do you prefer to answer with? This will be the unit of weight corresponding to the amount of food you purchase per week.\"];\n // console.log(element[foodElement]);\n // var convertedCount = element[foodElement[\"food\"]];\n if (units === \"Pounds (lbs)\") {\n // Units are in lbs but we want kgs\n if (unitType === \"kgs\") {\n elementCopy[foodElement] = element[foodElement] * 0.4536;\n }\n } else {\n // Units are in kgs but we want lbs\n if (unitType === \"lbs\") {\n elementCopy[foodElement] = element[foodElement] * 2.2046;\n } \n }\n });\n final.push(elementCopy);\n // element[foodElement] = element[foodElement].replace(/\\(.*\\)/, '');\n });\n \n // console.log(final[\"Pork\"]);\n return final;\n }", "function resetData() {\n\n let tabs = document.getElementsByClassName(\"tabcontent\");\n // clean all 'tabs' of class 'tabcontent' because they will be\n // overwritten, except for the one with data transformations\n // with 'id' == 'datatab'. For this one, we just\n for ( let t of tabs ) {\n if( tabs.id != 'datatab' ) tabs.innerHTML = \"\";\n }\n\n max_value = Number.MIN_SAFE_INTEGER;\n min_value = Number.MAX_SAFE_INTEGER;\n\n for( let d of data ) {\n for ( let i = 0; i < d.values.length; i++ ){\n d.values[i] = d.originals[i];\n }\n for( let v of d.values ) {\n if ( v > max_value ) max_value = v;\n if ( v < min_value ) min_value = v;\n }\n }\n }", "function updateArray()\n{\n\t$.ajax({\n\t\ttype: \"GET\",\n\t\turl: \"/stats\",\n\t\tdataType: \"text\",\n\t\tsuccess: function (data, textStatus, jqXHR) {\n\t\t\tvar tmp = JSON.parse(data);\n\t\t\tvar tmpp = {};\n\t\t\tif (vdatap.length != 0) {\n\t\t\t\tif (vdatap[0]['timestamp'] == tmp['timestamp']) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (v in tmp) {\n\t\t\t\tif (tmp[v]['value'] != undefined) {\n\t\t\t\t\ttmp[v]['value'] = parseInt(tmp[v]['value']);\n\t\t\t\t\ttmpp[v.replace(\"MAIN.\",\"\")] = parseInt(tmp[v]['value']);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvdata.unshift(tmp);\n\t\t\tvdatap.unshift(tmpp);\n\t\t\tcompressData();\n\t\t\tupdateHitrate();\n\t\t\tif (reconstructTable) {\n\t\t\t\tconstructTable();\n\t\t\t\treconstructTable = false;\n\t\t\t\tsparklineDataHistory = {};\n\t\t\t} else {\n\t\t\t\tupdateTable();\n\t\t\t}\n\t\t}\n\t})\t\n}", "scaleUpdated() {\n\t\tthis.pointCoords = this.data.map(d=>[this.xaxis.scale(d[0]), this.yscale(d[1])]);\n\t}", "function changingData() {\n if (checkVal) {\n checkVal = false\n var passVar = \"month\"\n buttonOne.text(\"Monthly Aggregate: 10-Year Treasury Constant Maturity Rate 2013-2018\")\n }\n else {\n checkVal = true\n passVar = \"date\"\n buttonOne.text(\"10-Year Treasury Constant Maturity Rate 2013-2018\")\n }\n\n\n xScale\n .domain(d3.extent(groupByYear, function(d) { return d[passVar] }))\n\n responsiveUpdatedVariables(passVar)\n\n\n d3.select(window).on(\"resize\", function(d) {\n responsiveUpdatedVariables([passVar])\n\n })\n\n }", "function updateDataSet(newData) {\n clearDataTable();\n var fieldNames = [];\n for (var i = 0; i < newData.fields.length; i++) {\n var current = newData.fields[i];\n if (current.domain) {\n //replace in all\n var currentFeature = newData.features[0].attributes;\n var codeValue = currentFeature[current.name];\n if (codeValue) {\n var toReplace = current.domain.codedValues[codeValue - 1].name;\n currentFeature[current.name] = toReplace;\n }\n \n }//domain check\n fieldNames.push(current.name); \n }\n //send to UI\n var current = newData.features[0].attributes;\n for (var namesIndex = 0; namesIndex < fieldNames.length; namesIndex++) {\n appendData( fieldNames[namesIndex], current[ fieldNames[namesIndex] ] );\n }\n \n }", "function updateDataElement(me) {\n var text = me.name + \"<br />\" + (me.amount == \"Infinity\" ? \"Inf\" : me.amount);\n me.element.innerHTML = text;\n /*if(text.length > 14) me.element.style.width = \"490px\";\n else */me.element.style.width = \"\";\n}", "function parsing(updated){\n if(updated.size.F){\n updated.size['F'] = parseInt(updated.size['F']);\n }\n else{\n if(updated.size.S){\n updated.size['S'] = parseInt(updated.size['S']);\n updated.size['M']= parseInt(updated.size['M']);\n updated.size['L']= parseInt(updated.size['L']);\n }\n if(updated.size[\"8\"]){\n updated.size[\"8\"] = parseInt(updated.size[\"8\"]);\n updated.size[\"8_5\"] = parseInt(updated.size[\"8_5\"]);\n updated.size[\"9\"] = parseInt(updated.size[\"9\"]);\n updated.size[\"9_5\"] = parseInt(updated.size[\"9_5\"]);\n updated.size[\"10\"] = parseInt(updated.size[\"10\"]);\n updated.size[\"10_5\"] = parseInt(updated.size[\"10_5\"]);\n updated.size[\"11\"] = parseInt(updated.size[\"11\"]);\n }\n }\n updated.price = parseInt(updated.price);\n return updated;\n}", "function update (arr, start, end) {\n\t\tif (typeof arr === 'number' || arr == null) {\n\t\t\tend = start;\n\t\t\tstart = arr;\n\t\t\tarr = null;\n\t\t}\n\t\t//update array, if passed one\n\t\telse {\n\t\t\tif (arr.length == null) throw Error('New data should be array[ish]')\n\n\t\t\t//reset lengths if new data is smaller\n\t\t\tif (arr.length < scales[0].length) {\n\t\t\t\tfor (let group = 2, idx = 1; group <= maxScale; group*=2, idx++) {\n\t\t\t\t\tlet len = Math.ceil(arr.length/group);\n\t\t\t\t\tscales[idx].length = len;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tscales[0] = arr;\n\t\t}\n\n\t\tif (start == null) start = 0;\n\t\tif (end == null) end = scales[0].length;\n\n\t\tstart = nidx(start, scales[0].length);\n\t\tend = nidx(end, scales[0].length);\n\n\t\tfor (let group = 2, idx = 1; group <= maxScale; group*=2, idx++) {\n\t\t\tlet scaleBuffer = scales[idx];\n\t\t\tlet prevScaleBuffer = scales[idx - 1];\n\t\t\tlet len = Math.ceil(end/group);\n\n\t\t\t//ensure size\n\t\t\tif (scaleBuffer.length < len) scaleBuffer.length = len;\n\n\t\t\tlet groupStart = Math.floor(start/group);\n\n\t\t\tfor (let i = groupStart; i < len; i++) {\n\t\t\t\tlet left = prevScaleBuffer[i*2];\n\t\t\t\tif (left === undefined) left = 0;\n\t\t\t\tlet right = prevScaleBuffer[i*2+1];\n\t\t\t\tif (right === undefined) right = left;\n\t\t\t\tscaleBuffer[i] = reduce(left, right, i*2, idx-1);\n\t\t\t}\n\t\t}\n\n\t\treturn scales;\n\t}", "transformData(data, variable) {\n data.wmTransformedData = [];\n const columnsArray = variable.transformationColumns, dataArray = _.get(data, variable.dataField) || [], transformedData = data.wmTransformedData;\n _.forEach(dataArray, function (datum, index) {\n transformedData[index] = {};\n _.forEach(columnsArray, function (column, columnIndex) {\n transformedData[index][column] = datum[columnIndex];\n });\n });\n }", "function changeDataRate(delta)\r\n{\t\r\n\ttimeWindow +=delta;\r\n\tif (timeWindow < 2000)\r\n\t{\r\n\t\ttimeWindow = 2000;\r\n\t}\r\n\t\r\n\tif (timeWindow > 10000)\r\n\t{\r\n\t\ttimeWindow = 10000;\r\n\t}\r\n\r\n\tif (sendingData)\r\n\t{\r\n\t\tvar rate = Math.floor(timeWindow / dataLength);\r\n\t\tdataSocket.send(\"rate:\" + rate);\r\n\t}\r\n\t\r\n\tformatWindowField();\r\n\tresizeGraphs();\r\n}", "updateData(elms) {\n const self = this;\n if(!Array.isArray(elms)) {\n elms = [elms];\n }\n\n elms.forEach( elm => {\n if(!elm || !elm.position) {\n throw new Error('Cannot update null element or without position');\n }\n \n if (elm.position.isValid()) {\n const {line, column} = elm.position;\n self.data[line][column] = elm;\n }\n });\n }", "function changeData() {\n elem.name = userData.name;\n elem.star = userData.star;\n elem.time = userData.time;\n elem.moves = userData.moves;\n}", "update(data) {\n this.data = data;\n this.populate(this.dindex);\n console.log(\"Infographic of type \\\"\" + this.typename + \"\\\" updated.\");\n }", "_updateDataset() {\n // if graph hasn't been initialized, don't do anything\n if (!this.graph_obj) { console.log('not initialized'); return; }\n\n // calculate new decision's timestamp as a value between 0 and 1\n const xval = (\n (performance.now() - this.start_time) /\n (this.periodLength * 1000));\n if (isNaN(xval)) return;\n\n // add point for my new decision\n let dataset = this.graph_obj.series[0];\n this._lastElem(dataset.data).remove();\n dataset.addPoint([xval, this.myDecision]);\n dataset.addPoint([xval, this.myDecision]);\n\n // add point for others' new decision\n dataset = this.graph_obj.series[1];\n this._lastElem(dataset.data).remove();\n dataset.addPoint([xval, this.otherDecision]);\n dataset.addPoint([xval, this.otherDecision]);\n }", "update(updateData) {\n this.askNewPriceLevels.clear();\n this.bidNewPriceLevels.clear();\n updateData = updateData[0];\n this.askUpdated = false;\n this.bidUpdated = false;\n\n let price = updateData[0];\n let count = updateData[1];\n let size = updateData[2];\n\n if (count === 0) {\n let container;\n if (size === -1) {\n this.askUpdated = true;\n container = this.ask;\n } else {\n this.bidUpdated = true;\n container = this.bid;\n }\n let removeIndex = container.length;\n for (let i = 0; i < container.length; i++) {\n if (container[i][3] === price) {\n removeIndex = i;\n break;\n }\n }\n container.splice(removeIndex, 1);\n\n } else if (count > 0) {\n let total = Math.abs(price * size);\n\n let newRow = [\n 0,\n total,\n Math.abs(size),\n price\n ];\n\n //bids\n if (size > 0) {\n //append row\n this.bidUpdated = true;\n if (this.bid.length === 0 || price < this.bid[this.bid.length - 1][3]) {\n this.bid.push(newRow);\n this.bidNewPriceLevels.add(price);\n } else {\n\n for (let i = 0; i < this.bid.length; i++) {\n //update row\n if (this.bid[i][3] === price) {\n this.bid[i][2] = Math.abs(size);\n this.bid[i][1] = Math.abs(this.bid[i][2] * price);\n break;\n }\n //insert row\n if (price > this.bid[i][3]) {\n this.bid.splice(i, 0, newRow);\n this.bidNewPriceLevels.add(price);\n break;\n }\n }\n }\n //update sum\n let sum = 0;\n for (let i = 0; i < this.bid.length; i++) {\n sum += this.bid[i][1];\n this.bid[i][0] = sum;\n }\n }\n //asks\n if (size < 0) {\n //append row\n this.askUpdated = true;\n if (this.ask.length === 0 || price > this.ask[this.ask.length - 1][3]) {\n this.ask.push(newRow);\n this.askNewPriceLevels.add(price);\n } else {\n\n\n for (let i = 0; i < this.ask.length; i++) {\n //update row\n if (this.ask[i][3] === price) {\n this.ask[i][2] = Math.abs(size);\n this.ask[i][1] = Math.abs(this.ask[i][2] * price);\n break;\n }\n //insert row\n if (price < this.ask[i][3]) {\n this.ask.splice(i, 0, newRow);\n this.askNewPriceLevels.add(price);\n break;\n }\n }\n }\n //update sum\n let sum = 0;\n for (let i = 0; i < this.ask.length; i++) {\n sum += this.ask[i][1];\n this.ask[i][0] = sum;\n }\n }\n }\n return true;\n }", "function updateData() {\n\t/*\n\t* TODO: Fetch data\n\t*/\n}", "function updateValues ()\n{\n\t//Grab each label of the chart\n\tvar labels = color.domain();\n\t\n\treturn labels.map(function(label,index)\n\t{\n\t\t//Map each label name to an average of the values for this label.\n\t\treturn { \n\t\t\tlabel: label, \n\t\t\tvalue: sums[Object.keys(sums)[index]] / triadCount\n\t\t}\n\t});\n}", "function process_data_numeric(datas) {\n for (var i in datas){\n for(var j in datas[i]){\n if (typeof(datas[i][j]) === typeof(12)){\n if(datas[i][j] > 0 && datas[i][j] <1){\n datas[i][j] = (Math.trunc(datas[i][j] *10000))/100\n }\n }\n }\n }\n return datas\n\n }", "function processData(data) {\n mapData = data[0]\n incidence = data[1];\n mortality = data[2]\n for (var i = 0; i < mapData.features.length; i++) {\n mapData.features[i].properties.incidenceRates = incidence[mapData.features[i].properties.adm0_a3];\n mapData.features[i].properties.mortalityRates = mortality[mapData.features[i].properties.adm0_a3];\n }\n drawMap()\n}", "function update(data) {\n\t\t\tx.domain(data.map((d) => d.name));\n\t\t\ty.domain([0, d3.max(data, (d) => d.height)]);\n\n\t\t\t// Defines the axes\n\t\t\tconst xAxisCall = d3.axisBottom(x);\n\t\t\txAxisGroup\n\t\t\t\t.call(xAxisCall)\n\t\t\t\t.selectAll(\"text\")\n\t\t\t\t.attr(\"y\", \"10\")\n\t\t\t\t.attr(\"x\", \"-5\")\n\t\t\t\t.attr(\"text-anchor\", \"end\")\n\t\t\t\t.attr(\"transform\", \"rotate(-40)\");\n\n\t\t\tconst yAxisCall = d3\n\t\t\t\t.axisLeft(y)\n\t\t\t\t.ticks(3)\n\t\t\t\t.tickFormat((d) => d + \"m\");\n\t\t\tyAxisGroup.call(yAxisCall);\n\n\t\t\t// Generates data visualisation as a bar chart (D3 UPDATE PATTERN)\n\t\t\t// 1. JOIN new data with old elements\n\t\t\tconst bars = g.selectAll(\"rect\").data(data);\n\n\t\t\t// 2. EXIT old elements not present in new data\n\t\t\tbars.exit()\n\t\t\t\t.attr(\"fill\", \"red\")\n\t\t\t\t.transition(d3.transition().duration(500))\n\t\t\t\t.attr(\"height\", 0)\n\t\t\t\t.attr(\"y\", y(0))\n\t\t\t\t.remove();\n\n\t\t\t// 3. UPDATE old elements present in new data\n\t\t\tbars.transition(d3.transition().duration(500))\n\t\t\t\t.attr(\"x\", (d) => x(d.name))\n\t\t\t\t.attr(\"y\", (d) => y(d.height))\n\t\t\t\t.attr(\"width\", x.bandwidth)\n\t\t\t\t.attr(\"height\", (d) => HEIGHT - y(d.height));\n\n\t\t\t// 4. ENTER new elements present in new data\n\t\t\tbars.enter()\n\t\t\t\t.append(\"rect\")\n\t\t\t\t.attr(\"x\", (d) => x(d.name))\n\t\t\t\t.attr(\"height\", (d) => HEIGHT - y(d.height))\n\t\t\t\t.attr(\"width\", x.bandwidth)\n\t\t\t\t.attr(\"fill\", (d) => {\n\t\t\t\t\tif (d.name === \"Burj Khalifa\") {\n\t\t\t\t\t\treturn \"red\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn \"pink\";\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.attr(\"fill-opacity\", 0)\n\t\t\t\t.transition(d3.transition().duration(500))\n\t\t\t\t.attr(\"fill-opacity\", 1)\n\t\t\t\t.attr(\"y\", (d) => y(d.height));\n\t\t}", "radiansArraytoPositivePeriodicFractions(data) {\n const n = data.length;\n for (let i = 0; i < n; i++) {\n data.reassign(i, this.radiansToPositivePeriodicFraction(data.at(i)));\n }\n }", "function add_data_per_serving(data) {\n\n for (i = 0; i<data.data.length;i++) {\n\n serving = parseFloat(data.data[i].serving_size.substring(0, data.data[i].serving_size.indexOf(\"g\")));\n serv_factor = serving / 100\n\n fields_to_convert = [\"energy_100g\", \"fat_100g\", \"cholesterol_100g\", \"carbohydrates_100g\",\n \"sugars_100g\", \"proteins_100g\", \"sodium_100g\", \"fiber_100g\"];\n\n for (j = 0; j<fields_to_convert.length;j++) {\n var val_100g = data.data[i][fields_to_convert[j]];\n var old_name = fields_to_convert[j];\n var new_name = old_name.substring(0, old_name.indexOf(\"_\"))+\"_svg\";\n data.data[i][new_name] = val_100g * serv_factor;\n };\n\n };\n\n return data;\n}", "function changeDataHandler(event) {\n\n const divid = document.getElementById(event.target.id);\n //needs to be a constant value or works off resized values\n divid.parentElement.setAttribute('data-value', event.target.value);\n\n const name = divid.parentElement.getAttribute(\"data-function\");\n const existing = retrieveData(item);\n setData(name, existing.value, existing.x, existing.y, event.target.value);\n}", "function changeHis(){\r\n\t\tvar multi = 4;\r\n\t\tfor(var countIndex = 0;countIndex<countArray.length;countIndex++){\r\n\t\t\tcountArray[countIndex] = 0;\r\n\t\t}\r\n\t\ttimeData = _.filter(treeNodeList, function(d) {\r\n\t\t\treturn !Array.isArray(d.values);\r\n\t\t});\r\n\t\tfor(var i=0;i<timeData.length;i++){\r\n\t\t\tvar eachData = + timeData[i].values;\r\n\t\t\ttimeDataSum = timeDataSum + eachData;\r\n\t\t}\r\n\t\t// console.log(\"timeData\",timeData);\r\n\t\tvar count = 0;\r\n\t\tvar sumCount = 0;\r\n\t\tvar ddata = treeNodeList;\r\n\t\tfor(var i = 0; i < timeData.length; i++){\r\n\t\t\tvar d = timeData[i];\r\n\t\t\tdataSizeArray[i] = + d.values;\r\n\t\t\toriginalDataSizeArray[i] = + d.values;\r\n\t\t\tif(dataSizeArray[i] != 0){\r\n\t\t\t\tdataSizeArray[i] = Math.round(Math.log(dataSizeArray[i]) * multi);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// console.log(\"originalDataSizeArray\",originalDataSizeArray);\r\n\t\tvar maxLogData = d3.max(dataSizeArray);\r\n\t\tfor(var i=0;i<=maxLogData;i++){\r\n\t\t\tcountArray[i] = 0;\r\n\t\t\teachTypeIdArray[i] = new Array();\r\n\t\t\teachTypeIndexArray[i] = new Array();\r\n\t\t}\r\n\t\tfor(var i=0;i<dataSizeArray.length;i++){\r\n\t\t\tcountArray[dataSizeArray[i]]++;\r\n\t\t\teachTypeIdArray[dataSizeArray[i]].push(timeData[i].id);\r\n\t\t\teachTypeIndexArray[dataSizeArray[i]].push(i);\r\n\t\t}\r\n\t\tvar sumNode = 0;\r\n\t\tfor(var i=0;i<countArray.length;i++){\r\n\t\t\tsumNode = sumNode + countArray[i];\r\n\t\t}\r\n\t\tfor(var i=0;i<countArray.length;i++){\r\n\t\t\tif(countArray[i] != 0 ){\r\n\t\t\t\tcountArray[i] = Math.log(countArray[i] + 1);\r\n\t\t\t}\r\n\t\t}\r\n\t\tlineX.range([0,width - move_x * 1.2]);\r\n\t\tlineX.domain([0,(d3.max(dataSizeArray) + 1)/multi]);\r\n\t\tvar xAxis = d3.svg.axis()\r\n\t\t.scale(lineX)\r\n\t\t.orient(\"bottom\");\r\n\t\tbrush.x(lineX)\r\n\t\t\t.on(\"brushend\",brushed);\r\n\r\n\t\tfor(var i=0;i<(d3.max(dataSizeArray)+1)/multi;i=i+1){\r\n\t\t\txAxisTicks.push(i);\r\n\t\t}\r\n\t\this_width = (width - 1.2 * move_x)/(d3.max(dataSizeArray) + 1);\r\n\t\txAxis.tickValues(xAxisTicks);\r\n\t\tlineY.domain(d3.extent(countArray));\r\n\t\tfor(var i=0;i<countArray.length;i++){\r\n\t\t\tobjArray[i] = new Object();\r\n\t\t\tobjArray[i].num = i;\r\n\t\t\tobjArray[i].count = countArray[i];\r\n\t\t}\r\n\t\tvar yAxis = d3.svg.axis()\r\n\t\t\t.scale(lineY)\r\n\t\t\t.orient(\"left\");\r\n\t\tvar line = d3.svg.line()\r\n\t\t\t.x(function(d){return (lineX(d.num));})\r\n\t\t\t.y(function(d){return (lineY(d.count));})\r\n\r\n\t\td3.select(\"#histogramView\")\r\n\t\t\t.selectAll(\".his\")\r\n\t\t\t.data(objArray)\r\n\t\t\t.enter()\r\n\t\t\t.append(\"rect\")\r\n\t\t\t.attr(\"id\",function(d,i){\r\n\t\t\t\treturn \"his\" + i; \r\n\t\t\t})\r\n\t\t\t.attr(\"class\",\"his\")\r\n\t\t\t.attr(\"width\",his_width * 0.5)\r\n\t\t\t.attr(\"height\",function(d,i){\r\n\t\t\t\treturn moveHeight - lineY(objArray[i].count);\r\n\t\t\t})\r\n\t\t\t.attr(\"x\",function(d,i){\r\n\t\t\t\treturn his_width * i;\r\n\t\t\t})\r\n\t\t\t.attr(\"y\",function(d,i){\r\n\t\t\t\treturn lineY(objArray[i].count); \r\n\t\t\t})\r\n\t\t\t.attr(\"fill\",\"#1F77B4\");\r\n\t\td3.select(\"#histogramView\")\r\n\t\t.append(\"g\")\r\n\t\t.attr(\"class\",\"y axis\")\r\n\t\t.attr(\"transform\",\"translate(\" + 0 + \",\"+ 0 +\")\")\r\n\t\t.call(yAxis)\r\n\t\t.append(\"text\")\r\n\t\t.attr(\"transform\",\"rotate(-90)\")\r\n\t\t.attr(\"class\",\"label\")\r\n\t\t.attr(\"x\",5)\r\n\t\t.attr(\"y\",16)\r\n\t\t.style(\"text-anchor\",\"end\")\r\n\t\t.text(\"log(Number)\");\r\n\r\n\t\td3.select(\"#histogramView\")\r\n\t\t.append(\"g\")\r\n\t\t.attr(\"class\",\"x axis\")\r\n\t\t.attr(\"transform\",\"translate(\" + 0 + \",\"+ (moveHeight) +\")\")\r\n\t\t.call(xAxis)\r\n\t\t.append(\"text\")\r\n\t\t.attr(\"class\",\"label\")\r\n\t\t.attr(\"x\",width - move_x * 1.2 + 30)\r\n\t\t.attr(\"y\",14)\r\n\t\t.style(\"text-anchor\",\"end\")\r\n\t\t.text(\"log(bytes)\");\r\n\r\n\t\td3.select(\"#histogramView\")\r\n\t\t.append(\"g\")\r\n\t\t.attr(\"class\",\"x brush\")\r\n\t\t.call(brush)\r\n\t\t.selectAll(\"rect\")\r\n\t\t.attr(\"y\",0)\r\n\t\t.attr(\"height\",moveHeight);\r\n\t}", "function vdDemo_updateData(){\n\tvar d=GLB.vdDemoData[GLB.vdDemoIdx];\t// Use current index row of Demo Data Array\n\t\n\t// Update VDvehicle obj with data: [id,vehicle,speed,accel,heart,X,Y,Z,lat,lng,insurance]\n\tGLB.vehicle.updateData(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10]);\n\tGLB.vehicle.updateDriverImg(d[11]);\n\tGLB.vehicle.updateRoadImg(d[12]);\n\n\t// Update the Text elements on the page\n\tGLB.vehicle.modifyHtmlText();\n\n\t//UPDATE CHARTS HERE\n\n\t// Check if index has reached end of array\n\t// - If no: update by 1\n\t// - If yes: rollover\n\tif(GLB.vdDemoIdx==(GLB.vdDemoData.length-1))\n\t\tGLB.vdDemoIdx=0;\n\telse\n\t\tGLB.vdDemoIdx++;\n}", "function chart_shift(chart_data, new_graph_points) {\n // If our chart is full with data, delete the furthest left\n // console.log(chart_points_number);\n if (chart_data.length > chart_points_number) {\n chart_data.splice(0, new_graph_points);\n };\n\n // shift the chart data\n for (x = 0; x < chart_data.length; x++) {\n chart_data[x][0] = chart_data[x][0] - (new_graph_points);\n\n };\n}", "function updateData(new_lat, new_lon, new_acc){\n lat = new_lat;\n lon = new_lon;\n acc = new_acc;\n showPosition();\n}", "function fixUpdatedData(data) {\n if (!data['$set']) {\n return { $set: { ...data } };\n }\n return data;\n}", "function preProcessData(data) {\n data.forEach(function (d) {\n d.u = new Date(d.u * 1000);\n });\n }", "invert() {\r\n this.data = this.data.map(rows => rows.map(cols => cols*-1));\r\n }", "function fixDateValues (data) {\n for (var i = 0; i < data.length; i++) {\n var d = new Date(data[i].x);\n var dYear = d.getFullYear().toString();\n var dMonth = (d.getMonth() + 1).toString();\n var dDay = d.getDate().toString();\n data[i].x = dDay + \"/\" + dMonth + \"/\" + dYear;\n // console.log(data[i]);\n }\n return data\n }", "function updateData(clicSelect){\n \n \n // Changing parameters for different optional categories\n if(clicSelect == \"first\")\n {\n amp = 1000;\n cat = \"estab\";\n lab = \"Count x1000\";\n lab2 = \"K\";\n }\n else if(clicSelect == \"second\")\n {\n amp = 1000000;\n cat = \"emp\";\n lab = \"Count x1M\";\n lab2 = \"M\";\n }\n else if(clicSelect == \"third\")\n {\n amp = 1000000;\n cat = \"payroll\";\n lab = \"Amount x1M$\";\n lab2 = \"M$\";\n }\n else if(clicSelect == \"fourth\")\n {\n amp = 1000;\n cat = \"income\";\n lab = \"Amount x1000$\";\n lab2 = \"K$\";\n }\n else\n {\n amp = 1000;\n cat = \"firms\";\n lab = \"Count x1000\";\n lab2=\"K\";\n }\n \n // Recreate the tooltips\n tip = d3.tip()\n .attr('class', 'd3-tip')\n .offset([-10, 0])\n .html(function(d) {\n return \"<div class='tipbody'><p class='tiphead'>\" + valFormat(d[cat]/amp) + \" \" + lab2 + \"</p>\" + \"<p class='tiptext'>\" + d.name + \"</p></div>\";\n });\n \n // Clean the canvas from the old elements\n svg.selectAll(\"g.y.axis\").remove();\n svg.selectAll(\"rect\").remove();\n \n // Associate the new tips to the cleaned canvas\n svg.call(tip);\n \n // Reload the data (since all g's were removed) and modify the axis scaling\n d3.json(\"datamain.json\", function(error, data) {\n x.domain(data.map(function(d) { return d.name; }));\n y.domain([0, d3.max(data, function(d) { return d[cat]/amp; })]);\n\n //Repeat the association steps\n svg.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(xAxis);\n\n svg.append(\"g\")\n .attr(\"class\", \"y axis\")\n .call(yAxis)\n .append(\"text\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 6)\n .attr(\"dy\", \".71em\")\n .style(\"text-anchor\", \"end\")\n .text(lab);\n\n // Recreating the bars with zero values to prepare for the animation\n svg.selectAll(\".bar\")\n .data(data)\n .enter().append(\"rect\")\n .attr(\"class\", \"bar\")\n .attr(\"x\", function(d) { return x(d.name); })\n .attr(\"width\", x.rangeBand())\n .attr(\"y\",height)\n .attr(\"height\",0)\n .on('mouseover', tip.show)\n .on('mouseout', tip.hide);\n \n // Animation to the final new value\n svg.selectAll(\".bar\").transition()\n .duration(800) // Total duration for each bar\n .delay(function(d,i){return i*150;}) // Delay for ordered appearance\n .ease(\"sin\") // easing function (I am thinking about removing it in the final product)\n .attr(\"y\", function(d) { return y(d[cat]/amp); }) //Final y position\n .attr(\"height\", function(d) { return height - y(d[cat]/amp); }) // Final height.\n ;\n });\n}", "function updatePlot() {\n if (typeof envData === 'undefined') {\n return;\n }\n \n // Adjust scales' min and max\n xScale.domain([new Date(envData[0].time), new Date(envData[envData.length -1].time)]).range([W_PADDING, WIDTH - W_PADDING]); \n \n if (envData[0][scope.plottype] || envData[0][scope.plottype] == 0) {\n if (scope.thresholddata) {\n var min = Math.min(d3.min(envData, function(d) {return d[scope.plottype];}),\n scope.thresholddata.marginalData[scope.plottype], \n scope.thresholddata.severeData[scope.plottype]);\n var max = Math.max(d3.max(envData, function(d) {return d[scope.plottype];}),\n scope.thresholddata.marginalData[scope.plottype], \n scope.thresholddata.severeData[scope.plottype]);\n yScale.domain([min, max]).range([HEIGHT - H_PADDING, TOP_PADDING]);\n }\n else {\n yScale.domain([d3.min(envData, function(d) {return d[scope.plottype];}), d3.max(envData, function(d) {\n return d[scope.plottype];\n })]).range([HEIGHT - H_PADDING, TOP_PADDING]);\n }\n }\n \n svg.select('#d3plotline')\n .datum(envData) // set the new data\n .transition() // start a transition to bring the new value into view\n .attr(\"d\", line) // apply the new data values \n .ease(\"linear\")\n .duration(DURATION);\n \n if (scope.thresholddata) {\n setThresholdClipAttributes(); \n \n svg.selectAll(\".line\")\n .data(CLIP_NAMES)\n .attr(\"clip-path\", function(d) { \n return \"url(#clip-\" + d + \")\"; })\n .datum(envData)\n .transition()\n .attr(\"d\", line)\n .ease(\"linear\")\n .duration(DURATION); \n } \n \n svg.select(\".y.axis\") // update the y axis\n .transition()\n .duration(DURATION)\n .call(yAxis); \n \n svg.select(\"#yLabel\").text(yAxisLabel[scope.plottype]);\n\n svg.select(\".x.axis\") // update the x axis\n .transition()\n .duration(DURATION)\n .call(xAxis); \n \n svg.selectAll('#xAxis g text').each(insertLineBreaks);\n }", "function updateData(){\r\n\r\n //generating an arry of 100 random, unique numbers between 1 and 1000\r\n var randomSet = [...new Set(d3.range(100).map(function() {\r\n return Math.round(Math.random()*1000)\r\n }))];\r\n while (randomSet.length < 100) {\r\n var randomSet = [...new Set(randomSet.concat([...new Set(d3.range(100-randomSet.length).map(function() {\r\n return Math.round(Math.random()*1000)\r\n }))]))];\r\n }\r\n\r\n simData = fullData.filter(function(d,i){ return randomSet.indexOf(d.SimNum) >= 0 })\r\n\r\n //add 1-100 rowNum for plot ying axis\r\n var i = 1;\r\n while (i <= 100) {\r\n simData.forEach(function(d) {\r\n d.rowNum = i;\r\n i++;\r\n });\r\n }\r\n\r\n //count wins by trump, count wins by biden\r\n TrumpWins = simData.filter(function(d,i){ return d.SimpleCanidate == \"Trump\"}).length\r\n BidenWins = simData.filter(function(d,i){ return d.SimpleCanidate == \"Biden\"}).length\r\n\r\n //updating left results\r\n d3.selectAll(\"#leftResults\")\r\n .style(\"opacity\",0)\r\n .text(function(d){\r\n return TrumpWins + \" IN 100\"; //new results\r\n })\r\n //delaying \r\n .transition()\r\n .duration(1)\r\n .delay(3200) //waiting until dots are all showing\r\n .style(\"opacity\",1)\r\n\r\n\r\n //updating right results\r\n d3.selectAll(\"#rightResults\")\r\n .style(\"opacity\",0)\r\n .text(function(d){\r\n return BidenWins + \" IN 100\"; //new results\r\n })\r\n //delaying \r\n .transition()\r\n .duration(1)\r\n .delay(3200) //waiting until dots are all showing\r\n .style(\"opacity\",1)\r\n\r\n\r\n //defining scales\r\n var xScale = d3.scaleLinear()\r\n .domain([-150,150]) //input is -100 to 100 \r\n .range([leftMargin,w_dots-rightMargin]) //plot output along whole width of svg\r\n\r\n var yScale = d3.scaleLinear()\r\n .domain([0,100]) //1 to 100 rows\r\n .range([topMargin,h_dots-bottomMargin*3]) \r\n\r\n\r\n //updating dots\r\n d3.selectAll(\"circle\")\r\n .data(simData) \r\n .style(\"opacity\",0)\r\n .transition()\r\n .duration(1)\r\n .attr(\"cx\",function(d){\r\n return xScale(d.WinningMargin);\r\n })\r\n .attr(\"cy\",function(d){\r\n return yScale(d.rowNum);\r\n })\r\n .attr(\"r\",7)\r\n .attr(\"fill\",function(d){\r\n if(d.WinningMargin < 0){\r\n return red;\r\n } else if(d.WinningMargin == 0) {\r\n return \"#B8BABC\"; //gray\r\n } else {\r\n return blue;\r\n }\r\n })\r\n .transition()\r\n .delay(function(d,i){ return i * 30 })\r\n .duration(100)\r\n .style(\"opacity\",1)\r\n\r\n\r\n\r\n } //end of update function", "updateData() {\n const parameters = {\n rows: 17,\n columns: 17,\n dataRows: 17,\n dataColumns: 17,\n labelOffsetY: 130\n };\n\n mobx.transaction(() => {\n while (this.chart.state.rows.length < parameters.rows) {\n this.chart.state.rows.push({ label: `Row ${this.chart.state.rows.length}` });\n }\n\n while (this.chart.state.rows.length > parameters.rows) {\n this.chart.state.rows.pop();\n }\n\n while (this.chart.state.columns.length < parameters.columns) {\n this.chart.state.columns.push({\n label: `Column ${this.chart.state.columns.length}`\n });\n }\n\n while (this.chart.state.columns.length > parameters.columns) {\n this.chart.state.columns.pop();\n }\n\n while (this.chart.state.data.length < parameters.dataColumns) {\n this.chart.state.data.push(makeColumn(parameters));\n }\n\n while (this.chart.state.data.length > parameters.dataColumns) {\n this.chart.state.data.pop();\n }\n\n for (let i = 0, iMax = this.chart.state.data.length; i < iMax; ++i) {\n const row = this.chart.state.data[i];\n\n while (row.length < parameters.dataRows) {\n row.push(makeItem());\n }\n\n while (row.length > parameters.dataRows) {\n row.pop();\n }\n }\n });\n }", "update (data) {\n for (let key in data) {\n if (this.hasOwnProperty(key)) { // Can only update already defined properties\n this[key] = data[key];\n }\n }\n }", "function resetData() {\r\n\t\t\tpedometerData = {\r\n\t\t\t\tstepStatus : '-',\r\n\t\t\t\tspeed : 0,\r\n\t\t\t\twalkingFrequency : '-',\r\n\t\t\t\taccumulativeTotalStepCount : 0,\r\n\t\t\t\tcumulativeCalorie: 0,\r\n\t\t\t\tcumulativeTotalStepCount: 0\r\n\t\t\t\t\r\n\t\t\t};\r\n\t\t}", "_updateColumnScale() {\n\n\t\t\t// Remove amount of entries so that we can insert a line of 1 px\n\t\t\tconst amountOfDataSets = this._elements.svg.selectAll('.column').size();\n\t\t\tconst width = this._getSvgWidth() - 50 - this._getMaxRowLabelWidth() - this._configuration.spaceBetweenLabelsAndMatrix - amountOfDataSets * this._configuration.lineWeight;\n\t\t\tconsole.log('ResistencyMatrix / _updateColumnScale: Col # is %o, svg width is %o, width column content is %o', amountOfDataSets, this._getSvgWidth(), width);\n\n\t\t\t// Update scale\n\t\t\tthis._columnScale.range([0, width]);\n\t\t\tconsole.log('ResistencyMatrix: New bandwidth is %o, step is %o', this._columnScale.bandwidth(), this._columnScale.step());\n\n\t\t}", "function update(data) {\n const make = d3.select(makeButton).property(\"value\");\n const fuel = d3.select(fuelButton).property(\"value\");\n const cyl = d3.select(cylButton).property(\"value\");\n\n const updateData = [];\n const notData = [];\n\n data.forEach(d => {\n if ((d.Make == make || make == \"default\") && (d.Fuel == fuel || fuel == \"default\") && (d.EngineCylinders == cyl || cyl == \"default\")) {\n updateData.push(d);\n } else {\n notData.push(d);\n }\n })\n\n const fuelSet = new Set()\n const cylSet = new Set()\n const makeSet = new Set()\n\n updateData.forEach(car => {\n fuelSet.add(car.Fuel);\n cylSet.add(parseInt(car.EngineCylinders));\n makeSet.add(car.Make);\n });\n\n writeIntroUpdate(updateData.length, make, Array.from(makeSet).length, fuel, Array.from(fuelSet).length, cyl, Array.from(cylSet).length)\n updateCsv(updateData, notData);\n // Give these new data to update line\n}", "function insertBackwardsAttenuation(data) {\n for (var i = 0, n = nodes.length; i < n; i++) {\n for (var j = 0, m = data.length; j < m; j++) {\n if (nodes[i]['dbId'] == data[j]['idNo']) {\n nodes[i]['componentsAttenuation'] = data[j]['aComponentes'];\n nodes[i]['linkDistance'] = data[j]['cLigacao'];\n }\n }\n }\n}", "function updateData(data) {\n // data.selectedGen++;\n // model.provider.updateField(data.name, { active: data.selected });\n model.provider.toggleFieldSelection(data.name);\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "refreshValue() {\n const sourceData = this.hot.getSourceDataAtCell(this.row, this.prop);\n\n this.originalValue = sourceData;\n\n this.setValue(sourceData);\n this.refreshDimensions();\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "_updateGameOnly(data, newValues) {\n if (newValues) {\n data = objectAssign({}, data, newValues)\n }\n const percent = (data.actual)? Math.round(calculatePercent(data.promise, data.actual)) : 0\n if (percent != data.percent) {\n const generation = (data._gen || 0) + 1\n const points = getPoints(data.key, percent)\n return objectAssign({}, data, {percent, points, _gen: generation})\n } else {\n return data\n }\n }", "function updatingData1() {\n let wafersPrice = store2['inventory prices']['Mint Wafers'];\n wafersPrice = 1.99;\n return false;\n\n /* The price in the store2 data does not change because store2 is an object type.\n Objects are passed by reference. This means that reassigning the original \n wafersPrice to a new price only only changes the reference pointer to a new price without \n altering the original data.\n */\n}", "function moreData(series, data) {\n if (data.length) { // TODO try trackMaxDomain here\n var lastKey = data[data.length-1][0];\n var newEnd = Math.max(lastKey, chartData.displayDomain[1]);\n series.data = series.data.concat(data); // TODO overwrite existing keys not just append\n chartData.displayDomain[1] = newEnd;\n transitionRedraw();\n }\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "function updateAvgCharts(result){\t\r\n\r\n\t\t// store old values\t\t\t\r\n\t\t//oldRes.avg_traffic = chart1.series[0].data[0].y;\t\t\t\t\r\n\t\t//oldRes.pop_dens = chart3.series[0].data[0].y;\t\r\n\t\r\n\t\t// update charts\t\t\r\n\t\tchart1.series[0].setData(result.avg);\t// avg traffic\t\t\r\n\t\t\t\r\n\t\t// population\r\n\t\t/*\r\n\t\tchart3.series[0].setData([\t{color: col1, borderColor: col1_borderColor, name: 'pop_density', \t\ty: result.pop_dens},\r\n\t\t\t\t\t\t\t\t\t{color: col2, borderColor: col2_borderColor, name: 'pop_density', \t\ty: oldRes.pop_dens}]);\r\n\t\t*/\r\n}", "_updateObject(event, formData) { \n // Handle Damage Array\n let damage = Object.entries(formData).filter(e => e[0].startsWith(\"data.damage.parts\"));\n formData[\"data.damage.parts\"] = damage.reduce((arr, entry) => {\n let [i, j] = entry[0].split(\".\").slice(3);\n if ( !arr[i] ) arr[i] = [];\n arr[i][j] = entry[1];\n return arr;\n }, []);\n \n // Handle Critical Damage Array\n let criticalDamage = Object.entries(formData).filter(e => e[0].startsWith(\"data.critical.parts\"));\n formData[\"data.critical.parts\"] = criticalDamage.reduce((arr, entry) => {\n let [i, j] = entry[0].split(\".\").slice(3);\n if ( !arr[i] ) arr[i] = [];\n arr[i][j] = entry[1];\n return arr;\n }, []);\n\n // Handle Ability Adjustments array\n let abilityMods = Object.entries(formData).filter(e => e[0].startsWith(\"data.abilityMods.parts\"));\n formData[\"data.abilityMods.parts\"] = abilityMods.reduce((arr, entry) => {\n let [i, j] = entry[0].split(\".\").slice(3);\n if ( !arr[i] ) arr[i] = [];\n arr[i][j] = entry[1];\n return arr;\n }, []);\n \n // Update the Item\n super._updateObject(event, formData);\n }", "function adjust(){\n thescale = document.getElementById(\"scale\");\n if(thescale.value < 1){\n thescale.value = 1;\n }\n diviser = thescale.value;\n hasAdjusted = 1;\n init();\n }", "function updateDataElement(me) {\n // var nope = me.length - (me.amount + \"\").length, text = \"\";\n // for(var i=0; i<nope; ++i) text += \"0\";\n me.element.innerText = me.name + \"\\n\"/* + text + \"\"*/ + me.amount;\n}", "function applyAnswerData(newanswer) {\n\t\t\t$scope.answer = newanswer.data;\n\t\t\t\n\t\t\t$scope.answermap.dataTable.addColumn(\"string\", \"Field\");\n\t\t\t$scope.answermap.dataTable.addColumn(\"number\", \"TotalCount\");\t\t\t\n\t\t\t$scope.answermap.dataTable.addRows([[ \"Total Questions\", $scope.answer.totalQuestions],\n\t\t\t\t\t\t\t\t\t\t\t [ \"Total Answers\", $scope.answer.totalAnswers]\n\t\t\t ]);\n\t\t\t$scope.answermap.title = \"Total Answers Barchart\";\n\t\t\t\n\t\t}", "function update() {\n if (d3.event.keyCode == 38 || d3.event.keyCode == 40) {\n d3.event.preventDefault();\n if (d3.event.keyCode == 38) {\n scale = scale + 0.05;\n if (scale > 0.4) {\n scale = 0.4;\n return\n }\n }\n if (d3.event.keyCode == 40) {\n scale = scale - 0.05;\n if (scale < -2) {\n scale = -2;\n return\n }\n }\n var extent = self.data.zmax - self.data.zmin;\n var domain = utils.linspace(self.data.zmin + extent * scale,\n self.data.zmax - extent * scale, self.data.distinct);\n self.updateDomain(domain);\n draw();\n }\n if (d3.event.keyCode == 37 || d3.event.keyCode == 39) {\n d3.event.preventDefault();\n if (d3.event.keyCode == 37) {\n cindex = cindex - 1;\n if (cindex < 0) {\n cindex = clist.length - 1\n }\n }\n if (d3.event.keyCode == 39) {\n cindex = cindex + 1;\n if (cindex > clist.length - 1) {\n cindex = 0\n }\n }\n self.updateRange(clist[cindex]);\n draw();\n }\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }", "function updateChart() {\n const zoomState = zoomTransform(SVG.node());\n\n // recover the new scale\n var newX = zoomState.rescaleX(x);\n var newY = zoomState.rescaleY(y);\n\n \n // update axes with these new boundaries\n xAxis.call(axisBottom(newX))\n yAxis.call(axisLeft(newY))\n \n // update circle position\n scatter\n .selectAll(\"circle\")\n .attr('cx', function(d) {return newX(d.Sepal_Length)})\n .attr('cy', function(d) {return newY(d.Petal_Length)});\n }" ]
[ "0.6687704", "0.65922827", "0.6474521", "0.6411509", "0.6402488", "0.62500304", "0.62078094", "0.61798334", "0.59558105", "0.58987385", "0.5892078", "0.58432204", "0.5781464", "0.576219", "0.57237154", "0.570365", "0.5700649", "0.5698834", "0.5641815", "0.5620254", "0.56090665", "0.56059307", "0.5595126", "0.55935735", "0.5591318", "0.55876565", "0.5587624", "0.55790955", "0.5551257", "0.5535739", "0.5530988", "0.55232114", "0.5521539", "0.55179745", "0.5498203", "0.54957175", "0.54905987", "0.5476301", "0.5470959", "0.54516864", "0.54413116", "0.5436172", "0.54309595", "0.54193854", "0.5419114", "0.5415284", "0.54148126", "0.5410553", "0.5401816", "0.53881127", "0.53833246", "0.53785175", "0.537039", "0.5367254", "0.5366571", "0.5364621", "0.5361761", "0.5359523", "0.53518695", "0.53511214", "0.5346937", "0.53424495", "0.53411496", "0.53349537", "0.53140897", "0.53104395", "0.5306773", "0.5305637", "0.5301081", "0.5288729", "0.5286653", "0.5283345", "0.5279406", "0.52784395", "0.527345", "0.5259246", "0.5258296", "0.5257776", "0.5257129", "0.5257117", "0.52551514", "0.52535236", "0.5253181", "0.52513754", "0.52489924", "0.52472275", "0.52462476", "0.5245053", "0.52435774", "0.5238812", "0.523789", "0.5235289", "0.5227236", "0.5226845", "0.52259034", "0.5225809", "0.5225809", "0.5225809", "0.5225809", "0.5225809", "0.52202386" ]
0.0
-1
Try to reduce the number of times language list is iterated over
getFilteredLanguages(width, height) { const { languages, languageCode, filterText, fromCountry } = this.props; const filteredLanguages = filterText ? matchSorter(languages, filterText, { threshold: matchSorter.rankings.ACRONYM, keys: [ 'name', 'iso', { maxRanking: matchSorter.rankings.STARTS_WITH, key: 'alt_names', }, ], }) : languages; if (languages.length === 0) { return null; } const renderARow = ({ index, style, key }) => { const language = filteredLanguages[index]; return ( <div style={style} key={key} className="language-name" role="button" tabIndex={0} title={language.englishName || language.name} onClick={(e) => this.handleLanguageClick(e, language)} > <h4 className={ language.id === languageCode ? 'active-language-name' : '' } > {language.alt_names && language.alt_names.includes(filterText) ? filterText : language.autonym || language.englishName || language.name} {language.autonym && language.autonym !== (language.englishName || language.name) ? ` - ( ${language.englishName || language.name} )` : null} </h4> </div> ); }; const getActiveIndex = () => { let activeIndex = 0; filteredLanguages.forEach((l, i) => { if (l.id === languageCode) { activeIndex = i; } }); return activeIndex; }; return filteredLanguages.length ? ( <List id={'list-element'} estimatedRowSize={34 * filteredLanguages.length} height={height} rowRenderer={renderARow} rowCount={filteredLanguages.length} overscanRowCount={2} rowHeight={34} scrollToIndex={fromCountry ? 0 : getActiveIndex()} width={width} scrollToAlignment={'start'} /> ) : ( <div className={'language-error-message'}> There are no matches for your search. </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateNextLangIndex () {\n let index = this.langIndex + 1\n if (index >= LANG_LIST.length) {\n index = 0\n }\n this.langIndex = index\n }", "trainLanguages() {\n\t\tlet self=this;\n\t\treturn Q.all(this.languages.map((language)=>{\n\t\t\treturn self.trainLanguage(language);\n\t\t}));\n\t}", "function renewLanguageToLearn() {\n angular.forEach(vm.availableDictionary, function(value, key) {\n if (key == vm.data.localeSelected.id) {\n vm.data.languageToLearnArrayList = angular.fromJson(value.available_languages);\n angular.forEach(vm.data.languageToLearnArrayList, function(value, key) {\n if (value.id == $scope.user.languageToLearn) {\n vm.data.languageToLearnSelected = value;\n }\n });\n }\n });\n }", "function initializeLangVars() {\nswitch (Xlang) {\n// --------------------------------------------------------------------------------------------------------------------------------------------------------------------\n// - The 03/02/2010 ------------- by Ptitfred06\n// Modification : small word to have good view in tasklist\n// - Small modification on word (translation).\n// - comment what can be personnalise / and what can't \n// -----------------------------------------------------------------------\n\tcase \"fr\": // thanks Tuga\n// Texte détécté dans les page Travian (NE PAS CHANGER / No CHANGE !!!)\n\t\taLangAllBuildWithId = [\"Bûcheron\", \"Carrière de terre\", \"Mine de fer\", \"Ferme\", \"\", \"Scierie\", \"Usine de poteries\", \"Fonderie\", \"Moulin\", \"Boulangerie\", \"Dépôt de ressources\", \"Silo de céréales\", \"Armurerie\", \"Usine d'armures\", \"Place du tournoi\", \"Bâtiment principal\", \"Place de rassemblement\", \"Place du Marché\", \"Ambassade\", \"Caserne\", \"Écurie\", \"Atelier\", \"Académie\", \"Cachette\", \"Hôtel de ville\", \"Résidence\", \"Palais\", \"Chambre aux trésors\", \"Comptoir de commerce\", \"Grande Caserne\", \"Grande Écurie\", \"Mur d'enceinte\", \"Mur de terre\", \"Palissade\", \"Tailleur de Pierres\", \"Brasserie\", \"Fabricant de pièges\",\"Manoir du héros\", \"Grand dépôt de ressources\", \"Grand silo de céréales\", \"Merveille du monde\", \"Abreuvoir\"];\n\t\taLangAllBuildAltWithId = [/*\"Bûcheron\"*/, \"Carrière de Terre\", /*\"Mine de fer\"*/, \"Ferme de céréales\", \"\", /*\"Scierie\"*/, \"Usine de Poteries\", /*\"Fonderie\", \"Moulin\"*/,/* \"Boulangerie\"*/, /*\"Dépôt de ressources\"*/, /*\"Silo de céréales\"*/, /*\"Armurerie\"*/, /*\"Usine d'armures\"*/, /*\"Place du tournoi\"*/, \"Bâtiment Principal\", /*\"Place de rassemblement\"*/, \"Place du marché\", /*\"Ambassade\"*/, /*\"Caserne\"*/, /*\"Écurie\"*/, /*\"Atelier\"*/, /*\"Académie\"*/, /*\"Cachette\"*/, \"Hôtel de Ville\", /*\"Résidence\"*/, /*\"Palais\"*/, /*\"Chambre aux trésors\"*/, \"Comptoir de commerce\", \"Grande Caserne\", \"Grande Écurie\", \"Mur d'enceinte\", \"Mur de terre\", \"Palissade\", \"Tailleur de Pierres\", \"Brasserie\", \"Fabricant de pièges\",\"Manoir du Héros\", \"Grand dépôt de ressources\", \"Grand silo de céréales\", \"Merveille du monde\", \"Abreuvoir\"];\n\n// <-- Peu être modifié / can be personnalize\n\t\taLangAddTaskText = [\"Ajouter tache\", \"Type\", \"Village actif\", \"Cible\", \"Vers\", \"Mode\", \"Aide Const.\", \"Quantité de ress.\", \"Bouger vers le haut\", \"Bouger vers le bas\", \"Effacer\", \"&#160;&#160;&#160;Taches\", \"Bouger \", \"Eliminer toutes les tâches\"];\n\t\taLangTaskKind = [\"Évol \", \"N Cons \", \"Att \", \"Rech \", \"Entrai \", \"Trans \", \"NPC\", \"Dém \", \"Fête\"];\n// -->\n\n// <-- Peu être modifié / can be personnalize\n\t\taLangGameText = [\"Niv\", \"Marchands\", \"Id\", \"Capitale\", \"Temps début\", \"this timeseting is unuseful now.\", \"Vers\", \"Village\", \"Transport\", \"de\", \"Transport vers\", \"Transport de\", \"Retour de\", \"Ressources\", \"Bâtiment\", \"Construire un nouveau bâtiment\", \"Vide\", \"Niveau\"];\n// original \taLangGameText = [\"Niveau\", \"Marchands\", \"Identification\", \"Capitale\", \"Inicio\", \"this timeseting is unuseful now.\", \"Vers\", \"Village\", \"Transport\", \"de\", \"Transport vers\", \"Transport de\", \"Retour de\", \"Ressources\", \"Bâtiment\", \"Construire un nouveau bâtiment\", \"Vazio\", \"Niveau\"];\n// -->\tfin\t\n\n\t\taLangRaceName = [\"Romains\", \"Germains\",\"Gaulois\"];\n// <-- Peu être modifié\n\t\taLangTaskOfText = [\"Planifier evolution\", \"Planifier nouvelle construction\", \"RessUpD\", \"OFF\", \"Comencer\", \"ON\", \"Arreter\", \"La distribution des champs de ce village est \", \"AutoT\", \"Auto transport n est pas ouvert\", \"Ouvert\", \"Transport avec succès\", \"Taches\", \"Limit\", \"Defaut\", \"Modifier\", \"Bois/Terre/Fer\", \"Céréales\", \"Planification de demolition\", \"Planif.Attaque\", \"Type d´attaque\", \"Temps de voyage\", \"Repeter numero de fois\", \"Temps de intervales\",\"00:30:00\",\"Cible catapulte\",\"Aléatoire\", \"Inconnu\", \" Fois\", \"/\", \" \", \"Troupes envoyées\", \"Planification d´entrainement\",\"Train ubication\",\"Planification d´entrainement fini\",\"TransP\",\"Setup Interval Time of Reload\",\"This is the interval of page reload ,\\n default sont 20 minutes, Insérer nouveau temps:\\n\\n\",\"Remain\",\"Planifier fête\",\"petite fête\",\"grande fête\",\"Set Interval of Ressources concentration\",\"minutes\",\".\",\".\",\"START\",\"STOP\",\"Planifier entrainement\",\"Augmenter Attaque\",\"Augmenter Defense\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n// -->> fin\n// < ne pas change / no change !!! Detected for the feedback error.\n\t\taLangErrorText = [\"Pas assez de ressources\", \"Les ouvriers sont déjà au travail\", \"Construction complète\", \"Début de la construction\", \"Dans développement\", \"Son Dépôt de ressources est petit. Évolue son Dépôt de ressources pour continuer sa construction\", \"Son silo de céréales est petit. Évolue son Silo de céréales pour continuer sa construction\", \"Ressources suffisantes\",\"Une fête est déjà organisée\"];\n// -->> fin\n\t\taLangOtherText = [\"Il remarque important\", \"Seulement les champs de ressources du capitale <br/>peuvent être élevés à niveau 20. Son capital <br/> n'est pas décelable. S'il vous plaît il visite son profil.\", \"Raccourci ici ^_^\", \"Installation conclue\", \"Annulé\", \"Initier les tâches\", \"Upgrade avec succès\", \"Exécuter avec succès\", \"Sa race est inconnue, et son type de troupe aussi. <br/>Il visite son profil pour déterminer la race.<br/>\", \"S'il vous plaît il visite sa Manoir du héros pour déterminer<br/>la vitesse et le type de héros.\"];\n\t\taLangResources=[\"Bois\",\"Terre\",\"Fer\",\"Céréales\"];\n\t\taLangTroops[0] = [\"Légionnaire\", \"Prétorien\", \"Impérian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Bélier\", \"Catapulte de feu\", \"Sénateur\", \"Colon\", \"Héros\"];\n\t\taLangTroops[1] = [\"Combattant au gourdin\", \"Combattant à la lance\", \"Combattant à la hache\", \"Eclaireur\", \"Paladin\", \"Cavalier Teuton\", \"Bélier\", \"Catapulte\", \"Chef de tribu\", \"Colon\", \"Héros\"];\n\n// <-- NE PAS modifier // Utilisé dans plannification d'attaque, dans recherche de niveau suppèrieur / NO CHANGE !!\n\t\taLangTroops[2] = [\"Phalange\", \"Combattant à l'épée\", \"Eclaireur\", \"Eclair de Toutatis\", \"Cavalier druide\", \"Hédouin\", \"Bélier\", \"Catapulte de Guerre\", \"Chef\", \"Colon\", \"Héros\"];\n// original\taLangTroops[2] = [\"Phalange\", \"Combattant à l'épée\", \"Eclaireur\", \"Eclair de Toutatis\", \"Cavalier druide\", \"Hédouin\", \"Bélier\", \"Catapulte de Guerre\", \"Chef\", \"Colon\", \"Héros\"];\n\n// <-- Peu être modifié // Label des taches / CAN BE CHANGE\n// original\taLangAttackType = [\"Assistance\", \"Attaque\", \"Pillage\"];\n\t\taLangAttackType = [\"Ass.\", \"Att.\", \"Pill.\"];\n// -->\t\t\n\t\tbreak;\n// -------------------------------------------------------------------------------------------------------------------------------\n\n\tcase \"cc\": // 2011.02.13 -- yesren\n\tcase \"cn\": // 感谢K.C.Alvis\n\t\taLangAllBuildWithId = [\"伐木场\", \"黏土矿\", \"铁矿场\", \"农场\", \"\", \"木材厂\", \"砖块厂\", \"铸造厂\", \"磨坊\", \"面包房\", \"仓库\", \"粮仓\", \"铁匠铺\", \"军械库\", \"竞技场\", \"中心大楼\", \"集结点\", \"市场\", \"大使馆\", \"兵营\", \"马厩\", \"工场\", \"研发所\", \"山洞\", \"市政厅\", \"行宫\", \"皇宫\", \n\t\t\t\"宝库\", \"交易所\", \"大兵营\", \"大马厩\", \"罗马城墙\", \"日尔曼城墙\", \"高卢城墙\", \"石匠铺\", \"酿酒厂\", \"陷阱机\", \"英雄园\", \"大仓库\", \"大粮仓\", \"世界奇观\", \"饮马槽\"];\n\t\taLangAllBuildAltWithId = [\"伐木场\", \"黏土矿\", \"铁矿场\", \"农场\", \"\", \"木材厂\", \"砖块厂\", \"铸造厂\", \"磨坊\", \"面包房\", \"仓库\", \"粮仓\", \"铁匠铺\", \"军械库\", \"竞技场\", \"中心大楼\", \"集结点\", \"市场\", \"大使馆\", \"兵营\", \"马厩\", \"工场\", \"研发所\", \"山洞\", \"市政厅\", \"行宫\", \"皇宫\", \n\t\t\t\"宝库\", \"交易所\", \"大兵营\", \"大马厩\", \"罗马城墙\", \"日尔曼城墙\", \"高卢城墙\", \"石匠铺\", \"酿酒厂\", \"陷阱机\", \"英雄园\", \"大仓库\", \"大粮仓\", \"世界奇观\", \"饮马槽\"];\n\t\taLangAddTaskText = [\"添加任务\", \"任务类型\", \"所在村\", \"任务对象\", \"目标\", \"模式\", \"支援建设\", \"资源集中\", \"上移\", \"下移\", \"删除\", \"任务内容\", \"移动\", \"清除所有任务\"];\n\t\taLangTaskKind = [\"升级\", \"新建\", \"攻击\", \"研发\", \"训练\", \"运输\", \"活动\", \"拆除\", \"定制运输\"];\n\t\taLangGameText = [\"等级\", \"商人\", \"坑号\", \"主村\", \"执行时间\", \"此时间设置目前无效\", \"到\", \"村庄\", \"运送\", \"回来\", \"向\", \"来自于\", \"从\", \"资源\", \"建筑\", \"建造新的建筑\", \"空\", \"等级\"];\n\t\taLangRaceName = [\"罗马人\", \"日尔曼人\", \"高卢人\"];\n\t\taLangTaskOfText = [\"预定升级\", \"预定新建\", \"资源自动升级\", \"尚未开启\", \"马上开启\", \"已经开启\", \"点击关闭\", \"该村资源田分布\", \"自动运输\", \"自动运输尚未设定\", \"已设定\", \"运送成功\", \"任务列表\", \"资源输入限额\", \"默认\", \"更改\", \"木/泥/铁\", \"粮食\", \"预定拆除\",\n\t\t\t\"预定发兵\", \"攻击类型\", \"到达所需时间\", \"重复次数\", \"间隔时间\", \"00:30:00\", \"投石目标\", \"随机\", \"未知\", \"次\", \"月\", \"日\", \"部队已发出\",\"预定训练\",\"训练设施\",\"训练任务已执行\",\"定制运输\",\"设定页面刷新间隔\",\n\t\t\t\"页面刷新的间隔时间,是指隔多久执行一次页面的自动载入。\\n此时间过短,会增加被系统侦测到的危险,过长则影响任务执行的效率。\\n默认为20分钟,请输入新的时间间隔:\\n\\n\",\"资源输出保留\",\"预定活动\",\"小型活动\",\"大型活动\",\"资源集中模式的运输间隔\",\n\t\t\t\"分钟\",\"暂停中\",\"开启中\",\"开启\",\"暂停\",\"预定改良\",\"改良攻击\",\"改良防御\", \"资源过剩检查\", \"已经开启\", \"已经关闭\", \"粮田自动升级\", \"切换\"];\n\t\taLangErrorText = [\"资源不足\", \"已经有建筑在建造中\", \"建造完成\", \"将马上开始全部建造\", \"在开发中\", \"建造所需资源超过仓库容量上限,请先升级你的仓库\", \"建造所需资源超过粮仓容量上限,请先升级你的粮仓\", \"资源何时充足时间提示\",\"粮食产量不足: 需要先建造一个农场\",\"一个活动正在举行中\"];\n\t\taLangOtherText = [\"重要提示\", \"只有主村的资源田可以升级到20,<br />目前主村尚未识别,点击个人资料<br />页面可以解决这一问题\", \"五星级传送门^_^\", \"已经设置完成\", \"已经取消\", \"开始执行任务\", \"升级成功\", \"已顺利执行\", \"种族尚未确认,兵种也就无法确定,<br />请点击个人资料页面,以便侦测种族\", \"然后,请顺便访问英雄园,以便确认<br />英雄的种类和速度。<br />\"];\n\t\taLangResources=[\"木材\",\"泥土\",\"铁块\",\"粮食\"];\n\t\taLangTroops[0] = [\"古罗马步兵\", \"禁卫兵\", \"帝国兵\", \"使节骑士\", \"帝国骑士\", \"将军骑士\", \"冲撞车\", \"火焰投石器\", \"参议员\", \"拓荒者\", \"英雄\"];\n\t\taLangTroops[1] = [\"棍棒兵\", \"矛兵\", \"斧头兵\", \"侦察兵\", \"圣骑士\", \"日耳曼骑兵\", \"冲撞车\", \"投石器\", \"执政官\", \"拓荒者\", \"英雄\"];\n\t\taLangTroops[2] = [\"方阵兵\", \"剑士\", \"探路者\", \"雷法师\", \"德鲁伊骑兵\", \"海顿圣骑士\", \"冲撞车\", \"投石器\", \"首领\", \"拓荒者\", \"英雄\"];\n\t\taLangAttackType = [\"支援\", \"攻击\", \"抢夺\"];\n\t\tbreak;\n\t\t\n\tcase \"hk\": // 感谢sean3808、K.C.Alvis\n\t\taLangAllBuildWithId = [\"伐木場\", \"泥坑\", \"鐵礦場\", \"農場\",\"\", \"鋸木廠\", \"磚廠\", \"鋼鐵鑄造廠\", \"麵粉廠\", \"麵包店\", \"倉庫\", \"穀倉\", \"鐵匠\", \"盔甲廠\", \"競技場\", \"村莊大樓\", \"集結點\", \"市場\", \"大使館\", \"兵營\", \"馬棚\", \"工場\", \"研究院\", \"山洞\", \"村會堂\", \"行宮\", \"皇宮\", \"寶物庫\", \"交易所\", \"大兵營\", \"大馬棚\", \"城牆\", \"土牆\", \"木牆\", \"石匠鋪\", \"釀酒廠\", \"陷阱\", \"英雄宅\", \"大倉庫\", \"大穀倉\", \"世界奇觀\", \"放牧水槽\"];\n\t\taLangAllBuildAltWithId = [\"伐木場\", \"泥坑\", \"鐵礦場\", \"農場\",\"\", \"鋸木廠\", \"磚廠\", \"鋼鐵鑄造廠\", \"麵粉廠\", \"麵包店\", \"倉庫\", \"穀倉\", \"鐵匠\", \"盔甲廠\", \"競技場\", \"村莊大樓\", \"集結點\", \"市場\", \"大使館\", \"兵營\", \"馬棚\", \"工場\", \"研究院\", \"山洞\", \"城鎮廳\", \"行宮\", \"皇宮\", \"寶物庫\", \"交易所\", \"大兵營\", \"大馬棚\", \"城牆\", \"土牆\", \"木牆\", \"石匠鋪\", \"釀酒廠\", \"陷阱機\", \"英雄宅\", \"大倉庫\", \"大穀倉\", \"世界奇觀\", \"放牧水槽\"];\n\t\taLangAddTaskText = [\"添加任務\", \"任務類型\", \"所在村\", \"任務對象\", \"目標\", \"模式\", \"支援建設\", \"資源集中\", \"上移\", \"下移\", \"刪除\", \"任務內容\", \"移動\", \"清除所有任務\"];\n\t\taLangTaskKind = [\"升級\", \"新建\", \"攻擊\", \"研發\", \"訓練\", \"運輸\", \"平倉\", \"拆除\", \"活動\"];\n\t\taLangGameText = [\"等級\", \"商人\", \"坑號\", \"主村\", \"執行時間\", \"該時間設置尚未啟用\", \"到\", \"村莊\", \"運送\", \"回來\", \"運輸到\", \"從\", \"由\", \"資源\", \"建築\", \"建造新的建築物\", \"empty\", \"等級\"];\n\t\taLangRaceName = [\"羅馬人\", \"條頓人\", \"高盧人\"];\n\t\taLangTaskOfText = [\"預定升級\", \"預定建築\", \"資源自動升級\", \"尚未開啟\", \"馬上開啟\", \"已經開啟\", \"點擊關閉\", \"該村資源分布\", \"自動運輸\", \"自動運輸尚未設定\", \"已設定\", \"運送成功\", \"任務列表\", \"資源輸入限額\", \"默認\", \"更改\", \"木/磚/鐵\", \"穀物\", \"預定拆除\",\n\t\t\t\"預定發兵\", \"攻擊類型\", \"到達所需時間\", \"重複次數\", \"間隔時間\", \"00:30:00\", \"投石目標\", \"隨機\", \"未知\", \"次\", \"月\", \"日\", \"部隊已發出\",\"預定訓練\",\"訓練設施\",\"訓練任務已執行\",\"定制運輸\",\"設定頁面刷新間隔\",\"頁面刷新的間隔時間,是指隔多久執行一次頁面的自動載入。\\n此時間過短,會增加被系統偵測到的危險,過長則影響任務執行的效率。\\n默認為20分鐘,請輸入新的時間間隔:\\n\\n\",\"資源輸出保留\",\"預定活動\",\"小型活動\",\"大型活動\",\"資源集中模式的間隔時間\",\n\t\t\t\"分鐘\",\"暫停中\",\"開啟中\",\"開啟\",\"暫停\",\"預定改良\",\"改良攻擊\",\"改良防御\", \"資源過剩檢查\", \"已經開啟\", \"已經關閉\", \"糧田自動升級\", \"切換\"];\n\t\taLangErrorText = [\"資源不足\", \"工作正在進行中\", \"完全地開發\", \"將馬上開始全部建造\", \"在開發中\", \"倉庫需要升級\", \"糧倉需要升級\", \"資源何時充足時間提示\",\"糧食產量不足: 需要先建造一個農場\",\"派對進行中\"];\n\t\taLangOtherText = [\"重要提示\", \"只有主村的資源田可以升級到20,<br/>目前主村尚未識別,點擊個人資料<br/>頁面可以解決這一問題\", \"五星級傳送門^_ ^\", \"已經設置完成\", \"已經取消\", \"開始執行任務\", \"升級成功\", \"已順利執行\", \"種族尚未確認,兵種也就無法確定,<br/>請點擊個人資料頁面,以便偵測種族\", \"然後,請順便訪問英雄園,以便確認<br/>英雄的種類和速度。<br/>\"];\n\t\taLangResources=[\"木材\",\"磚塊\",\"鋼鐵\",\"穀物\"];\n\t\taLangTroops[0] = [\"古羅馬步兵\", \"禁衛兵\", \"帝國兵\", \"使者騎士\", \"帝國騎士\", \"將軍騎士\", \"衝撞車\", \"火焰投石機\", \"參議員\", \"開拓者\", \"英雄\"];\n\t\taLangTroops[1] = [\"棍棒兵\", \"矛兵\", \"斧頭兵\", \"偵察兵\", \"遊俠\", \"條頓騎士\", \"衝撞車\", \"投石機\", \"司令官\", \"開拓者\", \"英雄\"];\n\t\taLangTroops[2] = [\"方陣兵\", \"劍士\", \"探路者\", \"雷法師\", \"德魯伊騎兵\", \"海頓聖騎\", \"衝撞車\", \"投石機\", \"族長\", \"開拓者\", \"英雄\"];\n\t\taLangAttackType = [\"支援\", \"攻擊\", \"搶奪\"];\n\t\tbreak;\n\n\tcase \"tw\": // 感谢adobe、魎皇鬼、ieyp、K.C.Alvis\n\t\taLangAllBuildWithId = [\"伐木場\", \"泥坑\", \"鐵礦場\", \"農場\", \"農田\", \"鋸木廠\", \"磚廠\", \"鋼鐵鑄造廠\", \"麵粉廠\", \"麵包店\", \"倉庫\", \"穀倉\", \"鐵匠\", \"盔甲廠\", \"競技場\", \"村莊大樓\", \"集結點\", \"市場\", \"大使館\", \"兵營\", \"馬廄\", \"工場\", \"研究院\", \"山洞\", \"村會堂\", \"行宮\", \"皇宮\", \"寶物庫\", \"交易所\", \"大兵營\", \"大馬廄\", \"城牆\", \"土牆\", \"木牆\", \"石匠舖\", \"釀酒廠\", \"陷阱機\", \"英雄宅\", \"大倉庫\", \"大穀倉\", \"世界奇觀\", \"放牧水槽\"];\n\t\taLangAllBuildAltWithId = [\"伐木場\", \"泥坑\", \"鐵礦場\", \"農場\", \"農田\", \"鋸木廠\", \"磚廠\", \"鋼鐵鑄造廠\", \"麵粉廠\", \"麵包店\", \"倉庫\", \"穀倉\", \"鐵匠\", \"盔甲廠\", \"競技場\", \"村莊大樓\", \"集結點\", \"市場\", \"大使館\", \"兵營\", \"馬廄\", \"工場\", \"研究院\", \"山洞\", \"村會堂\", \"行宮\", \"皇宮\", \"寶物庫\", \"交易所\", \"大兵營\", \"大馬廄\", \"城牆\", \"土牆\", \"木牆\", \"石匠舖\", \"釀酒廠\", \"陷阱機\", \"英雄宅\", \"大倉庫\", \"大穀倉\", \"世界奇觀\", \"放牧水槽\"];\n\t\taLangAddTaskText = [\"添加任務\", \"任務類型\", \"所在村\", \"任務對象\", \"目標\", \"模式\", \"支援建設\", \"資源集中\", \"上移\", \"下移\", \"刪除\", \"任務內容\", \"移動\", \"清除所有任務\"];\n\t\taLangTaskKind = [\"升級\", \"新建\", \"攻擊\", \"研發\", \"訓練\", \"運輸\", \"平倉\", \"拆除\", \"活動\"];\n\t\taLangGameText = [\"等級\", \"商人\", \"坑號\", \"主村\", \"執行時間\", \"該時間設置尚未啟用\", \"到\", \"村莊\", \"運送\", \"回來\", \"運送到\", \"從\", \"由\", \"資源\", \"建築\", \"建造新的建築物\", \"empty\", \"等級\"];\n\t\taLangRaceName = [\"羅馬人\", \"條頓人\", \"高盧人\"];\n\t\taLangTaskOfText = [\"預定升級\", \"預定建築\", \"資源自動升級\", \"尚未開啟\", \"馬上開啟\", \"已經開啟\", \"點擊關閉\", \"該村資源分布\", \"自動運輸\", \"自動運輸尚未設定\", \"已設定\", \"運送成功\", \"任務列表\", \"資源輸入限額\", \"默認\", \"更改\", \"木/磚/鐵\", \"穀物\", \"預定拆除\",\n\t\t\t\"預定發兵\", \"攻擊類型\", \"到達所需時間\", \"重複次數\", \"間隔時間\", \"00:30:00\", \"投石目標\", \"隨機\", \"未知\", \"次\", \"月\", \"日\", \"部隊已發出\",\"預定訓練\",\"訓練設施\",\"訓練任務已執行\",\"定制運輸\",\"設定頁面刷新間隔\",\"頁面刷新的間隔時間,是指隔多久執行一次頁面的自動載入。\\n此時間過短,會增加被系統偵測到的危險,過長則影響任務執行的效率。\\n默認為20分鐘,請輸入新的時間間隔:\\n\\n\",\"資源輸出保留\",\"預定活動\",\"小型活動\",\"大型活動\",\"資源集中模式的間隔時間\",\n\t\t\t\"分鐘\",\"暫停中\",\"開啟中\",\"開啟\",\"暫停\",\"預定改良\",\"改良攻擊\",\"改良防御\", \"資源過剩檢查\", \"已經開啟\", \"已經關閉\", \"糧田自動升級\", \"切換\"];\n\t\taLangErrorText = [\"資源不足\", \"已經有建築在建造中\", \"建造完成\", \"將馬上開始全部建造\", \"在開發中\", \"建造所需資源超過倉庫容量上限,請先升級你的倉庫\", \"建造所需資源超過糧倉容量上限,請先升級你的糧倉\", \"資源何時充足時間提示\",\"糧食產量不足: 需要先建造一個農場\",\"派對進行中\"];\n\t\taLangOtherText = [\"重要提示\", \"只有主村的資源田可以升級到20,<br/>目前主村尚未識別,點擊個人資料<br/>頁面可以解決這一問題\", \"五星級傳送門^_ ^\", \"已經設置完成\", \"已經取消\", \"開始執行任務\", \"升級成功\", \"已順利執行\", \"種族尚未確認,兵種也就無法確定,<br/>請點擊個人資料頁面,以便偵測種族\", \"然後,請順便訪問英雄園,以便確認<br/>英雄的種類和速度。<br/>\"];\n\t\taLangResources=[\"木材\",\"磚塊\",\"鋼鐵\",\"穀物\"];\n\t\taLangTroops[0] = [\"古羅馬步兵\", \"禁衛兵\", \"帝國兵\", \"使者騎士\", \"帝國騎士\", \"將軍騎士\", \"衝撞車\", \"火焰投石機\", \"參議員\", \"開拓者\", \"英雄\"];\n\t\taLangTroops[1] = [\"棍棒兵\", \"矛兵\", \"斧頭兵\", \"偵察兵\", \"遊俠\", \"條頓騎士\", \"衝撞車\", \"投石機\", \"司令官\", \"開拓者\", \"英雄\"];\n\t\taLangTroops[2] = [\"方陣兵\", \"劍士\", \"探路者\", \"雷法師\", \"德魯伊騎兵\", \"海頓聖騎\", \"衝撞車\", \"投石機\", \"族長\", \"開拓者\", \"英雄\"];\n\t\taLangAttackType = [\"支援\", \"攻擊\", \"搶奪\"];\n\t\tbreak;\n\n\tcase \"fi\": // thanks Christer82\n\t\taLangAllBuildWithId = [\"Puunhakkaaja\", \"Savimonttu\", \"Rautakaivos\", \"Viljapelto\", \"\", \"Saha\", \"Tiilitehdas\", \"Rautavalimo\", \"Mylly\", \"Leipomo\", \"Varasto\", \"Viljasiilo\", \"Aseseppä\", \"Haarniskapaja\", \"Turnausareena\", \"Päärakennus\", \"Kokoontumispiste\", \"Tori\", \"Lähetystö\", \"Kasarmi\", \"Talli\", \"Työpaja\", \"Akatemia\", \"Kätkö\", \"Kaupungintalo\", \"Virka-asunto\", \"Palatsi\", \"Aarrekammio\", \"Kauppavirasto\", \"Suuri kasarmi\", \"Suuri talli\", \"Kaupungin muuri\", \"Maamuuri\", \"Paaluaita\", \"Kivenhakkaaja\", \"Panimo\", \"Ansoittaja\",\"Sankarin kartano\", \"Suuri varasto\", \"Suuri viljasiilo\", \"Maailmanihme\", \"Hevostenjuottoallas\"];\n\t\taLangAllBuildAltWithId = [\"Puunhakkaaja\", \"Savimonttu\", \"Rautakaivos\", \"Viljapelto\", \"\", \"Saha\", \"Tiilitehdas\", \"Rautavalimo\", \"Mylly\", \"Leipomo\", \"Varasto\", \"Viljasiilo\", \"Aseseppä\", \"Haarniskapaja\", \"Turnausareena\", \"Päärakennus\", \"Kokoontumispiste\", \"Tori\", \"Lähetystö\", \"Kasarmi\", \"Talli\", \"Työpaja\", \"Akatemia\", \"Kätkö\", \"Kaupungintalo\", \"Virka-asunto\", \"Palatsi\", \"Aarrekammio\", \"Kauppavirasto\", \"Suuri kasarmi\", \"Suuri talli\", \"Kaupungin muuri\", \"Maamuuri\", \"Paaluaita\", \"Kivenhakkaaja\", \"Panimo\", \"Ansoittaja\",\"Sankarin kartano\", \"Suuri varasto\", \"Suuri viljasiilo\", \"Maailmanihme\", \"Hevostenjuottoallas\"];\n\t\taLangAddTaskText = [\"Lisää tehtävä\", \"Tyyli\", \"Kohdistettu kylä\", \"Tehtävän kohde\", \"Minne:\", \"Tyyppi\", \"Rakennustuki\", \"Resurssien keskittäminen\", \"Siirry ylös\", \"Siirry alas\", \"Poista\", \"&#160;&#160;&#160;Tehtävän sisältö\", \"Siirry \", \"Poista kaikki tehtävät\"];\n\t\taLangTaskKind = [\"Päivitä\", \"Uusi rakennus\", \"Hyökkäys\", \"Tutkimus\", \"Koulutus\", \"Kuljetus\", \"NPC\", \"Hajotus\", \"Juhla\"];\n\t\taLangGameText = [\"Taso\", \"Kauppiaat\", \"ID\", \"Pääkaupunki\", \"Aloitusaika\", \"Tätä aika-asetusta ei voi nyt käyttää.\", \"minne:\", \"Kylä\", \"kuljetus\", \"mistä\", \"Kuljeta kylään\", \"Kuljeta kylästä\", \"Palaa kylästä\", \"Resurssit\", \"rakennus\", \"Rakenna uusi rakennus\", \"tyhjä\", \"taso\"];\n\t\taLangRaceName = [\"Roomalaiset\", \"Teutonit\", \"Gallialaiset\"];\n\t\taLangTaskOfText = [\"Aseta kentän päivitys\", \"Aseta uusi rakennuskohde\", \"Automaattinen resurssipäivitys\", \"Ei toimintaa\", \"Aloita\", \"Aloitettu\", \"Keskeytä\", \"Tämän kylän resurssikenttien jakauma on \", \"Automaattikuljetus\", \"automaattikuljetusta ei ole avattu\", \"Avattu\", \"Kuljetus onnistui\", \"Tehtäväluettelo\", \"Trans_In_limit\", \"Perusasetus\", \"Muokkaa\", \"Puu/Savi/Rauta\", \"vilja\", \"Tehtävälistan poisto\",\n\t\t\t\"Schedule attack\", \"Hyökkäystyyppi\", \"Kuljetusaika\", \"toistokerrat\", \"Hyökkäysaikaväli\",\"00:30:00\",\"Katapultin kohde\",\"Satunnainen\", \"Tuntematon\", \"kertaa\", \"Kuukausi\", \"Päivä\", \"Joukot on lähetetty\",\"Aseta koulutustehtävä\",\"Koulutuskohde\",\"Koulutustehtävä suoritettu\",\"waitForTranslate\",\"setup Hyökkäysaikaväli of reload\",\"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans_Out_Rmn\",\"ScheduleParty\",\"small party\",\"big party\",\"setInterval of Resources concentration\",\n\t\t\t\"minutes\",\"pausing\",\"running\",\"run\",\"pause\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Liian vähän resursseja\", \"Työntekijät ovat jo töissä.\", \"Rakennuskohde valmis\", \"Aloitetaan rakentaminen\", \"Työ kesken\", \"Varastosi on liian pieni. Suurenna varastoa aloittaaksesi rakentamisen\", \"Viljasiilosi on liian pieni. Suurenna viljasiiloa aloittaaksesi rakentamisen\", \"Riittävästi resursseja\"];\n\t\taLangOtherText = [\"Tärkeä huomautus\", \"Vain pääkaupungin resurssikenttiä voidaan <br/>päivittää tasolle 20. Nyt pääkaupunkia<br/> ei voida todentaa. Päivitä profiiliasi, kiitos.\", \"Pikalinkki tähän ^_^\", \"Asennus valmis\", \"Peruttu\", \"Aloita tehtävät\", \"Päivitys valmis\", \"Tehty onnistuneesti\", \"Heimosi on määrittämätön, siksi joukkojesi tyyppiä <br/>Päivitä profiiliasi heimon määrittämiseksi.<br/>\", \"Käy Sankarin kartanossa määrittääksesi<br/> sankarisi tyypin ja nopeuden.\"];\n\t\taLangResources=[\"waitTranslate\",\"waitTranslate\",\"waitTranslate\",\"waitTranslate\"];\n\t\taLangTroops[0] = [\"Legioonalainen\", \"Pretoriaani\", \"Imperiaani\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Muurinmurtaja\", \"Tulikatapultti\", \"Senaattori\", \"Uudisasukas\", \"Sankari\"];\n\t\taLangTroops[1] = [\"Nuijamies\", \"Keihäsmies\", \"Kirvessoturi\", \"Tiedustelija\", \"Paladiini\", \"Teutoniritari\", \"Muurinmurtaja\", \"Katapultti\", \"Päällikkö\", \"Uudisasukas\", \"Sankari\"];\n\t\taLangTroops[2] = [\"Falangi\", \"Miekkasoturi\", \"Tunnustelija\", \"Teutateksen salama\", \"Druidiratsastaja\", \"Haeduaani\", \"Muurinmurtaja\", \"Heittokone\", \"Päällikkö\", \"Uudisasukas\", \"Sankari\"];\n\t\taLangAttackType = [\"Vahvistus\", \"Hyökkäys\", \"Ryöstö\"];\n\t\tbreak;\n\n\tcase \"us\": // by shadowx360\n\t\taLangAllBuildWithId = [\"Woodcutter\", \"Clay Pit\", \"Iron Mine\", \"Wheat Field\", \"\", \"Sawmill\", \"Brickworks\", \"Iron Foundry\", \"Flour Mill\", \"Bakery\", \"Warehouse\", \"Granary\", \"Blacksmith\", \"Armory\", \"Tournament Square\", \"Main Building\", \"Rally Point\", \"Marketplace\", \"Embassy\", \"Barracks\", \"Stable\", \"Siege Workshop\", \"Academy\", \"Cranny\", \"Town Hall\", \"Residence\", \"Palace\", \"Treasury\", \"Trade Office\", \"Great Barracks\", \"Great Stable\", \"City Wall\", \"Earth Wall\", \"Palisade\", \"Stonemason's Lodge\", \"Brewery\", \"Trapper\",\"Hero's Mansion\", \"Great Warehouse\", \"Great Granary\", \"Wonder Of The World\", \"Horse Drinking Pool\"];\n\t\taLangAllBuildAltWithId = [\"Woodcutter\", \"Clay Pit\", \"Iron Mine\", \"Wheat Field\", \"\", \"Sawmill\", \"Brickworks\", \"Iron Foundry\", \"Flour Mill\", \"Bakery\", \"Warehouse\", \"Granary\", \"Blacksmith\", \"Armory\", \"Tournament Square\", \"Main Building\", \"Rally Point\", \"Marketplace\", \"Embassy\", \"Barracks\", \"Stable\", \"Siege Workshop\", \"Academy\", \"Cranny\", \"Town Hall\", \"Residence\", \"Palace\", \"Treasury\", \"Trade Office\", \"Great Barracks\", \"Great Stable\", \"City Wall\", \"Earth Wall\", \"Palisade\", \"Stonemason's Lodge\", \"Brewery\", \"Trapper\",\"Hero's Mansion\", \"Great Warehouse\", \"Great Granary\", \"Wonder Of The World\", \"Horse Drinking Pool\"];\n\t\taLangAddTaskText = [\"Add task\", \"Style\", \"Active village\", \"Task target\", \"To\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \" Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\taLangTaskKind = [\"Upgrade\", \"NewBuild\", \"Attack\", \"Research\", \"Train\", \"Transport\", \"NPC\", \"Demolish\", \"Celebration\"];\n\t\taLangGameText = [\"Lvl\", \"Merchants\", \"ID\", \"Capital\", \"Start time\", \"this timeseting is notuseful now.\", \"to\", \"Village\", \"transport\", \"from\", \"Transport to\", \"Transport from\", \"Return from\", \"resources\", \"building\", \"Construct a new building\", \"empty\", \"level\"];\n\t\taLangRaceName = [\"Romans\", \"Teutons\", \"Gauls\"];\n\t\taLangTaskOfText = [\"Schedule Upgrade\", \"Schedule NewBuild\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Task List\", \"Trans In limit\", \"Default\", \"Modify\", \"Wood/Clay/Iron\", \"Wheat\", \"Schedule demolition\",\n\t\t\t\"Schedule attack\", \"Attack type\", \"Travel time\", \"repeat times\", \"interval time\",\"00:30:00\",\"Catapult target\",\"Random\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Troops sent\",\n\t\t\t\"Schedule Train\", \"Train site\", \"TrainTask done\", \"customTransport\", \"setup interval time of reload\",\"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans Out Rmn\",\"ScheduleParty\",\"small party\",\"big party\",\"setInterval of Resources concentration\",\n\t\t\t\"minutes\", \".\",\".\",\"START\",\"STOP\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Too few resources.\", \"Your builders are already working\", \"completely upgraded\", \"Starting construction\", \"In development\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"Enough resources\",\"Lack of food: extend cropland first\",\"There is already a celebration going on\"];\n\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can <br/>be upgraded to level 20. Now your capital<br/> is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. <br/>Visit your Profile to determine your race.<br/>\", \"Please also visit your Hero's Mansion to determine<br/> the speed and the type of your hero.\" , \"Upgrade\"];\n\t\taLangResources=[\"lumber\",\"clay\",\"iron\",\"wheat\"];\n\t\taLangTroops[0] = [\"Legionnaire\", \"Praetorian\", \"Imperian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Battering Ram\", \"Fire Catapult\", \"Senator\", \"Settler\", \"Hero\"];\n\t\taLangTroops[1] = [\"Clubswinger\", \"Spearman\", \"Axeman\", \"Scout\", \"Paladin\", \"Teutonic Knight\", \"Ram\", \"Catapult\", \"Chief\", \"Settler\", \"Hero\"];\n\t\taLangTroops[2] = [\"Phalanx\", \"Swordsman\", \"Pathfinder\", \"Theutates Thunder\", \"Druidrider\", \"Haeduan\", \"Ram\", \"Trebuchet\", \"Chieftain\", \"Settler\", \"Hero\"];\n\t\taLangAttackType = [\"Reinforce\", \"Attack\", \"Raid\"];\n\t\tbreak;\n\n\tcase \"in\":\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": // translations for travian version 3.6\n\t\t\t\taLangAllBuildWithId = [\"Woodcutter\", \"Clay Pit\", \"Iron Mine\", \"Wheat Field\", \"\", \"Sawmill\", \"Brickworks\", \"Iron Foundry\", \"Flour Mill\", \"Bakery\", \"Warehouse\", \"Granary\", \"Blacksmith\", \"Armoury\", \"Tournament Square\", \"Main Building\", \"Rally Point\", \"Marketplace\", \"Embassy\", \"Barracks\", \"Stable\", \"Siege Workshop\", \"Academy\", \"Cranny\", \"City Hall\", \"Residence\", \"Palace\", \"Treasure Chamber\", \"Trade Office\", \"Great Barracks\", \"Great Stable\", \"City Wall\", \"Earth Wall\", \"Palisade\", \"Stonemason\", \"Brewery\", \"Trapper\", \"Hero's Mansion\", \"Great Warehouse\", \"Great Granary\", \"Wonder Of The World\", \"Horse Drinking Pool\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Woodcutter\", \"Clay Pit\", \"Iron Mine\", \"Wheat Field\", \"\", \"Sawmill\", \"Brickworks\", \"Iron Foundry\", \"Flour Mill\", \"Bakery\", \"Warehouse\", \"Granary\", \"Blacksmith\", \"Armoury\", \"Tournament Square\", \"Main Building\", \"Rally Point\", \"Marketplace\", \"Embassy\", \"Barracks\", \"Stable\", \"Siege Workshop\", \"Academy\", \"Cranny\", \"City Hall\", \"Residence\", \"Palace\", \"Treasure Chamber\", \"Trade Office\", \"Great Barracks\", \"Great Stable\", \"City Wall\", \"Earth Wall\", \"Palisade\", \"Stonemason\", \"Brewery\", \"Trapper\", \"Hero's Mansion\", \"Great Warehouse\", \"Great Granary\", \"Wonder Of The World\", \"Horse Drinking Pool\"];\n\t\t\t\taLangAddTaskText = [\"Add task\", \"Style\", \"Active village\", \"Task target\", \"To\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \"&#160;&#160;&#160;Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\t\t\taLangTaskKind = [\"Upgrade\", \"NewBuild\", \"Attack\", \"Research\", \"Train\", \"Transport\", \"NPC\", \"Demolish\", \"Celebration\"];\n\t\t\t\taLangGameText = [\"Lvl\", \"Merchants\", \"ID\", \"Capital\", \"Start time\", \"this timeseting is unuseful now.\", \"to\", \"Village\", \"transport\", \"from\", \"Transport to\", \"Transport from\", \"Return from\", \"resources\", \"building\", \"Construct a new building\", \"empty\", \"level\"];\n\t\t\t\taLangRaceName = [\"Romans\", \"Teutons\", \"Gauls\"];\n\t\t\t\taLangTaskOfText = [\"Schedule Upgrade\", \"Schedule NewBuild\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Task List\", \"Trans In limit\", \"Default\", \"Modify\", \"Wood/Clay/Iron\", \"Crop\", \"Schedule demolition\",\n\t\t\t\t\t\t\"Schedule attack\", \"Attack type\", \"Travel time\", \"repeat times\", \"interval time\", \"00:30:00\", \"Catapult target\", \"Random\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Troops sent\",\n\t\t\t\t\t\t\"Schedule Train\", \"Train site\", \"TrainTask done\", \"customTransport\", \"setup interval time of reload\", \"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\", \"Trans Out Rmn\", \"ScheduleParty\", \"small party\", \"big party\", \"setInterval of Resources concentration\",\n\t\t\t\t\t\t\"minutes\", \".\", \".\", \"START\", \"STOP\", \"Schedule Improve\", \"Improve Attack\", \"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"Too few resources.\", \"Your workers are already building something.\", \"Construction completed\", \"Starting construction\", \"In development\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"Enough resources\", \"Food shortage: Upgrade a wheat field first\", \"There is already a celebration going on\"];\n\t\t\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can <br/>be upgraded to level 20. Now your capital<br/> is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. <br/>Visit your Profile to determine your race.<br/>\", \"Please also visit your Hero's Mansion to determine<br/> the speed and the type of your hero.\" , \"Upgrade\"];\n\t\t\t\taLangResources = [\"lumber\", \"clay\", \"iron\", \"crop\"];\n\t\t\t\taLangTroops[0] = [\"Legionnaire\", \"Praetorian\", \"Imperian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Battering Ram\", \"Fire Catapult\", \"Senator\", \"Settler\", \"Hero\"];\n\t\t\t\taLangTroops[1] = [\"Clubswinger\", \"Spearman\", \"Axeman\", \"Scout\", \"Paladin\", \"Teutonic Knight\", \"Ram\", \"Catapult\", \"Chief\", \"Settler\", \"Hero\"];\n\t\t\t\taLangTroops[2] = [\"Phalanx\", \"Swordsman\", \"Pathfinder\", \"Theutates Thunder\", \"Druidrider\", \"Haeduan\", \"Ram\", \"Trebuchet\", \"Chieftain\", \"Settler\", \"Hero\"];\n\t\t\t\taLangAttackType = [\"Reinforce\", \"Attack\", \"Raid\"];\n\t\t\t\tbreak;\n\t\t\tcase \"4.0\": // translations for travian version 4.0\n\t\t\t\taLangAllBuildWithId = [\"Woodcutter\", \"Clay Pit\", \"Iron Mine\", \"Wheat Field\", \"Place for new building\", \"Sawmill\", \"Brickworks\", \"Iron Foundry\", \"Flour Mill\", \"Bakery\", \"Warehouse\", \"Granary\", \"Blacksmith\", \"Smithy\", \"Tournament Square\", \"Main Building\", \"Rally Point\", \"Marketplace\", \"Embassy\", \"Barracks\", \"Stable\", \"Siege Workshop\", \"Academy\", \"Cranny\", \"City Hall\", \"Residence\", \"Palace\", \"Treasure Chamber\", \"Trade Office\", \"Great Barracks\", \"Great Stable\", \"City Wall\", \"Earth Wall\", \"Palisade\", \"Stonemason\", \"Brewery\", \"Trapper\", \"Hero's Mansion\", \"Great Warehouse\", \"Great Granary\", \"Wonder Of The World\", \"Horse Drinking Pool\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Woodcutter\", \"Clay Pit\", \"Iron Mine\", \"Wheat Field\", \"\", \"Sawmill\", \"Brickworks\", \"Iron Foundry\", \"Flour Mill\", \"Bakery\", \"Warehouse\", \"Granary\", \"Blacksmith\", \"Smithy\", \"Tournament Square\", \"Main Building\", \"Rally Point\", \"Marketplace\", \"Embassy\", \"Barracks\", \"Stable\", \"Siege Workshop\", \"Academy\", \"Cranny\", \"City Hall\", \"Residence\", \"Palace\", \"Treasure Chamber\", \"Trade Office\", \"Great Barracks\", \"Great Stable\", \"City Wall\", \"Earth Wall\", \"Palisade\", \"Stonemason\", \"Brewery\", \"Trapper\", \"Hero's Mansion\", \"Great Warehouse\", \"Great Granary\", \"Wonder Of The World\", \"Horse Drinking Pool\"];\n\t\t\t\taLangAddTaskText = [\"Add task\", \"Style\", \"Active village\", \"Task target\", \"To\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \"&#160;&#160;&#160;Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\t\t\taLangTaskKind = [\"Upgrade\", \"NewBuild\", \"Attack\", \"Research\", \"Train\", \"Transport\", \"NPC\", \"Demolish\", \"Celebration\"];\n\t\t\t\taLangGameText = [\"Lvl\", \"Merchants\", \"ID\", \"Capital\", \"Start time\", \"this timeseting is unuseful now.\", \"to\", \"Village\", \"transport\", \"from\", \"Transport to\", \"Transport from\", \"Return from\", \"resources\", \"building\", \"Construct a new building\", \"empty\", \"level\"];\n\t\t\t\taLangRaceName = [\"Romans\", \"Teutons\", \"Gauls\"];\n\t\t\t\taLangTaskOfText = [\"Schedule Upgrade\", \"Schedule NewBuild\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Task List\", \"Trans In limit\", \"Default\", \"Modify\", \"Wood/Clay/Iron\", \"Crop\", \"Schedule demolition\",\n\t\t\t\t\t\t\"Schedule attack\", \"Attack type\", \"Travel time\", \"repeat times\", \"interval time\", \"00:30:00\", \"Catapult target\", \"Random\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Troops sent\",\n\t\t\t\t\t\t\"Schedule Train\", \"Train site\", \"TrainTask done\", \"customTransport\", \"setup interval time of reload\", \"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\", \"Trans Out Rmn\", \"ScheduleParty\", \"small party\", \"big party\", \"setInterval of Resources concentration\",\n\t\t\t\t\t\t\"minutes\", \".\", \".\", \"START\", \"STOP\", \"Schedule Improve\", \"Improve Attack\", \"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"Too few resources.\", \"Your workers are already building something.\", \"Construction completed\", \"Starting construction\", \"In development\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"Enough resources\", \"Food shortage: Upgrade a wheat field first\", \"There is already a celebration going on\"];\n\t\t\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can <br/>be upgraded to level 20. Now your capital<br/> is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. <br/>Visit your Profile to determine your race.<br/>\", \"Please also visit your Hero's Mansion to determine<br/> the speed and the type of your hero.\" , \"Upgrade\"];\n\t\t\t\taLangResources = [\"lumber\", \"clay\", \"iron\", \"crop\"];\n\t\t\t\taLangTroops[0] = [\"Legionnaire\", \"Praetorian\", \"Imperian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Battering Ram\", \"Fire Catapult\", \"Senator\", \"Settler\", \"Hero\"];\n\t\t\t\taLangTroops[1] = [\"Clubswinger\", \"Spearman\", \"Axeman\", \"Scout\", \"Paladin\", \"Teutonic Knight\", \"Ram\", \"Catapult\", \"Chief\", \"Settler\", \"Hero\"];\n\t\t\t\taLangTroops[2] = [\"Phalanx\", \"Swordsman\", \"Pathfinder\", \"Theutates Thunder\", \"Druidrider\", \"Haeduan\", \"Ram\", \"Trebuchet\", \"Chieftain\", \"Settler\", \"Hero\"];\n\t\t\t\taLangAttackType = [\"Reinforce\", \"Attack\", \"Raid\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrowLogicError ( \"initializeLangVars():: Travian Version not set, when initializing language variables for \\'in\\'!!\" );\n\t\t}\n\t\tbreak;\n\n\tcase \"sk\": // by Zapo [ 2011.04.07 ]\n\t\taLangAllBuildWithId = [\"Drevorubač\", \"Hlinená baňa\", \"Železná baňa\", \"Obilné pole\", \"\", \"Píla\", \"Tehelňa\", \"Zlievareň\", \"Mlyn\", \"Pekáreň\", \"Sklad surovín\", \"Sýpka\", \"Kováč\", \"Zbrojnica\", \"Turnajové ihrisko\", \"Hlavná budova\", \"Zhromaždisko\", \"Trhovisko\", \"Ambasáda\", \"Kasárne\", \"Stajne\", \"Dielňa\", \"Akadémia\", \"Úkryt\", \"Radnica\", \"Rezidencia\", \"Palác\", \"Pokladnica\", \"Obchodná kancelária\", \"Veľké kasárne\", \"Veľká stajňa\", \"Mestské hradby\", \"Zemná hrádza\", \"Palisáda\", \"Kamenár\", \"Pivovar\", \"Pasti\",\"Dvor hrdinov\", \"Veľké dielne\", \"Veľká sýpka\", \"Div sveta\", \"Žriedlo\"];\n\t\taLangAllBuildAltWithId = [\"Drevorubač\", \"Hlinená baňa\", \"Železná baňa\", \"Obilné pole\", \"\", \"Píla\", \"Tehelňa\", \"Zlievareň\", \"Mlyn\", \"Pekáreň\", \"Sklad surovín\", \"Sýpka\", \"Kováč\", \"Zbrojnica\", \"Turnajové ihrisko\", \"Hlavná budova\", \"Zhromaždisko\", \"Trhovisko\", \"Ambasáda\", \"Kasárne\", \"Stajne\", \"Dielňa\", \"Akadémia\", \"Úkryt\", \"Radnica\", \"Rezidencia\", \"Palác\", \"Pokladnica\", \"Obchodná kancelária\", \"Veľké kasárne\", \"Veľká stajňa\", \"Mestské hradby\", \"Zemná hrádza\", \"Palisáda\", \"Kamenár\", \"Pivovar\", \"Pasti\",\"Dvor hrdinov\", \"Veľké dielne\", \"Veľká sýpka\", \"Div sveta\", \"Žriedlo\"];\n\t\taLangAddTaskText = [\"Pridaj úlohu\", \"Štýl\", \"Aktívna dedina\", \"Plánovaný cieľ\", \"To\", \"Mód\", \"Construction support\", \"Resources concentration\", \"Presuň hore\", \"Presuň dole\", \"Zmaž\", \" Obsah úloh\", \"Posun \", \"Zmaž všetky úlohy\"];\n\t\taLangTaskKind = [\"Upgrade\", \"Nová stavba\", \"Útok\", \"Výskum\", \"Trénovať\", \"Transport\", \"NPC\", \"Búrať\", \"Oslavy\"];\n\t\taLangGameText = [\"Lvl\", \"Obchodníci\", \"ID\", \"Hlavná dedina\", \"Start time\", \"nastavenie času je nepoužiteľný teraz.\", \"do\", \"Dedina\", \"transport\", \"od\", \"Transport do\", \"Transport od\", \"Návrat z\", \"suroviny\", \"budova\", \"Postaviť novú budovu\", \"prázdne\", \"úroveň\"];\n\t\taLangRaceName = [\"Rimania\", \"Germáni\", \"Galovia\"];\n\t\taLangTaskOfText = [\"Naplánovať Upgrade\", \"Naplánovať novú budovu\", \"Auto ResUpD\", \"Nebeží\", \"Štart\", \"Beží\", \"Suspend\", \"Surovinová distribúcia tejto dediny je \", \"Autotransport\", \"Autotransport nie je otvorený\", \"Otvorený\", \"Transport úspešný\", \"Zoznam úloh\", \"Trans In limit\", \"Default\", \"Zmeň\", \"Drevo/Hlina/Železo\", \"Obilie\", \"Naplánuj demolíciu\",\n\t\t\t\"Naplánuj útok\", \"Typ útoku\", \"Čas cesty\", \"opakovať\", \"časový interval\",\"00:30:00\",\"Cieľ Katapultu\",\"Náhodne\", \"Neznámy\", \"krát\", \"Mesiac\", \"Deň\", \"Poslať jednotky\",\n\t\t\t\"Naplánovať výcvik\",\"Výcvikové miesto\",\"Výcviková úloha hotová\",\"customTransport\",\"nastav časový interval obnovenia\",\"toto je interval obnovenia stránky ,\\n default je 20 minút, prosím vlož nový čas:\\n\\n\",\"Trans Out Rmn\",\"NaplánujOslavu\",\"malá slava\",\"veľká oslava\",\"nastavInterval surovinovej koncentrácie\",\n\t\t\t\"minút\",\"pozastavené\",\"spustené\",\"spusť\",\"pauza\",\"Naplánuj vylepšenie\",\"Vylepšiť Útok\",\"Vylepšiť Obranu\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Príliš málo surovín.\", \"Stavitelia majú momentálne veľa práce\", \"Stavanie kompletné\", \"Začína stavanie\", \"Vo vývoji\", \"Tvoj sklad je príliš malý. Prosím zvýš tvoj Sklad na pokračovanie stavania\", \"Tvoja Sýpka je príliš malá. Prosím zvýš tvoju Sýpku na pokračovanie stavania\", \"Dostatok surovín\",\"Nedostatok potravín: rozšír obilné polia najskôr!\",\"There is already a celebration going on\"];\n\t\taLangOtherText = [\"Dôležité poznámky\", \"Surovinové polia môžu byť len v hlavnej zvyšované na úroveň 20. Teraz nieje určená tvoja hlavná. Navštív tvoj Profil prosím.\", \"Skratka tu ^_^\", \"Nastavenie kompletné\", \"Zrušené\", \"Spusť úlohy\", \"Upgrade úspešný\", \"Spustenie úspešné\", \"Tvoj národ je neznámy, therefore your troop type. Navštív tvoj Profil na určenie tvojho národa.\", \"Prosím navštív tiež tvoj Dvor hrdinov na určenie rýchlosti a typu tvojho hrdinu.\"];\n\t\taLangResources = [\"drevo\",\"hlina\",\"železo\",\"obilie\"];\n\t\taLangTroops[0] = [\"Legionár\", \"Pretorián\", \"Imperián\", \"Equites Legáti\", \"Equites Imperátoris\", \"Equites Caesaris\", \"Rímske Baranidlo\", \"Ohnivý Katapult\", \"Senátor\", \"Osadník\", \"Hrdina\"];\n\t\taLangTroops[1] = [\"Pálkar\", \"Oštepár\", \"Bojovník so sekerou\", \"Špeh\", \"Rytier\", \"Teuton jazdec\", \"Germánske baranidlo\", \"Katapult\", \"Kmeňový vodca\", \"Osadník\", \"Hrdina\"];\n\t\taLangTroops[2] = [\"Falanx\", \"Šermiar\", \"Sliedič\", \"Theutates Blesk\", \"Druid jazdec\", \"Haeduan\", \"Drevené Baranidlo\", \"Vojnový Katapult\", \"Náčelník\", \"Osadník\", \"Hrdina\"];\n\t\taLangAttackType = [\"Podpora\", \"Útok\", \"Lúpež\"];\n\t\tbreak;\n\n\tcase \"id\":\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": // translations for travian version 3.6\n\t\t\t\taLangAllBuildWithId = [\"Penebangan Kayu\", \"Penggalian Tanah Liat\", \"Tambang Besi\", \"Ladang\", \"\", \"Penggergajian\", \"Pabrik Bata\", \"Peleburan Besi\", \"Penggilingan Gandum\", \"Toko Roti\", \"Gudang\", \"Lumbung\", \"Pandai Besi\", \"Pabrik Perisai\", \"Pusat Kebugaran\", \"Bangunan Utama\", \"Titik Temu\", \"Pasar\", \"Kedutaan\", \"Barak\", \"Istal\", \"Bengkel\", \"Akademi\", \"Cranny\", \"Balai Desa\", \"Kastil\", \"Istana\", \"Gudang Ilmu\", \"Kantor Dagang\", \"Barak Besar\", \"Istal Besar\", \"Pagar Batu\", \"Pagar Tanah\", \"Pagar kayu\", \"Tukang Batu\", \"Pabrik Bir\", \"Perangkap\",\"Padepokan\", \"Gudang Besar\", \"Lumbung Besar\", \"Keajaiban Dunia\", \"Tempat Minum Kuda\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Penebang Kayu\", \"Penggalian Tanah Liat\", \"Tambang Besi\", \"Ladang\", \"\", \"Penggergajian\", \"Pabrik Bata\", \"Peleburan Besi\", \"Penggilingan Gandum\", \"Toko Roti\", \"Gudang\", \"Lumbung\", \"Pandai Besi\", \"Pabrik Perisai\", \"Pusat Kebugaran\", \"Bangunan Utama\", \"Titik Temu\", \"Pasar\", \"Kedutaan\", \"Barak\", \"Istal\", \"Bengkel\", \"Akademi\", \"Cranny\", \"Balai Desa\", \"Kastil\", \"Istana\", \"Gudang Ilmu\", \"Kantor Dagang\", \"Barak Besar\", \"Istal Besar\", \"Pagar Batu\", \"Pagar Tanah\", \"Pagar kayu\", \"Tukang Batu\", \"Pabrik Bir\", \"Perangkap\",\"Padepokan\", \"Gudang Besar\", \"Lumbung Besar\", \"Keajaiban Dunia\", \"Tempat Minum Kuda\"];\n\t\t\t\taLangAddTaskText = [\"Tambah Pengerjaan\", \"Jenis\", \"Desa Aktif\", \"Target Pengerjaan\", \"ke\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \" Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\t\t\taLangTaskKind = [\"Menaikkan\", \"Dirikan\", \"Serang\", \"riset\", \"latih\", \"Kirim\", \"NPC\", \"Bongkar\", \"Perayaan\"];\n\t\t\t\taLangGameText = [\"Tk\", \"Pedagang\", \"ID\", \"Ibukota\", \"Waktu mulai\", \"jangan gunakan waktu di atas\", \"ke\", \"Desa\", \"kirim\", \"dari\", \"Kirim ke\", \"Kiriman dari\", \"Kembali dari\", \"sumberdaya\", \"bangunan\", \"Mendirikan Bangunan\", \"kosong\", \"tingkat\"];\n\t\t\t\taLangRaceName = [\"Romawi\", \"Teuton\", \"Galia\"];\n\t\t\t\taLangTaskOfText = [\"Jadwal Menaikkan\", \"Jadwal Dirikan\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Otomatis kirim\", \"Autotransport is not opened\", \"Opened\", \"Pengiriman Berhasil\", \"Task List\", \"Trans In limit\", \"Default\", \"Modify\", \"Kayu/Liat/Besi\", \"Gandum\", \"Jadwal Pembongkaran\",\n\t\t\t\t\t\"Jadwal Serangan\", \"Tipe serangan\", \"Waktu tiba\", \"diulang\", \"rentang waktu\", \"00:30:00\", \"Target catapult\", \"Acak\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Pasukan terkirim\",\n\t\t\t\t\t\"Jadwal Pelatihan\", \"Tempat latih\", \"Pelatihan selesai\", \"Atur kirim\", \"setup interval time of reload\",\"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans Out Rmn\",\"Jadwal Perayaan\",\"Perayaan kecil\",\"Perayaan besar\",\"setInterval of Resources concentration\",\n\t\t\t\t\t\"minutes\", \".\",\".\",\"START\",\"STOP\",\"Jadwal Pengembangan\",\"Pengembangan serangan\",\"Pengembangan pertahanan\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"sumberdaya cukup pada\", \"Pekerja sedang bekerja\", \"sepenuhnya telah dikembangkan\", \"Dirikan bangunan\", \"Sedang Membangun\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"sumberdaya cukup pada\",\"Kurang makanan: kembangkan ladang terlebih dahulu\",\"There is already a celebration going on\"];\n\t\t\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can be upgraded to level 20. Now your capital is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. Visit your Profile to determine your race.\", \"Please also visit your Hero's Mansion to determine the speed and the type of your hero.\" , \"Upgrade\"];\n\t\t\t\taLangResources=[\"Kayu\",\"Liat\",\"Besi\",\"Gandum\"];\n\t\t\t\taLangTroops[0] = [\"Legionnaire\", \"Praetorian\", \"Imperian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Battering Ram\", \"Fire Catapult\", \"Senator\", \"Settler\", \"Kesatria\"];\n\t\t\t\taLangTroops[1] = [\"Clubswinger\", \"Spearman\", \"Axeman\", \"Scout\", \"Paladin\", \"Teutonic Knight\", \"Ram\", \"Catapult\", \"Chief\", \"Settler\", \"Kesatria\"];\n\t\t\t\taLangTroops[2] = [\"Phalanx\", \"Swordsman\", \"Pathfinder\", \"Theutates Thunder\", \"Druidrider\", \"Haeduan\", \"Ram\", \"Trebuchet\", \"Chieftain\", \"Settler\", \"Kesatria\"];\n\t\t\t\taLangAttackType = [\"Bantuan\", \"Serang\", \"Rampok\"];\n\t\t\t\tbreak; \n\t\t\tcase \"4.0\": // translations for travian version 4.0\n\t\t\t\taLangAllBuildWithId = [\"Penebang Kayu\", \"Penggalian Tanah Liat\", \"Tambang Besi\", \"Ladang\", \"\", \"Pemotong Kayu\", \"Pabrik Bata\", \"Pelebur Besi\", \"Penggiling Gandum\", \"Toko Roti\", \"Gudang\", \"Lumbung\", \"Pandai Besi\", \"Pabrik Perisai\", \"Pusat Kebugaran\", \"Bangunan Utama\", \"Titik Temu\", \"Pasar\", \"Kedutaan\", \"Barak\", \"Istal\", \"Bengkel\", \"Akademi\", \"Cranny\", \"Balai Desa\", \"Kastil\", \"Istana\", \"Gudang Ilmu\", \"Kantor Dagang\", \"Barak Besar\", \"Istal Besar\", \"Pagar Batu\", \"Pagar Tanah\", \"Pagar kayu\", \"Tukang Batu\", \"Pabrik Bir\", \"Perangkap\",\"Padepokan\", \"Gudang Besar\", \"Lumbung Besar\", \"Keajaiban Dunia\", \"Tempat Minum Kuda\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Penebang Kayu\", \"Penggalian Tanah Liat\", \"Tambang Besi\", \"Ladang\", \"\", \"Pemotong Kayu\", \"Pabrik Bata\", \"Pelebur Besi\", \"Penggiling Gandum\", \"Toko Roti\", \"Gudang\", \"Lumbung\", \"Pandai Besi\", \"Pabrik Perisai\", \"Pusat Kebugaran\", \"Bangunan Utama\", \"Titik Temu\", \"Pasar\", \"Kedutaan\", \"Barak\", \"Istal\", \"Bengkel\", \"Akademi\", \"Cranny\", \"Balai Desa\", \"Kastil\", \"Istana\", \"Gudang Ilmu\", \"Kantor Dagang\", \"Barak Besar\", \"Istal Besar\", \"Pagar Batu\", \"Pagar Tanah\", \"Pagar kayu\", \"Tukang Batu\", \"Pabrik Bir\", \"Perangkap\",\"Padepokan\", \"Gudang Besar\", \"Lumbung Besar\", \"Keajaiban Dunia\", \"Tempat Minum Kuda\"];\n\t\t\t\taLangAddTaskText = [\"Tambah Pengerjaan\", \"Jenis\", \"Desa Aktif\", \"Target Pengerjaan\", \"ke\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \" Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\t\t\taLangTaskKind = [\"Menaikkan\", \"Dirikan\", \"Serang\", \"riset\", \"latih\", \"Kirim\", \"NPC\", \"Bongkar\", \"Perayaan\"];\n\t\t\t\taLangGameText = [\"Tk\", \"Pedagang\", \"ID\", \"Ibukota\", \"Waktu mulai\", \"jangan gunakan waktu di atas\", \"ke\", \"Desa\", \"kirim\", \"dari\", \"Kirim ke\", \"Kiriman dari\", \"Kembali dari\", \"sumberdaya\", \"bangunan\", \"Mendirikan Bangunan\", \"kosong\", \"tingkat\"];\n\t\t\t\taLangRaceName = [\"Romawi\", \"Teuton\", \"Galia\"];\n\t\t\t\taLangTaskOfText = [\"Jadwal Menaikkan\", \"Jadwal Dirikan\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Otomatis kirim\", \"Autotransport is not opened\", \"Opened\", \"Pengiriman Berhasil\", \"Task List\", \"Trans In limit\", \"Default\", \"Modify\", \"Kayu/Liat/Besi\", \"Gandum\", \"Jadwal Pembongkaran\",\n\t\t\t\t\t\"Jadwal Serangan\", \"Tipe serangan\", \"Waktu tiba\", \"diulang\", \"rentang waktu\", \"00:30:00\", \"Target catapult\", \"Acak\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Pasukan terkirim\",\n\t\t\t\t\t\"Jadwal Pelatihan\", \"Tempat latih\", \"Pelatihan selesai\", \"Atur kirim\", \"setup interval time of reload\",\"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans Out Rmn\",\"Jadwal Perayaan\",\"Perayaan kecil\",\"Perayaan besar\",\"setInterval of Resources concentration\",\n\t\t\t\t\t\"minutes\", \".\",\".\",\"START\",\"STOP\",\"Jadwal Pengembangan\",\"Pengembangan serangan\",\"Pengembangan pertahanan\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"sumberdaya cukup pada\", \"Pekerja sedang bekerja\", \"sepenuhnya telah dikembangkan\", \"Dirikan bangunan\", \"Sedang Membangun\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"sumberdaya akan cukup pada\",\"Gandum anda dalam kondisi minus maka tidak akan pernah sampai pada jumlah sumber daya yang dibutuhkan.\",\"There is already a celebration going on\"];\n\t\t\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can be upgraded to level 20. Now your capital is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. Visit your Profile to determine your race.\", \"Please also visit your Hero's Mansion to determine the speed and the type of your hero.\" , \"Upgrade\"];\n\t\t\t\taLangResources=[\"Kayu\",\"Liat\",\"Besi\",\"Gandum\"];\n\t\t\t\taLangTroops[0] = [\"Legionnaire\", \"Praetorian\", \"Imperian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Battering Ram\", \"Fire Catapult\", \"Senator\", \"Settler\", \"Kesatria\"];\n\t\t\t\taLangTroops[1] = [\"Clubswinger\", \"Spearman\", \"Axeman\", \"Scout\", \"Paladin\", \"Teutonic Knight\", \"Ram\", \"Catapult\", \"Chief\", \"Settler\", \"Kesatria\"];\n\t\t\t\taLangTroops[2] = [\"Phalanx\", \"Swordsman\", \"Pathfinder\", \"Theutates Thunder\", \"Druidrider\", \"Haeduan\", \"Ram\", \"Trebuchet\", \"Chieftain\", \"Settler\", \"Kesatria\"];\n\t\t\t\taLangAttackType = [\"Bantuan\", \"Serang\", \"Rampok\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrowLogicError ( \"initializeLangVars():: Travian Version not set, when initializing language variables for \\'id\\'!!\" );\n\t\t}\n\t\tbreak;\n\n\n\tcase \"au\":\t\n\tcase \"uk\":\t\n\tcase \"com\": // thanks ieyp\n\tdefault:\n\t\t// used for logic, translation required\n\t\taLangAllBuildWithId = aLangAllBuildWithIdComDef.slice(0);\n\t\t// used for logic, translation required\n\t\taLangAllBuildAltWithId = aLangAllBuildAltWithIdComDef.slice(0);\n\t\t// used for display only\n\t\taLangAddTaskText = [\"Add task\", \"Style\", \"Active village\", \"Task target\", \"To\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \"&#160;&#160;&#160;Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\t// used for display only\n\t\taLangTaskKind = [\"Upgrade\", \"NewBuild\", \"Attack\", \"Research\", \"Train\", \"Transport\", \"NPC\", \"Demolish\", \"Celebration\"];\n\t\t// used for logic and display, translation required\n\t\taLangGameText = aLangGameTextComDef.slice(0);\n\t\t// used for getMainVillageid(), translation required\n\t\taLangRaceName = aLangRaceNameComDef.slice(0);\n\t\t// used for display only\n\t\taLangTaskOfText = [\"Schedule Upgrade\", \"Schedule NewBuild\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Task List\", \"Trans In limit\", \"Default\", \"Modify\", \"Wood/Clay/Iron\", \"Crop\", \"Schedule demolition\",\n\t\t\t\t\"Schedule attack\", \"Attack type\", \"Travel time\", \"repeat times\", \"interval time\", \"00:30:00\", \"Catapult target\", \"Random\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Troops sent\",\n\t\t\t\t\"Schedule Train\", \"Train site\", \"TrainTask done\", \"customTransport\", \"setup interval time of reload\", \"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\", \"Trans Out Rmn\", \"ScheduleParty\", \"small party\", \"big party\", \"setInterval of Resources concentration\",\n\t\t\t\t\"minutes\", \".\", \".\", \"START\", \"STOP\", \"Schedule Improve\", \"Improve Attack\", \"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t// used for logic & display, translation required\n\t\taLangErrorText = aLangErrorTextComDef.slice(0);\n\t\t// used for display\n\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can <br/>be upgraded to level 20. Now your capital<br/> is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. <br/>Visit your Profile to determine your race.<br/>\", \"Please also visit your Hero's Mansion to determine<br/> the speed and the type of your hero.\" , \"Upgrade\"];\n\t\t// used for display only, however translation can be done\n\t\taLangResources = aLangResourcesComDef.slice(0);\n\t\t// used for logic & display, translation required\n\t\taLangTroops[0] = aLangTroopsComDef[0].slice(0);\n\t\taLangTroops[1] = aLangTroopsComDef[1].slice(0);\n\t\taLangTroops[2] = aLangTroopsComDef[2].slice(0);\n\t\t// used for display only, however translation can be done\n\t\taLangAttackType = aLangAttackTypeComDef.slice(0);\n\t\tbreak;\n\n\tcase \"pl\": // partial translation by deFox\n\t\t// 2011.02.13 -- partial translation by Blaker\n\t\taLangAllBuildWithId = [\"Las\", \"Kopalnia gliny\", \"Kopalnia żelaza\", \"Pole zboża\", \"\", \"Tartak\", \"Cegielnia\", \"Huta stali\", \"Młyn\", \"Piekarnia\", \"Magazyn surowców\", \"Spichlerz\", \"Zbrojownia\", \"Kuźnia\", \"Plac turniejowy\", \"Główny budynek\", \"Miejsce zbiórki\", \"Rynek\", \"Ambasada\", \"Koszary\", \"Stajnia\", \"Warsztat\", \"Akademia\", \"Kryjówka\", \"Ratusz\", \"Rezydencja\", \"Pałac\", \"Skarbiec\", \"Targ\", \"Duże koszary\", \"Duża stajnia\", \"Mur obronny\", \"Wał ziemny\", \"Palisada\", \"Kamieniarz\", \"Browar\", \"Traper\",\"Dwór bohatera\", \"Duży magazyn surowców\", \"Duży spichlerz\", \"Cud świata\", \"Wodopój\"];\n\t\taLangAllBuildAltWithId = [\"Las\", \"Kopalnia gliny\", \"Kopalnia żelaza\", \"Pole zboża\", \"\", \"Tartak\", \"Cegielnia\", \"Huta stali\", \"Młyn\", \"Piekarnia\", \"Magazyn surowców\", \"Spichlerz\", \"Zbrojownia\", \"Kuźnia\", \"Plac turniejowy\", \"Główny budynek\", \"Miejsce zbiórki\", \"Rynek\", \"Ambasada\", \"Koszary\", \"Stajnia\", \"Warsztat\", \"Akademia\", \"Kryjówka\", \"Ratusz\", \"Rezydencja\", \"Pałac\", \"Skarbiec\", \"Targ\", \"Duże koszary\", \"Duża stajnia\", \"Mur obronny\", \"Wał ziemny\", \"Palisada\", \"Kamieniarz\", \"Browar\", \"Traper\",\"Dwór bohatera\", \"Duży magazyn surowców\", \"Duży spichlerz\", \"Cud świata\", \"Wodopój\"];\n\t\taLangAddTaskText = [\"Add task\", \"Style\", \"Active village\", \"Task target\", \"To\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \"&#160;&#160;&#160;Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\taLangTaskKind = [\"Upgrade\", \"NewBuild\", \"Attack\", \"Research\", \"Train\", \"Transport\", \"NPC\", \"Demolish\", \"Celebration\"];\n\t\taLangGameText = [\"Lvl\", \"Merchants\", \"ID\", \"Capital\", \"Start time\", \"this timeseting is unuseful now.\", \"to\", \"Village\", \"transport\", \"from\", \"Transport to\", \"Transport from\", \"Return from\", \"resources\", \"building\", \"Construct new building\", \"empty\", \"level\"];\n\t\taLangRaceName = [\"Rzymianie\", \"Germanie\", \"Galowie\"];\n\t\taLangTaskOfText = [\"Zaplanuj Upgrade\", \"Zaplanuj Budowę\", \"Auto ResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Lista zadań\", \"Trans In limit\", \"Domyśl.\", \"Zmień\", \"Drewno/Glina/Żelazo\", \"Zboże\", \"Schedule demolition\",\n\t\t\t\"Zaplanuj atak\", \"Typ Ataku\", \"Czas podróży\", \"repeat times\", \"odstęp czasu\", \"00:30:00\",\"Cel dla katapult\", \"Losowy\", \"Nieznany\", \"times\", \"Mies.\", \"Dzień\", \"Troops sent\",\n\t\t\t\"Zaplanuj szkolenie\", \"Train site\", \"TrainTask done\", \"customTransport\", \"setup interval time of reload\",\"this is the interval of page reload,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans Out Rmn\",\"ScheduleParty\",\"small party\",\"big party\",\"setInterval of Resources concentration\",\n\t\t\t\"minut\", \".\",\".\",\"START\",\"STOP\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Zbyt mało surowców.\", \"The workers are already at work.\", \"Construction completed\", \"Starting construction\", \"In development\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"Enough resources\",\"Lack of food: extend cropland first\",\"There is already a celebration going on\"];\n\t\taLangOtherText = [\"Ważna wiadomość\", \"Tylko w stolicy można rozbudować teren do poz. 20.<br/>Aktywna wioska nie została rozpoznana jako stolica.<br/>Wejdź w Ustawienia by wywołać aktualizację.\", \"Szybki link ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"Upgrade successfully\", \"Run successfully\", \"Nie udało się określić twojej rasy, stąd typy jednostek<br/>nie są znane. Wejdź w Ustawienia by skrypt wykrył twoją rasę.<br/>\", \"Please also visit your Hero's Mansion to determine<br/> the speed and the type of your hero.\"];\n\t\taLangResources = [\"drewno\", \"glina\", \"żelazo\", \"zboże\"];\n\t\taLangTroops[0] = [\"Legionnaire\", \"Praetorian\", \"Imperian\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Battering Ram\", \"Fire Catapult\", \"Senator\", \"Settler\", \"Hero\"];\n\t\taLangTroops[1] = [\"Clubswinger\", \"Spearman\", \"Axeman\", \"Scout\", \"Paladin\", \"Teutonic Knight\", \"Ram\", \"Catapult\", \"Chief\", \"Settler\", \"Hero\"];\n\t\taLangTroops[2] = [\"Falanga\", \"Miecznik\", \"Tropiciel\", \"Grom Teutatesa\", \"Jeździec druidzki\", \"Haeduan\", \"Taran\", \"Trebusz\", \"Herszt\", \"Osadnicy\", \"Bohater\"];\n\t\taLangAttackType = [\"Posiłki\", \"Atak normalny\", \"Grabież\"];\n\t\tbreak;\n\n\tcase \"ua\":\n\t\taLangAllBuildWithId = [\"Лісоповал\", \"Глиняний кар'єр\", \"Залізна копальня\", \"Ферма\", \"\", \"Деревообробний завод\", \"Цегляний завод\", \"Чавуноливарний завод\", \"Млин\", \"Пекарня\", \"Склад\", \"Зернова комора\", \"Кузня зброї\", \"Кузня обладунків\", \"Арена\", \"Головна будівля\", \"Пункт збору\", \"Ринок\", \"Посольство\", \"Казарма\", \"Стайня\", \"Майстерня\", \"Академія\", \"Схованка\", \"Ратуша\", \"Резиденція\", \"Палац\", \"Скарбниця\", \"Торгова палата\", \"Велика казарма\", \"Велика стайня\", \"Міська стіна\", \"Земляний вал\", \" Огорожа\", \"Каменяр\", \"Пивна\", \"Капканщик\",\"Таверна\", \"Великий склад\", \"Велика Зернова комора\", \"Чудо світу\", \"Водопій\"];\n\t\taLangAllBuildAltWithId = [\"Лісоповал\", \"Глиняний кар'єр\", \"Залізна копальня\", \"Ферма\", \"\", \"Деревообробний завод\", \"Цегляний завод\", \"Чавуноливарний завод\", \"Млин\", \"Пекарня\", \"Склад\", \"Зернова комора\", \"Кузня зброї\", \"Кузня обладунків\", \"Арена\", \"Головна будівля\", \"Пункт збору\", \"Ринок\", \"Посольство\", \"Казарма\", \"Стайня\", \"Майстерня\", \"Академія\", \"Схованка\", \"Ратуша\", \"Резиденція\", \"Палац\", \"Скарбниця\", \"Торгова палата\", \"Велика казарма\", \"Велика стайня\", \"Міська стіна\", \"Земляний вал\", \" Огорожа\", \"Каменяр\", \"Пивна\", \"Капканщик\",\"Таверна\", \"Великий склад\", \"Велика Зернова комора\", \"Чудо світу\", \"Водопій\"];\n\t\taLangAddTaskText = [\"Додати завдання\", \"Спосіб\", \"Активне поселення\", \"Ціль завдання\", \"| Ціль\", \"Тип\", \"Підтримка будівництва\", \"Концентрація ресурсів\", \"Вверх\", \"Вниз\", \"\", \"\", \"\", \"Видалити усі завдання\"];\n\t\taLangTaskKind = [\"Покращити:\", \"Нове завдання:\", \"Атакувати:\", \"Розвідати:\", \" наняти:\", \"Відправити ресурси:\", \"NPC:\", \"Зруйнувати:\", \"Урочистість:\"];\n\t\taLangGameText = [\" Рівень \", \"Торговці\", \"ID\", \"Столиця\", \"Час початку\", \"(тимчасово не працює)\", \"в\", \"Поселення\", \"Транспортування\", \"з\", \"Транспортування в\", \"Транспортування из\", \"Повернення з\", \"ресурси\", \"будівля\", \"Побудувати нову будівлю\", \"пусто\", \"рівень\"];\n\t\taLangRaceName = [\"Римляни\", \"Тевтонці\", \"Галли\"];\n\t\taLangTaskOfText = [\"Запланувати удосконалення\", \"Запланувати нове завдання\", \"Качати реурси\", \"Викл\", \"Старт\", \"Вкл\", \"стоп\", \"Розполілення полів в поселенні: \", \"Автовідправлення\", \"Автовідправлення викл.\", \"Вкл.\", \"Успішно відправленно\", \"* Задачі *\", \"Обмеження ввозу\", \"Ні\", \"Змінити \", \"Дерево/Глина/Залізо\", \"Зерно\", \"Запланувати зруйнування\",\n\t\t\t\"Запланувати атаку\", \"Тип атаки\", \"Час в дорозі\", \"повтори\", \"проміжок\",\"00:30:00\",\"Ціль катов\",\"Випадково\", \"Невідомо\", \" раз\", \"/\", \" :дата/час: \", \"Війска\",\n\t\t\t\"Запланувати найм\",\"Train site\",\"Навчання військ завершено\",\"цілеве відправлення\",\"Інтервал оновлення\",\"Це інтервал оновлення сторінки ,\\n по замовчуванню - 20 хвилин, Введіть новоий час:\\n\\n\",\"Обмеження вивозу\",\"Запланувати святкування\",\"Малий праздник\",\"Великий праздник\",\"Встановлення інтервала концентрації ресурсів\",\n\t\t\t\"хвилини\",\"зупинено\",\"працює\",\"старт\",\"пауза\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Недостатньо сировини\", \"Всі будівельники зараз зайняті\", \"Це завдання зупинено повністю\", \"Починаю будівництво\", \"Процес розвитку\", \"Недостатня місткість складу\", \"Недостатня місткість Зернової комори\", \"Достатньо ресурсів\",\"\",\"Проводится урочистість\"];\n\t\taLangOtherText = [\"Важливі замітки\", \"Тільки в столиці поля можуть бути до рівня 20. Столиця не визначена.Зайдіть в профіль будьласка\", \"Ссилка тут ^_^\", \"Настройка завершена\", \"Відмінено\", \"Почати завдання\", \"Удосконалення пройшло успішно\", \"Успішно\", \"Ваш народ невизначений.Будьласка зайдіть в профіль.\", \"Також будьласка зайдіть в таверну для визначення типу та скорості героя\"];\n\t\taLangResources=[\"Деревина\",\"Глина\",\"Залізо\",\"Зерно\"];\n\t\taLangTroops[0] = [\"Легіонер\", \"Преторіанець\", \"Імперіанець\", \"Кінний розвідник\", \"Кіннота імператора\", \"Кіннота Цезаря\", \"Таран\", \"Вогняна катапульта\", \"Сенатор\", \"Поселенець\", \"Герой\"];\n\t\taLangTroops[1] = [\"Дубинник\", \"Списник\", \"Сокирник\", \"Скаут\", \"Паладин\", \"Тевтонський вершник\", \"Стінобитне знаряддя\", \"Катапульта\", \"Ватажок\", \"Поселенець\", \"Герой\"];\n\t\taLangTroops[2] = [\"Фаланга\", \"Мечник\", \"Слідопит\", \"Тевтацький грім\", \"Друїд-вершник\", \"Едуйська кіннота\", \"Таран\", \"Катапульта\", \"Лідер\", \"Поселенець\", \"Герой\"];\n\t\taLangAttackType = [\"Підкріплення\", \"Напад\", \"Набіг\"];\n\t\tbreak;\n\n\tcase \"tr\": // by karambol update the 27 Mar 2010 by SARLAK\n aLangAllBuildWithId = [\"Oduncu\", \"Tuğla Ocağı\", \"Demir Madeni\", \"Tarla\", \"\", \"Kereste Fabrikası\", \"Tuğla Fırını\", \"Demir Dökümhanesi\", \"Değirmen\", \"Ekmek Fırını\", \"Hammadde deposu\", \"Tahıl Ambarı\", \"Silah Dökümhanesi\", \"Zırh Dökümhanesi\", \"Turnuva Yeri\", \"Merkez Binası\", \"Askeri Üs\", \"Pazar Yeri\", \"Elçilik\", \"Kışla\", \"Ahır\", \"Tamirhane\", \"Akademi\", \"Sığınak\", \"Belediye\", \"Köşk\", \"Saray\", \"Hazine\", \"Ticari Merkez\", \"Büyük Kışla\", \"Büyük Ahır\", \"Sur\", \"Toprak Siper\", \"Çit\", \"Taşçı\", \"İçecek Fabrikası\", \"Tuzakçı\",\"Kahraman Kışlası\", \"Büyük Hammadde deposu\", \"Büyük Tahıl Ambarı\", \"Dünya Harikası\", \"Yalak\"];\n aLangAllBuildAltWithId = [\"Oduncu\", \"Tuğla Ocağı\", \"Demir Madeni\", \"Tarla\", \"\", \"Kereste Fabrikası\", \"Tuğla Fırını\", \"Demir Dökümhanesi\", \"Değirmen\", \"Ekmek Fırını\", \"Hammadde deposu\", \"Tahıl Ambarı\", \"Silah Dökümhanesi\", \"Zırh Dökümhanesi\", \"Turnuva Yeri\", \"Merkez Binası\", \"Askeri Üs\", \"Pazar Yeri\", \"Elçilik\", \"Kışla\", \"Ahır\", \"Tamirhane\", \"Akademi\", \"Sığınak\", \"Belediye\", \"Köşk\", \"Saray\", \"Hazine\", \"Ticari Merkez\", \"Büyük Kışla\", \"Büyük Ahır\", \"Sur\", \"Toprak Siper\", \"Çit\", \"Taşçı\", \"İçecek Fabrikası\", \"Tuzakçı\",\"Kahraman Kışlası\", \"Büyük Hammadde deposu\", \"Büyük Tahıl Ambarı\", \"Dünya Harikası\", \"Yalak\"];\n aLangAddTaskText = [\"Görev Ekle\", \"Stil\", \"Aktif Köy\", \"Görev Hedefi\", \"Hedef\", \"Türü\", \"İnşaat Desteği\", \"Hammadde karışımı\", \"Yukarı Taşı\", \"Aşağı Taşı\", \"Sil\", \"Görev İçeriği\", \"Sırala\", \"Tüm görevleri sil\"]; \n aLangTaskKind = [\"Geliştirilen Bina :\", \"Yeni Bina :\", \"Hücum\", \"Araştır\", \"Yetiştir\", \"Gönder\", \"NPC\", \"Yıkılan Bina :\", \"Festival\"]; \n aLangGameText = [\"Seviye \", \"Tüccar\", \"ID\", \"Başkent\", \"Başlangıç zamanı\", \"Değiştirilemez.\", \"buraya\", \"Aktif Köy\", \"gönder\", \"buradan\", \"Gönderiliyor\", \"Gönderildi\", \"Dönüş\", \"hammadde\", \"bina\", \"Yeni bina kur\", \"boş\", \"Seviye \"]; \n aLangRaceName = [\"Romalılar\", \"Cermenler\", \"Galyalılar\"]; \n aLangTaskOfText = [\"Geliştirme Zamanla\", \"Yeni Bina Kurulumu\", \"Otomatik hammadde güncelle\", \"Çalışmıyor\", \"Başlat\", \"Çalışıyor\", \"Durdur\", \"Bu köyün kaynak alanları dağılımıdır \", \"Otomatik Gönderme\", \"Otomatik gönderme açılmadı\", \"Açıldı\", \"Gönderme Tamamladı\", \"\", \"Gönderme limiti\", \"Varsayılan\", \"Değiştir\", \"Odun/Tuğla/Demir\", \"Tahıl\", \"Yıkımı zamanla\", \n \"Hücum zamanla\", \"Hücum Şekli\", \"Varış zamanı\", \"Tekrar Sayısı\", \"Tekrar Aralığı\",\"00:30:00\",\"Mancınık hedef\",\"Rastgele\", \"Bilinmeyen\", \"kere\", \"Ay\", \"Gün\", \"Asker gönder\", \"Asker Yetiştir\",\"Yetiştirilme Noktası\",\"Eğitim görevi tamamlandı\",\"Hammadde Gönderimi Zamanla\",\"Gerçekleşmeyen Kurulumu Tekrarlama Süresi\",\"Tekrar deneme süresini giriniz.\\n(Varsayılan Değer: 20 Dakika)\",\"Trans Out Rmn\",\"Festivalzamanla\",\"Küçük festival\",\"Büyük festival\",\"Hammadde Toplama Aralığı\", \n \"dakikalar\",\"Pasif\",\"Aktif\",\"Aktif Et\",\"Pasif Et\",\"Asker Gelişimi Zamanla\",\"Silah Gelişimi\",\"Zırh Gelişimi\",\"saati\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"]; \n aLangErrorText = [\"Çok az kaynak.\", \"Işçi zaten iş başında.\", \"İnşaat tamamlandı\", \"İnşaat başlatılıyor\", \"Araştırma yapılıyor\", \"İnşaata Hammadde deposunu geliştirip devam ediniz.\", \"İnşaata Tahıl ambarını geliştirip devam ediniz.\", \"Yeterli hammadde\",\"Kaynak eksikliği: önce Tarlanı geliştir\",\"Şu anda bir festival yapılıyor zaten\"]; \n aLangOtherText = [\"Önemli not\", \"Sadece başkent için hammadde üretebilirsiniz <br/>be Güncellendi seviye 20. Şimdi Başkentin<br/> tesbit edilemedi. Profilinizi ziyaret ediniz.\", \"Buraya kısa yol ^_^\", \"Kurulum tamamlandı\", \"Vazgeçildi\", \"Görevleri başlat\", \"Güncelleme tamamlandı\", \"Çalışma tamam\", \"Irkınız bilinmediğinden asker türünüz belilenemedi <br/>Profilinizi ziyaret edip ırkınızı belirleyin<br/>\", \"Ayrıca kahraman kışlasınıda ziyaret edin<br/> Kahramanınızın hızı ve tipi.\"]; \n aLangResources=[\"Odun\",\"Tuğla\",\"Demir\",\"Tahıl\"]; \n aLangTroops[0] = [\"Lejyoner\", \"Pretoryan\", \"Emperyan\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Koçbaşı\", \"Ateş Mancınığı\", \"Senatör\", \"Göçmen\", \"Kahraman\"]; \n aLangTroops[1] = [\"Tokmak Sallayan\", \"Mızrakçı\", \"Balta Sallayan\", \"Casus\", \"Paladin\", \"Toyton\", \"Koçbaşı\", \"Mancınık\", \"Reis\", \"Göçmen\", \"Kahraman\"]; \n aLangTroops[2] = [\"Phalanx\", \"Kılıçlı\", \"Casus\", \"Toytatın Şimşeği\", \"Druyid\", \"Heduan\", \"Koçbaşı\", \"Mancınık\", \"Kabile Reisi\", \"Göçmen\", \"Kahraman\"]; \n aLangAttackType = [\"Destek\", \"Saldırı: Normal\", \"Saldırı: Yağma\"]; \n break;\n\n\tcase \"br\":\n\t\taLangAllBuildWithId = [\"Bosque\", \"Poço de Barro\", \"Mina de Ferro\", \"Campo de Cereais\", \"\", \"Serraria\", \"Alvenaria\", \"Fundição\", \"Moinho\", \"Padaria\", \"Armazém\", \"Celeiro\", \"Ferreiro\", \"Fábrica de Armaduras\", \"Praça de torneios\", \"Edifício principal\", \"Ponto de reunião militar\", \"Mercado\", \"Embaixada\", \"Quartel\", \"Cavalaria\", \"Oficina\", \"Academia\", \"Esconderijo\", \"Casa do Povo\", \"Residência\", \"Palácio\", \"Tesouraria\", \"Companhia do Comércio\", \"Grande Quartel\", \"Grande Cavalaria\", \"Muralha\", \"Barreira\", \"Paliçada\", \"Pedreiro\", \"Cervejaria\", \"Fábrica de Armadilhas\",\"Mansão do Herói\", \"Grande armazém\", \"Grande Celeiro\", \"Maravilha do Mundo\", \"Bebedouro para cavalos\"];\n\t\taLangAllBuildAltWithId = [\"Bosque\", \"Poço de Barro\", \"Mina de Ferro\", \"Campo de Cereais\", \"\", \"Serraria\", \"Alvenaria\", \"Fundição\", \"Moinho\", \"Padaria\", \"Armazém\", \"Celeiro\", \"Ferreiro\", \"Fábrica de Armaduras\", \"Praça de torneios\", \"Edifício principal\", \"Ponto de reunião militar\", \"Mercado\", \"Embaixada\", \"Quartel\", \"Cavalaria\", \"Oficina\", \"Academia\", \"Esconderijo\", \"Casa do Povo\", \"Residência\", \"Palácio\", \"Tesouraria\", \"Companhia do Comércio\", \"Grande Quartel\", \"Grande Cavalaria\", \"Muralha\", \"Barreira\", \"Paliçada\", \"Pedreiro\", \"Cervejaria\", \"Fábrica de Armadilhas\",\"Mansão do Herói\", \"Grande armazém\", \"Grande Celeiro\", \"Maravilha do Mundo\", \"Bebedouro para cavalos\"];\n\t\taLangAddTaskText = [\"Adicionar tarefa\", \"Estilo\", \"Aldeia Activa\", \"Alvo\", \"Para\", \"Modo\", \"Ajuda na Construção\", \"Quantidade de recursos\", \"Mover para cima\", \"Mover para baixo\", \"Apagar\", \"&#160;&#160;&#160;Tarefas\", \"Mover \", \"Eliminar todas as tarefas\"];\n\t\taLangTaskKind = [\"Evolução\", \"Novo construção\", \"Ataque\", \"Pesquisa\", \"Treino\", \"Transporte\", \"NPC\", \"Demolição\", \"Celebração\"];\n\t\taLangGameText = [\"Lvl\", \"Mercadores\", \"Identificação\", \"Capital\", \"Inicio\", \"this timeseting is unuseful now.\", \"Para\", \"Aldeia\", \"Transporte\", \"de\", \"Transporte para\", \"Transporte de\", \"A regressar de\", \"Recursos\", \"Edificio\", \"Construir novo edifício\", \"Vazio\", \"Nivel\"];\n\t\taLangRaceName = [\"Romanos\", \"Teutões\", \"Gauleses\"];\n\t\taLangTaskOfText = [\"Agendar Evolução\", \"Agendar nova construção\", \"ResourcesUpD\", \"OFF\", \"Iniciar\", \"ON\", \"Parar\", \"A distribuição dos campos desta aldeia é \", \"Autotransporte\", \"Autotransporte não está aberto\", \"Aberto\", \"Transporte com sucesso\", \"Lista de agendamento\", \"Limit\", \"Default\", \"Alterar\", \"madeira/barro/ferro\", \"cereal\", \"Agendamento de demolição\",\n\t\t\t\"Agendamento de ataque\", \"Tipo de ataque\", \"Tempo de viagem\", \"Repetir número de vezes\", \"Tempo de intervalo\",\"00:30:00\",\"Alvo catapulta\",\"Aleatório\", \"Desconhecido\", \"Vezes\", \" Mês\", \" Dia\", \"Tropas enviadas\",\n\t\t\t\"Agendamento de treino\",\"localização de tropas\",\"Agendamento de treino feito\",\"Transporte personalizado\",\"Setup Interval Time of Reload\",\"This is the interval of page reload ,\\n default são 20 minutos, Insira novo tempo:\\n\\n\",\"Remain\",\"Agendar Celebração\",\"pequena celebração\",\"grande celebração\",\"Set Interval of Resources concentration\",\n\t\t\t\"minutos\",\"parado\",\"ligado\",\"ligar\",\"parar\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Poucos recursos.\", \"Os trabalhadores já estão a trabalhar.\", \"Construção completa\", \"Inicio da construção\", \"Em desenvolvimento\", \"Seu Armazém é pequeno. Evolua o seu armazém para continuar a sua construção\", \"Seu Celeiro é pequeno. Evolua o seu Celeiro para continuar a sua construção\", \"Recursos suficientes\",\"Já se encontra uma celebração em curso\"];\n\t\taLangOtherText = [\"Nota importante\", \"Apenas os campos de recursos da capital <br/>podem ser elevados a nivel 20 . A sua capital <br/> nao está detectavel. Por favor visite o seu perfil.\", \"Atalho aqui ^_^\", \"Instalação concluída\", \"Cancelado\", \"Iniciar as tarefas\", \"Upgrade com sucesso\", \"Executar com sucesso\", \"Sua raça é desconhecida, e o seu tipo de tropa também. <br/>Visite o seu perfil para determinar as raça.<br/>\", \"Por favor visite a sua mansão do heroi para determinar<br/> a velocidade e o tipo de heroi.\"];\n\t\taLangResources=[\"Madeira\",\"Barro\",\"Ferro\",\"Cereais\"];\n\t\taLangTroops[0] = [\"Legionário\", \"Pretoriano\", \"Imperiano\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Aríete\", \"Catapulta de Fogo\", \"Senador\", \"Colonizador\", \"Heroi\"];\n\t\taLangTroops[1] = [\"Salteador\", \"Lanceiro\", \"Bárbaro\", \"Espião\", \"Paladino\", \"Cavaleiro Teutão\", \"Aríete\", \"Catapulta\", \"Chefe\", \"Colonizador\", \"Heroi\"];\n\t\taLangTroops[2] = [\"Falange\", \"Espadachim\", \"Batedor\", \"Trovão Theutate\", \"Cavaleiro Druida\", \"Haeduano\", \"Aríete\", \"Trabuquete\", \"Chefe de Clã\", \"Colonizador\", \"Heroi\"];\n\t\taLangAttackType = [\"Reforço\", \"Ataque\", \"Assalto\"];\n\t\tbreak;\n\n\n case \"pt\": // thanks RASCO and Tuga\n\t\taLangAllBuildWithId = [\"Bosque\", \"Poço de Barro\", \"Mina de Ferro\", \"Campo de Cereais\", \"\", \"Serração\", \"Alvenaria\", \"Fundição\", \"Moinho\", \"Padaria\", \"Armazém\", \"Celeiro\", \"Ferreiro\", \"Fábrica de Armaduras\", \"Praça de torneios\", \"Edifício principal\", \"Ponto de reunião militar\", \"Mercado\", \"Embaixada\", \"Quartel\", \"Cavalariça\", \"Oficina \", \"Academia\", \"Esconderijo\", \"Casa do Povo\", \"Residência\", \"Palácio\", \"Tesouraria\", \"Companhia do Comércio\", \"Grande Quartel\", \"Grande Cavalariça\", \"Muralha\", \"Barreira\", \"Paliçada\", \"Pedreiro\", \"Cervejaria\", \"Fábrica de Armadilhas\",\"Mansão do Herói\", \"Grande armazém\", \"Grande Celeiro\", \"Maravilha do Mundo\", \"Bebedouro para cavalos\"];\n\t\taLangAllBuildAltWithId = [\"Bosque\", \"Poço de Barro\", \"Mina de Ferro\", \"Campo de Cereais\", \"\", \"Serração\", \"Alvenaria\", \"Fundição\", \"Moinho\", \"Padaria\", \"Armazém\", \"Celeiro\", \"Ferreiro\", \"Fábrica de Armaduras\", \"Praça de torneios\", \"Edifício principal\", \"Ponto de reunião militar\", \"Mercado\", \"Embaixada\", \"Quartel\", \"Cavalariça\", \"Oficina \", \"Academia\", \"Esconderijo\", \"Casa do Povo\", \"Residência\", \"Palácio\", \"Tesouraria\", \"Companhia do Comércio\", \"Grande Quartel\", \"Grande Cavalariça\", \"Muralha\", \"Barreira\", \"Paliçada\", \"Pedreiro\", \"Cervejaria\", \"Fábrica de Armadilhas\",\"Mansão do Herói\", \"Grande armazém\", \"Grande Celeiro\", \"Maravilha do Mundo\", \"Bebedouro para cavalos\"];\n\t\taLangAddTaskText = [\"Adicionar tarefa\", \"Estilo\", \"Aldeia Activa\", \"Alvo\", \"Para\", \"Modo\", \"Ajuda na Construção\", \"Quantidade de recursos\", \"Mover para cima\", \"Mover para baixo\", \"Apagar\", \"&#160;&#160;&#160;Tarefas\", \"Mover \", \"Eliminar todas as tarefas\"];\n\t\taLangTaskKind = [\"Evolução\", \"Novo construção\", \"Ataque\", \"Pesquisa\", \"Treino\", \"Transporte\", \"NPC\", \"Demolição\", \"Celebração\"];\n\t\taLangGameText = [\"Lvl\", \"Mercadores\", \"Identificação\", \"Capital\", \"Inicio\", \"this timeseting is unuseful now.\", \"Para\", \"Aldeia\", \"Transporte\", \"de\", \"Transporte para\", \"Transporte de\", \"A regressar de\", \"Recursos\", \"Edificio\", \"Construir novo edifício\", \"Vazio\", \"Nivel\"];\n\t\taLangRaceName = [\"Romanos\", \"Teutões\", \"Gauleses\"];\n\t\taLangTaskOfText = [\"Agendar Evolução\", \"Agendar nova construção\", \"ResourcesUpD\", \"OFF\", \"Iniciar\", \"ON\", \"Parar\", \"A distribuição dos campos desta aldeia é \", \"Autotransporte\", \"Autotransporte não está aberto\", \"Aberto\", \"Transporte com sucesso\", \"Lista de agendamento\", \"Limit\", \"Default\", \"Alterar\", \"madeira/barro/ferro\", \"cereal\", \"Agendamento de demolição\",\n\t\t\t\"Agendamento de ataque\", \"Tipo de ataque\", \"Tempo de viagem\", \"Repetir número de vezes\", \"Tempo de intervalo\",\"00:30:00\",\"Alvo catapulta\",\"Aleatório\", \"Desconhecido\", \"Vezes\", \" Mês\", \" Dia\", \"Tropas enviadas\", \"Agendamento de treino\",\"localização de tropas\",\"Agendamento de treino feito\",\"Transporte personalizado\",\"Setup Interval Time of Reload\",\"This is the interval of page reload ,\\n default são 20 minutos, Insira novo tempo:\\n\\n\",\"Remain\",\"Agendar Celebração\",\"pequena celebração\",\"grande celebração\",\"Set Interval of Resources concentration\",\"minutos\",\".\",\".\",\"START\",\"STOP\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Poucos recursos.\", \"Os trabalhadores já estão a trabalhar.\", \"Construção completa\", \"Inicio da construção\", \"Em desenvolvimento\", \"Seu Armazém é pequeno. Evolua o seu armazém para continuar a sua construção\", \"Seu Celeiro é pequeno. Evolua o seu Celeiro para continuar a sua construção\", \"Recursos suficientes\",\"Já se encontra uma celebração em curso\"];\n\t\taLangOtherText = [\"Nota importante\", \"Apenas os campos de recursos da capital <br/>podem ser elevados a nivel 20 . A sua capital <br/> nao está detectavel. Por favor visite o seu perfil.\", \"Atalho aqui ^_^\", \"Instalação concluída\", \"Cancelado\", \"Iniciar as tarefas\", \"Upgrade com sucesso\", \"Executar com sucesso\", \"Sua raça é desconhecida, e o seu tipo de tropa também. <br/>Visite o seu perfil para determinar as raça.<br/>\", \"Por favor visite a sua mansão do heroi para determinar<br/> a velocidade e o tipo de heroi.\"];\n\t\taLangResources = [\"Madeira\",\"Barro\",\"Ferro\",\"Cereais\"];\n\t\taLangTroops[0] = [\"Legionário\", \"Pretoriano\", \"Imperiano\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Aríete\", \"Catapulta de Fogo\", \"Senador\", \"Colonizador\", \"Heroi\"];\n\t\taLangTroops[1] = [\"Salteador\", \"Lanceiro\", \"Bárbaro\", \"Espião\", \"Paladino\", \"Cavaleiro Teutão\", \"Aríete\", \"Catapulta\", \"Chefe\", \"Colonizador\", \"Heroi\"];\n\t\taLangTroops[2] = [\"Falange\", \"Espadachim\", \"Batedor\", \"Trovão Theutate\", \"Cavaleiro Druida\", \"Haeduano\", \"Aríete\", \"Trabuquete\", \"Chefe de Clã\", \"Colonizador\", \"Heroi\"];\n\t\taLangAttackType = [\"Reforço\", \"Ataque\", \"Assalto\"];\n\t\tbreak;\n\n case \"my\":\n\t\taLangAllBuildWithId = [\"Kawasan Pembalakan\", \"Kuari Tanat Liat\", \"Lombong Bijih Besi\", \"Ladang\", \"\", \"Kilang Papan\", \"Kilang Bata\", \"Faundri Besi\", \"Pengisar Bijian\", \"Kilang Roti\", \"Gudang\", \"Jelapang\", \"Kedai Senjata\", \"Kedai Perisai\", \"Gelanggang Latihan\", \"Bangunan Utama\", \"Titik Perhimpunan\", \"Pasar\", \"Kedutaan\", \"Berek\", \"Kandang Kuda\", \"Bengkel\", \"Akademi\", \"Gua\", \"Dewan Perbandaran\", \"Residen\", \"Istana\", \"Perbendaharaan\", \"Pejabat Dagangan\", \"Berek Besar\", \"Kandang Kuda Besar\", \"Tembok Bandar\", \"Tembok Tanah\", \"Pagar Kubu\", \"Kedai Tukang Batu\", \"Kilang Bir\", \"Pemerangkap\",\"Rumah Agam Wira\", \"Gudang Besar\", \"Jelapang Besar\", \"Dunia Keajaiban\", \"Palung Kuda\"];\n\t\taLangAllBuildAltWithId = [\"Kawasan Pembalakan\", \"Kuari Tanat Liat\", \"Lombong Bijih Besi\", \"Ladang\", \"\", \"Kilang Papan\", \"Kilang Bata\", \"Faundri Besi\", \"Pengisar Bijian\", \"Kilang Roti\", \"Gudang\", \"Jelapang\", \"Kedai Senjata\", \"Kedai Perisai\", \"Gelanggang Latihan\", \"Bangunan Utama\", \"Titik Perhimpunan\", \"Pasar\", \"Kedutaan\", \"Berek\", \"Kandang Kuda\", \"Bengkel\", \"Akademi\", \"Gua\", \"Dewan Perbandaran\", \"Residen\", \"Istana\", \"Perbendaharaan\", \"Pejabat Dagangan\", \"Berek Besar\", \"Kandang Kuda Besar\", \"Tembok Bandar\", \"Tembok Tanah\", \"Pagar Kubu\", \"Kedai Tukang Batu\", \"Kilang Bir\", \"Pemerangkap\",\"Rumah Agam Wira\", \"Gudang Besar\", \"Jelapang Besar\", \"Dunia Keajaiban\", \"Palung Kuda\"];\n\t\taLangAddTaskText = [\"Add task\", \"Style\", \"Active village\", \"Task target\", \"To\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Move up\", \"Move down\", \"Del\", \" Task contents\", \"Move \", \"Delete all the tasks\"];\n\t\taLangTaskKind = [\"Tingkatkan\", \"Bina bangunan\", \"Serang\", \"Selidik\", \"latih\", \"Angkut\", \"NPC\", \"musnah\", \"Perayaan\"];\n\t\taLangGameText = [\"Tahap\", \"Pedagang\", \"ID\", \"Ibu Kota\", \"Waktu mula\", \"this timeseting is unuseful now.\", \"ke\", \"Kampung\", \"angkut\", \"dari\", \"Angkut ke\", \"Angkut dari\", \"Balik dari\", \"sumber\", \"bangunan\", \"Bina bangunan\", \"Kosong\", \"tahap\"];\n\t\taLangRaceName = [\"Rom\", \"Teuton\", \"Gaul\"];\n\t\taLangTaskOfText = [\"Schedule Upgrade\", \"Schedule NewBuild\", \"AutoResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Task List\", \"Trans_In_limit\", \"Default\", \"Modify\", \"Wood/Clay/Iron\", \"Crop\", \"Schedule demolition\", \"Schedule attack\", \"Attack type\", \"Travel time\", \"repeat times\", \"interval time\",\"00:30:00\",\"Catapult target\",\"Random\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Troops sent\", \"Schedule Train\",\"Train site\",\"TrainTask done\",\"customTransport\",\"setup interval time of reload\",\"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans_Out_Rmn\",\"ScheduleParty\",\"small party\",\"big party\",\"setInterval of Resources concentration\",\"minutes\",\".\",\".\",\"START\",\"STOP\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Terlalu sedikit sumber\", \"Para pekerja sedang bekerja\", \"Construction completed\", \"Starting construction\", \"In development\", \"Your Warehouse is too small. Please upgrade your Warehouse to continue your construction\", \"Your Granary is too small. Please upgrade your Granary to continue your construction\", \"Enough resources\",\"Lack of food: extend cropland first\",\"There is already a celebration going on\"];\n\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can be upgraded to level 20. Now your capital is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Cancelled\", \"Start the tasks\", \"Upgrade successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. Visit your Profile to determine your race.\", \"Please also visit your Hero's Mansion to determine the speed and the type of your hero.\"];\n\t\taLangResources=[\"kayu\",\"tanah liat\",\"besi\",\"tanaman\"];\n\t\taLangTroops[0] = [\"Askar Legion\", \"Pengawal Pertahanan\", \"Askar Empayar\", \"Kesatria Diplomatik\", \"Kesatria Empayar\", \"Kesatria Jeneral\", \"Kereta Pelantak\", \"Tarbil Api\", \"Senator\", \"Peneroka\", \"Wira\"];\n\t\taLangTroops[1] = [\"Askar Belantan\", \"Askar Lembing\", \"Askar Kapak\", \"Peninjau\", \"Kesatria Santo\",\"Kesatria Teutonik\", \"Kereta Pelantak\", \"Tarbil\", \"Penghulu\", \"Peneroka\", \"Wira\"];\n\t\taLangTroops[2] = [\"Falanks\", \"Askar Pedang\", \"Penjelajah\", \"Guruh Theutates\", \"Penunggang Druid\", \"Haeduan\", \"Kereta Pelantak\", \"Tarbil\", \"Pemimpin\", \"Peneroka\", \"Wira\"];\n\t\taLangAttackType = [\"Bantuan\", \"Serangan: Normal\", \"Serangan: Serbuan\"];\n\t\tbreak;\n\n\n case \"nl\":\n\t\taLangAllBuildWithId = [\"Houthakker\", \"Klei-afgraving\", \"IJzermijn\", \"Graanakker\", \"\", \"Zaagmolen\", \"Steenbakkerij\", \"Ijzersmederij\", \"Korenmolen\", \"Bakkerij\", \"Pakhuis\", \"Graansilo\", \"Wapensmid\", \"Uitrustingssmederij\", \"Toernooiveld\", \"Hoofdgebouw\", \"Verzamelenplaats\", \"Marktplaats\", \"Ambassade\", \"Barakken\", \"Stal\", \"Werkplaats\", \"Acedemie\", \"Schuilplaats\", \"Raadhuis\", \"Residentie\", \"Paleis\", \"Schatkamer\", \"Handelskantoor\", \"Grote Barakken\", \"Grote Stal\", \"Stadsmuur\", \"Muur van aarde\", \"Palissade\", \"Steenhouwerij\", \"Brouwerij\", \"Vallenzetter\",\"Heldenhof\", \"Groot Pakhuis\", \"Grote Graansilo\", \"Wereldwonder\", \"Drinkplaats\"];\n\t\taLangAllBuildAltWithId = [\"Houthakker\", \"Klei-afgraving\", \"IJzermijn\", \"Graanakker\", \"\", \"Zaagmolen\", \"Steenbakkerij\", \"Ijzersmederij\", \"Korenmolen\", \"Bakkerij\", \"Pakhuis\", \"Graansilo\", \"Wapensmid\", \"Uitrustingssmederij\", \"Toernooiveld\", \"Hoofdgebouw\", \"Verzamelenplaats\", \"Marktplaats\", \"Ambassade\", \"Barakken\", \"Stal\", \"Werkplaats\", \"Acedemie\", \"Schuilplaats\", \"Raadhuis\", \"Residentie\", \"Paleis\", \"Schatkamer\", \"Handelskantoor\", \"Grote Barakken\", \"Grote Stal\", \"Stadsmuur\", \"Muur van aarde\", \"Palissade\", \"Steenhouwerij\", \"Brouwerij\", \"Vallenzetter\",\"Heldenhof\", \"Groot Pakhuis\", \"Grote Graansilo\", \"Wereldwonder\", \"Drinkplaats\"];\n\t\taLangAddTaskText = [\"Taak toevoegen\", \"Type\", \"Gekozen dorp\", \"Taakdoel\", \"Naar\", \"Modus\", \"Bouwhulp\", \"Grondstofconcentratie\", \"Naar boven\", \"Naar benenden\", \"Del\", \"&#160;&#160;&#160;Doelen\", \"Bewegen \", \"Verwijder alle taken\"]; \n\t\taLangTaskKind = [\"Verbeteren\", \"Gebouw bouwen\", \"Aanvallen\", \"Onderzoeken\", \"Trainen\", \"Handel\", \"NPC\", \"Slopen\", \"Vieren\"]; \n\t\taLangGameText = [\"Niveau\", \"Handelaren\", \"ID\", \"Hoofddorp\", \"Start tijd\", \"Deze tijdsinstelling is onbruikbaar op dit moment.\", \"Naar\", \"Dorp\", \"transport\", \"Van\", \"Transporteren naar\", \"Transporteren van\", \"Terugkeren van\", \"Grondstoffen\", \"Gebouw\", \"Nieuw gebouw bouwen\", \"Leeg\", \"Niveau\"]; \n aLangRaceName = [\"Romeinen\", \"Germanen\", \"Galliërs\"]; \n\t\taLangTaskOfText = [\"Upgrade plannen\", \"Nieuwbouw plannen\", \"Auto ResUpD\", \"Inactief\", \"Start\", \"Bezig\", \"Stop\", \"De grondverdeling van dit dorp is \", \"Autotransport\", \"Autotransport is niet gestart\", \"Gestart\", \"Transport succesvol\", \"Takenlijst\", \"Trans In limit\", \"Standaard\", \"Aanpassen\", \"Hout/Klei/Ijzer\", \"Graan\", \"Slopen plannen\", \n \"Aanval plannen\", \"Aanvalssoort\", \"Tijdsduur\", \"Herhalen\", \"tussentijd\",\"00:30:00\",\"Katapult doel\",\"Random\", \"Onbekend\", \"keren\", \"Maand\", \"Dag\", \"Troepen verstuurd\", \n \"Training plannen\", \"Trainingkant\", \"Trainingstaak voltooid\", \"Handmatig Transport\", \"Stel de tussentijd in\",\"Dit is de tussentijd van de pagina herladen ,\\n standaard is 20 minuten, stel a.u.b. een nieuwe tijd in:\\n\\n\",\"Trans Out Rmn\",\"Feest plannen\",\"Klein Feest\",\"Groot Feest\",\"Stel tussentijd in voor grondstofconcentratie\", \n \"minuten\", \".\",\".\",\"START\",\"STOP\",\"Verbetering plannen\",\"Verbeter aanval\",\"Verbeter uitrusting\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"]; \n aLangErrorText = [\"Te weinig grondstoffen.\", \"Je bouwvakkers zijn al aan het werk.\", \"Bouwopdracht voltooid\", \"Bouwopdracht begint\", \"Bezig\", \"Je pakhuis is te klein. Verbeter je pakhuis om de bouwopdracht voort te zetten.\", \"Je graansilo is te klein. Verbeter je graansilo om de bouwopdracht voort te zetten\", \"Genoeg grondstoffen\",\"Te weinig graanproductie: Verbeter eerst een graanveld\",\"Er is al een feest gaande\"]; \n\t\taLangOtherText = [\"Belangrijk bericht\", \"Alleen de grondstofvelden van het hoofddorp kunnen <br/>verbeterd worden tot niveau 20. Nu is je hoofddorp<br/> niet vastgesteld. Bezoek je profiel a.u.b.\", \"Afkorting hier ^_^\", \"Instellingen succesvol\", \"Geannuleerd\", \"Start de taken\", \"Verbetering succesvol\", \"Start succesvol\", \"Je ras is onbekend, daardoor ook je troeptype. <br/>Bezoek je profiel om je ras vast te stellen<br/>\", \"Bezoek a.u.b. ook je heldenhof om <br/> de snelheid en type van je held vast te stellen.\"]; \n\t\taLangResources=[\"Hout\",\"Klein\",\"Ijzer\",\"Graan\"]; \n\t\taLangTroops[0] = [\"Legionair\", \"Praetoriaan\", \"Imperiaan\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Ram\", \"Vuurkatapult\", \"Senator\", \"Kolonist\", \"Held\"]; \n\t\taLangTroops[1] = [\"Knuppelvechter\", \"Speervechter\", \"Bijlvechter\", \"Verkenner\", \"Paladijn\", \"Germaanse Ridder\", \"Ram\", \"Katapult\", \"Leider\", \"Kolonist\", \"Held\"]; \n\t\taLangTroops[2] = [\"Phalanx\", \"Zwaardvechter\", \"Padvinder\", \"Toetatis donder\", \"Druideruiter\", \"Haeduaan\", \"Ram\", \"Trebuchet\", \"Onderleider\", \"Kolonist\", \"Held\"]; \n\t\taLangAttackType = [\"Versterking\", \"Aanval\", \"Overval\"]; \n\t\tbreak;\n\n\ncase \"hu\": //Harrerp\n\n\t\taLangAllBuildWithId = [\"Favágó\", \"Agyagbánya\", \"Vasércbánya\", \"Búzafarm\", \"\", \"Fűrészüzem\", \"Agyagégető\", \"Vasöntöde\", \"Malom\", \"Pékség\", \"Raktár\", \"Magtár\", \"Fegyverkovács\", \"Páncélkovács\", \"Gyakorlótér\", \"Főépület\", \"Gyülekezőtér\", \"Piac\", \"Követség\", \"Kaszárnya\", \"Istálló\", \"Műhely\", \"Akadémia\", \"Rejtekhely\", \"Tanácsháza\", \"Rezidencia\", \"Palota\", \"Kincstár\", \"Kereskedelmi központ\", \"Nagy Kaszárnya\", \"Nagy Istálló\", \"Kőfal\", \"Földfal\", \"Cölöpfal\", \"Kőfaragó\", \"Sörfőzde\", \"Csapdakészítő\", \"Hősök háza\", \"Nagy Raktár\", \"Nagy Magtár\", \"Világcsoda\",\"Lóitató\"];\n\t\taLangAllBuildAltWithId = [\"Favágó\", \"Agyagbánya\", \"Vasércbánya\", \"Búzafarm\", \"\", \"Fűrészüzem\", \"Agyagégető\", \"Vasöntöde\", \"Malom\", \"Pékség\", \"Raktár\", \"Magtár\", \"Fegyverkovács\", \"Páncélkovács\", \"Gyakorlótér\", \"Főépület\", \"Gyülekezőtér\", \"Piac\", \"Követség\", \"Kaszárnya\", \"Istálló\", \"Műhely\", \"Akadémia\", \"Rejtekhely\", \"Tanácsháza\", \"Rezidencia\", \"Palota\", \"Kincstár\", \"Kereskedelmi központ\", \"Nagy Kaszárnya\", \"Nagy Istálló\", \"Kőfal\", \"Földfal\", \"Cölöpfal\", \"Kőfaragó\", \"Sörfőzde\", \"Csapdakészítő\", \"Hősök háza\", \"Nagy Raktár\", \"Nagy Magtár\", \"Világcsoda\",\"Lóitató\"];\n\t\taLangAddTaskText = [\"Feladat hozzáadása\", \"Feladat\", \"Aktív falu\", \"Feladat célja\", \"Ide\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Fel\", \"Le\", \"Törlés\", \" Feladatok\", \"Sorrend\", \"Összes feladat törlése\"];\n\t\taLangTaskKind = [\"Kiépítés\", \"Új épület\", \"Támadás\", \"Fejlesztés\", \"Kiképzés\", \"Szállítás\", \"NPC\", \"Bontás\", \"Ünnep\"];\n\t\taLangGameText = [\"Szint\", \"Kereskedők\", \"ID\", \"Capital\", \"Indítási idő\", \"az időbeállítás nem szükséges.\", \"ide\", \"Falu\", \"szállítás\", \"innen\", \"Szállítás ide\", \"Szállítás innen\", \"Visszaérkezés\", \"nyersanyag\", \"épület\", \"Új épület építése\", \"empty\", \"szint\"];\n\t\taLangRaceName = [\"Római\", \"Germán\", \"Gall\"];\n\t\taLangTaskOfText = [\"Időzített kiépítés\", \"Időzített építés\", \"AutoResUpD\", \"Not_run\", \"Start\", \"Started\", \"Suspend\", \"The resource fields distribution of this village is \", \"Auto szállítás\", \"Autotransport is not opened\", \"Opened\", \"Szállítás kész\", \"Feladat lista\", \"Trans_In_limit\", \"Default\", \"Módosítás\", \"Fa/Agyag/Vasérc\", \"Búza\", \"Időzített bontás\",\n\t\t\t\"Időzítet támadás\", \"Támadás típus\", \"Utazási idő\", \"Ismétlés\", \"Idő intervallum\",\"00:30:00\",\"Katapult célpont\",\"Véletlen\", \"Ismeretlen\", \"ismétlés\", \"Hónap\", \"Nap\", \"Egységek küldése\",\n\t\t\t\"Időzített kiképzés\",\"Kiképzőhely\",\"Kiképzés befejezve\",\"Egyedi szállítás\",\"Frissítési időintervallum beállítás\",\"Ez az oldalfrissítési időintervallum,\\n az alap 20 perc, írd be az új időt:\\n\\n\",\"Trans_Out_Rmn\",\"Időzített ünnepség\",\"Kis ünnepség\",\"Nagy ünnepség\",\"setInterval of Resources concentration\",\n\t\t\t\"perc\",\"áll\",\"fut\",\"indulj\",\"állj\",\"Időzített fejlesztés\",\"Fegyver fejlesztés\",\"Páncél fejlesztés\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Too few resources.\", \"The workers are already at work.\", \"Építés kész\", \"Építés indul\", \"Fejlesztés folyamatban\", \"A raktárad túl kicsi. Építsd tovább a raktárt, hogy folytathasd az építést\", \"A magtárad túl kicsi. Építsd tovább a magtárt, hogy folytathasd az építést\", \"Elég nyersanyag\",\"Élelemhiány: Előtte egy búzafarmot kell építened \",\"Jelenleg is ünnepelnek\",\"There is already research going on\"];\n\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can be upgraded to level 20. Now your capital is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Beállítás kész\", \"Cancelled\", \"Start the tasks\", \"Kiépítés kész\", \"Run successfully\", \"Your race is unknown, therefore your troop type. Visit your Profile to determine your race.\", \"Please also visit your Hero's Mansion to determine the speed and the type of your hero.\"];\n\t\taLangResources= [\"fa\",\"agyag\",\"vasérc\",\"búza\"];\n\t\taLangTroops[0] = [\"Légiós\", \"Testőr\", \"Birodalmi\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Faltörő kos\", \"Tűzkatapult\", \"Szenátor\", \"Telepes\", \"Hős\"]; //Római\n\t\taLangTroops[1] = [\"Buzogányos\", \"Lándzsás\", \"Csatabárdos\", \"Felderítő\", \"Paladin\", \"Teuton lovag\", \"Faltörő kos\", \"Katapult\", \"Törzsi vezető\", \"Telepes\", \"Hős\"]; //Germán\n\t\taLangTroops[2] = [\"Phalanx\", \"Kardos\", \"Felderítő\", \"Theutat villám\", \"Druida lovas\", \"Haeduan\", \"Falromboló\", \"Harci-katapult\", \"Főnök\", \"Telepes\", \"Hős\"]; //Gall\n\t\taLangAttackType = [\"Támogatás\", \"Támadás\", \"Rablás\"];\n\t\tbreak;\t\t\n\n\ncase \"lv\": //by sultāns updated the 16/04/2010\n\t\taLangAllBuildWithId = [\"Cirsma\", \"Māla Karjers\", \"Dzelzs Raktuves\", \"Labības Lauks\", \"\", \"Kokzāģētava\", \"Ķieģelu Fabrika\", \"Dzelzs Lietuve\", \"Dzirnavas\", \"Maiznīca\", \"Noliktava\", \"Klēts\", \"Ieroču kaltuve\", \"Bruņu kaltuve\", \"Turnīru laukums\", \"Galvenā ēka\", \"Pulcēšanās Vieta\", \"Tirgus laukums\", \"Vēstniecība\", \"Kazarmas\", \"Stallis\", \"Darbnīca\", \"Akadēmija\", \"Paslēptuve\", \"Rātsnams\", \"Rezidence\", \"Pils\", \"Dārgumu glabātuve\", \"Tirdzniecības Birojs\", \"Lielās Kazarmas\", \"Lielais Stallis\", \"Pilsētas Mūris\", \"Zemes Mūris\", \" Palisāde\", \"Akmeņlauztuve\", \"Alus Darītava\", \"Mednieku māja\",\"Varoņu Savrupmāja\", \"Lielā Noliktava\", \"Liela Klēts\", \"Pasaules Brīnums\"];\n\t\taLangAllBuildAltWithId = [\"Cirsma\", \"Māla Karjers\", \"Dzelzs Raktuves\", \"Labības Lauks\", \"\", \"Kokzāģētava\", \"Ķieģelu Fabrika\", \"Dzelzs Lietuve\", \"Dzirnavas\", \"Maiznīca\", \"Noliktava\", \"Klēts\", \"Ieroču kaltuve\", \"Bruņu kaltuve\", \"Turnīru laukums\", \"Galvenā ēka\", \"Pulcēšanās Vieta\", \"Tirgus laukums\", \"Vēstniecība\", \"Kazarmas\", \"Stallis\", \"Darbnīca\", \"Akadēmija\", \"Paslēptuve\", \"Rātsnams\", \"Rezidence\", \"Pils\", \"Dārgumu glabātuve\", \"Tirdzniecības Birojs\", \"Lielās Kazarmas\", \"Lielais Stallis\", \"Pilsētas Mūris\", \"Zemes Mūris\", \" Palisāde\", \"Akmeņlauztuve\", \"Alus Darītava\", \"Mednieku māja\",\"Varoņu Savrupmāja\", \"Lielā Noliktava\", \"Liela Klēts\", \"Pasaules Brīnums\"];\n\t\taLangAddTaskText = [\"Izveidot uzdevumu\", \"Veids\", \"Aktīvais ciems\", \"Uzdevuma mērķis\", \"| Mērķis\", \"Tips\", \"Celtniecības atbalsts\", \"Resursu koncentrācija\", \"Uz augšu\", \"Uz leju\", \"Izdzēst\", \" Uzdevuma stāvoklis\", \"Pārvietot\", \"Dzēst visus uzdevumus\"];\n\t\taLangTaskKind = [\"Uzlabot\", \"Jauna ēka\", \"Uzbrukt\", \"Izpētīt\", \"Apmācīt\", \"Nosūtīt resursus\", \"NPC\", \"Nojaukt\", \"Svinības\"];\n\t\taLangGameText = [\"Līmenis\", \"Tirgotāji\", \"ID\", \"Galvaspilsēta\", \"Sākuma laiks\", \"Īslaicīgi nestrādā\", \"uz\", \"Ciems\", \"Transportēt\", \"no\", \"Transportēt uz\", \"Transportēt no\", \"Atgriezties no\", \"resursi\", \"ēka\", \"Būvēt jaunu ēku\", \"tukšs\", \"līmenis\"];\n\t\taLangRaceName = [\"Romieši\", \"Ģermāņi\", \"Galli\"];\n\t\taLangTaskOfText = [\"Ieplānot uzlabojumus\", \"Ieplānot jaunas ēkas celtniecību\", \"Uzlabot resursu laukus\", \"Izslēgt\", \"Uzsākt\", \"Ieslēgts\", \"Stop\", \"Resursu lauku izvietojums šajā ciemā\", \"Automātiska nosūtīšana\", \"Automātiska nosutīšana atslēgta\", \"Ieslēgts\", \"Veiksmīgi nosūtīts\", \"* Uzdevumi *\", \"Ienākošais limits\", \"Default\", \"Izmainīt\", \"Koks/Māls/Dzelzis\", \"Labība\", \"Ieplānot nojaukšanu\",\n\t\t\t\"Ieplānot uzbrukumu\", \"Uzbrukuma veids\", \"Laiks ceļā\", \"Atkartošanas laiks\", \"laika intervāls\",\"00:30:00\",\"Ar katapultām massēt\",\"Pofig pa ko\", \"Nezināms\", \"laiki\", \"Mēnesis\", \"Diena\", \"Kareivji nosūtīti\",\n\t\t\t\"Ieplānot apmācību\",\"Train site\",\"Kareivju apmācība pabeigta\",\"optimizēt transportēšanu\",\"Ievadīt laiku pēc kura atkārtot iekraušanu\",\"Šis ir intervāls lapas parlādēšanai ,\\n pēc noklusējuma - 20 min., Lūdzu ievadiet jaunu laiku:\\n\\n\",\"Izejošais limits\",\"Ieplānot svinības\",\"mazās svinības\",\"lielās svinības\",\"Uzstādīt laika intervālu resursu sūtīšanai\",\n\t\t\t\"minūtes\", \".\",\".\",\"Start\", \"Stop\", \"Ieplānot uzdevumus\",\"Ieplānot uzbrukumus\",\"Ieplanot aizsardzību\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Nepietiek resursu\", \"Strādnieki jau strādā\", \"Būvniecība pabeigta\", \"Ir uzsākta būvniecība\", \"Attīstības stadija\", \"Nepietiek vietas noliktavā, lūdzu paplašiniet to\", \"Nepietiek vietas klētī, ludzu paplašinoiet to\", \"Pietiekoši resursu\",\"\",\"Svinības jau notiek\"];\n\t\taLangOtherText = [\"Svarīgi\", \"Tikai galvaspilsētā resursu laukus var uzlabot uz 20Lvl. Galvaspilsāta nav noteikta. Ieejiet lūdzu savā profilā\", \"Shortcut here ^_^\", \"Iestatījumi pabeigti\", \"Atcelts\", \"Sākt uzdevumus\", \"Uzlabots veiksmīgi\", \"Viss notiek\", \"Jūsu rase ir unknown. Lūdzu ieejiet profilā.\", \"Kā arī, lūdzu ieejiet varoņu majā, lai noteiktu varoņa veidu un ātrumu\"];\n\t\taLangResources=[\"Koks\",\"Māls\",\"Dzelzs\",\"Labība\"];\n\t\taLangTroops[0] = [\"Leģionārs\", \"Pretorietis\", \"Iekarotājs\", \"Ziņnesis\", \"Romas Jātnieks\", \"Romas Bruņinieks\", \"Mūra Brucinātājs\", \"Uguns Katapulta\", \"Senators\", \"Kolonists\", \"Varonis\"];\n\t\taLangTroops[1] = [\"Rungas Vēzētājs\", \"Šķēpnesis\", \"Karacirvja Vēzētājs\", \"Izlūks\", \"Bruņinieks\", \"Ģermāņu Bruņinieks\", \"Postītājs\", \"Katapultas\", \"Virsaitis\", \"Kolonists\", \"Varonis\"];\n\t\taLangTroops[2] = [\"Falanga\", \"Zobenbrālis\", \"Pēddzinis\", \"Zibens Jātnieks\", \"Priesteris - Jātnieks\", \"Edujs\", \"Tarāns\", \"Trebušets\", \"Barvedis\", \"Kolonists\", \"Varonis\"];\n\t\taLangAttackType = [\"Papildspēki\", \"Uzbrukums\", \"Iebrukums\"];\n\t\tbreak;\n\tcase \"cl\":\n\tcase \"mx\":\n\tcase \"net\": // thanks Renzo\n\t\taLangAllBuildWithId = [\"Leñador\", \"Barrera\", \"Mina\", \"Granja\", \"\", \"Serrería\", \"Ladrillar\", \"Fundición de Hierro\", \"Molino\", \"Panadería\", \"Almacén\", \"Granero\", \"Herrería\", \"Armería\", \"Plaza de torneos\", \"Edif. principal\", \"Plaza reuniones\", \"Mercado\", \"Embajada\", \"Cuartel\", \"Establo\", \"Taller\", \"Academia\", \"Escondite\", \"Ayuntamiento\", \"Residencia\", \"Palacio\", \"Tesoro\", \"Oficina de Comercio\", \"Cuartel Grande\", \"Establo Grande\", \"Muralla\", \"Terraplén\", \"Empalizada\", \"Cantero\", \"Cervecería\", \"Trampero\",\"Hogar del héroe\", \"Almacén Grande\", \"Granero Grande\", \"Maravilla\", \"Abrevadero\"];\n\t\taLangAllBuildAltWithId = [\"Leñador\", \"Barrera\", \"Mina\", \"Granja\", \"\", \"Serrería\", \"Ladrillar\", \"Fundición de Hierro\", \"Molino\", \"Panadería\", \"Almacén\", \"Granero\", \"Herrería\", \"Armería\", \"Plaza de torneos\", \"Edif. principal\", \"Plaza reuniones\", \"Mercado\", \"Embajada\", \"Cuartel\", \"Establo\", \"Taller\", \"Academia\", \"Escondite\", \"Ayuntamiento\", \"Residencia\", \"Palacio\", \"Tesoro\", \"Oficina de Comercio\", \"Cuartel Grande\", \"Establo Grande\", \"Muralla\", \"Terraplén\", \"Empalizada\", \"Cantero\", \"Cervecería\", \"Trampero\",\"Hogar del héroe\", \"Almacén Grande\", \"Granero Grande\", \"Maravilla\", \"Abrevadero\"];\n\t\taLangAddTaskText = [\"Añadir tarea\", \"Estilo\", \"Aldea activa\", \"Objetivo de Tarea\", \"Para\", \"Modo\", \"Soporte de Construcción\", \"Concentración de Recursos\", \"Ir arriba\", \"Ir abajo\", \"Borrar\", \" Contenido de tarea\", \"Mover \", \"Borrar todas las tareas\"];\n\t\taLangTaskKind = [\"Subir\", \"Construir edificio nuevo\", \"Atacar\", \"Mejorar\", \"Entrenar\", \"Transportar\", \"NPC\", \"Demoler\", \"Fiesta\"];\n\t\taLangGameText = [\"Nivel\", \"Comerciantes\", \"ID\", \"Capital\", \"Tiempo de Inicio\", \"esta prueba de tiempo no es útil.\", \"para\", \"Aldea\", \"transportar\", \"de\", \"Transportar a\", \"Transporte de\", \"Regreso de\", \"recursos\", \"edificio\", \"Construir nuevo edificio\", \"vacío\", \"nivel\"];\n\t\taLangRaceName = [\"Romanos\", \"Germanos\", \"Galos\"];\n\t\taLangTaskOfText = [\"Programar subida\", \"Programar nueva Construcción\", \"AutoResUpD\", \"OFF\", \"Empezar\", \"ON\", \"Suspender\", \"La distribución de campos de recursos de esta aldea es \", \"Autotransporte\", \"Autotransporte no está abierto\", \"Abierto\", \"Transporte exitoso\", \"Lista de Tareas\", \"Trans_In_limit\", \"Por Defecto\", \"Modificar\", \"Madera/Barro/Hierro\", \"Cereal\", \"Programar demolición\",\"Programar ataque\", \"Tipo de Ataque\", \"Tiempo de Viaje\", \"Número de Repeticiones\", \"Tiempo de intervalo\",\"00:30:00\",\"Objetivo de Catapulta\",\"Al Azar\", \"Desconocido\", \"Veces\", \"Mes\", \"Día\", \"Tropas enviadas\", \"Programar Cadena\",\"Sitio de Cadena\",\"Tarea de Cadena completada\",\"Transporte Custom\",\"Establecer tiempo de intervalo de la recarga\",\"este es el tiempo de intervalo entre cada recarga de la página,\\n Por defecto es 20 minutos, por favor introduza el nuevo tiempo:\\n\\n\",\"Trans_Out_Rmn\",\"Programar Fiesta\",\"fiesta pequeña\",\"fiesta grande\",\"Establecer intervalo de concentración de recursos\",\"minutos\",\".\",\".\",\"START\",\"STOP\", \"Programar Mejora\", \"Mejorar Ataque\", \"Mejorar Defensa\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Muy pocos recursos.\", \"Los aldeanos ya están trabajando.\", \"Construcción completa\", \"Empezando construcción\", \"En desarrollo\", \"Su almacén es muy pequeño. Por favor amplíe su almacén para continuar su construcción\", \"Su almacén es muy pequeño. Por favor amplíe su almacén para continuar su construcción\", \"Suficientes Recursos\",\"Falta de Alimento: Amplíe una granja primero\",\"Ya hay una fiesta en progreso\",\"Ya hay una exploración en progreso\"];\n\t\taLangOtherText = [\"Nota importante\", \"Solo los campos de recurso de la capital pueden ser ampliados a nivel 20. Su capital no ha sido detectada. Por favor visite su perfil.\", \"Atajo aquí ^_^\", \"Configuración completada\", \"Cancelado\", \"Empezar tareas\", \"Mejora Exitosa\", \"Ejecución exitosa\", \"Su raza es desconocida, asimismo su tipo de tropas. Visite su Perfil para determinar su raza.\", \"Por favor visite su Hogar del Heroe para determinar la velocidad y tipo de su heroe.\"];\n\t\taLangResources = [\"madera\", \"barro\", \"hierro\", \"cereal\"];\n\t\taLangTroops[0] = [\"Legionario\", \"Pretoriano\", \"Imperano\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Carnero\", \"Catapulta de Fuego\", \"Senador\", \"Colono\", \"Héroe\"];\n\t\taLangTroops[1] = [\"Luchador de Porra\", \"Lancero\", \"Luchador de Hacha\", \"Emisario\", \"Paladín\", \"Jinete Teutón\", \"Ariete\", \"Catapulta\", \"Cabecilla\", \"Colono\", \"Héroe\"];\n\t\taLangTroops[2] = [\"Falange\", \"Luchador de Espada\", \"Batidor\", \"Rayo de Teutates\", \"Jinete Druida\", \"Jinete Eduo\", \"Ariete\", \"Catapulta de Guerra\", \"Cacique\", \"Colono\", \"Héroe\"];\n\t\taLangAttackType = [\"Refuerzo\", \"Ataque\", \"Atraco\"];\n\t\tbreak;\n\n\tcase \"se\": // thanks to Arias\n\t\taLangAllBuildWithId = [\"Skogshuggare\", \"Lergrop\", \"Järngruva\", \"Vetefält\", \"\", \"Sågverk\", \"Murbruk\", \"Järngjuteri\", \"Vetekvarn\", \"Bageri\", \"Magasin\", \"Silo\", \"Smedja\", \"Vapenkammare\", \"Tornerplats\", \"Huvudbyggnad\", \"Samlingsplats\", \"Marknadsplats\", \"Ambassad\", \"Baracker\", \"Stall\", \"Verkstad\", \"Akademi\", \"Grotta\", \"Stadshus\", \"Residens\", \"Palats\", \"Skattkammare\", \"Handelskontor\", \"Stor barack\", \"Stort stall\", \"Stadsmur\", \"Jordvall\", \"Palisad\", \"Stenmurare\", \"Bryggeri\", \"Fälla\", \"Hjältens egendom\", \"Stort magasin\", \"Stor silo\", \"Världsunder\", \"Vattenbrunn\"];\n\t\taLangAllBuildAltWithId = [\"Skogshuggare\", \"Lergrop\", \"Järngruva\", \"Vetefält\", \"\", \"Sågverk\", \"Murbruk\", \"Järngjuteri\", \"Vetekvarn\", \"Bageri\", \"Magasin\", \"Silo\", \"Smedja\", \"Vapenkammare\", \"Tornerplats\", \"Huvudbyggnad\", \"Samlingsplats\", \"Marknadsplats\", \"Ambassad\", \"Baracker\", \"Stall\", \"Verkstad\", \"Akademi\", \"Grotta\", \"Stadshus\", \"Residens\", \"Palats\", \"Skattkammare\", \"Handelskontor\", \"Stor barack\", \"Stort stall\", \"Stadsmur\", \"Jordvall\", \"Palisad\", \"Stenmurare\", \"Bryggeri\", \"Fälla\", \"Hjältens egendom\", \"Stort magasin\", \"Stor silo\", \"Världsunder\", \"Vattenbrunn\"];\n\t\taLangAddTaskText = [\"Lägg till uppgift\", \"Stil\", \"Aktiv by\", \"Task target\", \"Till\", \"Läge\", \"Kontruktions stöd\", \"Råvaro koncentration\", \"Flytta upp\", \"Flytta ner\", \"Radera\", \"Uppgifter\", \"Flytta \", \"Radera alla uppgifterna\"];\n\t\taLangTaskKind = [\"Uppgradering:\", \"Ny byggnad:\", \"Attack:\", \"Forskning:\", \"Träning:\", \"Transport:\", \"NPC:\", \"Demolish:\", \"Celebration:\"];\n\t\taLangGameText = [\"Nivå \", \"Handel\", \"ID\", \"Capital\", \"Start time\", \"this timesetting is unuseful now.\", \"till\", \"By\", \"Transport\", \"från\", \"Transport till\", \"Transport från\", \"Återvänder från\", \"Råvaror\", \"Byggnad\", \"Konstruera en ny byggnad\", \"Tom\", \"Nivå\"];\n\t\taLangRaceName = [\"Romare\", \"Germaner\", \"Galler\"];\n\t\taLangTaskOfText = [\"Schemalägg uppgradering\", \"Schemalägg ny byggnad\", \"Uppgradera fält\", \"Ej Aktiv\", \"Starta\", \"Startad\", \"Avbryt\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport lyckades\", \"Uppgifter\", \"Trans_In_limit\", \"Standard\", \"Ändra \", \"Trä/Lera/Järn\", \"Vete\", \"Schemalägg demolition\",\n\t\t\t\"Schemalägg attack\", \"Attack type\", \"Res tid\", \"antal upprepningar\", \"interval time\",\"00:30:00\",\"Catapult target\",\"Random\", \"Okänd\", \"times\", \"Månad\", \"Dag\", \"Trupper skickade\", \"Schemalägg Träning\",\"Tränings plats\",\"Träningen klar\",\"Anpassad transport\",\"Sätt intervallen för omladdning av sidan\",\"Detta är intevallen för omladdning av sida,\\n standard är 20 minuter, vänligen ange ny intervall:\\n\\n\",\"Trans_Out_Rmn\",\"Schemalägg fest\",\"Liten fest\",\"Stor fest\",\"Sätt intervall av råvarukoncentration\",\n\t\t\t\"minuter\",\".\",\".\",\"START\",\"STOP\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"För få råvaror\", \"Dina arbetare är redan ute på jobb\", \"Byggnad klar\", \"Påbörjar byggnad\", \"Under utveckling\", \"Ditt magasin är för litet. Vänligen uppgradera ditt magasin för att fortsätta ditt byggnadsarbete.\", \"Din silo är för liten. Vänligen uppgradera din silo för att fortsätta ditt byggnadsarbete.\", \"Tillräckligt med resurser\", \"Brist på mat: utöka vetefälten först\", \"En fest pågår redan.\"];\n\t\taLangOtherText = [\"Important note\", \"Only the resource fields of the capital can <br/>be upgraded to level 20. Now your capital<br/> is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup klar\", \"Avbruten\", \"Starta uppgifterna\", \"successfully\", \"Run successfully\", \"Your race is unknown, therefore your troop type. <br/>Visit your Profile to determine your race.<br/>\", \"Please also visit your Hero's Mansion to determine<br/> the speed and the type of your hero.\" , \"Upgrade\"];\n\t\taLangResources=[\"Trä\",\"Lera\",\"Järn\",\"Vete\"];\n\t\taLangTroops[0] = [\"Legionär\", \"Praetorian\", \"Imperiesoldat\", \"Spårare\", \"Imperieriddare\", \"Ceasarriddare\", \"Murbräcka\", \"Eld Katapult\", \"Senator\", \"Nybyggare\", \"Hjälte\"];\n\t\taLangTroops[1] = [\"Klubbman\", \"Spjutman\", \"Yxman\", \"Scout\", \"Paladin\", \"Germansk Knekt\", \"Murbräcka\", \"Katapult\", \"Stamledare\", \"Nybyggare\", \"Hjälte\"];\n\t\taLangTroops[2] = [\"Falanx\", \"Svärdskämpe\", \"Spårare\", \"Theutates Blixt\", \"Druidryttare\", \"Haeduan\", \"Murbräcka\", \"Krigskatapult\", \"Hövding\", \"Nybyggare\", \"Hjälte\"];\n\t\taLangAttackType = [\"Förstärkning\", \"Normal\", \"Plundring\"];\n\t\tbreak;\n\n\tcase \"it\": // thanks Hamkrik, corrections by baldo 2011.04.08\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": // translations for travian version 3.6\n\t\t\t\t// 2011.02.16 -- provided by Psea\n\t\t\t\taLangAllBuildWithId = [\"Bosco\", \"Pozzo d'argilla\", \"Miniera di ferro\", \"Campo di grano\", \"\", \"Segheria\", \"Fabbrica di Mattoni\", \"Fonderia\", \"Mulino\", \"Forno\", \"Magazzino\", \"Granaio\", \"Fabbro\", \"Armeria\", \"Arena\", \"Palazzo Pubblico\", \"Base militare\", \"Mercato\", \"Ambasciata\", \"Caserma\", \"Scuderia\", \"Officina\", \"Accademia\", \"Deposito Segreto\", \"Municipio\", \"Reggia\", \"Castello\", \"Camera del tesoro\", \"Ufficio Commerciale\", \"Grande Caserma\", \"Grande Scuderia\", \"Mura Cittadine\", \"Fortificazioni\", \"Palizzata\", \"Genio civile\", \"Birrificio\", \"Esperto di trappole\", \"Dimora dell'Eroe\", \"Grande Magazzino\", \"Grande Granaio\", \"Meraviglia\", \"Fonte Equestre\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Bosco\", \"Pozzo d'argilla\", \"Miniera di ferro\", \"Campo di grano\", \"\", \"Segheria\", \"Fabbrica di mattoni\", \"Fonderia\", \"Mulino\", \"Forno\", \"Magazzino\", \"Granaio\", \"Fabbro\", \"Armeria\", \"Arena\", \"Palazzo Pubblico\", \"Base militare\", \"Mercato\", \"Ambasciata\", \"Caserma\", \"Scuderia\", \"Officina\", \"Accademia\", \"Deposito Segreto\", \"Municipio\", \"Reggia\", \"Castello\", \"Camera del tesoro\", \"Ufficio Commerciale\", \"Grande Caserma\", \"Grande Scuderia\", \"Mura cittadine\", \"Fortificazioni\", \"Palizzata\", \"Genio civile\", \"Birrificio\", \"Esperto di trappole\", \"Dimora dell'Eroe\", \"Grande Magazzino\", \"Grande Granaio\", \"Meraviglia\", \"Fonte Equestre\"];\n\t\t\t\taLangAddTaskText = [\"Aggiungere Compito\", \"Tipo\", \"Villaggio Attivo\", \"Obiettivo del Compito\", \"Coordinate\", \"Modalita'\", \"Supporto ampliamento risorse\", \"Concentrazione risorse\", \"SU\", \"GIU\", \"Cancella\", \" Contenuto del Compito\", \"Muovere\", \"Cancella tutti i Compiti\"]; \n\t\t\t\taLangTaskKind = [\"Amplia\", \"Nuovo Edificio\", \"Attacco\", \"Ricerca\", \"Addestra\", \"Trasporto\", \"NPC\", \"Demolire\", \"Festa\"]; \n\t\t\t\taLangGameText = [\"Livello\", \"Mercanti\", \"ID\", \"Capitale\", \"Tempo di Inizio\", \"questa impostazione di tempo non si usa.\", \"Coordinate\", \"Villaggio\", \"trasporto\", \"dalla\", \"Trasporto alla\", \"Trasporto dalla\", \"Ritorno dalla\", \"risorse\", \"edifici\", \"Costruisci nuovo edificio\", \"vuoto\", \"livello\"]; \n\t\t\t\taLangRaceName = [\"Romani\", \"Teutoni\", \"Galli\"]; \n\t\t\t\taLangTaskOfText = [\"Programma Ampliamento\", \"Programma Nuovo Edificio\", \"AutoResUpD\", \"Non_attivo\", \"Start\", \"Iniziato\", \"Sospeso\", \"La distribuzione delle risorse di questo villaggio e' \", \"Autotrasporto\", \"Autotrasporto non e aperto\", \"Aperto\", \"Trasportato con successo\", \"Lista Compiti\", \"Trans_In_limit\", \"Default\", \"Modificare\", \"Legno/Argilla/Ferro\", \"Grano\", \"Demolire\",\n\t\t\t\t\t\"Programma Attacco\", \"Tipo Attacco\", \"Tempo Percorso\", \"ripeti\", \"intervallo di tempo\", \"00:30:00\", \"Obiettivo Catapulta\", \"Random\", \"Sconosciuto\", \"volte\", \"Mese\", \"Giorno\", \"Truppe Inviate\", \"Programma Addestramento\", \"Edificio di addestramento\", \"Addestramento Finito\", \"Transporto Diverso\", \"ripeti numero volte\", \"questo é l'intervallo di ricarica pagina,\\n default é 20 minuti, per favore inserire nuovo tempo:\\n\\n\", \"Trans_Out_Rmn\", \"Programma la Festa\", \"festa piccola\", \"Festa grande\", \"Imposta l'Intervallo di Concentrazione delle Risorse\",\n\t\t\t\t\t\"minuti\", \"in attesa\", \"corrente\", \"fare\", \"pausa\", \"Schedula Miglioria\", \"Migliora l'attacco\", \"Migliora la difesa\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"]; \n\t\t\t\taLangErrorText = [\"Mancano le risorse.\", \"I Lavoratori Sono Pronti per Lavorare\", \"Edificio Completo\", \"Inizia Edificio\", \"Nella Ricerca\", \"Il tuo Magazzino é piccolo. Per favore amplia il magazzino per continuare la costruzione\", \"Il tuo Granaio e piccolo. Per favore amplia il granaio per continuare la costruzione\", \"Risorse sufficienti\", \"Mancanza di Cibo: Amplia i Campi di grano\", \"Pronta la Festa\"]; \n\t\t\t\taLangOtherText = [\"Nota Importante \", \"Solo i Campi della Capitale possono essere ampliati al livello 20. La tua capitale non é determinata. Visita il tuo Profilo per favore.\", \"Shortcut here ^_^\", \"Setup compiuto\", \"Cancellato\", \"Inizia i Compiti\", \"Ampliato con successo\", \"Iniziato con successo\", \"La tua razza e' sconosciuta, anche il tipo di truppe. Visita il tuo Profilo per determinare la razza.\", \"Per favore visita Circolo degli eroi per determinare la velocita e il tipo di eroe.\"];\n\t\t\t\taLangResources = [\"legno\", \"argilla\", \"ferro\", \"grano\"]; \n\t\t\t\taLangTroops[0] = [\"Legionario\", \"Pretoriano\", \"Imperiano\", \"Emissario a cavallo\", \"Cavaliere del Generale\", \"Cavaliere di Cesare\", \"Ariete\", \"Onagro\", \"Senatore\", \"Colono\", \"Eroe\"]; \n\t\t\t\taLangTroops[1] = [\"Combattente\", \"Alabardiere\", \"Combattente con ascia\", \"Esploratore\", \"Paladino\", \"Cavaliere Teutonico\", \"Ariete\", \"Catapulta\", \"Comandante\", \"Colono\", \"Eroe\"]; \n\t\t\t\taLangTroops[2] = [\"Falange\", \"Combattente con spada\", \"Ricognitore\", \"Fulmine di Teutates\", \"Cavaliere druido\", \"Paladino di Haeduan\", \"Ariete\", \"Trabucco\", \"Capo tribù\", \"Colono\", \"Eroe\"]; \n\t\t\t\taLangAttackType = [\"Rinforzi\", \"Attacco\", \"Raid\"];\n\t\t\t\tbreak;\n\t\t\tcase \"4.0\": // translations for travian version 4.0\n\t\t\t\t// 2011.03.28 -- provided by Psea\n\t\t\t\taLangAllBuildWithId = [\"Bosco\", \"Pozzo d'argilla\", \"Miniera di ferro\", \"Campo di grano\", \"\", \"Segheria\", \"Fabbrica di Mattoni\", \"Fonderia\", \"Mulino\", \"Forno\", \"Magazzino\", \"Granaio\", \"Fucina\", \"Fucina\", \"Arena\", \"Palazzo Pubblico\", \"Base militare\", \"Mercato\", \"Ambasciata\", \"Caserma\", \"Scuderia\", \"Officina\", \"Accademia\", \"Deposito Segreto\", \"Municipio\", \"Reggia\", \"Castello\", \"Camera del tesoro\", \"Ufficio Commerciale\", \"Grande caserma\", \"Grande Scuderia\", \"Mura Cittadine\", \"Fortificazioni\", \"Palizzata\", \"Genio Civile\", \"Birrificio\", \"Esperto di trappole\", \"Dimora dell'Eroe\", \"Grande Magazzino\", \"Grande Granaio\", \"Meraviglia\", \"Fonte Equestre\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Bosco\", \"Pozzo d'argilla\", \"Miniera di ferro\", \"Campo di grano\", \"\", \"Segheria\", \"Fabbrica di mattoni\", \"Fonderia\", \"Mulino\", \"Forno\", \"Magazzino\", \"Granaio\", \"Fucina\", \"Fucina\", \"Arena\", \"Palazzo Pubblico\", \"Base militare\", \"Mercato\", \"Ambasciata\", \"Caserma\", \"Scuderia\", \"Officina\", \"Accademia\", \"Deposito Segreto\", \"Municipio\", \"Reggia\", \"Castello\", \"Camera del tesoro\", \"Ufficio Commerciale\", \"Grande Caserma\", \"Grande Scuderia\", \"Mura cittadine\", \"Fortificazioni\", \"Palizzata\", \"Genio Civile\", \"Birrificio\", \"Esperto di trappole\", \"Dimora dell'Eroe\", \"Grande Magazzino\", \"Grande Granaio\", \"Meraviglia\", \"Fonte Equestre\"];\n\t\t\t\taLangAddTaskText = [\"Aggiungere Compito\", \"Tipo\", \"Villaggio Attivo\", \"Obiettivo del Compito\", \"Coordinate\", \"Modo\", \"Supporto di Costruzione\", \"Concentrazione risorse\", \"SU\", \"GIU\", \"Cancella\", \" Contenuto del Compito\", \"Muovere\", \"Cancella tutti i Compiti\"]; \n\t\t\t\taLangTaskKind = [\"Amplia\", \"Nuovo Edificio\", \"Attacco\", \"Ricerca\", \"Addestra\", \"Trasporto\", \"NPC\", \"Demolire\", \"Festa\"]; \n\t\t\t\taLangGameText = [\"Livello\", \"Mercanti\", \"ID\", \"Capitale\", \"Tempo di Inizio\", \"Questa impostazione di tempo non si usa.\", \"Coordinate\", \"Villaggio\", \"Trasporto\", \"dalla\", \"Trasporto a\", \"Trasporto da\", \"In ritorno da\", \"Risorse\", \"Edifici\", \"Costruisci nuovo edificio\", \"vuoto\", \"livello\"]; \n\t\t\t\taLangRaceName = [\"Romani\", \"Teutoni\", \"Galli\"]; \n\t\t\t\taLangTaskOfText = [\"Programma Ampliamento\", \"Programma Nuovo Edificio\", \"AutoResUpD\", \"Non_attivo\", \"Start\", \"Iniziato\", \"Sospeso\", \"La distribuzione delle risorse di questo villaggio e' \", \"Autotrasporto\", \"Autotrasporto non aperto\", \"Aperto\", \"Trasportato con successo\", \"Lista Compiti\", \"Trans_In_limit\", \"Default\", \"Modificare\", \"Legno/Argilla/Ferro\", \"Grano\", \"Demolire\",\n\t\t\t\t\t\"Programma Attacco\", \"Tipo Attacco\", \"Tempo Percorso\", \"ripeti\", \"intervallo di tempo\", \"00:30:00\", \"Obiettivo Catapulta\", \"Random\", \"Sconosciuto\", \"volte\", \"Mese\", \"Giorno\", \"Truppe Inviate\", \"Programma Addestramento\", \"Edificio addestramento\", \"Addestramento Finito\", \"Transporto Diverso\", \"Ripeti numero volte\", \"Questo é l'intervallo di ricarica pagina,\\n default é 20 minuti, per favore inserisci il nuovo tempo:\\n\\n\", \"Trans_Out_Rmn\", \"Programma la Festa\", \"Festa piccola\", \"Festa grande\", \"Imposta l'Intervallo di Concentrazione delle Risorse\",\n\t\t\t\t\t\"minuti\", \"in attesa\", \"corrente\", \"fare\", \"pausa\", \"Schedula miglioria\", \"Migliora attacco\", \"Migliora difesa\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"]; \n\t\t\t\taLangErrorText = [\"Mancano le risorse.\", \"I tuoi costruttori sono già occupati nella costruzione di un altro edificio\", \"Livello massimo raggiunto\", \"Inizia Edificio\", \"Nella Ricerca\", \"Il tuo Magazzino \", \"Il tuo Granaio \", \"Risorse disponibili\", \"Mancanza di cibo\", \"Pronta la Festa\"]; \n\t\t\t\taLangOtherText = [\"Nota Importante \", \"Solo i Campi della Capitale possono essere ampliati al livello 20. La tua capitale non é determinata. Visita il tuo Profilo per favore.\", \"Shortcut here ^_^\", \"Setup compiuto\", \"Cancellato\", \"Inizia i Compiti\", \"Ampliato con successo\", \"Iniziato con successo\", \"La tua razza e' sconosciuta, anche il tipo di truppe. Visita il tuo Profilo per determinare la razza.\", \"Per favore visita il Circolo degli eroi per determinare la velocita e tipo di eroe.\"];\n\t\t\t\taLangResources = [\"legno\", \"argilla\", \"ferro\", \"grano\"]; \n\t\t\t\taLangTroops[0] = [\"Legionario\", \"Pretoriano\", \"Imperiano\", \"Emissario a cavallo\", \"Cavaliere del Generale\", \"Cavaliere di Cesare\", \"Ariete\", \"Onagro\", \"Senatore\", \"Colono\", \"Eroe\"]; \n\t\t\t\taLangTroops[1] = [\"Combattente\", \"Alabardiere\", \"Combattente con ascia\", \"Esploratore\", \"Paladino\", \"Cavaliere Teutonico\", \"Ariete\", \"Catapulta\", \"Comandante\", \"Colono\", \"Eroe\"]; \n\t\t\t\taLangTroops[2] = [\"Falange\", \"Combattente con spada\", \"Ricognitore\", \"Fulmine di Teutates\", \"Cavaliere druido\", \"Paladino di Haeduan\", \"Ariete\", \"Trabucco\", \"Capo tribù\", \"Colono\", \"Eroe\"]; \n\t\t\t\taLangAttackType = [\"Rinforzi\", \"Attacco\", \"Raid\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrowLogicError ( \"initializeLangVars():: Travian Version not set, when initializing language variables for \\'it\\'!!\" );\n\t\t}\n\t\tbreak;\n\n\n\tcase \"si\": // thanks Bananana and Tuga\n\t\taLangAllBuildWithId = [\"Gozdar\", \"Glinokop\", \"Rudnik železa\", \"Žitno polje\", \"\", \"Žaga\", \"Opekarna\", \"Talilnica železa\", \"Mlin\", \"Pekarna\", \"Skladišče\", \"Žitnica\", \"Izdelovalec orožja\", \"Izdelovalec oklepov\", \"Vadbišče\", \"Gradbeni ceh\", \"Zbirališče\", \"Tržnica\", \"Ambasada\", \"Barake\", \"Konjušnica\", \"Izdelovalec oblegovalnih naprav\", \"Akademija\", \"Špranja\", \"Mestna hiša\", \"Rezidenca\", \"Palača\", \"Zakladnica\", \"Trgovski center\", \"Velike barake\", \"Velika konjušnica\", \"Mestno obzidje\", \"Zemljen zid\", \"Palisada\", \"Kamnosek\", \"Pivnica\", \"Postavljalec pasti\", \"Herojeva rezidenca\", \"Veliko skladišče\", \"Velika žitnica\", \"Čudež sveta\"];\n\t\taLangAllBuildAltWithId = [\"Gozdar\", \"Glinokop\", \"Rudnik železa\", \"Žitno polje\", \"\", \"Žaga\", \"Opekarna\", \"Talilnica železa\", \"Mlin\", \"Pekarna\", \"Skladišče\", \"Žitnica\", \"Izdelovalec orožja\", \"Izdelovalec oklepov\", \"Vadbišče\", \"Gradbeni ceh\", \"Zbirališče\", \"Tržnica\", \"Ambasada\", \"Barake\", \"Konjušnica\", \"Izdelovalec oblegovalnih naprav\", \"Akademija\", \"Špranja\", \"Mestna hiša\", \"Rezidenca\", \"Palača\", \"Zakladnica\", \"Trgovski center\", \"Velike barake\", \"Velika konjušnica\", \"Mestno obzidje\", \"Zemljen zid\", \"Palisada\", \"Kamnosek\", \"Pivnica\", \"Postavljalec pasti\", \"Herojeva rezidenca\", \"Veliko skladišče\", \"Velika žitnica\", \"Čudež sveta\"];\n\t\taLangAddTaskText = [\"Dodaj nalogo\", \"Style\", \"Aktivna vas\", \"Nadgradi\", \"Na\", \"Mode\", \"Construction support\", \"Resources concentration\", \"Prestavi gor\", \"Prestavi dol\", \"Izbriši\", \" Naloge\", \"Premakni \", \"Izbriši vse naloge\"];\n\t\taLangTaskKind = [\"Nadgradi\", \"Zazidljiva parcela\", \"Napad\", \"Razišči\", \"Uri\", \"Transport\", \"NPC\", \"Demolish\", \"Festival\"];\n\t\taLangGameText = [\"Stopnja\", \"Merchants\", \"ID\", \"Prestolnica\", \"Začetek ob\", \"Nastavitev časa ni pomembna.\", \"to\", \"Vas\", \"transport\", \"from\", \"Transport to\", \"Transport from\", \"Return from\", \"resources\", \"building\", \"Postavi nov objekt\", \"empty\", \"level\"];\n\t\taLangRaceName = [\"Rimljani\", \"Tevtoni\", \"Galci\"];\n\t\taLangTaskOfText = [\"Nadgradi kasneje\", \"Postavi nov objekt\", \"Surovine gor\", \"Pauza\", \"Začetek\", \"Začeto\", \"Prekliči\", \"The resource fields distribution of this village is \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Naloge\", \"Trans_In_limit\", \"Osnovno\", \"Spremeni\", \"Les/Glina/Železo\", \"Crop\", \"Podri kasneje\",\n\t\t\t\"Napadi kasneje\", \"Tip napada\", \"Do napada\", \"Ponovi\", \"Vrnitev čez\",\"00:30:00\",\"Tarča katapultov\",\"Naključno\", \"Unknown\", \"times\", \"Month\", \"Day\", \"Enote poslane\", \"Uri kasneje\",\"Mesto urjenja\",\"Urjenje končano\",\"customTransport\",\"setup interval time of reload\",\"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\",\"Trans_Out_Rmn\",\"ScheduleParty\",\"mali festival\",\"veliki festival\",\"setInterval of Resources concentration\",\n\t\t\t\"minute\",\".\",\".\",\"START\",\"STOP\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Primankljaj surovin.\", \"Delavci so že na delu.\", \"Zgrajeno\", \"Začnem z gradnjo\", \"V razvoju\", \"Seu Armazém é pequeno. Evolua o seu armazém para continuar a sua construção\", \"Seu Celeiro é pequeno. Evolua o seu Celeiro para continuar a sua construção\", \"Recursos suficientes\",\"Já se encontra uma celebração em curso\"];\n\t\taLangOtherText = [\"Pomembno!\", \"Samo polja v prestolnicigredo do stopnje 20 . A sua capitalnao está detectavel. Por favor visite o seu perfil.\", \"Atalho aqui ^_^\", \"Naloga uspešno dodana\", \"Preklicano\", \"Začni z nalogo\", \"Uspešno nadgrajeno\", \"Executar com sucesso\", \"Sua raça é desconhecida, e o seu tipo de tropa também.Visite o seu perfil para determinar as raça.\", \"Por favor visite a sua mansão do heroi para determinara velocidade e o tipo de heroi.\"];\n\t\taLangResources=[\"Les\",\"Glina\",\"Železo\",\"Žito\"]; \n\t\taLangTroops[0] = [\"Legionar\", \"Praetorijan\", \"Imperijan\", \"Izvidnik\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Oblegovalni oven\", \"Ognjeni katapult\", \"Senator\", \"Kolonist\", \"Heroj\"];\n\t\taLangTroops[1] = [\"Gorjačar\", \"Suličar\", \"Metalec sekir\", \"Skavt\", \"Paladin\", \"Tevtonski vitez\", \"Oblegovalni oven\", \"Mangonel\", \"Vodja\", \"Kolonist\", \"Heroj\" ];\n\t\taLangTroops[2] = [\"Falanga\", \"Mečevalec\", \"Stezosledec\", \"Theutatesova Strela\", \"Druid\", \"Haeduan\", \"Oblegovalni oven\", \"Trebušet\", \"Poglavar\", \"Kolonist\", \"Heroj\"];\n\t\taLangAttackType = [\"Okrepitev\", \"Napad\", \"Ropanje\"];\n\t\tbreak;\n\n\tcase \"vn\": // thanks Tuga\n\t\taLangAllBuildWithId = [\"Tiều Phu\", \"Mỏ Đất Sét\", \"Mỏ sắt\", \"Ruộng lúa\", \"\", \"Xưởng Gỗ\", \"Lò Gạch\", \"Lò Rèn\", \"Nhà Xay Lúa\", \"Lò Bánh\", \"Nhà Kho\", \"Kho Lúa\", \"Thợ Rèn\", \"Lò Luyện Giáp\", \"Võ Đài\", \"Nhà Chính\", \"Binh Trường\", \"Chợ\", \"Đại Sứ Quán\", \"Trại Lính\", \"Chuồng Ngựa\", \"Xưởng\", \"Học Viện\", \"Hầm Ngầm\", \"Tòa Thị Chính\", \"Lâu Đài\", \"Cung Điện\", \"Kho Bạc\", \"Phòng Thương Mại\", \"Doanh Trại Lớn\", \"Trại Ngựa\", \"Tường Thành\", \"Tường Đất\", \"Tường Rào\", \"Thợ Xây Đá\", \"Quán bia\", \"Hố Bẫy\",\"Lâu đài tướng\", \"Nhà Kho Lớn\", \"Kho Lúa Lớn\", \"Kỳ Quan\", \"Tàu ngựa\"];\n\t\taLangAllBuildAltWithId = [\"Tiều Phu\", \"Mỏ Đất Sét\", \"Mỏ sắt\", \"Ruộng lúa\", \"\", \"Xưởng Gỗ\", \"Lò Gạch\", \"Lò Rèn\", \"Nhà Xay Lúa\", \"Lò Bánh\", \"Nhà Kho\", \"Kho Lúa\", \"Thợ Rèn\", \"Lò Luyện Giáp\", \"Võ Đài\", \"Nhà Chính\", \"Binh Trường\", \"Chợ\", \"Đại Sứ Quán\", \"Trại Lính\", \"Chuồng Ngựa\", \"Xưởng\", \"Học Viện\", \"Hầm Ngầm\", \"Tòa Thị Chính\", \"Lâu Đài\", \"Cung Điện\", \"Kho Bạc\", \"Phòng Thương Mại\", \"Doanh Trại Lớn\", \"Trại Ngựa\", \"Tường Thành\", \"Tường Đất\", \"Tường Rào\", \"Thợ Xây Đá\", \"Quán bia\", \"Hố Bẫy\",\"Lâu đài tướng\", \"Nhà Kho Lớn\", \"Kho Lúa Lớn\", \"Kỳ Quan\", \"Tàu ngựa\"];\n\t\taLangAddTaskText = [\"Thêm nhiệm vụ\", \"Loại\", \"Tại làng\", \"Mục tiêu\", \"Tới\", \"Phương thức\", \"Tự động\", \"Tùy chỉnh\", \"Di chuyển lên\", \"Di chuyển xuống\", \"Xóa\", \"&#160;&#160;&#160;Nội dung công việc\", \"Di chuyển\", \"Xóa tất cả danh mục\"];\n\t\taLangTaskKind = [\"Nâng cấp\", \"Kiến Trúc Mới\", \"Tấn công\", \"Nghiên cứu\", \"Huấn luyện\", \"Vận chuyển\", \"NPC\", \"Phá hủy\", \"ăn mừng\"];\n\t\taLangGameText = [\"Cấp \", \"Lái Buôn\", \"Tại vị trí\", \"Thủ đô\", \"Bắt đầu tại\", \"Chưa dùng được chức năng này.\", \"đến\", \"Làng\", \"vận chuyển\", \"từ\", \"Vận chuyển đến\", \"Vận chuyển từ\", \"Trở về từ\", \"Tài nguyên\", \"Kiến trúc\", \"Xây Kiến Trúc Mới\", \"không có gì\", \"Cấp\"];\n\t\taLangRaceName = [\"Tộc Romans\", \"Tộc Teutons\", \"Tộc Gauls\"];\n\t\taLangTaskOfText = [\"Lên lịch nâng cấp kiến trúc này\", \"Lên lịch xây kiến trúc này\", \"Tự động nâng cấp các mỏ\", \"Chưa kích hoạt\", \"Kích hoạt\", \"Đã kích hoạt\", \"Hủy\", \"Đây là làng loại \", \"Tự động gửi tài nguyên\", \"Tự động gửi tài nguyên chưa được kích hoạt\", \"Đã được kích hoạt\", \"Gủi thành công\", \"Danh mục\", \"Tài nguyên bạn muốn nhận\", \"Mặc định\", \"Tùy chỉnh \", \"Gỗ/Đất sét/Sắt\", \"Lúa\", \"Lên lịch phá hủy công trình\",\n\t\t\t\"Lên lịch tấn công làng này\", \"Loại tấn công\", \"Thời gian để đến nơi\", \"Số lần lặp lại\", \"Khoảng cách giữa các lần lặp lại\",\"00:30:00\",\"Mục tiêu cata\",\"Ngẫu nhiên\", \"Chưa biết\", \"Giờ\", \"Tháng\", \"Ngày\", \"Đã gửi lính\", \"Lên lịch huấn luyện lính này\",\"Train ubication\",\"Lính đang được huấn luyện\",\"Tùy chỉnh gửi tài nguyên\",\"Thiết lập thời gian tải lại trang web\",\"Đây là khoảng thởi gian tải lại trang web ,\\n Mặc định là 20 phút, hãy điền vào số phút bạn muốn thay đổi:\\n\\n\",\"Tài nguyên bạn muốn chừa lại\",\"Lên lịch ăn mừng\",\"Ăn mừng nhỏ\",\"Ăn mừng lớn\",\"Thiết lập khoảng thời gian bạn muốn gửi tài nguyên\",\n\t\t\t\"Phút\",\"Đang tạm dừng\",\"Đang thi hanh\",\"Thi hành\",\"Tạm dừng\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Quá ít tài nguyên.\", \"Công nhân đang làm nhiệm vụ khác.\", \"Kiến trúc đã hoàn thiên\", \"Bắt đầu xây dựng\", \"Đang xây dựng\", \"Nhà kho quá nhỏ. Hãy nâng cấp nhà kho mới xây dựng được kiến trúc\", \"Kho lúa quá nhỏ. Hãy nâng cấp kho lúa mới xây được kiến trúc\", \"Quá ít tài nguyên\",\"\",\"Hiện đang có buổi lễ ăn mừng\"];\n\t\taLangOtherText = [\"Chú thích quan trọng\", \"Chỉ thủ đô mới có thể<br/>nâng cấp các mỏ lên level 20. THủ đô của bạn<br/> chưa thấy. hãy vào phần hồ sơ của bạn.\", \"Click vào đây\", \"Cài đặt hoàn tất\", \"Đã hủy\", \"Bắt đầu công việc\", \"Nâng cấp thành công\", \"Kích hoạt thành công\", \"CHưa biết bạn thuộc tộc nào. <br/>Vì vậy bạn nên vào hồ sơ để cập nhật thông tin.<br/>\", \"Bạn cũng nên vào Lâu Đài Tướng để cập nhật<br/> tốc đọ và loại tướng.\"];\n\t\taLangResources=[\"Gỗ\",\"Đất sét\",\"Sắt\",\"Lúa\"];\n\t\taLangTroops[0] = [\"Lính Lê Dương\", \"Thị Vệ\", \"Chiến Binh Tinh Nhuệ\", \"Kỵ Binh Do Thám\", \"Kỵ Binh\", \"Kỵ Binh Tinh Nhuệ\", \"Xe Công Thành\", \"Máy Phóng Lửa\", \"Nguyên Lão\", \"Dân Khai Hoang\", \"Tướng\"];\n\t\taLangTroops[1] = [\"Lính Chùy\", \"Lính Giáo\", \"Lính Rìu\", \"Do Thám\", \"Hiệp Sĩ Paladin\", \"Kỵ Sĩ Teutonic\", \"Đội Công Thành\", \"Máy Bắn Đá\", \"Thủ Lĩnh\", \"Dân Khai Hoang\", \"Tướng\"];\n\t\taLangTroops[2] = [\"Lính Pha Lăng\", \"Kiếm Sĩ\", \"Do Thám\", \"Kỵ Binh Sấm Sét\", \"Tu Sĩ\", \"Kỵ Binh\", \"Máy Nện\", \"Máy Bắn Đá\", \"Tù Trưởng\", \"Dân Khai Hoang\", \"Tướng\"];\n\t\taLangAttackType = [\"Tiếp viện\", \"Tấn công\", \"Cướp bóc\"];\n\t\tbreak;\n\n\tcase \"ru\": // by MMX\n\t\taLangAllBuildWithId = [\"Лесопилка\", \"Глиняный карьер\", \"Железный рудник\", \"Ферма\", \"\", \"Лесопильный завод\", \"Кирпичный завод\", \"Чугунолитейный завод\", \"Мукомольная мельница\", \"Пекарня\", \"Склад\", \"Амбар\", \"Кузница оружия\", \"Кузница доспехов\", \"Арена\", \"Главное здание\", \"Пункт сбора\", \"Рынок\", \"Посольство\", \"Казарма\", \"Конюшня\", \"Мастерская\", \"Академия\", \"Тайник\", \"Ратуша\", \"Резиденция\", \"Дворец\", \"Сокровищница\", \"Торговая палата\", \"Большая казарма\", \"Большая конюшня\", \"Стена\", \"Земляной вал\", \"Изгородь\", \"Каменотес\", \"Пивная\", \"Капканщик\",\"Таверна\", \"Большой склад\", \"Большой амбар\", \"Чудо света\", \"Водопой\"];\n\t\taLangAllBuildAltWithId = [\"Лесопилка\", \"Глиняный карьер\", \"Железный рудник\", \"Ферма\", \"\", \"Лесопильный завод\", \"Кирпичный завод\", \"Чугунолитейный завод\", \"Мукомольная мельница\", \"Пекарня\", \"Склад\", \"Амбар\", \"Кузница оружия\", \"Кузница доспехов\", \"Арена\", \"Главное здание\", \"Пункт сбора\", \"Рынок\", \"Посольство\", \"Казарма\", \"Конюшня\", \"Мастерская\", \"Академия\", \"Тайник\", \"Ратуша\", \"Резиденция\", \"Дворец\", \"Сокровищница\", \"Торговая палата\", \"Большая казарма\", \"Большая конюшня\", \"Стена\", \"Земляной вал\", \"Изгородь\", \"Каменотес\", \"Пивная\", \"Капканщик\",\"Таверна\", \"Большой склад\", \"Большой амбар\", \"Чудо света\", \"Водопой\"];\n\t\taLangAddTaskText = [\"Добавить задание\", \"Тип задания\", \"Активная деревня\", \"Цель задания\", \" Цель\", \"Тип\", \"Поддержка строительства\", \"Концентрация ресурсов\", \"Вверх\", \"Вниз\", \"\", \"\", \"\",\"Снять все задания\"];\n\t\taLangTaskKind = [\"Улучшить:\", \"Строим:\", \"Атаковать:\", \"Исследовать:\", \" нанять:\", \"Отправить ресурсы:\", \"NPC:\", \"Разрушить:\", \"Торжество:\"];\n\t\taLangGameText = [\" \", \"Торговцы\", \"ID\", \"Столица\", \"Время запуска\", \"временно не работает\", \"в\", \"Деревня\", \"Транспортировка\", \"из\", \"Транспортировка в\", \"Транспортировка из\", \"Отправка из\", \"ресурсы\", \"здание\", \"Построить новое здание\", \"пусто\", \"уровень\"];\n\t\taLangRaceName = [\"Римляне\", \"Германцы\", \"Галлы\"];\n\t\taLangTaskOfText = [\"Запланировать улучшение\", \"Запланировать новое здание\", \"Качать ресурсы\", \"Выкл\", \"(►)\", \"Вкл\", \"(■)\", \"Распределение полей в деревне: \", \"Автоотправка\", \"Автоотправка выкл.\", \"Вкл.\", \"Успешно отправлено\", \"/Задания/\", \"Лимит ввоза\", \"Нет\", \"Правка \", \"Дерево/Глина/Железо\", \"Зерно\", \"Запланировать разрушение\",\n\t\t\t\"Запланировать атаку\", \"Тип атаки\", \"Време в пути\", \"повторы\", \"через\", \"00:30:00\", \"Цель катов\", \"Случайно\", \"Неизвестно\", \" раз\", \"/\", \" :дата/время: \", \"Войска\",\n\t\t\t\"Запланировать найм\",\"Выбранное здание \", \"Обучение войск завершено\",\"Поставки\", \"Задать интревал обновления\", \"Это интервал обновления страницы ,\\n по умолчанию - 20 минут, Введите новое время:\\n\\n\", \"Лимит вывоза\", \"Запланировать празднование\", \"Малый праздник\", \"Большой праздник\", \"Установка интервала концентрации ресов\",\n\t\t\t\"минуты\", \"Выключен\", \"Включено\", \"(►)\", \"(■)\",\"Запланировать улучшение\",\"Улучшить атаку\",\"Улучшить защиту\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Недостаточно сырья\", \"Все строители сейчас заняты\", \"Это здание отстроено полностью\", \"Начинаю строительство\", \"Процесс развития\", \"Недостаточна вместимость склада\", \"Недостаточна вместимость амбара\", \"Достаточно ресурсов\", \"Недостаток продовольствия: развивайте фермы.\",\"Проводится торжество\"];\n\t\taLangOtherText = [\"Важные заметки\", \"Только в столице поля могут быть до уровня 20.<br/>Столица не определена.Зайдите в профиль\", \"Ссылка тут ^_^\", \"<br/>Настройка завершена\", \"Отменено\", \"Начать задачи\", \" Улучшение прошло успешно\", \"Успешно\", \"Ваш народ неопределен.Пожалуйста зайдите в профиль.\", \"Также пожалуйста зайдите в таверну<br/>для определения типа и скорости героя\"];\n\t\taLangResources = [\"Древесина\",\"Глина\",\"Железо\",\"Зерно\"];\n\t\taLangTroops[0] = [\"Легионер\", \"Преторианец\", \"Империанец\", \"Конный разведчик\", \"Конница императора\", \"Конница Цезаря\", \"Таран\", \"Огненная катапульта\", \"Сенатор\", \"Поселенец\", \"Герой\"];\n\t\taLangTroops[1] = [\"Дубинщик\", \"Копьеносец\", \"Топорщик\", \"Скаут\", \"Паладин\", \"Тевтонская конница\", \"Стенобитное орудие\", \"Катапульта\", \"Вождь\", \"Поселенец\", \"Герой\"];\n\t\taLangTroops[2] = [\"Фаланга\", \"Мечник\", \"Следопыт\", \"Тевтатский гром\", \"Друид-всадник\", \"Эдуйская конница\", \"Таран\", \"Требушет\", \"Предводитель\", \"Поселенец\", \"Герой\"];\n\t\taLangAttackType = [\"Подкрепление\", \"Нападение\", \"Набег\"];\n\t\tbreak; \n\n\tcase \"rs\": // by rsinisa\n\t\taLangAllBuildWithId = [\"Дрвосеча\", \"Рудник глине\", \"Рудник гвожђа\", \"Њива\", \"\", \"Пилана\", \"Циглана\", \"Ливница гвожђа\", \"Млин\", \"Пекара\", \"Складиште\", \"Силос\", \"Ковачница оружја\", \"Ковачница оклопа\", \"Витешка арена\", \"Главна зграда\", \"Место окупљања\", \"Пијаца\", \"Амбасада\", \"Касарна\", \"Штала\", \"Радионица\", \"Академија\", \"Склониште\", \"Општина\", \"Резиденција\", \"Палата\", \"Ризница\", \"Трговачки центар\", \"Велика касарна\", \"Велика штала\", \"Градски зид\", \"Земљани зид\", \"Палисада\", \"Каменорезац\", \"Пивница\", \"Постављач замки\",\"Дворац хероја\", \"Велико складиште\", \"Велики силос\", \"Светско чудо\", \"Појилиште\"];\n\t\taLangAllBuildAltWithId = [\"Дрвосеча\", \"Рудник глине\", \"Рудник гвожђа\", \"Њива\", \"\", \"Пилана\", \"Циглана\", \"Ливница гвожђа\", \"Млин\", \"Пекара\", \"Складиште\", \"Силос\", \"Ковачница оружја\", \"Ковачница оклопа\", \"Витешка арена\", \"Главна зграда\", \"Место окупљања\", \"Пијаца\", \"Амбасада\", \"Касарна\", \"Штала\", \"Радионица\", \"Академија\", \"Склониште\", \"Општина\", \"Резиденција\", \"Палата\", \"Ризница\", \"Трговачки центар\", \"Велика касарна\", \"Велика штала\", \"Градски зид\", \"Земљани зид\", \"Палисада\", \"Каменорезац\", \"Пивница\", \"Постављач замки\",\"Дворац хероја\", \"Велико складиште\", \"Велики силос\", \"Светско чудо\", \"Појилиште\"];\n\t\taLangAddTaskText = [\"Додај задатак\", \"Начин\", \"Активна села\", \"Задата мета\", \"на\", \"Мод\", \"Подршка изградње\", \"Концентрација ресурса\", \"Помери горе\", \"Помери доле\", \"Бриши\", \" Списак задатака\", \"Помери \", \"Обриши све задатке\"];\n\t\taLangTaskKind = [\"Надогради\", \"Нова градња\", \"Напад\", \"Истраживање\", \"Обучи\", \"Транспорт\", \"НПЦ\", \"Рушити\", \"Забава\"];\n\t\taLangGameText = [\"ниво \", \"Трговци\", \"ID\", \"Главни град\", \"Време почетка\", \"ово временско подешавање је бескорисно\", \" према\", \"Село\", \"транспорт\", \"из\", \"Пребацивање према\", \"Пребацивање из\", \"повратак из\", \"ресурси\", \"изградња\", \"Направи нову зграду\", \"празно\", \"ниво\"];\n\t\taLangRaceName = [\"Римљани\", \"Тевтонци\", \"Гали\"];\n\t\taLangTaskOfText = [\"Распоред за надоградњу\", \"Направи нови распоред\", \"Ауто надоградња ресурса\", \"Неактивно\", \"Покрени\", \"Активно\", \"Заустави\", \"Дистрибуција ресурсних поља овог села је \", \"Аутотранспорт\", \"Аутотранспорт није отворен\", \"Отворен\", \"Транспорт успешан\", \"Листа задатака\", \"Транспорт са лимитом\", \"Подразумевано\", \"Измени\", \"Дрво/Гллина/Гвожђе\", \"Њива\", \"Листа рушења\", \"Листа напада\", \"Врста напада\", \"Време превоза\", \"број понављања\", \"Временски интервал\",\"00:30:00\",\"Мета катапулта\",\"Насумично\", \"Непознат\", \" пута\", \". месец, \", \". дан, у \", \"Слање трупа\", \"Листа обуке\",\"Место обуке\",\"Тренинг задатак урадити\",\"прилагођен транспорт\",\"подеси време поновног учитавања \",\" ово је интервал поновног учитавања стране, \\n подразумевана вредност је 20 минута, молимо Вас убаците ново време:\\n \\n\",\"Остатак одлазног транспорта\",\"Листа забава\",\"мала забава\",\"велика забава\",\" Подесите интервал концентрације ресурса \", \"минути\", \"заустављено\", \"активно\", \"покрени\", \"паузирај\",\"Распоред унапређења\",\"Унапреди напад\",\"Унапреди одбрану\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Премало ресурса.\", \"Радници су већ на послу.\", \"Изградња завршена\", \"Покретање изградње\", \"У изградњи\", \"Складиште је премало. Проширите складиште како би наставили са изградњом\", \"Силос је премали. Проширите силос како би наставили са изградњом\", \"Довољно ресурса\",\"Премало жита: прошири прво њиве\",\"Прослава је већ у току\"];\n\t\taLangOtherText = [\"Важна напомена\", \"Само у главном граду ресурсна поља могу бити проширена на ниво 20. Твој главни град није детектован, погледај свој профил.\", \"Пречица овде ^_^\", \"Подешавања готова\", \"Отказано\", \"Покрени задатке\", \"Надоградња успешна\", \"Покретање успешно\", \"Ваше племе је непознато, стога и врста трупа. Погледајте свој профил да видите који сте народ.\",\"Такође посетите дворац хероја да сазнате брзину и тип свог хероја \"];\n\t\taLangResources=[\"дрво\",\"глина\",\"гвожђе\",\"жито\"];\n\t\taLangTroops[0] = [\"Легионар\", \"Преторијанац\", \"Империјанац\", \"Извиђач\", \"Императорова коњица\", \"Цезарева коњица\", \"Ован\", \"Ватрени катапулт\", \"Сенатор\", \"Насељеник\", \"Херој\"];\n\t\taLangTroops[1] = [\"Батинар\", \"Копљаник\", \"Секираш\", \"Извиђач\", \"Паладин\", \"Тевтонски витез\", \"Ован\", \"Катапулт\", \"Поглавица\", \"Насељеник\", \"Херој\"];\n\t\taLangTroops[2] = [\"Фаланга\", \"Мачевалац\", \"Извиђач\", \"Галски витез\", \"Друид\", \"Коњаник\", \"Ован\", \"Катапулт\", \"Старешина\", \"Насељеник\", \"Херој\"];\n\t\taLangAttackType = [\"Појачање\", \"Нормалан\", \"Пљачка\"];\n\t\tbreak;\n\n\tcase \"ba\": // thanks ieyp\n\t\taLangAllBuildWithId = [\"Drvosječa\", \"Rudnik gline\", \"Rudnik željeza\", \"Poljoprivredno imanje\", \"\", \"Pilana\", \"Ciglana\", \"Livnica\", \"Mlin\", \"Pekara\", \"Skladište\", \"Silos\", \"Oruzarnica\", \"Kovacnica oklopa\", \"Mejdan\", \"Glavna zgrada\", \"Mesto okupljanja\", \"Pijaca\", \"Ambasada\", \"Kasarna\", \"Stala\", \"Radionica\", \"Akademija\", \"Skloniste\", \"Opstina\", \"Rezidencija\", \"Palata\", \"Riznica\", \"Trgovacki centar\", \"Velika kasarna\", \"Velika stala\", \"Gradski zid\", \"Zemljani zid\", \"Taraba\", \"Kamenorezac\", \"Pivnica\", \"Zamkar\",\"Dvorac heroja\", \"Veliko skladiste\", \"Veliki silos\", \"WW\", \"Pojiliste\"];\n\t\taLangAllBuildAltWithId = [\"Drvosječa\", \"Rudnik gline\", \"Rudnik željeza\", \"Poljoprivredno imanje\", \"\", \"Pilana\", \"Ciglana\", \"Livnica\", \"Mlin\", \"Pekara\", \"Skladište\", \"Silos\", \"Oruzarnica\", \"Kovacnica oklopa\", \"Mejdan\", \"Glavna zgrada\", \"Mesto okupljanja\", \"Pijaca\", \"Ambasada\", \"Kasarna\", \"Stala\", \"Radionica\", \"Akademija\", \"Skloniste\", \"Opstina\", \"Rezidencija\", \"Palata\", \"Riznica\", \"Trgovacki centar\", \"Velika kasarna\", \"Velika stala\", \"Gradski zid\", \"Zemljani zid\", \"Taraba\", \"Kamenorezac\", \"Pivnica\", \"Zamkar\",\"Dvorac heroja\", \"Veliko skladiste\", \"Veliki silos\", \"WW\", \"Pojiliste\"];\n\t\taLangAddTaskText = [\"Dodaj zadatak\", \"Nacin\", \"Aktivna sela\", \"Zadata meta\", \"Prema\", \"Mod\", \"Podrska izgradnje\", \"Koncentracija resursa\", \"Pomeri gore\", \"Pomeri dole\", \"Del\", \"&#160;&#160;&#160;Task contents\", \"Pomeri \", \"Obrisi sve zadatke\"];\n\t\taLangTaskKind = [\"Unapredi\", \"Nova izgradnja\", \"Napad\", \"Istrazivanje\", \"Obuci\", \"Transport\", \"NPC\", \"Rusiti\", \"Zabava\"];\n\t\taLangGameText = [\"Lvl\", \"Trgovci\", \"ID\", \"Glavni grad\", \"Vreme pocetka\", \"ovo vremensko podesavanje je beskorisno\", \"prema\", \"Selo\", \"transport\", \"iz\", \"Prebacivanje prema\", \"Prebacivanje iz\", \"povratak iz\", \"resursi\", \"izgradnja\", \"Napravi novu zgradu\", \"prazno\", \"nivo\"];\n\t\taLangRaceName = [\"Rimljani\", \"Teutonci\", \"Gali\"];\n\t\taLangTaskOfText = [\"Raspored za nadogradnju\", \"Napravi novi raspored\", \"AutoResUpD\", \"Not_run\", \"Pokreni\", \"Pokrenuto\", \"Zaustavi\", \"Distribucija resursnih polja ovog sela je \", \"Autotransport\", \"Autotransport is not opened\", \"Opened\", \"Transport successfully\", \"Task List\", \"Transport sa limitom\", \"Podrazumevano\", \"Izmeni\", \"Drvo/Glina/Gvozdje\", \"Njiva\", \"Lista rusenja\",\n\t\t\t\"Lista napada\", \"Vrsta napada\", \"Vreme prevoza\", \"broj ponavljanja\", \"Vremenski interval\",\"00:30:00\",\"Meta katapulta\",\"Nasumicno\", \"Nepoznat\", \"times\", \"Mesec\", \"Dan\", \"Slanje trupa\", \"Lista obuke\",\"Mesto obuke\",\"TreningZadatak uraditi\",\"prilagodenTransport\",\"podesi vreme ponovnog ucitavanja \",\" ovo je interval ponovnog ucitavanja strane, \\n podrazumevan vrednost je 20 minuta, molimo vas ubacite novo vreme:\\n \\n\",\"Trans_Out_Rmn\",\"Lista zabava\",\"mala zabava\",\"velika zabava\",\" Podesite interval koncentracie resursa \",\n\t\t\t\"minuti\", \"zaustavljanje\", \"pokrece se\", \"pokreni\", \"pauza\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"Premalo resursa. Buahaha :D\", \"Radnici su vec na poslu :P\", \"Izgradnja zavrsena\", \"Pokretanje izgradnje\", \"U izgradnji\", \"Skladiste je premalo. Prosirite skladiste kako bi nastavili sa izgradnjom\", \"Silos je malecak. Prosirite silos kako bi nastavili sa izgradnjom\", \"Dovoljno resursa\",\"Premalo zita, prvo prosiri njive\",\"Proslava je u toku\"];\n\t\taLangOtherText = [\"Vazna napomena\", \"Samo u glavnom gradu mozete <br/> prosiriti resursna polja preko nivoa 10. Tvoj glavni grad <br/> nije otkriven, poseti svoj profil.\", \"Precica ovde ^^\", \"Podesavanja gotova\", \"Otkazano\", \"Pokreni zadatke\", \"Nadogradnja uspesna\", \"Pokretanje uspesno\", \"Vase pleme je nepoznato, stoga I tip trupa. Posetite <br/> svoj profil da vidite pleme. <br/>\",\"Posetite dvorac heroja da saznate <br/> brzinu I tip svog heroja \"];\n\t\taLangResources=[\"drvo\",\"glina\",\"gvozdje\",\"zito\"];\n\t\taLangTroops[0] = [\"Legionar\", \"Pretorijanac\", \"Imperijanac\", \"Izvidjac\", \"Imperatorova konjica\", \"Cezareva konjica\", \"Ovan\", \"Vatreni katapult\", \"Senator\", \"Naseljenik\", \"Heroj\"];\n\t\taLangTroops[1] = [\"Batinar\", \"Kopljanik\", \"Sekiras\", \"Izvidjac\", \"Paladin\", \"Tetutonski vitez\", \" Ovan \", \"Katapult\", \"Poglavica\", \"Naseljenik\", \"Heroj\"];\n\t\taLangTroops[2] = [\"Falanga\", \"Macevalac\", \"Izvidjac\", \"Teutateov grom\", \"Druid\", \"Heduan\", \" Ovan \", \"Katapult\", \"Staresina\", \"Naseljenik\", \"Heroj\"];\n\t\taLangAttackType = [\"Pojacanje\", \"Normalan\", \"Pljacka\"];\n\t\tbreak;\n\n\tcase \"org\":\n\tcase \"de\": // by LohoC et al.\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": // translations for travian version 3.6\n\t\t\t\taLangAllBuildWithId = [\"Holzfäller\",\"Lehmgrube\",\"Eisenmine\",\"Getreidefarm\",\"\",\"Sägewerk\",\"Lehmbrennerei\",\"Eisengießerei\",\"Getreidemühle\",\"Bäckerei\",\"Rohstofflager\",\"Kornspeicher\",\"Waffenschmiede\",\"Rüstungsschmiede\",\"Turnierplatz\",\"Hauptgebäude\",\"Versammlungsplatz\",\"Marktplatz\",\"Botschaft\",\"Kaserne\",\"Stall\",\"Werkstatt\",\"Akademie\",\"Versteck\",\"Rathaus\",\"Residenz\",\"Palast\",\"Schatzkammer\",\"Handelskontor\",\"Große Kaserne\",\"Großer Stall\",\"Stadtmauer\",\"Erdwall\",\"Palisade\",\"Steinmetz\",\"Brauerei\",\"Fallensteller\",\"Heldenhof\",\"Großes Rohstofflager\",\"Großer Kornspeicher\",\"Weltwunder\",\"Pferdetränke\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Holzfäller\",\"Lehmgrube\",\"Eisenmine\",\"Getreidefarm\",\"\",\"Sägewerk\",\"Lehmbrennerei\",\"Eisengießerei\",\"Getreidemühle\",\"Bäckerei\",\"Rohstofflager\",\"Kornspeicher\",\"Waffenschmiede\",\"Rüstungsschmiede\",\"Turnierplatz\",\"Hauptgebäude\",\"Versammlungsplatz\",\"Marktplatz\",\"Botschaft\",\"Kaserne\",\"Stall\",\"Werkstatt\",\"Akademie\",\"Versteck\",\"Rathaus\",\"Residenz\",\"Palast\",\"Schatzkammer\",\"Handelskontor\",\"Große Kaserne\",\"Großer Stall\",\"Stadtmauer\",\"Erdwall\",\"Palisade\",\"Steinmetz\",\"Brauerei\",\"Fallensteller\",\"Heldenhof\",\"Großes Rohstofflager\",\"Großer Kornspeicher\",\"Weltwunder\",\"Pferdetränke\"];\n\t\t\t\taLangAddTaskText = [\"Aufgabe hinzufügen\",\"Style\",\"Aktives Dorf\",\"Aufgaben Ziel\",\"nach\",\"Modus\",\"Baubetreuung\",\"Ressourcenkonzentration\",\"Rauf\",\"Runter\",\"Entfernen\",\" Aufgaben Inhalte\",\"Bewegen \",\"alle Aufgaben Löschen\"];\n\t\t\t\taLangTaskKind = [\"Upgrade\",\"Neues Gebäude\",\"Angriff\",\"Forschung\",\"ausbilden\",\"Transport\",\"NPC\",\"Zerstören\",\"Fest\"];\n\t\t\t\taLangGameText = [\"Lvl\",\"Händler\",\"ID\",\"Hauptdorf\",\"Startzeit\",\"diese Zeiteinstellung ist nicht sinnvoll.\",\"nach\",\"Dorf\",\"Transport\",\"von\",\"Transport nach\",\"Transport von\",\"Rückkehr aus\",\"Rohstoffe\",\"Gebäude\",\"Neues Gebäude errichten\",\"leer\",\"Stufe\"];\n\t\t\t\taLangRaceName = [\"Römer\",\"Germane\",\"Gallier\"];\n\t\t\t\taLangTaskOfText = [\"Zeitplan Upgrade\",\"Zeitplan Neu Bauen\",\"AutoResRauf\",\"Pausiert\",\"Start\",\"Laufend\",\"Unterbrechen\",\"Es wird Gebaut \",\"Autotransport\",\"Autotransport ist nicht An\",\"AN\",\"Transport Erfolgreich\",\"Aufgabenliste\",\"Transportlimit (-)\",\"Vorgabe\",\"Ändern \",\"Holz/Lehm/Eisen\",\"G3D\",\"Zeitplan Abriss\",\n\t\t\t\t\t\"Zeitplan Angriff\",\"Angriffsart\",\"Laufzeit\",\"Wiederholungen\",\"Intervalzeit\",\"00:30:00\",\"Katapultziel\",\"Zufall\",\"Unbekannt\",\"mal\",\"Monat\",\"Tag\",\"Truppen senden\",\"Zeitplan Ausbildung\",\"Ausbildungsseite\",\"Ausbildungsauftrag abgeschlossen\",\"Manueller Transport\",\"Setzte Intervalzeit für Reload\",\"Dies ist der Interval zum Seitenreload ,\\n Standard sind 20 Minuten, Bitte trage eine neue ein:\\n\\n\",\"Transportlimit (+)\",\"Partyplanung\",\"Kleine Party\",\"Große Party\",\"Setzte den Interval der Ressourcenkonzentration\",\n\t\t\t\t\t\"Minuten\",\".\",\".\",\"START\",\"STOP\",\"Zeitplan Verbessern\",\"Angriff verbessern\",\"Verteidigung verbessern\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"Zu wenig Rohstoffe\",\"Es wird bereits gebaut\",\"vollständig ausgebaut\",\"Starte Konstruktion\",\"In Entwicklung\",\"Zuerst Rohstofflager ausbauen\",\"Zuerst Kornspeicher ausbauen\",\"Genug Rohstoffe\",\"Nahrungsmangel: Erst eine Getreidefarm ausbauen\",\"Es wird bereits gefeiert.\"];\n\t\t\t\taLangOtherText = [\"Wichtige Notiz\",\"Nur die Ressourcenfelder der Hauptstadt können<br/>bis Stufe 20 ausgebaut werden. Zur zeit ist deine Hauptstadt<br/>nicht identifiziert. Bitte besuche dein Profil.\",\"Shortcut here ^_^\",\"Setup fertiggestellt\",\"Abgebrochen\",\"Starte die Aufgaben\",\"Upgrade war erfolgreich\",\"Starten war erfolgreich\",\"Deine Rasse ist unbekannt.<br/>Bitte besuche dein Profil.<br/>\",\"Bitte besuche auch deinen Heldenhof um<br/>die Geschwindigkeit und die Art deines Helden zu bestimmen.\"];\n\t\t\t\taLangResources = [\"Holz\",\"Lehm\",\"Eisen\",\"Getreide\"];\n\t\t\t\taLangTroops[0] = [\"Legionär\",\"Prätorianer\",\"Imperianer\",\"Equites Legati\",\"Equites Imperatoris\",\"Equites Caesaris\",\"Rammbock\",\"Feuerkatapult\",\"Senator\",\"Siedler\",\"Held\"];\n\t\t\t\taLangTroops[1] = [\"Keulenschwinger\",\"Speerkämpfer\",\"Axtkämpfer\",\"Kundschafter\",\"Paladin\",\"Teutonen Reiter\",\"Ramme\",\"Katapult\",\"Stammesführer\",\"Siedler\",\"Held\"];\n\t\t\t\taLangTroops[2] = [\"Phalanx\",\"Schwertkämpfer\",\"Späher\",\"Theutates Blitz\",\"Druidenreiter\",\"Haeduaner\",\"Rammholz\",\"Kriegskatapult\",\"Häuptling\",\"Siedler\",\"Held\"];\n\t\t\t\taLangAttackType = [\"Unterstützung\",\"Angriff: Normal\",\"Angriff: Raubzug\"];\n\t\t\tbreak;\n\t\t\tcase \"4.0\": // translations for travian version 4.0\n\t\t\t\taLangAllBuildWithId = [\"Holzfäller\",\"Lehmgrube\",\"Eisenmine\",\"Getreidefarm\",\"\",\"Sägewerk\",\"Lehmbrennerei\",\"Eisengießerei\",\"Getreidemühle\",\"Bäckerei\",\"Rohstofflager\",\"Kornspeicher\",\"Waffenschmiede\",\"Schmiede\",\"Turnierplatz\",\"Hauptgebäude\",\"Versammlungsplatz\",\"Marktplatz\",\"Botschaft\",\"Kaserne\",\"Stall\",\"Werkstatt\",\"Akademie\",\"Versteck\",\"Rathaus\",\"Residenz\",\"Palast\",\"Schatzkammer\",\"Handelskontor\",\"Große Kaserne\",\"Großer Stall\",\"Stadtmauer\",\"Erdwall\",\"Palisade\",\"Steinmetz\",\"Brauerei\",\"Fallensteller\",\"Heldenhof\",\"Großes Rohstofflager\",\"Großer Kornspeicher\",\"Weltwunder\",\"Pferdetränke\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Holzfäller\",\"Lehmgrube\",\"Eisenmine\",\"Getreidefarm\",\"\",\"Sägewerk\",\"Lehmbrennerei\",\"Eisengießerei\",\"Getreidemühle\",\"Bäckerei\",\"Rohstofflager\",\"Kornspeicher\",\"Waffenschmiede\",\"Schmiede\",\"Turnierplatz\",\"Hauptgebäude\",\"Versammlungsplatz\",\"Marktplatz\",\"Botschaft\",\"Kaserne\",\"Stall\",\"Werkstatt\",\"Akademie\",\"Versteck\",\"Rathaus\",\"Residenz\",\"Palast\",\"Schatzkammer\",\"Handelskontor\",\"Große Kaserne\",\"Großer Stall\",\"Stadtmauer\",\"Erdwall\",\"Palisade\",\"Steinmetz\",\"Brauerei\",\"Fallensteller\",\"Heldenhof\",\"Großes Rohstofflager\",\"Großer Kornspeicher\",\"Weltwunder\",\"Pferdetränke\"];\n\t\t\t\taLangAddTaskText = [\"Aufgabe hinzufügen\",\"Style\",\"Aktives Dorf\",\"Aufgaben Ziel\",\"nach\",\"Modus\",\"Baubetreuung\",\"Ressourcenkonzentration\",\"Rauf\",\"Runter\",\"Entfernen\",\" Aufgaben Inhalte\",\"Bewegen \",\"alle Aufgaben Löschen\"];\n\t\t\t\taLangTaskKind = [\"Upgrade\",\"Neues Gebäude\",\"Angriff\",\"Forschung\",\"ausbilden\",\"Transport\",\"NPC\",\"Zerstören\",\"Fest\"];\n\t\t\t\taLangGameText = [\"Lvl\",\"Händler\",\"ID\",\"Hauptdorf\",\"Startzeit\",\"diese Zeiteinstellung ist nicht sinnvoll.\",\"nach\",\"Dorf\",\"Transport\",\"von\",\"Transport nach\",\"Transport von\",\"Rückkehr aus\",\"Rohstoffe\",\"Gebäude\",\"Neues Gebäude errichten\",\"leer\",\"Stufe\"];\n\t\t\t\taLangRaceName = [\"Römer\",\"Germane\",\"Gallier\"];\n\t\t\t\taLangTaskOfText = [\"Zeitplan Upgrade\",\"Zeitplan Neu Bauen\",\"AutoResRauf\",\"Pausiert\",\"Start\",\"Laufend\",\"Unterbrechen\",\"Es wird Gebaut \",\"Autotransport\",\"Autotransport ist nicht An\",\"AN\",\"Transport Erfolgreich\",\"Aufgabenliste\",\"Transportlimit (-)\",\"Vorgabe\",\"Ändern \",\"Holz/Lehm/Eisen\",\"G3D\",\"Zeitplan Abriss\",\n\t\t\t\t\t\"Zeitplan Angriff\",\"Angriffsart\",\"Laufzeit\",\"Wiederholungen\",\"Intervalzeit\",\"00:30:00\",\"Katapultziel\",\"Zufall\",\"Unbekannt\",\"mal\",\"Monat\",\"Tag\",\"Truppen senden\",\"Zeitplan Ausbildung\",\"Ausbildungsseite\",\"Ausbildungsauftrag abgeschlossen\",\"Manueller Transport\",\"Setzte Intervalzeit für Reload\",\"Dies ist der Interval zum Seitenreload ,\\n Standard sind 20 Minuten, Bitte trage eine neue ein:\\n\\n\",\"Transportlimit (+)\",\"Partyplanung\",\"Kleine Party\",\"Große Party\",\"Setzte den Interval der Ressourcenkonzentration\",\n\t\t\t\t\t\"Minuten\",\".\",\".\",\"START\",\"STOP\",\"Zeitplan Verbessern\",\"Angriff verbessern\",\"Verteidigung verbessern\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"Zu wenig Rohstoffe\",\"Es wird bereits gebaut\",\"vollständig ausgebaut\",\"Starte Konstruktion\",\"In Entwicklung\",\"Zuerst Rohstofflager ausbauen\",\"Zuerst Kornspeicher ausbauen\",\"Genug Rohstoffe\",\"Nahrungsmangel: Erst eine Getreidefarm ausbauen\",\"Es wird bereits gefeiert.\"];\n\t\t\t\taLangOtherText = [\"Wichtige Notiz\",\"Nur die Ressourcenfelder der Hauptstadt können<br/>bis Stufe 20 ausgebaut werden. Zur zeit ist deine Hauptstadt<br/>nicht identifiziert. Bitte besuche dein Profil.\",\"Shortcut here ^_^\",\"Setup fertiggestellt\",\"Abgebrochen\",\"Starte die Aufgaben\",\"Upgrade war erfolgreich\",\"Starten war erfolgreich\",\"Deine Rasse ist unbekannt.<br/>Bitte besuche dein Profil.<br/>\",\"Bitte besuche auch deinen Heldenhof um<br/>die Geschwindigkeit und die Art deines Helden zu bestimmen.\"];\n\t\t\t\taLangResources = [\"Holz\",\"Lehm\",\"Eisen\",\"Getreide\"];\n\t\t\t\taLangTroops[0] = [\"Legionär\",\"Prätorianer\",\"Imperianer\",\"Equites Legati\",\"Equites Imperatoris\",\"Equites Caesaris\",\"Rammbock\",\"Feuerkatapult\",\"Senator\",\"Siedler\",\"Held\"];\n\t\t\t\taLangTroops[1] = [\"Keulenschwinger\",\"Speerkämpfer\",\"Axtkämpfer\",\"Kundschafter\",\"Paladin\",\"Teutonen Reiter\",\"Ramme\",\"Katapult\",\"Stammesführer\",\"Siedler\",\"Held\"];\n\t\t\t\taLangTroops[2] = [\"Phalanx\",\"Schwertkämpfer\",\"Späher\",\"Theutates Blitz\",\"Druidenreiter\",\"Haeduaner\",\"Rammholz\",\"Kriegskatapult\",\"Häuptling\",\"Siedler\",\"Held\"];\n\t\t\t\taLangAttackType = [\"Unterstützung\",\"Angriff: Normal\",\"Angriff: Raubzug\"];\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrowLogicError ( \"initializeLangVars():: Travian Version not set, when initializing language variables for \\'de\\' or \\'org\\'!!\" );\n\t\t}\n\t\tbreak;\n\n\tcase \"ir\": // mrreza\n\t\taLangAllBuildWithId = [\"هیزم شکن\", \"آجرسازی\", \"معدن آهن\", \"گندم زار\", \"محل احداث ساختمان\", \"چوب بری\", \"آجرپزی\", \"ذوب آهن\", \"آسیاب\", \"نانوایی\", \"انبار\", \"انبار غذا\", \"آهنگری\", \"زره سازی\", \"میدان تمرین\", \"ساختمان اصلی\", \"اردوگاه\", \"بازار\", \"سفارت\", \"سربازخانه\", \"اصطبل\", \"کارگاه\", \"دارالفنون\", \"مخفیگاه\", \"تالار\", \"اقامتگاه\", \"قصر\", \"خزانه\", \"تجارتخانه\", \"سربازخانه‌ی بزرگ\", \"اصطبل بزرگ\", \"دیوار شهر\", \"دیوار گلی\", \"پرچین\", \"سنگ تراشی\", \"قهوه خانه\", \"تله ساز\",\"عمارت قهرمان\", \"انبار بزرگ\", \"انبارغذای بزگ\", \"شگفتی جهان\", \"آبشخور اسب\"];\n\t\taLangAllBuildAltWithId = [\"هیزم شکن\", \"آجر سازی\", \"معدن آهن\", \"گندم زار\", \"محل\", \"چوب بری\", \"آجرپزی\", \"ذوب آهن\", \"آسیاب\", \"نانوایی\", \"انبار\", \"انبارغذا\", \"آهنگری\", \"زره سازی\", \"میدان تمرین\", \"ساختمان اصلی\", \"اردوگاه\", \"بازار\", \"سفارت\", \"سربازخانه\", \"اصطبل\", \"کارگاه\", \"دارالفنون\", \"مخفیگاه\", \"تالار\", \"اقامتگاه\", \"قصر\", \"خزانه\", \"تجارتخانه\", \"سربازخانه‌ی بزرگ\", \"اصطبل بزرگ\", \"دیوار شهر\", \"دیوار گلی\", \"پرچین\", \"سنگ تراشی\", \"قهوه خانه\", \"تله ساز\",\"عمارت قهرمان\", \"انبار بزرگ\", \"انبار غذای بزرگ\", \" شگفتی جهان\", \"آبشخور اسب\"];\n\t\taLangAddTaskText = [\"اضافه کردن وظیفه\", \"شیوه\", \"دهکده فعال\", \"هدف کاری\", \"به سوی\", \"روش\", \"پشتیبانی از سازه ها\", \"ارسال معمولی (تمرکز منابع)\", \"بالا بردن\", \"پایین آوردن\", \"حذف\", \"&#160;&#160;&#160;محتوای وظیفه\", \"حرکت کردن\", \"پاک کردن تمام وظایف\"];\n\t\taLangTaskKind = [\"ارتقاء دادن\", \"بنای جدید\", \"حمله\", \"تحقیق\", \"تربیت کردن\", \"ارسال منابع\", \"تعدیل منابع\", \"تخریب کردن\", \"برگزاری جشن\"];\n\t\taLangGameText = [\"سطح\", \"بازرگانان\", \"شماره\", \"رئیس\", \"زمان شروع\", \"این تنظیم زمان در حال حاضر بی فایده است.\", \"به سوی\", \"دهکده\", \"انتقال دادن\", \"از\", \"ارسال به\", \"دریافت از\", \"بازگشت از\", \"منابع\", \"ساخنمان\", \"احداث ساختمان جدید\", \"خالی کردن\", \"سطح\" , \"منابع ارسال شدند.\"];\n\t\taLangRaceName = [\"رومی‌ها\" ,\"توتن‌ها\" ,\"گول‌ها\"];\n\t\taLangTaskOfText = [\"برنامه ارتقاء\", \"برنامه ساختمان جدید\", \"ارتقا خودکار منابع\", \"در حال اجرا نمی باشد\", \"شروع\", \"شروع شده\", \"معلق کردن\", \"جدول توزیع منابع در این روستا هست \", \"ارسال خودکار منابع\", \"حمل و نقل خودکار باز نمی باشد\", \"باز شده\", \"حمل و نقل با موفقیت\", \"لیست وظایف\", \"سقف ورود منابع\", \"پیشفرض\", \"اصلاح کردن\", \"چوب/خشت/آهن\", \"گندم\", \"برنامه تخریب\",\n\t\t\t\"برنامه حمله\", \"نوع حمله\", \"زمان سفر\", \"زمان تکرار\", \"فاصله زمانی\",\"00:30:00\",\"هدف منجنیق\",\"تصادفی\", \"نامعلوم\", \"زمان\", \"ماه\", \"روز\", \"سربازان فرستاده شدند\", \"برنامه آموزش\",\"محل آموزش\",\"وظیفه آموزش انجام شد\",\"ارسال سفارشی منابع\",\" فاصله زمانی از زمان راه اندازی مجدد\",\" این فاصله زمانی از صفحه بارگذاری شده است,\\n پیشفرض 20 دقیقه می باشد, لطفا مقدار جدید را وارد کنید زمان:\\n\\n\",\"سقف نگه داشتن منابع\",\"برنامه جشن\",\"جشن کوچک\",\"جشن بزرگ\",\" تنظیم فاصله زمانی حمل معمولی در قسمت ارسال خودکار\",\n\t\t\t\"دقیقه\", \"در حال مکث\", \"در حرکت\", \"ادامه دادن\", \"مکث\",\"ارتقا قدرت نظامی\",\"ارتقا قدرت حمله\",\"ارتقا قدرت دفاع\", \"کنترل سرریز منابع\", \"فعال\", \"غیر فعال\", \"ارتقا خودکار گندمزار\", \"تغییر\"];\n\t\taLangErrorText = [\"کمبود منابع.\", \"کارگران مشغول کار هستند.\", \"به سطح آخر ممکن رسید.\", \"ساخت و ساز شروع شد\", \"در حال توسعه\", \"اول انبار را ارتقا دهید.\", \"اول انبارغذا را ارتقا دهید.\", \"پیش نیازها:\",\"کمبود غذا: اول گندم زار را ارتقا دهید!\",\"در حال حاضر یک جشن در حال برگذاری است\",\"یک جشن هم‌اکنون در حال برگزاری است.\",\"در حال رسیدن به سطح نهایی خود می‌باشد.\"];\n\t\taLangOtherText = [\"توجه داشته باشید\", \"فقط منابع در دهکده پایتخت می توانند <br/>تا سطح 20 ارتقاء یابند. اکنون پایتخت شما<br/> تشخیص داده نشده است. لطفا از پروفایل خود دیدن کنید.\", \"دسترسی آسان در اینجا ^_^\", \"تنظیمات کامل شد\", \"لغو شد\", \"وظیفه آغاز شد\", \"با موفقیت انجام شد\" , \"حرکت با موفقیت انجام شد\", \"نژاد شما معلوم نیست, بنابراین نوع لشکرتون مشخص نیست. <br/>برای مشخص شدن نژادتون از پروفایل خود دیدن کنید.<br/>\", \"همچنین لطفا دیدن کنید از عمارت قهرمان برای مشخص شدن <br/> سطح و نوع آن.\" , \"ارتقاء\"];\n\t\taLangResources=[\"چوب\",\"خشت\",\"آهن\",\"گندم\"];\n\t\taLangTroops[0] = [\"سرباز لژیون\", \"محافظ\", \"شمشیرزن\", \"خبرچین\", \"شوالیه\", \"شوالیه سزار\", \"دژکوب\", \"منجنیق آتشین\", \"سناتور\", \"مهاجر\", \"قهرمان\"];\n\t\taLangTroops[1] = [\"گرزدار\", \"نیزه دار\", \"تبرزن\", \"جاسوس\", \"دلاور\", \"شوالیه‌ی توتن\", \"دژکوب\", \"منجنیق\", \"رئیس\", \"مهاجر\", \"قهرمان\"];\n\t\taLangTroops[2] = [\"سرباز پیاده\", \"شمشیرزن\", \"ردیاب\", \"رعد\", \"کاهن سواره\", \"شوالیه گول\", \"دژکوب\", \"منجنیق\", \"رئیس قبیله\", \"مهاجر\", \"قهرمان\"];\n\t\taLangAttackType = [\"پشتیبانی\", \"حمله عادی\", \"حمله غارت\"];\n\t\tbreak;\n\n\tcase \"ae\": // By Dream1, SnTraL (2011.02.24)\n\t\taLangAllBuildWithId = [\"الحطاب\", \"حفرة الطين\", \"منجم حديد\", \"حقل القمح\", \"\", \"معمل النجاره\", \"مصنع البلوك\", \"مصنع الحديد\", \"المطاحن\", \"المخابز\", \"المخزن\", \"مخزن الحبوب\", \"الحداد\", \"مستودع الدروع\", \"ساحة البطولة\", \"المبنى الرئيسي\", \"نقطة التجمع\", \"السوق\", \"السفارة\", \"الثكنه\", \"الإسطبل\", \"المصانع الحربية\", \"الأكاديمية الحربية\", \"المخبأ\", \"البلدية\", \"السكن\", \"القصر\", \"الخزنة\", \"المكتب التجاري\", \"الثكنة الكبيرة\", \"الإسطبل الكبير\", \"حائط المدينة\", \"الحائط الأرضي\", \"الحاجز\", \"الحجّار\", \"المعصرة\", \"الصياد\", \"قصر الأبطال\", \"المخزن الكبير\", \"مخزن الحبوب الكبير\", \"معجزة العالم\", \"بِئْر سقي الخيول\"];\n\t\taLangAllBuildAltWithId = [\"الحطاب\", \"حفرة الطين\", \"منجم حديد\", \"حقل القمح\", \"\", \"معمل النجاره\", \"مصنع البلوك\", \"مصنع الحديد\", \"المطاحن\", \"المخابز\", \"المخزن\", \"مخزن الحبوب\", \"الحداد\", \"مستودع الدروع\", \"ساحة البطولة\", \"المبنى الرئيسي\", \"نقطة التجمع\", \"السوق\", \"السفارة\", \"الثكنه\", \"الإسطبل\", \"المصانع الحربية\", \"الأكاديمية الحربية\", \"المخبأ\", \"البلدية\", \"السكن\", \"القصر\", \"الخزنة\", \"المكتب التجاري\", \"الثكنة الكبيرة\", \"الإسطبل الكبير\", \"حائط المدينة\", \"الحائط الأرضي\", \"الحاجز\", \"الحجّار\", \"المعصرة\", \"الصياد\", \"قصر الأبطال\", \"المخزن الكبير\", \"مخزن الحبوب الكبير\", \"معجزة العالم\", \"بِئْر سقي الخيول\"];\n\t\taLangAddTaskText = [\"أضافة مهمة\", \"النمط\", \"القرية النشطة\", \"المهمة المستهدفة\", \"الى\", \"نمط\", \"دعم للبناء\", \"تكثيف الموارد\", \"تحريك للاعلى\", \"تحريك للاسفل\", \"حذف\", \"&#160;&#160;&#160;محتوى المهمه\", \"تحريك \", \"حذف جميع المهام\"];\n\t\taLangTaskKind = [\"تطوير\", \"تشييد مبنى\", \"هجوم\", \"بحث\", \"تدريب\", \"نقل\", \"تاجر المبادله\", \"هدم\", \"الاحتفال\"];\n\t\taLangGameText = [\"مستوى\", \"التجار\", \"المعرف\", \"العاصمة\", \"بداية الوقت\", \"هذا الاعداد في الوقت الحالي عديم الفائدة.\", \" إلى\", \"القرية\", \"نقل\", \"من\", \"نقل الى\", \"نقل من\", \"العودة من\", \"الموارد\", \"المباني\", \"تشييد\", \"فارغ\", \"المستوى\"];\n\t\taLangRaceName = [\"الرومان\", \"الجرمان\", \"الإغريق\"];\n\t\taLangTaskOfText = [\"الجدول الزمني للترقية\", \"الجدول الزمني لبناء جديد\", \"التطوير التلقائي\", \"لايعمل\", \"بدأ\", \"أبتداء\", \"توقف مؤقتا\", \"الحقول / المباني توزيع لقرية \", \"النقل التلقائي\", \"لم يتم فتح النقل التلقائي\", \"فتح\", \"تم النقل بنجاح\", \"قائمة المهام\", \"Trans_In_limit\", \"أفتراضي\", \"تعديل\", \"خشب/طين/حديد\", \"قمح\", \"الجدول الزمني للهدم\",\n\t\t\t\"الجدول الزمني للهجوم\", \"نوع الهجوم\", \"وقت الذهاب\", \"عدد مرات التكرار\", \"الفاصل الزمني\",\"00:30:00\",\"هدف المقاليع\",\"عشوائي\", \"غير معروف\", \"مرات\", \"شهر\", \"يوم\", \"القوات ارسلت\", \"الجدول الزمني للتدريب\",\"مكان تدريب\",\"مهمة التدريب تمت\",\"الجدول الزمني للنقل\",\"إعداد الفاصل الزمني للتحديث\",\"هذا هو الفاصل الزمني لتحديث الصفحة ,\\n الافتراضي هو 20 دقيقة,يرجى وضع فاصل زمني جديد:\\n\\n\",\"Trans_Out_Rmn\",\"الجدول الزمني للإحتفال\",\"إحتفال صغير\",\"إحتفال كبير\",\"تعيين الفاصل الزمني لتركيز الموارد\",\n\t\t\t\"دقائق\", \"متوقف\", \"يعمل\", \"تشغيل\", \"أيقاف\",\"Schedule Improve\",\"Improve Attack\",\"Improve defence\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\taLangErrorText = [\"الموارد قليلة جداً.\", \"العمال مشغولون الآن.\", \"البناء منجز\", \"بدء البناء\", \"في التطوير\", \"يجب رفع مستوى المخزن أولاً \", \"يجب رفع مستوى مخزن الحبوب أولاً \", \"الموارد كافية\",\"\",\"يوجد احتفال جارية بالفعل\"];\n\t\taLangOtherText = [\"ملاحظات هامه\", \"فقط حقول الموارد في العاصمة <br/>يتم ترقيتهم الى مستوى 20 .<br/> لم يتم معرفة العاصمه. يرجاء زيارة بطاقة العضويه.\", \"الاختصار هنا ^_^\", \"أكتمال الإعدادات\", \"ألغي\", \"بدء المهام\", \"تم التطوير بنجاح\", \"تم التشغيل بنجاح\", \"القبيلة غير معروفه, لابد من معرفة نوع القوات. <br/>يرجاء زيارة بطاقة العضويه لتحديد نوع القبيله.<br/>\", \"يرجاء ايضاً زيارة قصر الابطال<br/> لتحديد سرعة ونوع بطلك.\"];\n\t\taLangResources=[\"الخشب\",\"الطين\",\"الحديد\",\"القمح\"];\n\t\taLangTroops[0] = [\"جندي أول\", \" حراس الإمبراطور\", \"جندي مهاجم\", \"فرقة تجسس\", \"سلاح الفرسان\", \"فرسان القيصر\", \"الكبش\", \"المقلاع الناري\", \"حكيم\", \"مستوطن\", \"البطل\"]; //الرومان\n\t\taLangTroops[1] = [\"مقاتل بهراوة\", \"مقاتل برمح\", \"مقاتل بفأس\", \"الكشاف\", \"مقاتل القيصر\", \"فرسان الجرمان\", \"محطمة الأبواب\", \"المقلاع\", \"الزعيم\", \"مستوطن\", \"البطل\"]; //الجرمان\n\t\taLangTroops[2] = [\"الكتيبة\", \"مبارز\", \"المستكشف\", \"رعد الجرمان\", \"فرسان السلت\", \"فرسان الهيدوانر\", \"محطمة الأبواب الخشبية\", \"المقلاع الحربي\", \"رئيس\", \"مستوطن\", \"البطل\"]; //الإغريق\n\t\taLangAttackType = [\"مساندة\", \"هجوم: كامل\", \"هجوم: للنهب\"];\n\t\tbreak;\n\n\tcase \"gr\": // by adonis_gr (2011.03.30)\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": // translations for travian version 3.6\n\t\t\t\taLangAllBuildWithId = [\"Ξυλοκόπος\", \"Ορυχείο πηλού\", \"Ορυχείο σιδήρου\", \"Χωράφι σιταριού\", \"Περιοχή\", \"Πριονιστήριο\", \"Πηλοποιείο\", \"Χυτήριο σιδήρου\", \"Μύλος σιταριού\", \"Αρτοποιείο\", \"Αποθήκη πρώτων υλών\", \"Σιταποθήκη\", \"Οπλοποιείο\", \"Πανοπλοποιείο\", \"Πλατεία αθλημάτων\", \"Κεντρικό κτίριο\", \"Πλατεία συγκεντρώσεως\", \"Αγορά\", \"Πρεσβεία\", \"Στρατόπεδο\", \"Στάβλος\", \"Εργαστήριο\", \"Ακαδημία\", \"Κρυψώνα\", \"Δημαρχείο\", \"Μἐγαρο\", \"Παλάτι\", \"Θησαυροφυλάκιο\", \"Εμπορικό γραφείο\", \"Μεγάλο Στρατόπεδο\", \"Μεγάλος Στάβλος\", \"Τείχος Πόλεως\", \"Χωμάτινο τεἰχος\", \"Τείχος με πάσσαλους\", \"Λιθοδὀμος\", \"Ζυθοποιείο\", \"Τοποθέτης παγίδων\", \"Περιοχή ηρώων\", \"Μεγάλη Αποθήκη\", \"Μεγάλη Σιταποθήκη\", \"Παγκόσμιο Θαύμα\", \"Μέρος ποτίσματος αλόγων\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Ξυλοκόπος\", \"Ορυχείο πηλού\", \"Ορυχείο σιδήρου\", \"Χωράφι σιταριού\", \"Περιοχή\", \"Πριονιστήριο\", \"Πηλοποιείο\", \"Χυτήριο σιδήρου\", \"Μύλος σιταριού\", \"Αρτοποιείο\", \"Αποθήκη πρώτων υλών\", \"Σιταποθήκη\", \"Οπλοποιείο\", \"Πανοπλοποιείο\", \"Πλατεία αθλημάτων\", \"Κεντρικό κτίριο\", \"Πλατεία συγκέντρωσης\", \"Αγορά\", \"Πρεσβεία\", \"Στρατόπεδο\", \"Στάβλος\", \"Εργαστήριο\", \"Ακαδημία\", \"Κρυψώνα\", \"Δημαρχείο\", \"Μἐγαρο\", \"Παλάτι\", \"Θησαυροφυλάκιο\", \"Εμπορικό γραφείο\", \"Μεγάλο Στρατόπεδο\", \"Μεγάλος Στάβλος\", \"Τείχος Πόλεως\", \"Χωμάτινο τεἰχος\", \"Τείχος με πάσσαλους\", \"Λιθοδὀμος\", \"Ζυθοποιείο\", \"Τοποθέτης παγίδων\", \"Περιοχή ηρώων\", \"Μεγάλη Αποθήκη\", \"Μεγάλη Σιταποθήκη\", \"Παγκόσμιο Θαύμα\", \"Μέρος ποτίσματος αλόγων\"];\n\t\t\t\taLangAddTaskText = [\"Προσθηκη Εργασίας\", \"Style\", \"Ενεργό χωριό\", \"στοχος εργασίας\", \"Προς\", \"λειτουργία\", \"Construction support\", \"Resources concentration\", \"Μετακίνηση πάνω\", \"Μετακίνηση κάτω\", \"Διαγραφή\", \" Περιεχομενο εργασιών\", \"Move \", \"Διαγραφή όλων των εργασιών\"];\n\t\t\t\taLangTaskKind = [\"αναβάθμισης\", \"Κατασκευή κτηρίου\", \"Επίθεση\", \"Έρευνα\", \"εκπαίδευση\", \"αποστολή\", \"NPC\", \"κατεδάφιση\", \"γιορτή\"];\n\t\t\t\taLangGameText = [\"επίπεδο\", \"Έμποροι\", \"ID\", \"Πρωτεύουσα\", \"Start time\", \"this timeseting is unuseful now.\", \"προς\", \"χωριό\", \"αποστολή\", \"από\", \"αποστολή προς\", \"αποστολή απο\", \"Επιστροφή απο\", \"πρώτες ύλες\", \"κτήριο\", \"Κατασκευή νέου κτηρίου\", \"κενό\", \"επίπεδο\"];\n\t\t\t\taLangRaceName = [\"Ρωμαίοι\", \"Τεύτονες\", \"Γαλάτες\"];\n\t\t\t\taLangTaskOfText = [\"Πρόγραμμα αναβάθμισης\", \"Πρόγραμμα Κατασκευή νέου κτηρίου\", \"Αυτοματη Αναβ. Υλών\", \"Not_run\", \"Έναρξη\", \"Ξεκίνησε\", \"Αναστολή\", \"The resource fields distribution of this village is \", \"Αυτοματη αποστολή\", \"αύτοματη αποστολή είναι ανενεργή\", \"Ανοιχτό\", \"αποστολή επιτυχής\", \"Λίστα Εργασιών\", \"Trans In limit\", \"Προεπιλογή\", \"Τροποποίηση\", \"Ξύλο/Πηλός/Σιδήρος\", \"Σιτάρι\", \"Πρόγραμμα κατεδάφισης\",\n\t\t\t\t\t\t\"Προγραμματισμος επίθεσης\", \"Τυπος επίθεσης\", \"διάρκεια\", \"επανάληψεις\", \"Ενδιάμεσο χρονικό διάστημα\", \"00:30:00\", \"Στόχος καταπέλτη\", \"Τυχαίος\", \"Άγνωστο\", \"φορές\", \"Μήνας\", \"Ημέρα\", \"Στρατεύματα εστάλησαν\",\n\t\t\t\t\t\t\"Προγραμματησμος εκπαίδευσης\", \"Μέρος εκπαίδευσης\", \"εκπαίδευση Ολοκληρώθηκε\", \"προσαρμοσμένη αποστολή\", \"setup interval time of reload\", \"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\", \"Trans Out Rmn\", \"Προγραμματισμος γιορτων\", \"Μικρή γιορτή\", \"Μεγάλη Γιορτή\", \"Set Interval of Resources concentration\",\n\t\t\t\t\t\t\"λεπτά\", \".\", \".\", \"Έναρξη\", \"Διακοπή\", \"Schedule Improve\", \"Βελτίωση Επίθεσης\", \"Βελτίωση άμυνας\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"Πάρα πολύ λίγες πρώτες ύλες\", \"Ήδη εκτελούνται εργασίες\", \"Κατασκευή ολοκληρώθηκε\", \"Εναρξη Κατασκευής\", \"Σε εξέλιξη\", \"Η Αποθήκη πρώτων υλών σας ειναι πολύ μικρή. Παρακαλώ αναβάθμιστε την Αποθήκη πρώτων υλών για να συνεχιστεί η κατασκευή σας\", \"Η Σιταποθήκη σας ειναι πολύμικρή. Παρακαλώ αναβάθμιστε την σιταποθήκη για να συνεχιστεί η κατασκευή σας\", \"Αρκετες Πρώτες ύλες\", \"Έλλειψη τροφής: Αναβαθίστε πρώτα ενα Χωράφι σιταριού\", \"Πραγματοποιείται ήδη μία γιορτή\"];\n\t\t\t\taLangOtherText = [\"Important note\", \"Μονο οι ύλες της Πρωτεύουσας μπορούν να αναβάθμιστουν στο επίπεδο 20. Now your Πρωτεύουσα is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Ακυρωμένο\", \"Έναρξη των εργασιών\", \"Επιτυχής αναβάθμιση\", \"Εκτελέστηκε με επιτυχία\", \"Your race is unknown, therefore your troop type. Visit your Profile to determine your race.\", \"Please also visit your Περιοχή ηρώων to determine the speed and the type of your hero.\"];\n\t\t\t\taLangResources = [\"Ξύλο\", \"Πηλός\", \"Σίδερο\", \"Σιτάρι\"];\n\t\t\t\taLangTroops[0] = [\"Λεγεωνάριοι\", \"Πραιτοριανός\", \"Ιμπεριανός\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Πολιορκητικός κριός\", \"Καταπέλτης φωτιάς\", \"Γερουσιαστής\", \"Άποικος\", \"Hero\"];\n\t\t\t\taLangTroops[1] = [\"Μαχητές με ρόπαλα\", \"Μαχητής με Ακόντιο\", \"Μαχητής με Τσεκούρι\", \"Ανιχνευτής\", \"Παλατινός\", \"Τεύτονας ιππότης\", \"Πολιορκητικός κριός\", \"Καταπέλτης\", \"Φύλαρχος\", \"Άποικος\", \"Hero\"];\n\t\t\t\taLangTroops[2] = [\"Φάλαγγες\", \"Μαχητής με Ξίφος\", \"Ανιχνευτής\", \"Αστραπή του Τουτατή\", \"Δρυίδης\", \"Ιδουανός\", \"Πολιορκητικός κριός\", \"Πολεμικός καταπέλτης\", \"Αρχηγός\", \"Άποικος\", \"Hero\"];\n\t\t\t\taLangAttackType = [\"Ενίσχυση\", \"Επίθεση: Κανονική\", \"Επίθεση: Επιδρομή\"];\n\t\t\t\tbreak;\n\t\t\tcase \"4.0\": // translations for travian version 4.0\n\t\t\t\taLangAllBuildWithId = [\"Ξυλοκόπος\", \"Ορυχείο πηλού\", \"Ορυχείο σιδήρου\", \"Χωράφι σιταριού\", \"Περιοχή\", \"Πριονιστήριο\", \"Πηλοποιείο\", \"Χυτήριο σιδήρου\", \"Μύλος σιταριού\", \"Αρτοποιείο\", \"Αποθήκη πρώτων υλών\", \"Σιταποθήκη\", \"Σιδηρουργείο\", \"Σιδηρουργείο\", \"Πλατεία αθλημάτων\", \"Κεντρικό κτίριο\", \"Πλατεία συγκεντρώσεως\", \"Αγορά\", \"Πρεσβεία\", \"Στρατόπεδο\", \"Στάβλος\", \"Εργαστήριο\", \"Ακαδημία\", \"Κρυψώνα\", \"Δημαρχείο\", \"Μἐγαρο\", \"Παλάτι\", \"Θησαυροφυλάκιο\", \"Εμπορικό γραφείο\", \"Μεγάλο Στρατόπεδο\", \"Μεγάλος Στάβλος\", \"Τείχος Πόλεως\", \"Χωμάτινο τεἰχος\", \"Τείχος με πάσσαλους\", \"Λιθοδὀμος\", \"Ζυθοποιείο\", \"Τοποθέτης παγίδων\", \"Περιοχή ηρώων\", \"Μεγάλη Αποθήκη\", \"Μεγάλη Σιταποθήκη\", \"Παγκόσμιο Θαύμα\", \"Μέρος ποτίσματος αλόγων\"];\n\t\t\t\taLangAllBuildAltWithId = [\"Ξυλοκόπος\", \"Ορυχείο πηλού\", \"Ορυχείο σιδήρου\", \"Χωράφι σιταριού\", \"Περιοχή\", \"Πριονιστήριο\", \"Πηλοποιείο\", \"Χυτήριο σιδήρου\", \"Μύλος σιταριού\", \"Αρτοποιείο\", \"Αποθήκη πρώτων υλών\", \"Σιταποθήκη\", \"Σιδηρουργείο\", \"Σιδηρουργείο\", \"Πλατεία αθλημάτων\", \"Κεντρικό κτίριο\", \"Πλατεία συγκέντρωσης\", \"Αγορά\", \"Πρεσβεία\", \"Στρατόπεδο\", \"Στάβλος\", \"Εργαστήριο\", \"Ακαδημία\", \"Κρυψώνα\", \"Δημαρχείο\", \"Μἐγαρο\", \"Παλάτι\", \"Θησαυροφυλάκιο\", \"Εμπορικό γραφείο\", \"Μεγάλο Στρατόπεδο\", \"Μεγάλος Στάβλος\", \"Τείχος Πόλεως\", \"Χωμάτινο τεἰχος\", \"Τείχος με πάσσαλους\", \"Λιθοδὀμος\", \"Ζυθοποιείο\", \"Τοποθέτης παγίδων\", \"Περιοχή ηρώων\", \"Μεγάλη Αποθήκη\", \"Μεγάλη Σιταποθήκη\", \"Παγκόσμιο Θαύμα\", \"Μέρος ποτίσματος αλόγων\"];\n\t\t\t\taLangAddTaskText = [\"Προσθηκη Εργασίας\", \"Style\", \"Ενεργό χωριό\", \"στοχος εργασίας\", \"Προς\", \"λειτουργία\", \"Construction support\", \"Resources concentration\", \"Μετακίνηση πάνω\", \"Μετακίνηση κάτω\", \"Διαγραφή\", \" Περιεχομενο εργασιών\", \"Move \", \"Διαγραφή όλων των εργασιών\"];\n\t\t\t\taLangTaskKind = [\"αναβάθμισης\", \"Κατασκευή κτηρίου\", \"Επίθεση\", \"Έρευνα\", \"εκπαίδευση\", \"αποστολή\", \"NPC\", \"κατεδάφιση\", \"γιορτή\"];\n\t\t\t\taLangGameText = [\"επίπεδο\", \"Έμποροι\", \"ID\", \"Πρωτεύουσα\", \"Start time\", \"this timeseting is unuseful now.\", \"προς\", \"χωριό\", \"αποστολή\", \"από\", \"αποστολή προς\", \"αποστολή απο\", \"Επιστροφή απο\", \"πρώτες ύλες\", \"κτήριο\", \"Κατασκευή νέου κτηρίου\", \"κενό\", \"επίπεδο\"];\n\t\t\t\taLangRaceName = [\"Ρωμαίοι\", \"Τεύτονες\", \"Γαλάτες\"];\n\t\t\t\taLangTaskOfText = [\"Πρόγραμμα αναβάθμισης\", \"Πρόγραμμα Κατασκευή νέου κτηρίου\", \"Αυτοματη Αναβ. Υλών\", \"Not_run\", \"Έναρξη\", \"Ξεκίνησε\", \"Αναστολή\", \"The resource fields distribution of this village is \", \"Αυτοματη αποστολή\", \"αύτοματη αποστολή είναι ανενεργή\", \"Ανοιχτό\", \"αποστολή επιτυχής\", \"Λίστα Εργασιών\", \"Trans In limit\", \"Προεπιλογή\", \"Τροποποίηση\", \"Ξύλο/Πηλός/Σιδήρος\", \"Σιτάρι\", \"Πρόγραμμα κατεδάφισης\",\n\t\t\t\t\t\t\"Προγραμματισμος επίθεσης\", \"Τυπος επίθεσης\", \"διάρκεια\", \"επανάληψεις\", \"Ενδιάμεσο χρονικό διάστημα\", \"00:30:00\", \"Στόχος καταπέλτη\", \"Τυχαίος\", \"Άγνωστο\", \"φορές\", \"Μήνας\", \"Ημέρα\", \"Στρατεύματα εστάλησαν\",\n\t\t\t\t\t\t\"Προγραμματησμος εκπαίδευσης\", \"Μέρος εκπαίδευσης\", \"εκπαίδευση Ολοκληρώθηκε\", \"προσαρμοσμένη αποστολή\", \"setup interval time of reload\", \"this is the interval of page reload ,\\n default is 20 minutes, please insert new time:\\n\\n\", \"Trans Out Rmn\", \"Προγραμματισμος γιορτων\", \"Μικρή γιορτή\", \"Μεγάλη Γιορτή\", \"Set Interval of Resources concentration\",\n\t\t\t\t\t\t\"λεπτά\", \".\", \".\", \"Έναρξη\", \"Διακοπή\", \"Schedule Improve\", \"Βελτίωση Επίθεσης\", \"Βελτίωση άμυνας\", \"ResOvrFlow Chk\", \"Enabled\", \"Disabled\", \"AutoRes Crop Upgrd\", \"Toggle\"];\n\t\t\t\taLangErrorText = [\"Πάρα πολύ λίγες πρώτες ύλες\", \"Ήδη εκτελούνται εργασίες\", \"Κατασκευή ολοκληρώθηκε\", \"Εναρξη Κατασκευής\", \"Σε εξέλιξη\", \"Η Αποθήκη πρώτων υλών σας ειναι πολύ μικρή. Παρακαλώ αναβάθμιστε την Αποθήκη πρώτων υλών για να συνεχιστεί η κατασκευή σας\", \"Η Σιταποθήκη σας ειναι πολύμικρή. Παρακαλώ αναβάθμιστε την σιταποθήκη για να συνεχιστεί η κατασκευή σας\", \"Αρκετές πρώτες\", \"Έλλειψη τροφής : Αναβαθμίστε πρώτα ένα χωράφι σιταριού\", \"Πραγματοποιείται ήδη μία γιορτή\"];\n\t\t\t\taLangOtherText = [\"Important note\", \"Μονο οι ύλες της Πρωτεύουσας μπορούν να αναβάθμιστουν στο επίπεδο 20. Now your Πρωτεύουσα is not detected. Visit your Profile please.\", \"Shortcut here ^_^\", \"Setup completed\", \"Ακυρωμένο\", \"Έναρξη των εργασιών\", \"Επιτυχής αναβάθμιση\", \"Εκτελέστηκε με επιτυχία\", \"Your race is unknown, therefore your troop type. Visit your Profile to determine your race.\", \"Please also visit your Περιοχή ηρώων to determine the speed and the type of your hero.\"];\n\t\t\t\taLangResources = [\"Ξύλο\", \"Πηλός\", \"Σίδερο\", \"Σιτάρι\"];\n\t\t\t\taLangTroops[0] = [\"Λεγεωνάριοι\", \"Πραιτοριανός\", \"Ιμπεριανός\", \"Equites Legati\", \"Equites Imperatoris\", \"Equites Caesaris\", \"Πολιορκητικός κριός\", \"Καταπέλτης φωτιάς\", \"Γερουσιαστής\", \"Άποικος\", \"Hero\"];\n\t\t\t\taLangTroops[1] = [\"Μαχητές με ρόπαλα\", \"Μαχητής με Ακόντιο\", \"Μαχητής με Τσεκούρι\", \"Ανιχνευτής\", \"Παλατινός\", \"Τεύτονας ιππότης\", \"Πολιορκητικός κριός\", \"Καταπέλτης\", \"Φύλαρχος\", \"Άποικος\", \"Hero\"];\n\t\t\t\taLangTroops[2] = [\"Φάλαγγες\", \"Μαχητής με Ξίφος\", \"Ανιχνευτής\", \"Αστραπή του Τουτατή\", \"Δρυίδης\", \"Ιδουανός\", \"Πολιορκητικός κριός\", \"Πολεμικός καταπέλτης\", \"Αρχηγός\", \"Άποικος\", \"Hero\"];\n\t\t\t\taLangAttackType = [\"Ενίσχυση\", \"Επίθεση: Κανονική\", \"Επίθεση: Επιδρομή\"];\n\t\t\t\tbreak;\n\t\t}\n}\n\nJOINEDaLangAllBuildWithId = aLangAllBuildWithId.slice(0) ;\nJOINEDaLangAllBuildWithId = cleanString(JOINEDaLangAllBuildWithId);\n\t\t\nJOINEDaLangAllBuildAltWithId = aLangAllBuildAltWithId.slice(0);\nJOINEDaLangAllBuildAltWithId = cleanString(JOINEDaLangAllBuildAltWithId);\ninitializeLangSpecificDependentVars();\n\n}", "handleAddLanguage(languageLabel, price) {\n const tmp = this.state.selectedLanguages;\n if (tmp.find((x) => x.label === languageLabel)) return;\n tmp.push({label: languageLabel, price});\n this.setState({\n selectedLanguages: tmp,\n price: this.state.price + price,\n });\n\n const allLanguagesBooked = this.props.data.custom.availableLanguages.reduce((a, b) => {\n if (a.label === undefined)\n return a && !!tmp.find((x) => x.label === b.label);\n else\n return !!tmp.find((x) => x.label === a.label) && !!tmp.find((x) => x.label === b.label);\n });\n\n if (allLanguagesBooked) this.setState({\n moreLanguagesBookable: false\n });\n }", "getValidLanguages() {\n return validLanguages.slice();\n }", "getValidLanguages() {\n return validLanguages.slice();\n }", "function addLanguages() {}", "function ls_applyLanguageSelect(language, temporary) {\n // possible site for cookie checking to disable language select\n if (!ls_enable) return;\n \n // grab the body element (only one)\n var body = document.getElementsByTagName('body')[0];\n \n // grab an array of multilingual elements\n var mls = ls_getAllMultilingualElements(body);\n \n // this will get overwritten many times, temporary variable\n var form, language_element_hash;\n \n // iterate through all those elements\n for (var i = 0; i < mls.length; i++) {\n var ml = mls[i]; // the current multilingual container\n var ml_c = ml.childNodes; // children of the container\n \n // if it's the first iteration...\n if (ls__first) {\n form = ls_buildWidget(language);\n ml.appendChild(form, ml_c[0]);\n } else {\n // update widget\n form = ml_c[ml_c.length - 1]; // form is last element\n if (!temporary) {\n form.elements[0].value = language;\n form.elements[0].removeAttribute('disabled');\n form.elements[2].removeAttribute('disabled');\n } else {\n form.elements[0].setAttribute('disabled', 'disabled');\n form.elements[2].setAttribute('disabled', 'disabled');\n }\n }\n \n form.elements[0].style.background=\"#FFF\";\n \n // tells us whether or not to blindly perform the keep\n var message_exists = false;\n \n // iterate through all languages and set up a hash\n // with references to each of the language nodes\n lang_element_hash = new Object();\n for (var j = 0; j < ml_c.length; j++) {\n var n = ml_c[j];\n if (n.nodeType != Node.ELEMENT_NODE) continue; // skip non-elements\n if (!n.lang) continue; // skip non-language specific elements\n if (n.lang.indexOf(language) === 0) {\n // it turns out our language is here\n message_exists = true;\n }\n lang_element_hash[n.lang] = n;\n }\n \n // if a preferred language was kept, do quickest processing\n if (message_exists) {\n ls_hideAllExcept(lang_element_hash, language);\n continue;\n }\n \n // otherwise, nothing happened, this means that it wasn't found\n // if it's not the first time, repaint all of them\n if (!ls__first) {\n ls_showAll(lang_element_hash);\n }\n if (language != 'mul') {\n form.elements[0].style.background=\"#FCC\";\n }\n }\n // we've already processed once\n ls__first = false; \n}", "function alienLanguages(n, m) {\n let mod=1e8+7\n \n \n\n return result%mod\n}", "function reloadLanguage() {\n document.querySelectorAll(\"*\").forEach(function (node) {\n let translate = node.getAttribute(\"data-translate\");\n let translateTitle = node.getAttribute(\"data-translate-title\");\n let translatePlaceholder = node.getAttribute(\"data-translate-placeholder\");\n let languageList = node.getAttribute(\"data-languages-list\");\n let custom = node.getAttribute(\"data-languages-custom\");\n\n let languagePath = loadedTranslationData[currentLang];\n let fallbackPath = loadedTranslationData[defaultLang];\n\n if (translate)\n node.innerHTML = languagePath[translate]\n ? languagePath[translate]\n : fallbackPath[translate]\n ? fallbackPath[translate]\n : translate;\n if (translateTitle)\n node.title = languagePath[translateTitle]\n ? languagePath[translateTitle]\n : fallbackPath[translateTitle]\n ? fallbackPath[translateTitle]\n : translateTitle;\n if (translatePlaceholder)\n node.placeholder = languagePath[translatePlaceholder]\n ? languagePath[translatePlaceholder]\n : fallbackPath[translatePlaceholder]\n ? fallbackPath[translatePlaceholder]\n : translatePlaceholder;\n if (languageList) {\n node.innerHTML = \"\";\n for (const locale of availableLanguages) {\n const langCode = locale.baseName;\n const languageNames = new Intl.DisplayNames([langCode], {type: 'language'});\n const dispName = languageNames.of(langCode);\n const replace = languageList\n .replace(/%langCode%/g, langCode)\n .replace(/%langDispName%/g, dispName)\n .replace(/%langCodeQ%/g, '\"' + langCode + '\"')\n .replace(/%langDispName%/g, '\"' + dispName + '\"');\n node.innerHTML += replace;\n }\n }\n if (custom) {\n const pairs = custom.split(\";\");\n for (const p in pairs)\n if (pairs.hasOwnProperty(p)) {\n const pair = pairs[p].split(\":\");\n const attr = pair[0];\n const valueKey = pair[1];\n const value = languagePath[valueKey]\n ? languagePath[valueKey]\n : fallbackPath[valueKey]\n ? fallbackPath[valueKey]\n : valueKey;\n node.setAttribute(attr, value);\n }\n }\n });\n}", "function calcMultilingual(tags) {\n var existingLangsOrdered = _multilingual.map(function(item) {\n return item.lang;\n });\n var existingLangs = new Set(existingLangsOrdered.filter(Boolean));\n\n for (var k in tags) {\n // matches for field:<code>, where <code> is a BCP 47 locale code\n // motivation is to avoid matching on similarly formatted tags that are\n // not for languages, e.g. name:left, name:source, etc.\n var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);\n if (m && m[1] === field.key && m[2]) {\n var item = { lang: m[2], value: tags[k] };\n if (existingLangs.has(item.lang)) {\n // update the value\n _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;\n existingLangs.delete(item.lang);\n } else {\n _multilingual.push(item);\n }\n }\n }\n\n // Don't remove items based on deleted tags, since this makes the UI\n // disappear unexpectedly when clearing values - #8164\n _multilingual.forEach(function(item) {\n if (item.lang && existingLangs.has(item.lang)) {\n item.value = '';\n }\n });\n }", "function allKeys(eng, comparator, missingTranslations, lang){\n var languageMode;\n // Identify the language being referenced.\n switch (lang) {\n case \"It\":\n languageMode = italian;\n break;\n case \"De\":\n languageMode = german;\n break;\n case \"Fr\":\n languageMode = french;\n\n break;\n default:\n showToast(\"Something went wrong.\", \"R\");\n break;\n }\n\n for (var key in eng) {\n accessor.push(key);\n // Check for nested JSON.\n if(typeof eng[key] === \"object\"){\n // Synchronise object if keys are missing.\n if(!comparator.hasOwnProperty(key)) {comparator[key] = eng[key]};\n // Recursive call on the object.\n allKeys(eng[key], comparator[key], missingTranslations, lang);\n\n } else{\n // Extract values\n var engVal = getObjFromLastKey(eng, accessor);\n var langVal = getObjFromLastKey(comparator, accessor);\n if(langVal == null){\n // Synchronise JSONs is value doesn't exists.\n inputObject(languageMode, accessor.slice(), engVal);\n }\n if(engVal == langVal || langVal == null){\n // Flag this word if: the values are the same, the value doesn't exist and it is not on the ignore list.\n if(!identicals[\"All\"].includes(engVal) && ( !identicals.hasOwnProperty(lang) || !identicals[lang].includes(engVal) )){\n // Check if translation exsists before asking for a transaltion.\n var translatedVal = checkTranslationExists(engVal, english, languageMode);\n // Fill translation if found.\n if(translatedVal != \"\"){\n inputObject(languageMode, accessor.slice(), translatedVal);\n autoChanges++;\n }else{\n // Append or add the associated key trails to the corresponding phrase.\n missingTranslations.hasOwnProperty(engVal) ? missingTranslations[engVal].push(accessor.slice()) : missingTranslations[engVal] = [accessor.slice()] ;\n }\n }\n }\n }\n accessor.pop();\n }\n\n console.log(missingTranslations);\n return missingTranslations;\n}", "function setCurrentWords() {\n var collWords = collection[currLang] || {};\n helper.clearObject(currentWords);\n translate.buildWords(collWords, currentWords);\n var subCollWords = subColls[currLang];\n !helper.isEmpty(subCollWords) && translate.buildWords(subCollWords, currentWords);\n }", "function mostSpokenLanguages(array) {\n let allLanguages = []\n array.forEach(element => {\n allLanguages.push(element.languages.join(\", \")) /*turns the array into a string*/\n\n })\n console.log(allLanguages)\n // (250) [\"Pashto, Uzbek, Turkmen\", \n // ========\n let joined = allLanguages.join(\", \").split(\", \")\n console.log(joined)\n // (368) [\"Pashto\", \"Uzbek\", \"Turkmen\",\n // ============\n let mySet = new Set(joined)\n console.log(mySet)\n // Set(112) {\"Pashto\", \"Uzbek\", \"Turkmen\",\n\n let myMap = new Map()\n for (let language of mySet) {\n let count = joined.filter(element => element === language)\n myMap.set(language, count.length)\n }\n console.log(myMap)\n\n\n\n}", "function updateLanguagePanel() {\n languagesPresent = [];\n numEachLanguage = {};\n\n //generates a list of languages and a count of each one\n //for only Gists that are not favorited\n GistList.filter(nonFavorite).forEach(function(gist) {\n gist.languages.forEach(function(lang) {\n if (languagesPresent.indexOf(lang) == -1) {\n languagesPresent.push(lang);\n numEachLanguage[lang] = 1;\n } else {\n numEachLanguage[lang]++;\n }\n });\n });\n\n //update html\n var langList = document.getElementById('languageList');\n clearNode(langList);\n\n languagesPresent.forEach(function(lang) {\n var chlabel = document.createElement('label');\n var ch = document.createElement('input');\n\n ch.setAttribute('type', 'checkbox');\n ch.setAttribute('onclick', 'languageSelect(this.checked,this.value)');\n ch.setAttribute('value', lang);\n\n if (languagesSelected.indexOf(lang) != -1) {\n ch.setAttribute('checked', 'true');\n }\n\n chlabel.appendChild(ch);\n\n chlabel.appendChild(document.createTextNode(lang + ' (' + numEachLanguage[lang] + ') '));\n\n langList.appendChild(chlabel);\n });\n\n for (var i = 0; i < languagesSelected.length; i++) {\n //selecetd language no longer in set\n if (languagesPresent.indexOf(languagesSelected[i]) == -1) {\n languagesSelected.splice(i, 1);\n }\n }\n}", "function addBonusLanguagesEightCities() {\r\n\tvar bonusLanguages = [\r\n\t\t{\"language\": \"Lankhmarese (High)\"},\r\n\t\t{\"language\": \"Ilthmarish\"},\r\n\t\t{\"language\": \"Mingol\"},\r\n\t\t{\"language\": \"Horborixic\"},\r\n\t\t{\"language\": \"Desert-Talk\"},\r\n\t\t{\"language\": \"Northspeak (Cold Tongue)\"},\r\n\t\t{\"language\": \"Quarmallian\"},\r\n\t\t{\"language\": \"Kleshic\"},\r\n\t\t{\"language\": \"Old Ghoulish\"},\r\n\t\t{\"language\": \"Kiraayan\"},\r\n\t\t{\"language\": \"Eevamarensee\"},\r\n\t\t{\"language\": \"Simorgyan\"}\r\n\t\t\t];\r\n return bonusLanguages[Math.floor(Math.random() * bonusLanguages.length)]; \r\n}", "getAvailableLanguages() {\n if (!this.availableLanguages) {\n this.availableLanguages = [];\n for (let language in this.props) {\n this.availableLanguages.push(language);\n }\n }\n return this.availableLanguages;\n }", "function storageLang(index) {\r\n\tvar type = {\r\n\t\t'ko': 0,\r\n\t\t'ko-KR': 0,\r\n\t\t'en-US': 1,\r\n \t'ja': 2,\r\n \t'ja-JP': 2,\r\n \t'cn': 3,\r\n \t'zh-cn': 3\r\n\t}\r\n\r\n\tvar text = [\r\n\t\t[\r\n\t\t\t\"하드디스크\", // 0\r\n\t \"이동디스크\",\r\n\t \"보안토큰\",\r\n\t \"저장토큰\",\r\n\t \"안전디스크\",\r\n\r\n\t \"구동에 실패하였습니다.\\n\\n IE인터넷 옵션 -> 보안 \\n 인터넷 보호모드 check, 신뢰사이트 보호모드 check \\n\", // 5\r\n\t \"지원되지 않습니다.\",\r\n\t \r\n\t \"인증서의 유출가능성이 있어 안전하지 않습니다.<br><br>PC를 공용으로 상용하는 경우는 더 위험하오니,<br>USB메모리, 보안토큰, IC카드 등을 이용하십시오.\", // 7\r\n\t \"USB 메모리의 경우,<br>하드디스크와 동일하게 인식되어 이용이 매우 편리합니다.<br>\",\r\n\t \" - 보안기능이 탑재된 가장 우수한 장치입니다.<br> - 국내 표준 인증을 받은 제품 이외에는<br>&nbsp;&nbsp;해당매체를 지원하지 못합니다<br> - 인증서 발급시 몇 분이 소요될 수 있습니다.\",\r\n\t \" - 접근속도가 저장매체중 비교적 낮습니다<br> - 저장매체의 안전성(보안성)이 우수합니다.\",\r\n\r\n\t \t// html 언어\r\n\t\t\t\"인증서 저장매체 선택\",\t// 11\r\n\t\t\t\"저장매체 선택\",\r\n\t\t\t\"[설명]\",\r\n\t\t\t\"확인\",\r\n\t\t\t\"취소\",\r\n\t\t\t\"이동식매체 선택\",\t// 16\r\n\r\n\t\t\t\"저장매체를 선택하세요.\",\t// 17\r\n\r\n\t\t\t// 언어 세팅이 일본어일때 저장매체 영어로\r\n\t\t\t\"HardDisk\", // 18\r\n\t \"Removable\",\r\n\t \"CryptoToken\",\r\n\t \"SaveToken\",\r\n\t \"SecureDisk\",\r\n\r\n\t // 안전디스크 설명문\r\n\t\t\t \"하드디스크의 특정영역을 암호화하고, <br>별도의 인증절차를 통해서만 접근할 수 있도록 만든 <br>안전한 디스크 영역으로 공인인증서를 안전디스크에 저장함으로써 <br>위험요소를 최소화 하였습니다.\",\t// 23\r\n\t\t\t \"공통저장소\"\r\n\t\t],\r\n\t\t[\r\n\t\t\t\"HardDisk\", // 0\r\n\t \"Removable\",\r\n\t \"CryptoToken\",\r\n\t \"SaveToken\",\r\n\t \"SecureDisk\",\r\n\r\n\t \"Failedtoinitialize, IE internet Option -> security-> internet protected mode check, -> trusted site protecet mode check \", // 5\r\n\t \"Not Supported.\",\r\n\r\n\t \"This storage isn't safe, there is the possibility of certificate leakage.<br><br>It could be very unsafe, if you are using public PC.<br>It is stongly recommended using Removable Disk, Crypto Token, IC Card.\",\r\n\t \"The removable disk is very easy to use, because it is recognized in the same manner as a hard disk.<br>\",\r\n\t \" - This is the best storage device that is equipped with security functions.<br> - Except for products received national certification standards <br>&nbsp;&nbsp;do not support the device.<br> - It may take a few minutes during certificate issuance.\",\r\n\t \" - This storage is relatively low access speed of the storage media.<br> - This storage has excellent the safety and security.\",\r\n\r\n\t // html 언어\r\n\t\t\t\"Select certificate storage\",\t// 11\r\n\t\t\t\"Select storage\",\r\n\t\t\t\"[description]\",\r\n\t\t\t\"OK\",\r\n\t\t\t\"Cancel\",\r\n\t\t\t\"Select Removable Disk\",\t// 16\r\n\r\n\t\t\t// 새로 추가됨\r\n\t\t\t\"Select storage.\",\t// 17\r\n\r\n\t\t\t// 언어 세팅이 일본어일때 저장매체 영어로\r\n\t\t\t\"HardDisk\", // 18\r\n\t \"Removable\",\r\n\t \"CryptoToken\",\r\n\t \"SaveToken\",\r\n\t \"SecureDisk\",\r\n\r\n\t // 안전디스크 설명문\r\n\t \"하드디스크의 특정영역을 암호화하고, <br>별도의 인증절차를 통해서만 접근할 수 있도록 만든 <br>안전한 디스크 영역으로 공인인증서를 안전디스크에 저장함으로써 <br>위험요소를 최소화 하였습니다.\",\t// 23\r\n\t\t\t \"공통저장소\"\r\n\t\t],\r\n\t\t[\r\n\t\t\t\"ハードディスク\", // 0\r\n\t \"リムーバブルディスク\",\r\n\t \"セキュリティトークン\",\r\n\t \"ICトークン\",\r\n\t \"安全ディスク\",\r\n\r\n\t \"起動に失敗しました。\\n\\nIEインターネットオプション -> セキュリティ\\nインターネット保護モードcheck、信頼済みサイト保護モードcheck \\n\", // 5\r\n\t \"サポートされていません。\",\r\n\t \r\n\t \"認証書はハッキングの可能性があって危険です。<br><br>共用PCを使用する場合はより危険なので、<br>USBメモリ、セキュリティトークン、ICカードなどを利用してください。\", // 7\r\n\t \"USBメモリの場合、<br>ハードディスクと同一に認識されて利用が非常に便利です。<br>\",\r\n\t \" -セキュリティ機能がある最も優れた装置です。<br>- 国内標準認証を受けた製品以外には<br>&nbsp;&nbsp;その媒体をサポートすることができません。<br>- 認証書の発給時には数分時間がかかる場合があります。\",\r\n\t \" -アクセル速度が保存媒体の中で比較的低いです。<br>-保存媒体の安全(セキュリティ)性が優れます。\",\r\n\r\n\t // html 언어\r\n\t\t\t\"認証書保存媒体の選択\",\t// 11\r\n\t\t\t\"保存媒体の選択\",\r\n\t\t\t\"[説明]\",\r\n\t\t\t\"確認\",\r\n\t\t\t\"取消\",\r\n\t\t\t\"USB媒体の選択\",\t// 16\r\n\r\n\t\t\t// 새로 추가됨\r\n\t\t\t\"保存媒体のを選択してください。\",\t// 17\r\n\r\n\t\t\t// 언어 세팅이 일본어일때 저장매체 영어로\r\n\t\t\t\"HardDisk\", // 18\r\n\t \"Removable\",\r\n\t \"CryptoToken\",\r\n\t \"SaveToken\",\r\n\t \"SecureDisk\",\r\n\r\n\t // 안전디스크 설명문\r\n\t \"하드디스크의 특정영역을 암호화하고, <br>별도의 인증절차를 통해서만 접근할 수 있도록 만든 <br>안전한 디스크 영역으로 공인인증서를 안전디스크에 저장함으로써 <br>위험요소를 최소화 하였습니다.\",\t// 23\r\n\t\t\t \"공통저장소\"\r\n\t\t],\r\n\t\t[\r\n\t\t\t\"硬盘\", // 0\r\n\t \"移动硬盘\",\r\n\t \"安全令牌\",\r\n\t\t\t\"储存令牌\",\r\n\t\t\t\"安全磁盘\",\r\n\r\n\t \"驱动失败.\\n\\n IE互联网选项 -> 安全 \\n 互联网保护模式 check, 可信任网址保护模式 check \\n\", // 5\r\n\t \"不受支持.\",\r\n\t \r\n\t \"认证书有泄漏的危险.<br><br>使用公用电脑的话更加危险,<br>请使用USB, 安全令牌, IC卡等.\", // 7\r\n\t \"USB,<br>将被识别为移动硬盘,使用起来非常便捷.<br>\",\r\n\t \" - 搭载安保功能的最优秀的设备.<br> - 国内获得标准认证的产品以外<br>&nbsp;&nbsp;不支持相关媒体<br> - 证书签发需要几分钟.\",\r\n\t \" - 接触速度相对于其他储存媒体较低<br> - 储存媒体的安全性(保安性)良好.\",\r\n\r\n\t \t// html 언어\r\n\t\t\t\"认证书储存媒体选择\",\r\n\t\t\t\"储存媒体选择\",\r\n\t\t\t\"[说明]\",\r\n\t\t\t\"确认\",\r\n\t\t\t\"取消\",\r\n\t\t\t\"移动媒体选择\",\r\n\r\n\t\t\t\"请选择储存媒体.\",\t\t// 17\r\n\r\n\t\t\t// 언어 세팅이 일본어일때 저장매체 영어로\r\n\t\t\t\"HardDisk\", // 18\r\n\t \"Removable\",\r\n\t \"CryptoToken\",\r\n\t \"SaveToken\",\r\n\t \"SecureDisk\",\r\n\r\n\t // 안전디스크 설명문\r\n\t \"硬盘特定领域加密, <br>通过额外的认证程序才可以靠近 <br>以此创建安全的磁盘区 <br>使存放在安全磁盘的公认认证书的安全风险降到最低.\",\t// 23\r\n\t\t\t \"공통저장소\"\r\n\t\t]\r\n\t];\r\n\r\n\tvar brwoserLang = (function () {\r\n\t\tif (typeof (window.navigator.browserLanguage) === 'undefined')\r\n\t\t\treturn window.navigator.language;\r\n\t\treturn window.navigator.browserLanguage;\r\n\t})();\r\n\r\n\tvar _config = VestSign.getConfig();\r\n\tif(_config.langIndex === undefined)\r\n\t\treturn text[type[brwoserLang]][index];\r\n\r\n\treturn text[_config.langIndex][index];\r\n}", "listWords() {\n let language = this.state.language.name;\n return this.state.words.map((item, idx) => {\n return (\n <li key={idx}>\n <p>{language}</p>\n <h4>{item.original}</h4>\n <p>{`correct answer count: ${item.correct_count}`}</p>\n <p>{`incorrect answer count: ${item.incorrect_count}`}</p>\n </li>\n );\n });\n }", "unpackWords(lex) {\n let tags = Object.keys(lex)\n for (let i = 0; i < tags.length; i++) {\n let words = Object.keys(unpack(lex[tags[i]]))\n for (let w = 0; w < words.length; w++) {\n addLex.addWord(words[w], tags[i], this.words)\n // do some fancier stuff\n addLex.addMore(words[w], tags[i], this)\n }\n }\n }", "function loadLangs() \n{\n\tif (jsonObject.phraseArray.length)\n\t{\n\t\tchrome.storage.sync.get({\n\t\t\tfrom: 'en',\n\t\t\tto: 'es',\n\t\t}, function(items) {\n\t\t\tjsonObject.fromLang = items.from;\n\t\t\tjsonObject.toLang = items.to;\n\t\t\tgetTranslation();\n\t\t});\n\t}\n}", "__init13() {this.languages = new Map()}", "function getBonusLanguages (intelligenceModifier, luckySign, luckModifier, modChoice) {\r\n\tvar bonusLanguages = 0;\r\n\tvar result = \"\";\r\n\tif(bonusLanguages != undefined && typeof bonusLanguages === 'number') {\r\n\t\tbonusLanguages = intelligenceModifier;\r\n\t}\r\n\telse {\r\n\t\treturn \"\";\r\n\t}\r\n\t\r\n\tif(luckySign != undefined && luckySign.luckySign === \"Birdsong\") {\r\n\t\tbonusLanguages += luckModifier;\r\n\t}\r\n\t\r\n\tif(bonusLanguages <=0) {\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\tif(modChoice == \"0\")\r\n\t{\r\n\t\tresult = \", \" + addBonusLanguagesLankhmar().language;\r\n\t\t\r\n\r\n\t\t// loop\r\n\t\tfor(var i = 1; i < bonusLanguages; i++)\r\n\t\t{\r\n\t\t\t// 1) get a random lang\r\n\t\t\tnewLanguage = addBonusLanguagesLankhmar().language;\r\n\t\t\t// 2) check the new lang is not repeative\r\n\t\t\tif(result.indexOf(newLanguage) != -1)\r\n\t\t\t{\r\n\t\t\t\ti--;\r\n\t\t\t\t// if yes continue;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else\r\n\t\t\t{\r\n\t\t\t\t// if not, add the new lang into the result\r\n\t\t\t\tresult += \", \" + newLanguage;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\t\r\n\r\n\tif(modChoice == \"1\")\r\n\t{\r\n\t\t\r\n\t\tresult = \", \" + addBonusLanguagesEightCities().language;\r\n\r\n\t\t// loop\r\n\t\tfor(var j = 1; j < bonusLanguages; j++)\r\n\t\t{\r\n\t\t\t// 1) get a random lang\r\n\t\t\tnewLanguage = addBonusLanguagesEightCities().language;\r\n\t\t\t// 2) check the new lang is not repeative\r\n\t\t\tif(result.indexOf(newLanguage) != -1)\r\n\t\t\t{\r\n\t\t\t\tj--;\r\n\t\t\t\t// if yes continue;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else\r\n\t\t\t{\r\n\t\t\t\t// if not, add the new lang into the result\r\n\t\t\t\tresult += \", \" + newLanguage;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(modChoice == \"2\")\r\n\t{\r\n\t\t\r\n\t\tresult = \", \" + addBonusLanguagesColdWaste().language;\r\n\r\n\t\t// loop\r\n\t\tfor(var k = 1; k < bonusLanguages; k++)\r\n\t\t{\r\n\t\t\t// 1) get a random lang\r\n\t\t\tnewLanguage = addBonusLanguagesColdWaste().language;\r\n\t\t\t// 2) check the new lang is not repeative\r\n\t\t\tif(result.indexOf(newLanguage) != -1)\r\n\t\t\t{\r\n\t\t\t\tk--;\r\n\t\t\t\t// if yes continue;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else\r\n\t\t\t{\r\n\t\t\t\t// if not, add the new lang into the result\r\n\t\t\t\tresult += \", \" + newLanguage;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(modChoice == \"3\")\r\n\t{\r\n\t\t\r\n\t\tresult = \", \" + addBonusLanguagesEasternLands1().language;\r\n\r\n\t\t// loop\r\n\t\tfor(var l = 1; l < bonusLanguages; l++)\r\n\t\t{\r\n\t\t\t// 1) get a random lang\r\n\t\t\tnewLanguage = addBonusLanguagesEasternLands1().language;\r\n\t\t\t// 2) check the new lang is not repeative\r\n\t\t\tif(result.indexOf(newLanguage) != -1)\r\n\t\t\t{\r\n\t\t\t\tl--;\r\n\t\t\t\t// if yes continue;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else\r\n\t\t\t{\r\n\t\t\t\t// if not, add the new lang into the result\r\n\t\t\t\tresult += \", \" + newLanguage;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(modChoice == \"4\")\r\n\t{\r\n\t\t\r\n\t\tresult = \", \" + addBonusLanguagesEasternLands2().language;\r\n\r\n\t\t// loop\r\n\t\tfor(var m = 1; m < bonusLanguages; m++)\r\n\t\t{\r\n\t\t\t// 1) get a random lang\r\n\t\t\tnewLanguage = addBonusLanguagesEasternLands2().language;\r\n\t\t\t// 2) check the new lang is not repeative\r\n\t\t\tif(result.indexOf(newLanguage) != -1)\r\n\t\t\t{\r\n\t\t\t\tm--;\r\n\t\t\t\t// if yes continue;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else\r\n\t\t\t{\r\n\t\t\t\t// if not, add the new lang into the result\r\n\t\t\t\tresult += \", \" + newLanguage;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(modChoice == \"5\")\r\n\t{\r\n\t\t\r\n\t\tresult = \", \" + addBonusLanguagesMingol().language;\r\n\r\n\t\t// loop\r\n\t\tfor(var n = 1; n < bonusLanguages; n++)\r\n\t\t{\r\n\t\t\t// 1) get a random lang\r\n\t\t\tnewLanguage = addBonusLanguagesMingol().language;\r\n\t\t\t// 2) check the new lang is not repeative\r\n\t\t\tif(result.indexOf(newLanguage) != -1)\r\n\t\t\t{\r\n\t\t\t\tn--;\r\n\t\t\t\t// if yes continue;\r\n\t\t\t\tcontinue;\r\n\t\t\t} else\r\n\t\t\t{\r\n\t\t\t\t// if not, add the new lang into the result\r\n\t\t\t\tresult += \", \" + newLanguage;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\r\n\treturn result;\r\n}", "async function setLanguagePairs() {\n let defaultClient = LiltNode.ApiClient.instance;\n // Configure API key authorization: ApiKeyAuth\n let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];\n let APIKey = window.localStorage.getItem(\"LILTAPIKEY\");\n if (!APIKey) {\n handleError(\"No API Key Found\");\n return;\n }\n ApiKeyAuth.apiKey = APIKey;\n let BasicAuth = defaultClient.authentications['BasicAuth'];\n BasicAuth.username = APIKey;\n BasicAuth.password = APIKey;\n\n let apiMemoryInstance = new LiltNode.MemoriesApi();\n let apiLanguageInstance = new LiltNode.LanguagesApi();\n\n let memories = await apiMemoryInstance.getMemory();\n let languages = await apiLanguageInstance.getLanguages();\n let dict = languages.code_to_name;\n\n let languagePairs = new Set();\n for (let i = 0; i < memories.length; i++) {\n let memory = memories[i];\n let src = dict[memory.srclang];\n let trg = dict[memory.trglang];\n languagePairs.add(src + \" to \" + trg);\n let cached = window.localStorage.getItem(memory.srclang + memory.trglang + \"LiltMemory\");\n if (cached !== null) {\n memoriesDict[src + \" to \" + trg] = [memory.srclang, memory.trglang, cached];\n } else {\n memoriesDict[src + \" to \" + trg] = [memory.srclang, memory.trglang, memory.id];\n }\n }\n\n let options = \"\"\n for (let pair of languagePairs) {\n let splitPair = pair.split(\" to \");\n\n if (languagePairs.has(splitPair[1] + \" to \" + splitPair[0])) {\n options += '<option value=\"' + pair + '\" />';\n }\n }\n\n document.getElementById('languages').innerHTML = options;\n}", "function SelectLanguage (props) {\n var languages = ['All', 'CSS', 'Java', 'Javascript', 'Python', 'Ruby', 'Scala'];\n return (\n <ul className='popular-languages'>\n {languages.map(function (lang) {\n return (\n <LanguageItem \n key={lang}\n language={lang} \n onSelect={props.onSelect}\n selectedLanguage={props.selectedLanguage}\n />\n );\n })}\n </ul>\n );\n}", "function d(e,a){a=a||O.languages||E(S);var n={relevance:0,value:t(e)},r=n;return a.filter(w).forEach(function(t){var a=l(t,e,!1);a.language=t,a.relevance>r.relevance&&(r=a),a.relevance>n.relevance&&(r=n,n=a)}),r.language&&(n.second_best=r),n}", "function listLanguages() {\n return new Promise((resolve, reject) => {\n translate\n .getLanguages()\n .then((results) => {\n [languages] = results;\n const randomNumber = getRandomInt(languages.length);\n target = languages[randomNumber].code;\n detectAndTranslateLanguages().then((response) => {\n translatedText = response;\n resolve(languages[randomNumber].name);\n });\n })\n .catch((err) => {\n console.error('ERROR:', err);\n reject();\n });\n });\n}", "function setupEditKW(settings = { \"app\": { \"enabled-keywordlists\": [\"en\"] }}) {\n logger.debug(\"setupEditKW\");\n var enabledKW = settings.app[\"enabled-keywordlists\"];\n //if (enabledKW.length === 0) { enabledKW.push(\"en\");}\n //var apppath = remote.app.getPath('userData');\n\n $(\"#KW-selector\").empty();\n $(\"#KW-selector\").append(document.createElement(\"option\"));\n\n logger.debug(\"getting enabled local lists...\");\n /*\n $(\"#settings-local-kw-lists .kw-list-enabled\").each(function (i) {\n var kw_list_id = $(this).attr(\"data-id\");\n enabledKW.push(kw_list_id);\n logger.debug(\"ADDED: \" + kw_list_id);\n });\n */\n\n var kw_base = path.join(__dirname, '../../keywordfiles/lists/');\n\n var kw_groups = [];\n var kw_current_group = \"\";\n logger.debug(\"GOING TO LOOP enabledKW now....\");\n for (var i = 0; i < enabledKW.length; i++) {\n //logger.debug(\"Round: \" + i);\n // enabledKW is list of lang folder names [\"en\",\"fi\",....]\n var langfolderbase = path.join(kw_base, enabledKW[i]);\n var kwfiles = fs.readdirSync(path.join(kw_base, enabledKW[i]), 'utf8');// read dir, like \"en\" contents\n for (var f = 0; f < kwfiles.length; f++) {\n // kwfiles is list of kw files under language folder, like \"en\"\n let loadedlist = [];\n if (fs.existsSync(path.join(langfolderbase, kwfiles[f]))) {\n logger.debug(\"KW file '\" + kwfiles[f] + \"' located!\");\n try {\n //logger.debug(\"TRYING TO GET KW FILE CONTENTS AND LOOP 'EM\");\n loadedlist = require(path.join(langfolderbase, kwfiles[f]));\n for (var k in loadedlist) {\n //logger.debug(\"in loop now. current: \" + k);\n if (loadedlist.hasOwnProperty(k)) {\n var kw_tag = k;\n var kw_itself = loadedlist[k];\n if (Object.keys(loadedlist).indexOf(k) === 0) {//loadedlist.indexof(k) === 0) {// skipping 0, because that is the name\n //logger.debug(kw_itself);\n kw_current_group = kw_itself;//.substring(kw_itself.split(' - ')[0].length + 3, kw_itself.length);\n //logger.debug(\"First line! taking name...: \" + kw_current_group);\n continue;\n } else if (Object.keys(loadedlist).indexOf(k) === 1) {\n //version number here...\n continue;\n }\n if (kw_groups.indexOf(kw_current_group) > -1) {\n //logger.debug(\"Group seems to exist: \" + kw_current_group);\n let option_elem = document.createElement(\"option\");\n let option_text = document.createTextNode(kw_itself);\n //logger.debug(\"KW ITSELF: \" + kw_itself);\n //logger.debug(\"KW TAG: \" + kw_tag);\n $(option_elem).attr({\n value: kw_tag\n });\n $(option_elem).append(option_text);\n $(\"#KW-selector optgroup[label='\" + kw_current_group + \"']\").append(option_elem);\n //logger.debug(\"#KW-selector optgroup[label='\" + kw_current_group + \"']\");\n }\n else {\n //logger.debug(\"Group seems to NOT exist: \" + kw_current_group);\n kw_groups.push(kw_current_group);\n var optgroup_elem = document.createElement(\"optgroup\");\n $(optgroup_elem).attr({\n label: kw_current_group\n });\n $(\"#KW-selector\").append(optgroup_elem);\n\n let option_elem = document.createElement(\"option\");\n let option_text = document.createTextNode(kw_itself);\n //logger.debug(\"KW ITSELF: \" + kw_itself);\n //logger.debug(\"KW TAG: \" + kw_tag);\n $(option_elem).attr({\n value: kw_tag\n });\n $(option_elem).append(option_text);\n $(\"#KW-selector optgroup[label='\" + kw_current_group + \"']\").append(option_elem);\n //logger.debug(\"#KW-selector optgroup[label='\" + kw_current_group + \"']\");\n }\n }\n }\n } catch (err) {\n logger.error(\"Failed to load '\" + enabledKW[i] + \".json' KW file...\");\n logger.error(err.message);\n $(\"#settings-local-kw-lists li['data-id'='\" + enabledKW[i] + \"'] span\").trigger(\"click\");\n }\n }\n else {\n logger.warn(\"No desired KW-file found in keywords directory!\");\n $(\"#settings-local-kw-lists li[data-id='\" + enabledKW[i] + \"'] span\").trigger(\"click\");\n }\n }\n }\n // here you update kw-selector in case of same words in current file\n $(\"#file-chosen-kw-ul li\").each(function (i) {//\"#KW-selector\"\n logger.debug(\"TESTING IF THE CURRENT FILE SELECTED KW ARE PRESENT IN SELECT-LIST\");\n var kw_identificator = $(this).attr(\"data-value\").substring(3, $(this).attr(\"data-value\").length);\n $(\"#KW-selector option\").each(function (i) {\n // FRIENDSHIP IS MAGIC! var value = $(this).attr(\"data-value\").substring(3, test.length - 1);\n var kw_testvalue = $(this).val().substring(3, $(this).val().length);\n logger.debug(\"TESTING SELECTED KEYWORD----\");\n if (kw_testvalue === kw_identificator) {\n // same and nice :3\n $(this).attr(\"disabled\", \"disabled\");\n }\n });\n });\n logger.debug(\"re-calling SELECT2 for keyword selection in edit-view.....\");\n $(\"#KW-selector\").select2({\n placeholder: i18n.__('select2-kw-add-ph')\n });\n}", "function loadLanguages(languages) {\n const languageSelect = $(ids.language);\n var languageOptions = languages.map(toOption);\n\n languageSelect.append(languageOptions);\n}", "makeStrings () {\n const { words, wordsEng = {}, wordsRu = {} } = this.state\n let rus = {}\n let eng = {}\n words.forEach(item => {\n eng[`${item}`] = wordsEng !== {} ? wordsEng[`${item}Eng`] : 'no data'\n rus[`${item}`] = wordsRu !== {} ? wordsRu[`${item}Ru`] : 'no data'\n })\n let localizedStrings = new LocalizedStrings({\n rus: rus,\n eng: eng\n })\n this.setState({ localizedStrings })\n }", "function listLanguages() {\n return languageNames.concat()\n}", "function isRubyComing(list) {\n // thank you for checking out my kata :)\n let count = 0\n for(let i = 0; i < list.length ; i++){\n let {firstName, lastName, country, contient, age, language} = list[i]\n if(language === \"Ruby\"){\n count = count + 1;\n } \n \n }\n if(count > 0) return true \n else return false\n \n}", "function buildLanguageLinks() {\n const userPageUrl = '/user-page.html?user=' + parameterUsername;\n const languagesListElement = document.getElementById('languages');\n\n //Iterate through hash map\n supportedLanguages.forEach(function(value, key) {\n languagesListElement.appendChild(createListItem(createLink(\n userPageUrl + '&language=' + key, value)));\n });\n\n}", "function setWords(){\n //if no lang was select set to hebrew\n if (localStorage.getItem(\"language\") == null)\n var lang = HEBREW;\n else\n var lang = localStorage.getItem(\"language\");\n\n for(var i = 0;i< word.length;i++){\n if ($('[data-word=\"'+i+'\"]').length > 0) {\n $('[data-word=\"'+i+'\"]').html(word[i][lang]);\n }\n if($('[data-word-placeholder=\"'+i+'\"]').length > 0){\n $('[data-word-placeholder=\"'+i+'\"]').attr(\"placeholder\", (word[i][lang]));\n }\n if($('[data-word-value=\"'+i+'\"]').length > 0){\n $('[data-word-value=\"'+i+'\"]').val((word[i][lang]));\n $('input[data-word-value=\"' + i + '\"]').button( \"refresh\" );//refresh the buttons\n }\n }\n\n //ltr\n if (localStorage.getItem(\"language\") != HEBREW && localStorage.getItem(\"language\") != null ){\n $('link[href=\"css/lang_rtl.css\"]').attr('href','css/lang_ltr.css');\n //$(\"#sidebar ul li a\").css('textAlign', 'left');\n $(\"#sidebar ul li a\").removeClass('ui-btn-icon-left');\n $(\"#sidebar ul li a\").addClass('ui-btn-icon-right');\n } \n\n //rtl\n else{\n $('link[href=\"css/lang_ltr.css\"]').attr('href','css/lang_rtl.css');\n //$(\"#sidebar ul li a\").css('textAlign', 'right');\n $(\"#sidebar ul li a\").removeClass('ui-btn-icon-right');\n $(\"#sidebar ul li a\").addClass('ui-btn-icon-left');\n }\n $(\".sub-menu li a\").css('textAlign', 'left');\n $(\".sub-menu li a\").removeClass('ui-btn-icon-right');\n $(\".sub-menu li a\").removeClass('ui-btn-icon-left');\n \n /*\n setTimeout(function(){\n alert($('[data-word=\"ab\"]').length);\n },1000);\n */\n}", "function populateLanguageSelect() {\n for (const lang in languages) {\n $(\"#language-select\").append(`<option value=\"${lang}\">${languages[lang]}</option>`);\n }\n}", "getLikelyLocaleForLanguage(language) {\n var _this5 = this;\n\n return _asyncToGenerator(function* () {\n let lang = language.toLowerCase();\n if (!_this5.likelyLocaleTable) _this5.likelyLocaleTable = yield _this5.buildLikelyLocaleTable();\n\n if (_this5.likelyLocaleTable[lang]) return _this5.likelyLocaleTable[lang];\n _this5.fallbackLocaleTable = _this5.fallbackLocaleTable || require('./fallback-locales');\n\n return _this5.fallbackLocaleTable[lang];\n })();\n }", "function mostSpokenLanguages(arr, range) {\n let list = [];\n arr.forEach((countryObj) => {\n let languages = countryObj.languages;\n for (const item of languages) {\n let isAlreadyThere = list.findIndex((i) => i.country == item);\n if (isAlreadyThere == -1) {\n list.push({ country: item, count: 1 });\n } else if (isAlreadyThere >= 0) {\n list[isAlreadyThere].count++;\n }\n }\n });\n list.sort((a, b) => {\n if (a.count > b.count) return -1;\n if (a.count < b.count) return 1;\n return;\n });\n let sortList = [];\n list.forEach((item) => {\n sortList.push({ [item.country]: item.count });\n });\n return sortList.slice(0, range);\n}", "function LangMap() {}", "function LangMap() {}", "function list_transcribe(){\n\t\tfor(element in input.list){\n\t\t\tindex = 0\n\t\t\twhile(input.list[element] != alphabet[index]){\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tinput.transcribedsingle.push(index);\n\t\t}\n}", "function changeLanguage(currentLang) {\n state.currentLang = currentLang;\n setTabToContent();\n\n // replace brackets with hidden span tags and store lang tags in state\n function replaceLanguageLabels() {\n const languageLabels = $('ul[class=\"objects\"]').find('label:contains(\" [\")');\n if (languageLabels.length) {\n // if state is undefined, set the language labels in state\n if (typeof state.languageLabels === 'undefined') {\n state.languageLabels = languageLabels;\n } else {\n for (let label in languageLabels) {\n state.languageLabels.push(languageLabels[label]);\n }\n }\n // replace brackets with hidden span tags\n languageLabels.each(function() {\n this.innerHTML = this.innerHTML.replace(\n '[',\n \" <span style='display:none;'>\",\n );\n this.innerHTML = this.innerHTML.replace(']', '</span>');\n });\n }\n }\n replaceLanguageLabels();\n\n // TODO: refactor into a function, evaluate performance\n let labelList = state.languageLabels;\n for (let label of labelList) {\n if (label.querySelector) {\n let languageTag = label.querySelector('span').innerText;\n // 'rah-static rah-static--height-auto c-sf-block__content' is the classList associated with\n // react-streamfields. If the element is not in the streamfield div, then we need to access\n // its grandparent and hide that. If it is in the streamfield div, we hide its parent.\n // if the classlist changes, or other fields are nested in different ways, there is the\n // potential for regressions\n if (\n label.parentElement.parentElement.parentElement.classList\n .value !== 'rah-static rah-static--height-auto c-sf-block__content'\n ) {\n const translatedElement = label.parentElement.parentElement;\n if (languageTag != null && languageTag != currentLang) {\n translatedElement.classList.add('hidden');\n } else {\n translatedElement.classList.remove('hidden');\n }\n /*\n While the first condition checks for 'struct-blocks' with language tags,\n it doesn't catch the case where there are 'struct-blocks' with language\n tags WITHIN the element itself. The following condition checks for those conditions.\n - This is not currently being used for streamfields, but could be used again\n if we decide to hide different fields */\n// if (translatedElement.classList.contains('struct-block')) {\n// const fieldlabels = translatedElement.querySelectorAll('[for]');\n// fieldlabels.forEach(fieldlabel => {\n// const attrFor = fieldlabel.getAttribute('for').split('_');\n// fieldlabel.parentNode.classList.remove('hidden');\n// // Adding a failsafe to make sure we don't remove non translated fields\n// const attrLang = attrFor[attrFor.length - 1];\n// if (['en', 'es', 'vi', 'ar'].includes(attrLang)) {\n// if (attrLang !== currentLang) {\n// fieldlabel.parentNode.classList.add('hidden');\n// translatedElement.classList.remove('hidden'); // only re-reveal the parent class if we find this case.\n// }\n// }\n// });\n// }\n } else {\n const translatedElement = label.parentElement;\n if (languageTag != null && languageTag != currentLang) {\n translatedElement.classList.add('hidden');\n } else {\n translatedElement.classList.remove('hidden');\n }\n }\n }\n }\n\n // ----\n // Switch the language for janisPreviewUrl in state\n // ----\n const janisPreviewUrl = getPreviewUrl(currentLang);\n state.janisPreviewUrl = janisPreviewUrl;\n\n const mobilePreviewSidebarButton = $('#mobile-preview-sidebar-button');\n const sharePreviewUrl = $('#share-preview-url');\n\n // Update link for \"Mobile Preview\" button on sidebar\n mobilePreviewSidebarButton.attr('href', janisPreviewUrl);\n sharePreviewUrl.text(janisPreviewUrl);\n\n // force reload of Mobile Preview iframe if its already open\n if (\n _.includes(\n mobilePreviewSidebarButton[0].classList,\n 'coa-sidebar-button--active',\n )\n ) {\n $('#mobile-preview-iframe').attr('src', janisPreviewUrl);\n }\n }", "function isSameLanguage(list) {\n return list.every(l => l.language === list[0].language)\n\n}", "function checkLanguage(value) {\n //Remove the language from the select to prevent duplicates\n var select = document.getElementById(\"language\");\n select.options[select.selectedIndex] = null;\n\n //Locate the outer container for adding\n var container = document.getElementById(\"languageContainer\");\n\n //Create a container for each new language\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 = \"language[]\";\n nameInput.value = value;\n\n //Create a new select for selecting expertise for each language\n var expertiseInput = document.createElement(\"select\");\n expertiseInput.classList.add(\"ib\");\n expertiseInput.classList.add(\"nudgeUp\");\n expertiseInput.name = \"languageExpertise[]\";\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 language\n var button = document.createElement(\"button\");\n button.id = \"b\"+value;\n button.name = value;\n button.setAttribute(\"onclick\", \"removeLanguage(this.name)\");\n button.classList.add(\"button\");\n button.classList.add(\"nudgeUp\");\n button.classList.add(\"fieldButton\");\n button.innerHTML = 'Remove Language';\n\n //Add all inputs to inner container and append it to outer container\n p.append(nameInput);\n p.appendChild(document.createTextNode(value + \": \"));\n p.appendChild(expertiseInput);\n p.appendChild(button);\n container.appendChild(p);\n}", "function replaceLanguageLabels() {\n const languageLabels = $('ul[class=\"objects\"]').find('label:contains(\" [\")');\n if (languageLabels.length) {\n // if state is undefined, set the language labels in state\n if (typeof state.languageLabels === 'undefined') {\n state.languageLabels = languageLabels;\n } else {\n for (let label in languageLabels) {\n state.languageLabels.push(languageLabels[label]);\n }\n }\n // replace brackets with hidden span tags\n languageLabels.each(function() {\n this.innerHTML = this.innerHTML.replace(\n '[',\n \" <span style='display:none;'>\",\n );\n this.innerHTML = this.innerHTML.replace(']', '</span>');\n });\n }\n }", "toLanguageString(languages, countryName) {\n let langStr = `People in ${countryName} speak `;\n if (languages.length === 1) {\n langStr += `${languages[0].name}.`;\n } else if(languages.length === 2) {\n langStr += `${languages[0].name} and ${languages[1].name}.`;\n } else if(languages.length > 2) {\n for(let i = 0; i < languages.length; i++) {\n if (i === languages.length - 1) {\n langStr += ` and ${languages[i].name}.`;\n } else if (i < languages.length - 1){\n langStr += `${languages[i].name}, `;\n }\n }\n } \n return langStr;\n }", "function translateAllButtonClicked() {\n var translateAllId = ((currentPage - 1) * elementsPerPage) + 1;\n var languages = document.getElementById(\"LanguageSelection\");\n var languageCode = languages.options[languages.selectedIndex].value;\n translateAPI = new TextTranslator(token_config['Yandex']);\n if (languageCode === \"\") {\n window.alert(\"First select language to translate.\");\n\n } else {\n for (translateAllId; translateAllId < rowCounter + 1; translateAllId++) {\n var description = document.getElementById(translateAllId).getElementsByTagName(\"td\")[2].innerHTML;\n if (description == null) {\n description = \"-\";\n }\n translateAPI.translateText(description, languageCode, translateAllId, translatedText);\n\n }\n }\n}", "function listLanguages() {\n return high.listLanguages()\n}", "function fillLanguage(){\n if (jQuery.inArray(streamInfo['language'], language) == -1) {\n //if the element is not in the array\n language.push(streamInfo['language']);\n switch (streamInfo['language']) {\n case 'en':\n lng = \"ENGLISH\"; break;\n case 'de':\n lng = \"GERMAN\"; break;\n case 'hr':\n lng = \"CROATIAN\"; break;\n case 'it':\n lng = \"ITALIAN\"; break;\n case 'fr':\n lng = \"FRENCH\"; break;\n case 'ru':\n lng = \"RUSSIAN\"; break;\n case 'pl':\n lng = \"POLISH\"; break;\n case 'es':\n lng = \"SPANISH\"; break;\n case 'tr':\n lng = \"TURKISH\"; break;\n case 'nl':\n lng = \"NETHERLANDS\"; break;\n case 'pt':\n lng = \"PORTUGUESE\"; break;\n case 'pt-br':\n lng = \"PORTUGUESE (BRAZIL)\";break;\n case 'zh-tw':\n lng = \"CHINESE (TAIWAN)\"; break;\n default:\n lng = streamInfo['language'].toUpperCase(); break;\n }\n $('#selectLanguage').append(\n '<li><label for=\\\"' + lng + '\\\">' + lng + '</label><input data-language=\"'+ streamInfo['language'] +'\" type=\\\"checkbox\\\" name=\\\"language[]\\\" id=\\\"' + lng + '\\\" value=\\\"' + streamInfo['language'] + '\\\"/></li>'\n );\n }\n }", "function pickWords()\n{\n\tfor (var i = 0; i < textNodes.length; i++)\n\t{\n\t\t// splits string into array of word strings\n\t\tvar stringArray = textNodes[i].split(\" \");\n\n\t\tvar j = Math.floor(Math.random() * 15) + 2;\n\t\twhile (j < stringArray.length)\n\t\t{\n\t\t\t// TODO: make translation snippets randomly varied in word length, don't cut across sentences\n\t\t\t// \t\t at some point, make snippets logical phrases for better translation\n\t\t\t// \t\t (e.g. \"and then he said\" instead of \"cat and then\")\n\t\t\tvar phraseToTranslate = stringArray[j] + \" \" + stringArray[j+1] + \" \" + stringArray[j+2];\n\t\t\tif (validate(phraseToTranslate))\n\t\t\t{\n\t\t\t\tvar item = {\n\t\t\t\t\tuntranslated : phraseToTranslate,\n\t\t\t\t\ttranslated : \"\"\n\t\t\t\t};\n\n\t\t\t\tjsonObject.phraseArray.push(item);\n\t\t\t}\n\n\t\t\tj += Math.floor(Math.random() * 90) + 80;\n\t\t}\n\t}\n\n\tvar arrLength = jsonObject.phraseArray.length.toString();\n\tchrome.runtime.sendMessage({ type: \"setBadge\", badgeText : arrLength });\n\n\tloadLangs();\n}", "function changeLang(){\n\n //Changing language\n let langToChange = document.getElementsByClassName(\"langToChange\");\n let previousLang = langToChange[0].getAttribute(\"lang\");\n let lang;\n previousLang === \"es\" ? lang = \"en\" : lang = \"es\";\n\n //Set language selection in localStorage\n if (typeof(Storage) !== \"undefined\") {\n localStorage.setItem(\"lang\", JSON.stringify(lang));\n }\n \n for (i=0; i<langToChange.length; i++){\n langToChange[i].setAttribute(\"lang\", lang)\n }\n\n let zones = document.querySelectorAll('html [lang]');\n applyStrings(zones, lang);\n}", "editLang() {\n if (this.langArr.length === 2) {\n this.langArr.pop();\n return this.langArr;\n }\n }", "function langLinkSelector(languages) {\n\tvar $list = $('#langList').empty();\n\n\t$.each(languages, function(i, lang) {\n\t\t$(\"<div class='listItemContainer'>\" +\n\t\t\t\"<a class='listItem'>\" +\n\t\t\t\"<span class='text'></span>\" +\n\t\t\t\"</a>\" +\n\t\t\t\"</div>\")\n\t\t.find('.text')\n\t\t\t.text(lang.name)\n\t\t\t.end()\n\t\t.find('a')\n\t\t\t.click(function() {\n\t\t\t\tnavigateToPage(lang.url);\n\t\t\t\thideOverlays();\n\t\t\t})\n\t\t\t.end()\n\t\t.appendTo($list);\n\t});\n}", "buildLikelyLocaleTable() {\n var _this8 = this;\n\n return _asyncToGenerator(function* () {\n let localeList = [];\n\n if (process.platform === 'linux') {\n let locales = yield (0, _spawnRx.spawn)('locale', ['-a']).catch(function () {\n return _Observable.Observable.of(null);\n }).reduce(function (acc, x) {\n acc.push(...x.split('\\n'));return acc;\n }, []).toPromise();\n\n d(`Raw Locale list: ${JSON.stringify(locales)}`);\n\n localeList = locales.reduce(function (acc, x) {\n let m = x.match(validLangCodeWindowsLinux);\n if (!m) return acc;\n\n acc.push(m[0]);\n return acc;\n }, []);\n }\n\n if (process.platform === 'win32') {\n localeList = require('keyboard-layout').getInstalledKeyboardLanguages();\n }\n\n if (isMac) {\n fallbackLocaleTable = fallbackLocaleTable || require('./fallback-locales');\n\n // NB: OS X will return lists that are half just a language, half\n // language + locale, like ['en', 'pt_BR', 'ko']\n localeList = _this8.currentSpellchecker.getAvailableDictionaries().map(function (x) {\n if (x.length === 2) return fallbackLocaleTable[x];\n return (0, _utility.normalizeLanguageCode)(x);\n });\n }\n\n d(`Filtered Locale list: ${JSON.stringify(localeList)}`);\n\n // Some distros like Ubuntu make locale -a useless by dumping\n // every possible locale for the language into the list :-/\n let counts = localeList.reduce(function (acc, x) {\n let k = x.split(/[-_\\.]/)[0];\n acc[k] = acc[k] || [];\n acc[k].push(x);\n\n return acc;\n }, {});\n\n d(`Counts: ${JSON.stringify(counts)}`);\n\n let ret = Object.keys(counts).reduce(function (acc, x) {\n if (counts[x].length > 1) return acc;\n\n d(`Setting ${x}`);\n acc[x] = (0, _utility.normalizeLanguageCode)(counts[x][0]);\n\n return acc;\n }, {});\n\n // NB: LANG has a Special Place In Our Hearts\n if (process.platform === 'linux' && process.env.LANG) {\n let m = process.env.LANG.match(validLangCodeWindowsLinux);\n if (!m) return ret;\n\n ret[m[0].split(/[-_\\.]/)[0]] = (0, _utility.normalizeLanguageCode)(m[0]);\n }\n\n d(`Result: ${JSON.stringify(ret)}`);\n return ret;\n })();\n }", "function convertOneToNine (n, lang) {\t\n var oneToNine = {\n\t0:'',\n 1: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'one',\n\t\t\t1: 'un',\n\t\t\t2: 'uno'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n 2: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'two',\n\t\t\t1: 'deux',\n\t\t\t2: 'dos'\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n 3: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'three',\n\t\t\t1: 'trois',\n\t\t\t2: 'tres'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n\t4: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'four',\n\t\t\t1: 'quatre',\n\t\t\t2: 'cuatro'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n\t5: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'five',\n\t\t\t1: 'cinq',\n\t\t\t2: 'cinco'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n\t6: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'six',\n\t\t\t1: 'six',\n\t\t\t2: 'seis'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n\t7: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'seven',\n\t\t\t1: 'sept',\n\t\t\t2: 'siete'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n\t8: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'eight',\n\t\t\t1: 'huit',\n\t\t\t2: 'ocho'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n },\n\t9: function (){\t\t\n\t\tvar language = {\n\t\t\t0: 'nine',\n\t\t\t1: 'neuf',\n\t\t\t2: 'nueve'\t\t\t\t\t\t\n\t\t};\t\t\n\t\treturn language[lang];\t\t\t\n }\n };\n return ' ' + oneToNine[n]();\n}", "function getEnglishCourses(courses){\n\t// let engCourses = []\n\t// courses.forEach(course => {\n\t// \tif (course.languages.indexOf(\"en\") != -1){\n\t// \t\tengCourses.push(course)\n\t// \t}\n\t// })\n\t//Shorthand version\n\tlet engCourses = courses.filter(course => course.languages.includes(\"en\"))\n\tconsole.log(\"engCourses\", engCourses)\n\treturn engCourses\n}", "initializeLanguage(languages) {\n for(var k in languages) {\n let opt = Utility.createNode('option', { \n value: k, innerHTML: languages[k]\n });\n $('#select-language').append(opt);\n }\n /*Translate.google_translate_support_lang().then(data => {\n const langs = data.data.languages;\n langs.forEach(e => {\n let opt = Utility.createNode('option');\n opt.value = e.language;\n opt.innerHTML = e.name;\n $('#select-language').append(opt);\n });\n $('#select-language').selectpicker('refresh');\n $('#select-language').selectpicker('val', 'en');\n });*/\n }", "function myLanguages(results) {\n const array = [];\n for (let i = 0, num = Object.keys(results).length; i < num; i++) {\n array.push([Object.keys(results)[i], results[Object.keys(results)[i]]]);\n }\n const sorted = array.sort(function (a, b) {\n return b[1] - a[1];\n });\n return sorted.filter(a => a[1] >= 60).map(l => l[0]);\n}", "function displayLanguages(langs) {\n if(langs instanceof Array){\n langs.forEach(function (lang){\n if(lang !== 'default'){\n var selectLanguages = document.getElementById('languages'),\n option = document.createElement('option');\n\n option.value = lang;\n option.text = lang;\n selectLanguages.appendChild(option);\n }\n });\n } else {\n console.error('must be an array of languages to build out list');\n }\n\n }", "handleLangChange() {\n let newLan = (getLanguage(this.props.user) + 1) % clientConfig.languages.length;\n this.props.changeLanguageLocal(newLan);\n }", "function updateIdenticals(lang, selectComponent){\n\n if(selectComponent.value == \"\"){\n showToast(\"Something went wrong.\", \"R\");\n return;\n }\n\n switch(lang) {\n case \"German\":\n appendToIgnores(\"De\", selectComponent.value);\n break;\n case \"Italian\":\n appendToIgnores(\"It\", selectComponent.value);\n break;\n case \"French\":\n appendToIgnores(\"Fr\", selectComponent.value);\n break;\n case \"All\":\n appendToIgnores(\"All\", selectComponent.value);\n break;\n default:\n showToast(\"Something went wrong\", \"R\");\n break;\n }\n delete currMissing[selectComponent.value];\n selectComponent.options[selectComponent.selectedIndex].remove();\n checkCompleted(selectComponent);\n}", "userLanguages(username) {\n return this.repositories(username)\n .then(repos => Promise.all(repos.map(repo => this.languages(repo.full_name))));\n }", "function buildWordList (num) { //Uses recursion. \n\t\t\t\treturn num === 0 ? [] :\n\t\t\t\t\tbuildWordList(--num).concat(getLibraryWord());\n\t\t\t}", "function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string';\n var subvalue;\n\n /* istanbul ignore if - support non-loaded sublanguages */\n if (explicit && !languages[top.subLanguage]) {\n return addText(modeBuffer, []);\n }\n\n if (explicit) {\n subvalue = coreHighlight(\n top.subLanguage,\n modeBuffer,\n true,\n prefix,\n continuations[top.subLanguage]\n );\n } else {\n subvalue = autoHighlight(modeBuffer, {\n subset: top.subLanguage.length ? top.subLanguage : undefined,\n prefix: prefix\n });\n }\n\n /* Counting embedded language score towards the\n * host language may be disabled with zeroing the\n * containing mode relevance. Usecase in point is\n * Markdown that allows XML everywhere and makes\n * every XML snippet to have a much larger Markdown\n * score. */\n if (top.relevance > 0) {\n relevance += subvalue.relevance;\n }\n\n if (explicit) {\n continuations[top.subLanguage] = subvalue.top;\n }\n\n return [build(subvalue.language, subvalue.value, true)];\n }", "function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string'\n var subvalue\n\n /* istanbul ignore if - support non-loaded sublanguages */\n if (explicit && !languages[top.subLanguage]) {\n return addText(modeBuffer, [])\n }\n\n if (explicit) {\n subvalue = coreHighlight(\n top.subLanguage,\n modeBuffer,\n true,\n prefix,\n continuations[top.subLanguage]\n )\n } else {\n subvalue = autoHighlight(modeBuffer, {\n subset: top.subLanguage.length === 0 ? undefined : top.subLanguage,\n prefix: prefix\n })\n }\n\n // If we couldn’t highlight, for example because the requests subset isn’t\n // loaded, return a text node.\n if (!subvalue.language) {\n return [buildText(modeBuffer)]\n }\n\n // Counting embedded language score towards the host language may be\n // disabled with zeroing the containing mode relevance.\n // Usecase in point is Markdown that allows XML everywhere and makes every\n // XML snippet to have a much larger Markdown score.\n if (top.relevance > 0) {\n relevance += subvalue.relevance\n }\n\n if (explicit) {\n continuations[top.subLanguage] = subvalue.top\n }\n\n return [build(subvalue.language, subvalue.value, true)]\n }", "function mostUsed (){ \n\n //Set highest at 0 to comapre number values of each property value\n let highest = 0;\n \n //Begin building the html elements to be inserted \n let mostUsedStatus = '<ul>';\n for(const property in textArray) {\n if(textArray[property] > highest){\n highest = property;\n } \n }\n //Finish building the HTML with opening and closing tags, then targeting the element to insert\n mostUsedStatus += '<li>';\n mostUsedStatus += highest;\n mostUsedStatus += '</li>';\n mostUsedStatus += '</ul>';\n document.getElementById(\"mostUsed\").innerHTML = mostUsedStatus;\n }", "countryLanguages(countryName) {\n // Select the correct samples of users for the requested country\n let countryUsers = [];\n switch (countryName) {\n case 'afrique':\n countryUsers = samples.AFRICA;\n break;\n case 'bresil':\n countryUsers = samples.BRAZIL;\n break;\n case 'chine':\n countryUsers = samples.CHINA;\n break;\n case 'inde':\n countryUsers = samples.INDIA;\n break;\n case 'japon':\n countryUsers = samples.JAPAN;\n break;\n case 'russie':\n countryUsers = samples.RUSSIA;\n break;\n case 'suisse':\n countryUsers = samples.SUISSE;\n break;\n case 'suede':\n countryUsers = samples.SWEDEN;\n break;\n case 'usa':\n countryUsers = samples.USA;\n break;\n case 'heig':\n countryUsers = samples.HEIG;\n break;\n default:\n throw new Error('this country don\\'t exists or isn\\'t supported');\n }\n // Create a promise that will do the job\n return Promise.all(countryUsers.map(user => this.userLanguages(user)\n .then(datas => functions.agregateLanguages(datas))))\n .then(datas => functions.agregateLanguages(datas));\n }", "handleRemoveLanguage(languageLabel) {\n let tmp = this.state.selectedLanguages;\n if (!tmp.find((x) => x.label === languageLabel)) return;\n const langObj = tmp.find((x) => x.label === languageLabel);\n tmp = tmp.filter((x) => x.label !== languageLabel);\n this.setState({\n selectedLanguages: tmp,\n moreLanguagesBookable: true,\n price: this.state.price - langObj.price,\n });\n }", "_fiterByWordCount() {\n let entitesCopy = [...this.state.entities];\n let filteredArray = [];\n let { pfa, cfa } = this.state;\n if(!pfa && !cfa) {\n filteredArray = entitesCopy;\n } else {\n let secondFilterArray = [];\n entitesCopy.forEach( entrie => {\n let titleLength = entrie.title.split(' ').length;\n if(cfa && titleLength > 5) {\n secondFilterArray.push(entrie);\n } else if(pfa && titleLength <= 5) {\n secondFilterArray.push(entrie);\n }\n });\n filteredArray = this._fiterByPoitsOrComm( cfa, secondFilterArray );\n };\n return filteredArray;\n }", "deleteLangs() {\n return this.langArr = []\n }", "function myLanguages(results) {\n \nlet arr = Object.entries(results).filter(el => el[1] >= 60).sort((a, b) => b[1] - a[1])\n \nlet lang = arr.map(el => el[0])\n \nreturn lang;\n}", "getTranslationsTree(){\n //Debug given texts\n var debugText = [];\n\n //Build translates tree\n for ( var key in this.allTranslates ) {\n var translate = this.domPreparer.prepareTranslateHTML(this.allTranslates[key][0]||key);\n\n /*\n * DEBUG only given texts\n */\n if ( debugText.length > 0 && translate.indexOf(debugText) === -1 ) {\n continue;\n }\n\n if ( translate && translate.indexOf('je fiktívny text') > -1 ){\n console.log(translate)\n }\n\n //We need save duplicate translates\n if ( translate in this.translatedTree ) {\n this.duplicates.push(translate);\n }\n\n this.translatedTree[translate] = key;\n\n if ( translate.length > this.maxTranslateLength ) {\n this.maxTranslateLength = translate.length;\n }\n }\n }", "function chooseWords(pWrapper){\n let x;\n switch (parse(localStorage.level)) {\n case 1:\n x = 2;\n break;\n case 2:\n x = 3;\n break;\n case 3:\n x = 5;\n break;\n }\n \n for (let i = 0; i < x; i++){\n pWrapper.appendChild(window.utils.createEl('p'));\n pWrapper.lastChild.classList.add('word');\n pWrapper.lastChild.textContent = _.sample(_.sample(window.tasks.speechPart));\n } \n return x;\n }", "function getLanguagePriority(language,accepted,index){var priority={o:-1,q:0,s:0};for(var i=0;i<accepted.length;i++){var spec=specify(language,accepted[i],index);if(spec&&(priority.s-spec.s||priority.q-spec.q||priority.o-spec.o)<0){priority=spec;}}return priority;}", "function createLanguageSelector(){\n let languages = getLanguages()\n languages = languages.sort()\n const languageSelector = document.getElementById(\"languageSelector\");\n languageSelector.innerHTML = \"\"\n for (const language of languages) {\n // modified from: https://stackoverflow.com/questions/17730621/how-to-dynamically-add-options-to-an-existing-select-in-vanilla-javascript\n languageSelector.options[languageSelector.options.length] = new Option(language, language)\n }\n $(languageSelector).on('change', filteredByLanguage)\n // create a multiselector\n // modified from: https://materializecss.com/select.html\n var elems = document.querySelectorAll('#languageSelector');\n var instances = M.FormSelect.init(elems, {});\n\n // modified from: https://codepen.io/souvik1809/pen/rvNMyO?fbclid=IwAR3lxAlSq8wmShlAta5N2EKgEc02e3r9txS_YzoE2XJrp0X2w5VC6zKatZQ\n const selectAll = $('<li><span>Select All</span></li>');\n $('#languageSelector').siblings('ul').prepend(selectAll);\n selectAll.on('click', function () {\n supressLanguageFilter = true\n var jq_elem = $(this),\n jq_elem_span = jq_elem.find('span'),\n select_all = jq_elem_span.text() === 'Select All',\n set_text = select_all ? 'Select None' : 'Select All';\n jq_elem_span.text(set_text);\n jq_elem.siblings('li').filter(function() {\n return $(this).find('input').prop('checked') !== select_all;\n }).click();\n supressLanguageFilter = false;\n filteredByLanguage()\n });\n\n}", "function languageChain ( languages ) {\n var pairs = [], i = 0;\n while ( i < languages.length-1 ) pairs.push({ from: languages[i], \n to: languages[++i] });\n return pairs;\n}", "loadDictionaryForLanguageWithAlternatives(langCode) {\n var _this4 = this;\n\n let cacheOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n return _asyncToGenerator(function* () {\n _this4.fallbackLocaleTable = _this4.fallbackLocaleTable || require('./fallback-locales');\n let lang = langCode.split(/[-_]/)[0];\n\n let alternatives = [langCode, yield _this4.getLikelyLocaleForLanguage(lang), _this4.fallbackLocaleTable[lang]];\n if (langCode in alternatesTable) {\n try {\n return {\n language: alternatesTable[langCode],\n dictionary: yield _this4.dictionarySync.loadDictionaryForLanguage(alternatesTable[langCode])\n };\n } catch (e) {\n d(`Failed to load language ${langCode}, altTable=${alternatesTable[langCode]}`);\n delete alternatesTable[langCode];\n }\n }\n\n d(`Requesting to load ${langCode}, alternatives are ${JSON.stringify(alternatives)}`);\n return yield _Observable.Observable.of(...alternatives).concatMap(function (l) {\n return _Observable.Observable.defer(function () {\n return _Observable.Observable.fromPromise(_this4.dictionarySync.loadDictionaryForLanguage(l, cacheOnly));\n }).map(function (d) {\n return { language: l, dictionary: d };\n }).do(function (_ref4) {\n let language = _ref4.language;\n\n alternatesTable[langCode] = language;\n }).catch(function () {\n return _Observable.Observable.of(null);\n });\n }).concat(_Observable.Observable.of({ language: langCode, dictionary: null })).filter(function (x) {\n return x !== null;\n }).take(1).toPromise();\n })();\n }", "function FrEnWordSelector(wordsToSelect, shuffle) {\n let wordCounter = 0;\n let preparedWords = []; // array of objects\n\n // main loop\n while (wordCounter < wordsToSelect.words.length) {\n let articleForm;\n let formDetails;\n const word = wordsToSelect.words[wordCounter];\n let weakForms = false; // contains the statsByForm of the user for the current word\n if (wordsToSelect.statsByForm) {\n weakForms = wordsToSelect.statsByForm[wordCounter];\n }\n\n // picks randomly the source language and the form the first time it is presented (null or false)\n if (!weakForms) {\n formDetails = pickFormRandomly(word);\n } else {\n formDetails = pickWeakForm(weakForms);\n }\n\n const { sourceForm, sourceLanguage } = formDetails;\n const forms = returnForms(sourceForm, word.type, sourceLanguage);\n const frForm = forms.fr;\n const enForm = forms.en;\n\n // only nouns accept articles, special cases when nouns have only certains articles -> hasUniqueForm = true\n if (word.type === \"noun\" && !word.hasUniqueForm) {\n articleForm = randomPicker([\"definite\", \"indefinite\"]);\n }\n\n const selectedWords = returnSelectedWordsWithArticle(\n sourceLanguage,\n word.fr,\n word.en,\n frForm,\n enForm,\n articleForm,\n word.enName\n );\n preparedWords.push({\n selectedForm: selectedWords.selectedForm,\n fr: selectedWords.fr,\n en: selectedWords.en,\n lesson: word.lesson,\n theme: word.theme\n });\n wordCounter++;\n }\n if (shuffle) {\n preparedWords = shuffleArray(preparedWords);\n }\n return preparedWords;\n}", "languages (state) {\n return [\n { flag: '🇸🇮', tag: 'si' },\n { flag: '🇬🇧', tag: 'en' },\n ].map(language => ({ ...language, isActive: state.language === language.tag }))\n }", "function setLanguage(storage){\n \n let lang;\n storage ? lang = storage: lang = findLocaleMatch();\n\n let langToChange = document.getElementsByClassName(\"langToChange\");\n for (i=0; i<langToChange.length; i++){\n\n langToChange[i].setAttribute(\"lang\", lang)\n \n langToChange[i].classList.add('lang-match');\n }\n\n let zones = document.querySelectorAll('html [lang]');\n applyStrings(zones,lang);\n}", "checkLang() {\n return this.langArr\n }", "function showMoreButtonClicked() {\r\n var languageElemsList = document.evaluate('/html/body/div[4]/div[2]/div[@id=\"p-lang\"]/div/ul', document.body, null, XPathResult.ANY_TYPE, null).iterateNext()\r\n var languageElems = languageElemsList.getElementsByTagName('li');\r\n for (var i = 0; i < languageElems.length; ++i) {\r\n var lang = languageElems[i].children[0].getAttribute('lang')\r\n if (isPreferredLanguage(lang)) {\r\n // do nothing for languages that are already shown\r\n } else {\r\n // show again the ones that were hidden\r\n languageElems[i].style.display = 'inherit'\r\n }\r\n }\r\n // finally hide the 'more'-button\r\n buttonElement.style.display = 'none'\r\n}", "function uniqueWords (){\n let uniqueStatus = '<ul>';\n for(const property in textArray) {\n if(textArray[property] == 1){\n uniqueStatus += '<li>';\n uniqueStatus += property;\n uniqueStatus += '</li>';\n }\n }\n \n //Finish building the HTML with opening and closing tags, then targeting the element to insert\n uniqueStatus += '</ul>';\n document.getElementById(\"unique\").innerHTML = uniqueStatus;\n }", "function cleanTranslations(data) {\r\n var translation = \"\";\r\n var sliceIndex;\r\n\tif(data.translate){\r\n\t\tfor (var i = 0; i < data.translate.length; i++) {\r\n\r\n\t\t\t//translation += \",\" + data.translate[i].value.replaceAll(/[A-Za-z]/, \"\").trim();\r\n\t\t\ttranslation += \",\" + data.translate[i].value.replaceAll(/[^А-Яа-я\\,\\s]/, \"\").trim();\r\n\r\n\t\t}\r\n\t} else {\r\n\t\ttranslation = data.translation.toString().replaceAll(/[^А-Яа-я\\,\\s]/, \"\").trim();;\r\n\t}\r\n\t\r\n var translations = translation.split(\",\");\r\n\r\n var uniqueTranslations = [];\r\n $.each(translations, function(i, el) {\r\n if ($.inArray(el.trim(), uniqueTranslations) === -1) uniqueTranslations.push(el.trim());\r\n });\r\n\r\n uniqueTranslations.clean(\"\");\r\n\r\n // uniqueTranslations.sort(function(a, b) {\r\n // return b.length - a.length;\r\n // });\r\n\r\n uniqueTranslations.sort(function(a, b) {\r\n return a.length - b.length;\r\n });\r\n\r\n for (var b = 0; b < uniqueTranslations.length; b++) {\r\n var stringLength = uniqueTranslations.slice(0, b).toString().length;\r\n\r\n if (stringLength > 60) {\r\n break;\r\n }\r\n\r\n sliceIndex = b+1;\r\n }\r\n\r\n uniqueTranslations = uniqueTranslations.slice(0, sliceIndex);\r\n return uniqueTranslations;\r\n}", "function validate() {\n const missingKeys = new Map();\n for (const lang of [\"de\", \"en\", \"fr\"]) {\n const missingKeySet = new Set();\n missingKeys.set(lang, missingKeySet);\n\n function checkForMissingValues(currentPath, obj) {\n if (obj === NOT_TRANSLATED) {\n missingKeySet.add(currentPath.join(\".\"));\n } else if (typeof obj === \"object\") {\n Object.entries(obj).forEach(([key, value]) => checkForMissingValues([...currentPath, key], value));\n }\n }\n\n const langFileContent = getFileJSON(`src/locales/generated/${lang}.json`);\n checkForMissingValues([], langFileContent);\n }\n const languagesWithMissingKeys = [...missingKeys].filter(([lang, missingKeys]) => missingKeys.size > 0);\n if (languagesWithMissingKeys.length > 0) {\n console.warn(\"Missing translations found!\");\n for (const [lang, missingKeys] of languagesWithMissingKeys) {\n console.warn(\n `For language '${lang}' ${missingKeys.size} keys do not have a translation value:\\n - ` +\n [...missingKeys].sort((a, b) => (a < b ? -1 : 1)).join(\"\\n - \")\n );\n }\n process.exit(1);\n }\n}", "function initializeArr(isEnglish) {\n\t\t\tif (isEnglish) {\n\t\t\t\treturn [\n\t\t\t\t\t[\"Catch all the adjectives\"], [\n\t\t\t\t\t\t[\"Happy\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Lucky\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Handsome\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Courageous\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Friendly\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Hilarious\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Mysterious\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Generous\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Energetic\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Gorgeous\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Appear\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Begin\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Rise\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Credit\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Belief\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Recipe\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"Reaction\", \"text\", false, \"\", \"\", 0]\n\t\t\t\t\t]\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\treturn [\n\t\t\t\t\t[\"תפסו את כל מי שכיהן כראש ממשלת מדינת ישראל\"], [\n\t\t\t\t\t\t[\"דוד בן גוריון\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"אהוד אולמרט\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"אריאל שרון\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"מנחם בגין\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"אהוד ברק\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"יצחק שמיר\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"לוי אשכול\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[\"משה שרת\", \"text\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[lib.Golda, \"pic\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[lib.Rabin, \"pic\", true, \"\", \"\", 0],\n\t\t\t\t\t\t[lib.Dayan, \"pic\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[lib.Kochavi, \"pic\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"יאיר לפיד\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"אביגדור ליברמן\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"משה (בוגי) יעלון\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"יעקב דורי\", \"text\", false, \"\", \"\", 0],\n\t\t\t\t\t\t[\"רפאל איתן\", \"text\", false, \"\", \"\", 0]\n\t\t\t\t\t]\n\t\t\t\t];\n\t\t\t}\n\t\t}", "usedPhrases ({start, end}) {\n const filterRow = row => row.date >= start && row.date < end\n const phrases = new Set()\n // load all the unique phrases\n for (let n = 1; n <= this.options.maxN; n++) {\n this.ngrams[n].filter(filterRow).forEach(row => {\n phrases.add(row.ngram)\n })\n }\n return [...phrases]\n }", "function FormatLanguages(information) {\r\n var result = \"<p> Languages: \";\r\n for (var i = 0; i < information.languages.length; i++) {\r\n result += information.languages[i].name;\r\n if (i + 1 < information.languages.length)\r\n result += \", \";\r\n }\r\n result += \"</p>\";\r\n return result;\r\n}", "function longestWord(uniqueWords) {\n let longest = 0; // integer, storing the length of longest word so far\n let index = []; // array of integers, storing the indexes of the longest words so far\n // usually contains one index, but when two words have the same length, then it will store both indexes\n let letters; // integer, storing the length of the word being processed\n\n for (let x = 0; x < uniqueWords.length; x++) {\n letters = uniqueWords[x].length;\n if (letters > longest) { // if there is so far longest word, store it in index\n longest = letters; // update the current highest length\n index = []; // make sure there won't be any old indexes with shorter words\n index[0] = x; // assign the index\n } else if (letters == longest) { // if there is other longest word, also store it\n index.push(x);\n }\n }\n\n // if there is more than one longest word, change the grammar from \"word\" to \"words\"\n if (index.length > 1) {\n $(\"#word\").html(\"Longest words: \");\n }\n\n // loop to print out the list of the longest word(s)\n for (let y = 0; y < index.length; y++) {\n $(\"#longest\").append(uniqueWords[index[y]]);\n if (y != index.length - 1) {\n $(\"#longest\").append(\", \"); // include commas between all the words (but not after the last one)\n }\n }\n // print out the length of longest word(s)\n $(\"#longest\").append(\" (\" + longest + \" letters)\");\n}", "function callLanguages(){\n\n if (localStorage.getItem(\"language\"))\n\n localStorage.getItem(\"language\") == 2 ? language_file = 'json/pt.json' : language_file = 'json/en.json'\n\n else \n\n language_file = 'json/en.json'\n\n $.getJSON(language_file, function(json){\n \n localStorage.setItem(\"json\", JSON.stringify(json))\n \n setLanguage()\n \n })\n}", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }", "function unloadLang(key) {\n delete languages[key];\n }" ]
[ "0.6152354", "0.59042716", "0.57948375", "0.56115246", "0.55984294", "0.5559476", "0.5559476", "0.5559091", "0.5480814", "0.5477001", "0.54756427", "0.5472458", "0.5441969", "0.5435204", "0.5430011", "0.5423498", "0.54228973", "0.54136986", "0.53981185", "0.53883815", "0.53777266", "0.5299661", "0.52772784", "0.5272679", "0.5263164", "0.5251963", "0.5226495", "0.522301", "0.5219644", "0.5170655", "0.51695335", "0.5169476", "0.5149158", "0.5134275", "0.51262707", "0.5125176", "0.5115548", "0.5110975", "0.51075685", "0.51075685", "0.50912416", "0.508761", "0.5072107", "0.50638014", "0.5042374", "0.50421274", "0.50332797", "0.5030553", "0.5016767", "0.50077975", "0.5006095", "0.49958038", "0.49828765", "0.4974339", "0.49633163", "0.49527735", "0.49509296", "0.49493372", "0.49468175", "0.49316624", "0.49149883", "0.48973587", "0.48944005", "0.48933798", "0.4892697", "0.4892219", "0.48910597", "0.488953", "0.48867053", "0.4883863", "0.4879968", "0.4878495", "0.4874453", "0.48744383", "0.48649988", "0.48619232", "0.48619044", "0.48545292", "0.48515105", "0.48415643", "0.48402387", "0.48315698", "0.48292875", "0.48270196", "0.48236498", "0.48234197", "0.48145384", "0.48044488", "0.4801455", "0.47993416", "0.47942832", "0.47942832", "0.47942832", "0.47942832", "0.47942832", "0.47942832", "0.47942832", "0.47942832", "0.47942832", "0.47942832" ]
0.5534149
8
by removing some characters from it. Example: / for s = 'ceoydefthf5h5yts and t= ' codefights' the output should be true
function convertString(s, t) { let word = ""; let tIndex = 0; const sChars = s.split(" "); for (let i = 0; i < s.length; i++) { if (s[i] === t[tIndex]) { word = word.concat(s[i]); tIndex++; if (word === t) { return true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeSpecial(s) {\n return s.replace(/[^a-z0-9]/ig, '');\n }", "function isnotSpecial(str){\nstringSpecialCheck=\"!#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\"+\"\\'\";\nf4=1;\nfor(j=0;j<str.length;j++)\n{if(stringSpecialCheck.indexOf(str.charAt(j))!=-1)\n{f4=0;}}\nif(f4==0)\n{return true;}else{return false;}\n}", "function pure(s){\n var chars = \"012345678|-()\"\n for (var i = 0; i < s.length; i++){\n if (!chars.includes(s[i])){\n return false\n }\n }\n return true;\n}", "function remove(s){\n return s.replace(/!+$/, '');\n}", "function removeChar(string, chars) {\n let output = '';\n for (let i = 0; i < string.length; i++) {\n let contained = true;\n for (let j = 0; j < chars.length; j++) {\n if (string[i] === chars[j]) {\n contained = false;\n }\n }\n if (contained) {\n output += string[i];\n }\n }\n return output;\n}", "function isnotSpecial(str){\n\tstringSpecialCheck=\"!#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\";\n\n\n\n\n\n\n\n\tf4=1;\n\tfor(j=0;j<str.length;j++){\n\t\tif(stringSpecialCheck.indexOf(str.charAt(j))!=-1){\n\t\t\tf4=0;\n\t\t}\n\t}\n\tif(f4==0){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n}", "function palindrome(str) {\n // Remove Spaces and non-alphabetical characters\n var removed = str.replace(/[\\s\\W_]/gi,\"\").toLowerCase()\n console.log(removed)\n // Check if its the equalivent of the reversed version \n return removed == removed.split(\"\").reverse().join(\"\")\n }", "function stripCharsInBag (s, bag)\n{ var i;\n var returnString = \"\";\n\n // Buscar por el string, si el caracter no esta en \"bag\",\n // agregarlo a returnString\n\n for (i = 0; i < s.length; i++)\n { var c = s.charAt(i);\n if (bag.indexOf(c) == -1) returnString += c;\n }\n return returnString;\n}", "function filterSpace(test){\n\treturn test != \"\";\n}", "function removeExclamationMarks(s) {\n\treturn s.replace(/[^\\w\\s]/gi, '');\n}", "function HayApostrofe(s)\n{\n var i;\n for (i = 0; i < s.length; i++)\n {\n var c = s.charAt(i);\n if (c==\"'\")\n return true;\n }\n return false;\n}", "function removeChar(test){\r\n let newChars = test.slice(1,-1);\r\n return newChars;\r\n }", "function removeCharacters(str){\n let newStr = '';\n newStr = str.replace(/a|e|i|o|u/gi, '');\n console.log(newStr)\n}", "function stripCharsNotInBag (s, bag){ \n\tvar i;\n var returnString = \"\";\n\n // Search through string's characters one by one.\n // If character is in bag, append to returnString.\n for (i = 0; i < s.length; i++) { \n // Check that current character isn't whitespace.\n var c = s.charAt(i);\n if (bag.indexOf(c) != -1) returnString += c;\n }\n\n return returnString;\n}", "function remove(s) {\n var sSplit = s.split(' ');\n var output = [];\n for (var i=0; i<sSplit.length; i++) {\n var temp = '';\n for (var a=0; a<sSplit[i].length; a++) {\n if (sSplit[i][a] !== '!') {\n temp = temp + sSplit[i][a];\n }\n }\n output.push(temp);\n }\n return output.join(' ') + '!';\n}", "function removeExclamationMarks(s) {\n let noExclamations = \"\";\n\n for (let ch of s) {\n if (ch !== \"!\") {\n noExclamations += ch\n }\n }\n return noExclamations\n}", "function reomveChar(str){\n let result = ''\n for(let i = 0; i < str.length; i++){\n if (str[i] !== 'a' && str[i] !== 'e' && str[i] !== 'i' && str[i] !== 'o' && str[i] !== 'u' ){\n\n result += str[i]\n }\n }\n return result;\n}", "function sanitize(string) {\n return string.replace(/[&<>]/g, '');\n }", "function isnotAlpha(str){\nstringCheck=\"!@#$%^&*()_+|<>?/=-~.,`0123456789;:][{}\"+\"\\\\\"+\"\\'\";\nf1=1;\nfor(j=0;j<str.length;j++)\n{ if(stringCheck.indexOf(str.charAt(j))!=-1)\n { f1=0;}}\nif(f1==0)\n{ return true; }else {return false;}\n}", "function isnotAlpha(str){\nstringCheck=\"!@#$%^&*()_+|<>?/=-~.,`0123456789;:][{}\"+\"\\\\\"+\"\\'\";\nf1=1;\nfor(j=0;j<str.length;j++)\n{ if(stringCheck.indexOf(str.charAt(j))!=-1)\n { f1=0;}}\nif(f1==0)\n{ return true; }else {return false;}\n}", "function disemvowel(str){\n let vowels = /[aeiou]/gi\n let noVowels = str.replace(vowels, '')\n return noVowels\n}", "function stripCharsInBag (s, bag) { \n\tvar i;\n var returnString = \"\";\n\n // Search through string's characters one by one.\n // If character is not in bag, append to returnString.\n for (i = 0; i < s.length; i++) { \n // Check that current character isn't whitespace.\n var c = s.charAt(i);\n if (bag.indexOf(c) == -1) {\n \treturnString += c;\n }\n }\n\n return returnString;\n}", "function stripCharsNotInBag (s, bag) {\r\n\tvar i;\r\n var returnString = \"\";\r\n\r\n // Search through string's characters one by one.\r\n // If character is in bag, append to returnString.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character isn't whitespace.\r\n var c = s.charAt(i);\r\n if (bag.indexOf(c) !== -1) returnString += c;\r\n }\r\n return returnString;\r\n}", "function stripCharsInBag (s, bag) {\r\n\tvar i;\r\n var returnString = \"\";\r\n\r\n // Search through string's characters one by one.\r\n // If character is not in bag, append to returnString.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character isn't whitespace.\r\n var c = s.charAt(i);\r\n if (bag.indexOf(c) === -1) returnString += c;\r\n }\r\n return returnString;\r\n} //stripCharsInBag", "function stripCharsNotInBag (s, bag)\r\n\r\n{ var i;\r\n var returnString = \"\";\r\n\r\n // Search through string's characters one by one.\r\n // If character is in bag, append to returnString.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character isn't whitespace.\r\n var c = s.charAt(i);\r\n if (bag.indexOf(c) != -1) returnString += c;\r\n }\r\n\r\n return returnString;\r\n}", "function stripCharsNotInBag (s, bag)\r\n\r\n{ var i;\r\n var returnString = \"\";\r\n\r\n // Search through string's characters one by one.\r\n // If character is in bag, append to returnString.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character isn't whitespace.\r\n var c = s.charAt(i);\r\n if (bag.indexOf(c) != -1) returnString += c;\r\n }\r\n\r\n return returnString;\r\n}", "function removevowel(str){\n var newstr = \"\";\n for(var i = 0; i <str.length; i++ ){\n if(str[i] != \"a\" && str[i] != \"e\" && str[i] != \"i\" && str[i] != \"o\" && str[i] != \"u\"){\n newstr += str[i];\n }\n\n }\n return newstr;\n }", "function stringClean(s){\n return s.replace(/[0-9]/g, '');\n }", "function removeO(string){\nreturn string.replace(/[o]/g,'');\n}", "function disemvowel(str) {\n new_str = \"\"\n for (let char of str) {\n if (char !== 'a' | char !== 'e' | char !== 'i' | char !== 'o' | char !== 'u') {\n new_str += char;\n }\n }\n return new_str;\n}", "function stripCharsInBag (s, bag)\r\n\r\n{ var i;\r\n var returnString = \"\";\r\n\r\n // Search through string's characters one by one.\r\n // If character is not in bag, append to returnString.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character isn't whitespace.\r\n var c = s.charAt(i);\r\n if (bag.indexOf(c) == -1) returnString += c;\r\n }\r\n\r\n return returnString;\r\n}", "function stripCharsInBag (s, bag)\r\n\r\n{ var i;\r\n var returnString = \"\";\r\n\r\n // Search through string's characters one by one.\r\n // If character is not in bag, append to returnString.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character isn't whitespace.\r\n var c = s.charAt(i);\r\n if (bag.indexOf(c) == -1) returnString += c;\r\n }\r\n\r\n return returnString;\r\n}", "function ExOh(str) {\n\n // First, we declare two variables:\n // One which remove all characters in the string that aren't x's...\n var strX = str.replace(/[^x]/g, \"\");\n\n // ...and and the second which removes all characters that aren't o's\n var strO = str.replace(/[^o]/g, \"\");\n\n // Next, we get the length of each of these new variables to determine how many x's and o's are in the string...\n var xNumber = strX.length;\n var oNumber = strO.length;\n\n // ...and return the truth value of comparing the two.\n return xNumber === oNumber;\n}", "function solve(s, i) {\n s.replace(/[^a-zA-Z ]/g, \"\")\n}", "function strTrim(strng){\n if(ht == 0){ loc = 0; } // head clip\n else { loc = strng.length - 1; }// tail clip ht = 1 \n if( strng.charAt( loc ) == \" \"){\n aString = strng.substring( - ( ht - 1 ), strng.length - ht);\n aString = strTrim(aString);\n } else { \n var flg = false;\n for(i=0; i<=5; i++ ){ flg = flg || ( strng.charAt( loc ) == punct[i]); }\n if(flg){ \n aString = strng.substring( - ( ht - 1 ), strng.length - ht );\n } else { aString = strng; }\n if(aString != strng ){ strTrim(aString); }\n }\n if( ht ==0 ){ ht = 1; strTrim(aString); } \n else { ht = 0; } \n return aString;\n}", "function disemvowel(str) {\n let newStr = '';\n for(let i = 0; i < str.length; i++){\n if (str[i].toLowerCase() !== 'a' && str[i].toLowerCase() !== 'e' && str[i].toLowerCase() !== 'i' && str[i].toLowerCase() !== 'o' && str[i].toLowerCase() !== 'u'){\n newStr += str[i];\n }\n }\n return newStr;\n}", "function removeSpecialChars(str){\n\treturn str.replace(/[^a-z0-9A-Z ]+/gi, '').replace(/^-*|-*$/g, '').toLowerCase();\t\n}", "static _cleanString(str){\n\t\treturn str.trim().toLowerCase().split(\" \").join(\"-\").replace(/[^a-z0-9\\-]+/gi, \"\");\n\t}", "function containsOnlyLetters(input)\n{\n\treturn /^[a-zA-Z]/.test(input.replace(/\\s/g, ''));\n}", "function cleanString(str) {\n //withe the help of regex we R going to replace any character that is not a number or lowerCase, upperCase letter with no thing or an empty string\n return str.replace(/[^\\w]/g, \"\").toLowerCase().split(\"\").sort().join(\"\");\n}", "function scrub(txt){\r\n return txt.replace(/[^a-zA-Z ]/g, \"\")\r\n }", "function stringClean(s){\n return s.replace(/[0-9]/g, '');\n}", "function palindrome(str){\n //regular expression matches any non-word character. Equivalent to [^A-Za-z0-9_].\n\t var strRe = /[\\W_]/g;\n\n\t str = str.toLowerCase().replace(strRe, \"\");\n\n for(var i = 0; i < str.length; i++){\n\n\t if(str[i] !== str[str.length-1-i]){\n\t return false;\n\t }\n\t }\n\t return true;\n\n\t }", "function filter (v) {\n return v.charAt(0) !== \"b\"\n }", "function stripSpecialChars(original) {\n return original.replace(/[^\\w]/gi, '');\n}", "function removeAll(str, chars) {\n if (chars instanceof Array) {\n // go through each character and remove it\n result = str;\n for (var i = 0; i < chars.length; i++) {\n result = result.replace(new RegExp(chars[i], \"g\"), \"\");\n }\n return result;\n } else {\n return str.replace(chars, \"\");\n }\n}", "function palindromePerm(str){\n\n if (typeof str !== 'string'){\n return false;\n }\n \n let storage = new Set();\n for (let char of str){\n if (char !== ' '){\n if (storage.has(char)){\n storage.delete(char);\n } else {\n storage.add(char);\n }\n }\n }\n\n return storage.size <= 1;\n}", "function disemvowel(str) {\n let withoutVowel = \"\";\n for (let i = 0; i < str.length; i++) {\n if (str[i] !== \"a\" && str[i] !==\"e\" && str[i] !==\"i\" && str[i] != \"o\" && str[i] !== \"u\") {\n withoutVowel += str[i];\n }\n }\n return withoutVowel;\n}", "function removeCharacters(string, characters) {\n //Without using filter, split or join methods... I think the next best option would be Reg Exp\n\n // var regex = new RegExp(characters, \"g\")\n // return string.replace(regex, '')\n\n let arr = [];\n let characterArr = [];\n\n for (i=0; i<characters.length; i++) {\n characterArr.push(characters[i])\n }\n\n for (i=0; i<string.length; i++) {\n let match = false;\n characterArr.forEach((character) => {\n if (character === string[i]) {\n match = true\n }\n })\n if (match === true) {\n arr.push('')\n } else {\n arr.push(string[i])\n }\n } \n let newString = '';\n for (i=0; i<arr.length; i++) {\n newString = String(newString) + String(arr[i])\n }\n return newString\n}", "function palindromePerm(string) {\r\n const check = new Set();\r\n for (let i = 0; i < string.length; i++) {\r\n char = string[i].toLowerCase();\r\n if (char === \" \") continue;\r\n if (!check.has(char)) {\r\n check.add(char);\r\n } else {\r\n check.delete(char);\r\n }\r\n }\r\n return check.size <= 1;\r\n}", "function palindrome(str) {\n //character class for non-alphanumeric\n var filtered = str.replace(/[^a-zA-Z0-9]/gi, '').toLowerCase();\n //two runners\n var j = filtered.length - 1;\n for (var i = 0; i <= j; i++) {\n if (!filtered[i] != filtered[j]) {\n return false;\n }\n j--;\n }\n return true;\n\n}", "function removeChars(str, char) {\n let newStr = ' ';\n let last = 0;\n for (let i = 0; i <= str.length; i++) {\n if (char.includes(str[i]) || i === str.length) {\n newStr += str.slice(last, i);\n last = i + 1;\n }\n }\n return newStr;\n}", "function onlyLetters(str) {\n return str.toLowerCase().replace(/[^a-z]/g, \"\");\n}", "function isUniqueInPlace (s){\n\n\n // assuming s is ascii string \n // number of unique ascii characters is 256;\n if(s.length > 256) return false;\n\n // sort first by spliting into array, sorting characters, and rejoining\n s = s.split(\"\").sort().join(\"\");\n \n for (let i = 0; i <s.length-1; i++)\n // no character should be the same as the one before/after it\n if(s.charAt(i) === s.charAt(i+1)) return false;\n\n\n return true;\n}", "function isRealPalindrome(str) {\n var nonAlphanumericRemoved = str.replace(/\\W\\D*/i, '');\n\n return isPalindrome(nonAlphanumericRemoved.toLowerCase());\n}", "function removeVowels(S) {\n let regex = /[aeiouAEIOU]/g;\n let newString = \"\";\n for(let i = 0; i < S.length; i++){\n if(!S[i].match(regex)) {\n newString+= S[i]\n }\n }\n return newString;\n}", "function removeCharacters(string, rem) {\n let modifiedString = \"\";\n for (let i = 0; i < string.length; i++) {\n for (let j = 0; j < rem.length; j++) {\n if (string[i] !== rem[j]) {\n modifiedString += string[i];\n }\n }\n }\n return modifiedString;\n}", "function removeVowels(str) {\n var vowels = 'aeiou';\n return str.toLowerCase().split('').filter(function (letter) {\n return !vowels.split('').includes(letter);\n }).join('');\n}", "function disemvowel(str) {\n\treturn str.replace(/a|e|i|o|u/gi, \"\");\n}", "function disemvowel(str) {\n const vowelsArr = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n const strArr = str.split(\"\")\n\n return strArr.filter(char => !vowelsArr.includes(char.toLowerCase())).join(\"\")\n}", "function checkSpecialScenarios(s) {\n\tvar bugchars = '!#$^&*()+|}{[]?><~%:;/,=`\"\\'';\n\tvar i;\n\tvar lchar = \"\";\n\t// Search through string's characters one by one.\n\t// If character is not in bag.\n\tfor (i = 0; i < s.length; i++) {\n\t\t// Check that current character isn't whitespace.\n\t\tvar c = s.charAt(i);\n\t\tif (i > 0) lchar = s.charAt(i - 1)\n\t\tif (bugchars.indexOf(c) != -1 || (lchar == \".\" && c == \".\")) return false;\n\t}\n\treturn true;\n}", "function isPalindrome(s) {\n\tvar str = s.replace(/\\W/g,\"\").toLowerCase();\n\treturn str == str.split(\"\").reverse().join(\"\")\n}", "function sanitizeString(str){\n str = str.replace(/[^a-z0-9áéíóúñü \\.,_-]/gim,\"\");\n return str.trim();\n}", "function removeVowels(str){\n let vowels=['a','e','i','o','u'];\n return str.toLowerCase().split(\"\").filter(character => {\n if(!vowels.includes(character)) return character;\n }).join(\"\");\n}", "function cleanString(s) {\n let result = \"\";\n for (let index = 0; index < s.length; index++) {\n if (s[index] === \"#\") {\n result = result.slice(0, result.length - 1);\n } else {\n result += s[index];\n }\n }\n return result;\n}", "function clean_string_no_special(input_object) {\n var input_string = input_object.value;\n\n // remove all non alpha numeric\n var first_pass = input_string.replace(/[^a-zA-Z0-9_\\ \\.\\\\\\#\\-_\\/]/g, \"\");\n\n input_object.value = first_pass;\n}", "function isAllWhite(str){\n var isAllWhite = true,i,c,counter=0;\n \n while ( str.charAt(counter) ){\n c = str.charAt(counter++);\n if ( c != ' ' && c != '\\t' && c != '\\n' && c != '\\r' ){\n isAllWhite = false;\n break;\n }\n }\n \n return isAllWhite; \n}", "function modifiedRemoveCharacters(string, rem) {\n let dictionary = {};\n let modifiedString = \"\";\n for (let i = 0; i < rem.length; i++) {\n dictionary[rem[i]] = true;\n }\n for (let i = 0; i < string.length; i++) {\n if (!dictionary[string[i]]) {\n modifiedString += string[i];\n }\n }\n return modifiedString;\n}", "function onlyLetters (string){\n return string.replace(/[0-9]/g,'')\n}", "function isSubsequence(s,t) {\n let i = 0;\n\n for (let char of s) {\n while (i < t.length && char !== t[i]) {\n i++;\n }\n\n if (i >= t.length) return false;\n i++;\n }\n\n return true;\n}", "function clean(string) {\n string = string\n .toLowerCase()\n .replace(/[^a-zA-Z0-9 ]/g, \"\")\n .replace(\n /([\\uE000-\\uF8FF]|\\uD83C[\\uDC00-\\uDFFF]|\\uD83D[\\uDC00-\\uDFFF]|[\\u2011-\\u26FF]|\\uD83E[\\uDD10-\\uDDFF])/g,\n \"\"\n )\n .replace(\" \", \"\")\n .trim();\n return string;\n }", "function disemvowel(str) {\n return str.replace(/[aeiou]/gi, '');\n}", "function funnyString(s){\n var i, len = s.length;\n var arr = [];\n for (i = 0; i < len - 1; i++)\n arr[i] = Math.abs(s[i].charCodeAt() - s[i+1].charCodeAt());\n \n for (i = 0; i < (len - 1) / 2; i++)\n if (arr[i] !== arr[len-2-i])\n break;\n \n if (i >= (len-1)/2)\n return \"Funny\";\n else\n return \"Not Funny\";\n}", "function cleanString(inStr){\n var rv =\"\"\n for(var i = 0; i < inStr.length; i++){\n var char = inStr[i];\n if(!checkForOpperand(char)){\n continue;\n }else{\n rv+=char;\n }\n }\n return rv;\n}", "function filterStr(str) {\n var alphaNums = \"abcdefghijklmnopqrstuvwxyz1234567890\"\n return str.split(\"\").filter(function(char) {\n return alphaNums.includes(char.toLowerCase())\n })\n .join(\"\")\n}", "function removeSpacesb(string) {\nstringfixed = string.split(' ').join('-');\nstringfixed = stringfixed.toLowerCase();\nvar r = stringfixed;\nr = r.replace(new RegExp(\"[àáâãäå]\", 'g'),\"a\");\nr = r.replace(new RegExp(\"æ\", 'g'),\"ae\");\nr = r.replace(new RegExp(\"ç\", 'g'),\"c\");\nr = r.replace(new RegExp(\"[èéêë]\", 'g'),\"e\");\nr = r.replace(new RegExp(\"[ìíîï]\", 'g'),\"i\");\nr = r.replace(new RegExp(\"ñ\", 'g'),\"n\"); \nr = r.replace(new RegExp(\"[òóôõö]\", 'g'),\"o\");\nr = r.replace(new RegExp(\"œ\", 'g'),\"oe\");\nr = r.replace(new RegExp(\"[ùúûü]\", 'g'),\"u\");\nr = r.replace(new RegExp(\"[ýÿ]\", 'g'),\"y\");\nr = r.replace(new RegExp(\"[!¡¿?]\", 'g'),\"\");\nreturn r;\n\n }", "function palindrome(str) {\n// var lowRegStr = str.toLowerCase().replace(/[\\W_]/g, '');\n// var reverseStr = str.toLowerCase().replace(/[\\W_]/g, '').split('').reverse().join(''); \n return str.toLowerCase().replace(/[\\W_]/g, '').split('').reverse().join('') === str.toLowerCase().replace(/[\\W_]/g, '');\n}", "function removeChars(str, strToRemove) {\n\n var regex = new RegExp(`[${strToRemove}]`, 'g');\n\n return str.replace(regex, '');\n\n\n\n}", "function removeVowels(string myString) {\n\tlet noVowels = '';\n\tconst vowels = ['a', 'e', 'i', 'o', 'u'];\n\tforeach(myString as letter) {\n\t\tif(!vowels.contains(letter)) {\n\t\t\tnoVowels = noVowels.letter\n\t\t}\n\t}\n}", "function disemvowel(str){\n result = ''\n for (let i=0; i < str.length; i++){\n if (str[i] !== 'a' && str[i] !== 'e' && str[i] !== 'i' && str[i] !== 'o' && str[i] !== 'u' && str[i] !== 'A' && str[i] !== 'E' && str[i] !== 'I' && str[i] !== 'O' && str[i] !== 'U'){\n result += str[i];\n }\n }\n console.log(result);\n str = result;\n return str;\n}", "function clean_string_no_special(input_object) {\n var input_string = input_object.value;\n\n // remove all non alpha numeric\n var first_pass = input_string.replace(/[^a-zA-Z0-9_\\ \\.\\\\\\#\\-_\\/]/g, \"\");\n var second_pass = first_pass.replace(/\\./g, \"-\");\n input_object.value = second_pass;\n }", "function removeVowels(str){\n return str.replace(/[aouie]/gi, '');\n}", "function matchFunction(string) {\n var regExp = /[ !@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?]`/;\n\n if (string.match(regExp)) {\n newStr = string.replace(regExp, \"\")\n return newStr;\n } else {\n return string;\n }\n}", "function simplifyString(s) {\n return s.toLowerCase().replace(/[^\\w]|_/g, \"\");\n }", "function removeBMW(str){\r\n if(typeof(str) !== 'string') {\r\n throw new Error(\"This program only works for text.\");\r\n }\r\n\r\n let newStr = str.replace(/b+/gi, '');\r\n newStr = newStr.replace(/m+/gi, '');\r\n newStr = newStr.replace(/w+/gi, '');\r\n return newStr; \r\n}", "function isnotName(str){\nstringCheck=\"!@#$%^&*()_+|<>?/=~,0123456789;:][{}\"+\"\\\\\";\nf1=1;\nfor(j=0;j<str.length;j++)\n{ if(stringCheck.indexOf(str.charAt(j))!=-1)\n { f1=0;}}\nif(f1==0)\n{ return true; }else {return false;}\n}", "function stripCharacter(words,character) {\n\t//documentation for this script at http://www.shawnolson.net/a/499/\n\t var spaces = words.length;\n\t for(var x = 1; x<spaces; ++x){\n\t words = words.replace(character, \"\");\n\t }\n\t return words;\n }", "function removeThisIsSA(string: string){\n\n\t\t\t\t\tif (string.includes(' This is SA: ')){\n\t\t\t\t\t\treturn string.replace('This is SA: ', '');\n\t\t\t\t\t}\n\t\t\t\t\tif (string.includes(' This is S.A.:')){\n\t\t\t\t\t\treturn string.replace('This is S.A.: ', '');\n\t\t\t\t\t}\n\n\t\t\t\t\treturn string;\n\t\t\t\t}", "function clean( w ){\n\treturn w.replace(/[^\\d\\w\\s,().\\?\\/\\\\n\\\\t{}<>=\\\"\\\":%-]/gi, '') // remove special chars\n\t\t\t.replace(/\\s+/g, \" \") // remove extra spaces\n\t\t\t.trim(); // remove trailing chars\n}", "function removePunctuation(strInput){ \n let puncRemove = strInput.filter(char => arrayPunc.indexOf(char) === -1);\n return puncRemove;\n}", "function removeChar(string, remove){\n console.log(remove);\n return string.replace(/[remove]/ig, '');\n}", "function removeChar(str) {\n\n\n return str.slice(1, str.length - 1)\n\n}", "function trimString(string) {\n return string.toLowerCase().replace(/\\s/g, '-').replace(/[.!_&%/:;')(+?,=]/g, '');\n}", "function removeSpecials(str) {\n let brokenStr = str.match(/[\\w ]/g);\n return brokenStr != null ? brokenStr.join('') : null;\n}", "function disemvowel(str) {\n\n var vowels = ['a', 'i', 'u', 'e', 'o', 'A', 'I', 'U', 'E', 'O']\n var result = str\n \n for(var i = 0; i < str.length; i++){\n for(var j = 0; j < vowels.length; j++){\n if(str[i] == vowels[j]){\n result = result.replace(str[i], '')\n }\n }\n }\n\n return result\n }", "function removeVowels1(str){\n let vowels = \"AEIOUaeiou\";\n let res = '';\n for (let i = 0; i < str.length; i++){\n if (!vowels.includes(str[i])){\n res += str[i];\n }\n }\n return res;\n}", "function isnotAlphaNumeric(str){\nstringAlphaNumCheck=\"!@#$%^&*()_+|<>?/=-~.,;:][{}\"+\"\\\\\"+\"\\'\";\nf3=1;\nfor(j=0;j<str.length;j++)\n{if(stringAlphaNumCheck.indexOf(str.charAt(j))!=-1)\n{f3=0;}}\nif(f3==0)\n{return true;}else{return false;}\n}", "function palindrome(str) {\n // Good luck!\n var reg = /[\\W_]/g;\n var smallstr = str.toLowerCase().replace(reg, \"\");\n var reverse = smallstr.split(\"\").reverse().join(\"\");\n if( reverse === smallstr) return true;\n return false;\n}", "function removeDups(s) {\n let charArray = s.split(\"\");\n for (let i = 0; i < charArray.length; i++) {\n for (let j = i + 1; j < charArray.length; j++)\n if (charArray[i] == charArray[j]) {\n charArray.splice(j, 1);\n j--;\n }\n }\n return charArray.join(\"\");\n }", "function isPalindrome2(string){\n string = string.toLowerCase(); //case insensitive\n var charactersArr = string.split('');\n var validCharacters = 'abcdefghijklmnopqrstuvwxyz'.split('');\n\n var lettersArr = [];\n charactersArr.forEach(function(char){ // for each character\n if (validCharacters.indexOf(char) > -1) lettersArr.push(char); //get rid of the character if it's not in the list of eligible chars\n });\n\n return lettersArr.join('') === lettersArr.reverse().join(''); // return result of comparing the word with the reverse version of it\n}" ]
[ "0.65463436", "0.64395005", "0.6371885", "0.632304", "0.6316935", "0.6281303", "0.62589574", "0.6255047", "0.61815035", "0.61736774", "0.6148167", "0.61431986", "0.61252415", "0.6120773", "0.6096078", "0.60883284", "0.60867673", "0.60794497", "0.60705763", "0.60705763", "0.6045254", "0.6042246", "0.60350543", "0.6030798", "0.60307", "0.60307", "0.60252535", "0.60019296", "0.5996828", "0.5995918", "0.5990386", "0.5990386", "0.5984536", "0.59836984", "0.59593", "0.59478873", "0.5930732", "0.59223443", "0.5919672", "0.59067816", "0.5905591", "0.5899919", "0.5899622", "0.5897799", "0.58968735", "0.5888026", "0.58725035", "0.5871682", "0.5871276", "0.58686227", "0.5865637", "0.58647233", "0.58426374", "0.5840964", "0.58402145", "0.5834514", "0.58292043", "0.58242905", "0.58177817", "0.58145326", "0.5813542", "0.5812953", "0.58127946", "0.5803171", "0.5784664", "0.5784478", "0.57788944", "0.5765791", "0.57563055", "0.5755883", "0.5749372", "0.574813", "0.5745161", "0.5728393", "0.57166016", "0.5714914", "0.571233", "0.57079273", "0.5707314", "0.57073134", "0.5704811", "0.5703935", "0.570335", "0.57004136", "0.56856155", "0.5683987", "0.56786084", "0.56749785", "0.5672307", "0.5668967", "0.5666704", "0.56589127", "0.56585664", "0.5651989", "0.5646543", "0.56351626", "0.56322813", "0.5630342", "0.56283927", "0.5626954" ]
0.62158936
8
function to keep earth gif moving
function validateField() { var docs = document.getElementById("img"); docs.setAttribute("src", "gif_path"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function moveGif(){\r\n\tvar intViewportWidth = window.innerWidth\r\n\tb1.style.opacity = \".5\"\r\n\torange.style.transition = \"transform 2s ease\"\r\n\torange.style.transform = \"translate(30vw, 0)\"\r\n\tif(x.matches){\r\n\t\torange.style.transform = \"translate(0, -165px)\"\r\n\t}\r\n\r\n}", "function animateGif(gif){\n $(gif).attr(\"src\", $(gif).attr(\"data-motion\"))\n $(gif).attr(\"data-state\",\"inMotion\")\n}", "function playGif () {\n\n if ($(this).attr(\"data-state\") == \"still\") {\n $(this).html(\"<img src'\" + $(this).attr(\"data-animate\") + \"'>\");\n $(this).attr(\"data-state\", \"animate\");\n }\n else {\n $(this).html(\"<img src='\" + $(this).attr(\"data-still\") + \"'>\");\n $(this).attr(\"data-state\", \"still\");\n }\n }", "function animateGif() {\n var state = $(this).attr(\"data-state\");\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n}", "function animatepuppyGif() {\n // Images can either be animated or stay still\n var state = $(this).find(\"img\").attr(\"data-state\");\n \n if (state === \"still\") {\n $(this).find(\"img\").attr(\"src\", $(this).find(\"img\").attr(\"data-animate\"));\n $(this).find(\"img\").attr(\"data-state\", \"animate\");\n \n } else {\n $(this).find(\"img\").attr(\"src\", $(this).find(\"img\").attr(\"data-still\"));\n $(this).find(\"img\").attr(\"data-state\", \"still\");\n }\n }", "function playGif() {\n var state = $(this).attr(\"data-state\");\n\n if (state == \"still\") {\n $(this).attr(\"src\", $(this).data(\"animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).data(\"still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n }", "function playGif () {\n var state = $(this).attr('data-state');\n if (state === 'still') {\n $(this).attr('src', $(this).attr('data-animate'));\n $(this).attr('data-state', 'animate');\n }\n else {\n $(this).attr('src' , $(this).attr('data-still'));\n $(this).attr('data-state', 'still');\n }\n }", "function playGif(){\n var state = $(this).attr(\"data-state\");\n\t\t\t \n\t\t\tif (state == \"still\") {\n\t\t\t\t$(this).attr(\"src\", $(this).data(\"animate\"));\n\t\t\t\t$(this).attr(\"data-state\", \"animate\");\n\t\t\t} else {\n\t\t\t\t$(this).attr(\"src\", $(this).data(\"still\"));\n\t\t\t\t$(this).attr(\"data-state\", \"still\");\n\t\t\t}\n}", "function gifAnimation() {\n\n\t\tvar state = $(this).attr(\"data-state\");\t\t\t\t\t\t\t\t\t\t// Get the current state\n\n\t\tif (state === \"still\") {\t\t\t\t\t\t\t\t\t\t\t\t\t// If the GIF is currently still\n\t\t\t$(this).attr(\"data-state\", \"animate\");\t\t\t\t\t\t\t\t\t// Set the state to animate\n\t\t\t$(this).attr(\"src\", $(this).attr(\"data-animate\"));\t\t\t\t\t\t// And load the animated GIF\n\t\t}\n\t\telse {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Otherwise\n\t\t\t$(this).attr(\"data-state\", \"still\");\t\t\t\t\t\t\t\t\t// Set the state to still\n\t\t\t$(this).attr(\"src\", $(this).attr(\"data-still\"));\t\t\t\t\t\t// And load the still GIF\n\t\t}\n\n\t}", "function playGif() {\n var state = $(this).attr(\"data-state\");\n \n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n}", "function pausePlayGifs() {\n var movement = $(this).attr('data-state');\n if (movement === 'still') {\n $(this).attr('src', $(this).attr('data-animate'));\n $(this).attr('data-state', 'animate');\n } else {\n $(this).attr('src', $(this).attr('data-still'));\n $(this).attr('data-state', 'still');\n }\n }", "function gifSwitch() {\n\tvar state = $(this).attr(\"data-state\");\n\tif (state === \"still\") {\n\t\t$(this).attr(\"src\", $(this).attr(\"data-animate\"));\n\t\t$(this).attr(\"data-state\", \"animate\");\n\t\tconsole.log(\"gif is moving\");\n\t} else if (state === \"animate\") {\n\t\t$(this).attr(\"src\", $(this).attr(\"data-still\"));\n\t\t$(this).attr(\"data-state\", \"still\");\n\t\tconsole.log(\"gif is still\");\n\t}\n}", "function clickGif() {\n \n //console.log($(this).attr(\"still\"));\n \n if($(this).attr(\"still\") === \"true\") {\n console.log(\"making image move\")\n console.log($(this).attr(\"activeLink\"))\n $(this).attr(\"src\", $(this).attr(\"activeLink\"));\n $(this).attr(\"still\", \"false\");\n } else {\n //console.log(\"making image still\")\n $(this).attr(\"src\", $(this).attr(\"stillLink\"));\n $(this).attr(\"still\", \"true\");\n \n }\n }", "function staticImgPosition() {\n if (bFavoritesAnimatedOpen) {\n $('#imgFavorites').stop(true, true).animate({ rotate: '0deg' }, 10);\n }\n if (bSecureAnimatedOpen) {\n $('#imgSurfSafely').stop(true, true).animate({ rotate: '0deg' }, 10);\n }\n if (bExtensionAnimatedOpen) {\n $('#LR').stop(true, true).animate({ rotate: '0deg' }, 10);\n }\n }", "animate () {\n this.x -= this.speed * 5;\n if (this.x < -this.groundImage.width) \n this.x = 0;\n }", "function gifContainerAnimation() {\n gifContainer.classList.add('rotate-vert-center');\n gifContainer.addEventListener('animationend', gifContainerListener);\n}", "function startAnimation(){\n\tif (carIsRunning === true){\n\t\treturn;\n\t}\n\t$(\"#streetImg\").animate({\n\t\tbackgroundPositionY: '+=200px'\n\t}, 500, 'linear', startAnimation);\n}", "function checkBottleAnimation() {\n setInterval(function () {\n let index = thrownbottleGraphicsIndex % thrownbottleGraphics.length;\n thrownbottleCurrentImage = thrownbottleGraphics[index];\n thrownbottleGraphicsIndex = thrownbottleGraphicsIndex + 1;\n }, 70);\n}", "function changeGIFState() {\n var state = $(this).attr(\"data-state\");\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n }", "function animateGifs() {\n var state = $(this).attr(\"data-state\");\n var animated = $(this).attr(\"data-animate\");\n var still = $(this).attr(\"data-still\");\n if (state === \"still\") {\n $(this).attr(\"src\", animated);\n $(this).attr(\"data-state\", \"animate\");\n } else if (state === \"animate\") {\n $(this).attr(\"src\", still);\n $(this).attr(\"data-state\", \"still\");\n }\n }", "function ocupar1(){\n if(!animation1){\n if(ocupado1){\n img1DespY = 1;\n ocupado1 = false;\n }else {\n img1DespY = -1;\n ocupado1 = true;\n }\n animation1=true;\n interval1 = setInterval(moveCar1,20); // cada 20 milisegundos se ejecute\n }\n}", "function playBGMNearShore (event) {\n bgmNearShore.currentTime = 0;\n $(bgmNearShore).each(function(){this.play(); $(this).animate({volume:1},1000)});\n }", "function MoveToRunter(){\n document.getElementById(\"kidposition\").style.transitionDuration=\"1s\";\n \n document.getElementById(\"kidposition\").src=\"kid_bilder/gifs/kid_right_walking.gif\";\n document.getElementById(\"kidposition\").style.left=\"400px\";\n document.getElementById(\"kidposition\").style.top =\"410px\";\n\n setTimeout(function(){\n document.getElementById(\"kidposition\").src=\"kid_bilder/gifs/kid_front_walking.gif\";\n document.getElementById(\"kidposition\").style.left=positionAX;\n document.getElementById(\"kidposition\").style.top =positionAY;\n\n \n },1000)\n setTimeout(function(){\n position=\"Schreibtisch\";\n document.getElementById(\"kidposition\").style.transitionDuration=\"3s\";\n },2000);\n}", "function changeGifState() {\n var gif = $(this);\n var animated = gif.attr(\"data-animated\");\n var still = gif.attr(\"data-still\");\n\n if (gif.attr(\"data-state\") === \"still\") {\n gif.attr(\"src\", animated);\n gif.attr(\"data-state\", \"animated\");\n } else {\n gif.attr(\"src\", still);\n gif.attr(\"data-state\", \"still\");\n }\n }", "function stillGif(gif){\n $(gif).attr(\"src\", $(gif).attr(\"data-still\"))\n $(gif).attr(\"data-state\",\"still\")\n}", "function pauseGif() {\n\n var state = $(this).attr(\"data-state\");\n\n console.log(state);\n\n if (state === \"still\") {\n\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n };\n}", "function girb_interval(){\n\t\t//\n\t\tclearInterval(girb_int);\n\t\t//\n\t\tif(Math.random()*100 > 50){\n\t\t\tmove_girb();\n\t\t}else{\n\t\t\treset_interval();\n\t\t\tset_animation(return_randImg(arr_img_idle));\n\t\t}\n\t}", "splashBottle() {\n clearInterval(this.gravitation);\n clearInterval(this.the_throw); \n this.playAnimation(this.IMAGES_SPLASH);\n this.splash_sound.play();\n setInterval(() => {\n this.width = 0;\n this.height = 0;\n }, 200);\n }", "function switchGifs() {\n var gifState = $(this).attr('data-state');\n if (gifState === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n }", "re_animate_ghost() {\r\n\r\n this.sprite.status = this.statusEnum.ALIVE;\r\n this.set_animation_frame(0, 0);\r\n this.animate_start();\r\n \r\n }", "function gifInit() {\n d.image.src = images[0];\n d.image.setAttribute('data-frame', 0);\n d.controlPlayback.addEventListener('click', playAnimation);\n}", "function moveCar1(){\n ctx.clearRect(img1X,img1Y,46,90);\n img1Y = img1Y + img1DespY;\n ctx.drawImage(carImg1,img1X,img1Y,46,90);\n if(img1Y<=28||img1Y>=140)\n {\n animation1=false;\n clearInterval(interval1); // cancelar el ciclo\n }\n\n}", "pintar(){\r\n this.app.ellipseMode(this.app.CORNER);\r\n this.gif.position(this.x-17, this.y-17);\r\n }", "function gifState() {\n var state = $(this).attr(\"data-state\");\n var animate = $(this).attr(\"data-state-animate\");\n var still = $(this).attr(\"data-state-still\");\n\n if (state === \"still\") {\n $(this).find(\"img\").attr(\"src\", animate);\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).find(\"img\").attr(\"src\", still);\n $(this).attr(\"data-state\", \"still\");\n };\n}", "function gifClick(){\r\n\tvar state = $(this).attr('data-state');\r\n\r\n\tif(state == 'animate'){\r\n\t\t$(this).attr('src', $(this).data('still'));\r\n\t\t$(this).attr('data-state', 'still');\r\n\t}else{\r\n\t\t$(this).attr('src', $(this).data('animate'));\r\n\t\t$(this).attr('data-state', 'animate');\r\n\t}\t\r\n}", "function phosphate() {\n\tif (phosphateClicked == false) {\n\t\tdocument.getElementById('phosphateGo').src=phosphateGif.src;\n\t\tphosphateClicked = true;\n\t} else {\n\t\tdocument.getElementById('phosphateGo').src=phosphateJpeg.src;\n\t\tphosphateClicked = false;\n\t}\n}", "function frame()\n {\n //Clear the element if it reaches below a certain pixel range\n if (pos == 1024)//setting of the finish line\n {\n clearInterval(id);\n eball.remove();\n }\n //Continue to move till the finish line hits.\n else\n {\n pos++;//Add the position\n eball.style.top = pos + 'px';//Continuosly keep on adding the position value to account for the movement\n }\n }", "function playBGMFarFromShore (event) {\n bgmFarFromShore.currentTime = 0;\n $(bgmFarFromShore).each(function(){this.play(); $(this).animate({volume:1},1000)});\n }", "toggleAnimation(){if(this.__stopped){this.__stopped=!1;this.shadowRoot.querySelector(\"#svg\").style.visibility=\"hidden\";if(null!=this.src){this.shadowRoot.querySelector(\"#gif\").src=this.src}this.shadowRoot.querySelector(\"#gif\").alt=this.alt+\" (Stop animation.)\"}else{this.__stopped=!0;this.shadowRoot.querySelector(\"#svg\").style.visibility=\"visible\";if(null!=this.srcWithoutAnimation){this.shadowRoot.querySelector(\"#gif\").src=this.srcWithoutAnimation}this.shadowRoot.querySelector(\"#gif\").alt=this.alt+\" (Play animation.)\"}}", "function seasick() {\n\tif (seasickClicked == false) {\n\t\tdocument.getElementById('seasickGo').src=seasickGif.src;\n\t\tseasickClicked = true;\n\t} else {\n\t\tdocument.getElementById('seasickGo').src=seasickJpeg.src;\n\t\tseasickClicked = false;\n\t}\n}", "function pausePlayGifs() {\n var state = $(this).attr(\"data-state\");\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n }", "function watchGifs() {\n $(\".gif\").on(\"click\", function() {\n // The attr jQuery method allows us to get or set the value of any attribute on our HTML element\n var state = $(this).attr(\"data-state\");\n console.log(state);\n // If the clicked image's state is still, update its src attribute to what its data-animate value is.\n // Then, set the image's data-state to animate\n // Else set src to the data-still value\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n })\n }", "function ferriswheel() {\n\tif (ferriswheelClicked == false) {\n\t\tdocument.getElementById('ferriswheelGo').src=ferriswheelGif.src;\n\t\tferriswheelClicked = true;\n\t} else {\n\t\tdocument.getElementById('ferriswheelGo').src=ferriswheelJpeg.src;\n\t\tferriswheelClicked = false;\n\t}\n}", "function gravity(){\r\n\tif(tpaolo.jumping==true){\r\n\t\timgrun = document.getElementById('up');\r\n\t\tif(tpaolo.y-tpaolo.vy-tpaolo.gravity>floor){\r\n\t\t\ttpaolo.jumping=false;\r\n\t\t\timgrun = document.getElementById('run');\r\n\t\t\ttpaolo.vy=0;\r\n\t\t\ttpaolo.y=floor;\r\n\t\t}else{\r\n\t\t\ttpaolo.vy-=tpaolo.gravity;\r\n\t\t\ttpaolo.y-=tpaolo.vy;\r\n\t\t}\r\n\t}\r\n}", "function startMoving(){\n ninjaLevitation(animTime);\n //sunrise();\n var particular4transl_50 = 50 / animTime;\n var particular4transl_100 = 100 / animTime;\n var particular4opacity_0 = 1 / animTime;\n var particular4opacity_075 = 0.75 / animTime;\n animate(function(timePassed) {\n forBackgnd.attr({opacity : particular4opacity_0 * timePassed});\n instagramLogo.attr({opacity : particular4opacity_0 * timePassed, 'transform' : 't 0, '+(100 - particular4transl_100 * timePassed)});\n mountFog.attr({opacity : 0.75 - particular4opacity_075 * timePassed});\n sunRays.attr({opacity : particular4opacity_0 * timePassed, 'transform' : 't 0, '+(50 - particular4transl_50 * timePassed)});\n }, animTime);\n}", "function gifRender() {\n // The attr jQuery method allows us to get or set the value of any attribute on our HTML element\n var state = $(this).attr(\"data-state\");\n // If the clicked image's state is still, update its src attribute to what its data-animate value is.\n // Then, set the image's data-state to animate\n // Else set src to the data-still value\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n}", "function gifAnimator() {\n $(\".gifImg\").on(\"click\", function () {\n\n var state = $(this).attr(\"data-state\")\n var dynaSource;\n\n // console.log(state)\n\n\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n\n $(this).attr(\"data-state\", \"animate\");\n }\n else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n\n $(this).attr(\"data-state\", \"still\");\n\n }\n\n });\n }", "function gifState () {\n $(\".gif\").on(\"click\", function () { //Must double-click -- Why?\n var state = $(this).attr(\"data-state\");\n\n if(state === \"still\") {\n var animatedURL = $(this).attr(\"data-animate\");\n $(this).attr(\"src\", animatedURL);\n $(this).attr(\"data-state\", \"animate\");\n\n }else if (state === \"animate\") {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n });\n}", "function gifClickState() {\n $(document).on(\"click\", \".gif\", function () {\n\n var state = $(this).attr(\"data-state\");\n console.log(state);\n\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n\n });\n } /// gifClickState();", "function pausingGifs() {\n\n var state = $(this).attr(\"data-state\");\n // If the clicked image's state is still, update its src attribute to what its data-animate value is.\n // Then, set the image's data-state to animate\n // Else set src to the data-still value\n if (state === \"still\") {\n // if the current state is STILL\n // console.log the URL in the animate state\n console.log(\"currently still change to animate: \" + $(this).attr(\"data-animate\"));\n // update its src attribute to what its data-animate value is\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n //set the image's data-state to animate\n $(this).attr(\"data-state\", \"animate\");\n } else { \n // else if the current state is ANIMATE\n // console.log the URL in the still state\n console.log(\"currently animate change to still: \" + $(this).attr(\"data-still\"));\n // update its src attribute to what its data-still value is\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n // set the image's data-state to still\n $(this).attr(\"data-state\", \"still\");\n }\n }", "function pausegifs() {\n console.log(\"clikedit\")\n var state = $(this).attr(\"state\")\n console.log(state)\n if (state === \"animate\") {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"state\", \"still\");\n }\n else {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"state\", \"animate\");\n }\n}", "shiftImage(){\n this.contZero(); \n this.showImage();\n if(this.play === false){\n this.intervalId = setInterval(function(){\n this.nextImage();\n }.bind(this), 5000);\n this.play = true;\n } \n }", "function curentAnimation(mark) {\r\n mark.setIcon('http://maps.gstatic.com/mapfiles/ms2/micons/bar.png');\r\n mark.setAnimation(google.maps.Animation.BOUNCE);\r\n}", "function toggleGif() {\n console.log(\"toggleGif\");\n if ($(this).data('active')) {\n $(this).data('active', false);\n $(this).css('background-image', 'url(' +$(this).data(\"still\") + ')');\n } else {\n $(this).data('active', true);\n $(this).css('background-image', 'url(' +$(this).data(\"animated\") + ')');\n }\n }", "function animateCloud(image){\n $(image).stop(true).animate({ \n top: newPos()[1],\n left: newPos()[0]\n }, 10000, function(){\n animateCloud(image);\n });\n }", "function moveCar2(){\n ctx.clearRect(img2X,img2Y,46,90);\n img2Y = img2Y + img2DespY;\n ctx.drawImage(carImg2,img2X,img2Y,46,90);\n if(img2Y<=28||img2Y>=140)\n {\n animation2=false;\n clearInterval(interval2);\n }\n\n}", "function gifyMotion() {\n\n var state = $(this).attr(\"data-state\");\n console.log(state);\n if (state === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n}", "function mouseOverGif (event) {\n\t\t\tvar gif = event.target;\n\t\t\tif (state == \"selectGif\") {\n\t\t\t\tTweenLite.to(gif, 0.2, {scale: 1.05});\n\t\t\t}\n\t\t}", "function changePic() {\n var blowfishh = document.getElementById('myblowfish');\n //blowfish.src = \"/img/Sashimi.png\";\n var img = \"/img/\" + parseInt(eggCounter) + \".gif\";\n blowfishh.src = img;\n h += 15;\n w += 15;\n\n $(\"#myblowfish\").animate({\n //left: '250px',\n //opacity: '0.5',\n height: h + 'px',\n width: w + 'px'\n }, 1000);\n \n}", "function animate() {\n window.setTimeout(animate, 25);\n L10_Canvas.crc2.putImageData(imagedata, 0, 0);\n moveFishes();\n drawFishes();\n moveBubbles();\n drawBubbles();\n }", "function anim() {\n ox = lerp(ox, x, 0.0733);\n oy = lerp(oy, y, 0.0733);\n if(Math.abs(ox - x) > 1 && Math.abs(oy - y) > 1) {\n $('#' + id).attr({style: $.index.templates.shot.replace('{x}', x).replace('{y}', y)});\n //$('#' + id).attr('style', 'z-index:999;width:15px;height:15px;display:block;position:absolute;left:' + ox + 'px; top:' + oy + 'px;');\n setTimeout(anim, 100);\n } else $('#' + id).remove();\n }", "function myfunc(){\n\tball = new Image();\n\t\n\tball.src = \"ball1.png\";\n\t\n\twindow.setInterval(move,10);\n\t//I sped up the interval to make the ball move across the screen faster...(it SHOULD be 100, but I'm impatient)\n\t\n\t}", "function playGiphy() {\n if ($(this).attr(\"still\") == \"Y\") {\n var link = $('img', this).attr(\"src\").split(\"_s.gif\");\n $('img', this).attr(\"src\", link[0] + \".gif\");\n $(this).attr(\"still\", \"N\");\n } else {\n var link = $('img', this).attr(\"src\").split(\".gif\");\n $('img', this).attr(\"src\", link[0] + \"_s.gif\");\n $(this).attr(\"still\", \"Y\");\n }\n}", "function playBGMInTheCastle (event) {\n bgmInTheCastle.currentTime = 0;\n $(bgmInTheCastle).each(function(){this.play(); $(this).animate({volume:1},1000)});\n }", "function walkingLeft() {\n// Working on a good animation technqiue; tricky with a single thread!\n//user.src = \"stickfigureart/runl1.png\";\n//setTimeout(donothing, 5);\n//user.src = \"stickfigureart/runl2.png\";\n//setTimeout(donothing, 5);\n user.src = \"stickfigureart/runl3.png\";\n//setTimeout(donothing, 5);\n}", "function frame() {\n\t\tleft += 2.5;\n\t\t//opacity += 0.02;\n\t\tanimal.style.left = left + 'px';\n\t\t//txt.style.opacity = opacity;\n\t\tif (left >= 15) {\n\t\t\tclearInterval(interval);\n\t\t\tanimal.style.left = \"15px\";\n\t\t\t//txt.style.opacity = 1;\n\t\t\tspots_disabled = false;\n\t\t\tfadein_text();\n\t\t}\n\t}", "function animateImage() {\n var stillImg = $(this).attr('data-still');\n var animatedImg = $(this).attr('src');\n $(this).attr('data-still', animatedImg);\n $(this).attr('src', stillImg);\n }", "function removeLife (){\n Images.frog.src = '../images/icons8-Poison-96.png'\n frogImages[lives - 1].remove()\n setTimeout(function(){\n Images.frog.src = '../images/frog.png'\n }, 700)\n x = 225\n y = 560\n counter = 60\n}", "function animate(){\n if(backgroundInfo.x === xGoal && backgroundInfo.y === yGoal){//if we hit the distance goal\n clearTimeout(loopTimer);\n console.log(\"congratulations, the animation completed!\");\n }\n //else\n else {\n //save, do something, restore\n ctx.save();\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n //console.log(\"background started at: \" + backgroundInfo.x + \" \" + backgroundInfo.y);\n backgroundInfo.x += x/32;\n backgroundInfo.y += y/32;\n console.log(\"background at: \" + backgroundInfo.x + \" \" + backgroundInfo.y);\n //TODO: if the backgrond is going to start moing off-screen, we need to do something idfferent\n ctx.drawImage(background, backgroundInfo.x, backgroundInfo.y);//draw the background to the new location\n ctx.restore();//restore canvas back to original location\n var loopTimer = setTimeout(animate, 1);//function to call to iterate through the animation, and the speed at which the animation will take to complete\n }\n }", "function moveImage() {\n\t//Keep on moving the image till the target is achieved\n\tif(y1<dest_y) y1 = y1 + interval;\n\t\n\t//Move the image to the new location\n\tdocument.getElementById(\"s1\").style.top = y1+'px';\n\tif (y1+interval < dest_y) {\n\t\t//Keep on calling this function every 100 microsecond \n\t\t//\ttill the target location is reached\n\t\twindow.setTimeout('moveImage()',100);\n\t}\n}", "function storm() {\n $(\"img\").each(function () {\n d = Math.random() * 1000;\n $(this).delay(d).animate({ opacity: 1 }, {\n step: function (n) {\n //rotating the images on the Y axis from 360deg to 0deg\n ry = (1 - n) * 360;\n //translating the images from 1000px to 0px\n tz = (1 - n) * 1000;\n //applying the transformation\n $(this).css(\"transform\", \"rotateY(\" + ry + \"deg) translateZ(\" + tz + \"px)\");\n },\n duration: 3000,\n //Some easing fun. Comes from jquery easing plugin\n easing: 'easeOutQuint',\n })\n })\n }", "function animateLoader() {\r\n\tif (moonState < moonStateImages.length) {\r\n\t\t$(\"#fe_intro_moon img\").attr(\"src\", \"img/\" + moonStateImages[moonState]);\r\n\t\t$(\"#fe_intro_moon p\").html(Math.round(moonState/moonStateImages.length * 100));\r\n\t\tmoonState++;\r\n\t\tsetTimeout(animateLoader, 350); // the interval between frames\r\n\t}\r\n\telse {\r\n\t\t$(\"#fe_intro_moon img\").attr(\"src\", \"img/\" + moonStateImages[moonState-1]);\r\n\t\t$(\"#fe_intro_moon p\").html(Math.round(moonState/moonStateImages.length * 100));\r\n\t\tsetTimeout(startIntro, 250); // play the intro when the load animation completes\r\n\t}\r\n}", "function ImgTimer()\n{\n\timgtimersubtract = setInterval(changinImg, 250); //Goes to DealingHand() every 250 millisecond. defines imgtimersubtract.\n}", "function sheepjump() {\n\tvar jumpsheep=$('jumpjpg');\n\tjumpsheep.style.bottom = \"200px\";\n\tif (jumpsheep.style.left == \"680px\") {\n\t jumpsheep.style.left = \"780px\";}\n\telse {jumpsheep.style.left = \"680px\";}\n\tsetTimeout(() => { jumpsheep.style.bottom = \"340px\"; }, 200);\n}", "jump(){\n this.jumpCount++;\n if (this.jumpCount < 2) {\n this.velocity = -21;\n }\n \n clear();\n //this.jmpImg.show();\n\n }", "function ceramics() {\n\tif (ceramicsClicked == false) {\n\t\tdocument.getElementById('ceramicsGo').src=ceramicsGif.src;\n\t\tceramicsClicked = true;\n\t} else {\n\t\tdocument.getElementById('ceramicsGo').src=ceramicsJpeg.src;\n\t\tceramicsClicked = false;\n\t}\n}", "function stopStart(){\n\t\tvar state = $(this).attr(\"data-state\");\n\t\tvar animateGif = $(this).attr(\"data-animate\");\n\t\tvar stillGif = $(this).attr(\"data-still\");\n\n if (state === \"still\") {\n\n $(this).attr(\"src\", $(this).data(\"animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } \n \n else {\n\n $(this).attr(\"src\", $(this).attr(\"still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n}", "function playGif() {\n $('.pic-animate').on('click', function() {\n\n var state = $(this).attr('data-state');\n\n var animate = $(this).attr('data-animate');\n var still = $(this).attr('data-still');\n\n if (state === 'still') {\n $(this).attr('src', animate)\n $(this).attr('data-state', 'animate')\n console.log('animate: ' + this.src);\n } else {\n $(this).attr('src', still)\n $(this).attr('data-state', 'still')\n console.log('still: ' + this.src);\n }\n });\n}", "function lonlight ( timer )\n{\n isLoadOn = true;\n if ( typeof timer === undefined ){timer = 500;\n }\n timer = !is_numeric ( timer ) ? 500 : timer;\n $ ( '#loadIconDiv1' ).animate ( { 'opacity' : 1 } , timer ).dequeue ();\n $ ( '#loadIconDiv1' ).fadeIn ( timer ).dequeue ();\n $ ( '#hiderLayer1' ).fadeOut ( timer ).dequeue ();\n hueRotation ();\n\n}", "function animateWagon(pace) {\n\tvar position = 0; //start position for the image slicer\n\tconst interval = 200/pace;\n\n\tvar times_run = 0;\n\ttID = setInterval ( () => {\n\t\tvar ctx = (document.getElementById(\"myCanvas\")).getContext(\"2d\"); \n\t\tvar img = document.getElementById(\"wagon\");\n\t\tctx.drawImage(img, 0, position, 80, 29, 420, 70, 120, 45);\n\n\t\t// We increment the position by 30 each time\n\t\tif (position < 30) { \n\t\t\tposition = position + 30;\n\t\t}\n\t\telse { \n\t\t\tposition = 0;\n\t\t}\n\t\t//reset the position to 0px, once position exceeds 30px\n\t\t\n\t\ttimes_run += 1; \n\t\tif(times_run > 1000/interval){\n\t\t\tclearInterval(tID);\n\t\t}\n\t} ,interval ); //end of setInterval\n\n} //end of animateWagon()", "function toggleGifAnimation() {\n\n\n //set variable called 'state' to value of 'data-state' attribute\n var state = $(this).attr('data-state') ;\n \n \n\n if (state == 'still') {\n //set 'src' attribute to 'data-animate' value\n $(this).attr('src', $(this).attr('data-animate') );\n //set 'data-state' attribute to 'animate'\n $(this).attr('data-state', 'animate');\n }\n else if (state == 'animate') {\n //set 'src' attribute to 'data-still' value\n $(this).attr('src', $(this).attr('data-still') );\n //set 'data-state' attribute to 'still'\n $(this).attr('data-state', 'still' );\n }\n\n}", "function moveStop() {\n var state = $(this).attr(\"data-state\");\n var animateImage = $(this).attr(\"data-animate\");\n var stillImage = $(this).attr(\"data-still\");\n var $this = $(this);\n\n if (state == \"still\") {\n $this.attr(\"src\", animateImage);\n $this.attr(\"data-state\", \"animate\");\n }\n\n else if (state == \"animate\") {\n $this.attr(\"src\", stillImage);\n $this.attr(\"data-state\", \"still\");\n }\n }", "function playGiphy() {\n var still = $(this).attr('data-still');\n var animated = $(this).attr('data-animated');\n var state = $(this).attr('data-state');\n\n if (state === 'still') {\n // Play Image\n $(this).attr({\n 'data-state': 'play',\n src: animated\n });\n } else {\n // Pause image\n $(this).attr({\n 'data-state': 'still',\n src: still\n });\n }\n}", "showOnce() {\n image(SkyImg, this.xSky - width, 0);\n }", "function imgToggler() {\n // Check if current image is still or animate and toggle\n if ($(this).attr(\"data-state\") === \"still\") {\n $(this).attr(\"src\", $(this).attr(\"data-animate\"));\n $(this).attr(\"data-state\", \"animate\");\n } else {\n $(this).attr(\"src\", $(this).attr(\"data-still\"));\n $(this).attr(\"data-state\", \"still\");\n }\n clickedGif = $(this).parent();\n }", "function barber() {\n\tif (barberClicked == false) {\n\t\tdocument.getElementById('barberGo').src=barberGif.src;\n\t\tbarberClicked = true;\n\t} else {\n\t\tdocument.getElementById('barberGo').src=barberJpeg.src;\n\t\tbarberClicked = false;\n\t}\n}", "function ocupar2(){\n if(!animation2){\n if(ocupado2){\n img2DespY = 1;\n ocupado2 = false;\n }else {\n img2DespY = -1;\n ocupado2 = true;\n }\n animation2=true;\n interval2 = setInterval(moveCar2,20);\n }\n}", "function changeGifState(gifId) {\n //alert (\"changegif \" + gifId);\n let gif = document.getElementById(gifId);\n let state = gif.getAttribute(\"data-state\");\n if (state === \"still\") {\n event.target.setAttribute(\"src\", event.target.getAttribute(\"data-animate\"));\n event.target.setAttribute(\"data-state\", \"animate\");\n } else {\n event.target.setAttribute(\"src\", event.target.getAttribute(\"data-still\"));\n event.target.setAttribute(\"data-state\", \"still\");\n }\n}", "function catWalkLeft() {\n \n var oldLeft = parseInt(img.style.left);\n var newLeft = oldLeft - 10;\n img.style.left = newLeft + 'px';\n \n if (newLeft == -300) {\n clearInterval(timer2);\n superman.setAttribute(\"class\", \"\"); // off superman gif\n img.src = 'http://www.anniemation.com/clip_art/images/cat-walk.gif'\n timer = setInterval(catWalkRight, 50);\n };\n}", "function anim() {\r\n Loop();\r\n requestAnimFrame(anim);\r\n }", "function cloudAnimation() {\n\t\tlet tl = gsap.timeline({repeat: -1});\n\t\ttl\n\t\t .to('#myAd_clouds', {duration: 45, backgroundPositionX: 649, ease: \"none\"})\n\t}", "function checkTheCircles() {\n switch (page) {\n case 1:\n circle1.src = \"/images/circle.png\";\n circle2.src = \"/images/circle-empty.png\";\n circle3.src = \"/images/circle-empty.png\";\n break;\n case 2:\n circle1.src = \"/images/circle-empty.png\";\n circle2.src = \"/images/circle.png\";\n circle3.src = \"/images/circle-empty.png\";\n break;\n case 3:\n circle1.src = \"/images/circle-empty.png\";\n circle2.src = \"/images/circle-empty.png\";\n circle3.src = \"/images/circle.png\";\n break;\n }\n\n // give some time for the animation to complete.\n setTimeout(() => {\n moving = false;\n }, 1000);\n}", "function finishNewGif(){\n // stoppeo el recorder y timer. Estilo tambien la pantalla\n recorder.stopRecording( function(){\n console.log(\"Finalizando gifo...\")\n finalizar.style.display = \"none\"; \n\n stopTimer();\n\n timer.style.display = \"none\";\n subir.style.display = \"block\";\n repeat.style.display = \"inline\";\n });\n}", "function stop () {\n speedX = 0;\n speedY = 0;\n image.src = \"./images/sad.png\"; \n}", "function clearGif(){\n $(\"#gifs-appear-here\").empty();\n }", "function toggleGif(thisGif) {\n if (thisGif.attr(\"data-imgtype\") === \"still\") {\n var gifUrl = thisGif.attr(\"data-gifurl\");\n thisGif.attr(\"src\", gifUrl);\n thisGif.attr(\"data-imgtype\", \"gif\");\n }\n else {\n var stillUrl = thisGif.attr(\"data-stillurl\");\n thisGif.attr(\"src\", stillUrl);\n thisGif.attr(\"data-imgtype\", \"still\");\n }\n}", "function areGifWellSet(){\n let bool = true;\n let i = 0 ;\n const len = gifClickZone.length;\n while(i < len && bool){\n if(gifClickZone[i].id[2][gifOnScene[i].get_current_frame()] != 2){\n bool = false;\n }\n i++;\n }\n return bool;\n}", "function ironManGif(){\n var ironManPicture =\"https://media2.giphy.com/media/Uuo7YI3FwcTAI/200_s.gif\"\n var img = document.getElementById('im1')\n img.src = ironManPicture;\n img.style.display = \"inline-block\";\n\n var ironManPicture =\"https://media3.giphy.com/media/wohOGFXEDzg8U/200_s.gif\"\n var img = document.getElementById('im2')\n img.src = ironManPicture;\n img.style.display = \"inline-block\";\n\n var ironManPicture =\"https://media2.giphy.com/media/eqnT3nCRaXP8s/200_s.gif\"\n var img = document.getElementById('im3')\n img.src = ironManPicture;\n img.style.display = \"inline-block\";\n\n var ironManPicture =\"https://media2.giphy.com/media/rNNYWUpnLDR0k/200_s.gif\"\n var img = document.getElementById('im4')\n img.src = ironManPicture;\n img.style.display = \"inline-block\";\n\n var ironManPicture =\"https://media0.giphy.com/media/3BWLv26GvtamY/200_s.gif\"\n var img = document.getElementById('im5')\n img.src = ironManPicture;\n img.style.display = \"inline-block\";\n\n var ironManPicture =\"https://media1.giphy.com/media/XglCYiJb4duEw/200_s.gif\"\n var img = document.getElementById('im6')\n img.src = ironManPicture;\n img.style.display = \"inline-block\";\n }", "function animateImageA() { \n if (keeprunning === true || secondPlayerAnimate === true) { \n $('.a').animate({top: makeNewPosition()[0], left: makeNewPosition()[1] }, 3000, function() { // console.log('a'); \n animateImageA();\n });\n }\n }", "function spin() {\n\tlargeImage.style.transform += \"rotate(0.1deg)\";\n\tsetInterval(spin, 40);\n}", "function img_light_r() {\n\t\t$('.img_light_r').velocity(\n\t\t{\n\t\ttop: 50,\n\t\topacity: 1,\n\t\t},\n\t\t500);\n\t}" ]
[ "0.68467385", "0.6639768", "0.661927", "0.6576437", "0.6525546", "0.6523847", "0.650001", "0.64799887", "0.64518267", "0.63920295", "0.6387297", "0.633111", "0.6308683", "0.62749034", "0.6272526", "0.626896", "0.6259028", "0.6236334", "0.620578", "0.6199799", "0.61984265", "0.6194435", "0.61621916", "0.6149562", "0.6135324", "0.6125327", "0.61182195", "0.60855806", "0.60704064", "0.60639787", "0.60566455", "0.6042131", "0.6040464", "0.603694", "0.6033815", "0.60331684", "0.6030524", "0.6028236", "0.6022117", "0.6020052", "0.6017152", "0.6010829", "0.600048", "0.5999151", "0.5995328", "0.5991019", "0.59892803", "0.5976882", "0.59764904", "0.59664935", "0.5961361", "0.5948609", "0.5947593", "0.5946283", "0.59261185", "0.5922805", "0.5914463", "0.5912383", "0.5910155", "0.58962244", "0.58952045", "0.5892596", "0.5888693", "0.5888061", "0.5882967", "0.5876063", "0.5866667", "0.5850178", "0.5844714", "0.5841402", "0.58399105", "0.5834454", "0.58298075", "0.5815515", "0.58150303", "0.5812754", "0.5803613", "0.5801197", "0.5791595", "0.5791151", "0.57881165", "0.5786894", "0.5783356", "0.5778811", "0.57785034", "0.5774996", "0.57738185", "0.5766211", "0.5761593", "0.5759215", "0.57537866", "0.57453877", "0.57412535", "0.5740665", "0.57376355", "0.57304263", "0.5726675", "0.57255083", "0.5723464", "0.5718237", "0.5713785" ]
0.0
-1
generates initial screen / home page
function initialScreen() { startScreen = "<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block startbtn' href='#' role='button'>Click Here To Start</a></p>"; $(".mainDiv").html(startScreen); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function home(){\n\tapp.getView().render('vipinsider/insider_home.isml');\n}", "function displayHome() {\n\tvar message = HomeServices.generateHome();\n\tdisplay = document.getElementById(\"displayWindow\");\n\tif(message) {\n\t\tdisplay.innerHTML = message;\n\t}\n\telse {\n\t\tdisplay.innerHTML = \"<h1>The 'generate home' message returned was NULL</h1>\";\n\t}\n\n\t$('#displayWindow').trigger(\"create\");\n}", "function createHomePage() {\n // Ensures that the choices are hidden\n btnGroup.addClass(\"hide\");\n\n // Hides the home button\n homeBtn.addClass(\"hide\");\n\n // Unhides the highscores button\n highscoresBtn.removeClass(\"hide\");\n\n // Changes header\n $(\"#header\").text(\"Coding Quiz Challenge\");\n\n // Empties content element\n contentEl.empty();\n\n // Creates paragraph element\n var introParagraph = $(\"<p>\").addClass(\"intro-paragraph\");\n\n // Adds text to paragraph element\n introParagraph.text(\"Try to answer the following code-related question within the time limit. Keep in mind that incorrect answers will penalize your score/time by ten seconds!\");\n\n // Creates start button element\n var startButton = $(\"<button>\").addClass(\"start-button\");\n\n // Adds text to start button element\n startButton.text(\"Start\");\n\n // Appends both elements to the content div\n contentEl.append(introParagraph);\n contentEl.append(startButton);\n }", "function displayHome(ctx) {\n if (!auth.isAuth()) {\n ctx.loadPartials({\n header: './templates/common/header.hbs',\n footer: './templates/common/footer.hbs',\n loginForm: './templates/forms/loginForm.hbs',\n registerForm: './templates/forms/registerForm.hbs'\n }).then(function () {\n this.partial('./templates/welcome.hbs');\n })\n } else {\n ctx.redirect('#/catalog');\n }\n }", "function initialisePage(){\n\t\t\tcurrent_tab = \"about\";\n\t\t\tgenerateNav(register_navevents);\n\t\t\tgenerateFramework(current_tab, generatePage);\n\t\t\t// Enable button again\n\t\t\tbuttonOff();\n\t\t}", "function loadInitialPage() {\n var props = new Object();\n\n // when the user first opens the website\n props[\"loadType\"] = \"defaultLoad\";\n props[\"pageExtension\"] = \"/\";\n\n ReactDOM.render(React.createElement(Home, props), document.getElementById(\"root\"));\n}", "function createInitialsPage() {\n // Hides both nav buttons and the choices\n homeBtn.addClass(\"hide\");\n highscoresBtn.addClass(\"hide\");\n btnGroup.addClass(\"hide\");\n\n // Changes the header\n $(\"#header\").text(\"You got a highscore!\");\n\n // Displays the final score in a message\n var scoreMessage = $(\"<p>\").text(\"Your final score was \" + timeRemaining);\n\n // Appends the scoreMessage to the content div\n contentEl.append(scoreMessage);\n \n // Creates a form object\n var inputForm = $(\"<form>\").addClass(\"input-form\");\n\n // Creates a text input box with a placeholder, minimum length, and maximum length\n var inputBox = $(\"<input>\").attr(\"type\", \"text\");\n inputBox.addClass(\"initials-input\");\n inputBox.attr(\"placeholder\", \"Enter your initials here\");\n inputBox.attr(\"minlength\", \"1\");\n inputBox.attr(\"maxlength\", \"3\");\n\n // Appends the inputBox to the inputForm\n inputForm.append(inputBox);\n\n // Creates a submit button object\n var submitBtn = $(\"<input>\").attr(\"type\", \"submit\");\n submitBtn.addClass(\"submit-btn\");\n\n // Appends the submitBtn to the inputForm\n inputForm.append(submitBtn);\n\n // Appends the inputForm to the contentDiv\n contentEl.append(inputForm);\n }", "function showHomePage(page_name) {\n var root = $('<div>').addClass(_classes[page_name]).height(window.innerHeight);\n\n /* Title */\n //$('<figure>').append($('<img>').attr('src', 'resources/images/splash_title.png')).appendTo(root);\n /* Landing Logo */\n $('<div>').addClass('landing-logo fadeMe').appendTo(root).attr(\"style\", \"display:none\");\n /* Bottom */\n var qLandingBottom = $('<div>').addClass('landing-bottom fadeMe').attr(\"style\", \"display:none\").append($('<span>').html('Loading...'));\n qLandingBottom.appendTo(root);\n /* Loading Image */\n //$('<div>').addClass('landing-loader').append($('<img>').attr('src', 'resources/images/landig_loader.png')).appendTo(qLandingBottom);\n\n /* Google Anlytics */\n ga('send', 'screenview', {'screenName': 'Home'});\n\n return root;\n }", "function showHome(request){\n\trequest.respond(\"This is the home page.\");\n}", "function initHome() {\n\tgetCurrentUser();\n\tinitializeStudentInfo();\n\tloadCourses(buildCourseContent);\n\tprogressBarFunc();\n\tw3_open(); \n}", "function pageHome(request, response) {\r\n response.send('<h1>Welcome to Phonebook</h1>')\r\n}", "function _init() {\r\n // set page <title>\r\n Metadata.set(home.title);\r\n\r\n // activate controller\r\n _activate();\r\n }", "function loadHome() {\n\tapp.innerHTML = nav + homepage;\n}", "function loadHomePage(){\n\tloadNavbar();\n\tloadJumbotron();\n\tgenerateCarousels();\t\n}", "function drawHomePage(req, res) {\n var db = req.db;\n var collection = db.get('pageContent');\n\n var data = collection.find({}, {}, function(e, docs) {\n var homeIntro = docs[0].homeIntro;\n var homeTitle = docs[0].homeTitle;\n var usrname = loggedInUser(req);\n\n if (usrname) {\n res.render('index', { title: homeTitle,\n intro: homeIntro,\n pagename: 'index',\n loginsite: 'Logout',\n username: usrname });\n }\n else {\n res.render('index', { title: homeTitle,\n intro: homeIntro,\n pagename: 'index',\n loginsite: 'Login',\n username: usrname });\n }\n });\n}", "function homePageLoader() {\n\n pageCreator(\"home-page\");\n navBar(\"home-page\");\n restaurantLogo();\n bookTableBtn(\"home-page\");\n socialMedia();\n}", "function home(req, res) {\n return res.render('index', {\n ENV: JSON.stringify(ENV), // pass environment variables to html\n title: 'Hack University',\n page: 'home',\n url: `${HOST}`,\n layout: 'layout' // change layout\n });\n}", "function renderHomePage(name) {\n\tres.write(\"<html><head><title>Home</title></head>\");\n\tres.write(\"<body>\")\n\tres.write(\"<h1>This is the home page</h1>\");\n\tres.write(\"<h2>Welcome \" + name + \"</h2>\");\n\tres.write(\"</body></html>\");\n\tres.end();\n\t\n}", "function go_home() {\n\tdocument.getElementById(\"display-screen\").innerHTML = loading;\n\tx_home_page(\"\", do_display);\t\t\t\t\n}", "function renderStartPage() {\n addView(startPage());\n}", "function home(req,res){\n query.getAll().then(function(resultat,err){\n if(err) throw err;\n res.render('home', {home:resultat});\n });\n}", "function renderStartPage(){\n const setHtml = generateIntro();\n $('main').html(setHtml);\n}", "function showHomePage() {\n $('#greet-user').text('Bookmarks');\n $('#logout-button').hide();\n $('#login-div').show();\n $('#register-div').hide();\n $('#bookmarks-view').hide();\n }", "function buildFrontPage() {\n $('.menu-home').toggleClass('selected-text');\n initHomepage()\n}", "function init() {\n createWelcomeGraphic();\n console.log('WELCOME TO ASSOCIATE MANAGER!');\n console.log('FOLLOW THE PROMPTS TO COMPLETE YOUR TASKS.');\n}", "function displayHomePage() {\n //clear the document\n document.body.innerHTML = \"\";\n\n var titleDiv = createDiv();\n titleDiv.id = \"titleDiv\";\n\n var title = createHeadings(\"Fun with Math\");\n title.id = \"title\";\n titleDiv.appendChild(title);\n\n var barnImage = createImage(\"images/barn.png\");\n barnImage.id = \"barnHome\";\n\n var startButton = createButton(\"Start\");\n startButton.id = \"startButton\";\n startButton.onclick = chooseLevel;\n\n var pigImage = createImage(\"images/pig2.png\");\n pigImage.id = \"pigHome\";\n}", "function renderHome(req, res) {\n var users = Room.getRoom('').getUsernames()\n , room_state = { users: users };\n //console.log('rendering home; user is', req.user);\n\n if (_.isObject(req.user)) { \n if ( _.isString(req.query.joined_table_name) ) {\n req.user.current_table_names.push(req.query.joined_table_name);\n }\n res.render('index', _.extend(req.user, {\n title: 'Bitcoin Poker'\n , room_state: JSON.stringify(room_state)\n , user: req.user\n , message: getFlashFromReq(req)\n }));\n }\n else {\n console.log('user is not logged in. rendering welcome environment');\n res.redirect('/welcome');\n }\n}", "function goHome() {\n if (!isLoggedIn()) {\n return;\n }\n var home = '../personal/courses.html';\n window.location.assign(home);\n}", "function landingView() {\n\n // generate button ui\n let btn = UICtrl.mainMenuBtn();\n mainMenuEAL(btn.ID, btn.bStr);\n initializeTableConfig()\n // load viewport\n\n }", "function renderHomePage(context) {\n ctxHandler(context);\n\n this.loadPartials({\n header: './templates/common/header.hbs',\n footer: './templates/common/footer.hbs',\n login: './templates/welcome/login.hbs',\n register: './templates/welcome/register.hbs',\n }).then(function () {\n this.partial('./templates/welcome/welcome.hbs');\n })\n }", "function appDefaultView(){\n\t//clears everything on the page\n\t\n\tclearSection();\n\t\n\tvar local_simulation = get_local_simulation();\n\t//sets the top bar to be the default look\n\tdefaultheaderView();\n\tif(getVerified() == false){\n\t\talert('You do not have permission to access this. Please get a token first.');\n\t}else{\n\t\t//sets the page to view to 'user information' page\n\t\tvar apps = DeviceAppsListTemplate(local_simulation.apps);\n\t\tvar content = getContainer();\n\t\tif(local_simulation.apps==''||local_simulation.apps==null){\n\t\t\tapps += \"No applications are registed to this simulation.\";\n\t\t}\n\t\tcontent.innerHTML = apps;\n\t\t//sets the sidebar to the sidebar for when inside a simulation\n\t\tsimulationSideBarView();\n\t\tremoveClass('active');\n\t\tdocument.getElementById('my-apps-link').className='active';\n\t}\n}", "function loadApp() {\n console.log(\"loadApp\");\n displayHomePage();\n}", "function goHome(req, res) {\n if (req.session.loggedIN) {\n req.flash('succes', 'Hoi ' + req.session.userName);\n res.render('readytostart');\n } else {\n res.render('index');\n }\n}", "async show() {\n // Anzuzeigenden Seiteninhalt nachladen\n let html = await fetch(\"page-start/page-start.html\");\n let css = await fetch(\"page-start/page-start.css\");\n\n if (html.ok && css.ok) {\n html = await html.text();\n css = await css.text();\n } else {\n console.error(\"Fehler beim Laden des HTML/CSS-Inhalts\");\n return;\n }\n\n // Seite zur Anzeige bringen\n this._pageDom = document.createElement(\"div\");\n this._pageDom.innerHTML = html;\n\n await this._renderReciepts(this._pageDom);\n\n this._app.setPageTitle(\"Startseite\", {isSubPage: true});\n this._app.setPageCss(css);\n this._app.setPageHeader(this._pageDom.querySelector(\"header\"));\n this._app.setPageContent(this._pageDom.querySelector(\"main\"));\n\n this._countDown();\n }", "function HomeHandler (request, reply) {\n reply.view('views/home.html');\n}", "function initialScreen() {\n \tstartScreen = \"<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n \t$(\".mainArea\").html(startScreen);\n }", "function initializeWebsite() {\n const content = document.querySelector(\"#content\");\n content.prepend(generateHeader());\n content.appendChild(generateHome());\n content.appendChild(generateFooter());\n\n // Set home button as active on default\n const activeBtn = document.querySelector('button[data-id=\"Home\"]');\n activeBtn.classList.add(\"nav-btn_active\");\n}", "function loadHome() {\r\n hideall();\r\n\r\n var top = document.getElementById(\"Welcome\");\r\n\r\n top.innerHTML=(\"Weclome Home \" + user);\r\n \r\n $(\"#home\").show();\r\n $(\"#sidebar\").show();\r\n deactiveAll();\r\n $(\"#side-home\").addClass(\"active\");\r\n $(\"#navbar\").show();\r\n\r\n // Additonal calls \r\n clearCalendar();\r\n makeCalander();\r\n}", "function splashPage(req, res) {\n res.render(\"index\");\n}", "async show() {\n // Anzuzeigenden Seiteninhalt nachladen\n let html = await fetch(\"page-overview/page-overview.html\");\n let css = await fetch(\"page-overview/page-overview.css\");\n\n if (html.ok && css.ok) {\n html = await html.text();\n css = await css.text();\n } else {\n console.error(\"Fehler beim Laden des HTML/CSS-Inhalts\");\n return;\n }\n\n // Seite zur Anzeige bringen\n let pageDom = document.createElement(\"div\");\n pageDom.innerHTML = html;\n\n this._renderBoatTiles(pageDom);\n\n this._app.setPageTitle(\"Startseite\");\n this._app.setPageCss(css);\n this._app.setPageHeader(pageDom.querySelector(\"header\"));\n this._app.setPageContent(pageDom.querySelector(\"main\"));\n }", "@appRoute(\"(/)\")\n startIndexRoute () {\n System.import(\"../views/home\").then(View => App.getContentContainer().show(new View.default()) );\n }", "function home(req, res) {\n if (!req.session.nameID) {\n res.render('name');\n } else {\n res.redirect('succes');\n }\n}", "function initialScreen() {\n startScreen = \"<p class='text-center main-button-container'><a class='btn btn-danger btn-lg btn-block start_button' href='#' role='button'>Start Quiz</a></p>\";\n $(\"#wrapper\").html(startScreen);\n }", "function homePage() {\n window.location.href = initApi.homeUrl;\n //location.reload();\n }", "function load_home_page() {\n page = home_page;\n load_page();\n}", "function generateStartPage() {\n const assets = getAssets('startPage');\n return `<div class=\"row\">\n <div class=\"col-6\">\n <img src=\"${assets.startImg}\" alt=\"${assets.startImg}\">\n </div>\n <div class=\"col-6\">\n <p>${assets.startMsg}</p>\n <button type=\"button\" class=\"btnStartQuiz\">Begin Quiz</button>\n </div>\n </div>`;\n}", "function home() {\n\t\t\tself.searchText('');\n\t\t\tconfigData.page = 1;\n\t\t\tgetPhotos();\n\t\t}", "function initialScreen() {\n startScreen = \"<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n $(\".mainArea\").html(startScreen);\n }", "function initialScreen() {\n startScreen = \"<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n $(\".mainArea\").html(startScreen);\n }", "function initialScreen() {\n startScreen = \"<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n $(\".mainArea\").html(startScreen);\n }", "function startPage() {\n var img = new Image();\n img.onload = function() {\n cr.ui.replaceContent(cr.ui.template.render_template(\"admin/start_page.html\"));\n };\n img.src = \"../asset/css/admin/title_img.png\";\n }", "function createWelcomePage(language) {\n\tshrinkTitle(language);\n\tintroduceTest(language);\n\taddTestSpecificationsListeners(language);\n}", "genPrimaryContent(page) {\n switch (page) {\n\n case 'EXPLORER':\n return (\n <Explorer\n position={this.state.position}\n getPosition={this.getPosition}\n />\n );\n\n default:\n return (\n <Welcome\n title={Texts.title}\n label={Texts.titleButtonLabel}\n onClick={this.handleAuthSubmit}\n />\n );\n }\n }", "function homePage(req, res) {\n rivets.findAll().then(function(rivets){\n res.render('index', {rivets: rivets})\n }).catch(function(error){\n res.send(\"Couldn't fetch rivets\")\n })\n}", "function startScreen() {\n\t\t\tinitialScreen =\n\t\t\t\t\"<p class='text-center main-button-container'><a class='btn btn-default btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n\t\t\t$( \".mainArea\" )\n\t\t\t\t.html( initialScreen );\n\t\t}", "function mobileLanding() {\n\tapp.getView().render('turnto/mobilelanding');\n}", "function displayHome(pageToRemove) {\r\n\t\tcalculateNewBill(); // calculate for the homescreen\r\n\t\tremovePage(pageToRemove);\r\n\t\tdisplayPage(\"#mainOptions\");\r\n\t\tfocusOnInput(\"#optionsChoice\");\r\n\t\tcurrentPage = \"mainPage\";\r\n\t}", "function setUpPage(){\r\n displayHeader();\r\n displayFooter();\r\n displaySideBar();\r\n createEventListeners();\r\n}", "function goStartPage() {\r\n document.querySelector(\"#home-page\").style.display = \"none\";\r\n document.querySelector(\"#lets-start-page\").style.display = \"flex\";\r\n}", "function renderWelcomeScreen(){\r\n getTemplateAjax('./templates/welcome.handlebars', function(template) {\r\n welcomeData =\r\n {welcomeTitle: \"Hey. Where do you want to park?\", welcomeMessage: \"Single-origin coffee portland squid tofu 3 wolf moon fixie thundercats single-origin coffee tofu jean shorts.\"}\r\n $('#welcomeScreen').html(template(welcomeData));\r\n })\r\n }", "function renderHomePage() {\n var items = $('.cvt-report li');\n if (items) {\n items.remove();\n }\n \n var page = $('.home');\n page.addClass('visible');\n }", "function render() {\r\n let content = '';\r\n if (STORE.view === 'home') {\r\n $('main').html(welcomePage());\r\n }\r\n else if (STORE.view === 'question') {\r\n content = questionAsked();\r\n content += generateAnswers();\r\n content += questionAndScoreStanding();\r\n $('main').html(`<form>${content}</form>`);\r\n } else if (STORE.view === 'feedback') {\r\n answerFeedback();\r\n } else if (STORE.view === 'score') {\r\n finalScore();\r\n }\r\n}", "render() {\n this.configPage();\n history.pushState({ href: '/first-entrance' }, null, '/first-entrance');\n this.wrapper.append(this.main);\n\n this.main.innerHTML = firstTemplate();\n\n document.querySelector('.icon-list').classList.add('active');\n\n this.attachListeners(this.main);\n }", "static goToHome() {\n browser.refresh();\n new MenuBar().clickHome();\n }", "function index (request, response) {\n var contextData = {\n 'pageTitle': 'Kognas in CH',\n };\n response.render('index.html', contextData);\n}", "function setUpPage(){\r\n displayHeader();\r\n displayFooter();\r\n displaySideBar();\r\n\r\n createEventListeners();\r\n}", "function startApp() {\n Backbone.history.start({\n pushState: false\n });\n\n var isFirstLoad = localStorage.getItem('firstLoad') === null;\n\n if (isFirstLoad) {\n var onboardView = new OnboardView();\n\n $('body').append(onboardView.render().el);\n localStorage.setItem('firstLoad', 1);\n }\n}", "function initialScreen() {\n\tstartScreen = \"<p><a class='btn-primary' href='#' role='button'><strong>Start Exam</strong></a></p>\";\n\t$(\".mainArea\").html(startScreen);\n}", "async function app() {\n //Render and display app logo\n renderLogo();\n //Inquirer \"home page\" which lists all options to the user\n appHome();\n}", "function initialize() {\n $.get(\"views/AdminHomePage.html\")\n .done(setup)\n .fail(error);\n }", "function welcomeScreen(){\n\t//loads existing jobs\n\tif (localStorage[\"timepunch.totaljobs\"] != null){\n\t\tfor(var count = 0; count < parseInt(localStorage[\"timepunch.totaljobs\"]); count ++){\n\t\t\tprintJob(count);\n\t\t}\n\t}\n\t//initializes job count\n\t//first time app is loaded\n\telse {\n\t\tlocalStorage[\"timepunch.totaljobs\"] = 0;\n\t}\n}", "function index() {\n createMainWin().open();\n }", "function pageGenerator(pagename, req, res, pgloging = false, pgadmin = false, pgname=\"A user\"){\n var title = \"\";\n if(pagename == \"index\"){\n title = \"Bonline\";\n } else {\n title = pagename;\n }\n msg1=\"\";\n msg1 = msg1 + \"<head>\";\n msg1 = msg1 + \"<title>Welcome to \" + title + \"</title>\";\n msg1 = msg1 + '<LINK href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">';\n msg1 = msg1 + \"</head>\";\n msg1 = msg1 + \"<h1>Welcome to the \" + title + \"</h1>\";\n text1 = menuGenerator(pagename, req, res, pgloging, pgadmin, pgname);\n msg1 = msg1 + text1;\n msg1 = msg1 + '</body></html>';\n return msg1;\n}", "function goHome() {\n WinJS.log && WinJS.log(\"You are home.\", \"sample\", \"status\");\n }", "function setupPage(){\n Card.create();\n Menu.render();\n}", "async function home(evt) {\n evt.preventDefault();\n hidePageComponents();\n currentUser = await checkForUser();\n\n if (currentUser.userId !== undefined) {\n hidePageComponents();\n $graphs.show();\n $links.show();\n $logoutBtn.show();\n $userBtn.text(`Profile (${currentUser.username})`);\n $userBtn.show();\n } else {\n $loginContainer.show();\n $welcome.show();\n $loginBtn.show();\n $loginForm.show();\n $signupBtn.show();\n $loginBtn.addClass(\"border-bottom border-start border-3 rounded\");\n }\n}", "function go_mainpage(){\n\n object.getpage('mainpage.html');\n }", "function render(st = state.Home) {\n document.querySelector(\"#root\").innerHTML = `\n ${Header(st)}\n ${Nav(state.Links)}\n ${Main(st)}\n ${Footer()}\n `;\n\n router.updatePageLinks();\n addEventListeners(st);\n\n}", "function buildPage() {\n // Set the title with the location name at the first\n // Gets the title element so it can be worked with\n let pageTitle = document.querySelector('#page-title');\n // Create a text node containing the full name\n let fullNameNode = document.createTextNode(sessStore.getItem('fullName'));\n // inserts the fullName value before any other content that might exist\n pageTitle.insertBefore(fullNameNode, pageTitle.childNodes[0]);\n // When this is done the title should look like this:\n // Soda Springs, Idaho | mybetterweather.com\n }", "function renderPage() {\n\n if (STORE.view === 'start') {\n if (game1.sessionToken) {\n $('start-button').attr('disabled', false);\n }\n $('.page').html(renderStartView());\n }\n if (STORE.view === 'questions') {\n console.log('about to render');\n $('.page').html(renderQuestionView());\n }\n if (STORE.view === 'feedback' && STORE.showFeedback === true) {\n $('.page').html(renderFeedbackView());\n }\n if (STORE.view === 'results') {\n $('.page').html(renderResultsView());\n }\n}", "function initScreen() {\n\tstartScreen = \"<p class='text-center introText'>Through this trivia game you'll test your knowledge about Jon,<br> and perhaps learn a thing or three.<a class='btn btn-danger btn-lg btn-block start-button' role='button'>Start Quiz</a></p>\";\n\t$(\".mainArea\").html(startScreen);\n}", "function loadHome(){\r\n switchToContent(\"page_home\");\r\n}", "function showHome(request){\n request.serveFile(\"index.html\"); \n}", "function initialScreen() {\n\tstartScreen = \"<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n\t$(\".mainArea\").html(startScreen);\n}", "function index_page() {\n //Replaces index page with template page.\n window.open(\"index.html\", \"_self\");}", "function initializePage() {\n\t// add any functionality and listeners you want here\n\n\t//listener function for the content buttons in the home page.\n\t\n\t\n\t\n\t\n}", "function walkHome(){\r\n\tbackground(0);\r\n\tfirstOption.hide();\r\n\tsecondOption.hide();\r\n\tuserName.hide();\r\n\r\n\t//change the text for the title\r\n\ttitle.html(\"You have gone home. Good Night.\");\r\n\r\n\t//startOver = createA(\"index.html\", \"Start Over\")\r\n\t//firstOption.mousePressed(startOver);\r\n}", "function introScreen() {\n SDPresents = new image(DEMO_ROOT + \"/def/resources/senior.png\");\n presentsScreen = SeniorDads.ScreenHandler.Codef(640,400,name,zIndex++);\n \t\tSDPresents.draw(presentsScreen,0,0);\n \t}", "function renderPage() {\n // set up any necessary events\n Main.addClickEventToElement(document.getElementById(\"homeOptP\"), function () {\n Main.changeHash(Main.pageHashes.home);\n });\n Main.addClickEventToElement(document.getElementById(\"infoOptP\"), function () {\n Main.changeHash(Main.pageHashes.info);\n });\n Main.addClickEventToElement(document.getElementById(\"quizOptP\"), function () {\n Main.changeHash(Main.pageHashes.quiz);\n });\n Main.addClickEventToElement(document.getElementById(\"econ\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Economy\");\n _loadPlatformSection(_platformSections.economy);\n });\n Main.addClickEventToElement(document.getElementById(\"immigration\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Immigration\");\n _loadPlatformSection(_platformSections.immigration);\n });\n Main.addClickEventToElement(document.getElementById(\"domSoc\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Domestic Policy\");\n _loadPlatformSection(_platformSections.domestic);\n });\n Main.addClickEventToElement(document.getElementById(\"foreignPol\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Foreign Policy\");\n _loadPlatformSection(_platformSections.foreign);\n });\n\n // show page\n Main.sendPageview(Main.analyticPageTitles.platform);\n Main.showPage(Main.pageContainers.partyPlatformContainer);\n }", "function init() {\n\n\t\t// > = greatar than\n\t\t// < = less than\n\t\t\n\n\t\t/* -------------------------------------------------- */\n\t\t/* CACHE\n\t\t/* -------------------------------------------------- */\n\t\t\n\t\tvar page = $('.page').data('page');\n\n\n\t\t/* -------------------------------------------------- */\n\t\t/* HOME\n\t\t/* -------------------------------------------------- */\n\n\t\tif ( page === 'index' ) {\n\t\t\t\n\t\t\tconsole.log('Home Page');\n\t\t\t\n\t\t}\n\t \n\t\t\n\t /* -------------------------------------------------- */\n\t\t/* PRIVACY AND TERMS OF USE\n\t\t/* -------------------------------------------------- */\n\n\t\telse if ( page === 'legal' ) {\n\n\t\t\tconsole.log('Privacy and Terms of Use Page');\n\t\t\t\n\t\t}\n\t \n\t\t\n\t\t/* -------------------------------------------------- */\n\t\t/* ERROR\n\t\t/* -------------------------------------------------- */\n\n\t\telse {\n\n\t\t\tconsole.log('Error Page');\n\t\t\t\n\t\t}\n\n\t}", "function renderBeginningPage(){\n console.log('setting page back to original VIEW state');\n\n $('#calicers-speach-text').html('Hello, my name is Calcifer.');\n $('#califers-text-input-box').show();\n\n }", "function welcome_page(request, response) {\n if(request.session.id) { return response.redirect('/account'); }\n return response.render(chamber.pages['welcome'], { signed_in: request.session.id || false });\n}", "function startPage() {\n $('main').html(startScreen());\n startQuizButton();\n}", "function renderStartQuiz() {\n //console.log('Generating start of quiz');\n $('.intro').html(generateStartPage());\n}", "function setHomeScreen(){\n var main = Ext.getCmp('MainPanel');\n var calendarButton = FRIENDAPP.app.getController('DashboardController').getCalendarButton();\n calendarButton.addCls('activeCls');\n FRIENDAPP.app.getController('DashboardController').activeButton = calendarButton;\n main.setActiveItem(1);\n return;\n }", "function updateWelcomeScreen () {}", "function displayMainPage() {\n const userNameInput = getUserInputID()\n if (!userNameInput) {\n _domUpdates_js__WEBPACK_IMPORTED_MODULE_4__.default.renderLoginFailedMsg()\n } else {\n getFetchedData(userNameInput)\n getTrips(userNameInput, tripsData, date)\n verifyLoginInput(userNameInput)\n }\n}", "function homeRouteHandler(request, response) {\n response.status(200).send('Welcome to City Explorer App');\n}", "function initSwitch() {\n\n // Load first page into container\n loadPage(\"home_onlineChoiceView.html\");\n}", "function homePage(req, res){\n\n var loginCookies = cookieUtils.getLoginCookies(req, res)\n if (loginCookies.uId && loginCookies.uAuth){\n dbLogin(req, res, loginCookies.uId, loginCookies.uAuth, useCookies=true)\n }else{\n console.log(\"Cookie authentication failed: no cookies set\")\n loader.loadHTML(res, loginPath, {\n\t\t\t\"heading\" : \"Hi and welcome\"\n\t\t})\n }\n}" ]
[ "0.7357644", "0.7179117", "0.7104492", "0.70907503", "0.68889254", "0.68687934", "0.6804751", "0.67880094", "0.67692447", "0.67104256", "0.6693577", "0.66696626", "0.6647739", "0.66474706", "0.66443276", "0.66066295", "0.65838253", "0.65696615", "0.65686077", "0.65462", "0.6529416", "0.6529367", "0.65078336", "0.6506812", "0.648523", "0.6477425", "0.64239556", "0.6413538", "0.64081794", "0.63953215", "0.63882047", "0.63852054", "0.6375819", "0.63471884", "0.63115454", "0.6309838", "0.6308279", "0.63054115", "0.6296186", "0.6290855", "0.6278673", "0.62774277", "0.6272739", "0.62698114", "0.6248176", "0.623368", "0.6210101", "0.61988205", "0.61988205", "0.61988205", "0.619745", "0.61920875", "0.61838543", "0.61580986", "0.6155507", "0.6150272", "0.614256", "0.61403763", "0.6127701", "0.6121849", "0.6114953", "0.6112506", "0.6112118", "0.61111283", "0.60995895", "0.60987496", "0.60872334", "0.6077263", "0.6071575", "0.6071127", "0.6061975", "0.6047925", "0.6046718", "0.60428387", "0.60410935", "0.60396445", "0.6036209", "0.60327697", "0.60259", "0.6018537", "0.60148096", "0.60076016", "0.60064965", "0.59957695", "0.59941626", "0.5981928", "0.5967273", "0.5965849", "0.59596735", "0.59569037", "0.5955902", "0.59526193", "0.59470516", "0.5939855", "0.59171444", "0.59045535", "0.590013", "0.59000677", "0.5896662", "0.5889313" ]
0.6127038
59
if the user does not select an answer before the timer runs out
function userLossTimeOut() { unansweredTally++; gameHTML = correctAnswers[questionCounter] + "" + losingImages[questionCounter]; $(".mainDiv").html(gameHTML); setTimeout(wait, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function answerCheck() {\n if (timeLeftPlay === 0) {\n pauseTimer = true;\n unanswered++;\n msgCreator(\"Time ran out!\", \"The correct answer is: \" + currentCorrectAnswer.answer, currentCorrectAnswer.image);\n setTimeout(unansweredPause, 3000);\n $(\".outOfTime\").text(unanswered);\n $(\"#gameDiv\").show();\n $(\"#gameStatDiv\").show();\n }\n }", "function checktimer(time) {\n //if you've run out of time, it will mark that you got it wrong and move to next question and restart timer\n if (timeLeft === 0) {\n timeLeft = 15;\n if (currentQuestion < triviaQuestions.length) {\n currentQuestion++;\n wrongChoices++;\n displayQuestion();\n }\n }\n}", "function showTimer() {\n seconds --;\n if \n (seconds < 1) {\n idle = true;\n clearInterval(timer);\n showAnswer();\n }\n }", "function userTimeout() {\n\t\tif (time === 0) {\n\t\t\t$(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n\t\t\tincorrectGuesses++;\n\t\t\tvar correctAnswer = questions[questionCounter].correctAnswer;\n\t\t\t$(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" + \n\t\t\t\tcorrectAnswer + \n\t\t\t\t\"</span></p>\" + \n\t\t\t\tquestions[questionCounter].image);\n\t\t\tsetTimeout(nextQuestion, 4000);\n\t\t\tquestionCounter++;\n\t\t}\n\t}", "function userTimeout() {\n\t\tif (time === 0) {\n\t\t\t$(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n\t\t\tincorrectGuesses++;\n\t\t\tvar correctAnswer = questions[questionCounter].correctAnswer;\n\t\t\t$(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" + \n\t\t\t\tcorrectAnswer + \n\t\t\t\t\"</span></p>\" + \n\t\t\t\tquestions[questionCounter].image);\n\t\t\tsetTimeout(nextQuestion, 4000);\n\t\t\tquestionCounter++;\n\t\t}\n\t}", "function selectAnswer(e) {\n var selectedBtn = e.target;\n correct = selectedBtn.dataset.correct;\n if (correct) {\n console.log(\"correct\");\n } else {\n console.log('wrongo');\n startTime -= 10;\n };\n if (startTime <= 0) {\n secondsLeft = 0;\n timerEl.innerText = '0';\n endGame();\n } else {\n currentQuestionIndex++;\n if (currentQuestionIndex == questions.length) {\n endGame();\n } else {\n setNextQuestion();\n };\n };\n}", "function questionTimedout() {\n acceptingResponsesFromUser = false;\n\n console.log(\"timeout\");\n $(\"#timer-view\").html(\"- -\");\n $(\".footer\").html(\"Darn! Time out! <br> The correct answer is <strong>\" + questions[currentQuestionToPlay].correctResponse + \"</strong>. <br>Waiting 5 seconds to go next!\");\n\n timeoutCount++;\n $(\"#timeout-view\").html(timeoutCount);\n waitBeforeGoingNextAutomatically();\n}", "function checkSelection() {\n var selection = quizOptions.value;\n if (i < quizContent.length) {\n if (selection === quizContent[i].answer) {\n showElement(answerResult);\n answerResult.textContent = \"Correct!\";\n userScore = userScore + 10;\n // this setTimeOut function keeps the answerResult box from flashing too fast; allows user to see the result\n setTimeout(nextQuestion, 500);\n } else if (selection !== \"\" && selection !== quizContent[i].answer) {\n showElement(answerResult);\n answerResult.textContent = \"Wrong!\";\n userScore = userScore - 10;\n if (secondsLeft >= 11) {\n secondsLeft = secondsLeft - 10;\n } else {\n secondsLeft = 1;\n renderSubmission();\n }\n setTimeout(nextQuestion, 500);\n }\n }\n}", "function outOfTime() {\n extraMessage.text(\"OOPS! TIME'S UP!\");\n extraMessage.css(\"visibility\", \"visible\");\n\n displayCorrectAnswer();\n\n // add 1 to count of unanswered questions\n unansweredCount++;\n\n // increment the question # counter\n questionCounter++;\n\n // stop the timer \n stopTimer();\n\n // after a delay, display a new question\n setTimeout(newQuestion, delayTime);\n }", "function checkAnswers() {\n if (userSelection == quizBank[questionCounter].correctAnswer) {\n score++;\n secondsLeft += 10;\n } else {\n secondsLeft -= 10;\n }\n questionCounter++;\n showQuestions();\n}", "function userTimeout() {\n if (time === 0) {\n $(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n incorrectGuesses++;\n var correctAnswer = questions[questionCounter].correctAnswer;\n $(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" + correctAnswer + \"</span></p>\" + \n questions[questionCounter].image);\n setTimeout(nextQuestion, 4000);\n questionCounter++;\n } \n }", "function selectanswer(event){\n\n var selectedanswer = event.target;\n if(selectedanswer.dataset.correct)\n {\n score = score + 10; //Add 10 point whenever answer is correct\n checkanswer(\"Correct\"); \n \n }else\n {\n checkanswer(\"Wrong\"); \n secondsLeft = secondsLeft - 10; //Reduce 10s from timer if answer is wrong\n }\n\n questionindex++;\n setnextquestion();\n\n\n}", "function selectAnswer() {\n \n if (this.value !== questions[currentQuestionIndex].answer) {\n secondsLeft -= 15;\n\n if (secondsLeft < 0) { \n secondsLeft = 0;\n }\n\n timerEl.textContent = secondsLeft;\n\n rightOrWrong.textContent = \"Wrong\"\n\n } else {\n rightOrWrong.textContent = \"Correct\";\n }\n\n rightOrWrong.setAttribute(\"class\", \"right-wrong\");\n setTimeout(function() {\n rightOrWrong.setAttribute('class', 'right-wrong hide');\n }, 1000);\n\n currentQuestionIndex++;\n\n if (currentQuestionIndex === questions.length) {\n addScoreTotal();\n } else {\n showQuestion();\n }\n}", "function userTimeout() {\n if(time=== 0){\n $(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n incorrectGuesses++;\n var correctAnswer=questions[questionCounter].correctAnswer;\n $(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" +\n correctAnswer = questions[questionCounter].correctAnswer;\n\n $(\"#gameScreen\").append (\"<p>The answer was <span class='answer'>\"+\n correctAnswer +\n \"</span></p>\" +\n questions[questionCounter].image);\n setTimeout(nextQuestion, 4000);\n questionCounter++;\n }\n }", "function answer1timeout(){\n \tunanswered++;\n \t$('#playerscore').show();\n \t$('#result').show();\n \tdisplayscore();\n \tstop();\n \t$(\"#display\").html('<h3>Time Remaining: 0 seconds</h3>');\n \t$('#questions').html('<img src=\"assets/images/wolverine.gif\" alt=\"wolverine\">');\n \t$('#result').html('<h4> Time&#39;s Up: Make up your mind civilian.</h4>');\n $('#choices1,#choices2,#choices3,#choices4').hide();\n setTimeout(quest2, 1000 * 5);\n }", "function incorrectChoice() {\n currentQuest++;\n feedback.innerHTML = \"Wrong...That cost you 10 seconds\";\n setTimeout(function() {\n feedback.innerHTML = \"\";\n }, 1750);\n timeLeft -= 10; \n if (currentQuest < contentArray.length){\n loadQuestion(currentQuest);\n } else (\n endDetect = true\n )\n}", "function timeQuestion() {\n //If is different is because the user have not responded all questions\n if (countQuestion != questionList.length) {\n countTime--;\n $(\"#time\").text(countTime);\n\n //If countTime is zero is because the time finished\n if (countTime == 1) {\n countLoose++;\n visibleAnswer(false, true);\n }\n }\n //The responded all question, and we have to stop timer\n else {\n clearInterval(time);\n }\n }", "function checkSelection() {\n console.log(\"check selection function reached\");\n \n // hide the questionAsked board and stop the timer\n $(\"#questionAsked\").hide();\n clearInterval(counter);\n $(\"#timerDiv\").html(\"&nbsp;\");\n \n // if answer was right\n if (userGuess.data(\"value\") == allQuestionsArray[gameVariables.currentQuestion].correctAnswer) {\n console.log(userGuess.data(\"value\"));\n console.log(\"correct\");\n // run the correctAnswer function\n correctAnswer();\n }\n // else if answer was wrong\n else {\n console.log(userGuess.data(\"value\"));\n console.log(\"incorrect\");\n // run the incorrectAnswer function\n incorrectAnswer();\n }\n \n }", "function checkTime() {\n setTimeout(function() {\n if (!game.quiz[game.p].answered && !cStatus.feedback.spoken && !game.german && !cStatus.speaking) {\n tellJoke();\n // checkTime();\n }\n }, LIMIT);\n}", "function unansweredNoti() {\n clearDivs();\n $('#timer').html(\"<p>Pick</p>\");\n unanswered++; // number of unaswered goes up\n showAnswers();\n stopCounting();\n setTimeout(playGame, 5000);\n }", "function selectAnswer(answer){\n console.log(answer)\n if (answer == questions[questionNum].correct){\n console.log('correct');\n } else {\n timeleft -= 10;\n }\n questionNum += 1\n\n if( questionNum<questions.length )\n getQuestions()\n else\n endQuiz() \n}", "function timerWrongOption() {\n if (clock >= 10) {\n clock = clock - 10\n } \n timerEl.textContent = clock;\n showAnswerEl.textContent = \"Wrong Answer\";\n\n}", "function selectAnswer() {\n //logic to compare right/wrong answers\n if (this.value === \"true\") {\n //increase the score\n score = secondsLeft;\n //alert keep going\n alert(\"You got it!\");\n } else {\n //deduct time from the clock varaible\n secondsLeft = secondsLeft - 5;\n //alert wrong answer ----change alerts\n alert(\"Ooops... wrong answer\");\n }\n //move to the nextQuestion\n currentQuestionIndex++;\n\n //Check if it's the last question\n if (currentQuestionIndex === quizList.length) {\n //stop the clock???\n clearInterval(timerInterval);\n\n alert(\"Your final score is \" + secondsLeft + \" points\");\n document.querySelector(\"#finalScore\").textContent = secondsLeft;\n cardEl.classList.add(\"hide\");\n startButton.classList.add(\"hide\");\n submitScore.classList.remove(\"hide\");\n } else {\n //Display the next Question instead of a for loop\n setNextQuestion();\n }\n}", "function showingTimer() {\n qTime--;\n $(\"#time\").text(\"Time: \" + qTime);\n if (qTime == 0) {\n $(\"#result\").text(\"Time is out! Correct answer is: \" + quizQ[counterQ].correctAnsw);\n skipped += 1;\n clearInterval(timeOut);\n $(\"div button[class='choices']\").attr(\"disabled\", true);\n }\n}", "function wrongAnswer(){\n $(\"#timer\").text(\"You are wrong!\");\n clearInterval(timeInterval);\n roundEnd();\n }", "function isAnswerCorrect() {\n if (savedAnswer === currentCorrectAnswer) {\n timeLeft = timeLeft + 2;\n correctAnswerSplash();\n } else {\n timeLeft = timeLeft - 10;\n wrongAnswerSplash();\n }\n}", "function outOfTime(){\n lives--;\n updateLives();\n timeLeft -= 5;\n // save the question data for return later\n wrongAnswered.push(questionData[0]);\n wrongAnswered.push(questionData[1]);\n // display failure visuals and message\n $('.optA').css({backgroundColor: \"rgb(176, 73, 67)\"});\n $('.optB').css({backgroundColor: \"rgb(176, 73, 67)\"});\n $('.timeAlert').css({display: 'block'});\n $('.timeAlert').append($noTime);\n prepNext();\n }", "function userTimeout() {\n if (time === 0) {\n $(\"#QuizArea\").html(\"<p>Times Up!</p>\");\n incorrectGuesses++;\n var correctAnswer = questions[questionCounter].correctAnswer;\n $(\"#QuizArea\").append(\"<p>Correct Answer: <span class='answer'>\" + correctAnswer + \"</span></p>\" + questions[questionCounter].image);\n setTimeout(nextQuestion, 3000);\n questionCounter++;\n }\n}", "function checkUserAnswer() {\r\n if (userAnswer === answer) {\r\n score += scoreGot;\r\n updateMaxScore();\r\n } else {\r\n displayCheck();\r\n setTimeout(() => toggleMsg(\"game\"),\r\n 1000);\r\n }\r\n getNew();\r\n }", "function noTime() {\n\n clearInterval(timer); //stoping time at 0\n\n lost++; // incrementing losses due to no time left\n loadI('lost');\n setTimeout(nextQ, 3 * 1000);\n // calling function to reset to next question\n}", "function click() {\r\n console.log(questions[questionIndex].answer)\r\n console.log(this.value)\r\nif(this.value !== questions[questionIndex].answer) {\r\n time -= 5;\r\n\r\n if (time < 0) {\r\n time = 0;\r\n }\r\n}\r\n\r\n$(\"#time-counter\").text(time);\r\n\r\nquestionIndex++;\r\nif(questionIndex === questions.length) {\r\n finish();\r\n} else {\r\nstartQuestions();\r\n}}", "function timeRunsOut() {\n noAnswer++;\n console.log(noAnswer);\n $(\".timer\").hide();\n $(\".question\").empty();\n $(\".answers\").empty();\n $(\".results\").html(\"<p class='answer-message'>Too slow!</p>\" + \"<src=\" + trivia[questionCount].gif + \"</>\");\n setTimeout(nextQuestion, 1000 *4);\n }", "function updateTimer() {\n if (countdownNum == 0) {\n clearInterval(timerCounter);\n\n // call a function to show the correct answer and set a timeout \n var answer = \"null\";\n checkAnswer(answer);\n\n\n }\n else {\n countdownNum--;\n $(\".counter\").text(countdownNum);\n }\n}", "function answerTimeOut() {\n\n\t// If there's another question, display it.\n\tif (index < questionsArray.length - 1) {\n\t\tindex++;\n\t\tquestionID = questionsArray[index];\n\t\tgoToNextQuestion();\n\n\t// If there's no more questions, show results.\n\t} else {\n\t\tshowTriviaResults();\n\t}\n}", "function selectAnswer(event) {\n console.log(event.target.value);\n\n if (event.target.value === questionsArr[currentQuestionIndex].correct) {\n currentQuestionIndex++;\n console.log(\"correct\");\n judgeEl.textContent = \"CORRECT!\";\n judgeEl.classList.remove(\"hide\");\n quizDone();\n }\n else {\n currentQuestionIndex++;\n timeLeft = timeLeft - 10;\n console.log(\"incorrect\");\n judgeEl.textContent = \"WRONG!\";\n judgeEl.classList.remove(\"hide\");\n quizDone();\n }\n}", "function noAnswer() {\n\t$(\"[data-status=true]\").unbind(\"mouseenter\");\n\t$(\"[data-status=false]\").unbind(\"mouseenter\");\n\tclearInterval(intervalId);\n\tresultOfTrivia();\n\t$(\".answer1\").html(\"Time's up!\");\n \tquestion++;\n \tunanswered++;\n\tsetTimeout(countdown, 1000 * 5);\n\tsetTimeout(gameOfTrivia, 1000 * 5);\n\tsetTimeout(hoverHighlight, 1000 * 5);\n\ttime = 31;\n}", "function yourWrong(updateAlert) {\n if (updateAlert) {\n $(\"#alerts\").html(\"<h2> The timer ran out! The correct answer was \" + currentQuestion.answer + \"</h2>\");\n $(\"#alerts\").show();\n stopTimer();\n       setTimeout(function(){nextQuestion()}, 1000);\n       incorrectAnswers.push(currentQuestion);\n } else {\n $(\"#alerts\").html(\"<h2> You are incorrect! The correct answer was \" + currentQuestion.answer + \"</h2>\");\n       $(\"#alerts\").show();\n stopTimer();\n       setTimeout(function(){nextQuestion()}, 1000);\n       incorrectAnswers.push(currentQuestion);\n }; \n    }", "function timeOut() {\n if (counter === 0) {\n yourWrong(true);\n }; \n }", "function timeoutQuestion() {\n var picture = questionsList[questionsIndex - 1].media\n var questionInfo = questionsList[questionsIndex - 1].questionHint\n clearAnswerDetail()\n stopTimer()\n $(\"#timer\").hide()\n $(\"#question\").hide()\n $(\"#msg-box\").html(\"<h1>TIME!! INCORRECT</h1>\")\n $(\"#msg-box\").append(\"<img src=\" + picture + \">\")\n $(\"#msg-box\").append(\"<p>\" + questionInfo + \"</p>\")\n $(\"#msg-box\").append(\"<p> participation point: \" + points + \"</p>\")\n setTimeout(startQuestion, 15000)\n }", "function loadAnswer() {\n\t\t// Set result if user didn't answer and time ran out\n\t\tif (result === false){\n\t\t\tresults = \"No answer chosen.\"\n\t\t}\n\t\t// Clear values\n\t\tclearInterval(showAnswer);\n\t\tclearInterval(timer);\n\t\t$(\"#time\").empty();\n\n\t\t//Update html elements\n\t\t$(\"#time\").html(\"<p>Time remaining: \" + countdown + \" seconds.</p>\");\n\t\t$(\"#question\").html(\"<p>\" + results + \"</p>\");\n\n\t\t// reset result in case timer ran out\n\t\tresult = false;\n\n\t\t// Set intervals\n\t\ttimer = setInterval(countdownTimer, 1000);\n\t}", "function checkAns() {\n if (ansChoice == allQuest[questionNum].correct) {\n switchQues();\n }\n else {\n secondsLeft = secondsLeft - 10;\n }\n}", "function clickedChoiceOne() {\n if (\"a\" === quizQuestions[questionCounter].correctAnswer) {\n answerEl.innerHTML = \"Correct\";\n setTimeout(() => {\n answerEl.innerHTML = \"\";\n questionCounter++;\n score += 10;\n runQuestions();\n }, 1000);\n } else {\n answerEl.innerHTML = \"Incorrect: -10 Seconds\";\n setTimeout(() => {\n answerEl.innerHTML = \"\";\n questionCounter++;\n score -= 10;\n timer -= 10;\n runQuestions();\n }, 1000);\n }\n}", "function timeoutLoss() {\n\ttotalUnanswered++;\n\t$(\"#display\").html(\"<h3>Time's up! The correct answer is: <h3 class='green'>\" + questionList[questionNumber].correctAnswer + \"</h3></h3>\");\n\tsetTimeout(nextQuestion, 3000); \n\n\t//test\n\tconsole.log(\"Unanswered: \" + totalUnanswered);\n}", "function checkAnswer() {\n var userSelection = $(\"input:checked\").val(); // answer index of user selection in choices\n //check the index is equal to the correct answer index , if yes, stop time, print correct\n if (userSelection == problems[counter].answer) {\n timer.stopTimer();\n correctAns++;\n $(\"#ringt-answer\").html(\"<h2>Correct!</h2>\")\n\n } else {\n timer.stopTimer();\n wrongAns++;\n var correctText = problems[counter].answerText;\n $(\"#wrong-answer\").html(\"<h2>Incorrect!</h2>\" + \"<br></br>\" + \"<h2>the correct answer is: \" + correctText + \"</h2>\")\n\n }\n\n}", "function timeLimit() {\n timer = setInterval(function () {\n $(\"#clock\").css(\"animation\", \"none\");\n $(\"#timer\").text(\"Time left: \" + seconds);\n seconds--;\n\n if (seconds < 5) {\n $(\"#clock\").css(\"animation\", \"pulse 5s infinite\");\n }\n\n if (seconds === -1 && click < questions.length) {\n seconds = 15;\n click++;\n incorrect++;\n clearTimeout(timer);\n showAnswer();\n }\n else if (click === questions.length) {\n displayScore();\n }\n }, 1000);\n }", "function handleAnswer() {\n\t\tif(correctAnswer != null) {\n\t\t\ttimeSinceSelection--;\n\t\t\tif(timeSinceSelection <= 0) {\n\t\t\t\tcorrectAnswer = null;\n\t\t\t\tfor(var i in lanes) {\n\t\t\t\t\tlanes[i].reset();\n\t\t\t\t}\n\t\t\t\tgenerateNewQuestion();\n\t\t\t}\n\t\t}\n\t}", "function selectAnswer() {\n //if right answer show correct, and log score\n if (questions[questionNumber].answer === userAnswer) {\n win();\n stop();\n questionNumber++;\n // wait to start next question\n nextQuestion();\n }\n //if wrong answer show correct and log score\n else {\n lose();\n stop();\n questionNumber++;\n // wait to start next question\n nextQuestion();\n }\n}", "function checkAnswers(answer){\n console.log('correct answer: ' + chosenQuestion.correctAns);\n\n if (answer !== null){\n if (chosenQuestion.correctAns == answer){\n console.log('You are CORRECT!');\n resultFooter.textContent = 'You are CORRECT!';\n }else {\n //if not correct substract 15sec from timeLeft and assign timeLeft \n timeLeft -= 15;\n resultFooter.textContent = 'You are WRONG!';\n };\n main.appendChild(resultFooter);\n questionEl.innerHTML = \"\";\n };\n}", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function count() {\n time--;\n $(\".timer\").text(time);\n if (time <= 0) {\n clearInterval(questionInterval);\n buttonClicked(0);\n // calling the buttonClicked function as if unanswered = wrong.\n }\n }", "function checkAnswer() {\n\n if ((questionNum === 0 && userChoice == 3) || \n (questionNum === 1 && userChoice == 1) ||\n (questionNum === 2 && userChoice == 2) ||\n (questionNum === 3 && userChoice == 3) ||\n (questionNum === 4 && userChoice == 3)) {\n\n footerEl.textContent = (\"Correct!\");\n }else {\n footerEl.textContent = (\"False.\")\n totalSeconds = totalSeconds -10;\n penalty.textContent = (\" -10\");\n }\n questionNum++;\n\n setTimeout(function() {\n generateQuestion();\n }, 500);\n \n \n}", "function clock(){\n time--;\n $(\"#time\").html(\"Time Remaining \" + time);\n clockRunning = true;\n if (time===0){\n delayReset;\n $(\"#question\").html(outTime);\n unanswered++;\n console.log (\"unansered is :\" + unanswered)\n }\n}", "function checkAnswer(answer){\r\n correct = myQuestions[questionIndex].correctAnswer;\r\n\r\n //on correct answer for question that is not final question, takes user to next question\r\n if (answer === correct && questionIndex !== finalQuestion){\r\n score++;\r\n questionIndex++;\r\n displayQuestion();\r\n \r\n // on incorrect answer that is not final question, removes 5 seconds from timer \r\n }else if (answer !== correct && questionIndex !== finalQuestion){\r\n questionIndex++;\r\n displayQuestion();\r\n timeLeft -=5; // takes 5 seconds off of timer for incorrect answer\r\n \r\n // after last question, displays the user's score\r\n }else{\r\n displayScore();\r\n }\r\n}", "function unansweredPause() {\n pauseTimer = false;\n timeLeftPlay = initialTimePlay;\n currentQuestionIndex++;\n\n if (currentQuestionIndex < trivia.length) {\n displayQuestionAnswers(trivia[currentQuestionIndex]);\n }\n else {\n if (currentQuestionIndex === trivia.length) {\n pauseTimer = true;\n $(\"#gameDiv\").hide();\n $(\"#gameStatDiv\").hide();\n setTimeout(function () {\n $(\"#endingStatDiv\").show();\n }, 3000);\n\n }\n }\n }", "function timeIsOut() {\n stop();\n $scope.setAnswer();\n $timeout( function () {\n MainService.checkAnswer( [], $scope.partData.lesson_part.test_model ).then( function ( d ) {\n $scope.getPart();\n } );\n } );\n }", "function incorrectAnswer() {\n\tclearInterval(intervalId);\n\tresultOfTrivia();\n\t$(\".answer1\").html(\"Incorrect!\");\n \tquestion++;\n \tincorrect++;\n\tsetTimeout(countdown, 1000 * 5);\n\tsetTimeout(gameOfTrivia, 1000 * 5);\n\tsetTimeout(hoverHighlight, 1000 * 5);\n\ttime = 31;\n}", "function answer(i) {\n // Variable to hold the question chosen\n var choice = questions[currentQuestion].answers[i];\n // Computer will loop through the current questions answers\n for (var i = 0; i < questions[currentQuestion].answers.length; i++) {\n // If answer is correct add answer to rightAnswer variable\n if (questions[currentQuestion].answers[i].correct === true) {\n var rightAnswer = questions[currentQuestion].answers[i].answerText;\n }\n }\n // if question answered within 10 seconds\n if (timer.time > 0) {\n\n // if Answer is true\n if (choice.correct === true) {\n setTimeout(function () {\n alert('Great Job!');\n }, 1000); // alert will disappear in 1 second\n $('#correctAnswer').empty(); // empty correct answer\n correctAnswers++; // increment total # of correct answers\n timer.reset(); // reset timer\n timer.start(); // start timer\n } else {\n\n // if Answer is false\n setTimeout(function () {\n alert(\"Whoops! That was incorrect.\");\n }, 1000); // alert will disappear in 1 second\n $('#correctAnswer').html('<h3>The Correct Answer is: ' + rightAnswer + '</h3>'); // the correct answer will be shown.\n incorrectAnswers++; //increment incorrect answers count\n timer.reset(); //reset timer\n timer.start(); //start timer\n }\n }\n\n // If no answer given and timer runs out\n if (timer.time === 0) {\n setTimeout(function () {\n alert(\"Sorry, you ran out of time!\");\n }, 1000); // alert will disappear in 1 second\n $('#correctAnswer').html('<h3>The Correct Answer is: ' + rightAnswer + '</h3>'); // the correct answer will be shown.\n unanswered++; //increment unanswered count\n timer.reset(); //reset timer\n timer.start(); //start timer\n }\n setTimeout('nextQuestion()', 1000); // set time for next question to appear after 1 second\n}", "function timeIsUp() {\n if (time < 1) {\n clearInterval(intervalId);\n clockRunning = false;\n quizId.setAttribute(\"style\", \"display: none;\");\n timeId.setAttribute(\"style\", \"display: none;\");\n submitBtn.setAttribute(\"style\", \"display: none;\");\n addResults(arr, quizId, resultsId);\n }\n }", "function wrongAnswer() {\n secondsLeft -= 10;\n}", "function checkAnswer(){\r\n if(!event.target.classList.contains('answer')) return\r\n console.log(event.target.value, questions[currentQuestion].correctAnswer )\r\n if(questions[currentQuestion].correctAnswer !== parseInt(event.target.value)){\r\n secondsLeft -= 15\r\n }\r\n currentQuestion++\r\n console.log(currentQuestion ,questions.length)\r\n if(currentQuestion === questions.length){\r\n console.log('end game')\r\n }else{\r\n displayQuestion()\r\n }\r\n}", "function howManySecs(){\n seconds--;\n $('#timer').html('<h3>You have ' + seconds + ' seconds left </h3>');\n if (seconds < 1){\n clearInterval(clock);\n isAnswered = false;\n whatIsTheAns();\n }\n}", "function submitAnswer() {\n clearInterval(countdown);\n $(\".time-left\").html(`Answered with ${secondsLeft} seconds to spare.`).removeClass(\"time-critical\");\n // Check if answer is correct\n setTimeout(function() {\n checkAnswer();\n }, 1200);\n}", "function timeRunsOut () {\n unanswered++;\n // console.log(unanswered);\n $(\".timer\").hide();\n $(\".questions\").empty();\n $(\".answers\").empty();\n $(\"results\").html(\"<p class='answer-message'>Whoops, time is out!</p>\" +\"<img src= \" + quiz[questionNumber].image + \"</>\");\n setTimeout(questionIsAnswered, 1000*2);\n }", "function handleAnswerClick(){\n console.log(this.textContent);\n console.log(questions[currentQuestion].answer);\n if(this.textContent===questions[currentQuestion].answer) {\n currentQuestion ++;\n congrats.textContent = \"congratulations! That is correct!!\"\n endGame();\n generateQuestion();\n } else {\n //timer interval needs to decrement by 5 for each wrong answer \n secondsLeft -= 5; \n congrats.textContent = \"Whoops! Thats incorrect, -5 seconds. Try again!\"\n endGame();\n generateQuestion();\n }\n}", "function checkAnswer(answer) {\n if (answer === questions[currentQuestion].correct) {\n // correct.innerHTML = \"correct!\"\n nextQuestion();\n // setTimeout();\n }\n if (!answer){\n correct.innerHTML = \"\"\n } \n else{\n // correct.innerHTML = \"wrong!\"\n timeleft - 5 ;\n nextQuestion();\n // setTimeout();\n }\n}", "function SwichPage() {\n // to clear the section for response after chosen an answer\n $(\"#response\").empty();\n // check conditions to see if a choice was made by the user, if yes run the check function\n // to check user's selection\n if ($(\"input\").is(':checked')) {\n checkAnswer();\n //run this when time out, and no choice was made\n } else if (timer.answerTime === 0) {\n //text to show when time's up\n var correctText = problems[counter].answerText;\n $(\"#out-of-time\").html(\"<h2> Time's Up! </h2>\" + \"<br></br>\" + \"<h2>the correct answer is: \" + correctText + \"</h2>\");\n\n }\n\n}", "function evaluateAnswer() {\n clearInterval(interval);\n interval = setTimeout(startGame, 5000);\n userAnswer = $('input[name=answer]:checked').attr('id');\n console.log(userAnswer)\n if (questions[n][userAnswer] === questions[n].correct) {\n correctAnswer();\n } else {\n wrongAnswer();\n }\n}", "function checkOption() {\n // Convert this to a jQuery object and store it in a variable\n let thisButton = $(this);\n\n // Highlight correct answer in green\n highlightAnswer();\n\n // If user chooses the right answer\n if (thisButton.text() === currentQuestion.answer) {\n // Increase the number of correct answers\n numCorrect++;\n // Pause timer and show answer\n showAnswer(\"correct\");\n } else { // If user chooses the wrong answer\n // Highlight the wrong answer chosen in red\n thisButton.removeClass(\"btn-secondary\");\n thisButton.addClass(\"btn-danger\");\n // Increase the number of incorrect answers\n numIncorrect++;\n // Pasue timer and show answer\n showAnswer(\"incorrect\");\n }\n\n // Wait 3 seconds before moving on to the next question\n setTimeout(function() {\n // Change the red incorrect option back to grey\n thisButton.removeClass(\"btn-danger\");\n thisButton.addClass(\"btn-secondary\");\n\n // Decide if there is still a question that still needs to be answered\n questionOrStats()\n }, 3000);\n }", "function yourRight() {\n $(\"#alerts\").html(\"<h2> You are correct! </h2>\");\n       $(\"#alerts\").show();\n stopTimer();\n       setTimeout(function(){nextQuestion()}, 1000);\n       correctAnswers.push(currentQuestion);\n }", "function timeLimit() {\n if (!timerRunning) {\n timerRunning = true;\n intervalId = setInterval(function () {\n timer--\n points--\n $(\"#timer\").html(timer)\n if (timer <= 0) {\n timerRunning = false;\n points = 1\n questionsIncorrect++\n questionsIndex++\n stopTimer()\n timeoutQuestion()\n }\n }, 1000)\n }\n }", "function countdown() {\n\ttime--;\n $(\".timer\").html(\"Time Left: \" + time);\n if (time === 0) {\n clearInterval(intervalId);\n noAnswer();\n }\n }", "function visibleAnswer(isAnswer, isTimeOut) {\n $(\"#popup\").css(\"visibility\", \"visible\");\n\n //Clear question timer\n clearTimeout(time);\n time = null;\n\n $(\"#time\").text = 13; \n\n //When the time finished\n if (isTimeOut) {\n $(\"#answerSelected\").text(\"Ooooppsss sorry!\");\n $(\"#initialtitle\").text(\"Time is out\");\n\n //Show the correct answer\n rightAnswer();\n } else {\n //When the user select answer\n //Answer is correct, set text\n if (isAnswer) {\n $(\"#answerSelected\").text(\"Congratulations!\");\n $(\"#initialtitle\").text(\"You choose the right answer\");\n }\n //Answer is incorrect, set text\n else {\n $(\"#answerSelected\").text(\"Ooooppsss sorry!\");\n $(\"#initialtitle\").text(\"Bad answer\");\n\n rightAnswer();\n }\n }\n setTimeOutAnswer = setTimeout(nextAnswer, interval);\n }", "function unansweredQuestion() {\n unanswered++;\n $(\"#message\").html(\"<span style='color:red';>Time Out !! You failed to choose the answer.</span> <br> The Answer is \" + computerPick.choice[computerPick.answer] + \"</p>\");\n $(\"#time-remaining\").hide();\n $(\".choiceDiv\").hide();\n $(\"#ansImage\").html(\"<img src=\" + computerPick.image + \">\");\n $(\"#message\").show();\n $(\"#ansImage\").show();\n nextQuestion();\n\n }", "function answerSelection() {\n timeLeft = 20;\n counter = setInterval(timer, 1000)\n $('.answerChoices').click(function () {\n userGuess = $(this).data('userGuess');\n rightAnswer = questions[currentQuestion].rightAnswer;\n if (userGuess === rightAnswer) {\n $('.gameBox').html('<div id=\"correctIncorrectHeader\" data-aos=\"zoom-in-right\">Correct!</div>');\n $('.gameBox').append(questions[currentQuestion].explanation).addClass('question');\n $('.gameBox').append(questions[currentQuestion].image);\n resetTimer();\n correctAnswers++;\n currentQuestion++;\n setTimeout(displayNext, 6500);\n } else {\n $('.gameBox').html('<div id=\"correctIncorrectHeader\" data-aos=\"zoom-in-left\">Wrong!</div>')\n $('.gameBox').append(questions[currentQuestion].explanation).addClass('question');\n $('.gameBox').append(questions[currentQuestion].image);\n resetTimer();\n wrongAnswers++;\n currentQuestion++;\n setTimeout(displayNext, 6500);\n }\n });\n }", "function correctChoice() {\n currentQuest++;\n feedback.innerHTML = \"Correct!\";\n setTimeout(function() {\n feedback.innerHTML = \"\";\n }, 1750);\n if (currentQuest < contentArray.length){\n loadQuestion(currentQuest);\n } else (\n endDetect = true\n )\n}", "function questionTally(){\n\n if (questionCounter === questions.length){\n $(\"#messageArea\").html(\"Game Over!\")\n $(\"#questionArea\").html(\"You got \" + numCorrect + \" right!\");\n $(\"#answerArea\").html(\"You got \" + numWrong + \" Wrong!\")\n }\n else{\n $(\"#messageArea\").empty();\n setTimeout(addQuestion, 2000);\n }\n\n}", "function checkAnswer (answer) {\n if(answer == questions[runningQuestion].correct) {\n score++;\n alert(\"Correct! Way to Go!\");\n\n }\n else {\n alert(\"Incorrect! Uh oh!\");\n timeLeft = timeLeft - 10;\n\n }\n if (runningQuestion < lastQuestion) {\n runningQuestion++;\n renderQuestion();\n }\n else {\n scoreRender();\n timeLeft = 99999999;\n timerEl.style.display = \"none\";\n }\n}", "function incorrect() {\n timeLeft -=20;\n nextQuestion();\n}", "function checkAnswera(){\n\n console.log(\"clicked a\");\n\n if(questions[i].answer === \"A\") {\n console.log(\"correct\");\n timeLeft = timeLeft + 5; // Adds 5 seconds to the timer //\n\n } else {\n console.log(\"not correct\");\n timeLeft = timeLeft - 5; // Deletes 5 seconds from the timer //\n }\n\n i++;\n quizquestions();\n }", "function confirmAnswer(answer){\n correct = questionsArray[questionOptions].correctAnswer\n if(answer === correct){\n questionOptions++;\n alert(\"You are right!\");\n scoreBoard.textContent = \"Score: \" + score++;\n questionSelect()\n \n }\n else if(answer !== correct){\n questionOptions++;\n alert(\"Wrong answer!\");\n timerSetting -= 5;\n questionSelect()\n \n }\n}", "function count () {\n time--;\n $(\"#timer\").text(\"Time Remaining: \" + time);\n\n if (time === 0) {\n noAnswer();\n losses++;\n stop();\n $(\"#timer\").text(\"\");\n }\n}", "function displayAnswer(a,r,q) {\n if (a) { // Correct answer selected\n $(\"#result\").html(\"Correct!\").css(\"color\",\"green\");\n }\n else if(r === 0) { // Wrong Answer selected\n $(\"#result\").html(\"Wrong!\").css(\"color\",\"red\");\n }\n else { // Answer not selected in time allowed\n $(\"#result\").html(\"Times's Up!\").css(\"color\",\"red\");\n numWrong++;\n }\n \n clearTimeout(questionTimer); // Stop the question timer\n clearInterval(secondTimer); // Stop the second timer\n\n answerTimer = setTimeout(nextQuestion, displayAnswerTime); // Set the display answer timer \n secondTimer = setInterval(secondCountdown, second); // Reset the second timer \n\n timeRemaining = displayAnswerTime/1000; // Time for answer to be displayed\n\n $(\"#timeRemaining\").hide(); // hide the question remaining time counter\n $(\"#info\").html(q.ansInfo);\n $(\"#nextQuestionTime\").html(\"Next Question in: \"+timeRemaining+\" seconds\").css(\"color\",\"green\").show();\n $(\"#answerImg\").html(\"<img src='\"+q.ansImg+\"'>\");\n}", "function startover(){\n time = 10;\n correctanswer = 0;\n wronganswer = 0;\n unanswered = 0; \n }", "function setTimer() { //sets timer\n var timerInterval = setInterval(function() { \n secondsLeft--;\n timeEl.textContent = secondsLeft;\n if(secondsLeft === 0 || questionIndex === 5) { //logic to prevent from going over number of questions or time\n if (timeEl.textContent <= 0) { //logic prevents time from showing negative numbers\n timeEl.textContent = 0\n scoreEl.textContent = 0\n }\n document.getElementById('answer').style.display ='none'; \n choiceList.setAttribute('hidden', true);\n finalScore.removeAttribute('hidden');\n questionEl.textContent = 'ALL DONE!';\n document.getElementById(\"submit-form\").style.display=\"inline-flex\";\n clearInterval(timerInterval); \n }\n }, 1000);\n}", "function setTimer(time) {\n timeLeft = time < 0 ? 0 : time;\n timeLeftEl.textContent = \"Time left: \" + timeLeft + \"s\";\n clearTimeout(quizTimer);\n quizTimer = setTimeout(function() {\n loadResultPage();\n clearInterval(quizInterval);\n }, 1000 * timeLeft);\n return timeLeft > 0;\n}", "function checkAnswers(event){\nvar selectedChoice = event.currentTarget.id;\nconsole.log(event.currentTarget.id);\n// Determining if selected choice is equal to correct answer\nif (selectedChoice===currentquestion.correct){\n console.log(\"Correct\");\n //Add 10 point to score for being correct\n score+=10;\n scoreDiv.innerText = score;\n\n//If incorrect\n\n}else {\n//Subtract time from timer\ntimerSeconds-=5;\n}\n//Go to next question\nrunningQuestion++;\nfillnextfunction();\n}", "function check(answer) {\r\n if (questionIndex < questions.length - 1) {\r\n if (answer == questions[questionIndex].correctAnswer) {\r\n score++;\r\n questionIndex++;\r\n choices.style.display = \"none\";\r\n choiceResponse.innerHTML= \"<p>Richtig!</p>\"\r\n choiceResponse.style.display = \"block\";\r\n setTimeout(getQuestion,2000);\r\n }\r\n else {\r\n questionIndex++;\r\n choices.style.display = \"none\";\r\n choiceResponse.innerHTML= \"<p>Nop!</p>\"\r\n choiceResponse.style.display = \"block\";\r\n setTimeout(getQuestion,2000);\r\n }\r\n }\r\n else {\r\n if (answer == questions[questionIndex].correctAnswer) {\r\n score++;\r\n choices.style.display = \"none\";\r\n choiceResponse.innerHTML= \"<p>Richtig!</p>\"\r\n choiceResponse.style.display = \"block\";\r\n setTimeout(showScore,2000);\r\n }\r\n else {\r\n choices.style.display = \"none\";\r\n choiceResponse.innerHTML= \"<p>Nö!</p>\"\r\n choiceResponse.style.display = \"block\";\r\n setTimeout(showScore,2000);\r\n }\r\n }\r\n}", "function checkAns(guess) {\n if (guess === qt.correctAns) {\n ans.textContent = \"Correct!\";\n setTimeout(function() {\n ansDiv.style.display = \"none\";\n }, 600);\n ansDiv.style.display = \"block\";\n stats += 5;\n getQuestion();\n } else {\n ans.textContent = \"Wrong!\";\n setTimeout(function() {\n ansDiv.style.display = \"none\";\n }, 600);\n ansDiv.style.display = \"block\";\n stats -= 2;\n // If the user gets an question wrong 1 second is deducted\n timer--;\n getQuestion();\n }\n}", "function outOfTime() {\n clearInterval(myTimer)\n questionIndex = questionIndex + 1\n displayQuestion()\n displayAnswers()\n $(\"#answers\").empty()\n $(\"#timeLeft\").empty()\n // allows for the gap between the three second correct or incorrect screen\n counter = 33\n displayQuestion()\n displayAnswers()\n // gets the timer going again\n myTimer = setInterval(timer,1000)\n $(\"#screen\").hide()\n var noTime = $(\"<h1>\")\n noTime.attr(\"id\", \"times\")\n noTime.text(\"YOU RAN OUT OF TIME\")\n $(\"#body\").append(noTime)\n setTimeout(function() {\n $(\"#screen\").show()\n $(\"#times\").text(\"\")\n },3000)\n incorrect = incorrect + 1\n displayScore()\n}", "function validateAnswer(event) {\n // when an answer option is clicked, it will have one of the two components, as follow:\n // a) for correct answer \n if (event.target.textContent == questions[questionNumber].answer){\n correctOrWrong.textContent = correctWrongMessage.correctMessage;\n score++;\n // b) for wrong answer\n } else {\n correctOrWrong.textContent = correctWrongMessage.wrongMessage;\n penaltyTime ();\n }\n \n // display each question on one \"question screen\" and clear the creen form next question \n clearScreen();\n // clear the question and answer section when the time is over\n timeOverMessage();\n\n // when the user is at the last question \n if (questionNumber === questions.length - 1) {\n // stop the time\n stopTheTimer();\n // and display all answered screen\n displayAllAnswered();\n \n } else {\n // move to next question\n questionNumber++; \n // displays the next question on the \"question screen\"\n questionStyle();\n }\n}", "function determineAnswer() {\n switch (answer) {\n case 'Yes':\n timeGTOne = 1\n GettingBlobsOfDoom()\n break;\n case 'No':\n writeText('All righty then. See ya later!')\n InInn()\n break;\n }\n }", "function checkAnswer(answer) {\n correct = questionArray[currentQuestionProgression].correctAnswer\n\n if (answer === correct && currentQuestionProgression !== lastQuestion) {\n response.setAttribute(\"style\", \"display: none;\")\n currentQuestionProgression++\n cycleQuestions()\n } else if (answer !== correct && currentQuestionProgression !== lastQuestion) {\n response.setAttribute(\"style\", \"display: block;\")\n response.textContent = \"Incorrect. Please try again\"\n //MINUS 10 SECONDS FROM TIMER\n secondsLeft -= 10\n } else {\n ifWin()\n }\n}", "function showCountdown(){\n if (timer === 0) {\n $(\"#gifs\").html(\"<img src='./assets/images/noAnswer.gif'/>\");\n noAnswerSound.play();\n $(\"#question\").html(\"<h3>If you didn't know, just ask Mallory! She'll talk too much about it.</h3>\")\n resetRound();\n questionAnswered = true;\n clearInterval(time);\n\n } \n else if (questionAnswered === true) {\n clearInterval(time);\n\n }\n else if (timer > 0) {\n timer--;\n $('#timer').html(timer);\n }\n\n \n}", "function questionHandler() {\n clearInterval(interval);\n questionChecker();\n console.log(unansweredQuestions)\n console.log(correctAnswers)\n console.log(incorrectAnswers)\n \n if (gameStart === false) {\n return false;\n }\n \n let answerIndex = parseInt($(this).attr(\"value\"));\n \n \n if (answerIndex === triviaQuestions[theQuestion].theAnswer) {\n \n correctAnswers++;\n cutePopUp();\n \n } else {\n \n incorrectAnswers++; \n uglyPopUp();\n \n }\n }", "function clickChoiceButton() {\n // check to see if user answered question right or wrong\n if (this.value !== questions[currentQuestionIndex].answer) {\n time -= 10;\n\n if(time < 0) {\n time = 0;\n }\n timeEl.textContent = time;\n\n // Notify quiz taker if they answered right or wrong\n rightWrongEl.textContent = \"Wrong\"\n } else {\n rightWrongEl.textContent = \"Correct! Good job!\";\n }\n rightWrongEl.setAttribute(\"class\", \"right-wrong\");\n\n setTimeout(function() {\n rightWrongEl.setAttribute(\"class\", \"right-wrong hide\");\n }, 500);\n\n currentQuestionIndex++;\n\n if (currentQuestionIndex === questions.length) {\n quizEnd();\n } else {\n showQuestion ();\n }\n}", "_goodCrashAnswers () {\n this._startAnimateAnswer();\n\n setTimeout(() => {\n this._stopAnimateAnswer();\n this._viewNewMessage(this._getAnswresMessage());\n\n if (this.isFirstAnswer) this.isFirstAnswer = false;\n }, 2000);\n }", "function nextQuestion() {\n if (questionCounter < questions.length)\n { time = 10;\n $(\"#gameScreen\").html(\"<p> You have <span id ='timer'>\" + time + \n \"</span> seconds left! </p>\");\n questionContent();\n timer();\n userTimeout();\n \n }\n \n else {\n resultsScreen();\n }\n\t}", "function check(answer) {\n if (questionIndex < questions.length - 1) {\n setTimeout(getQuestion,500);\n}\n else {\n setTimeout(showScore,500);\n}\n\nif (answer == questions[questionIndex].correctAnswer) {\n score++;\n questionIndex++;\n choices.style.display = \"none\";\n choiceResponse.innerHTML= '<p style=\"color:green\">Correct!</p>';\n choiceResponse.style.display = \"block\";\n choiceResponse.setAttribute(\"class\",\"label\");\n}\nelse {\n questionIndex++;\n choices.style.display = \"none\";\n choiceResponse.innerHTML= '<p style=\"color:red\">Incorrect!</p>';\n choiceResponse.style.display = \"block\";\n choiceResponse.setAttribute(\"class\",\"label\");\n }\n}", "function beginGame () {\n setTimeout(()=>{\nif(!timeInput.value){\n alertMessage.innerHTML = 'please enter time to play game'\n !gameResult\n}else {\n alertMessage.innerHTML = 'Game over'\n}\n\nconst gameResult = () => {\n if(counterS > counterL) {\n result.innerHTML = `Player S won the game. Congrats!!`\n }\n if (counterL > counterS) {\n result.innerHTML = `Player L won the game. Congrats!!`\n }\n if (counterS === counterL) {\n result.innerHTML = `It was a tie.`\n }\n}\ngameResult();\n},timeInput.value *1000)\n\n\n}", "function onCompletionPuzzleThreeA() {\n resultThree.textContent = 'Nope! Try again.';\n if (puzzleThreeAInput.value === '1'||puzzleThreeAInput.value === '2'||puzzleThreeAInput.value === 'one'||puzzleThreeAInput.value === 'two'||puzzleThreeAInput.value === 'One'||puzzleThreeAInput.value === 'Two') {\n //puzzleThreeAInput.classList.toggle('hide');\n resultThree.textContent = \"Correct!\";\n setTimeout(function(){puzzle3AQuestion.classList.toggle('hide')\n puzzleThreeBtn.classList.toggle('hide');\n }, 1000);\n}\n}", "function setupOptions() {\n noAnswer = 1; // user did NOT choose an answer (1 = not selected)\n checkedAnswer = 0; // the script checked the user's response (0 = not checked)\n $(\"#curQ\").html(parseInt(currentQuestion) + 1)\n $('#question').html(parseInt(currentQuestion) + 1 + \". \" + allQuestions[currentQuestion].question);\n var options = allQuestions[currentQuestion].choices;\n var formHtml = '';\n for (var i = 0; i < options.length; i++) {\n formHtml += '<div><input type=\"radio\" name=\"option\" value=\"' + i + '\" id=\"option' + i + '\" onclick=\"checkAns()\"><label for=\"option' + i + '\">' +\n allQuestions[currentQuestion].choices[i] + '</label></div><br/>';\n }\n $('#form').html(formHtml);\n var distance = 20;\n var now = -1;\n timerClock = setInterval(function() {\n\n // time already spent\n now++;\n \n // Find the distance between now an the count down date\n distance = 20 - now;\n \n // Output the result in an element with id=\"demo\"\n document.getElementById(\"countdown\").innerHTML = distance;\n // If the count down is over, write some text \n if (distance < 0) {\n clearInterval(timerClock);\n document.getElementById(\"countdown\").innerHTML = \"Time's Up!\";\n checkAns();\n }\n }, 1000);\n//timeoutClock=setTimeout(checkAns, 20000);\n\n}" ]
[ "0.7467261", "0.7242716", "0.7192307", "0.7177728", "0.7177728", "0.7148943", "0.7129041", "0.70838726", "0.70810384", "0.70033336", "0.6975034", "0.69453955", "0.6929539", "0.69245476", "0.69025725", "0.689427", "0.689175", "0.68881583", "0.68793625", "0.68499315", "0.68498856", "0.6843417", "0.6834402", "0.6828309", "0.68054575", "0.67989975", "0.67768896", "0.6776618", "0.67747176", "0.67694384", "0.6704966", "0.66975135", "0.66904944", "0.6683395", "0.6669974", "0.66680944", "0.6659636", "0.6649982", "0.6646366", "0.66400504", "0.66388315", "0.663545", "0.6619911", "0.66142964", "0.6599208", "0.6598432", "0.6596841", "0.65895975", "0.6579878", "0.6579644", "0.65759426", "0.65636086", "0.6558264", "0.6556392", "0.6555553", "0.6552791", "0.65521896", "0.6550583", "0.65407705", "0.65153986", "0.65147644", "0.6510955", "0.6510494", "0.65006214", "0.6498089", "0.64924824", "0.6482477", "0.6480887", "0.64758044", "0.6470553", "0.6470455", "0.64613867", "0.64599764", "0.6456872", "0.64548504", "0.64440984", "0.6443416", "0.6434663", "0.6433027", "0.6428428", "0.6419477", "0.6417031", "0.6414274", "0.6412318", "0.6411601", "0.6406328", "0.64035016", "0.63989115", "0.6398891", "0.6397309", "0.6395", "0.6394143", "0.63939846", "0.6393954", "0.639152", "0.6389999", "0.63866925", "0.6386255", "0.63805825", "0.637849", "0.6376723" ]
0.0
-1
if the user selects the correct answer
function generateWin() { correctTally++; gameHTML = "<p class='text-center timerText'></p>" + "<p class='text-center msg'>" + correctAnswers[questionCounter] + "</p>" + imageArray[questionCounter]; $(".mainDiv").html(gameHTML); setTimeout(wait, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function answerSelected() {\n let selected = $('input:checked');\n let answer = selected.val();\n\n if(answer !==undefined){\n\n let correctAnswer = `${STORE[questionNumber].correctAnswer}`;\n if (answer === correctAnswer) {\n rightAnswerFeedback();\n } else {\n wrongAnswerFeedback(correctAnswer);\n }\n}\n}", "function checkAnswer(selected){\n let rightAnswer = questionsArray[questionCounter].correctAnswer;\n \n if(selected === rightAnswer){\n score++;\n displayPopup(true, rightAnswer);\n } \n else{\n displayPopup(false, rightAnswer);\n }\n}", "function selectAnswer() {\n //if right answer show correct, and log score\n if (questions[questionNumber].answer === userAnswer) {\n win();\n stop();\n questionNumber++;\n // wait to start next question\n nextQuestion();\n }\n //if wrong answer show correct and log score\n else {\n lose();\n stop();\n questionNumber++;\n // wait to start next question\n nextQuestion();\n }\n}", "function choose() {\n if ($('input[name=\"answer\"]:checked').val() === undefined) {\n alert('Por favor selecione uma opção!');\n } else {\n selections[questionCounter] = $('input[name=\"answer\"]:checked').val();\n return true;\n }\n }", "function submitAnswer() {\n let radios = document.getElementsByName(\"choice\");\n let userAnswer;\n \n for(i = 0 ; i < radios.length; i++ ) {\n if(radios[i].checked) {\n checked = true;\n userAnswer = radios[i].value;\n }\n } \n\n// if user click submit button without selecting any option\n if(!checked) {\n alert(\"You must select an answer\");\n return;\n }\n \n // Correct answer\n if(userAnswer === \"option4\") {\n alert(\"Answer is correct!\");\n rightAnswer++;\n $(\"#right\").text(\"Correct answers: \" + rightAnswer);\n reset();\n }\n // incorrect answer\n else {\n alert(\"Answer is wrong!\");\n wrongAnswer++;\n $(\"#wrong\").text(\"Inccorect answers: \" + wrongAnswer);\n reset();\n }\n}", "function correctAnswer() {\n return $scope.answer.value === $scope.data.solution;\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 verifyAnswer(selection) {\n\n if (selection === questions[rand][2]) {\n correct++;\n setGif(0);\n } else {\n incorrect++;\n setGif(1);\n }\n\n } //ends verifyAnswer", "function checkAnswer(choice, answer) {\n if (choice == answer) {\n return true;\n } else {\n return false;\n }\n }", "function choose0() { checkAnswer(0) }", "function answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function checkAnswer () {\n console.log(userSelected.text);\n\n if (userSelected === questions[i].correctAnswer) {\n score ++;\n $(\"#score\").append(score);\n $(\"#answerCheck\").append(questions[i].rightReply);\n i++;\n } else {\n $(\"#answerCheck\").append(questions[i].wrongReply);\n i++;\n } \n }", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function answerChoice(sel) {\n // console.log(`The correctAnswer function ran. The selected answer was: ${selectAns}`);\n // console.log(`The correct answer was: ${quizContent.correct[currentInd - 1]}`);\n // console.log(`current correct answer: ${quizContent.correct[currentInd-1]}`);\n // console.log(`sel is ${sel}`);\n\n if (sel === quizContent.correct[currentInd - 1]) {\n console.log(\"The answer was correct\");\n correctAnswer();\n currentScore++;\n\n } else {\n wrongAnswer();\n console.log(\"The answer was incorrect\");\n }\n}", "check(user_choice){\n return user_choice === this.answer;\n }", "function checkAnswer(selectedAnswer) {\n const correctAnswer = quiz[currentQuestion].answer;\n \n if (selectedAnswer === correctAnswer) {\n score++;\n }\n \n currentQuestion++;\n \n if (currentQuestion < quiz.length) {\n displayQuestion();\n } else {\n showResult();\n }\n }", "function checkAnswer() {\r\n STORE.view = 'feedback';\r\n let userSelectedAnswer = STORE.userAnswer;\r\n let correctAnswer = STORE.questions[STORE.questionNumber].correctAnswer;\r\n console.log('Checking answer...');\r\n if (userSelectedAnswer == correctAnswer) {\r\n STORE.score++;\r\n STORE.correctAnswer = true;\r\n }\r\n else {\r\n STORE.correctAnswer = false;\r\n }\r\n}", "function checkAnswerValid() {\n\tlet answerIndex = $('input[name=answer]:checked').val()\n\tlet answerNotSelected = !answerIndex\n\n\tif (answerNotSelected) {\n\t\talert('Whoever didnt pick an answer...ya moms a h0e')\n\t} else {\n\t\tlet answer =\n\t\t\tQUESTIONS[currentQuestionIndex].answers[\n\t\t\t\tNumber($('input[name=answer]:checked').val())\n\t\t\t]\n\n\t\tupdateForm({ answer, answerIndex })\n\n\t\t// increment correct / incorrect count\n\t\tanswer.correct ? numCorrect++ : numIncorrect++\n\t\tupdateCorrectIncorrect()\n\t}\n}", "function q1 (){\n let answer = prompt('Is Quen from Maine?');\n answer = answer.toLowerCase();\n \n //question1\n if (answer === answerBank[2] || answer === answerBank[3]){\n console.log('correct');\n globalCorrect = globalCorrect + 1;\n alert('You got it correct, ' + userName + '!');\n }\n else if (answer === answerBank[0] || answer === answerBank[1]){\n console.log('Wrong');\n alert('Ouch! Better luck on the next one.');\n }\n else{\n //console.log('Non accepted answer submitted');\n alert('Wow, really?');\n }\n}", "function checkAnswer(answer, answerSelection) {\n //Write your code in here\n // if the \"veryPositive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very positive\"\n if (possibleAnswers.veryPositive.includes(answer, [answerSelection])) {\n return \"very positive\";\n }\n // if the \"positive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"positive\"\n else if (possibleAnswers.positive.includes(answer, [answerSelection])) {\n return \"positive\";\n }\n // if the \"negative\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"negative\"\n else if (possibleAnswers.negative.includes(answer, [answerSelection])) {\n return \"negative\";\n }\n // if the \"veryNegative\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very negative\"\n else if (possibleAnswers.veryNegative.includes(answer, [answerSelection])) {\n return \"very negative\";\n }\n}", "function quiz(question, choice, answer){ \n //getting user's answer\n var playerAnswer = readlineSync.keyInSelect(choice, question);\n //checkAnswer\n var check;\n if (playerAnswer === answer){\n check = 1;\n score++;\n } else if(playerAnswer === -1){\n check = -1;\n } else{\n check = 0;\n score -= 0.25; \n }\n return check;\n}", "function checkAnswer() {\n\t\tif (answerChoice == currentQuestion.rightAnswer) {\n\t\t\t$(\"#hint\").text(currentQuestion.congratulations);\n\t\t\tcurrentQuestion.correct = true;\n\t\t\tupdateScore();\n\t\t} else {\n\t\t\tconsole.log('incorrect');\n\t\t\t$(\"#hint\").text(currentQuestion.sorry);\n\t\t};\n\t}", "function checkAnswerChoice() {\n let answerChoice = $('input[type=radio][name=options]:checked').val();\n console.log(answerChoice);\n if (answerChoice === store.questions[store.questionNumber].correctAnswer) {\n updateScore();\n $('main').html(correctAnswer());\n } else {\n $('main').html(wrongAnswer());\n }\n}", "function checkAnswer() {\n var userSelection = $(\"input:checked\").val(); // answer index of user selection in choices\n //check the index is equal to the correct answer index , if yes, stop time, print correct\n if (userSelection == problems[counter].answer) {\n timer.stopTimer();\n correctAns++;\n $(\"#ringt-answer\").html(\"<h2>Correct!</h2>\")\n\n } else {\n timer.stopTimer();\n wrongAns++;\n var correctText = problems[counter].answerText;\n $(\"#wrong-answer\").html(\"<h2>Incorrect!</h2>\" + \"<br></br>\" + \"<h2>the correct answer is: \" + correctText + \"</h2>\")\n\n }\n\n}", "function answerCheck () {\n \n \n if(selectedAnswer===realAnswerArray[rightAnswerCounter]) {\n \n $(\"#showAnswer\").text(\"You Got It!!\");\n generateWin();\n \n \n } else {\n $(\"#showAnswer\").text(\"Oops!!\");\n generateLoss();\n \n }\n}", "function answerQ () {\n let val = document.getElementById('answer');\n \n if (val === '') { alert('Mohon jawab dulu!'); generateAngka(); }\n \n if (val === ops) { alert('Jawaban kamu benar!\\nMembuat pertanyaan baru lagi..'); generateAngka(); }\n}", "function checkIfAnswer(ev){\n\t\tif(document.getElementById(currentChoice).textContent == currentSet.correctChoice)\n\t\t\tallowDrop(event);\n}", "function updateAnswer(e) {\n var answer = $(\"input[type='radio']:checked\").val();\n if (answer == questions[currentQuestion].correct) {\n numberCorrect++; \n } else if (answer == null) {\n \talert('Please choose an option!');\n e.preventDefault();\n }\n }", "function checkAnswer() {\n if (document.getElementById(\"true\").selected) {\n processAnswer(\"true\");\n }\n else {\n processAnswer(\"false\");\n }\n // get next question if not asked all yet\n if (questionsAsked < 10) {\n setQuestion();\n }\n // final question asked show prompt.\n else {\n alert(\"Quiz complete! You got \" + totalCorrect + \" correct out of 10.\");\n\n }\n\n // update totals\n document.getElementById(\"qnr\").innerHTML = \"Question:\" + questionsAsked;\n document.getElementById(\"score\").innerHTML = \"Score:\" + totalCorrect;\n\n}", "function checkAnswer(answer) {\n event.preventDefault();\n if (answer === rightAnswer) {\n correctAnswerFn('WIN')\n\n } else {\n incorrectAnswerFn('LOSE')\n }\n if (fifty === \"FIFTY\") {\n fiftyLine('USEDFIFTY')\n }\n }", "function selectCorrectAnswer(aNum) {\n setCorrectAnswer(aNum);\n }", "function checkAnswer() {\n\tchoices = document.getElementsByName(\"choices\");\n\n\tfor (var i = 0, len = choices.length; i < len; i++) {\n\t\tif (choices[i].checked) {\n\t\t\tchoice = choices[i].value;\n\t\t}\n\t}\n\n\tif (choice === questions[pos][4]) {\n\t\tcorrect++;\n\t}\n\t\n\tpos++;\n\trenderQuestion();\n}", "function checkAnswer(answer){\n if( answer == questions[runningQuestion].correct){\n isCorrect();\n nextQuestion();\n } else {\n isWrong();\n nextQuestion();\n }\n}", "function checkAnswer() {\n let userAnswer = parseInt(document.getElementById(\"answer-box\").value);\n let calculatedAnswer = calculateCorrectAnswer();\n let isCorrect = userAnswer === calculatedAnswer[0];\n\n if (isCorrect) {\n alert(\"Hey! You got it right! :D\");\n incrementScore();\n } else {\n alert(`Awwww.....you answered ${userAnswer}. The correct answer was ${calculatedAnswer[0]}!`);\n incrementWrongAnswer();\n }\n\n runGame(calculatedAnswer[1]);\n\n\n}", "function determineAnswer() {\n switch (answer) {\n case 'Yes':\n timeGTOne = 1\n GettingBlobsOfDoom()\n break;\n case 'No':\n writeText('All righty then. See ya later!')\n InInn()\n break;\n }\n }", "function checkUserChoice(event) {\n event.preventDefault();\n var userChoice = event.target.textContent;\n var correctAnswer = getAnswer();\n\n if (userChoice === correctAnswer) {\n questionIndex++;\n userScore++;\n correctQuestions.textContent = userScore;\n correctAnwerMsg();\n \n if (questionIndex >= questions.length){\n return endGame();\n }\n clearCurrentQuestion();\n displayCurrentQuestion();\n\n } else {\n questionIndex++;\n incorrectAnswerMsg();\n if (questionIndex >= questions.length){\n return endGame();\n }\n clearCurrentQuestion();\n displayCurrentQuestion();\n }\n}", "function userSelection() {\n stopCountdown();\n if ($(this).attr(\"data-name\") == correctAnswers[questionSelector]) {\n rightWrong = true;\n correct++;\n var newScore = score += points;\n $(\"#score\").text(newScore);\n } else {\n incorrect++ \n }\n showResult();\n nextQuestion();\n }", "function answerIsCorrect() {\n correctAnswerFeedback();\n nextQuestion();\n addToScore();\n}", "function selectAnswer(event) {\n console.log(event.target.value);\n\n if (event.target.value === questionsArr[currentQuestionIndex].correct) {\n currentQuestionIndex++;\n console.log(\"correct\");\n judgeEl.textContent = \"CORRECT!\";\n judgeEl.classList.remove(\"hide\");\n quizDone();\n }\n else {\n currentQuestionIndex++;\n timeLeft = timeLeft - 10;\n console.log(\"incorrect\");\n judgeEl.textContent = \"WRONG!\";\n judgeEl.classList.remove(\"hide\");\n quizDone();\n }\n}", "function checkUserAnswer(answer) {\n//when the user selects an answer and it is exactly equal to an index in the correctAnswer object key,\n\tif(answer.text() === questionList[getCurrentIndex()].ansArray[questionList[getCurrentIndex()].correctAnswer]) {\n return true;\n console.log(true);\n } else {\n return false;\n console.log(false);\n }\n}", "function confirmAnswer(answer){\n correct = questionsArray[questionOptions].correctAnswer\n if(answer === correct){\n questionOptions++;\n alert(\"You are right!\");\n scoreBoard.textContent = \"Score: \" + score++;\n questionSelect()\n \n }\n else if(answer !== correct){\n questionOptions++;\n alert(\"Wrong answer!\");\n timerSetting -= 5;\n questionSelect()\n \n }\n}", "function userSelectAnswer () {\n $(\"form\").on(\"submit\", function (event) {\n event.preventDefault();\n let selected = $('input:checked');\n let answer = selected.val();\n let correctAnswer = `${STORE[questionNumber].correctAnswer}`;\n if (answer === correctAnswer) {\n increaseScore();\n showCorrectAnswer();\n } else {\n showWrongAnswer();\n }\n });\n finishGame(score);\n}", "function checkAnswer(e) {\n // targets user selection\n var answer = e.target.innerText;\n console.log(answer);\n\n //cannot set answer = to question correct answer\n // !!!!! NEED HELP WITH THIS !!!!\n if (answer === questions[qIndex].correct) {\n userScore++;\n scoreBox.innerHTML = `<h2>Score: ${userScore}</h2>`;\n console.log(userScore);\n // if answer correct, add one to question index\n qIndex++;\n // run questionCycle again prompting new question\n questionCycle();\n // box for user score have it update everytime this happens\n } else {\n // decreases timer by one second if user selects wrong answer\n timerCount = timerCount - 5;\n qIndex++;\n scoreBox.innerHTML = `<h2>Score: ${userScore}</h2>`;\n // prompts new question if answered incorrectly\n questionCycle();\n }\n}", "function controlAnswer(answer) {\n console.log(\"controlAnswer ran\");\n var currentQuestion = questions[questionNumber];\n if (answer === currentQuestion.answer) {\n correct += 1;\n console.log(\"User picked correct answer\");\n }\n console.log(\"Correct: \" + correct);\n }", "function feedbackForAnswer(answer) {\n var curvature = TreeConstructor.root.curvature;\n var suffix = \". \" + CONTINUE_BUTTON;\n if (curvature == answer) {\n var message = \"The expression is \" + \n CURVATURE_DISPLAY_NAME[curvature] + suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-success\">' +\n '<span><strong>Correct!</strong> ' + message + '</span></div>')\n } else {\n var message = \"The expression is \" + CURVATURE_DISPLAY_NAME[curvature] + \n \", but you answered \" + CURVATURE_DISPLAY_NAME[answer] +\n suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-error\">' +\n '<span><strong>Incorrect!</strong> ' + message + '</span></div>')\n }\n // Increase/decrease difficulty\n updateLevel(curvature == answer);\n // Listen to new expression button.\n $(\"#newExpression\").click(loadNewExpression);\n }", "function checkAnswer(event) {\r\n return event.target.innerText === question.answer;\r\n }", "function evaluateAnswer(userAnswer, correctAnswer){\n console.log('evaluating answer');\n if(userAnswer === correctAnswer){\n return true;\n }else {\n return false;\n } \n}", "function checkAnswer(answer) {\n correct = quizQuestions[currentQuestionIndex].correctAnswer;\n\n if (answer === correct && currentQuestionIndex !== finalQuestionIndex) {\n score++;\n alert(\"That Is Correct!\");\n currentQuestionIndex++;\n generateQuizQuestion();\n //If correct.\n } else if (answer !== correct && currentQuestionIndex !== finalQuestionIndex) {\n alert(\"That Is Incorrect.\")\n currentQuestionIndex++;\n generateQuizQuestion();\n //If wrong.\n } else {\n showScore();\n }\n}", "function checkAnswer() {\n //console.log('Answer is being checked')\n const currentAnswer = $( \"input:checked\" ).val();\n const correctAnswerText = getCorrectAnswer();\n \n if (currentAnswer === correctAnswerText) {\n STORE.currentAnswer = 'correctAnswer';\n updateUserScore();\n } else {\n STORE.currentAnswer = 'wrongAnswer';\n } \n}", "function checkAnswer(){\n\n\tchoices = document.getElementsByName(\"choices\");\n\tfor(var i=0; i<choices.length; i++){\n\t\tif(choices[i].checked){\n\t\t\tchoice = choices[i].value;\n\t\t}\n\t}\n\n\tif(choice == questions[pos][4]){\n\t\t//got the question right message\n\t\t_(\"status\").innerHTML = \"Yaay, way to go!\";\n\n\t\tcorrect++;\n\n\t} else {\n\n\t\t_(\"status\").innerHTML = \"You got it wrong, buddy!\";\n\t\t//got the question wrong message\n\t};\n\n\tpos++;\n\trenderQuestion();\n}", "function selectAnswer() {\n let choice =\n btn1.dataset[\"number\"] == currentQuestion.correctanswer\n ? \"correct\"\n : \"incorrect\";\n correctAnswers();\n disabledOptions();\n if (choice == \"incorrect\") {\n btn1.classList.add(\"incorrect\");\n } else {\n btn1.classList.add(\"correct\");\n increaseScore(correct_score);\n }\n}", "function getAnswer(question_no){\n let user_ans;\n \n // user_ans = prompt(\"Enter number of correct answer\");\n user_ans = document.getElementById(\"user_ans\").value;\n \n if(user_ans===null){\n throw new Error('Prompt canceled, terminating Quiz');\n }\n if(user_ans!==\"exit\"){\n user_ans=parseInt(user_ans);\n }\n console.log(\"User Answer: \"+user_ans);\n // console.log(\"user_ans type: \"+typeof(user_ans));\n // console.log(\"q_no: \"+question_no);\n // console.log(\"q_no correct ans: \"+Quiz[question_no].correct);\n if(user_ans===Quiz[question_no].correct){\n return \"correct\";\n }else if(user_ans===\"exit\"){\n return \"exit\";\n }else{\n return \"incorrect\"\n }\n \n}", "function checkAnswer() {\n // checks the iput against the correct answer\n var answer = document.getElementById('answer').value;\n if (answer == correctAnswer || event.which === 13) {\n points++;\n moveCar()\n pointsDisplay.innerHTML = points;\n return 'Well done! your answer is right. Keep Moving!';\n } else if (answer !== correctAnswer) {\n points--;\n moveCar();\n pointsDisplay.innerHTML = points;\n return 'Damn! your answer is wrong.';\n }\n}", "function checkAnswers() {\n\n}", "function checkSelection() {\n console.log(\"check selection function reached\");\n \n // hide the questionAsked board and stop the timer\n $(\"#questionAsked\").hide();\n clearInterval(counter);\n $(\"#timerDiv\").html(\"&nbsp;\");\n \n // if answer was right\n if (userGuess.data(\"value\") == allQuestionsArray[gameVariables.currentQuestion].correctAnswer) {\n console.log(userGuess.data(\"value\"));\n console.log(\"correct\");\n // run the correctAnswer function\n correctAnswer();\n }\n // else if answer was wrong\n else {\n console.log(userGuess.data(\"value\"));\n console.log(\"incorrect\");\n // run the incorrectAnswer function\n incorrectAnswer();\n }\n \n }", "function checkAnswer(question, answer) {\n console.log(\"question: \", question);\n console.log(\"asnwer: \", answer);\n let correctAnswer = questions.answer;\n let userAnswer = questions[question].options[answer];\n if (userAnswer == correctAnswer) {\n index = index + 1;\n console.log(score);\n console.log(\"Correct!!\");\n }\n else {\n index = index + 1;\n countDown = countDown - 15;\n score = score - 15;\n console.log(score);\n console.log(\"Next question: \", index);\n console.log(\"Incorrect!\");\n }\n clearQuestion();\n renderAllQuestions();\n // quizOver();\n }", "function isCorrect(){\n let temp; //used to keep track of the correct answer index\n for (let i =0; i<answerChoices[num-1].length; i++)\n {\n if (answerChoices[num-1][i] === correctAnswers[num-1]){\n temp=i;\n }\n }\n \n if (parseInt(input,10) === temp){ //input = index of correct answer\n console.log('V- Correct answer -V');\n score++;\n }\n else if (parseInt(input, 10) < 7 && parseInt(input, 10) < answerChoices[num-1].length){ //input is any of the other choices, wrong\n console.log('X- Sorry. Wrong answer. -X');\n score--;\n }\n else if(input === 'exit' || input === 'EXIT'){ \n console.log('Thank you for playing.');\n console.log('---Your final score is: '+score+'.---');\n }\n else{\n console.log('You entered the wrong value'); //input is anything but a number\n }\n\n //doesnt appear if user quits game\n if(stillPlaying){ \n console.log('----Your current score is: '+score+'.----');\n }\n }", "function answerChosen(userAnswer) {\n \n var rightAnswer = questions[questionCounter].correctAnswer;\n console.log(userAnswer);\n\n if (questions[questionCounter].correctAnswer === userAnswer){\n console.log(\"correct answer\");\n correct();\n } \n else if (questions[questionCounter].correctAnswer != userAnswer) {\n console.log(\"incorrect answer\");\n incorrect(rightAnswer);\n\n }\n else {\n console.log(\"times up\");\n timesUp();\n }\n\n }", "function checkAnswers() {\n\n\t\t$( '.button-question').on('click', function() {\n\t\t\tvar $this = $(this);\n\t\t\tconsole.log($this);\n\t\t\tvar val = $this.attr('value');\n\t\t\t// console.log(val);\n\n\t\t\tif (val === 'true'){\n\t\t\t\trightAnswer ++;\n\t\t\t\tconsole.log(rightAnswer);\n\t\t\t} else {\n\t\t\t\twrongAnswer ++;\n\t\t\t\tconsole.log(wrongAnswer);\n\t\t\t}\n\t\t\tnoAnswer = 5 - (rightAnswer + wrongAnswer);\n\t\t\t// console.log(\"unanswered\" + noAnswer);\n\t\t});\n\n\t}", "function evalChoice () {\n\t\tvar selection = $(\"input[type='radio']:checked\").val();\n\t\tvar defaultText = $(\".rank > p\").text(\"If you'd like a promotion, click NEW GAME below to try again.\");\n\t\t\t\tif(selection == questions[currentQuestion].correctAnswer) {\n\t\t\t\t\tnumCorrect++;\n\t\t\t\t\tconsole.log(numCorrect);\n\t\t\t\t\t//increment number of correct answers, tracks amount of correct answers\n\t\t\t\t\t$(\".feedback\").append(\"<h3>CORRECT</h3>\" + \"<p>\" + questions[currentQuestion].explanation + \"</p>\");\n\t\t\t\t\t//show feedback positive\n\t\t\t\t\tif (numCorrect == 1) {\n\t\t\t\t\t\t$(\"aside.score > #one\").removeClass().addClass(\"stars_appear\");\n\t\t\t\t\t\t $(\".rank > h4\").text(\"You've earned the rank of a BRIGADIER GENERAL!\");\n\t\t\t\t\t\t defaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 2) {\n\t\t\t\t\t\t$(\"aside.score > #two\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the rank of a MAJOR GENERAL!\");\n\t\t\t\t\t\tdefaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 3) {\n\t\t\t\t\t\t$(\"aside.score > #three\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the rank of a LIEUTENANT GENERAL!\");\n\t\t\t\t\t\tdefaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 4) {\n\t\t\t\t\t\t$(\"aside.score > #four\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the rank of a GENERAL!\");\n\t\t\t\t\t\tdefaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 5) {\n\t\t\t\t\t\t$(\"aside.score > #five\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the highest rank of a FIVE-STAR GENERAL!\");\n\t\t\t\t\t\t$(\".rank > p\").text(\"This rank is specially reserved for wartime generals. You're ready to join the ranks of only NINE Americans who have held this title!\");\n\t\t\t\t\t}\n\t\t\t\t\t//Star will appear if correct\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$(\".feedback\").append(\"<h3>INCORRECT</h3>\" + \"<p>\" + questions[currentQuestion].explanation + \"</p>\");\n\t\t\t\t\t//show feedback negative\n\t\t\t\t\tif(numCorrect == 0) {\n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've created a new rank which prevents you from leading troops into battle.\");\n\t\t\t\t\t\t$(\".rank > p\").text(\"If you'd like a promotion, click NEW GAME below to try again.\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t}", "function checkAnswer(answer) {\n //Write your code in here\n}", "function is_correct_answer(answer_text){\n if (answer_text == correctAnswer) {\n return true;\n }\n return false;\n}", "function checkAnswer(choice){\n if(choice === correctA[currentQ]){\n alert('Great Job!');\n currentQ ++;\n writeQ()\n }else{\n alert('Wrong answer! Try again!');\n time -= 5;\n }\n }", "function handleAnswers() {\n $(document).on('click', '.submit', function (event) {\n event.preventDefault();\n // console.log(\"function handleAnswers\", userQuestionNumber);\n let correct = STORE[(userQuestionNumber)].correctAnswer;\n // console.log(correct);\n\n\n\n let answer = $(\"input[class='radio']:checked\").val();\n // console.log(answer);\n if (answer == correct) {\n goodAnswer();\n } else if (answer == undefined) {\n alert('Please choose an option!');\n } else {\n wrongAnswer();\n }\n $('.feedback').show();\n });\n}", "function checkAnswer() {\n\n let selected = $(\"input:checked\");\n let selectedValue = selected.val();\n\n let correctAnswer = STORE.questions[currentQuestionNumber - 1].answer;\n\n\n\n if (correctAnswer == selectedValue) {\n $(\".quizForm\").append(`<p class=\"correctAnswer\"><i class=\"fas fa-check-circle\" style=\"color:#008000;\"></i>\\xa0That is correct!</p>`);\n currentScore++;\n } else {\n $(\".quizForm\").append(`<p class=\"incorrectAnswer\"><i class=\"fas fa-times-circle\" style=\"color:#FF0000;\"></i>\\xa0Sorry, that is incorrect! The correct answer is <strong>${correctAnswer}</strong>.</p>`);\n\n }\n}", "function checkAnswer() {\n\n if ((questionNum === 0 && userChoice == 3) || \n (questionNum === 1 && userChoice == 1) ||\n (questionNum === 2 && userChoice == 2) ||\n (questionNum === 3 && userChoice == 3) ||\n (questionNum === 4 && userChoice == 3)) {\n\n footerEl.textContent = (\"Correct!\");\n }else {\n footerEl.textContent = (\"False.\")\n totalSeconds = totalSeconds -10;\n penalty.textContent = (\" -10\");\n }\n questionNum++;\n\n setTimeout(function() {\n generateQuestion();\n }, 500);\n \n \n}", "function selectAnswer(answer){\n console.log(answer)\n if (answer == questions[questionNum].correct){\n console.log('correct');\n } else {\n timeleft -= 10;\n }\n questionNum += 1\n\n if( questionNum<questions.length )\n getQuestions()\n else\n endQuiz() \n}", "function choice() {\n \n for (var i = 0; i < 4; i++) {\n if(document.getElementById('option' + i).checked){ // if answer is checked\n var answers = i; //document.getElementById('option' + i).value\n } \n }\n\n// Create conditions to check if answer choices are right or wrong\n\n if(randomQuestion == 0) { // question in array 0\n if(answers == 1){ // correct answer is choice in index 1\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n }else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n }\n }\n\n if(randomQuestion == 1) {\n if(answers == 0){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n\n }\n }\n\n if(randomQuestion == 2) {\n if(answers == 2){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n\n if(randomQuestion == 3) {\n if(answers == 3){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n\n if(randomQuestion == 4) {\n if(answers == 0){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n\n if(randomQuestion == 5) {\n if(answers == 2){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n \n document.getElementById('results').innerText = `Score: ${score}`;\n\n\n}", "function checkAnswer() {\n disableAnswerBtns();\n const userAnswer = this.firstElementChild.innerText;\n const correctAnswer = startRound()\n \n if (userAnswer === correctAnswer[\"category\"]) {\n updateScore();\n showFeedbackModal(true, correctAnswer)\n } else {\n showFeedbackModal(false, correctAnswer)\n }\n}", "function checkAnswer(){\n let correct=false;\n if(answer==\"correct\") correct=true;\n if(correct) correctAnswer(this);\n else {wrongAnswer(this)};\n}", "function nextQuestion(){\n var n = Math.floor(Math.random() * q.length);\n q[n].display1();\n var ans = prompt('Please select the correct answer. (tap \\'exit\\' to exit)');\n \n if (ans !== 'exit'){\n q[n].checkAnswer(parseInt(ans),keepScore);\n nextQuestion();\n }\n }", "function checkAnswer(){\n var sum = operand1 +operand2;\n var userAnswer = document. getElementById(\"answerInput\").value;\n \n if(sum == userAnswer){\n document.getElementById(\"response\").innerHTML=\"Correct!\";\n }\n else{\n document.getElementById(\"response\").innerHTML=\"Congrats, YOU GOT IT WRONG SUCKER!\";\n }\n \n}", "function selectAnswer() {\n\n}", "function checkCorrectAnswer() {\n let radios = $('input:radio[name=answer]');\n let selectedAnswer = $('input[name=\"answer\"]:checked').data('answer');\n let questionNumber = store.questionNumber;\n let correctAnswer = store.questions[questionNumber].correctAnswer;\n\n if (radios.filter(':checked').length === 0) {\n alert('Select an answer before moving on.');\n return;\n } else {\n store.submittingAnswer = true;\n if(selectedAnswer === correctAnswer){\n store.score += 1;\n store.currentQuestionState.answerArray = [true, correctAnswer, selectedAnswer];\n } else {\n store.currentQuestionState.answerArray = [false, correctAnswer, selectedAnswer];\n }\n }\n}", "function checkanswer(){\r\n if (userClickedPattern[currentspot]===gamePattern[currentspot])\r\n {\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n}", "function isAnswerCorrect(answer){\n\n if(correctAnswer === answer){\n return true;\n }\n else{\n return false;\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}", "evaluateAnswer(userAnswer){\n \tconst {value1, value2, value3, proposedAnswer} = this.state;\n \tconst corrAnswer = value1 + value2 + value3;\n \treturn(\n \t\t (corrAnswer === proposedAnswer && userAnswer === 'true') ||\n \t\t (corrAnswer !== proposedAnswer && userAnswer === 'false')\n \t);\n }", "function compareAnswer(answer){\n if(getText() === answer){\n alert(\"You Answered Correctly!\")\n $(\"#score\").html(parseInt($(\"#score\").html()) + parseInt($(\"#point-value\").html()))\n } else {\n alert(\"Better luck next time...\")\n }\n }", "function checkAnswer(questionNumber, answer) {\n\n}", "function answerSelected() {\n\n hideGameContainers(); \n\n console.log($(this).text());\n\n if ($(this).text() === answer[count]){\n\n stopTime();\n isSelected = true;\n \n console.log (isSelected);\n\n $('#answer-holder').show();\n $('#answer-holder').html('Correct! The answer is... ' + answer[count]);\n\n correct++;\n count++;\n\n } else {\n\n hideGameContainers();\n stopTime();\n isSelected = true;\n\n console.log (isSelected);\n\n $('#answer-holder').show();\n $('#answer-holder').html('Incorrect! Correct answer is... ' + answer[count]);\n\n incorrect++;\n count++;\n\n }\n console.log(count);\n endGame();\n\n }", "function checkAnswer() {\n possible_answers = document.getElementsByName(\"possible_answers\");\n for(var i = 0; i < possible_answers.length; i++) {\n if(possible_answers[i].checked) {\n chosen_answer = possible_answers[i].value;\n }\n }\n//if answer is correct, increase points\n if (chosen_answer == questions[pos].answer) {\n correct++;\n }\n pos++;\n displayQuestion();\n}", "function checkAnswer(answer) {\n if (answer[userAnswer].isCorrect) {\n console.log('Your answer is correct! :D');\n score++;\n } else {\n console.log('Your answer is incorrect! D:');\n if (score > 0) {\n score--;\n }\n }\n}", "function checkAnswer() {\r\n // get first factor\r\n var factor1 = document.getElementById('factor1').innerHTML;\r\n console.log(\"factor 1 = \" + factor1);\r\n // get second factor\r\n var factor2 = document.getElementById('factor2').innerHTML;\r\n console.log(\"factor 2 = \" + factor2);\r\n // get answer\r\n var answer = document.getElementById('answer').value;\r\n console.log(\"answer = \" + answer);\r\n console.log((factor1*factor2) == answer);\r\n return (factor1*factor2) == answer;\r\n}", "function q4() {\n\n var answerToFourthQ = prompt('Will I eventually become an effective front end web developer?').toUpperCase();\n\n if (answerToFourthQ === 'Y' || answerToFourthQ === 'YES') {\n alert('Correct! Let\\'s keep going!');\n }else if (answerToFourthQ === 'N' || answerToFourthQ === 'NO') {\n alert('Um, ya dun goofed!');\n }else{alert('Please type accurately! Answer YES or NO!')};\n\n}", "function checkanswer(arrayname, qnumber) {\n\t//Indicate Selected Answer\n\t$('#answers').on('mousedown', '.anschoice',function() {\n\t\t$(this).removeClass().addClass('select');\n\t\t$(this).siblings().removeClass().addClass('anschoice');\n\t});\n\t//Change selected choice back to original\n\t$('#answers').on('mousedown', '.select',function() {\n\t\t$(this).removeClass().addClass('anschoice');\n\t});\n\t//Below determines what to do when next button clicked\n\t$('#next').mousedown(function() {\n\t\t//Make sure a choice is selected!\n\t\tvar userselect = $('.select').text();\n\t\tconsole.log('userselect is: ' + userselect);\n\t\tif ( userselect === '') {\n\t\t\tconsole.log('Please select a choice!');\t\n\t\t\t$('#next').avgrund({\n\t\t\t\ttemplate: '<p> Please select a choice! </p>'\n\t\t\t});\n\t\t}\n\t\telse { // Check answer\n\t\t\tif (userselect === arrayname[qnumber].correctAnswer) {\n\t\t\t\tcorrect++;\n\t\t\t\tconsole.log('The user is correct! ' + correct);\n\t\t\t}\n\t\t\telse { \n\t\t\t\tconsole.log('user is wrong');\n\t\t\t\tconsole.log('#correct is: ' + correct);\n\t\t\t\tconsole.log(userselect + ' vs. ' + arrayname[qnumber].correctAnswer);\n\t\t\t}\n\t\t\t// Move on to the next question\n\t\t\tqnumber++;\n\t\t\tinsertquestion(arrayname, qnumber);\n\t\t\tconsole.log('qnumber from checkanswer is now ' + qnumber);\n\t\t\ttheend(qnumber, correct, arrayname);\n\t\t}\n\t\t});\n}", "function checkAnswer(question , answer){\n var userAnswer = myVar.question(chalk.cyanBright(question));\n if(userAnswer.toUpperCase() == answer.toUpperCase()){\n console.log(chalk.green(\"Correct.\"));\n score ++;\n }\n\n else{\n console.log(chalk.red(\"Wrong.\"));\n console.log(chalk.white(\"Correct Answer = \" + answer));\n }\n console.log(chalk.redBright(\"\\n-------------------\"));\n\n}", "function questionOne() {\n var quizOne = prompt('Do I like dogs?').toUpperCase();\n\n if (quizOne === 'YES' || quizOne === 'Y') {\n // console.log('Well done.');\n alert('Well done.');\n score++;\n } else if (quizOne === 'NO' || quizOne === 'N') {\n // console.log('Incorrect.');\n alert('Incorrect.');\n } else {\n // console.log('Ok, that doesn\\'t make sense.');\n alert('Ok, that doesn\\'t make sense.');\n }\n}", "function correctAnswer(){\n\t\tcorrect++;\n\t\talert(\"You are Right! Good job!\");\n\t}", "function checkAnswer(answer) {\n if (answer == questionsE[runningQuestion].correctAnswer) {\n // answer is correct\n answerIsCorrect();\n score++;\n } else {\n // answer is incorrect\n answerIsIncorrect();\n alert(`Sorry you got it wrong! The correct answer is ${questionsE[runningQuestion].correctAnswer}`);\n }\n if (runningQuestion <= lastQuestion) {\n runningQuestion++;\n increment();\n renderQuestion();\n }\n}", "function questionOneTravel(){\n var countries = prompt('I have been to more than 5 different countries.').toUpperCase();\n console.log('5 countries: ' + countries);\n\n if(countries === 'Y' || countries === 'YES') {\n alert('I have only been to 3 countries, but I would love to travel more.');\n } else if (countries === 'N' || countries === 'NO') {\n alert('That is correct, I have only been to 3 different countries.');\n scoreCounter++;\n } else {\n alert('Please enter Y or N!');\n }\n}", "function correctAnswer () {\n return quiz.questions[quiz.currentQuestion].correctChoice\n}", "function checkAnswer(answer) {\n\t\treturn answer.isCorrect;\n\t}", "function checkQuestion() {\r\n correctAnswer = randomQuestion.answer;\r\n\r\n if ($(\"#optionA\").prop(\"checked\")) {\r\n userAnswer = \"optionA\";\r\n } else if ($(\"#optionB\").prop(\"checked\")) {\r\n userAnswer = \"optionB\";\r\n } else if ($(\"#optionC\").prop(\"checked\")) {\r\n userAnswer = \"optionC\";\r\n } else if ($(\"#optionD\").prop(\"checked\")) {\r\n userAnswer = \"optionD\";\r\n }\r\n\r\n if (userAnswer === correctAnswer) {\r\n score++;\r\n } else {\r\n wrong++;\r\n }\r\n\r\n removeQuestion(randomQuestion);\r\n}", "function checkcurr() {\n outresult[position][1] = $(\"input[name=answer]:checked\", \"#ansform\").val();\n if (outresult[position][1] === outresult[position][3]) {\n outresult[position][2] = \"Correct\";\n } else {\n outresult[position][2] = \"Incorrect\";\n }\n}//end of checkcurr", "function checkAnswer(question, answer) {\n console.log(\"question: \", question);\n console.log(\"answer: \", answer);\n let correctAnswer = questions[question].answer;\n let userAnswer = questions[question].choices[answer];\n if (userAnswer == correctAnswer) {\n index = index + 1;\n console.log(score);\n console.log(\"Correct\");\n }\n // This will allow code to continue even if wrong answer is selcted along with taking away time\n else {\n index = index + 1;\n countDown = countDown - 15;\n score = score - 15;\n console.log(score);\n console.log(\"Next question: \", index);\n console.log(\"Incorrect\");\n }\n clearQuestionDiv();\n renderQuestions();\n quizOver();\n}", "function checkResult(playerChoice) {\r\n resetSelected()\r\n computerRandomChoice()\r\n displayComputerChoice()\r\n updateScore(playerChoice)\r\n}", "function question3(){\n var questionThree = prompt(\"Was i born in March? (yes/y/no/n)\").toLowerCase();\n console.log(\"User's answer to question three\", questionThree);\n if (questionThree === \"yes\" || questionThree ==='y'){\n alert(\"Yes!\");\n correctAnswer++;\n }\n else if(questionOne === \"no\" || questionOne ===\"n\"){\n alert(\"You're wrong.\");\n }\n else{\n alert(\"You have to answer with yes or no.\");\n }\n}", "function checkQuestion() {\n\n var selected = $(\"#sol:checked\");\n\n //Was answer right?\n if (selected.val())\n {\n //TODO: Have two button-process for correct answer choice\n $.ajax({\n type: \"POST\",\n url: handlerUrl,\n data: JSON.stringify({\"question\": \"correct\", \"flag\": flag}),\n success: updateQuestion\n });\n }\n else\n {\n flag = \"true\";\n //TODO: style for the shaking button\n alert('incorrect answer');\n }\n }", "function evaluateAnswers(answer) {\n\n\tif(answer === answers[0].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[0].isCorrect;\n\t}\n\n\telse if(answer === answers[1].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[1].isCorrect;\n\t}\n\telse if(answer === answers[2].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[2].isCorrect;\n\t}\n\telse if(answer === answers[3].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[3].isCorrect;\n\t}\n\n\telse {\n\t\tunanswered = true;\n\t}\n}", "function checkWin() {\n // If selectedOption is in results[i].correct_answer \n // Add one to total score\n // Else there's nothing\n console.log('in the checkWin function, the selectedOption is ', selectedOption,' the correct answer is ', correctAnswer);\n if (selectedOption === correctAnswer) {\n totalCorrect++;\n totalQuestions = totalCorrect + totalIncorrect;\n } else {\n totalIncorrect++;\n totalQuestions = totalCorrect + totalIncorrect;\n }\n}" ]
[ "0.76616037", "0.7653011", "0.75845397", "0.7515136", "0.74669963", "0.74516445", "0.7447925", "0.74352103", "0.74136347", "0.7407009", "0.73902565", "0.7390235", "0.7383392", "0.7378582", "0.73462164", "0.73422813", "0.7342097", "0.73239917", "0.73123807", "0.730571", "0.72928125", "0.72820747", "0.7281485", "0.722479", "0.72231257", "0.7210907", "0.7210818", "0.7208424", "0.7181537", "0.7180849", "0.71618813", "0.7161081", "0.7137532", "0.7135149", "0.7128262", "0.7126419", "0.71212184", "0.7110037", "0.7103696", "0.7101639", "0.7101081", "0.7099762", "0.7096958", "0.7081469", "0.70659626", "0.7044039", "0.70404387", "0.7031392", "0.7029842", "0.70281804", "0.70220655", "0.7014596", "0.7007064", "0.70029217", "0.7002761", "0.6975465", "0.69698036", "0.6959563", "0.6957451", "0.6952568", "0.6951387", "0.69429225", "0.6939858", "0.69395864", "0.69369304", "0.6935149", "0.6925167", "0.6922988", "0.6921014", "0.69128484", "0.6907797", "0.6906796", "0.68975186", "0.6895936", "0.6895097", "0.68901384", "0.68846416", "0.68755734", "0.6873434", "0.6871711", "0.68653274", "0.6859691", "0.68576443", "0.68574524", "0.6854601", "0.6854595", "0.68510216", "0.68495476", "0.684686", "0.68395275", "0.6838661", "0.68384767", "0.68359935", "0.6835747", "0.68351614", "0.68340564", "0.6832726", "0.682925", "0.6825771", "0.6822961", "0.68195146" ]
0.0
-1
if the user selects the wrong answer
function generateLoss() { incorrectTally++; gameHTML = correctAnswers[questionCounter] + "" + losingImages[questionCounter]; $(".mainDiv").html(gameHTML); setTimeout(wait, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function choose0() { checkAnswer(0) }", "function answerSelected() {\n let selected = $('input:checked');\n let answer = selected.val();\n\n if(answer !==undefined){\n\n let correctAnswer = `${STORE[questionNumber].correctAnswer}`;\n if (answer === correctAnswer) {\n rightAnswerFeedback();\n } else {\n wrongAnswerFeedback(correctAnswer);\n }\n}\n}", "function choose() {\n if ($('input[name=\"answer\"]:checked').val() === undefined) {\n alert('Por favor selecione uma opção!');\n } else {\n selections[questionCounter] = $('input[name=\"answer\"]:checked').val();\n return true;\n }\n }", "function verifyAnswer(selection) {\n\n if (selection === questions[rand][2]) {\n correct++;\n setGif(0);\n } else {\n incorrect++;\n setGif(1);\n }\n\n } //ends verifyAnswer", "function selectAnswer() {\n //if right answer show correct, and log score\n if (questions[questionNumber].answer === userAnswer) {\n win();\n stop();\n questionNumber++;\n // wait to start next question\n nextQuestion();\n }\n //if wrong answer show correct and log score\n else {\n lose();\n stop();\n questionNumber++;\n // wait to start next question\n nextQuestion();\n }\n}", "function checkAnswer(selected){\n let rightAnswer = questionsArray[questionCounter].correctAnswer;\n \n if(selected === rightAnswer){\n score++;\n displayPopup(true, rightAnswer);\n } \n else{\n displayPopup(false, rightAnswer);\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 answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function checkIfAnswer(ev){\n\t\tif(document.getElementById(currentChoice).textContent == currentSet.correctChoice)\n\t\t\tallowDrop(event);\n}", "function checkAnswer() {\n var userSelection = $(\"input:checked\").val(); // answer index of user selection in choices\n //check the index is equal to the correct answer index , if yes, stop time, print correct\n if (userSelection == problems[counter].answer) {\n timer.stopTimer();\n correctAns++;\n $(\"#ringt-answer\").html(\"<h2>Correct!</h2>\")\n\n } else {\n timer.stopTimer();\n wrongAns++;\n var correctText = problems[counter].answerText;\n $(\"#wrong-answer\").html(\"<h2>Incorrect!</h2>\" + \"<br></br>\" + \"<h2>the correct answer is: \" + correctText + \"</h2>\")\n\n }\n\n}", "function answerQ () {\n let val = document.getElementById('answer');\n \n if (val === '') { alert('Mohon jawab dulu!'); generateAngka(); }\n \n if (val === ops) { alert('Jawaban kamu benar!\\nMembuat pertanyaan baru lagi..'); generateAngka(); }\n}", "function checkAnswerValid() {\n\tlet answerIndex = $('input[name=answer]:checked').val()\n\tlet answerNotSelected = !answerIndex\n\n\tif (answerNotSelected) {\n\t\talert('Whoever didnt pick an answer...ya moms a h0e')\n\t} else {\n\t\tlet answer =\n\t\t\tQUESTIONS[currentQuestionIndex].answers[\n\t\t\t\tNumber($('input[name=answer]:checked').val())\n\t\t\t]\n\n\t\tupdateForm({ answer, answerIndex })\n\n\t\t// increment correct / incorrect count\n\t\tanswer.correct ? numCorrect++ : numIncorrect++\n\t\tupdateCorrectIncorrect()\n\t}\n}", "function selectAnswer(event) {\n console.log(event.target.value);\n\n if (event.target.value === questionsArr[currentQuestionIndex].correct) {\n currentQuestionIndex++;\n console.log(\"correct\");\n judgeEl.textContent = \"CORRECT!\";\n judgeEl.classList.remove(\"hide\");\n quizDone();\n }\n else {\n currentQuestionIndex++;\n timeLeft = timeLeft - 10;\n console.log(\"incorrect\");\n judgeEl.textContent = \"WRONG!\";\n judgeEl.classList.remove(\"hide\");\n quizDone();\n }\n}", "function submitAnswer() {\n let radios = document.getElementsByName(\"choice\");\n let userAnswer;\n \n for(i = 0 ; i < radios.length; i++ ) {\n if(radios[i].checked) {\n checked = true;\n userAnswer = radios[i].value;\n }\n } \n\n// if user click submit button without selecting any option\n if(!checked) {\n alert(\"You must select an answer\");\n return;\n }\n \n // Correct answer\n if(userAnswer === \"option4\") {\n alert(\"Answer is correct!\");\n rightAnswer++;\n $(\"#right\").text(\"Correct answers: \" + rightAnswer);\n reset();\n }\n // incorrect answer\n else {\n alert(\"Answer is wrong!\");\n wrongAnswer++;\n $(\"#wrong\").text(\"Inccorect answers: \" + wrongAnswer);\n reset();\n }\n}", "function checkUserChoice(event) {\n event.preventDefault();\n var userChoice = event.target.textContent;\n var correctAnswer = getAnswer();\n\n if (userChoice === correctAnswer) {\n questionIndex++;\n userScore++;\n correctQuestions.textContent = userScore;\n correctAnwerMsg();\n \n if (questionIndex >= questions.length){\n return endGame();\n }\n clearCurrentQuestion();\n displayCurrentQuestion();\n\n } else {\n questionIndex++;\n incorrectAnswerMsg();\n if (questionIndex >= questions.length){\n return endGame();\n }\n clearCurrentQuestion();\n displayCurrentQuestion();\n }\n}", "function checkAnswer() {\n\t\tif (answerChoice == currentQuestion.rightAnswer) {\n\t\t\t$(\"#hint\").text(currentQuestion.congratulations);\n\t\t\tcurrentQuestion.correct = true;\n\t\t\tupdateScore();\n\t\t} else {\n\t\t\tconsole.log('incorrect');\n\t\t\t$(\"#hint\").text(currentQuestion.sorry);\n\t\t};\n\t}", "function answerChoice(sel) {\n // console.log(`The correctAnswer function ran. The selected answer was: ${selectAns}`);\n // console.log(`The correct answer was: ${quizContent.correct[currentInd - 1]}`);\n // console.log(`current correct answer: ${quizContent.correct[currentInd-1]}`);\n // console.log(`sel is ${sel}`);\n\n if (sel === quizContent.correct[currentInd - 1]) {\n console.log(\"The answer was correct\");\n correctAnswer();\n currentScore++;\n\n } else {\n wrongAnswer();\n console.log(\"The answer was incorrect\");\n }\n}", "function validateChoice() {\n if (userChoice !== \"r\" && userChoice !== \"p\" && userChoice !== \"s\") {\n alert(\"pick a either r, p , or s\")\n getUserChoice();\n } else {\n generateComputerChoice();\n compareAnswer();\n }\n}", "function checkAnswer(choice, answer) {\n if (choice == answer) {\n return true;\n } else {\n return false;\n }\n }", "function checkAnswer(answer) {\n event.preventDefault();\n if (answer === rightAnswer) {\n correctAnswerFn('WIN')\n\n } else {\n incorrectAnswerFn('LOSE')\n }\n if (fifty === \"FIFTY\") {\n fiftyLine('USEDFIFTY')\n }\n }", "function updateAnswer(e) {\n var answer = $(\"input[type='radio']:checked\").val();\n if (answer == questions[currentQuestion].correct) {\n numberCorrect++; \n } else if (answer == null) {\n \talert('Please choose an option!');\n e.preventDefault();\n }\n }", "function feedbackForAnswer(answer) {\n var curvature = TreeConstructor.root.curvature;\n var suffix = \". \" + CONTINUE_BUTTON;\n if (curvature == answer) {\n var message = \"The expression is \" + \n CURVATURE_DISPLAY_NAME[curvature] + suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-success\">' +\n '<span><strong>Correct!</strong> ' + message + '</span></div>')\n } else {\n var message = \"The expression is \" + CURVATURE_DISPLAY_NAME[curvature] + \n \", but you answered \" + CURVATURE_DISPLAY_NAME[answer] +\n suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-error\">' +\n '<span><strong>Incorrect!</strong> ' + message + '</span></div>')\n }\n // Increase/decrease difficulty\n updateLevel(curvature == answer);\n // Listen to new expression button.\n $(\"#newExpression\").click(loadNewExpression);\n }", "function checkAnswerChoice() {\n let answerChoice = $('input[type=radio][name=options]:checked').val();\n console.log(answerChoice);\n if (answerChoice === store.questions[store.questionNumber].correctAnswer) {\n updateScore();\n $('main').html(correctAnswer());\n } else {\n $('main').html(wrongAnswer());\n }\n}", "function checkAnswer() {\n let userAnswer = parseInt(document.getElementById(\"answer-box\").value);\n let calculatedAnswer = calculateCorrectAnswer();\n let isCorrect = userAnswer === calculatedAnswer[0];\n\n if (isCorrect) {\n alert(\"Hey! You got it right! :D\");\n incrementScore();\n } else {\n alert(`Awwww.....you answered ${userAnswer}. The correct answer was ${calculatedAnswer[0]}!`);\n incrementWrongAnswer();\n }\n\n runGame(calculatedAnswer[1]);\n\n\n}", "function checkAnswer () {\n console.log(userSelected.text);\n\n if (userSelected === questions[i].correctAnswer) {\n score ++;\n $(\"#score\").append(score);\n $(\"#answerCheck\").append(questions[i].rightReply);\n i++;\n } else {\n $(\"#answerCheck\").append(questions[i].wrongReply);\n i++;\n } \n }", "function selectCorrectAnswer(aNum) {\n setCorrectAnswer(aNum);\n }", "function answerCheck () {\n \n \n if(selectedAnswer===realAnswerArray[rightAnswerCounter]) {\n \n $(\"#showAnswer\").text(\"You Got It!!\");\n generateWin();\n \n \n } else {\n $(\"#showAnswer\").text(\"Oops!!\");\n generateLoss();\n \n }\n}", "function checkAnswer(answer, answerSelection) {\n //Write your code in here\n // if the \"veryPositive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very positive\"\n if (possibleAnswers.veryPositive.includes(answer, [answerSelection])) {\n return \"very positive\";\n }\n // if the \"positive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"positive\"\n else if (possibleAnswers.positive.includes(answer, [answerSelection])) {\n return \"positive\";\n }\n // if the \"negative\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"negative\"\n else if (possibleAnswers.negative.includes(answer, [answerSelection])) {\n return \"negative\";\n }\n // if the \"veryNegative\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very negative\"\n else if (possibleAnswers.veryNegative.includes(answer, [answerSelection])) {\n return \"very negative\";\n }\n}", "check(user_choice){\n return user_choice === this.answer;\n }", "function correctAnswer() {\n return $scope.answer.value === $scope.data.solution;\n }", "function getAnswer(question_no){\n let user_ans;\n \n // user_ans = prompt(\"Enter number of correct answer\");\n user_ans = document.getElementById(\"user_ans\").value;\n \n if(user_ans===null){\n throw new Error('Prompt canceled, terminating Quiz');\n }\n if(user_ans!==\"exit\"){\n user_ans=parseInt(user_ans);\n }\n console.log(\"User Answer: \"+user_ans);\n // console.log(\"user_ans type: \"+typeof(user_ans));\n // console.log(\"q_no: \"+question_no);\n // console.log(\"q_no correct ans: \"+Quiz[question_no].correct);\n if(user_ans===Quiz[question_no].correct){\n return \"correct\";\n }else if(user_ans===\"exit\"){\n return \"exit\";\n }else{\n return \"incorrect\"\n }\n \n}", "function q1 (){\n let answer = prompt('Is Quen from Maine?');\n answer = answer.toLowerCase();\n \n //question1\n if (answer === answerBank[2] || answer === answerBank[3]){\n console.log('correct');\n globalCorrect = globalCorrect + 1;\n alert('You got it correct, ' + userName + '!');\n }\n else if (answer === answerBank[0] || answer === answerBank[1]){\n console.log('Wrong');\n alert('Ouch! Better luck on the next one.');\n }\n else{\n //console.log('Non accepted answer submitted');\n alert('Wow, really?');\n }\n}", "function checkAnswer(selectedAnswer) {\n const correctAnswer = quiz[currentQuestion].answer;\n \n if (selectedAnswer === correctAnswer) {\n score++;\n }\n \n currentQuestion++;\n \n if (currentQuestion < quiz.length) {\n displayQuestion();\n } else {\n showResult();\n }\n }", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function userSelection() {\n stopCountdown();\n if ($(this).attr(\"data-name\") == correctAnswers[questionSelector]) {\n rightWrong = true;\n correct++;\n var newScore = score += points;\n $(\"#score\").text(newScore);\n } else {\n incorrect++ \n }\n showResult();\n nextQuestion();\n }", "function checkAnswer() {\r\n STORE.view = 'feedback';\r\n let userSelectedAnswer = STORE.userAnswer;\r\n let correctAnswer = STORE.questions[STORE.questionNumber].correctAnswer;\r\n console.log('Checking answer...');\r\n if (userSelectedAnswer == correctAnswer) {\r\n STORE.score++;\r\n STORE.correctAnswer = true;\r\n }\r\n else {\r\n STORE.correctAnswer = false;\r\n }\r\n}", "function checkAnswer(answer){\n correct = quizQuestions[currentQuestionIndex].correctAnswer;\n if (answer === correct && currentQuestionIndex !== finalQuestionIndex){\n score++;\n alert(\"Thats Right!\");\n currentQuestionIndex++;\n generateQuizQuestion();\n }else if (answer !== correct && currentQuestionIndex !== finalQuestionIndex){\n alert(\"WRONG!\");\n //-----DEDUCT TIME FOR WRONG ANSWERS------\n timeLeft = timeLeft - deduction;\n currentQuestionIndex++;\n generateQuizQuestion();\n }else{\n showScore();\n }\n}", "function clickedWrong() {\n $(\"#correctInput\").hide();\n $(\"#wrongInput\").show();\n if (clickedWrong) {\n yourScore -=5;\n }; if (yourScore < 0) {\n yourScore=0;\n }\n }", "function wrongAnswer(){\n\t\twrong++;\n\t\talert(\"That is not correct.\");\n\t}", "function checkGuess(){\r\n guesstext=guesstext.toUpperCase();//country array is in upper case, so change guess to uppercase\r\n if(guesstext==answer){//if the guess was correct\r\n answer=pickAnswer();//find a new answer\r\n chances=3; score+=10; guess.value=\"\";//reset chances to 3, add 10 to score and clear guess input field\r\n alert(guesstext+\"! You're right!\");//congratulate the user\r\n }\r\n else{chances-=1; guess.value=\"\";//guess is not correct, subtract one chance and clear the input field\r\n if(chances>0){alert(\"Nope. Try again.\");}//if there are chances left, ask user to try again\r\n }\r\n showGui();// turns on the engine and updates info\r\n }", "function isCorrect(){\n let temp; //used to keep track of the correct answer index\n for (let i =0; i<answerChoices[num-1].length; i++)\n {\n if (answerChoices[num-1][i] === correctAnswers[num-1]){\n temp=i;\n }\n }\n \n if (parseInt(input,10) === temp){ //input = index of correct answer\n console.log('V- Correct answer -V');\n score++;\n }\n else if (parseInt(input, 10) < 7 && parseInt(input, 10) < answerChoices[num-1].length){ //input is any of the other choices, wrong\n console.log('X- Sorry. Wrong answer. -X');\n score--;\n }\n else if(input === 'exit' || input === 'EXIT'){ \n console.log('Thank you for playing.');\n console.log('---Your final score is: '+score+'.---');\n }\n else{\n console.log('You entered the wrong value'); //input is anything but a number\n }\n\n //doesnt appear if user quits game\n if(stillPlaying){ \n console.log('----Your current score is: '+score+'.----');\n }\n }", "function quiz(question, choice, answer){ \n //getting user's answer\n var playerAnswer = readlineSync.keyInSelect(choice, question);\n //checkAnswer\n var check;\n if (playerAnswer === answer){\n check = 1;\n score++;\n } else if(playerAnswer === -1){\n check = -1;\n } else{\n check = 0;\n score -= 0.25; \n }\n return check;\n}", "function determineAnswer() {\n switch (answer) {\n case 'Yes':\n timeGTOne = 1\n GettingBlobsOfDoom()\n break;\n case 'No':\n writeText('All righty then. See ya later!')\n InInn()\n break;\n }\n }", "function checkAnswer(e) {\n // targets user selection\n var answer = e.target.innerText;\n console.log(answer);\n\n //cannot set answer = to question correct answer\n // !!!!! NEED HELP WITH THIS !!!!\n if (answer === questions[qIndex].correct) {\n userScore++;\n scoreBox.innerHTML = `<h2>Score: ${userScore}</h2>`;\n console.log(userScore);\n // if answer correct, add one to question index\n qIndex++;\n // run questionCycle again prompting new question\n questionCycle();\n // box for user score have it update everytime this happens\n } else {\n // decreases timer by one second if user selects wrong answer\n timerCount = timerCount - 5;\n qIndex++;\n scoreBox.innerHTML = `<h2>Score: ${userScore}</h2>`;\n // prompts new question if answered incorrectly\n questionCycle();\n }\n}", "function nextQuestion(){\n var n = Math.floor(Math.random() * q.length);\n q[n].display1();\n var ans = prompt('Please select the correct answer. (tap \\'exit\\' to exit)');\n \n if (ans !== 'exit'){\n q[n].checkAnswer(parseInt(ans),keepScore);\n nextQuestion();\n }\n }", "function checkAnswer() {\n if (document.getElementById(\"true\").selected) {\n processAnswer(\"true\");\n }\n else {\n processAnswer(\"false\");\n }\n // get next question if not asked all yet\n if (questionsAsked < 10) {\n setQuestion();\n }\n // final question asked show prompt.\n else {\n alert(\"Quiz complete! You got \" + totalCorrect + \" correct out of 10.\");\n\n }\n\n // update totals\n document.getElementById(\"qnr\").innerHTML = \"Question:\" + questionsAsked;\n document.getElementById(\"score\").innerHTML = \"Score:\" + totalCorrect;\n\n}", "function evalChoice () {\n\t\tvar selection = $(\"input[type='radio']:checked\").val();\n\t\tvar defaultText = $(\".rank > p\").text(\"If you'd like a promotion, click NEW GAME below to try again.\");\n\t\t\t\tif(selection == questions[currentQuestion].correctAnswer) {\n\t\t\t\t\tnumCorrect++;\n\t\t\t\t\tconsole.log(numCorrect);\n\t\t\t\t\t//increment number of correct answers, tracks amount of correct answers\n\t\t\t\t\t$(\".feedback\").append(\"<h3>CORRECT</h3>\" + \"<p>\" + questions[currentQuestion].explanation + \"</p>\");\n\t\t\t\t\t//show feedback positive\n\t\t\t\t\tif (numCorrect == 1) {\n\t\t\t\t\t\t$(\"aside.score > #one\").removeClass().addClass(\"stars_appear\");\n\t\t\t\t\t\t $(\".rank > h4\").text(\"You've earned the rank of a BRIGADIER GENERAL!\");\n\t\t\t\t\t\t defaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 2) {\n\t\t\t\t\t\t$(\"aside.score > #two\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the rank of a MAJOR GENERAL!\");\n\t\t\t\t\t\tdefaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 3) {\n\t\t\t\t\t\t$(\"aside.score > #three\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the rank of a LIEUTENANT GENERAL!\");\n\t\t\t\t\t\tdefaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 4) {\n\t\t\t\t\t\t$(\"aside.score > #four\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the rank of a GENERAL!\");\n\t\t\t\t\t\tdefaultText;\n\t\t\t\t\t}\n\t\t\t\t\telse if (numCorrect == 5) {\n\t\t\t\t\t\t$(\"aside.score > #five\").removeClass().addClass(\"stars_appear\"); \n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've earned the highest rank of a FIVE-STAR GENERAL!\");\n\t\t\t\t\t\t$(\".rank > p\").text(\"This rank is specially reserved for wartime generals. You're ready to join the ranks of only NINE Americans who have held this title!\");\n\t\t\t\t\t}\n\t\t\t\t\t//Star will appear if correct\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$(\".feedback\").append(\"<h3>INCORRECT</h3>\" + \"<p>\" + questions[currentQuestion].explanation + \"</p>\");\n\t\t\t\t\t//show feedback negative\n\t\t\t\t\tif(numCorrect == 0) {\n\t\t\t\t\t\t$(\".rank > h4\").text(\"You've created a new rank which prevents you from leading troops into battle.\");\n\t\t\t\t\t\t$(\".rank > p\").text(\"If you'd like a promotion, click NEW GAME below to try again.\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t}", "function checkAnswer(question, answer) {\n console.log(\"question: \", question);\n console.log(\"asnwer: \", answer);\n let correctAnswer = questions.answer;\n let userAnswer = questions[question].options[answer];\n if (userAnswer == correctAnswer) {\n index = index + 1;\n console.log(score);\n console.log(\"Correct!!\");\n }\n else {\n index = index + 1;\n countDown = countDown - 15;\n score = score - 15;\n console.log(score);\n console.log(\"Next question: \", index);\n console.log(\"Incorrect!\");\n }\n clearQuestion();\n renderAllQuestions();\n // quizOver();\n }", "function checkAnswer() {\n\n if ((questionNum === 0 && userChoice == 3) || \n (questionNum === 1 && userChoice == 1) ||\n (questionNum === 2 && userChoice == 2) ||\n (questionNum === 3 && userChoice == 3) ||\n (questionNum === 4 && userChoice == 3)) {\n\n footerEl.textContent = (\"Correct!\");\n }else {\n footerEl.textContent = (\"False.\")\n totalSeconds = totalSeconds -10;\n penalty.textContent = (\" -10\");\n }\n questionNum++;\n\n setTimeout(function() {\n generateQuestion();\n }, 500);\n \n \n}", "function checkAnswers() {\n\n\t\t$( '.button-question').on('click', function() {\n\t\t\tvar $this = $(this);\n\t\t\tconsole.log($this);\n\t\t\tvar val = $this.attr('value');\n\t\t\t// console.log(val);\n\n\t\t\tif (val === 'true'){\n\t\t\t\trightAnswer ++;\n\t\t\t\tconsole.log(rightAnswer);\n\t\t\t} else {\n\t\t\t\twrongAnswer ++;\n\t\t\t\tconsole.log(wrongAnswer);\n\t\t\t}\n\t\t\tnoAnswer = 5 - (rightAnswer + wrongAnswer);\n\t\t\t// console.log(\"unanswered\" + noAnswer);\n\t\t});\n\n\t}", "function selectAnswer(answer){\n console.log(answer)\n if (answer == questions[questionNum].correct){\n console.log('correct');\n } else {\n timeleft -= 10;\n }\n questionNum += 1\n\n if( questionNum<questions.length )\n getQuestions()\n else\n endQuiz() \n}", "function checkAnswer(question) {\n var selected = $(\"input[name=\"+question+\"]:checked\").val();\n\n // If Correct Answer\n if(selected === answers[questionNumber]) {\n correctAnswer();\n // If We've Answered All the Questions, Celebrate\n if(questionNumber == tot) {\n setTimeout(quizWin, 1500);\n }\n }\n //If Wrong Answer\n else {\n tries += 1;\n if(tries == 3) {\n oediWan();\n }\n else {\n var incorrectResponseArray = [\n \"That's incorrect. Try again!\",\n \"Hmm, that's still not right. Give it one more try!\"\n ];\n $(\".quiz_container .result\").addClass(\"wrong\").html(incorrectResponseArray[tries-1]);\n \n // Animate Jabba\n if(jabba == \"frown\") {\n !tween2.playing && tween2.start();\n jabba = \"smile\";\n }\n\n }\n }\n }", "function choice() {\n \n for (var i = 0; i < 4; i++) {\n if(document.getElementById('option' + i).checked){ // if answer is checked\n var answers = i; //document.getElementById('option' + i).value\n } \n }\n\n// Create conditions to check if answer choices are right or wrong\n\n if(randomQuestion == 0) { // question in array 0\n if(answers == 1){ // correct answer is choice in index 1\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n }else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n }\n }\n\n if(randomQuestion == 1) {\n if(answers == 0){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n\n }\n }\n\n if(randomQuestion == 2) {\n if(answers == 2){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n\n if(randomQuestion == 3) {\n if(answers == 3){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n\n if(randomQuestion == 4) {\n if(answers == 0){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n\n if(randomQuestion == 5) {\n if(answers == 2){\n document.getElementById('submit').innerHtml = alert('Correct');\n score++;\n } else {\n document.getElementById('submit').innerHtml = alert('Wrong');\n \n }\n }\n \n document.getElementById('results').innerText = `Score: ${score}`;\n\n\n}", "function confirmAnswer(answer){\n correct = questionsArray[questionOptions].correctAnswer\n if(answer === correct){\n questionOptions++;\n alert(\"You are right!\");\n scoreBoard.textContent = \"Score: \" + score++;\n questionSelect()\n \n }\n else if(answer !== correct){\n questionOptions++;\n alert(\"Wrong answer!\");\n timerSetting -= 5;\n questionSelect()\n \n }\n}", "function checkAnswer(question, answer) {\n console.log(\"question: \", question);\n console.log(\"answer: \", answer);\n let correctAnswer = questions[question].answer;\n let userAnswer = questions[question].choices[answer];\n if (userAnswer == correctAnswer) {\n index = index + 1;\n console.log(score);\n console.log(\"Correct\");\n }\n // This will allow code to continue even if wrong answer is selcted along with taking away time\n else {\n index = index + 1;\n countDown = countDown - 15;\n score = score - 15;\n console.log(score);\n console.log(\"Next question: \", index);\n console.log(\"Incorrect\");\n }\n clearQuestionDiv();\n renderQuestions();\n quizOver();\n}", "function checkAnswer(answer) {\n correct = quizQuestions[currentQuestionIndex].correctAnswer;\n\n if (answer === correct && currentQuestionIndex !== finalQuestionIndex) {\n score++;\n alert(\"That Is Correct!\");\n currentQuestionIndex++;\n generateQuizQuestion();\n //If correct.\n } else if (answer !== correct && currentQuestionIndex !== finalQuestionIndex) {\n alert(\"That Is Incorrect.\")\n currentQuestionIndex++;\n generateQuizQuestion();\n //If wrong.\n } else {\n showScore();\n }\n}", "function checkanswer(arrayname, qnumber) {\n\t//Indicate Selected Answer\n\t$('#answers').on('mousedown', '.anschoice',function() {\n\t\t$(this).removeClass().addClass('select');\n\t\t$(this).siblings().removeClass().addClass('anschoice');\n\t});\n\t//Change selected choice back to original\n\t$('#answers').on('mousedown', '.select',function() {\n\t\t$(this).removeClass().addClass('anschoice');\n\t});\n\t//Below determines what to do when next button clicked\n\t$('#next').mousedown(function() {\n\t\t//Make sure a choice is selected!\n\t\tvar userselect = $('.select').text();\n\t\tconsole.log('userselect is: ' + userselect);\n\t\tif ( userselect === '') {\n\t\t\tconsole.log('Please select a choice!');\t\n\t\t\t$('#next').avgrund({\n\t\t\t\ttemplate: '<p> Please select a choice! </p>'\n\t\t\t});\n\t\t}\n\t\telse { // Check answer\n\t\t\tif (userselect === arrayname[qnumber].correctAnswer) {\n\t\t\t\tcorrect++;\n\t\t\t\tconsole.log('The user is correct! ' + correct);\n\t\t\t}\n\t\t\telse { \n\t\t\t\tconsole.log('user is wrong');\n\t\t\t\tconsole.log('#correct is: ' + correct);\n\t\t\t\tconsole.log(userselect + ' vs. ' + arrayname[qnumber].correctAnswer);\n\t\t\t}\n\t\t\t// Move on to the next question\n\t\t\tqnumber++;\n\t\t\tinsertquestion(arrayname, qnumber);\n\t\t\tconsole.log('qnumber from checkanswer is now ' + qnumber);\n\t\t\ttheend(qnumber, correct, arrayname);\n\t\t}\n\t\t});\n}", "function controlAnswer(answer) {\n console.log(\"controlAnswer ran\");\n var currentQuestion = questions[questionNumber];\n if (answer === currentQuestion.answer) {\n correct += 1;\n console.log(\"User picked correct answer\");\n }\n console.log(\"Correct: \" + correct);\n }", "function checkAnswer(answer){\n if( answer == questions[runningQuestion].correct){\n isCorrect();\n nextQuestion();\n } else {\n isWrong();\n nextQuestion();\n }\n}", "function checkSelection() {\n console.log(\"check selection function reached\");\n \n // hide the questionAsked board and stop the timer\n $(\"#questionAsked\").hide();\n clearInterval(counter);\n $(\"#timerDiv\").html(\"&nbsp;\");\n \n // if answer was right\n if (userGuess.data(\"value\") == allQuestionsArray[gameVariables.currentQuestion].correctAnswer) {\n console.log(userGuess.data(\"value\"));\n console.log(\"correct\");\n // run the correctAnswer function\n correctAnswer();\n }\n // else if answer was wrong\n else {\n console.log(userGuess.data(\"value\"));\n console.log(\"incorrect\");\n // run the incorrectAnswer function\n incorrectAnswer();\n }\n \n }", "function checkAnswer(choice){\n if(choice === correctA[currentQ]){\n alert('Great Job!');\n currentQ ++;\n writeQ()\n }else{\n alert('Wrong answer! Try again!');\n time -= 5;\n }\n }", "function checkResult(playerChoice) {\r\n resetSelected()\r\n computerRandomChoice()\r\n displayComputerChoice()\r\n updateScore(playerChoice)\r\n}", "function selectAnswer() {\n let choice =\n btn1.dataset[\"number\"] == currentQuestion.correctanswer\n ? \"correct\"\n : \"incorrect\";\n correctAnswers();\n disabledOptions();\n if (choice == \"incorrect\") {\n btn1.classList.add(\"incorrect\");\n } else {\n btn1.classList.add(\"correct\");\n increaseScore(correct_score);\n }\n}", "function userSelectAnswer () {\n $(\"form\").on(\"submit\", function (event) {\n event.preventDefault();\n let selected = $('input:checked');\n let answer = selected.val();\n let correctAnswer = `${STORE[questionNumber].correctAnswer}`;\n if (answer === correctAnswer) {\n increaseScore();\n showCorrectAnswer();\n } else {\n showWrongAnswer();\n }\n });\n finishGame(score);\n}", "function checkAnswer(event) {\r\n return event.target.innerText === question.answer;\r\n }", "function testAnswer(gameMode) {\n if(Number(answerInput.value) === answer){\n alert(\"Good Job!!! Correct Answer!\");\n progessBarMovement();\n loadGameNumbers(gameMode)\n answerInput.value = \"\";\n if(level<=9){\n level++;\n } else {\n alert(\"Congratulations you have finished all questions!\");\n mainMenu();\n }\n } else {\n alert(\"Incorrect Answer!\");\n answerInput.value = \"\";\n }\n}", "function checkAnswer() {\n\tchoices = document.getElementsByName(\"choices\");\n\n\tfor (var i = 0, len = choices.length; i < len; i++) {\n\t\tif (choices[i].checked) {\n\t\t\tchoice = choices[i].value;\n\t\t}\n\t}\n\n\tif (choice === questions[pos][4]) {\n\t\tcorrect++;\n\t}\n\t\n\tpos++;\n\trenderQuestion();\n}", "function checkUserAnswer(answer) {\n//when the user selects an answer and it is exactly equal to an index in the correctAnswer object key,\n\tif(answer.text() === questionList[getCurrentIndex()].ansArray[questionList[getCurrentIndex()].correctAnswer]) {\n return true;\n console.log(true);\n } else {\n return false;\n console.log(false);\n }\n}", "function checkAnswer() {\r\n // get first factor\r\n var factor1 = document.getElementById('factor1').innerHTML;\r\n console.log(\"factor 1 = \" + factor1);\r\n // get second factor\r\n var factor2 = document.getElementById('factor2').innerHTML;\r\n console.log(\"factor 2 = \" + factor2);\r\n // get answer\r\n var answer = document.getElementById('answer').value;\r\n console.log(\"answer = \" + answer);\r\n console.log((factor1*factor2) == answer);\r\n return (factor1*factor2) == answer;\r\n}", "function checkAnswer(){\n\n\tchoices = document.getElementsByName(\"choices\");\n\tfor(var i=0; i<choices.length; i++){\n\t\tif(choices[i].checked){\n\t\t\tchoice = choices[i].value;\n\t\t}\n\t}\n\n\tif(choice == questions[pos][4]){\n\t\t//got the question right message\n\t\t_(\"status\").innerHTML = \"Yaay, way to go!\";\n\n\t\tcorrect++;\n\n\t} else {\n\n\t\t_(\"status\").innerHTML = \"You got it wrong, buddy!\";\n\t\t//got the question wrong message\n\t};\n\n\tpos++;\n\trenderQuestion();\n}", "function solutions() {\n\n console.log(this.value);\n // !== is when\n if (this.value !== questions[currentIndex].answers) {\n alert(\"Wrong\");\n secondsRemaining -= 5;\n timeEl.textContent = secondsRemaining;\n }\n else {\n alert(\"Correct!\");\n secondsRemaining += 5;\n timeEl.textContent = secondsRemaining;\n score++;\n }\n currentIndex++;\n if (currentIndex === questions.length) {\n gameOver();\n }\n else {\n startQuiz();\n }\n}", "function selectanswer(event){\n\n var selectedanswer = event.target;\n if(selectedanswer.dataset.correct)\n {\n score = score + 10; //Add 10 point whenever answer is correct\n checkanswer(\"Correct\"); \n \n }else\n {\n checkanswer(\"Wrong\"); \n secondsLeft = secondsLeft - 10; //Reduce 10s from timer if answer is wrong\n }\n\n questionindex++;\n setnextquestion();\n\n\n}", "function checkAnswer(answer) {\n if (answer[userAnswer].isCorrect) {\n console.log('Your answer is correct! :D');\n score++;\n } else {\n console.log('Your answer is incorrect! D:');\n if (score > 0) {\n score--;\n }\n }\n}", "function validateAnswer() {\n switch (current_question_number) {\n case 1: {\n return validateQuestion1();\n }\n case 2: {\n return validateQuestion2();\n }\n case 3: {\n return validateQuestion3();\n }\n case 4: {\n return validateQuestion4();\n }\n case 5: {\n return validateQuestion5();\n }\n }\n }", "function tryAgainorNot() {\n if (questionNum === questionLength) {\n showScore();\n } else {\n showQuestion();\n }\n}", "function checkUserAnswer(type, userAns, correctAns){\n\tif (count < maxTries) {\n\t\tif(userAns === \"\"){\n\t\t\talert(\"Please enter an answer\");\n\t\t}\n\t\telse if(isNaN(parseInt(userAns))){\n\t\t\talert(\"Please enter a number\");\n\t\t}\n\t\telse if (parseInt(userAns) != correctAns)\n\t\t{\n\t\t\tcount++;\n\t\t\talert(\"That is the incorrect answer\");\n\t\t}\n\t\telse if (parseInt(userAns) === correctAns)\n\t\t{\n\t\t\talert(\"That is the correct answer\");\n\t\t\t document.getElementById(\"answer\").value = \"\";\n\t\t\t generateNumbers();\n\n\t\t\t if(type ===\"add\") {\n\t\t\t\t add();\n\t\t\t }\n\t\t\t else if(type ===\"minus\") {\n\t\t\t\t minus();\n\t\t\t }\n\t\t\t else if(type ===\"multiply\") {\n\t\t\t\t multiply();\n\t\t\t }\n\t\t\t else {\n\t\t\t\t divide();\n\t\t\t }\n\t\t}\n\t}\n\telse {\n\t\talert(\"The correct answer is \"+correctAns);\n\t}\n}", "function GetAnswer(input, optionOne, optionTwo) {\n input = input.toUpperCase();\n if (input !== \"1\" && input !== optionOne && input !== \"2\" && input !== optionTwo) {\n alert(\"Invalid input. Please try again.\");\n return(true);\n } else {\n if (input === \"1\" || input === optionOne) {\n return(optionOne);\n } else {\n return(optionTwo);\n }\n }\n}", "function checkAnswer() {\n // checks the iput against the correct answer\n var answer = document.getElementById('answer').value;\n if (answer == correctAnswer || event.which === 13) {\n points++;\n moveCar()\n pointsDisplay.innerHTML = points;\n return 'Well done! your answer is right. Keep Moving!';\n } else if (answer !== correctAnswer) {\n points--;\n moveCar();\n pointsDisplay.innerHTML = points;\n return 'Damn! your answer is wrong.';\n }\n}", "function validateAnswer(userSelectedAnswer, currentQuestion) {\n const correctAnswer = currentQuestion.answer;\n if (userSelectedAnswer == correctAnswer) {\n handleCorrectAnswer(userSelectedAnswer);\n //Since the correct answer was selected we increment the users score\n incrementUserScore();\n } else {\n handleIncorrectAnswer(userSelectedAnswer, correctAnswer, score);\n }\n}", "function submitAnswer(){\r\n\ty = document.getElementById(\"qans\").value\r\n\tvar yy=y.toUpperCase();\r\n\tx = document.getElementById(\"question\").value\r\n \r\n\tif (ans===1){\r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"B\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===2){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"A\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===3){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"C\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===4){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"D\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===5){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"D\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===6){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"B\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===7){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"B\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===8){ \r\n\t\ty = document.getElementById(\"qans\").value;\r\n\t\tif(yy===\"D\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===9){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"C\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===10){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"B\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===11){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"A\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===12){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"A\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===13){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"C\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===14){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"D\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===15){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"B\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\t}\r\n\telse if (ans===16){ \r\n\t\ty = document.getElementById(\"qans\").value\r\n\t\tif(yy===\"D\"){\r\n\t\t\tcorrectAnswer();\r\n\t\t}\r\n\t\telse {\r\n\t\t\twrongAnswer();\r\n\t\t}\r\n\t\tdocument.view.qscore.value=score\r\n\t\tdocument.view.streakscore.value=current_streak\r\n\r\n\t\t// as this is the last question in the quiz, update the text of \"Next Question\" to make it more appropriate\r\n\t\tdocument.view.go.value=\"End Quiz...\"\r\n\t}\r\n\r\n\t// enable selection of \"Next Question\"\r\n\tdocument.getElementById(\"go_id\").disabled = false\r\n\tdocument.getElementById(\"go_id\").style.opacity = \"1\"\r\n\r\n\t// disable selection of \"Submit Answer\" to avoid logic issues\r\n\tdocument.getElementById(\"user_submit\").disabled = true\r\n\tdocument.getElementById(\"user_submit\").style.opacity = \"0.5\"\r\n\r\n\t// update var ans\r\n\tans++; \r\n}", "function checkAnswer(idOfuserChoice) {\r\n let userChoice = document.getElementById(idOfuserChoice);\r\n let index = qstn.options.indexOf(qstn.answer);\r\n if (arrayItem.answer != userChoice.textContent) {\r\n userChoice.style.color = \"red\";\r\n document.getElementById(`option${index}`).style.color = green;\r\n } else {\r\n document.getElementById(`option${index}`).style.color = green;\r\n }\r\n}", "function checkAnswers() {\n\n}", "function answer(a) {\n let selected_answer = a;\n //If selected_answer is equals to the last number in the array is a right answer\n if (selected_answer == questions[questionNum][5]){\n displayNo('wrong-answer');\n displayNo('answers')\n displayYes('right-answer');\n //Every right answer increases evenly X% of the progress bar\n progressNum+= questionPercent;\n document.getElementById('progress-num').classList.add('w-' + progressNum);\n document.getElementById('progress-num').innerHTML= progressNum + '%';\n \n //Finish Quiz on the last question available - else - show next question\n if(questionNum+1 == questions.length ){\n displayYes('finish-quiz');\n }\n else {\n questionNum++;\n displayYes('next-question');\n }\n \n // By wrong answer, show alert and increase counter \n } else {\n questionsWrong++;\n displayYes('wrong-answer');\n }\n}", "function checkAnswer(questionNumber, answer) {\n\n}", "function evaluateAnswers(answer) {\n\n\tif(answer === answers[0].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[0].isCorrect;\n\t}\n\n\telse if(answer === answers[1].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[1].isCorrect;\n\t}\n\telse if(answer === answers[2].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[2].isCorrect;\n\t}\n\telse if(answer === answers[3].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[3].isCorrect;\n\t}\n\n\telse {\n\t\tunanswered = true;\n\t}\n}", "function checkAnswer() {\n\n let selected = $(\"input:checked\");\n let selectedValue = selected.val();\n\n let correctAnswer = STORE.questions[currentQuestionNumber - 1].answer;\n\n\n\n if (correctAnswer == selectedValue) {\n $(\".quizForm\").append(`<p class=\"correctAnswer\"><i class=\"fas fa-check-circle\" style=\"color:#008000;\"></i>\\xa0That is correct!</p>`);\n currentScore++;\n } else {\n $(\".quizForm\").append(`<p class=\"incorrectAnswer\"><i class=\"fas fa-times-circle\" style=\"color:#FF0000;\"></i>\\xa0Sorry, that is incorrect! The correct answer is <strong>${correctAnswer}</strong>.</p>`);\n\n }\n}", "function compareAnswer(answer){\n if(getText() === answer){\n alert(\"You Answered Correctly!\")\n $(\"#score\").html(parseInt($(\"#score\").html()) + parseInt($(\"#point-value\").html()))\n } else {\n alert(\"Better luck next time...\")\n }\n }", "function checkAnswer() {\n const currentQuestion = questions[questionIndex];\n const correctChoice = currentQuestion[\"choices\"][0];\n const selector = document.querySelector(`input[name=question${questionIndex}]:checked`);\n let userAnswer = \"\";\n if (selector !== null)\n userAnswer = currentQuestion[\"choices\"][selector.value];\n\n if (userAnswer === correctChoice) {\n swal(\"Correct!\", `${currentQuestion.explanation}`, \"success\");\n score++;\n\tif(score != maxScore)\n\t yaySound.play();\n movePlayerForward();\n } else {\n swal(\"Incorrect\", `${currentQuestion.explanation}`, \"warning\");\n n_score++;\n\tif(n_score != minScore)\n\t noSound.play();\n movePlayerBackward();\n }\n console.log(`Score is now ${score}`);\n\n if (score == maxScore) {\n winSound.play(); // terminate game upon reaching a certain score\n swal(\"Congratulations! \\n you won! \\n Try a new game again\");\n endGame();\n return;\n }\n\n if (n_score == minScore) {\n GameoverSound.play();\n swal(\"Game Over! \\n Try a new game\");\n endGame();\n return;\n }\n\n questionIndex = (questionIndex + 1) % questions.length;\n displayQuestion();\n}", "function checkAnswer(answer) {\n if (answer == questionsE[runningQuestion].correctAnswer) {\n // answer is correct\n answerIsCorrect();\n score++;\n } else {\n // answer is incorrect\n answerIsIncorrect();\n alert(`Sorry you got it wrong! The correct answer is ${questionsE[runningQuestion].correctAnswer}`);\n }\n if (runningQuestion <= lastQuestion) {\n runningQuestion++;\n increment();\n renderQuestion();\n }\n}", "function checkAnswer(){\n let correct=false;\n if(answer==\"correct\") correct=true;\n if(correct) correctAnswer(this);\n else {wrongAnswer(this)};\n}", "function showAnswer(){\n equalsToIsClicked=true;\n numberIsClicked=true;\n numberOfOperand=1;\n if(numberIsClicked && operatorIsClicked && numberOfOperand===1 && equalsToIsClicked===true){\n switch(myoperator){\n case \"*\":\n num1*=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(3);\n throw \"the number of digits exceeded\";\n \n }\n break;\n case \"+\":\n num1+=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(3);\n throw \"the number of digits exceeded\";\n }\n break;\n case \"-\":\n num1-=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(2);\n throw \"the number of digits exceeded\";\n }\n break;\n case \"/\":\n num1/=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(3);\n throw \"the number of digits exceeded\";\n }\n break;\n\n }\n }\n numberIsClicked=false;\n operatorIsClicked=false;\n equalsToIsClicked=false;\n numberOfOperand=0;\n numberChecker=0;\n\n}", "checkResult() {\n const MAX_ANSWERS_LENGTH = 10;\n if (this.model.isDead()) {\n this.loose();\n } else if (this.model.defineAnswersLength() === MAX_ANSWERS_LENGTH) {\n this.win();\n } else {\n this.startGame();\n }\n }", "function optionClick(option){\n /* if the answer option the user clicks on matches in type and value to the answer in the questionSet array, flash the user a Correct toast */\n if(option.textContent == questionSet[questionIndex].answer){\n toastEl.textContent = \"Correct!\";\n \n /* if the answer option the user clicks on doesn't match in type and value to the answer in the questionSet array, flash the user a Wrong toast and */\n } else {\n \n /* subraction assingment to remove 2 seconds from time remaining if the answer is wrong */\n time -= 10;\n toastEl.textContent = \"Wrong :/\";\n }\n\n /*iterate to next question */\n questionIndex++;\n\n /* Evaluate if all questions in the array have been used yet */\n if (questionIndex === questionSet.length) {\n quizEnd();\n } else {\n renderQuestion();\n }\n }", "function answeredIncorrectly (questionSet, selectedAnswer) {\n\n // track answer\n trackAnswers(false, questionSet, selectedAnswer);\n\n // open modal, set content to true for correct answer\n $('#answerModal').modal().show(function () {\n setModalContent(false, selectedAnswer);\n });\n\n // disable incorrect answer\n $(`#${selectedAnswer}`).prop('disabled', true);\n $(`#${selectedAnswer}`).addClass('btn-danger');\n\n}", "function grade() {\n\n//question 1 answer r1\nif (answer1 === \"r1\") {\n correct++;\n } else if ((answer1 === \"r2\") || (answer1 === \"r3\")) {\n incorrect++;\n } else {\n unanswered++;\n }\n\n//question 2 answer r3\nif (answer2 === \"r3\") {\n correct++;\n } else if ((answer2 === \"r2\") || (answer2 === \"r1\")) {\n incorrect++;\n } else {\n unanswered++;\n }\n//question 3 answer r1\nif (answer3 === \"r1\") {\n correct++;\n } else if ((answer3 === \"r2\") || (answer3 === \"r3\")) {\n incorrect++;\n } else {\n unanswered++;\n }\n//question 4 answer r2\nif (answer4 === \"r2\") {\n correct++;\n } else if ((answer4 === \"r1\") || (answer4 === \"r3\")) {\n incorrect++;\n } else {\n unanswered++;\n }\n//question 5 answer r3\nif (answer5 === \"r3\") {\n correct++;\n } else if ((answer5 === \"r2\") || (answer5 === \"r1\")) {\n incorrect++;\n } else {\n unanswered++;\n }\n}", "checkAnswer(answer) {\n let check = false;\n if (answer == this.rightAnswer)\n check = true;\n check ? console.log(`CORRECT`) : console.log(`INCORRECT`);\n return check;\n }", "function checkcurr() {\n outresult[position][1] = $(\"input[name=answer]:checked\", \"#ansform\").val();\n if (outresult[position][1] === outresult[position][3]) {\n outresult[position][2] = \"Correct\";\n } else {\n outresult[position][2] = \"Incorrect\";\n }\n}//end of checkcurr", "function answerChosen(userAnswer) {\n \n var rightAnswer = questions[questionCounter].correctAnswer;\n console.log(userAnswer);\n\n if (questions[questionCounter].correctAnswer === userAnswer){\n console.log(\"correct answer\");\n correct();\n } \n else if (questions[questionCounter].correctAnswer != userAnswer) {\n console.log(\"incorrect answer\");\n incorrect(rightAnswer);\n\n }\n else {\n console.log(\"times up\");\n timesUp();\n }\n\n }", "function checkAnswer(answer) {\n clearTimeout(timer);\n // if the answer is correct\n if (answer === correctAnimal) {\n // next round\n timer = setTimeout(nextRound, saySomething(0));\n // update score\n score += 1;\n updateScore();\n // if not correct\n } else {\n // find the selected option\n $(\".guess\").each(function() {\n if ($(this).text() === answer) {\n // play the animation\n $(this).effect('shake').button(\"option\", \"disabled\", true);\n // say an insult\n timer = setTimeout(sayBackwards, saySomething(1), correctAnimal);\n // reset score\n score = 0;\n mistake = true;\n updateScore();\n }\n });\n }\n}", "function checkCorrectAnswer() {\n let radios = $('input:radio[name=answer]');\n let selectedAnswer = $('input[name=\"answer\"]:checked').data('answer');\n let questionNumber = store.questionNumber;\n let correctAnswer = store.questions[questionNumber].correctAnswer;\n\n if (radios.filter(':checked').length === 0) {\n alert('Select an answer before moving on.');\n return;\n } else {\n store.submittingAnswer = true;\n if(selectedAnswer === correctAnswer){\n store.score += 1;\n store.currentQuestionState.answerArray = [true, correctAnswer, selectedAnswer];\n } else {\n store.currentQuestionState.answerArray = [false, correctAnswer, selectedAnswer];\n }\n }\n}", "function handleIncorrectAnswer(clickedAnswer) {\n $('<div>').attr('id', 'incorrect').text('Wrong! IDiot!').appendTo('#info');\n if (clickedAnswer) {\n $(\".selections\").find(`li:contains(\"${clickedAnswer}\")`).addClass(\"incorrect\");\n }\n $('<div>').attr('id', 'answer').text(`it's ${movie.title}, Lol yikes`).appendTo($('#info'));\n strikes += 1;\n $missBoard.text(strikes);\n\n if (strikes === 3) {\n $lossModal.css('display', 'block');\n }\n}" ]
[ "0.7331716", "0.72632146", "0.7203991", "0.7195673", "0.71757287", "0.71658623", "0.71628815", "0.71563923", "0.7114494", "0.7106288", "0.7074535", "0.7050443", "0.6987985", "0.6976106", "0.6975805", "0.69701964", "0.69617337", "0.69583863", "0.69239616", "0.6921542", "0.6917278", "0.6914205", "0.6900555", "0.6898091", "0.6897374", "0.6886948", "0.6885282", "0.68605846", "0.6854485", "0.6849083", "0.6846875", "0.68384725", "0.68169016", "0.68062574", "0.67966735", "0.6787724", "0.6781495", "0.677693", "0.6766461", "0.6761445", "0.67578983", "0.6753827", "0.6725744", "0.67091423", "0.6704038", "0.67027783", "0.66987085", "0.6698253", "0.66977406", "0.66954154", "0.6676983", "0.66767585", "0.6667656", "0.6663981", "0.6663377", "0.66622454", "0.66485137", "0.66443443", "0.6626783", "0.66234225", "0.66194475", "0.66192406", "0.6619044", "0.66175216", "0.66174775", "0.6615841", "0.661556", "0.66145194", "0.6602903", "0.66009367", "0.6597888", "0.6596345", "0.65959656", "0.65858245", "0.65839773", "0.6581228", "0.65651727", "0.65612334", "0.65547633", "0.654849", "0.65443856", "0.6543011", "0.6534915", "0.65339065", "0.65279514", "0.6521669", "0.65178305", "0.65170085", "0.65097475", "0.6509085", "0.65062445", "0.6504339", "0.65026975", "0.6502343", "0.65004677", "0.6497", "0.6494077", "0.6492739", "0.649189", "0.64917296", "0.6490056" ]
0.0
-1
YOU CAN PUT BUTTONS HERE TEXTHERE TO GENERATE BUTTONS AND CLICK THROUGH EVERY OTHER PIC function to generate possible answers for each question
function generateHTML() { gameHTML = answerArray[questionCounter] +"<p class='text-center msg'>" + questionArray[questionCounter] + "</p>"; $(".mainDiv").html(gameHTML); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function questionGenerator() {\n \n questionEl.textContent = questions[indexPlace].q;\n questionEl.setAttribute('style', 'margin-top:125px; width:100%;');\n\n // create buttons for selecting answers\n var answerBtn1 = document.getElementById(\"answerBtn1\")\n answerBtn1.onclick=function(){correctAnswerCheck()};\n answerBtn1.textContent = questions[indexPlace].a1;\n answerBtn1.setAttribute('style', 'background-color:lightblue; height: 40px; font-size:large;');\n \n\n var answerBtn2 = document.getElementById(\"answerBtn2\")\n answerBtn2.onclick=function(){correctAnswerCheck()};\n answerBtn2.textContent=questions[indexPlace].a2;\n answerBtn2.setAttribute('style', 'background-color:lightblue; height: 40px; font-size:large;');\n\nvar answerBtn3= document.getElementById(\"answerBtn3\")\n answerBtn3.onclick=function(){correctAnswerCheck()};\n answerBtn3.textContent=questions[indexPlace].a3;\n answerBtn3.setAttribute('style', 'background-color:lightblue; height: 40px; font-size:large;');\n\nvar answerBtn4= document.getElementById(\"answerBtn4\")\n answerBtn4.onclick=function(){correctAnswerCheck()};\n answerBtn4.textContent=questions[indexPlace].a4;\n answerBtn4.setAttribute('style', 'background-color:lightblue; height: 40px; font-size:large;');\n}", "function getQuestion() {\n /*\n @TODO: write your function code here\n */\n // create question and buttons\n question_w = document.createElement(\"h2\");\n button1 = document.createElement(\"button\");\n button2 = document.createElement(\"button\");\n button3 = document.createElement(\"button\");\n button4 = document.createElement(\"button\");\n question_w.textContent = questions[currentQuestionIndex];\n // set namme of choices to each button\n button1.textContent = ansarray[currentQuestionIndex][0];\n button2.textContent = ansarray[currentQuestionIndex][1];\n button3.textContent = ansarray[currentQuestionIndex][2];\n button4.textContent = ansarray[currentQuestionIndex][3];\n // set data-index to each button\n question_w.setAttribute(\"style\",\"text-align:center\")\n button1.setAttribute(\"data-index\", 0 );\n button2.setAttribute(\"data-index\", 1 );\n button3.setAttribute(\"data-index\", 2 );\n button4.setAttribute(\"data-index\", 3 );\n // append question and button to html\n questionsEl.prepend(question_w);\n choicesEl.appendChild(button1);\n choicesEl.appendChild(button2);\n choicesEl.appendChild(button3);\n choicesEl.appendChild(button4);\n}", "function generate() {\n if (quiz.isEnded()) {\n gameOver();\n\n } else {\n\n // CREATE QUESTION ELEMENT\n var questionEl = document.createElement(\"article\");\n questionEl.className = \"question\";\n questionEl.innerHTML = quiz.getQuestionIndex().text;\n mainEl.appendChild(questionEl);\n\n\n // CREATE CHOICE BUTTONS\n var choices = quiz.getQuestionIndex().choices;\n for (var i = 0; i < choices.length; i++) {\n var choiceEl = document.createElement(\"button\");\n choiceEl.id = \"btn\" + i;\n choiceEl.className = \"button choice-btn\";\n mainEl.appendChild(choiceEl);\n var spanEl = document.createElement(\"span\");\n spanEl.id = \"choice\" + i;\n choiceEl.appendChild(spanEl);\n var element = document.getElementById(\"choice\" + i);\n element.innerHTML = choices[i];\n selection(\"btn\" + i, choices[i]);\n }\n questionNumber();\n }\n}", "function generateQuestion() {\n var choicesArr = questions[currentQuestion].choices;\n questionTitle.textContent = questions[currentQuestion].title;\n console.log(questions[currentQuestion].title);\n for (var i = 0; i < choicesArr.length; i++) {\n console.log(choicesArr[i]);\n document.getElementById(\"btn-\" + i).textContent = choicesArr[i]; \n var currentBtn = document.getElementById(\"btn-\" + i);\n currentBtn.addEventListener(\"click\", handleAnswerClick)\n }\n}", "function makeQuestions() {\n questionNumber++;\n answer = questions[questionNumber].answer\n\n questionHeader.textContent = questions[questionNumber].title;\n answerOptions.innerHTML = \"\";\n questionHeaderFont = questionHeader.style.fontSize = \"x-large\";\n \n var options = questions[questionNumber].options;\n\n for (var q = 0; q < options.length; q++) {\n var nextOption = document.createElement(\"button\");\n\n nextOption.textContent = options[q]\n btnAnswer = answerOptions.appendChild(nextOption).setAttribute(\"class\", \"p-3 m-1 btn btn-light btn-block\");\n }\n}", "function displayQuestion(question) {\n Quest.textContent = question.ask;\n button1.textContent = question.option1;\n button2.textContent = question.option2;\n button3.textContent = question.option3;\n button4.textContent = question.option4;\n \n for (var i = 0; i < allButtons.length; i++) {\n allButtons[i].addEventListener(\"click\", leggi);}\n}", "function generateQuestion() {\n var currentQuestion = questions[questionsIndex];\n questionsTitle.textContent = (currentQuestion.title);\n questionsAnswer.innerHTML = \"\";\n currentQuestion.options.forEach(function (option) {\n var ansButton = document.createElement(\"button\");\n ansButton.setAttribute(\"class\", \"options\");\n ansButton.setAttribute(\"value\", option);\n ansButton.textContent = option;\n ansButton.onclick = nextQuestion;\n questionsAnswer.appendChild(ansButton);\n\n\n })\n\n}", "function setupButtons(){\n //speak(quiz[currentquestion]['question'])\n\t\t$('.choice').on('click', function(){\n\t\tsynth.cancel();\n is_on = 0;\n\t\tpicked = $(this).attr('data-index');\n\t\tspeak(quiz[currentquestion]['choices'][picked], LINGUA_RISPOSTA);\n\t\tshow_button();\n\t\t// risposte in francese\n\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\n\t\t$(this).css({'font-weight':'900', 'border-color':'#51a351', 'color':'#51a351', 'background' : 'gold'});\n\t\tif(submt){\n\t\t\t\tsubmt=false;\n\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\n\t\t\t\t$('.choice').off('click');\n\t\t\t\t$(this).off('click');\n\t\t\t\tprocessQuestion(picked);\n //\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}", "function questionGenerator1(event){\n //creates question\n var questionElement=document.createElement(\"h1\")\n questionElement.textContent=questionArr[0];\n cardBody.appendChild(questionElement);\n //creates buttons\n for(var i=0;i<4;i++){\n var answerElement=document.createElement(\"button\");\n answerElement.setAttribute(\"class\",\"ansSelect\"+i);\n answerElement.textContent=answerArr1[i];\n cardBody.appendChild(answerElement);\n }\n //identifies correct answer\n var correctAnswer=document.querySelector(\".ansSelect2\");\n var wrongAnswer1=document.querySelector(\".ansSelect0\");\n var wrongAnswer2=document.querySelector(\".ansSelect1\");\n var wrongAnswer3=document.querySelector(\".ansSelect3\");\n//adds score and launches next question if correct\n correctAnswer.addEventListener(\"click\",function(){\n count++;\n cardBody.innerHTML=\"\";\n score.textContent=\"Score: \" + count;\n questionGenerator2();\n });\n//adds time to time loss and launches next question if wrong\n wrongAnswer1.addEventListener(\"click\",function(){\n timeLost+5;\n cardBody.innerHTML=\"\";\n questionGenerator2();\n });\n wrongAnswer2.addEventListener(\"click\",function(){\n timeLost+5;\n cardBody.innerHTML=\"\";\n questionGenerator2();\n });\n wrongAnswer3.addEventListener(\"click\",function(){\n timeLost+5;\n cardBody.innerHTML=\"\";\n questionGenerator2();\n });\n}", "function generateQuestion (question) {\n console.log(currentQuestionIndex + \" current question index\");\n questionElement.innerHTML = question.question;\n question.choices.forEach(answer => {\n const button = document.createElement('button'); \n button.innerText = answer.text;\n button.classList.add('btn-dark', 'btn', 'btn-padding');\n button.dataset.correct = answer.correct\n\n button.addEventListener('click', guessAnswer);\n answerElement.appendChild(button);\n })\n}", "function getQuestion(){\n // question list is the set of question you created and you are calling it so it can appear under question title from your html\n var quizQuestion = questionlist[currentQuestionIndex].questionTitle;\n\n var titleEl = document.getElementById('questionTitle')\n\n titleEl.textContent = quizQuestion;\n// ERASE THE PREVIOUS QUESTIONS AND ANSWER \n MultipleChoicesEl.innerHTML = \"\";\n//choices is from my HTML , this is a for loop to go to each questions \"current question index is the question number andit will loop throught the mulitple choice question that are define on the question list with the count of i i will start at 0 and will end when they are no more muliple choice question \n// Pass an argument to loop through the question list choise is the name of my function \n questionlist[currentQuestionIndex].multiplechoice.forEach (function(choice, index){\n\n var choiceNode = document.createElement(\"button\");\n // html id \n choiceNode.setAttribute(\"class\", \"choice\");\n // this c\n choiceNode.setAttribute(\"value\", choice);\n choiceNode.textContent= index+1+ \". \"+ choice;\n // creating a function for the eventlistener\n \n choiceNode.onclick = questionClick\n // to display the eventlistener on the page use appendchild\n MultipleChoicesEl.appendChild(choiceNode);\n \n });\n \n// calling a function will run the function \n \n\n}", "function showQuestion(qAndA) {\n document.getElementById('question').innerText = qAndA.question;\n qAndA.answers.forEach(answer => {\n let button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('answer');\n if (answer.correct) {\n button.dataset.correct = answer.correct\n\n }\n button.addEventListener('click', selectAnswer)\n document.getElementById('answers').appendChild(button)\n console.log('ping')\n })\n}", "function showQuestions() {\n var currentQuestion = codeQuestions[currentQuestionIndex];\n\n var titleEl = document.getElementById(\"question-title\");\n titleEl.textContent = currentQuestion.question;\n\n answersEl.innerHTML = \"\";\n\n //create loop for questions\n currentQuestion.answers.forEach(function (answer, i) {\n var answerNode = document.createElement(\"button\");\n answerNode.setAttribute(\"class\", \"answers\");\n answerNode.setAttribute(\"class\", \"answers\");\n\n answerNode.textContent = i + 1 + \".\" + rightAnswer;\n\n //clicky boy\n answerNode.onclick = answerClick;\n answersEl.appendChild(answerNode);\n });\n }", "function runQuestion() {\n\n var randomQuestion = pullQuestion();\n\n if (randomQuestion === undefined) {\n stopGame();\n return;\n }\n \n var questionEl = document.getElementById(\"description\");\n questionEl.textContent = randomQuestion.question;\n \n var ansEl = document.getElementById(\"questions\");\n ansEl.textContent = \"\";\n \n randomQuestion.answers.forEach((answer, index) => {\n var ans = document.createElement(\"button\");\n ans.textContent = ((index + 1) + \": \" + answer);\n ans.setAttribute(\"style\", \"display: block; height: 40px;\")\n ans.setAttribute(\"index\", index);\n ansEl.appendChild(ans);\n })\n \n correctIndex = randomQuestion.correctAnswer;\n}", "function next() {\ncurrentQuestion++;\n\nif (currentQuestion > questions.length - 1) {\n\tendGame();\n\treturn;\n}\n\nvar quizContent = \"<h2>\" + questions[currentQuestion].title + \"</h2>\"\n\nfor (var buttonLoop = 0; buttonLoop < questions[currentQuestion].choices.length; buttonLoop++) {\n\tvar buttonCode = \"<button onclick=\\\"[ANS]\\\">[CHOICE]</button>\"; \n\tbuttonCode = buttonCode.replace(\"[CHOICE]\", questions[currentQuestion].choices[buttonLoop]);\n\tif (questions[currentQuestion].choices[buttonLoop] == questions[currentQuestion].answer) {\n\t\tbuttonCode = buttonCode.replace(\"[ANS]\", \"correct()\");\n\t} else {\n\t\tbuttonCode = buttonCode.replace(\"[ANS]\", \"incorrect()\");\n\t}\n\tquizContent += buttonCode\n}\n\n\ndocument.getElementById(\"quizBody\").innerHTML = quizContent;\n}", "function renderQuestion () {\n heading.innerText = \"Question \" + counter;\n content.innerText = question[counter].questionText;\n for (var j=0; j<question[counter].answerList.length; j++) {\n var answerButton = document.createElement(\"button\");\n answerButton.textContent = question[counter].answerList[j];\n answerButton.setAttribute(\"id\", j);\n buttonArea.appendChild(answerButton);\n answerButton.addEventListener('click', (event) => {\n  checkAnswer(event.target.id);\n });\n };\n}", "function showQuestion (question){\n questionEl.innerText = question.question;\n question.answers.forEach(answer => {\n // create a new button for each answer and fill \n var button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer);\n answerChoiceBtn.appendChild(button);\n })\n}", "function makeSomeSillyLittleButtons() {\n //remove present button(s)\n $(\".buttons\").empty()\n //set variables\n questionToGen = questionsAndAnswers[questionsAsked];\n question = questionToGen[\"question\"]\n answers = questionToGen[\"answers\"];\n correctAnswer = questionToGen[\"correctAnswer\"];\n //set question text\n $(\".WhereQuestionGoes\").text(question)\n //makes buttons and append them.\n for (let i = 0; i < answers.length; i++) {\n var curAnswer = answers[i];\n var answerButton = $(\"<button>\");\n answerButton.addClass(\"btn btn-secondary\");\n answerButton.attr(\"type\", \"button\");\n answerButton.attr(\"data-answer\", curAnswer);\n answerButton.text(curAnswer);\n $(\".buttons\").append(answerButton);\n }\n //increment what question we are on\n questionsAsked++;\n //return the correct answer\n return correctAnswer;\n}", "function generateQuestion() {\n number1 = Math.ceil(Math.random() * 10);\n number2 = Math.ceil(Math.random() * 10);\n correctAnswer = number1 * number2;\n document.getElementById(\"question\").innerHTML = number1 + \" X \" + number2;\n document.getElementById(\"choice1\").innerHTML = \"<p>\" + correctAnswer + \"</p>\";\n \n \n \n let positions = [];\n while(positions.length < 4) {\n random = Math.ceil(Math.random() * 4);\n if(positions.length === 0) {\n positions.push(random);\n } else if(positions.indexOf(random) === -1) {\n positions.push(random);\n }\n }\n \n \n answers = [];\n answers[positions[0] - 1] = correctAnswer;\n for (let i = 1; i <= 3; i++) {\n random = Math.ceil(Math.random() * 100);\n answers[positions[i] - 1] = random;\n }\n \n \n \n for (let i = 0; i < answers.length; i++) {\n document.getElementById(\"choice\" + (i +1)).innerHTML = answers[i];\n }\n \n \n choice1 = answers[0];\n choice2 = answers[1];\n choice3 = answers[2];\n choice4 = answers[3];\n \n}", "function next() {\n currentQuestion++;\n\n if (currentQuestion > questions.length - 1) {\n endGame();\n return;\n }\n\n var quizContent = \"<h2>\" + questions[currentQuestion].question + \"</h2>\"\n\n for (var buttonLoop = 0; buttonLoop < questions[currentQuestion].choices.length; buttonLoop++) {\n var buttonCode = \"<button onclick=\\\"[ANS]\\\">[CHOICE]</button>\";\n buttonCode = buttonCode.replace(\"[CHOICE]\", questions[currentQuestion].choices[buttonLoop]);\n if (questions[currentQuestion].choices[buttonLoop] == questions[currentQuestion].answer) {\n buttonCode = buttonCode.replace(\"[ANS]\", \"correct()\");\n } else {\n buttonCode = buttonCode.replace(\"[ANS]\", \"incorrect()\");\n }\n quizContent += buttonCode\n }\n\n\n document.getElementById(\"quizBody\").innerHTML = quizContent;\n}", "function renderquestion(question){\n \n questionElement.textContent = question.Q;\n\n for (var j =0 ; j<question.A.length; j++)\n {\n var answer = document.createElement('button');\n answer.classList.add(\"btn\");\n answer.textContent = j+1 + \". \"+ question.A[j].ans;\n answerbuttons.append(answer);\n if (question.A[j].correct)\n { //Create data attribute correct for correct answer\n answer.dataset.correct = question.A[j].correct;\n }\n answer.addEventListener('click', selectanswer);\n }\n\n}", "function next() {\n currentQuestion++;\n\n if (currentQuestion > questions.length - 1) {\n endGame();\n return;\n }\n\n var quizContent = \"<h2>\" + questions[currentQuestion].title + \"</h2><br><br>\"\n\n for (var buttonLoop = 0; buttonLoop < questions[currentQuestion].choices.length; buttonLoop++) {\n var buttonCode = \"<button onclick=\\\"[ANS]\\\">[CHOICE]</button>\"; \n buttonCode = buttonCode.replace(\"[CHOICE]\", questions[currentQuestion].choices[buttonLoop]);\n if (questions[currentQuestion].choices[buttonLoop] == questions[currentQuestion].answer) {\n buttonCode = buttonCode.replace(\"[ANS]\", \"correct()\");\n } else {\n buttonCode = buttonCode.replace(\"[ANS]\", \"incorrect()\");\n }\n quizContent += buttonCode\n }\n\n\n document.getElementById(\"quizBody\").innerHTML = quizContent;\n}", "function getQuestion() {\n var currentQuestion = questions[qIndex];\n questionEl.textContent = currentQuestion.title;\n choicesEl.innerHTML = \"\";\n\n for(var i = 0; i < currentQuestion.choices.length; i++) {\n var choice = currentQuestion.choices[i];\n var newBtn = document.createElement(\"Button\");\n newBtn.textContent = choice;\n choicesEl.appendChild(newBtn);\n newBtn.className = \"new-button\";\n newBtn.onclick = ansClick;\n } \n}", "function showQuestion(question) {\n// fills in the question\n questionElement.innerText = question.question\n// creates buttons\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n // fills in inner text\n button.innerText = answer.text\n // adds style with class\n button.classList.add('btn') \n // adds true/false statment so score works\n if (answer.correct) {\n button.dataset.correct = answer.correct}\n // starts new function\n button.addEventListener('click', selectAnswer)\n // appends buttons\n answerButtonsElement.appendChild(button)\n })\n}", "function questions(number) {\n if (number < quiz.length) {\n $(\"#question\").html(quiz[number].question);\n var choicesArr = quiz[number].choices;\n $(\"#choices\").removeClass(\"textStyle\");\n $(\"#choices\").text(\"\");\n for (var i = 0; i < choicesArr.length; i++) {\n var buttonChoices = $(\"<button>\");\n buttonChoices.attr(\"data-ans\", i);\n buttonChoices.html(choicesArr[i]);\n $(\"#choices\").append(buttonChoices);\n $(\"#choices\").append(\"<br>\");\n } \n } else { \n result();\n }\n }", "function buildQuestionCard() {\n\n var questionTitle = document.getElementById(\"question-title\")\n questionTitle.textContent = questions[Q].question;\n answerBox.innerHTML = \"\"\n\n questions[Q].choices.forEach(function(choice){\n // console.log(choice);\n var button = document.createElement(\"button\");\n button.classList.add(\"list-group-item\");\n button.classList.add(\"text-white\");\n button.classList.add(\"mb-3\");\n button.classList.add(\"bg-dark\");\n button.textContent = choice;\n button.setAttribute(\"value\", choice)\n\n button.onclick = evalAnswer;\n answerBox.appendChild(button)\n\n \n })\n}", "function displayQuestions(question) {\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n var button = document.createElement(\"button\");\n button.innerText = answer.text;\n button.classList.add(\"btn\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener(\"click\", selectAnswer);\n choiceEl.appendChild(button);\n });\n}", "function buildQuestion(i) {\n var question = questions[i].q;\n var options = questions[i].o;\n questionText.textContent = question;\n for (n = 0; n < options.length; n++) {\n var btn = document.createElement(\"a\");\n btn.setAttribute(\"class\", \"btn btn-primary\");\n btn.setAttribute(\"value\", options[n])\n btn.setAttribute(\"onclick\", \"checkAnswer(\" + i + \")\")\n btn.textContent = options[n];\n choices.appendChild(btn);\n }\n}", "function generateQuestion(){\n \n var text = '<h2>Dodawanie pytania</h2>';\n text += '<p class=\"workshop\">Ilość odpowiedzi:';\n text += '<select id=\"answerCaunt\" class=\"workshop\">';\n text += '<option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"6\">6</option><option value=\"7\">7</option><option value=\"8\">8</option>';\n text += '</select>';\n text += '</p>';\n \n smoothPageContentChanging(text, '<button class=\"workshop\" onclick=\"generateAnswerFields()\">Utwórz pytanie</button>');\n}", "function showQuestion(){\n let listQuestion = theQuestions[questionIndex].question\n placeQuestion.textContent = listQuestion\n questionEl.appendChild(placeQuestion)\n \n //show answers as buttons\n function showAnswers(){\n let answerA = theQuestions[questionIndex].answer[0].list\n let answerB = theQuestions[questionIndex].answer[1].list\n let answerC = theQuestions[questionIndex].answer[2].list\n let answerD = theQuestions[questionIndex].answer[3].list\n btnTextA.textContent = answerA\n btnTextB.textContent = answerB\n btnTextC.textContent = answerC\n btnTextD.textContent = answerD\n multChoiceA.appendChild(btnTextA)\n multChoiceB.appendChild(btnTextB)\n multChoiceC.appendChild(btnTextC)\n multChoiceD.appendChild(btnTextD)\n }\n\n showAnswers()\n }", "function questionsAnswers (arr) {\n for (i = 0; i < arr.length; i++) {\n var button = $(\"<button>\");;\n button.text(arr[i]);\n button.addClass(\"button\");\n button.attr({\"selection\": arr[i]});\n $(\"#choices\").append(button);\n \n }\n}", "function randomQuizContent(questions) {\n console.log(\"WE ARE INSIDE\");\n currentModalImage.src = questions.img;\n questionElement.innerText = questions.question;\n questions.answers.forEach(answer => {\n const button = document.createElement(\"button\");\n button.innerText = answer.text;\n button.classList.add(\"btn\");\n\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n\n button.addEventListener(\"click\", selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n questionPicture.src = question.images\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if(answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n\n\n}", "function buildQuestionCard() {\n ask.textContent = questions[index].question;\n let answerBox = document.getElementById(\"answer-box\");\n answerBox.innerHTML = \"\";\n\n questions[index].answers.forEach(answer => {\n var button = document.createElement(\"button\");\n button.textContent = answer;\n button.setAttribute(\"value\", answer);\n answerBox.appendChild(button);\n button.onclick = checkAnswer\n });\n\n}", "function next() {\n currentQuestion++;\n\n if (currentQuestion > questions.length - 1) {\n endGame();\n return;\n }\n\n var quizContent = \"<h2>\" + questions[currentQuestion].title + \"</h2>\"\n\n for (var buttonLoop = 0; buttonLoop < questions[currentQuestion].choices.length; buttonLoop++) {\n var buttonCode = \"<button onclick=\\\"[ANS]\\\">[CHOICE]</button>\"; \n buttonCode = buttonCode.replace(\"[CHOICE]\", questions[currentQuestion].choices[buttonLoop]);\n if (questions[currentQuestion].choices[buttonLoop] == questions[currentQuestion].answer) {\n buttonCode = buttonCode.replace(\"[ANS]\", \"correct()\");\n } else {\n buttonCode = buttonCode.replace(\"[ANS]\", \"incorrect()\");\n }\n quizContent += buttonCode\n }\n\n\n document.getElementById(\"landing-container\").innerHTML = quizContent;\n}", "function displayQuestions(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n var button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n choiceEl.appendChild(button)\n })\n}", "function getNewQuestion() {\n\n // set the text for the current question\n currentQuestionCard = availableQuestions[currentQuestionIndex];\n questionEL.innerText = currentQuestionCard.q;\n\n // create buttons from the choices\n for (i=0; i<currentQuestionCard.choices.length; i++) {\n const button = document.createElement('button');\n button.innerText = currentQuestionCard.choices[i];\n button.setAttribute(\"class\", \"btn\");\n button.addEventListener('click', function(){\n checkAnswer(event);\n resetQuestions();\n });\n \n choiceButtonsEl.appendChild(button);\n\n\n }\n}", "function showNextQuestion(question){\n questionEl.innerText = question.question\n question.answers.forEach(answer => {\n var button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n \n }\n button.addEventListener('click', selectAnswer)\n answerEl.appendChild(button)\n })\n}", "function getQuestions() {\n var currentQuestion = quizQuestions[index];\n questions.textContent = currentQuestion.question\n answers.innerHTML = \"answers\"\n currentQuestion.answers.forEach(function(choice, i){\n var choiceBtn = document.createElement(\"button\")\n choiceBtn.setAttribute(\"class\", \"answers\")\n choiceBtn.setAttribute(\"value\", choice)\n choiceBtn.textContent = i + 1 + \": \" + choice \n answers.appendChild(choiceBtn)\n choiceBtn.onclick = verifyAnswer;\n })\n}", "function showQuestion(questionArray) {\n questionEl.innerText = questionArray.question;\n questionArray.answers.forEach(answer => {\n var button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add(\"btn\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n };\n if (answer.correct == false ) {\n button.classList.add(\"incorrect\");\n };\n button.addEventListener(\"click\", selectAnswer);\n answerButtonsEl.appendChild(button);\n });\n \n}", "function next() {\n currentQuestion++;\n\n if (currentQuestion > trivia.length - 1) {\n endGame();\n return;\n }\n\n var quizContent = \"<h2>\" + trivia[currentQuestion].triviaQuestion + \"</h2>\"\n\n for (var buttonLoop = 0; buttonLoop < trivia[currentQuestion].choice.length; buttonLoop++) {\n var buttonCode = \"<button class='answerButton' onclick=\\\"[ANS]\\\">[CHOICE]</button>\";\n buttonCode = buttonCode.replace(\"[CHOICE]\", trivia[currentQuestion].choice[buttonLoop]);\n if (trivia[currentQuestion].choice[buttonLoop] == trivia[currentQuestion].answer) {\n buttonCode = buttonCode.replace(\"[ANS]\", \"correct()\");\n } else {\n buttonCode = buttonCode.replace(\"[ANS]\", \"incorrect()\");\n }\n quizContent += buttonCode\n }\n\n document.getElementById(\"quizBody\").innerHTML = quizContent;\n}", "function displayQuestion() {\n questionText.textContent = currentQuestionObject.question;\n for (i=0; i<4; i++) {\n answerButtons[i].textContent = currentQuestionObject.choices[i]\n }\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answers => {\n var button = document.createElement('button')\n button.innerText = answers.text\n button.classList.add('btn')\n if (answers.correct) {\n button.dataset.correct = answers.correct\n\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function generateAnswers() {\n isGameOver()\n var question = questionsList[questionsIndex].question\n $(\"#question\").text(question)\n $(\"#question\").show()\n for (var i = 0; i < 4; i++) {\n var answerSelectList = questionsList[questionsIndex].answerChoices[i]\n var correctChoice = questionsList[questionsIndex].correctChoice\n var answerSelect = $(\"<div>\");\n\n answerSelect.addClass(\"answer-detail\")\n answerSelect.attr(\"answer-select\", answerSelectList)\n answerSelect.attr(\"data-answer-detail\", [i])\n answerSelect.text(answerSelectList)\n\n $(\"#answer-box\").append(answerSelect)\n $(\"#answer-detail\").addClass(\"name\")\n $(\"#answer-detail\").attr(\"answer-select\", answerSelectList)\n $(\"#answer-detail\").attr(\"answer-index\", correctChoice)\n }\n onClick()\n }", "function showQuestion(){\n var question = questions[questionIndex];\n resetQuestionCard();\n questionEl.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct){\n button.dataset.correct = answer.correct;\n };\n button.addEventListener('click', selectAnswer);\n answerBtns.appendChild(button);\n \n });\n}", "function visibleQuestion(question) {\n questionEle.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n console.log(question.question)\n if (answer.correct){\n button.dataset.correct = answer.correct\n }\n else { \n button.dataset.wrong = answer.wrong\n }\n button.addEventListener('click', selectAnswer)\n answerBtns.appendChild(button);\n \n\n //This clears the state after the answer is picked\n})\n}", "function displayQuestion(){\n questionNum = 0;\n \n questionDisplay.textContent = question[questionNum].title;\n userAnswer.innerHTML=\"\";\n var choices = question[questionNum].choices;\n for(var i = 0; i < 4; i++){\n var nextChoice = document.createElement(\"button\");\n nextChoice.textContent = choices[i];\n answerBtn = userAnswer.appendChild(nextChoice).setAttribute(\"class\", \"p-3 m-1 btn btn-light btn-block\");\n }\n\n}", "function showAnswers(){\n let answerA = theQuestions[questionIndex].answer[0].list\n let answerB = theQuestions[questionIndex].answer[1].list\n let answerC = theQuestions[questionIndex].answer[2].list\n let answerD = theQuestions[questionIndex].answer[3].list\n btnTextA.textContent = answerA\n btnTextB.textContent = answerB\n btnTextC.textContent = answerC\n btnTextD.textContent = answerD\n multChoiceA.appendChild(btnTextA)\n multChoiceB.appendChild(btnTextB)\n multChoiceC.appendChild(btnTextC)\n multChoiceD.appendChild(btnTextD)\n }", "function showQuestion(question) {\n\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n var button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('button')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtons.appendChild(button)\n })\n}", "function generateQuizQuestion() {\n gameoverDiv.style.display = \"none\";\n if (currentQuestionIndex === finalQuestionIndex) {\n return showScore();\n }\n var currentQuestion = quizQuestions[currentQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n buttonA.innerHTML = currentQuestion.choiceA;\n buttonB.innerHTML = currentQuestion.choiceB;\n buttonC.innerHTML = currentQuestion.choiceC;\n buttonD.innerHTML = currentQuestion.choiceD;\n}", "function showQuestion(question) {\n //look up to understand this entire function\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function showQuestion(question){\n questionElement.innerText = question.question; // question. is the value passed into the parameter, .question is the property of the questions array\n answerButtonsEl.innerHTML = ''; //wiping it clear to put new question in \n question.answers.sort((a, b) => { // fuctionally the same as writing function (a, b) compares a to b, expects negative or positive number to sort\n return Math.random() - 0.5; // 50% of time will either be negative or positive, therefore list will be sorted randomly\n });\n //Generate answer buttons\n question.answers.forEach(element => { //forEach expects element parameter and will run for each element in array, element is the list within the answers array\n let btn = document.createElement('div');\n btn.classList.add('btn');\n btn.innerText = element.text;\n btn.dataset.correct = element.correct; // dataset.x is converted to an html element property of data-x, data- stores whatever property in the DOM so you can reference it\n answerButtonsEl.appendChild(btn);\n });\n}", "function displayQuestion(id) {\n var question = questions[id];\n var text = question.questionText;\n\n $(\".questions\").append(\"<p>\" + text + \"</p>\");\n\n // this for loop is creating an html button for each answer in the answers array\n var answers = question.answers;\n for (var i = 0; i < answers.length; i++) {\n $(\".answers\").append(\"<button value=\" + i + \">\" + answers[i] + \"</button>\");\n }\n $(\".answers button\").click(handleAnswerClick);\n}", "function showQuestion(question){\n questionElement.innerText = question.question;\n question.answer.forEach(answer => {\n var button = document.createElement(\"button\");\n button.innerHTML = answer.text;\n button.classList.add(\"btn\")\n if(answer.correct){\n button.dataset.correct = answer.correct;\n console.log(\"right!\");\n }\n button.addEventListener(\"click\", selectAnswer)\n answerButtonElement.appendChild(button)\n \n });\n}", "function showAnswers() {\n var currentAnswers = questions[currentQuestionIndex]\n buttonA.innerText = currentAnswers.texta;\n buttonB.innerText = currentAnswers.textb;\n buttonC.innerText = currentAnswers.textc;\n buttonD.innerText = currentAnswers.textd;\n}", "function showAnswers() {\n choiceBtns.textContent = \"\";\n for (var i = 0; i < questions[questionIndex].answers.length; i++) {\n var choiceBtn = document.createElement(\"button\");\n choiceBtn.textContent = questions[questionIndex].answers[i];\n choiceBtn.classList.add(\"choice\");\n choiceBtn.id=i;\n choiceBtns.appendChild(choiceBtn);\n choiceBtn.setAttribute(\"onclick\", \"check(this)\"); \n \n \n \n\n }\n\n}", "function generateQuizQuestion(){\n gameoverDiv.style.display = \"none\";\n if (currentQuestionIndex === finalQuestionIndex){\n return showScore();\n } \n var currentQuestion = quizQuestions[currentQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n buttonA.innerHTML = currentQuestion.choiceA;\n buttonB.innerHTML = currentQuestion.choiceB;\n buttonC.innerHTML = currentQuestion.choiceC;\n buttonD.innerHTML = currentQuestion.choiceD;\n}", "function clickOn1(){if(goodAnswer == 1){ correctAnswerClick(1); }else{ badAnswerClick(1); }}", "function addAnswerBtns() {\n\t\tfor (let k = 0; k < randAnswers.length; k++) {\n\t\t\t$(\"#answerArea\").append('<button class=\"btn btn-kelly answerBtn\"><li>' + randAnswers[k] + '</li></button>');\n\t\t\t// console.log(randAnswers[k]);\n\t\t}\n\t}", "function questionGenerator() {\n questionChecker();\n \n if (gameStart) {\n showText(); \n theTimer(20);\n $(\"#image\").html(\" \")\n $(\"#button\").hide()\n $(\"#theResult\").hide()\n $(\"#question\").html(triviaQuestions[theQuestion].question);\n $(\"#answerOne\").html(triviaQuestions[theQuestion].answers[0]);\n $(\"#answerTwo\").html(triviaQuestions[theQuestion].answers[1]);\n $(\"#answerThree\").html(triviaQuestions[theQuestion].answers[2]);\n $(\"#answerFour\").html(triviaQuestions[theQuestion].answers[3]);\n }\n }", "function displayAnswers() {\n let answers = myQuestions[questionIndex].answers\n let buttons = answerButtons.children\n for (let i = 0; i < answers.length; i++) {\n let currentButton = buttons[i];\n let currentAnswer = answers[i];\n currentButton.innerHTML = currentAnswer.answer\n currentButton.dataset.correct = currentAnswer.correct\n currentButton.addEventListener('click', pressAnswer)\n }\n\n\n}", "function showQuestion(question) {\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n })\n}", "function makeQuestions() {\n for (var i = 0; i < arrayQs.length; i++) {\n // create div to hold question\n var container = document.createElement('div')\n // add class to div\n container.setAttribute('class', ' triviaQuestion')\n var currentQ = '<h2>' + arrayQs[i].question + '</h2>'\n // add current Question to container\n container.innerHTML = currentQ\n // add choices to container \n for (var x = 0; x < arrayQs[i].answers.length; x++) {\n // array for radio input + choices\n var choiceAndRadio = []\n choiceAndRadio.push('</br><input type=\"radio\" name=\"choice' + i + '\" class=\"testButton ') \n if (arrayQs[i].answers[x] === arrayQs[i].correct) {\n choiceAndRadio.push(' correct')\n }\n choiceAndRadio.push('\" value=\"' + arrayQs[i].answers[x] + '\">' + arrayQs[i].answers[x])\n // add choices to container HTML\n container.innerHTML += choiceAndRadio.join(\" \")\n }\n // button to submit response\n var testResponse = document.createElement('button')\n testResponse.setAttribute(\"class\", \" testResponse\"+ \" testResponse\" + i)\n var text = document.createTextNode(\"Submit\")\n testResponse.appendChild(text)\n container.appendChild(testResponse)\n // Add event listener to each submit button \n testResponse.addEventListener('click', runTest)\n // append container to board\n board.appendChild(container) \n }\n}", "function quizQuestions() {\n currIndex = 0;\n var currQuest = questions[currIndex];\n\n // update the header\n questionHeader.textContent = currQuest.title;\n\n //loop through choices,\n currQuest.choices.forEach(function(choices) {\n // if (curreQuest <= (questions.choices.length - 1)) {\n //creating a button for each, assigning the data-attributes, and event listeners to save their answer\n var choiceButton = document.createElement(\"button\");\n choiceButton.setAttribute(\"class\", \"choice\");\n choiceButton.setAttribute(\"value\", choices);\n\n //saving choice as their answer...\n choiceButton.onclick = userAnswer;\n //displaying the choices\n choiceButton.textContent = choices;\n\n //hopefully displays on page\n chooseEl.appendChild(choiceButton);\n });\n}", "function makeButt(value, answ) {\n // *** Append A Button To DOM\n const betterNextContainer = `\n <article class=\"col-7 col-md-4 id=\"nxtBtn>\n <h3>${value}</h3>\n <div class=\"row\">\n <button class=\"button nxt\"> Next </button>\n </div>\n <article>\n `;\n\n $(\".qa\").append(betterNextContainer);\n // *** If User is Wrong, Display the Correct Answer\n if (answ !== null) {\n const betterCorrectContainer = `\n <article class=\"col-7 col-md-4\">\n <h4 class=\"spacer\"> Correct Answer: </h4>\n <div class=\"row\">\n <h5 class=\"col cor-ans\">${answ}</h5>\n </div>\n </article>\n `;\n $(\".qa\").append(betterCorrectContainer);\n }\n // Increase the Value of curQuest So Next Question Will Load When User Clicks\n curQuest++;\n $(\".nxt\").click((event) => {\n event.preventDefault();\n $(\".qa\").remove();\n renderQuizBetter();\n });\n}", "function generateQuestions() {\n if (questionIndex < questions.length) {\n //makes this page show up !\n questionPageEl.style.display = \"block\";\n //this defines the correct answer as the answer stored in \"an\" in the object at index 0\n correctAnswer = questions[questionIndex].an;\n //this updates the stored text from the HTML to display the question in the object at index 0\n questionEl.textContent = questions[questionIndex].q;\n optionsEl.innerHTML = \"\";\n //this helps define and set what array the options are supposed to be pulled out of so they aren't pulled out of the next array every single time\n\n var choicesFromArray = questions[questionIndex].option;\n\n //optionsEl.textContent = questions[questionIndex].option;\n // console.log(optionsEl);\n //questionIndex = questionIndex + 1;\n\n for (var i = 0; i < 4; i++) {\n console.log(\"create button!\");\n var choicesButton = document.createElement(\"button\");\n //this variable choicesFromArray is assigned to whatever the options are at whatever spot questionIndex is currently at\n //var choicesFromArray = questions[questionIndex].option;\n // console.log(choicesFromArray);\n //sets the button text to be whatever the options from the choicesFromArray were\n choicesButton.innerHTML = choicesFromArray[i];\n choicesButton.setAttribute(\"class\", \"btn btn-primary buttons\");\n choicesButton.style.margin = \"20px\";\n console.log(choicesButton);\n optionsEl.append(choicesButton);\n\n choicesButton.addEventListener(\"click\", function (event) {\n console.log(\"button clicked!\");\n console.log(questionIndex);\n if (this.innerHTML === questions[questionIndex].an) {\n yesOrNoEl.innerHTML = \"Correct!\";\n } else {\n secondsLeft = secondsLeft - 10;\n yesOrNoEl.innerHTML = \"Nope! -10 seconds\";\n }\n questionIndex++;\n console.log(questionIndex);\n console.log(this.innerHTML);\n\n generateQuestions();\n });\n }\n } else {\n window.location.href = \"scoreboard.html\";\n }\n}", "function printQAs() {\n \n h3q1.textContent = questions[currentQuestion];\n correctAnswer = answerSet[currentQuestion].correct;\n \n //fill in the answers and set bingo to true for the correct answer\n for(var j=0; j<4; j++) {\n btns[j].textContent = answerSet[currentQuestion].answers[j];\n if (j == correctAnswer) {\n btns[j].setAttribute(\"bingo\",\"true\");\n }\n } \n}", "function displayQuestion() {\r\n var questionEl = document.querySelector(\"#question\")\r\n questionEl.textContent = questions[currentQuestion].question\r\n var optionsEl = document.querySelector(\"#options\")\r\n optionsEl.innerHTML =''\r\n for (let i = 0; i < questions[currentQuestion].answers.length; i++) {\r\n var button = document.createElement(\"button\")\r\n button.textContent = questions[currentQuestion].answers[i]\r\n button.setAttribute(\"value\", i)\r\n button.setAttribute(\"class\", \"answer\")\r\n optionsEl.appendChild(button)\r\n }\r\n}", "function generateQuestions() {\n quizHTML =\n \"<p class='text-center timer-p'>Time Remaining: <span class='timer'>30</span></p>\" +\n \"<p class='text-center'>\" + questionArray[position] + \"</p>\" +\n \"<button class='answers btn-secondary ml-3 mt-3 mb-1 p-2'>A. \" + answerArray[position][0] + \"</button><br>\" +\n \"<button class='answers btn-secondary ml-3 mb-1 p-2'>B. \" + answerArray[position][1] + \"</button><br>\" +\n \"<button class='answers btn-secondary ml-3 mb-1 p-2'>C. \" + answerArray[position][2] + \"</button><br>\" +\n \"<button class='answers btn-secondary ml-3 mb-3 p-2'>D. \" + answerArray[position][3] + \"</button>\";\n $(\"#mainArea\").html(quizHTML);\n }", "function nextQuestion () {\n // This for loop loops through all of the trivia object, this also has our questions appear on the html page\n for (var i = 0; i < trivia.length; i++) {\n // This will iterate through each question in the index\n document.getElementById('currentQuestion').innerHTML = trivia[questionIndex].question\n \n }\n // This for loop goes through the iteration of each choice\n for (var j = 0; j < trivia[questionIndex].choices.length; j++) {\n // Creates a new bootstrap button element\n var buttons = document.createElement('button')\n // Puts the choices into the innerHTML button element\n buttons.innerHTML = trivia[questionIndex].choices[j]\n // Creates a bootstrap button classname\n buttons.className = 'btn btn-outline-primary'\n // This sets a variable to the HTML div 'choices'\n var buttonDiv = document.getElementById('choices')\n // appends the buttons to the html\n buttonDiv.appendChild(buttons)\n // This adds an event listener to the buttons we created\n buttonDiv.addEventListener('click', checkAnswer)\n // document.getElementById('choices').innerHTML += `<button id=jsButtons> ${trivia[questionIndex].choices[j]}</button>`\n\n console.log(trivia[questionIndex].choices[j])\n \n }\n}", "function generateEasyQuestion(){\n //Rename the button from \"Next Question\" to \"Submit\"\n var submitButton = document.getElementById(\"submit\");\n submitButton.innerHTML = \"Submit\";\n submitButton.onclick = checkAnswerForEasyLevel;\n\n //display a question if there is still an available question\n if (upToQuestion < easyLevel.length) {\n //get a number from the shuffled numbers inside the numbers array\n var random = randomNumber[upToQuestion];\n //use the generated random number to get a random question from the array containing the questions\n currentQuestionItem = easyLevel[random];\n console.log(\"Question item: \" + random);\n var question = currentQuestionItem.question;\n var answer = currentQuestionItem.answer;\n mathQuestionElement.textContent = question;\n\n\n //game won\n } else{\n createTransition(\"Congratulations! You won a barn! Are you ready to take another challenge?\", \"images/barn.png\", createMemoryGame);\n }\n //clear the user text field\n userAnswerTextbox.value = \"\";\n\n //display instructions\n mathAnswer.textContent = \"Compute the answer of the given math problem above.\";\n mathAnswer.id = \"qAInstructions\";\n}", "openQuestion(points){\n let question\n\n // plays thinking music\n thinking.volume = 0.2\n thinking.currentTime = 0\n thinking.play()\n\n if (this.category==1) {\n if (points==100) {\n question = 1;\n questionEl.innerHTML = q1.question\n\n ans1.innerHTML = q1.a1\n ans2.innerHTML = q1.a2\n ans3.innerHTML = q1.a3\n ans4.innerHTML = q1.a4\n\n this.points = points\n this.correct = \"answer3\"\n this.buttonNr = 1\n\n } else if (points==200) {\n question = 2;\n questionEl.innerHTML = q2.question\n\n ans1.innerHTML = q2.a1\n ans2.innerHTML = q2.a2\n ans3.innerHTML = q2.a3\n ans4.innerHTML = q2.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 2\n\n } else if (points==300) {\n question = 3;\n questionEl.innerHTML = q3.question\n \n ans1.innerHTML = q3.a1\n ans2.innerHTML = q3.a2\n ans3.innerHTML = q3.a3\n ans4.innerHTML = q3.a4\n\n this.points = points\n this.correct = \"answer2\"\n this.buttonNr = 3\n\n } else if (points==400) {\n question = 4;\n questionEl.innerHTML = q4.question\n \n ans1.innerHTML = q4.a1\n ans2.innerHTML = q4.a2\n ans3.innerHTML = q4.a3\n ans4.innerHTML = q4.a4\n\n this.points = points\n this.correct = \"answer3\"\n this.buttonNr = 4\n\n } else if (points==500) {\n question = 5;\n questionEl.innerHTML = q5.question\n \n ans1.innerHTML = q5.a1\n ans2.innerHTML = q5.a2\n ans3.innerHTML = q5.a3\n ans4.innerHTML = q5.a4\n\n this.points = points\n this.correct = \"answer4\"\n this.buttonNr = 5\n }\n } else if (this.category==2) {\n if (points==100) {\n question = 6;\n questionEl.innerHTML = q6.question\n \n ans1.innerHTML = q6.a1\n ans2.innerHTML = q6.a2\n ans3.innerHTML = q6.a3\n ans4.innerHTML = q6.a4\n \n\n this.points = points\n this.correct = \"answer3\"\n this.buttonNr = 6\n\n } else if (points==200) {\n question = 7;\n questionEl.innerHTML = q7.question\n \n ans1.innerHTML = q7.a1\n ans2.innerHTML = q7.a2\n ans3.innerHTML = q7.a3\n ans4.innerHTML = q7.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 7\n\n } else if (points==300) {\n question = 8;\n questionEl.innerHTML = q8.question\n \n ans1.innerHTML = q8.a1\n ans2.innerHTML = q8.a2\n ans3.innerHTML = q8.a3\n ans4.innerHTML = q8.a4\n\n this.points = points\n this.correct = \"answer4\"\n this.buttonNr = 8\n\n } else if (points==400) {\n question = 9;\n questionEl.innerHTML = q9.question\n \n ans1.innerHTML = q9.a1\n ans2.innerHTML = q9.a2\n ans3.innerHTML = q9.a3\n ans4.innerHTML = q9.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 9\n\n } else if (points==500) {\n question = 10;\n questionEl.innerHTML = q10.question\n \n ans1.innerHTML = q10.a1\n ans2.innerHTML = q10.a2\n ans3.innerHTML = q10.a3\n ans4.innerHTML = q10.a4\n\n this.points = points\n this.correct = \"answer4\"\n this.buttonNr = 10\n\n }\n } else if (this.category==3) {\n if (points==100) {\n question = 11;\n questionEl.innerHTML = q11.question\n \n ans1.innerHTML = q11.a1\n ans2.innerHTML = q11.a2\n ans3.innerHTML = q11.a3\n ans4.innerHTML = q11.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 11\n\n } else if (points==200) {\n question = 12;\n questionEl.innerHTML = q12.question\n \n ans1.innerHTML = q12.a1\n ans2.innerHTML = q12.a2\n ans3.innerHTML = q12.a3\n ans4.innerHTML = q12.a4\n\n this.points = points\n this.correct = \"answer4\"\n this.buttonNr = 12\n\n } else if (points==300) {\n question = 13;\n questionEl.innerHTML = q13.question\n \n ans1.innerHTML = q13.a1\n ans2.innerHTML = q13.a2\n ans3.innerHTML = q13.a3\n ans4.innerHTML = q13.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 13\n\n } else if (points==400) {\n question = 14;\n questionEl.innerHTML = q14.question\n \n ans1.innerHTML = q14.a1\n ans2.innerHTML = q14.a2\n ans3.innerHTML = q14.a3\n ans4.innerHTML = q14.a4\n\n this.points = points\n this.correct = \"answer3\"\n this.buttonNr = 14\n\n } else if (points==500) {\n question = 15;\n questionEl.innerHTML = q15.question\n \n ans1.innerHTML = q15.a1\n ans2.innerHTML = q15.a2\n ans3.innerHTML = q15.a3\n ans4.innerHTML = q15.a4\n\n this.points = points\n this.correct = \"answer2\"\n this.buttonNr = 15\n\n }\n } else if (this.category==4) {\n if (points==100) {\n question = 16;\n questionEl.innerHTML = q16.question\n \n ans1.innerHTML = q16.a1\n ans2.innerHTML = q16.a2\n ans3.innerHTML = q16.a3\n ans4.innerHTML = q16.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 16\n\n } else if (points==200) {\n question = 17;\n questionEl.innerHTML = q17.question\n \n ans1.innerHTML = q17.a1\n ans2.innerHTML = q17.a2\n ans3.innerHTML = q17.a3\n ans4.innerHTML = q17.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 17\n\n } else if (points==300) {\n question = 18;\n questionEl.innerHTML = q18.question\n \n ans1.innerHTML = q18.a1\n ans2.innerHTML = q18.a2\n ans3.innerHTML = q18.a3\n ans4.innerHTML = q18.a4\n\n this.points = points\n this.correct = \"answer2\"\n this.buttonNr = 18\n\n } else if (points==400) {\n question = 19;\n questionEl.innerHTML = q19.question\n \n ans1.innerHTML = q19.a1\n ans2.innerHTML = q19.a2\n ans3.innerHTML = q19.a3\n ans4.innerHTML = q19.a4\n\n this.points = points\n this.correct = \"answer4\"\n this.buttonNr = 19\n\n } else if (points==500) {\n question = 20;\n questionEl.innerHTML = q20.question\n \n ans1.innerHTML = q20.a1\n ans2.innerHTML = q20.a2\n ans3.innerHTML = q20.a3\n ans4.innerHTML = q20.a4\n\n this.points = points\n this.correct = \"answer2\"\n this.buttonNr = 20\n\n }\n } else if (this.category==5) {\n if (points==100) {\n question = 21;\n questionEl.innerHTML = q21.question\n \n ans1.innerHTML = q21.a1\n ans2.innerHTML = q21.a2\n ans3.innerHTML = q21.a3\n ans4.innerHTML = q21.a4\n\n this.points = points\n this.correct = \"answer2\"\n this.buttonNr = 21\n\n } else if (points==200) {\n question = 22;\n questionEl.innerHTML = q22.question\n \n ans1.innerHTML = q22.a1\n ans2.innerHTML = q22.a2\n ans3.innerHTML = q22.a3\n ans4.innerHTML = q22.a4\n\n this.points = points\n this.correct = \"answer3\"\n this.buttonNr = 22\n\n } else if (points==300) {\n question = 23;\n questionEl.innerHTML = q23.question\n \n ans1.innerHTML = q23.a1\n ans2.innerHTML = q23.a2\n ans3.innerHTML = q23.a3\n ans4.innerHTML = q23.a4\n\n this.points = points\n this.correct = \"answer1\"\n this.buttonNr = 23\n\n } else if (points==400) {\n question = 24;\n questionEl.innerHTML = q24.question\n \n ans1.innerHTML = q24.a1\n ans2.innerHTML = q24.a2\n ans3.innerHTML = q24.a3\n ans4.innerHTML = q24.a4\n\n this.points = points\n this.correct = \"answer4\"\n this.buttonNr = 24\n\n } else if (points==500) {\n question = 25;\n questionEl.innerHTML = q25.question\n \n ans1.innerHTML = q25.a1\n ans2.innerHTML = q25.a2\n ans3.innerHTML = q25.a3\n ans4.innerHTML = q25.a4\n\n this.points = points\n this.correct = \"answer2\"\n this.buttonNr = 25\n\n }\n }\n $(\"#showquestion\").slideToggle(\"fast\")\n \n \n }", "function generateQuizQuestion(){\n $(gameoverDiv).hide();\n if (currentQuestionIndex === finalQuestionIndex){\n return showScore();\n } \n var currentQuestion = quizQuestions[currentQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n buttonA.innerHTML = currentQuestion.choiceA;\n buttonB.innerHTML = currentQuestion.choiceB;\n buttonC.innerHTML = currentQuestion.choiceC;\n buttonD.innerHTML = currentQuestion.choiceD;\n}", "function displayQuestion(question) {\n //Variables to use for displaying questions and choices\n const questionText = question.title;\n const possibleChoices = question.choices;\n //Removing the hidden class to display the questions\n document.getElementById(\"game\").classList.remove('hide')\n //Setting the text of the question\n document.getElementById(\"question\").textContent = questionText\n //Clearing the choices from the previous question\n document.getElementById(\"answers\").innerHTML = \"\"\n // Looping over possible choices\n for (let i = 0; i < possibleChoices.length; i++) {\n //created button for choices\n let div = document.createElement('button')\n //Setting the text content\n div.textContent = possibleChoices[i]\n // Event listener for the answer choice\n div.addEventListener(\"click\", function () {\n // Variable for users selected answer \n const userChoice = this.textContent\n // Variable for correct answer\n const realAnswer = Questions[currentQuestion].answer\n //Function for comparing their answer versus real answer\n checkAnswer(userChoice, realAnswer)\n\n })\n // Styling for buttons\n div.className =\"btn btn-primary\"\n // Appending answer buttons to page\n document.getElementById(\"answers\").appendChild(div)\n\n }\n}", "function askQuestion(questionNumber) {\n // this places the Question text into the Question area of the page\n var h1 = document.querySelector(\"h1\");\n h1.textContent = \"\"; // clears the previous Question\n h1.textContent = questions[questionNumber];\n // clear all previous Answers\n var ol = document.querySelector(\"ol\");\n ol.innerHTML = \"\";\n // for each Answer, let's display them\n for (let i = 0; i < 4; i++) { // there are 4 Answers\n // add a list item\n var li = document.createElement(\"li\");\n document.body.children[1].children[0].children[0].children[1].appendChild(li);\n // find a \"button\"\n var answerButton = document.createElement(\"button\")\n // ID the button, add quiz class, give style\n answerButton.setAttribute(\"id\", \"answer\");\n answerButton.setAttribute(\"class\", \"quiz\");\n answerButton.setAttribute(\"style\", \"padding:1em;width:100%\");\n // put the Answer text in the button\n thisAnswer = answers[questionNumber][i];\n answerButton.textContent = thisAnswer;\n // answerKey is the index of the correct Answer, always found in slot 4\n var answerKey = answers[questionNumber][4];\n rightAnswer = answers[questionNumber][answerKey];\n // correct Answer will be labeled true\n if (thisAnswer === rightAnswer) { answerButton.value = true; }\n // put the whole button in the site\n document.body.children[1].children[0].children[0].children[1].children[i].appendChild(answerButton);\n } // end for loop\n\n checkAnswer(questionNumber);\n}", "function renderQuestionChoices() {\n var question = questions[index].choices;\n console.log(question);\n for (var option = 0; option < question.length; option++) {\n var questionOptionsDiv = document.getElementById(\"question-choices\");\n var questionButtons = document.createElement(\"button\");\n questionButtons.className =\n \"btn btn-outline-primary btn-lg d-flex justify-content-around\";\n questionButtons.innerHTML = question[option];\n // This occurs when user selects a choice.\n questionButtons.setAttribute(\n \"onclick\",\n \"checkAnswer(\" + index + \",\" + option + \");\"\n );\n questionOptionsDiv.append(questionButtons);\n }\n quizOver();\n}", "function question() {\n timer.reset();\n timer.start();\n $('#answers').empty();\n $('#question').html(questions[currentQuestion].qstn);\n for (var i = 0; i < questions[currentQuestion].answers.length; i++) {\n var button = $('<button onclick=\"answer(' + i + ')\" class=\"btn btn-primary answerButton m-2\">' + questions[currentQuestion].answers[i].answerText + '</button>');\n $('#answers').append(button);\n }\n}", "function createEasyMultipleChoiceGame() {\n document.body.innerHTML = \"\";\n upToQuestion = 0;\n\n var pigImage = createImage(\"images/pig2.png\");\n pigImage.classList.add(\"pig3\");\n\n //create pig's message\n paragraphContent = createParagraph(\"In this challenge, you need to count the number of farm animals presented and choose your answer from the choices provided.\", \"multipleChoiceInstructions\");\n\n var messageDiv = createDiv();\n messageDiv.classList.add(\"mCInstructionsDiv\");\n messageDiv.appendChild(paragraphContent);\n\n var containerDiv = createDiv();\n containerDiv.classList.add(\"mCInstructionsContainerDiv\");\n containerDiv.appendChild(pigImage);\n containerDiv.appendChild(messageDiv);\n\n //create submit button\n buttonElement = createButton(\"Submit\");\n buttonElement.id = \"submitMCButton\";\n buttonElement.onclick = checkForMCAnswer;\n\n //container div for the question (images)\n mCQuestionDiv = createDiv();\n mCQuestionDiv.id = \"questionEasyMCContainer\";\n\n //container div for the options for each question\n mCOptionsDiv = createDiv();\n mCOptionsDiv.id = \"optionsMCDiv\";\n\n //This function shuffles elements\n function shuffle(o) {\n for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n return o;\n };\n //shuffle numbers inside the numbers array\n randomNumber = shuffle(numbers);\n console.log(\"Shuffled values: \" + randomNumber);\n\n generateMultipleChoiceQuestionAndOptions();\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach (answer => {\n const button = document.createElement('button')\n button.innerText=answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function getQuestion () {\n questionEl.textContent = questions[increment].question;\n mainQuestion.append(questionEl);\n // For loop for answer choices\n for (var i = 0; i < questions[increment].answerChoices.length; i++) {\n var answerChoiceEl = document.createElement(\"button\");\n // Answer button styling \n // I see the limitations of creating the buttons in js as opposed to HTML\n answerChoiceEl.style.backgroundColor = \"#F0FFFF\";\n answerChoiceEl.style.padding = \"10px\";\n answerChoiceEl.style.fontSize = \"large\";\n answerChoiceEl.style.borderRadius = \"10px\";\n answerChoiceEl.style.marginInlineStart = \"10px\";\n // Event listener for answer choices\n answerChoiceEl.addEventListener(\"click\", function (){\n var answerSelected = this.textContent\n if (answerSelected === questions[increment].correctAnswer) {\n console.log(\"You did it!\");\n mainQuestion.innerHTML = \"\";\n // 10 Point increase for correct answer\n score = score + 10;\n console.log(score);\n // Move to next question/answer combo\n increment++;\n getQuestion();\n } else {\n console.log(\"This ain't it.\");\n mainQuestion.innerHTML = \"\";\n // Time penalty for wrong answer\n time = time - 10;\n // Move to next questions/answer combo\n increment++;\n getQuestion();\n } \n });\n answerChoiceEl.textContent = questions[increment].answerChoices[i];\n mainQuestion.append(answerChoiceEl); \n } \n}", "function getQuestion() {\n $(\".quiz\").show();\n\n //create var that references the questions array\n var currentQuestion = questions[currentQuestionIndex];\n //Display the current question\n questionEl.textContent = currentQuestion.title;\n\n //Creates a short hand variable for the forEach method that loops through each choice and change the text of the HTML buttons\n var allChoices = currentQuestion.choices;\n allChoices.forEach(function(choice, i) {\n document.querySelector(\".choice\" + i).innerHTML = \"<button class='btn'>\" + allChoices[i] + \"</button>\";\n });\n \n //Event listener that is used when the changed button is clicked\n buttons.addEventListener(\"click\", checkAnswer);\n}", "function makeQuestions() {\n arrayQs.forEach(function(i) {\n // for(var i = 0; i < arrayQs.length; i++) {\n // while loop until submit is entered\n submit = false;\n while(!submit) {\n // create div to hold question\n var container = document.createElement(\"div\");\n // add class to div\n container.setAttribute(\"class\", \" triviaQuestion\");\n var currentQ = \"<h2>\" + i.question + \"</h2>\";\n // add current Question to container\n container.innerHTML = currentQ;\n // add choices to container\n i.answers.forEach(function(x) {\n // for (var x = 0; x < i.answers.length; x++) {\n // array for radio input + choices\n var choiceAndRadio = []\n choiceAndRadio.push(`</br><input type=\"radio\" name=\"choice` + i + `\" class=\"testButton `)\n if (i.x === i.correct) {\n choiceAndRadio.push(\" correct\")\n }\n choiceAndRadio.push(`\" value=\"` + i.x + `\">` + i.x)\n\n // add choices to container HTML\n container.innerHTML += choiceAndRadio.join(\" \")\n }\n )\n // button to submit response\n\n var testResponse = document.createElement(`button`)\n testResponse.setAttribute(\"class\", \" testResponse\"+ \" testResponse\" + i)\n var text = document.createTextNode(\"Submit\")\n testResponse.appendChild(text)\n container.appendChild(testResponse)\n\n // Add event listener to each submit button \n testResponse.addEventListener(`click`, runTest)\n // append container to board\n board.appendChild(container) \n }\n// end while loop\n }\n )\n}", "function renderQuestionOptions() {\n var question = questions[index].options;\n console.log(question);\n for (var i = 0; i < question.length; i++) {\n var questionOption = document.getElementById(\"question-choices\");\n var questionButtons = document.createElement(\"button\");\n questionButtons.className =\n \"btn btn-outline-primary btn-lg d-flex justify-content-around\";\n questionButtons.innerHTML = question[i];\n \n //This checks the answer when user choose an answer \n questionButtons.setAttribute(\n \"onclick\",\n checkAnswer(i)\n );\n questionOption.append(questionButtons);\n }\n // quizOver();\n }", "function nextQuestion () {\n displayYes('answers')\n displayNo('right-answer');\n displayNo('next-question');\n\n // Change question and answers from HTML with a for loop and an array for the IDs\n for (i=0;i<5;i++){\n let questionAnswers = ['question','answer1','answer2','answer3','answer4'];\n document.getElementById(questionAnswers[i]).innerHTML = questions[questionNum][i];\n }\n}", "function createButton(obj) {\n var answerOne = document.createElement(\"button\");\n answerOne.textContent = \"a) \" + obj.answers[\"a\"];\n answerOne.setAttribute(\"id\", \"a\");\n choicesEl.appendChild(answerOne);\n firstChoice = choicesEl.querySelector(\"#a\");\n \n var answerTwo = document.createElement(\"button\");\n answerTwo.textContent = \"b) \" + obj.answers[\"b\"];\n answerTwo.setAttribute(\"id\", \"b\");\n choicesEl.appendChild(answerTwo);\n secondChoice = choicesEl.querySelector(\"#b\");\n \n var answerThree = document.createElement(\"button\");\n answerThree.textContent = \"c) \" + obj.answers[\"c\"];\n answerThree.setAttribute(\"id\", \"c\");\n choicesEl.appendChild(answerThree);\n thirdChoice = choicesEl.querySelector(\"#c\");\n \n var answerFour = document.createElement(\"button\");\n answerFour.textContent = \"d) \" + obj.answers[\"d\"];\n answerFour.setAttribute(\"id\", \"d\");\n choicesEl.appendChild(answerFour);\n forthChoice = choicesEl.querySelector(\"#d\");\n \n createCheck = false;\n}", "function questionOne(){\n questions.textContent = \"What tag is required in all HTML documents, and is used to define the title?\";\n var answersOne = [\"<title>\", \"<body>\", \"<head>\", \"<br>\"];\n for (var i = 0; i < answersOne.length; i++){\n var buttonsOne = document.createElement(\"button\");\n buttonsOne.textContent = answersOne[i];\n buttonsOne.setAttribute(\"style\", \"color: black\");\n buttonsOne.setAttribute(\"data-value\", answersOne[i]);\n answersSelectionOne.append(buttonsOne);\n\n }\n}", "function questionGen() {\n $(\"#game\").append(\"<p class='question'>\" + questions[questionNumb].question + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[0] + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[1] + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[2] + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[3] + \"</p>\");\n }", "function showQuiz(){\n questionContainerEl.innerHTML =''\n var title= document.createElement('h1')\n var description= document.createElement('p')\n \n title.textContent = questions[qcounter].title\n description.textContent = questions[qcounter].description\n questionContainerEl.appendChild(title)\n questionContainerEl.appendChild(description)\n \n for(var i = 0; i < questions[qcounter].possibleAnswers.length; i++){\n var possibleAnswers= document.createElement('button')\n possibleAnswers.className = 'choices'\n possibleAnswers.textContent = questions[qcounter].possibleAnswers[i];\n questionContainerEl.appendChild(possibleAnswers)\n }\n}", "function askQuestions(){\n $(\"#answer\").empty();\n $(\"#timeUp\").hide();\n $(\"#answer\").hide();\n $(\"#quesBtn\").show();\n $(\"#ans1\").show();\n $(\"#ans2\").show();\n $(\"#ans3\").show();\n $(\"#ans4\").show();\n index = randomQuestion();\n $(\"#quesBtn\").removeClass('d-none');\n $(\"#quesBtn\").html(\"<button type= 'button' class='list-group-item list-group-item-action active' id='quesBtn'>\"+\n quesBank[index]+\"</button>\");\n $(\"#ans1\").removeClass('d-none');\n $(\"#ans1\").html(\"<button type='button' class='btn btn-secondary'id='ans1'value='\" + options[index][0] + \"'>\"+options[index][0]+\"</button>\");\n $(\"#ans2\").removeClass('d-none');\n $(\"#ans2\").html(\"<button type='button' class='btn btn-secondary'id='ans2'value='\" + options[index][1] + \"'>\"+options[index][1]+\"</button>\");\n $(\"#ans3\").removeClass('d-none');\n $(\"#ans3\").html(\"<button type='button' class='btn btn-secondary'id='ans3'value='\" + options[index][2] + \"'>\"+options[index][2]+\"</button>\");\n $(\"#ans4\").removeClass('d-none');\n $(\"#ans4\").html(\"<button type='button' class='btn btn-secondary'id='ans4'value='\" + options[index][3] + \"'>\"+options[index][3]+\"</button>\");\n\n $(\"#ans1\").unbind(\"click\").on(\"click\", \"button[id=ans1]\",function (){\n // $(\"#ans1\").unbind('click'); //Resets button\n var answer1 = $(this).val();\n // console.log($(\"#ans1\").text(value));\n console.log(answer1);\n evaluate(answer1);\n\n });\n\n $(\"#ans2\").unbind(\"click\").on(\"click\", \"button[id=ans2]\",function (){\n // $(\"#ans2\").unbind('click'); //Resets button\n var answer2 = $(this).val();\n // console.log($(\"#ans1\").text(value));\n console.log(answer2);\n evaluate(answer2);\n\n });\n\n // $(\"#ans3\").on(\"click\",\"button[id=ans3]\",function()\n // $('#ans3').unbind('click').click(function()\n $(\"#ans3\").unbind(\"click\").on(\"click\", \"button[id=ans3]\",function ()\n {\n // $(\"#ans3\").unbind('click'); //Resets button\n var answer3 = $(this).val();\n // console.log($(\"#ans1\").text(value));\n console.log(answer3);\n // $(\"#ans3\").unbind('click'); //Resets button\n evaluate(answer3);\n\n });\n\n $(\"#ans4\").unbind(\"click\").on(\"click\", \"button[id=ans4]\",function (){\n // $(\"#ans4\").unbind('click'); //Resets button\n var answer4 = $(this).val();\n // console.log($(\"#ans1\").text(value));\n console.log(answer4);\n // $(\"#ans4\").unbind('click'); //Resets button\n evaluate(answer4);\n\n });\n \n \n}", "function generateDarkQuizQuestion() {\n if (currentDarkQuestionIndex === finalDarkQuestionIndex) {\n return showScore();\n }\n var currentDarkQuestion = quizDarkQuestions[currentDarkQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentDarkQuestion.question + \"</p>\";\n\n buttonBox.innerHTML = \"\";\n currentDarkQuestion.answers.forEach(function (answer) {\n var button = document.createElement(\"button\");\n button.setAttribute(\"class\", \"answer\");\n button.setAttribute(\"value\", answer);\n button.textContent = answer;\n button.onclick = questionClick;\n buttonBox.appendChild(button);\n });\n console.log(currentDarkQuestion);\n}", "function makeQuestion() {\n const questionbox = document.querySelector('#questionbox');\n const responsebox = document.querySelector('#responsebox');\n responsebox.style.visibility='hidden';\n questionbox.style.visibility='visible';\n // create a variable called questionask\n let questionask = document.querySelector('#question');\n // print the current question\n questionask.innerHTML = questions[counter].ask;\n // loop through all of the answers\n for (let j=0; j < questions[counter].answers.length; j++){\n let answer = document.querySelectorAll('.answer');\n //print the current answer\n answer[j].innerHTML = questions[counter].answers[j].word;\n };\n }", "function generateMultipleChoiceHardQuestionAndOptions(){\n\n //display a question if there is still an available question\n if (upToQuestion < multipleChoiceHardElements.length){\n\n //get a number from the shuffled numbers inside the numbers array\n var random = randomNumber[ upToQuestion]\n console.log(\"Current question item: \" + random);\n //use the generated random number to get a random question from the array containing the questions\n currentQuestionItem = multipleChoiceHardElements[random];\n\n //clear the images of the previous question\n var previousQuestion = document.getElementById(\"questionMCHardContainer\");\n previousQuestion.innerHTML = \"\";\n //create the questions\n\n var questionDiv = createDiv();\n questionDiv.classList.add(\"mCHardImage\");\n questionDiv.style.backgroundImage = 'url(' + multipleChoiceHardElements[random].questionImage + ')';\n mCQuestionDiv.appendChild(questionDiv);\n\n\n //clear the previous options values\n var previousOptions = document.getElementById(\"optionsMCDiv\");\n previousOptions.innerHTML = \"\";\n\n\n //create the options for each question\n var optionA = multipleChoiceHardElements[random].options.a;\n var optionB = multipleChoiceHardElements[random].options.b;\n var optionC = multipleChoiceHardElements[random].options.c;\n\n\n //create option a\n var labelA = createLabel();\n labelA.setAttribute(\"for\", \"optionA\");\n labelA.innerHTML = optionA;\n console.log(\"option value: \" + optionA);\n\n var radioButtonA = createRadioButtons();\n radioButtonA.setAttribute(\"name\", \"option\");\n radioButtonA.classList.add(\"option\");\n radioButtonA.setAttribute(\"value\", \"a\");\n radioButtonA.setAttribute(\"id\", \"optionA\");\n labelA.appendChild(radioButtonA);\n mcOptionsDiv.appendChild(labelA);\n\n //create option b\n var labelB = createLabel();\n labelB.setAttribute(\"for\", \"optionB\");\n labelB.innerHTML = optionB;\n console.log(\"option value: \" + optionB);\n\n var radioButtonB = createRadioButtons();\n radioButtonB.setAttribute(\"name\", \"option\");\n radioButtonB.classList.add(\"option\");\n radioButtonB.setAttribute(\"value\", \"b\");\n radioButtonB.setAttribute(\"id\", \"optionB\");\n labelB.appendChild(radioButtonB);\n mcOptionsDiv.appendChild(labelB);\n\n //create option c\n var labelC = createLabel();\n labelC.setAttribute(\"for\", \"optionC\");\n labelC.innerHTML = optionC;\n console.log(\"option value: \" + optionC);\n\n var radioButtonC = createRadioButtons();\n radioButtonC.setAttribute(\"name\", \"option\");\n radioButtonC.classList.add(\"option\");\n radioButtonC.setAttribute(\"value\", \"c\");\n radioButtonC.setAttribute(\"id\", \"optionC\");\n labelC.appendChild(radioButtonC);\n mcOptionsDiv.appendChild(labelC);\n\n\n //change button text\n buttonElement.innerHTML = \"Submit\";\n buttonElement.id = \"submitMCButton\";\n buttonElement.onclick = checkForMCHardAnswer;\n\n } else {\n createTransition(\"There's always a room for more farm friends. Am I right, or am I right?\", \"images/goat2.png\", createMatchTheAnswerHardGame);\n }\n paragraphContent.removeAttribute(\"id\");\n paragraphContent.textContent = \"From the choices provided, choose the answer to the math problem.\";\n}", "function generateAnswers(question) {\n const answers = question.answers;\n\n const answersHTML = createNode(\"div\", { id: \"answersWrapper\" });\n\n\n const subDivArray = [];\n //para empaquetar las preguntas de dos en dos\n for (let j = 0; j < answers.length / 2; j++) {\n subDivArray[j] = createNode(\"div\", { className: \"answersSubWraper\" });\n }\n\n for (let i = 0; i < answers.length; i++) { //creamos el html de cada pregunta\n //vemos en que subWrapper hay que ponerlo:\n let subWrapper = Math.floor(i / 2);\n\n const answerWrapper = createNode(\"div\", { className: \"answerWrapper btn\" });\n\n //creamos los input\n const answerHTMLinput = createNode(\"input\", {\n className: \"answerInput\",\n type: \"radio\",\n name: `quID_${question.questionID}`,\n id: `answer_${i}`,\n value: i.toString()\n });\n\n\n //creamos las label\n const answerHTMLlabel = createNode(\"label\", {\n innerText: answers[i],\n className: \"answerLabel btn\",\n htmlFor: `answer_${i}`\n });\n\n //los metemos en el wrapper de respuesta\n answerWrapper.appendChild(answerHTMLinput);\n answerWrapper.appendChild(answerHTMLlabel);\n\n //lo metemos en el subWrapper de respuesta que corresponde\n subDivArray[subWrapper].appendChild(answerWrapper);\n\n //unimos los subDivArray en answersHTML\n subDivArray.forEach(subDiv => {\n answersHTML.appendChild(subDiv)\n })\n }\n //devolvemos el nodo con todas las respuestas.\n return answersHTML;\n}", "function generator(){\n\tif (surfacedQuestions.length > 0){ //if there are questions\n\t\tvar thisQuestion = surfacedQuestions.shift(); //get whatever turns up first in the array\n\t\t$('#question').append(thisQuestion.getInfo());\n\t\t//Submit answer\n\t\t$('.radioSubmit').click(function(){\n\t\t\tvar groupName = $('input[type=\"radio\"]:checked').val();\n\t\t\tif ($('input[type=\"radio\"]:checked').length > 0){\n\t\t\t\tif (groupName == thisQuestion.correctAnswer){\n\t\t\t\t\tanswer = '<div class=\"col-sm-6\"><div class=\"feedback\">';\n\t\t\t\t\tanswer = answer + '<i class=\"right fa fa-check-circle-o fa-3x\"></i><h3>You Got It!</h3></div>';\n\t\t\t\t\tanswer = answer + '<img src=\"'+ thisQuestion.blurryImageLink +'\"/></div>';\n\t\t\t\t\tanswer = answer + '<div class=\"col-sm-6\"><p>The Right Answer:<br/> <span class=\"titlecase right text-center\">' + thisQuestion.correctAnswer.replace(/-/g, \" \") + '</p>';\n\t\t\t\t\tanswer = answer + '<p class=\"description\">' + thisQuestion.fullAnswer + '</p>';\n\t\t\t\t\tcorrect++;\n\t\t\t\t} else {\n\t\t\t\t\tanswer = '<div class=\"col-sm-6\"><div class=\"feedback\">';\t\n\t\t\t\t\tanswer = answer + '<i class=\"wrong fa fa-times-circle fa-3x\"></i><h3>Ooh, so close!</h3></div>';\n\t\t\t\t\tanswer = answer + '<img src=\"'+ thisQuestion.blurryImageLink +'\"/></div>';\n\t\t\t\t\tanswer = answer + '<div class=\"col-sm-6\"><p>The Right Answer:<br /> <span class=\"titlecase right\">' + thisQuestion.correctAnswer.replace(/-/g, \" \") + '</span></p>';\n\t\t\t\t\tanswer = answer + '<p class=\"description\">' + thisQuestion.fullAnswer + '</p>';\n\t\t\t\t\tincorrect++;\n\t\t\t\t}\n\t\t\t\tclearDiv();\n\n\t\t\t\t//Print the appropariate answer\n\t\t\t\t$('#question').append(answer);\n\n\t\t\t\t//Create the \"next\" button, dependant on which question we're on\n\t\t\t\tvar nextButton = '<button type=\"button\" class=\"btn btn-primary nextOne\">Next Question <i class=\"fa fa-chevron-circle-right\"></i></button>';\n\t\t\t\tif (count == 4) {\n\t\t\t\t\tnextButton = '<button type=\"button\" class=\"btn btn-primary nextOne\">Beer me my results! <i class=\"fa fa-chevron-circle-right\"></i></button>';\n\t\t\t\t}\n\n\t\t\t\t$('#question').append('<div class=\"row\"><div class=\"basepadding col-sm-12 text-center\"><em>So far, you have ' + correct + ' right and ' + incorrect + ' wrong.</em><br/>' + nextButton + '</div></div>');\n\t\t\t\t\t//Make way for the next question\n\t\t\t\t\t$('.nextOne').click(function(){\n\t\t\t\t\t\tif (count < 4){\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t\t$('.questionNumber').empty().append('Question ' + count + ' of 4' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$('.questionNumber').empty().append('Your Results');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclearDiv();\n\t\t\t\t\t\tgenerator();\n\t\t\t\t\t});\n\t\t\t}else {\n\t\t\t\tif ($('.content-wrapper .wrong').length == 0){\n\t\t\t\t\t$('.content-wrapper').prepend('<span class=\"error wrong\">You didn\\'t pick an answer, silly!</span>');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\telse {\n\t\tvar reloadBtn = '<button type=\"button\" class=\"btn btn-primary tryagain\">Try again</button>';\n\n\t\tif (correct > 2){\n\t\t\t$('#question').append('<div class=\"results\"><i class=\"fa right fa-thumbs-o-up fa-4x\"></i><h3>You + Me = BFFs</h3><img src=\"images/bro-montana.gif\"/><p>You got ' + correct + ' answers right!</p> <p>YOU GET ME!</p></div>' + reloadBtn);\n\t\t} else {\n\t\t\t$('#question').append('<div class=\"results\"><i class=\"fa wrong fa-thumbs-o-down fa-4x\"></i><h3>You Don\\'t Get Me at All</h3><img src=\"images/double-facepalm.jpg\"/><p>You only got ' + correct + ' answers right.</p> <p>...It\\'s as though we\\'re complete strangers.</p> </div>' + reloadBtn);\n\t\t}\n\t\t$('.tryagain').click(function(){\n\t\t\tdocument.location.reload();\n\t\t});\n\n\t}\n}", "function generateQA(){\n var x = Math.round(Math.random()*14)+1;\n var y = Math.round(Math.random()*9)+1;\n answer = x * y;\n document.getElementById(\"question\").innerHTML = x + \"x\" + y;\n \n //for positioning the correct answer in the random box:\n var position = 1+Math.round(3*Math.random());\n document.getElementById(\"opt\" + position).innerHTML = answer;\n \n //for filled other options by wrong answers:\n var allanswers = [answer];\n for(var i = 1; i<5; i++){\n if(i !== position){\n var wronganswer;\n do{\n wronganswer = (Math.round(Math.random()*14)+1) * (Math.round(Math.random()*9)+1); //this will generates the wrong answer.\n }while(allanswers.indexOf(wronganswer) > -1);\n \n document.getElementById(\"opt\"+i).innerHTML = wronganswer;\n allanswers.push(wronganswer);\n }\n }\n}", "function getNextQuestion() {\n questionsCounter++\n questionTitle.innerText = questionsArray[currentQuestion].prompt; \n for (var i = 0; i < btnArray.length; i++) {\n var currentChoice = questionsArray[currentQuestion].choices[i]\n console.log(currentChoice)\n btnArray[i].textContent = currentChoice;\n btnArray[i].setAttribute(\"onclick\", \"selectAnswer(\" + \"\\\"\" + currentChoice + \"\\\"\" +\")\")\n }\n}", "function Option_btn_Click(val) {\n\n\n let id;\n let qNum;\n switch (i) {\n case 0: id = \"ans1\";qNum=1;break;\n case 1: id = \"ans2\";qNum=2;break;\n case 2: id =\"ans3\";qNum=3;break;\n case 3: id =\"ans4\";qNum=4;break;\n case 4: id =\"ans5\";qNum=5;break;\n }\n\n //setting results\n if (val === question.question[i].ans){\n document.getElementById(id).innerText = \"Q\"+qNum+\" Selected Option: \" + val + \", correct: +1\";\n result++;\n }\n else{\n document.getElementById(id).innerText= \"Q\"+qNum+\" Selected Option: \" + val + \", incorrect: 0 [Correct Ans:\"+question.question[i].ans+ \"]\";\n }\n if(i<4){i++;}\n else{\n document.getElementById('p3').style.display=\"block\";\n document.getElementById('p2').style.display=\"none\";\n i=0;\n }\n setUp();\n document.getElementById('res').innerText = \"Results : \"+result;\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n score++;\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function renderQuestion(){\n /* get a question from the questionSet array */\n var question = questionSet[questionIndex];\n \n /* update title with active question object */\n questionEl.children[0].textContent = question.title;\n \n /* evaluates if sometimes */\n while (answersEl.hasChildNodes()) {\n answersEl.removeChild(answersEl.lastChild);\n }\n /* Iterate over answer objects in each question's array */\n for (var i = 0; i < question.options.length; i++) {\n /* create button for each option object */\n var answerBtn = document.createElement(\"BUTTON\");\n answerBtn.textContent = question.options[i];\n /* return answer buttons in UI */\n answersEl.appendChild(answerBtn);\n }\n /* Each answer option object has an event listener*/\n answersEl.children[0].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[0]);\n });\n answersEl.children[1].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[1]);\n });\n answersEl.children[2].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[2]);\n });\n answersEl.children[3].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[3]);\n });\n\n /* Manages answer selection, user feedback, and iterating through all elements in the questionSet array */\n function optionClick(option){\n /* if the answer option the user clicks on matches in type and value to the answer in the questionSet array, flash the user a Correct toast */\n if(option.textContent == questionSet[questionIndex].answer){\n toastEl.textContent = \"Correct!\";\n \n /* if the answer option the user clicks on doesn't match in type and value to the answer in the questionSet array, flash the user a Wrong toast and */\n } else {\n \n /* subraction assingment to remove 2 seconds from time remaining if the answer is wrong */\n time -= 10;\n toastEl.textContent = \"Wrong :/\";\n }\n\n /*iterate to next question */\n questionIndex++;\n\n /* Evaluate if all questions in the array have been used yet */\n if (questionIndex === questionSet.length) {\n quizEnd();\n } else {\n renderQuestion();\n }\n }\n}", "function muestrapregunta() {\n if (questionIndex < questions.length) {\n var quest = questions[questionIndex];\n pregunta.textContent = quest.question;\n AButton.textContent = quest.choiceA;\n BButton.textContent = quest.choiceB;\n CButton.textContent = quest.choiceC;\n DButton.textContent = quest.choiceD;\n\n }\n else {\n resultdisplay();\n\n }\n}" ]
[ "0.7513611", "0.72971696", "0.7236651", "0.7226144", "0.71696675", "0.710609", "0.70444113", "0.7041013", "0.70290446", "0.69883245", "0.6983873", "0.6975619", "0.6973797", "0.69731414", "0.6964209", "0.6918448", "0.69055265", "0.6897879", "0.6882865", "0.6878244", "0.687444", "0.6874208", "0.6869824", "0.68520033", "0.68351364", "0.68330985", "0.6828664", "0.68264335", "0.68217194", "0.681431", "0.681", "0.6807758", "0.6806734", "0.68048334", "0.67952555", "0.67900455", "0.67766565", "0.677421", "0.6770845", "0.6770148", "0.6749368", "0.6738055", "0.67182857", "0.6716364", "0.6712475", "0.6710873", "0.6709106", "0.67079335", "0.67073226", "0.6697865", "0.66941", "0.66937506", "0.668593", "0.66756845", "0.6669781", "0.66677046", "0.6656189", "0.6651538", "0.6650269", "0.6645981", "0.66429853", "0.66337", "0.6629957", "0.6628037", "0.6626866", "0.6626115", "0.6626013", "0.6625363", "0.6623792", "0.6620179", "0.6619705", "0.6612281", "0.6606828", "0.6604092", "0.6596225", "0.65906847", "0.65821815", "0.65750545", "0.6574104", "0.6573026", "0.6568283", "0.65625125", "0.6557665", "0.6545161", "0.65445626", "0.65408635", "0.65403306", "0.6537679", "0.65333253", "0.6530956", "0.65268475", "0.65268064", "0.65228266", "0.6522053", "0.651841", "0.6511472", "0.6509168", "0.6508539", "0.6507331", "0.65046626", "0.6502731" ]
0.0
-1
function to check if there are more questions after each question, it will either show the next question or generate the final 'gameover' page
function wait() { if (questionCounter < 7) { questionCounter++; generateHTML(); counter = 5; timerWrapper(); } else { finalScreen(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextQuestion(){\n questionIndex++\n if (theQuestions.length > questionIndex){\n showQuestion()\n } else {\n quizEnd()\n }\n}", "function nextQuestion(){\n var isQuestionOver= (quizQuestions.length - 1) === currentQuestion;\n if (isQuestionOver){\n console.log(\"game is over\");\n displayResult();\n } \n \n else{\n currentQuestion++;\n loadQuestion();\n }\n \n}", "function nextQuestion(){\n var questionOver = (questions.length -1) === currentQuestion\n if (questionOver) {\n resultDisplay()\n } else {\n currentQuestion++;\n loadQuestions();\n }\n}", "function nextQuestion() {\n /* set variable isQuestionOver to the value of the two variable, triviaQuestions.length\n and currentQuestion, being equal*/\n var isQuestionOver = (triviaQuestions.length - 1) === currentQuestion;\n // if isQuestionOver true, run displayResults function\n if (isQuestionOver) {\n displayResults();\n\n // else add 1 to currentQuestion and run loadQuestion function.\n } else {\n currentQuestion++;\n loadQuestion();\n }\n }", "function nextQuestion(){\t\n\t\thideAnswerBox();\n\t\tremovePosters();\n\t\tstopAudio();\n\t\tquestionCount++;\n\t\t\n\t\tif (questionCount > 9) {\n\t\t\tendGame();\n\t\t\tshowOverlay($('.endGame'));\n\t\t}\n\t\telse if (questionCount > 4 && gameCount < 1) {\n\t\t\tendRound();\n\t\t\tshowOverlay($('.end_round'));\n\t\t}\n\t\telse {\n\t\t\tupdateQuestion();\n\t\t\tplayAudio();\n\t\t}\n\t}", "function nextQuestion() {\n const isQuestionOver = (triviaQuestions.length - 1) === currentQuestion;\n if (isQuestionOver) {\n displayResult();\n }else{\n currentQuestion++;\n loadQuestion();\n }\n\n }", "function nextQuestion() {\n const isQuestionOver = (quizQuestions.length - 1) === currentQuestion;\n if (isQuestionOver) {\n //\n displayResults();\n console.log(\"game over\")\n }\n else {\n currentQuestion++;\n $('#game-running').prepend(\"<div class='col-sm-12' id='time'>\");\n loadQuestion();\n }\n}", "function nextQuestion() {\n currentQuestion++;\n \n if (currentQuestion < quiz.length) {\n displayQuestion();\n } else {\n showResult();\n }\n }", "function nextQuestion() {\n const isQuestionOver = (quizQuestions.length - 1) === currentQuestion;\n if (isQuestionOver) {\n console.log('Game has ended.');\n displayResult();\n } else {\n currentQuestion++;\n loadQuestion();\n }\n\n}", "function nextQuestion(){\n clearAnswer();\n questionIndex++;\n\n if (questionIndex < questions.length) {\n displayQuestion(questions[questionIndex]);\n } else {\n gameOver();\n }\n}", "function endOfQuestions() {\n $('body').on('click', '#next', (event) => {\n STORE.currentQuestion === STORE.questions.length ? showResults() :\n displayQuestion();\n });\n}", "function nextQuestion() {\n if (currentQuestion < questions.length - 1) {\n currentQuestion++\n $(\".questions\").show();\n $(\".answers\").show();\n resetTimer();\n $(\".timer\").show();\n $(\".image\").hide();\n displayQuestion(currentQuestion);\n }\n\n else {\n gameOver();\n }\n\n}", "function nextQuestion(){\n previousQuestion = document.querySelector(\".\" + sectionArray[nextSectionIndex]);\n previousQuestion.style.display = \"none\";\n\n nextQuestionIndex++;\n nextSectionIndex++;\n \n // When the user gets to the last question, final score section will display. Otherwise, displays another question from the list in object\n if(nextQuestionIndex === lastQuestionIndex) {\n finalScoreMessage();\n } else {\n questionList();\n } \n}", "function nextQuestion() {\n\tif (questionNumber < 6) {\n\tquestionNumber++;\n\tshowTriviaGame();\n\tquestionTimer = 30;\n\tgameTimer();\n\t}\n\telse {\n\t\tresultsScreen();\n\t\t$(\"#results\").show();\n\t}\n}", "function nextQuestion() {\n $(\".answer-container\").hide();\n $(\".game-container\").show();\n currentQuestionIndex++;\n if (currentQuestionIndex >= triviaArr.length) {\n endGame();\n }\n else {\n $(\".timer\").show();\n time = 30;\n questionInterval = setInterval(count, 1000);\n currentQuestionData = triviaArr[currentQuestionIndex];\n displayQuestion();\n }\n }", "function nextQuestion() {\n\tif (question_counter < questions.length - 1) {\n\t\tquestion_counter++;\n\t\tquestion_button_default.style.display = \"none\";\n\t\tquestion_button_default.classList.remove('btn--wrong')\n\t\tquestion_button_default.classList.remove('btn--correct')\n\t\tshowQuestions(question_counter)\n\t} else {\n\t\tconsole.log('> No more questions: Staph');\n\t\tshowResultBox();\n\t}\n}", "function nextQuesiton(){\n\t\tquestionAnswered++;\n\t\t\n\t\t// if there are no more questions left end game and give score\n\t\tif(questionAnswered > Object.keys(questions).length /*length of object*/){\n\t\t\tgameOver();\n\t\t} else{\n\t\t\t//restart timer and ask next question\n\t\t\t//move to next question\n\t\t\t//show old hidden components\n\t\t\t$(\"#timer\").show();\n\t\t\t$(\"#answers\").show();\n\t\t\t$(\"#question\").show();\n\t\t\t$(\".headerSection\").show();\n\t\t\t$(\"#imagesDiv\").hide();\n\t\t\tconsole.log(questionAnswered);\n\t\t\t$(\"#question\").html(questions[\"q\" + questionAnswered][0]);\n\t\t\t//clears out old answers\n\t\t\t$(\"#answers\").empty();\n\t\t\t$(\"#answers\").css({\"width\": \"250px\", \"position\": \"absolute\", \"top\": \"50%\", \"left\": \"50%\", \"margin-right\": \"-50%\", \"transform\": \"translate(-50%, -50%)\"});\n\t\t\t//generate a list of possible answers for first question\n\t\t\tfor(var i = 1; i < questions[\"q\" + questionAnswered].length; i++) {\n\t\t\t$(\"#answers\").append(\"<div class = \\\"choices\\\">\"+questions[\"q\" + questionAnswered][i]+\"</div>\");\n\t\t\t}\n\t\t\t\n\t\t\t//clear countdown and restart\n\t\t\tclearInterval(interval);\n\t\t\tcounter = timeToAnswer;\n\t\t\t$(\"#timer\").html(\"Time Remaining: \" + timeToAnswer + \" seconds left\");\n\t\t\tintervalInit();\n\t\t\ttimerInit();\n\t\t\t\n\t\t}\n\n\t}", "function showNextQuestion(){\n\t$(\".wrapper\").show();\n\t$(\".answer-box\").hide();\n\t// $(\".flip-container\").flip(false);\n\t\n\tif(nextQuestionIndex < questions.length){\n\t\tshowQuestions(questions[nextQuestionIndex].question, questions[nextQuestionIndex].options, questions[nextQuestionIndex].answerIndex);\n\t\t$(\".number-counter\").html(\"<p>Question \" + questionCounter + \" of 5</p>\");\n\t\tquestionCounter++;\n\t}\n\telse{\n\t\tshowUserScore();\n\t}\n}", "function displayNext() {\n var question = $('#question');\n var wrong = $('#wrong');\n if (typeof(question) != 'undefined' && question != null) {\n question.remove();\n }\n\n if (typeof(wrong) != 'undefined' && wrong != null) {\n wrong.remove();\n }\n\n if(questionCounter < questions.length){\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion);\n\n // Controls display of 'prev' button\n if(questionCounter >= 1){\n prev.show();\n next.show();\n replay.hide();\n } else if(questionCounter == 0){\n \n prev.hide();\n next.show();\n replay.hide();\n }\n } else {\n //display score\n var scoreElem = displayScore();\n var numWrong = 5 - scoreElem;\n var warning = '<p id=\\'wrong\\'\\>You have ' + numWrong + ' wrong ';\n if (numWrong == 1) {\n warning += 'question.';\n } else {\n warning += 'questions.';\n }\n\n warning += ' Please try again!</p>';\n quiz.append(warning);\n\n if (scoreElem == 5) {\n window.location.href = \"congratulation.html\";\n }\n\n prev.hide();\n next.hide();\n replay.show();\n\n }\n}", "function nextQuestion() {\r\n if (STORE.questionNumber < STORE.questions.length - 1) {\r\n STORE.submittedAnswer = false;\r\n STORE.view = 'question';\r\n STORE.questionNumber++;\r\n }\r\n else {\r\n STORE.view = 'score';\r\n finalScore();\r\n }\r\n}", "function nextQuestion() {\n currentQuestion = currentQuestion + 1;\n if (currentQuestion < questions.length) {\n question();\n } else {\n gameSummary();\n }\n}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\tuserTimeout();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t// console.log(questionCounter);\n\t// console.log(questions[questionCounter].correctAnswer);\n\t}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\tuserTimeout();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t// console.log(questionCounter);\n\t// console.log(questions[questionCounter].correctAnswer);\n\t}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\tuserTimeout();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t// console.log(questionCounter);\n\t// console.log(questions[questionCounter].correctAnswer);\n\t}", "function nextQuestion() {\n if (questionCounter < questions.length) {\n time = 15;\n $(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n questionContent();\n timer();\n userTimeout();\n }\n else {\n resultsScreen();\n }\n\n }", "function goToNextQuestion() {\n $(\"#answers\").empty();\n $(\".footer\").html(\"Pick your answer. Watch out for the time!!\");\n\n // we are done with this response, lets go to the next question and load it if we havent reached the end\n currentQuestionToPlay++;\n\n if (currentQuestionToPlay < questions.length) {\n //there are more questions remaining, reset the timer and load the next set of question\n resetTimer();\n loadQuestionsAndAnswersOnUI();\n } else {\n reachedEndOfGame();\n }\n acceptingResponsesFromUser = true;\n}", "function nextQuestion() {\n if (questionSelector == answerArrays.length - 1) {\n questionSelector = 0;\n setTimeout(showScoreCard, 1500);\n } else {\n questionSelector++;\n setTimeout(displayGame, 1500);\n }\n }", "function nextQ() {\n // this code alerts us when questions array has reached its end\n const questionsDone = quizQuestions.length - 1 === currentQuestions;\n\n // if questions reach the end, ALERT \n if (questionsDone) {\n alert(\"Game Over\");\n }\n else {\n // otherwise continue\n currentQuestions++;\n startQuestions();\n }\n}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\".gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\ttimesUp();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t}", "function nextQuestion() {\n // Increment the quiz question count by 1\n count++\n //Remove previous question from HTML before going onto the next question in the quiz.\n $(\"#question-div\").hide();\n //Remove choice buttons from previous question from HTML.\n $(\"#view-quiz-results-div\").empty();\n //Increment progress bar by 10 for each question.\n // $('#quiz-progress-bar')\n // .progress('increment', 10);\n //If the count is the same as the length of the questionSet.questionArray array, find match.\n if (count === questionSet.questionArray.length) {\n findMatch();\n }\n\n //else, if there are still questions left, go to next question.\n else {\n start();\n }\n}", "function iterateQuestionsAndAnswers() {\n\tif (questionIndex < questions.length - 1) {\n\t\tquestionIndex++;\n\t\tdisplayQuestions();\n\t} else if (questionIndex === questions.length - 1 && currentScoreValue > 12) {\n\t\twinner();\n\t}\n}", "function nextQuestion() {\n\t$(\"#correct-display\").hide();\n\t$(\"#wrong-display\").hide();\n\t$(\"#oOT-display\").hide();\n\t$(\"#question-container\").show();\n\t$(\"#choices\").show();\n\tcurrentQuestion++;\n\tif (currentQuestion == questions.length) {\n\t\tresults();\n\t} else {\n\t\ttime();\n\t\trun();\n\t\t$(\"#question-container\").html(questions[currentQuestion].question);\n\t\t$(\"#a\").html(questions[currentQuestion].choices[0]);\n\t\t$(\"#b\").html(questions[currentQuestion].choices[1]);\n\t\t$(\"#c\").html(questions[currentQuestion].choices[2]);\n\t\t$(\"#d\").html(questions[currentQuestion].choices[3]);\n\t}\n}", "function nextQuestion() {\n\t\tqCounter++;\n\t\t// clears previous selection\n\t\t$(\"input[name='choice']\").prop(\"checked\", false);\n\n\t\t// checks to see if qCounter is equal to 10\n if (qCounter == 10) {\n\t \tstopwatch.stop();\n\t $(\"#main\").hide();\n\t $(\"#end\").show();\n\t $(\"#final-score\").html(\"<h2>You got \" + correct + \" out of \" + questions.length + \" questions correct!\");\n }\n\n //calls displayQuestions\n stopwatch.stop();\n displayQuestions();\n }", "function nextQuestion() {\n quizContentIndex++;\n // note that the answerResult box needs to be hidden again as questions and answers are iterated\n hideElement(answerResult);\n renderQuestion();\n}", "function nextQuestion() {\n let totalQuestions = myQuestions.length;\n if (questionIndex < totalQuestions - 1) {\n questionIndex++\n displayQuestion()\n } else {\n viewHs.classList.remove(\"hide\")\n playerInitialsInputBox.classList.remove(\"hide\");\n questionContainer.classList.add(\"hide\");\n updateHighScore();\n stopTimer();\n showResetButton();\n }\n}", "function nextQuestion(){\n $(\"#alerts\").hide();\n       currentQuestion = triviaQuestions[currentQuestionIndex + 1];\n       currentQuestionIndex++;\n if (currentQuestionIndex >= 10) {\n $(\"#alerts\").html(\"<h2> Nice job! Click the Start 90s Trivia button to play again! <br> Questions Correct: \" + correctAnswers.length + \" <br> Questions Incorrect: \" + incorrectAnswers.length + \" </h2>\");\n $(\"#alerts\").show();\n stopTimer();\n } else {\n       displayQuestion(currentQuestion);\n };\n    }", "function nextQuestion(){\r\n if(i<questionBank.length-1)\r\n {\r\n i=i+1;\r\n displayQuestion();\r\n }\r\n else{\r\n points.innerHTML= score+ '/'+ questionBank.length;\r\n quizContainer.style.display= 'none';\r\n scoreboard.style.display= 'block'\r\n }\r\n}", "function setnextquestion(){\n\n resetcontainer();\n if ( questionindex < questions_answers.length)\n {\n renderquestion(questions_answers[questionindex]);\n }else\n {\n submitscore();\n }\n\n}", "function loadNextQuestion() {\n currentQuestionIndex++;\n document.querySelector(\".content-box\").innerHTML = \"\";\n if (currentQuestionIndex == questions.length) {\n loadResultPage();\n } else {\n loadQuestion(questions[currentQuestionIndex]);\n }\n}", "function nextQuestion()\n\t\t\t{\n\t\t\t\t$(\"#oneword\").hide();\n\t\t\t\t$(\"#multiple\").hide();\n\n\t\t\t\tif(count >= 10)\n\t\t\t\t{\n\t\t\t\t\tcount = 0;\n\t\t\t\t\tendQuiz();\t\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\n\t\t\t\t\tcount++;\n\n\t\t\t\t\t//get the question object for next question\n\t\t\t\t\tif(day%2 == 0)\n\t\t\t\t\t\tquestion = getQuestion(randomArr[count-1]);\n\t\t\t\t\telse\n\t\t\t\t\t\tquestion = getQuestion(randomArr[count-1]);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif(count > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t//update the progress bar\n\t\t\t\t\t\tprogressBar();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t//update the score\n\t\t\t\t\t\tupdateScore();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t//reset the form values\n\t\t\t\t\t\tdocument.getElementById(\"formName\").reset();\n\t\t\t\t\t}\n\n\t\t\t\t\t\n\t\t\t\t\t//if multiple choice question\n\t\t\t\t\tif(question.questionType == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t$(\"#multiple\").show();\n\n\t\t\t\t\t\tdocument.getElementById(\"question1\").innerHTML = question.question;\n\t\t\t\t\t\tdocument.getElementById(\"label1\").innerHTML = question.choices[0];\n\t\t\t\t\t\tdocument.getElementById(\"label2\").innerHTML = question.choices[1];\n\t\t\t\t\t\tdocument.getElementById(\"label3\").innerHTML = question.choices[2];\n\t\t\t\t\t\tdocument.getElementById(\"label4\").innerHTML = question.choices[3];\n\n\t\t\t\t\t\tdocument.getElementById(\"radio1\").setAttribute(\"value\",question.choices[0]);\n\t\t\t\t\t\tdocument.getElementById(\"radio2\").setAttribute(\"value\",question.choices[1]);\n\t\t\t\t\t\tdocument.getElementById(\"radio3\").setAttribute(\"value\",question.choices[2]);\n\t\t\t\t\t\tdocument.getElementById(\"radio4\").setAttribute(\"value\",question.choices[3]);\n\t\t\t\t\t}\n\t\t\t\t\t//if single line question\n\t\t\t\t\telse if(question.questionType == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\t$(\"#oneword\").show();\n\t\t\t\t\t\tdocument.getElementById(\"question2\").innerHTML = question.question;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "function checkLastQuestion() {\n if (currentQuestion === questionCards.length) {\n clearTimeout(intervalId);\n displayScore();\n } else {\n // run function to clear question, display next\n displayQuestion();\n }\n}", "function nextQuestion() {\n if (questionCounter < questions.length)\n { time = 10;\n $(\"#gameScreen\").html(\"<p> You have <span id ='timer'>\" + time + \n \"</span> seconds left! </p>\");\n questionContent();\n timer();\n userTimeout();\n \n }\n \n else {\n resultsScreen();\n }\n\t}", "function setNextQuestion() { \n clearState();\n if (questionShuffled.length < questionIndex +1 ){\n displayScore();\n }\n else {\n visibleQuestion(questionShuffled[questionIndex])\n }\n}", "function nextQuestion() {\n questionNumber++;\n\n // empty text area and remove message\n $(\"#correct\").fadeIn(500).addClass(\"d-none\");\n $(\"#input-answer\").val(\"\");\n $(\"#input-answer\").css(\"color\", \"#212429\");\n\n arrayPositionSelect++;\n if (questionNumber < 5 && numberOfLives >= 0) {\n showQuestion(); // Dont need to call generate question (all questions generated)\n } else if (questionNumber > 4 && numberOfLives >= 0) {\n roundComplete();\n // Start Round\n } else if (numberOfLives < 0) {\n gameOver();\n }\n}", "function nextQuestion(){\n console.log('Next Question fired..')\n if((triviaQuestions.length -1) === currentQuestion){\n triviaResult()\n } \n else {\n currentQuestion++;\n $(\"#currentQuestion\").empty();\n displayQuestion()\n }\n}", "function displayNext() {\n quiz.fadeOut(function() {\n $('#question').remove();\n \n if(questionCounter < gameQuestions.length){\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion).fadeIn();\n if (!(isNaN(selections[questionCounter]))) {\n $('input[value='+selections[questionCounter]+']').prop('checked', true);\n }\n \n // Controls display of next and restart\n if(questionCounter === 0){\n \n $('#start').hide();\n $('#next').show();\n $('#start-over').hide();\n $('#quiz-time-left').show();\n }\n }else {\n var scoreElem = displayScore();\n quiz.append(scoreElem).fadeIn();\n $('#next').hide();\n $('#start').hide();\n $('#start-over').show();\n $('#quiz-time-left').hide();\n $('#gameOver').hide();\n }\n });\n }", "function nextQuestion() {\n $question.html('')\n if (questionIndex < questionList.length) {\n let questionMsg = '<h3>' + questionList[questionIndex][\"question\"] + '</h3><ol>'\n for (let i = 0; i < questionList[questionIndex][\"answers\"].length; i++) {\n questionMsg += '<li><button id=\"answer' + (i + 1) + '\">' + (i + 1) + '. ' + questionList[questionIndex][\"answers\"][i] + '</button></li>'\n }\n questionMsg += '</ol>'\n $question.append(questionMsg)\n } else {\n endQuiz()\n }\n }", "function nextQuestion() {\n // Clear the timeout that was set by displayAnswer. Clear the interval as well just in case.\n clearTimeout(game.timeoutID);\n clearInterval(game.intervalId);\n // Go to the next question\n game.questionIndex++;\n // If we're on the last question, the game is over. \n if (game.questionIndex >= questions.length) {\n endGame();\n } else { // Otherwise display the next question\n displayQuestion();\n }\n}", "function setNextQuestion() {\n resetState()\n if (currentQuestionIndex < questions.length){\n showQuestion(questions[currentQuestionIndex])\n}\nelse {\n gameOver()\n}}", "function nextQuestion() {\n // checks to see if there is a next q and a in the quiz\n if (currentQuestion < quiz.length - 1) {\n // increment the question index\n currentQuestion++;\n loadQuestion();\n // displays the new question and answers\n }\n if (currentQuestion >= quiz.length) {\n clearTimeout(count);\n endQuiz();\n };\n }", "function nextQuestion() {\n $(\".userAnswer\").remove();\n $(\".answerCheck\").show();\n if (this.id === currentQuestion[2][0]) {\n scoreTracker = scoreTracker + 1;\n $(\".answerCheck\").text(\"correct!\");\n } else {\n $(\".answerCheck\").text(\"incorrect!\");\n timePassed = timePassed + 4;\n }\n\n if (questionPlusAnswer < quizquestions.length - 1) {\n startQuiz();\n } else {\n finalScorePage();\n stopTimer();\n }\n }", "function nextQuestion(){\n\t\t$(\"#question\").show();\n\t\t$(\".choice\").show();\n\t\t$(\"#solutionDiv\").hide();\n\t\tstopwatch.reset();\n\t\tquizGo(i++);\n\t}", "function renderQuestion() {\n // If there are still more questions, render the next one.\n if (questionIndex <= (questionsArray.length - 1)) {\n document.querySelector(\"#question\").innerHTML = questionsArray[questionIndex][0];\n }\n // If there aren't, render the end game screen.\n else {\n document.querySelector(\"#question\").innerHTML = \"Game Over!\";\n document.querySelector(\"#score\").innerHTML = \"Final Score: \" + score + \" out of \" + questionsArray.length;\n }\n }", "function nextQuestion(){\n if(runningQuestion < lastQuestion){\n runningQuestion++;\n showQuestion();\n } else{\n endQuiz();\n }\n}", "function nextQuestion() {\n\n if (currentQuestion < lastQuestion) {\n currentQuestion++;\n showQuestion();\n } else {\n endQuiz();\n }\n}", "function nextQuestion() {\n if (questionCounter < questions.length) {\n time = 15;\n $(\"#QuizArea\").html(\"<p>Timer: <span id='timer'>\" + time + \"</span> \");\n displayQuestion();\n timer();\n userTimeout();\n }\n else {\n gameOverDisplay();\n }\n // console.log(questionCounter);\n // console.log(questions[questionCounter].correctAnswer);\n }", "function nextQuestion() {\n timerInterval = 15;\n questionNum++;\n answerOrder = shuffle(answerOrder);\n checkEndGame();\n updateDisplays();\n $('#sectionResults').addClass('hidden');\n $('#sectionQuestions').removeClass('hidden');\n countDown;\n }", "function nextQuestion() {\n if (questionCount < 7) {\n questionCount++\n console.log(questionCount);\n buildQuiz();\n $(\".results\").empty();\n $(\".timer\").show();\n timeLeft = 20;\n countdown();\n } else {\n gameOver();\n }\n}", "function nextQuestion() {\n\n $('#startPage').hide();\n $(\"#resultsPage\").hide();\n $(\"#giphyPage\").hide();\n $('#questionPage').show();\n clearInterval(timerId);\n run();\n\n }", "function goToNextQuestion() {\n\n\n\n // Display question page.\n\n showSection(questionPage);\n\n\n\n // Empties out existing answers from previous question.\n\n $(\".answer-choices\").empty();\n\n\n\n // Displays question and possible answers.\n\n displayQuestion();\n\n\n\n // Resets question timer.\n\n resetTimer();\n\n\n\n}", "function displayNextQuestion(nextQuestion) {\n currentIndex++;\n if (currentIndex < questions.length) {\n checkCorrect(nextQuestion.target.innerText === nextQuestions.answer);\n questionAnswers.innerText = '';\n if (currentIndex < questions.length) {\n nextQuestions = questions[currentIndex];\n displayQuestion(nextQuestions);\n } else {\n currentIndex = 0\n displayQuestion(nextQuestions);\n }\n } else {\n endQuiz();\n // setTimeout(function () {\n // endQuiz();\n // }, 1000);\n }\n}", "function nextQuestion() {\n questionsIndex++\n console.log(\"click worked!\")\n\n if (questionsIndex === questions.length) {\n endQuiz()\n } else {\n generateQuestion()\n }\n\n}", "function showNextQ(){\n resetState()\n if(questionsShuflle.length < questionIndex + 1){\n stopTimer();\n showScore = score + timeRemaing;\n highscoreBtn.classList.add('hide');\n timerEl.classList.add('hide');\n questionEl.classList.add('hide');\n answersEl.classList.add('hide');\n rightOrWrongEl.classList.add('hide');\n doneHEl.classList.remove('hide');\n donePEl.classList.remove('hide');\n donePEl.innerText = ('Your final score is ' + showScore);\n enterIEl.classList.remove('hide');\n inputEl.classList.remove('hide');\n submitEl.classList.remove('hide');\n }else {\n rendorQuestion(questionsShuflle[questionIndex])\n }\n}", "function nextQuestion () {\n if (questionId < questionsArr.length) {\n questionId++;\n timer.reset ();\n $(\"#trivia-question\").text(questionsArr[questionId]);\n $(\"#answer1\").html(answersArr[questionId][0]);\n $(\"#answer2\").html(answersArr[questionId][1]);\n $(\"#answer3\").html(answersArr[questionId][2]);\n $(\"#answer4\").html(answersArr[questionId][3]);\n $(document).on(\"click\", \".btnanswer\", function() {\n var userAnswer = $(this).text().trim();\n if (userAnswer == rightAns[questionId]) {\n correctAns++;\n nextQuestion();\n }\n else {\n wrongAns++;\n nextQuestion();\n }});\n }\n else {\n timer.stop ();\n gameOver ();\n }\n }", "function showQuestions() {\n if (quizBank.length == questionCounter) {\n endQuiz();\n } else {\n questionDisplay.innerText = quizBank[questionCounter].question;\n showAnswers();\n }\n}", "function displayNext(){\n\t\t$('#current').remove();\n\t\tif(questionNumber < questions.length){\n\t\t\tvar nextQuestion = createQuestion(questionNumber);\n\t\t\t$('#question').append(nextQuestion);\n\t\t} else {\n\t\t\t$('.survey').hide();\n\t\t\t$('#submitButton').show();\n\t\t\tvar newDiv2 = $('<div>');\n\t\t\tvar final = $('<h2>Thank You For Taking This Survey. Please Press Submit Button To Meet Your Match</h2>');\n\t\t\tnewDiv2.append(final);\n\t\t\t$('.thankYou').append(newDiv2);\n\t\t}\n\t}", "function nextQuestion(){\n // Hide present card\n document.getElementById(\"card\"+chosen).style.display = \"none\";\n\n if (awnsered.lastIndexOf(false) < 1) {\n document.getElementById(\"card0\").innerHTML = \"Du hast alle Fragen richtig beantwortet! <br><br> <button onClick='window.location.reload();'>Refresh Page</button>\";\n chosen=0;\n showPage();\n return;\n }\n\n msg = '';\n do {\n chosen++;\n if (chosen>karten) {\n chosen = 1;\n msg = 'Neue Runde. Du hast bisher <b>' + percentage() + '%</b> richtig.';\n }\n } while (awnsered[chosen]);\n\n // display chosen card\n message(msg);\n \n document.getElementById(\"card\"+chosen).style.display = \"block\";\n if (isOdd(chosen)) {Menu(3);} else {Menu(2);}\n\n progressBar(percentage());\n presentQ();\n \n if (plugin_flashcard__top>0) window.scrollTo({ top: plugin_flashcard__top, behavior: 'smooth' });\n}", "function nextQuestion() {\n document.querySelectorAll(\".ansBtn\").forEach(ans => {\n ans.addEventListener(\"click\", function (e) {\n checkAnswer(e);\n\n questionIndex++;\n answerButtonEl.innerHTML = \"\";\n\n if (questionIndex < quizQuestions.length) {\n console.log(\"show\");\n showQuestion();\n } else {\n viewGameOverScreen();\n }\n })\n })\n}", "function handleNextQuestion() {\n checkForAnswer() //check if player picked right or wrong option\n unCheckRadioButtons()\n //delays next question displaying for a second just for some effects so questions don't rush in on player\n setTimeout(() => {\n if (indexNumber <= 4) {\n//displays next question as long as index number isn't greater than 9, remember index number starts from 0, so index 9 is question 10\n NextQuestion(indexNumber)\n }\n else {\n handleEndGame()//ends game if index number greater than 9 meaning we're already at the 10th question\n }\n resetOptionBackground()\n }, 1000);\n}", "function checkQuestions() {\n $('body').on('click','#next-question', (event) => {\n STORE.progress === STORE.questions.length?\n showAnswers() : generateQuestion();\n });\n}", "function nextQuestion() {\n\tif (questionNumber < 9) {\n\t\tquestionNumber++;\n\t\tgenerateText();\n\t\tcounter = 21;\n\t\tstopwatch();\n\t}\n\telse {\n\t\tfinalScreen();\n\t}\n}", "function nextQuestion() {\n $(\".textResults\").hide();\n $(\".textBoxAnswer\").show();\n $(\".textBox\").show();\n $(\"#countdownTimer\").show();\n $(\"#pickAnswer\").show();\n resetTimer();\n startTimer();\nif (questionsCount < questions.length - 1)\nquestionsCount++;\n $(\"#question\").html(questions[questionsCount].question);\n $(\"#A\").html(questions[questionsCount].choiceA);\n $(\"#B\").html(questions[questionsCount].choiceB);\n $(\"#C\").html(questions[questionsCount].choiceC);\n $(\"#D\").html(questions[questionsCount].choiceD);\n}", "function next() {\n globalQuestionNumber += 1;\n if (globalQuestionNumber > globalMaxQuestionNumber) {\n globalState = STATE_FINISHED;\n } else {\n globalState = STATE_PLAYING;\n }\n generateQuestion();\n renderState();\n\n}", "function nextQuestion() {\n if (currentQuestion <= 4) {\n reset();\n displayQuestions();\n displayChoices();\n console.log(currentQuestion);\n } else {\n gameOver();\n }\n}", "function displayNext() {\n quiz.fadeOut(function () {\n $('#question').remove();\n\n if (questionCounter < questions.length) {\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion).fadeIn();\n if (!(isNaN(selections[questionCounter]))) {\n $('input[value=' + selections[questionCounter] + ']').prop('checked', true);\n }\n\n $next.show();\n preventRadio();\n } else {\n var scoreElem = displayScore();\n quiz.append(scoreElem).fadeIn();\n $next.hide();\n $start.show();\n }\n });\n }", "function handleNextQuestion() {\r\n checkForAnswer() //check if player picked right or wrong option\r\n unCheckRadioButtons()\r\n //delays next question displaying for a second just for some effects so questions don't rush in on player\r\n setTimeout(() => {\r\n if (indexNumber <= 9) {\r\n//displays next question as long as index number isn't greater than 9, remember index number starts from 0, so index 9 is question 10\r\n NextQuestion(indexNumber)\r\n }\r\n else {\r\n handleEndGame()//ends game if index number greater than 9 meaning we're already at the 10th question\r\n }\r\n resetOptionBackground()\r\n }, 1000);\r\n}", "function nextQuestion () {\n console.log('number of clicks=' + clickCount)\n clickCount += 1\n if (clickCount === 10) {\n // alert('Game Over!')\n if (player1score > player2score) {\n alert('Game over! Player 1 wins!')\n } else if (player2score > player1score) {\n alert('Game over! Player 2 wins!')\n } else {\n alert('Game over! Draw!')\n }\n } else {\n console.log('number of clicks=' + clickCount)\n // update the question numbering base on the click.\n $('#number').text(questionsNumber[clickCount])\n // update to the next question base on the click.\n $('#quiz').text(questions[clickCount].question)\n $('.choice').eq(0).text(questions[clickCount].choices[0])\n $('.choice').eq(1).text(questions[clickCount].choices[1])\n $('.choice').eq(2).text(questions[clickCount].choices[2])\n $('.choice').eq(3).text(questions[clickCount].choices[3])\n $('.choice').eq(4).text(questions[clickCount].choices[4])\n }\n }", "function nextQuestion() {\n questionIndex++;\n if (questionIndex === questions.length) {\n time = 0;\n finishQuiz();\n }\n if (time <= 0) {\n finishQuiz();\n }\n buildQuiz();\n}", "function loadNextQuestion() {\r\n var selectOption = document.querySelector('input[type=radio] : checked');\r\n var answerFromPlayer = selectOption.value;\r\n \r\n if (!selectOption) {\r\n alert('Please select your answer or You will not get mark for this question');\r\n return ;\r\n }\r\n if (questions[currentQuestion].answer == answerFromPlayer) {\r\n correct++;\r\n }\r\n selectOption.checked = false;\r\n currentQuestion++;\r\n \r\n if (currentQuestion == questions.length - 1) {\r\n nextButton.textContent = \"You finished the quiz. Let see how many correct questions you got\";\r\n nextButton.style.width = \"400px\";\r\n }\r\n if (currentQuestion == questions.length) {\r\n contain.style.display = \"none\";\r\n document.getAnimations(\"result\").style.display = \" \";\r\n document.getAnimations(\"result\").style.display = \"You got \" + correct + \" answers.\";\r\n document.getElementById(\"score\").textContent = score;\r\n return;\r\n }\r\n if (correct <= 5) {\r\n document.getElementById(\"message\").textContent = messages[1];\r\n document.getElementById(\"gif-source\").textContent = video[3];\r\n }\r\n if (correct <= 7) {\r\n document.getElementById(\"message\").textContent = messages[3];\r\n document.getElementById(\"gif-source\").textContent = video[1];\r\n }\r\n if (correct == 10 ) {\r\n document.getElementById(\"message\").textContent = messages[2];\r\n document.getElementById(\"gif-source\").textContent = video[2];\r\n }\r\n loadQuestion(currentQuestion);\r\n\r\n}", "function checkNextQuestion() {\n // increment and check if there are more questions\n document.getElementById(\"progress\").value = number++;\n questionIndex++;\n if (questionIndex < questions.length) {\n console.log(\"next question\");\n printQuestion(questionIndex);\n } else {\n console.log(\"stop quiz\");\n stopQuiz();\n }\n}", "function nextQuestion(choice) {\n // handle question data into an object\n var list = {\n 'title' : subjects[index].title,\n 'statement' : subjects[index].statement,\n 'answer' : choice,\n 'priority' : 0\n };\n\n // stores question data in answer list\n answers[index] = list;\n\n // increases the progress bar and index\n progressBar.style.width = (100 / subjects.length * (index + 2)) + \"%\";\n index++;\n\n // if the user surpasses the last question\n if(index >= subjects.length) {\n\n // question page will disable and enables priority page\n questionPage.style.display = \"none\";\n priorityPage.style.display = \"block\";\n\n // will be called to generate all topics at the priority page and display their info (function is in generation.js)\n generateTopics();\n\n // temp console.log (WILL BE REMOVED IF DONE TESTING)\n console.log(answers);\n } else {\n\n // if the user didn't surpass the last question, call ShowQuestion\n showQuestion();\n }\n}", "function nextQuestion() {\n showQuestion();\n //*********************************** */\n // this logic is implemented because unable to check whether event listener for first round exists with button\n if (startButton.textContent !== \"Retake Quiz\") {\n addEventListenerToButtons(questionIndex);\n }\n //*********************************** */\n}", "function showQuestion() {\n if (questionCount === questionsObj.length) {\n stop();\n }\n else {\n $(\"#question\").html(questionsObj[questionCount].question);\n $(\"#answer1\").html(questionsObj[questionCount].choices[0]);\n $(\"#answer2\").html(questionsObj[questionCount].choices[1]);\n $(\"#answer3\").html(questionsObj[questionCount].choices[2]);\n $(\"#answer4\").html(questionsObj[questionCount].choices[3]);\n questionTime = 5;\n }\n }", "function nextQuestion() {\n questionProgress();\n renderQuiz();\n}", "function handleNextQuestion() {\r\n\t\r\n\t\r\n\t\r\n checkForAnswer()\r\n unCheckRadioButtons()\r\n //delays next question displaying for a second\r\n setTimeout(() => {\r\n if (indexNumber <= 9) {\r\n NextQuestion(indexNumber)\r\n }\r\n else {\r\n handleEndGame()\r\n }\r\n resetOptionBackground()\r\n\t\t\r\n }, 1000);\r\n\t\r\n\t\r\n}", "function checkIfLinedUp() {\n\n if (nameAnswer.value.toLowerCase() === 'nominal' && ageAnswer.value.toLowerCase() === \"continuous\" && shoesizeAnswer.value.toLowerCase() === \"discrete\") {\n finishPuzzleOne.classList.toggle('hide');\n window.scrollTo(0,document.body.scrollHeight); //if they are all correct show the next button\n }\n }", "function loadNextQuestion() {\n var selectedOption = document.querySelector('input[type=radio]:checked');\n if(!selectedOption){\n alert('Choose an answer!');\n return;\n }\n var answer = selectedOption.value;\n if(questions[currentQuestion].answer == answer){\n score += 20;\n secs += 5;\n }\n if(questions[currentQuestion].answer != answer){\n secs -= 25;\n }\n selectedOption.checked = false\n currentQuestion++;\n \n \n if(currentQuestion == totQuestions - 1){\n nextButton.textContent = 'finished';\n }\n if(currentQuestion == totQuestions){\n container.style.display = 'none';\n resultCont.style.display = '';\n resultCont.textContent = \"Your score:\" + score;\n return;\n }\n loadQuestion(currentQuestion);\n }", "function showQuestion() {\n if (trackQuestion == questions.length) {\n scorePage();\n } else {\n questionElement.textContent = questions[trackQuestion].question;\n btn1.textContent = questions[trackQuestion].answers[0];\n btn2.textContent = questions[trackQuestion].answers[1];\n btn3.textContent = questions[trackQuestion].answers[2];\n btn4.textContent = questions[trackQuestion].answers[3];\n trackQuestion++;\n console.log(trackQuestion);\n }\n}", "function goToNextQuestion(){\n\n\t// Display question page.\n\tshowSection(questionPage);\n\n\t// Empties out existing answers from previous question.\n\t$( \".answer-choices\" ).empty();\n\n\t// Displays question and possible answers.\n\tdisplayQuestion();\n\n\t// Resets question timer.\n\tresetTimer();\n\n}", "function nextQuestion() {\n resetState()\n showQuestion(getRandomQuestion[questionIndex])\n}", "function checkExerciseNextButton() {\n \n var nvFor = sessionStorage.foryouthadults;\n \n if(nvFor==1) {\n\tif($(\".adultexercisesinsidelist .showhideexercisecls:visible\").next(\".adultexercisesinsidelist .showhideexercisecls:hidden\").length <= 0) {\n\t $(\"#excersisenext\").hide();\n\t} else {\n\t $(\"#excersisenext\").show();\n\t}\n } else {\n\tif($(\".youthexercisesinsidelist .showhideexercisecls:visible\").next(\".youthexercisesinsidelist .showhideexercisecls:hidden\").length <= 0) {\n\t $(\"#excersisenext\").hide();\n\t} else {\n\t $(\"#excersisenext\").show();\n\t}\n }\n \n videopausefunc();\n return false;\n}", "function nextQuestion() {\n $(\"#questionResponse\").html(\" \");\n if(count > questions.length - 1){\n clearInterval(timeCounter);\n $(\"#endGame\").show();\n $(\"#gameHolder\").hide();\n \n if (right >= wrong){\n document.getElementById(\"resultImage\").src = \"assets/images/Davefeet.gif\";\n $(\"#resultText\").html(\"Great DMB fan!\");\n }\n else {\n document.getElementById(\"resultImage\").src = \"assets/images/Daveeye.gif\";\n $(\"#resultText\").html(\"Come on, be a better fan!\");\n }\n }\n else {\n timeAmount = 10;\n timer();\n $(\"#question\").html((questions[count])[\"question\"]);\n $(\"#answer1\").html((questions[count])[\"option1\"]);\n $(\"#answer2\").html((questions[count])[\"option2\"]);\n $(\"#answer3\").html((questions[count])[\"option3\"]);\n $(\"#answer4\").html((questions[count])[\"option4\"]);\n }\n}", "function revealAnswer() {\n\n if (count === 0) {\n $(\".questionOne\").hide();\n $(\".answerOneTime\").show();\n array.push(\"firstQuestionAnswered\");\n nextQuestion();\n }\n}", "function nextQuestion(){\n var n = Math.floor(Math.random() * q.length);\n q[n].display1();\n var ans = prompt('Please select the correct answer. (tap \\'exit\\' to exit)');\n \n if (ans !== 'exit'){\n q[n].checkAnswer(parseInt(ans),keepScore);\n nextQuestion();\n }\n }", "function showNextQuestion() {\n console.log(\"showNextQuestion ran\");\n console.log(\"showNextQuestion thinks questionNumber is \" + questionNumber);\n /*Adds new content*/\n var currentQuestion = questions[questionNumber];\n $(\"#question\").prepend(currentQuestion.question);\n $(\"#question\").prepend(currentQuestion.illus);\n $(\"#answer1\").text(currentQuestion.choices[0]);\n $(\"#answer2\").text(currentQuestion.choices[1]);\n $(\"#answer3\").text(currentQuestion.choices[2]);\n showQuestionNumber();\n }", "function nextQuestion() {\n //creates a jQuery object listening for the nextQuestion\n //click event that...\n $(\"#nextQuestion\").click(e => {\n //asks if the currentQuestion value of STORE is less than the length \n //property of the questions array within STORE. and if it is...\n if (STORE.currentQuestion < STORE.questions.length - 1) {\n //adds one to the currentQuestion value, iterating through the questions\n //contained in STORE,\n STORE.currentQuestion++;\n //if there are more questions left, sets the page to \"question\" in STORE.\n STORE.page = \"question\";\n } else {//if no more questions remain, it sets the page value of STORE to \"endScore\".\n STORE.page = \"endScore\";\n }\n //then renders the correct page.\n render();\n });\n}", "function displayNext() {\n quiz.fadeOut(function() {\n $('#question').remove();\n\n if (questionCounter < questions.length) {\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion).fadeIn();\n if (!(isNaN(selections[questionCounter]))) {\n $('input[value=' + selections[questionCounter] + ']').prop('checked', true);\n }\n\n // Controls display of 'prev' button\n if (questionCounter === 1) {\n $('#prev').show();\n } else if (questionCounter === 0) {\n\n $('#prev').hide();\n $('#next').show();\n }\n } else {\n window.location.href = \"results.html\";\n $('#next').hide();\n $('#prev').hide();\n $('#start').show();\n }\n });\n }", "function nextQuestion() {\n \n index += questions;\n index = index > quiz.questions.length ? quiz.questions.length : index;\n \n if (index === quiz.questions.length) {\n disableElement(\"#nextBtn\");\n enableElement(\"#prevBtn\");\n $(\".question\").append(\"<input type=\\\"button\\\" onclick=\\\"buildAnswerObj()\\\" id=\\\"submit\\\" data-theme=\\\"b\\\" value=\\\"Submit Quiz\\\">\");\n //TODO fix it\n loadPage(\"#question\");\n } else {\n enableElement(\"#prevBtn\");\n }\n presentQuestion(true);\n}", "function displayNext() {\n quiz.fadeOut(function() {\n $('#question').remove();\n \n if(questionCounter < questions.length){\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion).fadeIn();\n if (!(selections[questionCounter] === undefined)) {\n $('input[value='+selections[questionCounter]+']').prop('checked', true);\n }\n }else {\n var projeto = window.location.search.substring(1).split('&')[0].split('=')[1];\n var aluno = window.location.search.substring(1).split('&')[1].split('=')[1];\n $.ajax({\n data: 'result='+selections+'&projeto='+projeto+'&aluno='+aluno,\n url: 'php/servicos/_questionario.php?',\n method: 'POST', // or GET\n success: function(result){\n window.location.replace(\"questionario.php\");\n }\n });\n $('#next').hide();\n }\n });\n }", "function nextQ() {\n\tif (iQ <= allQ.length) {\n\t\t$('.beginQuestion').text(currentQ.question);\n\t};\n\n}", "function next() {\n var currentQuestions = questions[counter];\n counter++;\n\n var quizContent = \"<h2>\" + currentQuestions.question + \"</h2>\";\n\n for (var i = 0; i < currentQuestions.option.length; i++) {\n var buttonCode = '<button onclick=\"Answer\">[options]</button>';\n\n buttonCode = buttonCode.replace(\"[options]\", currentQuestions.option[i]);\n\n if (currentQuestions.option[i] == currentQuestions.answer) {\n buttonCode = buttonCode.replace(\"Answer\", \"correct()\");\n score += 10;\n\n next();\n } else {\n buttonCode = buttonCode.replace(\"Answer\", \"incorrect()\");\n timeLeft -= 10;\n\n next();\n }\n\n quizContent += buttonCode;\n }\n if (counter >= questions.length - 1) {\n endGame();\n\n return;\n }\n document.getElementById(\"quizContainer\").innerHTML = quizContent;\n}" ]
[ "0.78652984", "0.7744782", "0.7699313", "0.763074", "0.7627635", "0.7603933", "0.7597288", "0.7577071", "0.75422096", "0.75070554", "0.7504014", "0.7493591", "0.74880195", "0.74428755", "0.7427179", "0.7422695", "0.7421834", "0.74183136", "0.73895574", "0.7389002", "0.73840666", "0.7370619", "0.7370619", "0.7370619", "0.73552746", "0.7341814", "0.7333695", "0.73169786", "0.73131216", "0.7291125", "0.7283624", "0.72755736", "0.7258702", "0.72549856", "0.724911", "0.72390074", "0.7232235", "0.72216636", "0.721604", "0.72060084", "0.72058654", "0.7197417", "0.7197233", "0.7189639", "0.7186376", "0.71788865", "0.71738535", "0.7169128", "0.71685", "0.7157845", "0.71282995", "0.71268666", "0.7123721", "0.71111995", "0.70976114", "0.70751965", "0.70658016", "0.7063007", "0.7045744", "0.7045535", "0.7042663", "0.7034633", "0.70320547", "0.70271176", "0.700337", "0.69808006", "0.69764453", "0.6972606", "0.6963946", "0.6955055", "0.6946182", "0.69398344", "0.69389373", "0.6924686", "0.6916925", "0.6916797", "0.6913284", "0.6911909", "0.69089866", "0.68919915", "0.68897116", "0.6889476", "0.68829316", "0.68803567", "0.6878929", "0.6878402", "0.6875858", "0.68722665", "0.6871827", "0.687048", "0.68694943", "0.6865838", "0.6864642", "0.68488365", "0.68486416", "0.6846516", "0.6838563", "0.6837047", "0.682219", "0.6817324", "0.6817107" ]
0.0
-1
function to give each question 20 seconds, show countdown in html, and generate loss if player does not select an answer in time
function timerWrapper() { theClock = setInterval(twentySeconds, 1000); function twentySeconds() { if (counter === 0) { clearInterval(theClock); userLossTimeOut(); } if (counter > 0) { counter--; } $(".timer").html(counter); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion () {\n counter = 30;\n timer = setInterval(countDown, 1000);\n //Set both the question and choices as variables \n const question = triviaQuestions[currentQuestion].question;\n const choices = triviaQuestions[currentQuestion].choices;\n //Add the question and its answers into the html as well as remaining questions \n $(\".triviaText\").html(`\n <h4>${question}</h4>${displayChoices(choices)}\n <h4>${remainingQuestions()}</h4>`)\n $(\"#timer\").html(`<h4>Timer: ${counter}`)\n}", "function nextQuestion() {\n if (questionCounter < questions.length)\n { time = 10;\n $(\"#gameScreen\").html(\"<p> You have <span id ='timer'>\" + time + \n \"</span> seconds left! </p>\");\n questionContent();\n timer();\n userTimeout();\n \n }\n \n else {\n resultsScreen();\n }\n\t}", "function loadQuestion() {\n counter = 8;\n timer = setInterval(countDown, 1000);\n\n\n const question = quizQuestions[currentQuestion].questions;\n const choices = quizQuestions[currentQuestion].choices;\n \n $(\"#time\").html(\"Time Remaining: \" + counter);\n \n //Displaying the question and function that has the choices\n $(\"#game\").html(`\n \n <h4>${question}</h4> \n ${loadChoices(choices)}\n ${loadRemainingQuestion()}\n \n \n `);\n \n}", "function answer1timeout(){\n \tunanswered++;\n \t$('#playerscore').show();\n \t$('#result').show();\n \tdisplayscore();\n \tstop();\n \t$(\"#display\").html('<h3>Time Remaining: 0 seconds</h3>');\n \t$('#questions').html('<img src=\"assets/images/wolverine.gif\" alt=\"wolverine\">');\n \t$('#result').html('<h4> Time&#39;s Up: Make up your mind civilian.</h4>');\n $('#choices1,#choices2,#choices3,#choices4').hide();\n setTimeout(quest2, 1000 * 5);\n }", "function timeoutLoss() {\n incorrectOnes++;\n quizHTML = \"<p class='text-center'>Time Remaining: <span class='timer'>\" + counter + \"</span></p>\" + \"<p class='text-center'>Time's Up! The correct answer was: \" + correctAnswers[position] + \"</p>\" + \"<img class='result-img' src='assets/images/timeout.jpg'>\";\n $(\"#mainArea\").html(quizHTML);\n setTimeout(wait, 3000);\n }", "function loadQuestion() {\n counter = 30;\n timer = setInterval(countDown, 1000);\n\n const question = quizQuestions[currentQuestion].question;\n const choices = quizQuestions[currentQuestion].choices;\n\n $('#time').html('Time Remaining: ' + counter);\n $('#game').html(`\n <h4>${question}</h4>\n ${loadChoices(choices)}\n ${loadRemainingQuestion()}\n `);\n}", "function nextQuestion() {\n if (questionCounter < questions.length) {\n time = 15;\n $(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n questionContent();\n timer();\n userTimeout();\n }\n else {\n resultsScreen();\n }\n\n }", "function generateQuestion() {\n $(\"#gameArea\").show();\n $(\"#question\").html(questionArray[questionCounter]);\n var ansA = $(\"#answerA\").html(\"A ) \" +answerArray[answerCounter][0]); \n var ansB = $(\"#answerB\").html(\"B ) \" +answerArray[answerCounter][1]);\n var ansC = $(\"#answerC\").html(\"C ) \" +answerArray[answerCounter][2]);\n var ansD = $(\"#answerD\").html(\"D ) \" +answerArray[answerCounter][3]);\n $(\"#timer\").show();\n $(\"#timer\").text(timeLeft);\n console.log(questionCounter);\n questionCounter++;\n}", "function generateLoss(){\n \n $(\"#gameArea\").hide();\n $(\"#showAnswer\").show();\n $(\"#timer\").hide();\n answerTemp = $(\"<div> The Correct Answer Was: </div>\").attr(\"class\", \"temp\");\n showAnswer = $(\"<div> \"+realAnswerArray[rightAnswerCounter]+\"</div>\");\n $(\"#showAnswer\").append(answerTemp);\n $(\"#showAnswer\").append(showAnswer);\n wrongAnswers++;\n timeLeft = 30;\n console.log(\"wrong answers \"+wrongAnswers);\n setTimeout(wait, 3000);\n clearInterval(clock);\n\n}", "function loadQuestion(){\n counter=10;\n timer=setInterval(countDown,1000);\n const question = gameQuestions[currentQuestion].question;\n const choices = gameQuestions[currentQuestion].choices;\n $('#time').html('Timer: ' + counter);\n $('#dGame').html(`<h4>${question}</h4>\n ${loadChoices(choices)}\n ${loadRemainingQuestion()}\n `);\n}", "function incorrect() {\n timeLeft -=20;\n nextQuestion();\n}", "function timer() {\n $(\"#timer-text\").html(`Remaining Time: ${time}`);\n time--\n \n\n if (time < -1) {\n clearInterval(counter);\n $(\".all\").empty()\n $(\"#directions-text\").html(`<h1 class=\"col-md-12 popup\">You didn't flick your wand quick enough! The right answer was ${questions[questionIndex].c}!<h1>`)\n $(\"#directions-text\").append(`<img src=\"https://66.media.tumblr.com/706576ce188ff312d0097f369335204d/tumblr_nt8pedAJxu1s6frvto1_400.gif\">`);\n wrong++;\n questionIndex++;\n time = 20;\n setTimeout(renderQuestion,5000);\n }\n \n}", "function startQuestions() {\n // starts timer when this function runs\n counter =15;\n timer = setInterval(countDown, 1000);\n\n\n const question = quizQuestions[currentQuestions].question;\n\n const choices = quizQuestions[currentQuestions].choices;\n\n\n // this allows T/Q/C/A show up on page\n $('#time').html('Timer: ' + counter);\n $('#game').html(`\n <h4>${question}<h4>\n ${showChoices(choices)}\n `);\n\n}", "function nextQuestion() {\n $(\"#questionResponse\").html(\" \");\n if(count > questions.length - 1){\n clearInterval(timeCounter);\n $(\"#endGame\").show();\n $(\"#gameHolder\").hide();\n \n if (right >= wrong){\n document.getElementById(\"resultImage\").src = \"assets/images/Davefeet.gif\";\n $(\"#resultText\").html(\"Great DMB fan!\");\n }\n else {\n document.getElementById(\"resultImage\").src = \"assets/images/Daveeye.gif\";\n $(\"#resultText\").html(\"Come on, be a better fan!\");\n }\n }\n else {\n timeAmount = 10;\n timer();\n $(\"#question\").html((questions[count])[\"question\"]);\n $(\"#answer1\").html((questions[count])[\"option1\"]);\n $(\"#answer2\").html((questions[count])[\"option2\"]);\n $(\"#answer3\").html((questions[count])[\"option3\"]);\n $(\"#answer4\").html((questions[count])[\"option4\"]);\n }\n}", "function showCountdown(){\n if (timer === 0) {\n $(\"#gifs\").html(\"<img src='./assets/images/noAnswer.gif'/>\");\n noAnswerSound.play();\n $(\"#question\").html(\"<h3>If you didn't know, just ask Mallory! She'll talk too much about it.</h3>\")\n resetRound();\n questionAnswered = true;\n clearInterval(time);\n\n } \n else if (questionAnswered === true) {\n clearInterval(time);\n\n }\n else if (timer > 0) {\n timer--;\n $('#timer').html(timer);\n }\n\n \n}", "function userLossTimeOut() {\n unansweredTally++;\n gameHTML = correctAnswers[questionCounter] + \"\" + losingImages[questionCounter];\n $(\".mainDiv\").html(gameHTML);\n setTimeout(wait, 5000); \n}", "function loadQuestion() {\n counter = 30;\n timer = setInterval(countDown, 1000);\n\n const question = quizQuestions[currentQuestion].question; \n const answers = quizQuestions[currentQuestion].answers; \n\n $('#time').html(`\n <h5>:${counter}</h5><p>\n `) \n $('#game').html(`\n <h4>${question}</h4><br>\n ${loadAnswers(answers)}\n `);\n}", "function countdownTimer() {\n if (countdown > 0) \t{\n countdown = countdown-1;\n $(\"#time\").html(\"<p>Time remaining: \" + countdown + \" seconds.</p>\"); \n }\n else {loadQuestion() \n };\n }", "function timeRunsOut() {\n noAnswer++;\n console.log(noAnswer);\n $(\".timer\").hide();\n $(\".question\").empty();\n $(\".answers\").empty();\n $(\".results\").html(\"<p class='answer-message'>Too slow!</p>\" + \"<src=\" + trivia[questionCount].gif + \"</>\");\n setTimeout(nextQuestion, 1000 *4);\n }", "function wrongAnswerTimeOut() {\n\tunanswered++;\n\ttriviaOutput = \"<p>Time Remaining: <span class='timer'>\" + questionTimer + \"</span></p>\" + \"<p>Time's up! The correct answer is: \" + correctAnswers[questionNumber] + \"</p>\" + images[questionNumber];\n\t$(\"#question-answers\").html(triviaOutput);\n\tsetTimeout(nextQuestion, 3000); \n}", "function nextQuestions() {\n number++;\n count = 30;\n timeRemain = setInterval(timer, 1000);\n $(\"#timer\").html(\"Time remaining: \" + count + \" secs\");\n questions(number);\n $(\"#image\").hide();\n }", "function questionGenerator() {\n questionChecker();\n \n if (gameStart) {\n showText(); \n theTimer(20);\n $(\"#image\").html(\" \")\n $(\"#button\").hide()\n $(\"#theResult\").hide()\n $(\"#question\").html(triviaQuestions[theQuestion].question);\n $(\"#answerOne\").html(triviaQuestions[theQuestion].answers[0]);\n $(\"#answerTwo\").html(triviaQuestions[theQuestion].answers[1]);\n $(\"#answerThree\").html(triviaQuestions[theQuestion].answers[2]);\n $(\"#answerFour\").html(triviaQuestions[theQuestion].answers[3]);\n }\n }", "function question() {\n // Reset Time\n time = 15;\n\n clearInterval(interval);\n\n // Set display timer\n interval = setInterval(timer, 1000);\n\n // Builds each Question\n var questDiv = $(\"<div>\");\n var questText = $(\"<h3>\" + questions[questCount].questionText + \"</h3>\");\n var questOpt1 = $(\"<p>\" + questions[questCount].option1 + \"</p>\");\n var questOpt2 = $(\"<p>\" + questions[questCount].option2 + \"</p>\");\n var questOpt3 = $(\"<p>\" + questions[questCount].option3 + \"</p>\");\n var questOpt4 = $(\"<p>\" + questions[questCount].option4 + \"</p>\");\n var timeDisp = $(\"<h4>\" + \"Time Remaining: \" + time + \"</h4>\");\n\n $(questOpt1).addClass(\"answer\");\n $(questOpt2).addClass(\"answer\");\n $(questOpt3).addClass(\"answer\");\n $(questOpt4).addClass(\"answer\");\n $(questOpt1).attr(\"answer\", questions[questCount].option1);\n $(questOpt2).attr(\"answer\", questions[questCount].option2);\n $(questOpt3).attr(\"answer\", questions[questCount].option3);\n $(questOpt4).attr(\"answer\", questions[questCount].option4);\n $(timeDisp).attr(\"id\", \"timeDiv\");\n\n\n questDiv.append(questText);\n questDiv.append(questOpt1);\n questDiv.append(questOpt2);\n questDiv.append(questOpt3);\n questDiv.append(questOpt4);\n questDiv.append(timeDisp);\n\n $(\"#body\").html(questDiv);\n \n // Question Timer\n var questTimeout = setTimeout (function() {\n questCount++;\n if (questCount >= questions.length) {\n clearTimeout(questTimeout);\n gameOver ()\n }\n question ();\n }, 15000);\n\n // Answer Listener\n $(\".answer\").on(\"click\", function(){\n console.log(this);\n // Clear timers\n clearTimeout(questTimeout);\n clearInterval(interval);\n \n var answerChosen = $(this).attr(\"answer\");\n var answerCorrect = questions[questCount].correct;\n \n console.log(answerChosen);\n console.log(answerCorrect);\n questCount++\n \n if (questCount >= questions.length) {\n gameOver (answerChosen, answerCorrect)\n } else if (answerChosen === answerCorrect) {\n correct++\n console.log(correct);\n console.log(wrong)\n question()\n }\n else {\n wrong++\n console.log(correct);\n console.log(wrong)\n question()\n }\n });\n}", "function timer() {\n count--;\n if (count <= 0) {\n var answer = quiz[number].correct;\n var answerString = quiz[number].choices[answer];\n clearInterval(timeRemain);\n $(\"#choices\").addClass(\"textStyle\");\n $(\"#timer\").html(\"Time remaining: \" + count + \" secs\");\n $(\"#question\").text(\"Time up!\");\n $(\"#choices\").text(\"The correct answer was: \" + answerString);\n unAnswers++;\n $(\"#image\").html(\"<img src = 'assets/images/\" + quiz[number].imgName +\"' />\");\n $(\"#image\").show();\n setTimeout(function() {\n nextQuestions();\n }, 1500) \n } else {\n $(\"#timer\").html(\"Time remaining: \" + count + \" secs\");\n }\n }", "function generateLossDueToTimeOut() {\n\tunansweredTally++;\n\tgameHTML = \"<p class='text-center timer-p'>Time Remaining: <span class='timer'>\" + counter + \"</span></p>\" + \"<p class='text-center'>You ran out of time! The correct answer was: \" + correctAnswers[questionCounter] + \"</p>\" + \"<img class='center-block src='assets/images/timeup.gif'>\";\n\t\n// uses inner html \n\t$(\".mainArea\").html(gameHTML); \n\tsetTimeout(wait, 4000); // change to 4000 or other amount\n}", "function timer() {\n clock--;\n $(\"#timer\").empty();\n var timeDiv = $(\"<h3>\");\n timeDiv.append(\"Time left: \" + clock + \" sec\");\n $(\"#timer\").append(timeDiv);\n\n if (clock < 1) {\n $(\"#question\").children().hide();\n $(\"#choices\").children().hide();\n $(\"#timer\").children().hide();\n $(\"#result\").children().hide();\n $(\"#answer\").empty()\n var gifsrc = trivia[questNum].image;\n var answerText = trivia[questNum].text;\n\n unanswered++;\n questNum++;\n setTimeout(displayQuest, 10000);\n clearInterval(time);\n\n var answerResult = $(\"<h1>\");\n answerResult.append(resultText.timesUp);\n $(\"#answer\").append(answerResult);\n\n\n var showText = $(\"<p>\");\n showText.append(answerText);\n showText.css(\"text-align\", \"justify\")\n $(\"#gifpic\").append(showText);\n\n var gifPic = $(\"<img>\");\n gifPic.attr(\"src\", gifsrc);\n $(\"#gifpic\").append(gifPic);\n\n if (questNum === trivia.length) { // Run this for the final question\n setTimeout(finalQuest, 10000);\n }\n }\n }", "function unansweredNoti() {\n clearDivs();\n $('#timer').html(\"<p>Pick</p>\");\n unanswered++; // number of unaswered goes up\n showAnswers();\n stopCounting();\n setTimeout(playGame, 5000);\n }", "function userTimeout() {\n if (time === 0) {\n $(\"#QuizArea\").html(\"<p>Times Up!</p>\");\n incorrectGuesses++;\n var correctAnswer = questions[questionCounter].correctAnswer;\n $(\"#QuizArea\").append(\"<p>Correct Answer: <span class='answer'>\" + correctAnswer + \"</span></p>\" + questions[questionCounter].image);\n setTimeout(nextQuestion, 3000);\n questionCounter++;\n }\n}", "function myTimer(){\n seconds = 15; //time alotted for each question\n $('#timer').html('<h3>You have ' + seconds + ' seconds left </h3>');\n isAnswered = true;\n clock = setInterval(howManySecs, 1000);\n}", "function noTime() {\n\n clearInterval(timer); //stoping time at 0\n\n lost++; // incrementing losses due to no time left\n loadI('lost');\n setTimeout(nextQ, 3 * 1000);\n // calling function to reset to next question\n}", "function timeQuestion() {\n //If is different is because the user have not responded all questions\n if (countQuestion != questionList.length) {\n countTime--;\n $(\"#time\").text(countTime);\n\n //If countTime is zero is because the time finished\n if (countTime == 1) {\n countLoose++;\n visibleAnswer(false, true);\n }\n }\n //The responded all question, and we have to stop timer\n else {\n clearInterval(time);\n }\n }", "function timeoutLoss() {\n\ttotalUnanswered++;\n\t$(\"#display\").html(\"<h3>Time's up! The correct answer is: <h3 class='green'>\" + questionList[questionNumber].correctAnswer + \"</h3></h3>\");\n\tsetTimeout(nextQuestion, 3000); \n\n\t//test\n\tconsole.log(\"Unanswered: \" + totalUnanswered);\n}", "function questionTimedout() {\n acceptingResponsesFromUser = false;\n\n console.log(\"timeout\");\n $(\"#timer-view\").html(\"- -\");\n $(\".footer\").html(\"Darn! Time out! <br> The correct answer is <strong>\" + questions[currentQuestionToPlay].correctResponse + \"</strong>. <br>Waiting 5 seconds to go next!\");\n\n timeoutCount++;\n $(\"#timeout-view\").html(timeoutCount);\n waitBeforeGoingNextAutomatically();\n}", "function theDelay() {\n theQuestion++;\n questionChecker();\n setTimeout(questionGenerator, 3000);\n }", "function nextAnswer() {\n\n //Clear popup timer\n clearTimeout(setTimeOutAnswer);\n setTimeOutAnswer = null;\n\n //Hidde popup\n $(\"#popup\").css(\"visibility\", \"hidden\");\n\n //Set count in 13 again\n countTime = 13;\n $(\"#time\").text = countTime; \n\n //Increment in 1 to show the next question\n countQuestion++;\n\n //Draw question\n drawQuestion();\n\n //Clear and set question timer\n clearTimeout(time);\n time = setInterval(timeQuestion, intervalTime);\n }", "function wrongAnswer(){\n $(\".textBoxAnswer\").hide();\n $(\"#countdownTimer\").hide();\n $(\"#pickAnswer\").hide();\n stopTimer();\n resetTimer();\n $(\".textResults\").show();\n audioWrong.play();\n $(\"#rightWrong\").html(\"<p>\" + \"WRONG!\".fontcolor(\"red\") + \"</p>\");\n $(\"#factoid\").html(questions[questionsCount].factoid);\n setTimeout(nextQuestion, 10000);\n setTimeout(backgroundChange, 10000);\n}", "function answer1right(){\n \t$('#playerscore').show();\n \t$('#result').show();\n \tdisplayscore();\n \tstop();\n \tclearInterval(answer1);\n \t$(\"#display\").html('<h3>Time Remaining: ' + time + ' seconds</h3>');\n \t$('#questions').html('<img src=\"assets/images/wolverine.gif\" alt=\"wolverine\">');\n \t$('#result').html('<h4>Correct: He&#39;s alright. He needs to layoff those musicals.</h4>');\n $('#choices1,#choices2,#choices3,#choices4').hide();\n setTimeout(quest2, 1000 * 5);\n }", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\".gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\ttimesUp();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t}", "function countdown(){\n seconds = 20;\n $(\"#timeLeft\").html(\"00:\" + seconds);\n answered = true;\n //Sets a delay of one second before the timer starts\n time = setInterval(showCountdown, 1000);\n }", "function clock() {\n countDown--;\n $(\"#clock\").text(\"Time remaining \" + countDown + \" seconds!\");\n if (countDown === 0) {\n $(\".answer\").hide();\n clearInterval(intervalId);\n var correctAnsText = questions[questionCounter][6];\n $(\"#question\").text(\"Times up! The correct answer is \" + correctAnsText + \"!\");\n $(\"#image\").attr(\"src\", questions[questionCounter][7]);\n $(\"#image\").show();\n countDown = 10;\n unanswered++;\n //console.log(\"unanswered \" + unanswered);\n questionCounter++;\n nextQuestion();\n }\n}", "function timeOutFunc () {\n $(\"#answerResult\").html(\"Time's up. The correct answer is: \" + listedQuestion.correctAnswer);\n questionIteration++;\n temp = questionTimeAmt;\n nextQuestion();\n}", "function questionTally(){\n\n if (questionCounter === questions.length){\n $(\"#messageArea\").html(\"Game Over!\")\n $(\"#questionArea\").html(\"You got \" + numCorrect + \" right!\");\n $(\"#answerArea\").html(\"You got \" + numWrong + \" Wrong!\")\n }\n else{\n $(\"#messageArea\").empty();\n setTimeout(addQuestion, 2000);\n }\n\n}", "function countdown() {\n if (points <= 0) {\n stopCountdown();\n points = 20;\n showResult();\n nextQuestion();\n } else {\n points--;\n $(\"#points\").text(points);\n }\n }", "function countDown () {\n seconds--;\n $(\".time-remaining\").text(\"Time Remaining: \" + seconds + \" seconds\");\n if (seconds < 1) {\n clearInterval(time);\n answered = false;\n //Run function to transition to next question page\n nextQuestion ();\n }\n}", "function newTimer() {\n time = 30;\n tDiv.html(\"<h5>\" + time + \"</h5>\");\n qTimer = setInterval(timerFunction, 1000);\n function timerFunction() {\n time--;\n tDiv.html(\"<h5>\" + time + \"</h5>\");\n if (time <= 0 && questionsPosition === 9) {\n clearInterval(qTimer);\n wrongAnswers++;\n questionsRemaining--;\n aDiv.html('You ran out of time! That counts as a wrong answer ¯\\\\_(ツ)_/¯' + \"<div class='d-flex justify-content-center>The correct answer was: \" + questionsArray[questionsPosition].cA + \"</div>\" + \"<div class='d-flex justify-content-center'>Questions Remaining: \" + questionsRemaining + \"</div>\")\n setTimeout(showResult, 4000);\n }\n else if (time <= 0) {\n clearInterval(qTimer);\n wrongAnswers++;\n questionsRemaining--;\n aDiv.html('You ran out of time! That counts as a wrong answer ¯\\\\_(ツ)_/¯' + \"<div class='d-flex justify-content-center'>The correct answer was: \" + questionsArray[questionsPosition].cA + \"</div>\" + \"<div class='d-flex justify-content-center'>Questions Remaining: \" + questionsRemaining + \"</div>\")\n questionsPosition++;\n setTimeout(function () {\n showQuestion(questionsPosition)\n }, 4000\n )\n }\n }\n}", "function userTimeout() {\n if (time === 0) {\n $(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n incorrectGuesses++;\n var correctAnswer = questions[questionCounter].correctAnswer;\n $(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" + correctAnswer + \"</span></p>\" + \n questions[questionCounter].image);\n setTimeout(nextQuestion, 4000);\n questionCounter++;\n } \n }", "function timeUp() {\n // clear the timing interval on the timer function.\n clearInterval(timer);\n // count the non answer as a wrong answer\n loss++;\n /* run preloadImage function with \"lost\" as argument (still trying to fully understand why calling it\n with the argument lost makes it work, i found this solution online)*/\n preloadImage(\"lost\");\n // set a timeout interval of 3 seconds before the nextquestion is generated\n setTimeout(nextQuestion, 3 * 1000);\n }", "function showCountdown(){\n console.log(\"in showcountdown\");\n seconds--;\n $('#timeLeft').html('<h3>Time Remaining: ' + seconds + '</h3>');\n if(seconds < 1){\n clearInterval(time);\n answered = false; \n PopulateAllAnswers(); \n }\n }", "function generateWin() {\n correctOnes++; //increament win by 1\n quizHTML = \"<p class='text-center'>Time Remaining: <span class='timer'>\" + counter + \"</span></p>\" + \"<p class='text-center'>Correct! The answer is: \" + correctAnswers[position] + \"</p>\" + \"<img class='result-img' src='assets/images/correctanswer.jpg'>\";\n $(\"#mainArea\").html(quizHTML); //set timer to zero, show what is the correct answer, and show pic for getting correct answer\n setTimeout(wait, 3000); //wait 3 seconds for user to go over the answer\n }", "function theTimer(seconds) {\n let timer = $(\"#seconds\");\n timer.html(seconds);\n // every second\n \n interval = setInterval(function() {\n // grab that number\n let currentNumber = Number(timer.html());\n // decrease it by 1\n currentNumber--;\n // display the new number on the screen\n timer.html(currentNumber);\n \n // if timer = 0\n \n if (\n $(\".answer\").on(\"click\", function() {\n clearInterval(interval);\n })\n )\n if (currentNumber === 0) {\n // stop timer\n unansweredQuestions++;\n \n \n theQuestion++;\n clearInterval(interval);\n setTimeout(questionGenerator, 3000);\n hideText();\n $(\"#question\").show().html(\"C'mon - that was an easy one!\");\n $(\"#image\").show().html(\"<img src='assets/images/seriously.gif' />\")\n $(\"#theResult\").show().html(`The Correct Answer was ${triviaQuestions[theQuestion].answers[answerNumber]}`)\n }\n }, 1000);\n }", "function outOfTimeExperience () {\n $(\".result-display\").append(\"<div class='col'>\" + \"<p id='correct'> Sorry, time's up!\" + \"</p>\" + \"</div>\");\n $(\".result-image\").append(\"<div class='col'>\" + correctChoiceImage[questionCount] + \"</div>\");\n $(\".result-text\").append(\"<div class='col'>\" + \"<p id='correct'>\" + correctChoice[questionCount] + \" is the correct answer\" + \"</p>\" + \"</div>\");\n setTimeout(actionsBasedOnCount,1000*6);\n}", "function incorrectChoice() {\n currentQuest++;\n feedback.innerHTML = \"Wrong...That cost you 10 seconds\";\n setTimeout(function() {\n feedback.innerHTML = \"\";\n }, 1750);\n timeLeft -= 10; \n if (currentQuest < contentArray.length){\n loadQuestion(currentQuest);\n } else (\n endDetect = true\n )\n}", "function userTimeout() {\n if(time=== 0){\n $(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n incorrectGuesses++;\n var correctAnswer=questions[questionCounter].correctAnswer;\n $(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" +\n correctAnswer = questions[questionCounter].correctAnswer;\n\n $(\"#gameScreen\").append (\"<p>The answer was <span class='answer'>\"+\n correctAnswer +\n \"</span></p>\" +\n questions[questionCounter].image);\n setTimeout(nextQuestion, 4000);\n questionCounter++;\n }\n }", "function showTimer() {\n seconds --;\n if \n (seconds < 1) {\n idle = true;\n clearInterval(timer);\n showAnswer();\n }\n }", "function winPage() {\n\n //increment correctCounter\n correctCounter++;\n\n //Clear countDownInterval\n clearInterval(countDownInterval);\n\n //Hide the questions and answers on the document\n $(\"#questionPage\").hide();\n\n //display winning message\n $(\"#message\").text(\"Correct!!!\");\n \n //display an image or gif\n $(\"#message\").append(\"<br>\" + \"<br>\");\n $(\"#message\").append($(\"<img>\").attr(\"src\", \"assets/images/correctGif.gif\"));\n \n //increment questionIndex\n questionIndex++;\n \n //use setTimeout to call questionPage after 5 sec\n setTimeout(questionPage, 3000);\n}", "function lose() {\n clearInterval(time);\n $(\"#quiz\").text(\"Oh No! The correct answer is: \" + questions[count].correctAns);\n showImage();\n count++;\n losses++;\n if (count < questions.length) {\n setTimeout(question, 3000);\n } else {\n setTimeout(resume, 3000);\n }\n}", "function nextQuestion() {\n if (counter == allQuestions.length - 1) {\n resultScreen();\n } else {\n questionTimer = 10;\n $(\"span\").text(questionTimer + \" Seconds\");\n timerForDisplay = setInterval(timeDown, 1000);\n counter += 1;\n $(\"p\").remove();\n $(\"img\").remove();\n createQuestion();\n }\n}", "function decrement() {\n\n $(\".timeRemaining\").html(\"<p>Time Remaining: \" + timer + \"</p>\");\n timer--;\n\n if (timer === 0) {\n unanswered++;\n stop();\n $(\".answer\").html(\"<p>Times Up! The correct answer was: \" + select.answerOptions[select.correctAnswer] + \"</p>\");\n selectedQuestion();\n timer = 15;\n countDown();\n }\n\n\n}", "function questionCycle(){\n // check if user quessed wrong\n if (this.value !== questions[currentQuestionIndex].answer){\n // penalize time\n time -=15;\n\n if (time < 0) {\n time = 0;\n }\n timerEl.textContent = time;\n\n // this tells user they are wrong\n feedbackEl.textContent = \"Incorrect!\";\n } else {\n feedbackEl.textContent= \"Correct!\";\n }\n // This will display right/wrong feedback for half a second\n feedbackEl.setAttribute(\"class\", \"feedback\");\n setTimeout(function(){\n feedbackEl.setAttribute(\"class\", \"feedback hide\");\n }, 1000);\n\n currentQuestionIndex++;\n\n // this will check to see if we ran out of questions\n if(currentQuestionIndex === questions.length){\n // run end quiz function\n quizEnd()\n } else {\n // gets next question\n getQuestion()\n }\n}", "function countdown(){\n action = setInterval(function(){\n timeremain -= 1;\n document.getElementById(\"timer\").innerHTML = timeremain;\n \n //for stop countdown:\n if(timeremain == 0){\n clearInterval(action);\n \n //fow showing gameover div:\n document.getElementById(\"gameover\").style.display = \"block\";\n \n //for showing gameover msg:\n document.getElementById(\"gameover\").innerHTML = \"<p>Time Over!</p><p>Your score is \" + score +\".</p>\";\n \n //for when game is over the timer will be hidden:\n document.getElementById(\"time\").style.display = \"none\";\n \n //for hide the question div HTML:\n document.getElementById(\"question\").innerHTML = null;\n \n //for hide the options HTML:\n var opts = document.getElementsByClassName(\"opt\");\n for(var i = 0; i < opts.length; i++){\n opts[i].innerHTML = null;\n }\n \n //for hide the correct and try again box when the game is over:\n document.getElementById(\"correct\").style.display = \"none\";\n document.getElementById(\"wrong\").style.display = \"none\";\n playing = false;\n document.getElementById(\"start\").innerHTML = \"Start Game\";\n }\n }, 1000);\n}", "function timer() {\n \tif (t !== 0) {\n\t\tt -= 1;\n\t};\n\tif (t == 0) {\n\tclearInterval(timer);\n\t// stops quiz\n\n\t// move to next question\n\t};\n\t$(\"#quizBox\").append(\"<div class='row'><h2 class='question_format'>Seconds Remaining : \" + t + \"</h2></div>\")\n\n}", "function askQuestions() {\n questionCounter++;\n \n\n $ (\".list\").show();\n $ (\".question\").show();\n $ (\".timeRemaining\").show(); \n\n if (questionCounter <= 10){\n \n $ (\".winOrLose\").empty();\n \n timer(30);\n\n $(\".question\").html(questions[questionCounter].question);\n $(\"#answerA\").html(questions[questionCounter].answerA);\n $(\"#answerB\").html(questions[questionCounter].answerB);\n $(\"#answerC\").html(questions[questionCounter].answerC);\n $(\"#answerD\").html(questions[questionCounter].answerD);\n\n }\n\n else {\n \n //runs end of the game screen\n endGame();\n } \n}", "function countdown() {\n\tcount = 20;\n\tcounter = setInterval(timer, 1000);\n\tfunction timer() {\n\t\tcount--;\n\t\tif (count === 0) {\n\t\t\t// Counter ended, stop timer and move on to the next question\n\t\t\tclearInterval(counter);\n\t\t\tgetNewQuestion();\n\t\t\treturn;\n\t\t}\n\t\t// Dispay the number of seconds\t\n\t\t$(\"#timer\").text(count);\n\t}\n}", "function timesUp() {\n\n $ (\".list\").hide();\n $ (\".question\").hide();\n $(\".winOrLose\").html(\"Time is up!\");\n \n window.setTimeout(askQuestions, 3000);\n}", "function countDown() {\n counter--;\n $(\"#timer\").html(\"Timer :\" + counter)\n//Once timer reaches 0 it will stop and move onto the next question\n if (counter === 0){\n clearInterval(timer)\n displayGIF();\n setTimeout(nextQuestion(), 3 * 1000);\n }\n}", "function countdown(){\r\n var questionTimer = 10;\r\n\r\n clearInterval(seconds);\r\n seconds = setInterval(decrement, 1000);\r\n // Display the timer\r\n $(\"#header\").html(\"<h1>Faking Confidence Trivia Challenge</h1><h2>Time Left: \" + questionTimer + \"</h2>\");\r\n // Starts decrementing the timer\r\n function decrement(){\r\n questionTimer--;\r\n\r\n // Displays the time left to answer\r\n $(\"#header\").html(\"<h1>Faking Confidence Trivia Challenge</h1><h2>Time Left: \" + questionTimer + \"</h2>\");\r\n\r\n // function timeUp() {\r\n // What happens when time expires\r\n if(questionTimer === 0) {\r\n alert(\"Time is up!\");\r\n $(\"#text\").html(\"<h3>Oh no! You are out of time.</h3>\")\r\n $(\"#text\").append(\"<h3>The correct answer : \" + questions[questionCounter].correctAnswer + \"</h3>\");\r\n $(\"#text\").append(\"<img src='assets/images/surprised.jpg'>\");\r\n $(\"#answers\").hide();\r\n stopTimer();\r\n layover();\r\n setTimeout(displayQuestion, 1000*5); \r\n\r\n // Increase the question counter\r\n questionCounter++;\r\n // };\r\n };\r\n };\r\n}", "function showingTimer() {\n qTime--;\n $(\"#time\").text(\"Time: \" + qTime);\n if (qTime == 0) {\n $(\"#result\").text(\"Time is out! Correct answer is: \" + quizQ[counterQ].correctAnsw);\n skipped += 1;\n clearInterval(timeOut);\n $(\"div button[class='choices']\").attr(\"disabled\", true);\n }\n}", "function questionPage() {\n\n \n //clear message\n $(\"#message\").empty();\n \n if (questionIndex === questionArray.length) {\n finalPage();\n return;\n }\n\n //Show the div tag\n $(\"#questionPage\").show();\n\n //reset timer\n timeRemaining = 30;\n\n //display timeRemaining on html\n $(\"#timeRemaining\").text(timeRemaining + \" seconds\");\n\n //use setInterval to call countDown() every 1 second\n countDownInterval = setInterval(countDown, 1000);\n \n //call displayQuestion()\n displayQuestion();\n \n //call displayAnswers()\n displayAnswers();\n \n}", "function timeUp() {\n if (questNum === gameArray.length) {\n $(\".timer\").empty();\n $(\".questions\").text(\"That all, here's how you did: \")\n $(\".choices\").html(\"<p>Correct Answers: \" + correctAnswer + \"</p><p> Wrong Answers: \" + wrongAnswer + \"</p><p> Unanswered Questions: \" + unanswered + \"</p>\");\n\n $(\".choices\").append(\"<br><div class='reset'>Restart the game</div>\");\n $(\".reset\").on(\"click\", function(){\n $(\".questions\").empty();\n $(\".choices\").empty();\n startNum = 20;\n questNum = 0;\n correctAnswer = 0;\n unanswered = 0;\n wrongAnswer = 0;\n $(\".timer\").text(\"Time remaining: \" + startNum);\n intervalID = setInterval(countDown, 1000);\n countDown();\n $(\".questions\").text(gameArray[questNum].q);\n for (i = 0; i < 4; i++) {\n $(\".choices\").append(\"<br> <div class='numBtn'>\" + gameArray[questNum].c[i] + \" </div><br>\");\n $(\".timer\").empty();\n startNum = 20;\n console.log(startNum);\n $(\".timer\").text(\"Time remaining: \" + startNum);\n }\n });\n if (correctAnswer >= 7) {\n $(\".choices\").prepend(\"<br><p>You diddly doodly did it!</p><br><img src='https://media3.giphy.com/media/l2JejtUtX0ImRvLnq/200.webp?cid=3640f6095bf0f07a4167586549f343d8'>\");\n var audio = new Audio('assets/images/winner-winner.mp3');\n audio.play();\n }\n else if (correctAnswer <= 3) {\n $(\".choices\").prepend(\"<br><p>I was saying boo-urns</p><br><img src='https://media2.giphy.com/media/jUwpNzg9IcyrK/200.webp?cid=3640f6095bf0f0cf66416f385539f10c'>\");\n var audio = new Audio('assets/images/lose-audio.wav');\n audio.play();\n }\n else {\n $(\".choices\").prepend(\"<p>Not bad! Join your family for some review!</p><br><img src='https://media1.giphy.com/media/oWjyixDbWuAk8/200.webp?cid=3640f6095bf0f15c616d62475153b23f'>\");\n var audio = new Audio('assets/images/middle-gif.mp3');\n audio.play();\n }\n \n }\n\n //timer back to ten\n else {\n startNum = 20;\n\n //empty the choices div\n $(\".choices\").empty();\n console.log(startNum);\n\n \n //set the timer again\n intervalID = setInterval(countDown, 1000);\n\n //call the countdown function\n countDown();\n\n //set the next question to html\n $(\".questions\").text(gameArray[questNum].q);\n\n //set the next answers to html\n for (i = 0; i < 4; i++) {\n $(\".choices\").append(\"<br> <div class='numBtn'>\" + gameArray[questNum].c[i] + \" </div> <br>\");\n };\n $(\".timer\").empty();\n startNum = 20;\n console.log(startNum);\n $(\".timer\").text(\"Time remaining: \" + startNum);\n \n }\n \n }", "function questionChecker() {\n if (theQuestion == triviaQuestions.length) {\n \n $(\"#question\").text(`Your Results!`);\n $(\"#image\").hide() \n hideText();\n \n clearInterval(interval);\n \n gameStart = false;\n theQuestion = 0; \n \n \n $(\"#intro\").show().text(`You can play again by clicking the button below`)\n $(\"#button\").show().text(`Play again? Click here!`)\n $(\".stats\").show()\n $(\"#correct\").show().text(`${correctAnswers}`)\n $(\"#incorrect\").show().text(`${incorrectAnswers}`)\n $(\"#unanswered\").show().text(`${unansweredQuestions}`)\n }\n }", "function loadingScreen() {\n $('.answers > div').html(\"\");\n if (answered[count - 1] == answers[count - 1]) {\n $('#question').html(\"<h3>You answered correctly!!!</h3>\");\n correct++;\n } else {\n $('#question').html(\"<h3>You answered incorrectly</h3>\");\n wrong++;\n }\n setTimeout(createQAndA, 3000);\n setTimeout(restartTime, 3000);\n}", "function timeUp () {\n clearInterval(timer);\n incorrect++;\n $('#game').html('<h5>' + 'Time is up! The correct answer was ' + questions[currentQuestion].correct + '</h5>')\n $('#game').append(\"<img src =\" + questions[currentQuestion].image + \">\")\n setTimeout(nextQuestion, 3 * 1000);\n}", "function startQuestion(){\n\n renderQuestion();\n\n clock = setInterval(function() {\n\n timeLeft--;\n\n // Display the result in the element with id=\"demo\"\n document.getElementById(\"timer\").innerHTML = \"Time Remaining: \" + timeLeft;\n \n \n\n // If the count down is finished, write some text \n if (timeLeft < 0) {\n clearInterval(clock);\n document.getElementById(\"timer\").innerHTML = \"Finished!\";\n checkAnswer();\n }\n\n }, 1000);\n \n}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\tuserTimeout();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t// console.log(questionCounter);\n\t// console.log(questions[questionCounter].correctAnswer);\n\t}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\tuserTimeout();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t// console.log(questionCounter);\n\t// console.log(questions[questionCounter].correctAnswer);\n\t}", "function nextQuestion() {\n\t\tif (questionCounter < questions.length) {\n\t\t\ttime = 15;\n\t\t\t$(\"#gameScreen\").html(\"<p>You have <span id='timer'>\" + time + \"</span> seconds left!</p>\");\n\t\t\tquestionContent();\n\t\t\ttimer();\n\t\t\tuserTimeout();\n\t\t}\n\t\telse {\n\t\t\tresultsScreen();\n\t\t}\n\t// console.log(questionCounter);\n\t// console.log(questions[questionCounter].correctAnswer);\n\t}", "function incorrectAnswer() {\n\tclearInterval(intervalId);\n\tresultOfTrivia();\n\t$(\".answer1\").html(\"Incorrect!\");\n \tquestion++;\n \tincorrect++;\n\tsetTimeout(countdown, 1000 * 5);\n\tsetTimeout(gameOfTrivia, 1000 * 5);\n\tsetTimeout(hoverHighlight, 1000 * 5);\n\ttime = 31;\n}", "function countdown() {\n if (currentQuestion < triviaQuestions.length) {\n timer = setInterval(function () {\n timeLeft--;\n checktimer();\n $(\".timer\").text(timeLeft + \" seconds left!\")\n }, 1000)\n }\n}", "function nextQuestion() {\n if (questionCounter < questions.length) {\n time = 15;\n $(\"#QuizArea\").html(\"<p>Timer: <span id='timer'>\" + time + \"</span> \");\n displayQuestion();\n timer();\n userTimeout();\n }\n else {\n gameOverDisplay();\n }\n // console.log(questionCounter);\n // console.log(questions[questionCounter].correctAnswer);\n }", "function generateWin() {\n timeLeft = 30;\n // $(\"#timer\").text(timeLeft);\n $(\"#gameArea\").hide();\n $(\"#showAnswer\").show();\n $(\"#timer\").hide();\n answerTemp = $(\"<div> The Correct Answer Was: </div>\").attr(\"class\", \"temp\");\n showAnswer = $(\"<div> \"+selectedAnswer+\"</div>\");\n $(\"#showAnswer\").append(answerTemp);\n $(\"#showAnswer\").append(showAnswer);\n correctAnswers++;\n console.log(\"correct Answers \"+correctAnswers);\n setTimeout(wait, 3000);\n clearInterval(clock);\n}", "function timeOutLoss() {\n\tunansweredTally++;\n\tgameHTML =\n\t\t\"<p class='text-center timer-p'>Time Left: <span class='timer'>\" +\n\t\tcounter + \"</span></p>\" +\n\t\t\"<p class='text-center'>Playing with your dog? The correct answer was: \" +\n\t\tcorrectAnswers[ questionCounter ] + \"</p>\";\n\t$( \".mainArea\" )\n\t\t.html( gameHTML );\n\tsetTimeout( wait, 2500 );\n}", "function nextQuestion() {\n $(\".answer-container\").hide();\n $(\".game-container\").show();\n currentQuestionIndex++;\n if (currentQuestionIndex >= triviaArr.length) {\n endGame();\n }\n else {\n $(\".timer\").show();\n time = 30;\n questionInterval = setInterval(count, 1000);\n currentQuestionData = triviaArr[currentQuestionIndex];\n displayQuestion();\n }\n }", "function gameOver() {\n clearContainer();\n $(\".correct\").html(\"Total Correct:\" + right);\n $(\".incorrect\").html(\"Total Incorrect:\" + wrong);\n $(\".correct\").show();\n $(\".incorrect\").show();\n currentQuestion = 0;\n time = 15;\n right = 0;\n wrong = 0;\n\n\n setTimeout(restart, 5000);\n}", "function displayAnswer(){\n setTimeout(nextQuestion, 7000);\n $(\".game-container\").hide();\n $(\".timer\").hide();\n $(\".correct-answer\").text(currentQuestionData.answer);\n $(\".image\").show().html(\"<img src=\" + currentQuestionData.answerImage + \">\");\n $(\".answer-container\").show();\n }", "function generateWin() {\n correctTally++;\n gameHTML = \"<p class='text-center timerText'></p>\" + \"<p class='text-center msg'>\" + correctAnswers[questionCounter] + \"</p>\" + imageArray[questionCounter];\n $(\".mainDiv\").html(gameHTML);\n setTimeout(wait, 5000); \n}", "function generateQuestion(questionNumber) {\n // checks to see if we've gone through all the questions, and if so takes to score summary\n if (questionNumber < 11) {\n // updates the question and timer\n $(\"#question-space\").text(questions[questionNumber].question);\n $(\"#timer-space\").html(\"<h2>Time Remaining: 00:20</h2>\");\n // resets the timer and starts the decrement function on a 1 second timer\n clearInterval(intervalId);\n intervalId = setInterval(decrement, 1000);\n // runs renderAnswers function to generate the answer options.\n renderAnswers(questionNumber);\n // determines what the correct answer is from the questions object\n var correctAnswer = questions[questionNumber].correct;\n // event handler waiting for click\n $(\".questions\").on(\"click\", function() {\n // conditional checking to see if the correct answer was picked or not. \n if ($(this).text() === correctAnswer) {\n // tracks which question we're on and moves to the next one.\n questionTrack++\n // increments the tracker for number of correct questions.\n correct++;\n // resets the timer\n clearInterval(intervalId);\n countDown = 20;\n // updates the DOM if we get the question right\n $(\"#question-space\").text(\"You're right! It's \" + correctAnswer + \"!\");\n $(\"#answer-space\").empty();\n $(\"#answer-space\").append(\"<img src='\" + questions[questionNumber].image + \"' </img>\");\n // waits 3 seconds before re-running the function again for the next question.\n setTimeout(function() {\n generateQuestion(questionTrack);\n }, 3000);\n }\n // all of these are pretty similar to above but inversed\n else {\n questionTrack++;\n wrong++;\n clearInterval(intervalId);\n countDown = 20;\n $(\"#question-space\").text(\"Ooh sorry wrong, the correct answer was \" + correctAnswer + \".\");\n $(\"#answer-space\").html(\"<img src='assets/images/Sad-Pikachu.jpg' </img>\");\n setTimeout(function() {\n generateQuestion(questionTrack);\n }, 3000);\n }\n });\n } \n // runs the score summary function if we are past the 10th question.\n else { \n scoreSummary();\n } \n}", "function unansweredQuestion() {\n unanswered++;\n $(\"#message\").html(\"<span style='color:red';>Time Out !! You failed to choose the answer.</span> <br> The Answer is \" + computerPick.choice[computerPick.answer] + \"</p>\");\n $(\"#time-remaining\").hide();\n $(\".choiceDiv\").hide();\n $(\"#ansImage\").html(\"<img src=\" + computerPick.image + \">\");\n $(\"#message\").show();\n $(\"#ansImage\").show();\n nextQuestion();\n\n }", "function countDown() {\n\n //subtract one from startNum every second\n startNum--;\n\n //send startNum to the timer div and show timer on html\n $(\".timer\").text(\"Time remaining: \" + startNum);\n console.log(startNum);\n\n //if the timer runs out(startNum = 0)\n if (startNum === 0) {\n\n //use clearInterval to stop the timer\n clearInterval(intervalID);\n console.log(\"hello\");\n\n //Empty the choices div\n $(\".choices\").empty();\n\n //replace the question with \"Time's up!\"\n $(\".questions\").text(\"Time's up!\");\n\n //replace the choices with \"The correct answer was \" + the answer pulled from gameArray[questNum].a \n $(\".choices\").append(\"<h3>The correct answer was \" + gameArray[questNum].a + \"</h3>\");\n console.log(gameArray[questNum].a);\n\n //Append the gif to the end of the choices div\n $(\".choices\").append(\"<br>\" + gameArray[questNum].lg);\n var audio = new Audio('assets/images/gif-lose-' + Math.floor(Math.random() * 5) + '.mp3');\n audio.play();\n //Add one to unanswered questions\n unanswered++;\n console.log(unanswered);\n\n //Add one to questNum\n questNum++;\n\n //set a timeout for 5 seconds. After that run the next question\n setTimeout(timeUp, 5000);\n\n //function to set the next question \n function timeUp() {\n if (questNum === gameArray.length) {\n $(\".timer\").empty();\n $(\".questions\").text(\"That all, here's how you did: \")\n $(\".choices\").html(\"<p>Correct Answers: \" + correctAnswer + \"</p><p> Wrong Answers: \" + wrongAnswer + \"</p><p> Unanswered Questions: \" + unanswered + \"</p>\");\n\n $(\".choices\").append(\"<br><div class='reset'>Restart the game</div>\");\n $(\".reset\").on(\"click\", function(){\n $(\".questions\").empty();\n $(\".choices\").empty();\n startNum = 20;\n questNum = 0;\n correctAnswer = 0;\n unanswered = 0;\n wrongAnswer = 0;\n $(\".timer\").text(\"Time remaining: \" + startNum);\n intervalID = setInterval(countDown, 1000);\n countDown();\n $(\".questions\").text(gameArray[questNum].q);\n for (i = 0; i < 4; i++) {\n $(\".choices\").append(\"<br> <div class='numBtn'>\" + gameArray[questNum].c[i] + \" </div><br>\");\n $(\".timer\").empty();\n startNum = 20;\n console.log(startNum);\n $(\".timer\").text(\"Time remaining: \" + startNum);\n }\n });\n if (correctAnswer >= 7) {\n $(\".choices\").prepend(\"<br><p>You diddly doodly did it!</p><br><img src='https://media3.giphy.com/media/l2JejtUtX0ImRvLnq/200.webp?cid=3640f6095bf0f07a4167586549f343d8'>\");\n var audio = new Audio('assets/images/winner-winner.mp3');\n audio.play();\n }\n else if (correctAnswer <= 3) {\n $(\".choices\").prepend(\"<br><p>I was saying boo-urns</p><br><img src='https://media2.giphy.com/media/jUwpNzg9IcyrK/200.webp?cid=3640f6095bf0f0cf66416f385539f10c'>\");\n var audio = new Audio('assets/images/lose-audio.wav');\n audio.play();\n }\n else {\n $(\".choices\").prepend(\"<p>Not bad! Join your family for some review!</p><br><img src='https://media1.giphy.com/media/oWjyixDbWuAk8/200.webp?cid=3640f6095bf0f15c616d62475153b23f'>\");\n var audio = new Audio('assets/images/middle-gif.mp3');\n audio.play();\n }\n \n }\n\n //timer back to ten\n else {\n startNum = 20;\n\n //empty the choices div\n $(\".choices\").empty();\n console.log(startNum);\n\n \n //set the timer again\n intervalID = setInterval(countDown, 1000);\n\n //call the countdown function\n countDown();\n\n //set the next question to html\n $(\".questions\").text(gameArray[questNum].q);\n\n //set the next answers to html\n for (i = 0; i < 4; i++) {\n $(\".choices\").append(\"<br> <div class='numBtn'>\" + gameArray[questNum].c[i] + \" </div> <br>\");\n };\n $(\".timer\").empty();\n startNum = 20;\n console.log(startNum);\n $(\".timer\").text(\"Time remaining: \" + startNum);\n \n }\n \n };\n\n }\n }", "function correctAnswer() {\n\tclearInterval(intervalId);\n\tresultOfTrivia();\n\t$(\".answer1\").html(\"Correct!\");\n \tquestion++;\n \tcorrect++;\n\tsetTimeout(countdown, 1000 * 5);\n\tsetTimeout(gameOfTrivia, 1000 * 5);\n\tsetTimeout(hoverHighlight, 1000 * 5);\n\ttime = 31;\n}", "function check(answer) {\n if (questionIndex < questions.length - 1) {\n setTimeout(getQuestion,500);\n}\n else {\n setTimeout(showScore,500);\n}\n\nif (answer == questions[questionIndex].correctAnswer) {\n score++;\n questionIndex++;\n choices.style.display = \"none\";\n choiceResponse.innerHTML= '<p style=\"color:green\">Correct!</p>';\n choiceResponse.style.display = \"block\";\n choiceResponse.setAttribute(\"class\",\"label\");\n}\nelse {\n questionIndex++;\n choices.style.display = \"none\";\n choiceResponse.innerHTML= '<p style=\"color:red\">Incorrect!</p>';\n choiceResponse.style.display = \"block\";\n choiceResponse.setAttribute(\"class\",\"label\");\n }\n}", "function countdown() {\n timeInterval = setInterval(function() {\n if(timeLeft > 0 && questionArray.length > 0){\n timerDisplay.innerText = timeLeft;\n timeLeft--;\n } \n }, 1000);\n}", "function wrongAnswerExperience () {\n $(\".result-display\").append(\"<div class='col'>\" + \"<p id='correct'> Sorry, that's incorrect.\" + \"</p>\" + \"</div>\");\n $(\".result-image\").append(\"<div class='col'>\" + correctChoiceImage[questionCount] + \"</div>\");\n $(\".result-text\").append(\"<div class='col'>\" + \"<p id='correct'>\" + correctChoice[questionCount] + \" is the correct answer\" + \"</p>\" + \"</div>\");\n setTimeout(actionsBasedOnCount,1000*6);\n\n}", "function losePage() {\n\n // //increment incorrectCounter\n // incorrectCounter++;\n \n //clear countDownInterval\n clearInterval(countDownInterval);\n \n //Hide the questions and answers on the document\n $(\"#questionPage\").hide();\n \n //display losing message\n if (timeRemaining === 0) {\n unansweredCounter++;\n $(\"#message\").text(\"You ran out of time.\");\n }\n else {\n incorrectCounter++;\n $(\"#message\").text(\"Incorrect.\");\n }\n \n //display the correct answer\n $(\"#message\").append($(\"<p>\").text(\"The correct answer was: \" + questionArray[questionIndex].correctAnswer));\n\n //display an image or gif\n $(\"#message\").append(\"<br>\");\n if (timeRemaining === 0) {\n $(\"#message\").append($(\"<img>\").attr(\"src\", \"assets/images/noTimeGif.gif\"));\n }\n else {\n $(\"#message\").append($(\"<img>\").attr(\"src\", \"assets/images/incorrectGif.gif\"));\n }\n\n //increment questionIndex\n questionIndex++;\n \n //use setTimout to call questionPage after 5 sec\n setTimeout(questionPage, 5000);\n \n}", "function questionClick() {\n // check if guessed wrong\n \n if (this.value !== questions[currentQuestionIndex].correct) {\n //penalize time\n time -= 10;\n\n if (time < 0) {\n time = 0;\n }\n\n // display new time on page\n timerCountdown.textContent = time;\n\n feedbackKey.textContent = \"Wrong!\";\n } if (this.value == questions[currentQuestionIndex].correct) {\n //Give extra time\n time += 10;\n\n if (time < 0) {\n time = 0;\n }\n\n // display new time on page\n timerCountdown.textContent = time;\n feedbackKey.textContent = \"Correct!\";\n };\n\n // flash right/wrong feedback on page\n feedbackKey.setAttribute(\"class\", \"key\");\n setTimeout(function() {\n feedbackKey.setAttribute(\"class\", \"key hide\");\n }, 1000);\n\n // move to next question\n currentQuestionIndex++;\n\n // check if we've run out of questions\n if (currentQuestionIndex === questions.length) {\n quizEnd();\n } else {\n getQuestion();\n }\n}", "function countdown() {\n \n var timeInterval = setInterval(function () {\n time--;\n timerElement.textContent = time + \" Seconds Remaining.\";\n \n if(time <= 0) {\n clearInterval(timeInterval);\n questionElement.setAttribute('class', 'hide');\n highScoreElement.removeAttribute('class');\n }\n \n }, 1000);\n }", "function decrement() {\n timeLeft--;\n $(\"#time-left\").html(\"<h2>\" + \"Time Remaining:&nbsp\" + \"</h2>\" + \"<h2>\" + timeLeft + \"</h2>\");\n if (timeLeft <= 0) {\n if (currentQuestion == 9) {\n $(\"#wrapper\").hide();\n $(\"#message\").show();\n $(\"#message\").html(\"<h4>\" + \"Time's Up!\" + \"</h4>\" + \"<h5>\" + \"Correct Answer:\" + \"</h5>\" + \"<h5>\" + questionList[currentQuestion].choices[questionList[currentQuestion].answer] + \"</h5>\");\n clearInterval(intervalId);\n // currentQuestion++;\n unanswered++;\n setTimeout(function () {\n $(\"#message\").hide();\n $(\"#wrapper\").hide();\n scores();\n },3000);\n }\n\n else {\n $(\"#wrapper\").hide();\n $(\"#message\").show();\n $(\"#message\").html(\"<h4>\" + \"Time's Up!\" + \"</h4>\" + \"<h5>\" + \"Correct Answer:\" + \"</h5>\" + \"<h5>\" + questionList[currentQuestion].choices[questionList[currentQuestion].answer] + \"</h5>\");\n clearInterval(intervalId);\n // currentQuestion++;\n unanswered++;\n setTimeout(function () {\n $(\"#message\").hide();\n newQA();\n },3000);\n }\n }\n}", "function answer(answer) {\n // Stop and reset the timer\n stopTimer();\n\n // If answer is wrong, show wrong answer screen\n if (answer.target.value != triva[q].correctAnswer) {\n console.log(\"Wrong\");\n // If answer is wrong, add to wrong answers\n wrong++;\n unanswered--;\n \n \n trivaCard.style.display = \"none\"; // Hide question & answers\n timer.style.display = \"none\" // Hide timer\n gif.src = \"assets/images/wrong.gif\" // Set gif src to the needed gif\n gifCard.style.display = \"block\"; // Show the gif\n \n // Show the right answer\n switch (triva[q].correctAnswer) {\n case \"a\":\n ifWrong.textContent = \"The Correct Answer Was '\" + triva[q].answers.a + \"'\";\n ifWrong.style.display= \"block\";\n break;\n case \"b\":\n ifWrong.textContent = \"The Correct Answer Was '\" + triva[q].answers.b + \"'\";\n ifWrong.style.display = \"block\";\n break;\n case \"c\":\n ifWrong.textContent = \"The Correct Answer Was '\" + triva[q].answers.c + \"'\";\n ifWrong.style.display = \"block\";\n break;\n case \"d\":\n ifWrong.textContent = \"The Correct Answer Was '\" + triva[q].answers.d + \"'\";\n ifWrong.style.display = \"block\";\n break;\n }\n\n q++;\n // Show next question after 5 seconds\n setTimeout(displayQuestion, 5000);\n }\n\n // If answer is right, show right answer screen\n else if (answer.target.value === triva[q].correctAnswer) {\n console.log(\"Correct!\");\n // If answer is right, add to wrong answers\n correct++;\n unanswered--;\n\n trivaCard.style.display = \"none\"; // Hide question & answers\n timer.style.display = \"none\" // Hide timer\n\n\n switch (q) {\n case 0:\n gif.src = \"assets/images/tvshowCorrect.gif\" // Set gif src to the needed gif\n gifCard.style.display = \"block\"; // Show the gif\n break;\n case 1:\n gif.src = \"assets/images/springfieldCorrect.gif\" // Set gif src to the needed gif\n gifCard.style.display = \"block\"; // Show the gif\n break;\n case 2:\n gif.src = \"assets/images/moesCorrect.gif\" // Set gif src to the needed gif\n gifCard.style.display = \"block\"; // Show the gif\n break;\n case 3:\n gif.src = \"assets/images/herbertCorrect.gif\" // Set gif src to the needed gif\n gifCard.style.display = \"block\"; // Show the gif\n break;\n case 4:\n gif.src = \"assets/images/firstepCorrect.gif\" // Set gif src to the needed gif\n gifCard.style.display = \"block\"; // Show the gif\n break;\n }\n \n q++;\n // Show next question after 5 seconds\n setTimeout(displayQuestion, 5000);\n }\n}", "function questionCounter() {\n if (counter < 10) {\n startGame();\n timer = 16;\n timerHolder();\n } else {\n finishGame();\n }\n }", "function correctAnswer() {\n $(\".textBoxAnswer\").hide();\n $(\"#countdownTimer\").hide();\n $(\"#pickAnswer\").hide();\n stopTimer();\n resetTimer();\n $(\".textResults\").show();\n audioCorrect.play();\n $(\"#rightWrong\").html(\"<p>\" + \"CORRECT!\".fontcolor(\"green\") + \"</p>\");\n $(\"#factoid\").html(questions[questionsCount].factoid);\n setTimeout(nextQuestion, 10000);\n setTimeout(backgroundChange, 10000);\n}", "function generateLoss() {\n incorrectTally++;\n gameHTML = correctAnswers[questionCounter] + \"\" + losingImages[questionCounter];\n $(\".mainDiv\").html(gameHTML);\n setTimeout(wait, 5000); \n}", "function incorrect() {\n timeLeft -= 15;\n document.getElementById(\"quizBody\").innerHTML = \" \";\n next();\n}" ]
[ "0.74916095", "0.7463579", "0.74063206", "0.73588055", "0.7302", "0.72965103", "0.72755635", "0.7266828", "0.72627234", "0.7234411", "0.7221665", "0.7217018", "0.72166795", "0.7216227", "0.7192297", "0.7188614", "0.71868753", "0.71615577", "0.71591514", "0.7156588", "0.7154956", "0.7146119", "0.7143599", "0.71414536", "0.7139171", "0.7133117", "0.71315783", "0.71255726", "0.71193653", "0.7116632", "0.71108425", "0.7106381", "0.70922965", "0.70904917", "0.7082875", "0.7082861", "0.7077515", "0.7075437", "0.70633036", "0.70557874", "0.7048113", "0.704738", "0.7045517", "0.7037764", "0.7028562", "0.70242566", "0.70181334", "0.70166725", "0.70151705", "0.70133096", "0.7009379", "0.70025223", "0.7001169", "0.7000407", "0.7000281", "0.69989896", "0.69842684", "0.698373", "0.6982771", "0.69716007", "0.69696546", "0.6968381", "0.6959405", "0.69590515", "0.6948679", "0.6947288", "0.69435346", "0.6943436", "0.6937034", "0.6935698", "0.6935173", "0.69348574", "0.69334435", "0.69285065", "0.69285065", "0.69285065", "0.692311", "0.692209", "0.69180447", "0.69161683", "0.6915212", "0.6914472", "0.691031", "0.6905373", "0.69018054", "0.68977666", "0.68857354", "0.68777984", "0.68761307", "0.6875527", "0.6872939", "0.6871797", "0.6869852", "0.686912", "0.6867174", "0.6866113", "0.686435", "0.68638", "0.68633914", "0.68617547", "0.6860383" ]
0.0
-1
function for when it's game over
function finalScreen() { // unique end-game message if the user got a perfect score of 8 if (correctTally === 8) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>100%! You got a perfect score!" + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if correct tally is 5-7 out of 8 else if (correctTally < 8 && correctTally > 4) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>Game Over! You did great!" + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if tally is 4 out of 8 else if (correctTally === 4) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>Game Over! You scored 50%." + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if correct tally is between 1-3 else if (correctTally < 4 && correctTally != 0) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>Game Over! You need to stay in school." + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if the correct tally is zero else { gameHTML = "<p class='text-center timerText msg finalmsg'>YOU DA BEST!<br><img src='https://i.imgur.com/uvVWKNX.gif' class='picDisplay noBorder'></p>" + "<p class='text-center'></p>" + "<p class='summary-correct'></p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Replay</a></p>"; // DOG GIF: https://i.imgur.com/FpJ79Ry.gif DANCING LADY: https://i.imgur.com/uvVWKNX.gif $(".mainDiv").html(gameHTML); // $(".endPic").html("<img class='endDancers' width='100px' src='https://i.imgur.com/uvVWKNX.gif'>"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameOver(){\n \tconsole.log(\"game over\");\n \t_onGameOver();\n }", "function dys_ChecGameOver(){\r\n\t\r\n}", "function gameOver() {\r\n disableActions();\r\n }", "gameOverAction() {\n\n }", "function gameOver(){\n getPlayerName();\n clearInterval(hoopIntervalId);\n clearInterval(divMoverIntervalId);\n clearInterval(gravityIntervalId);\n clearInterval(characterMoverIntervalId);\n clearInterval(hoopSpeedUpIntervalId);\n $endScore = $points.text();\n vSpeed = 0;\n $instruction.show();\n gameOngoing = false;\n resetGame();\n }", "handleGameOverEvent() {\n \n }", "function gameOver() {\r\n\tyouLose = true;\r\n\tdrawX();\r\n}", "function gameOver() {\n isGameRunning = false;\n showGameOverMenu();\n setupInstructions();\n cleanBullets();\n teardownScore();\n}", "function gameOver() {\n gameActive = false\n playSound(\"wrong\")\n gameOverAnimation()\n updateLevelText(\"Game Over\")\n resetGame()\n}", "function gameOver() {\n\tstopClock();\n\twriteModalStats();\n\ttoggleModal();\n\tmatched=0;\n}", "function gameOver() {\n puzzleEnd(false)\n }", "gameOver() {\n clearInterval(this.timeCount);\n this.soundControl.gameOver();\n document.getElementById('game-over-msg').classList.add('visible');\n }", "function gameOver(){\n\t\tgameArena.hide()\n\t\tscoring()\n\t}", "function GameOver() {\n\t\talert(\"GAME OVER\");\n\t\tdiplomaPositions = [{x: 300, y: 0}, {x: 450, y:250}, {x:600, y:150}];\n\t\tpreGame = true;\n\t\tscore = 0;\n\t}", "function gameOver() {\n clearPrevious();\n clearPreviousLifes();\n imgPrep();\n imgLose.classList.toggle(\"contentHide\");\n setTimeout(function () {\n modeMenu(\"100%\");\n }, 250);\n return winLoseValue = 0;\n}", "function gameovercheck() {\n\t\tif (lives === 0) {\n\t\t\tball.y_speed = 0;\n\t\t\tball.x_speed = 0;\n\t\t\tcontext.font = \"40px Copperplate\";\n\t\t\tcontext.fillText(\"GAME OVER\", width/2 - 120, height/2 + 35);\n\t\t\tgameover = 1;\n\t\t\tdocument.getElementById(\"newgame\").style.visibility = \"visible\";\n\t\t}\n\t\telse if (brickcount === 0) {\n\t\t\tball.y_speed = 0;\n\t\t\tball.x_speed = 0;\n\t\t\tcontext.font = \"40px Copperplate\";\n\t\t\tcontext.fillText(\"YOU WIN!\", width/2 - 95, height/2 + 35);\n\t\t\tgameover = 1;\n\t\t\tdocument.getElementById(\"newgame\").style.visibility = \"visible\";\n\t\t}\n\t}", "function gameover() {\n home();\n }", "function gameOver() {\n\tstopClock();\n\twriteModalStats();\n\ttoggleModal();\n}", "function gameOver() {\n\n // Pause the player's movements as they are no longer in the game\n freezePlayer();\n\n // Inform other code modules in this application that the game is over\n Frogger.observer.publish(\"game-over\");\n }", "gameOver() {\n state.isPlaying = false;\n state.isFalling = true;\n state.isGameOver = true;\n window.dispatchEvent(new CustomEvent('gameover'));\n }", "gameOver(){\n\n\t\tthis.mvc.gameState = 0;\n\n\t\tthis.mvc.model.ioSendEnd();\n\n\t\tthis.stop();\n\n\t\tthis.mvc.model.updatedHallOfFame();\n\n\t}", "function gameOver(){\n state = 2;\n}", "function gameOver() {\n\tstopTimer();\n\tupdateModal();\n\ttoggleModal();\n}", "function gameOver(message) {\n gameIsOn = false;\n setTimeout(printEndGameMessage(message, false));\n}", "gameover() {\n AM.play(\"gameover\");\n alert(\"game over!\" + this.score);\n this.reset();\n }", "function gameend(){\nvar gameover= true;\n$('.message').html('GAME OVER');\t\n}", "function gameOver() {\n stopClock();\n writeModalStats();\n toggleModal();\n}", "function gameOver() {\n var EightBitter = EightBittr.ensureCorrectCaller(this),\n text = EightBitter.ObjectMaker.make(\"CustomText\", {\n \"texts\": [{\n \"text\": \"GAME OVER\"\n }]\n }),\n texts, textWidth, dx, i;\n\n EightBitter.killNPCs();\n\n EightBitter.AudioPlayer.clearAll();\n EightBitter.AudioPlayer.play(\"Game Over\");\n\n EightBitter.GroupHolder.clearArrays();\n EightBitter.StatsHolder.hideContainer();\n EightBitter.TimeHandler.cancelAllEvents();\n EightBitter.PixelDrawer.setBackground(\"black\");\n\n EightBitter.addThing(\n text,\n EightBitter.MapScreener.width / 2,\n EightBitter.MapScreener.height / 2\n );\n\n texts = text.children;\n textWidth = -(texts[texts.length - 1].right - texts[0].left) / 2;\n for (i = 0; i < texts.length; i += 1) {\n EightBitter.shiftHoriz(texts[i], textWidth);\n }\n\n EightBitter.TimeHandler.addEvent(function () {\n EightBitter.gameStart();\n EightBitter.StatsHolder.displayContainer();\n }, 420);\n\n EightBitter.ModAttacher.fireEvent(\"onGameOver\");\n }", "gameOver() {\n clearInterval(this.countDown);\n $('#game-over').addClass('visible')\n }", "function gameOver() {\n var over = 0;\n for (var i = 0; i < 42; i++) {\n if (\n $(\".row\")\n .eq(i)\n .hasClass(\"player2\")\n ) {\n over++;\n } else if (\n $(\".row\")\n .eq(i)\n .hasClass(\"player1\")\n ) {\n over++;\n }\n if (over == \"42\") {\n setTimeout(function() {\n alert(\"GAME OVER!!!\");\n $(\".row\").removeClass(\"player1\");\n $(\".row\").removeClass(\"player2\");\n $(\".row\").removeClass(spiced1);\n $(\".row\").removeClass(spiced2);\n $(\"#cursor\").removeClass(spiced1);\n $(\"#cursor\").removeClass(spiced2);\n spiced = \"\";\n $(\"#cursor\").hide();\n $(\"#menu\").show();\n $(\"#menbg\").show();\n }, 20);\n }\n }\n }", "function GameOverAnimation() {\n /* ANIMATE GAME OVER\n PLAY SWOOSH SOUND\n SCOREBOARD();\n */\n}", "function gameOver(){\n\t\t\tconsole.log(\"gameOver() called\");\n\t\t\tupdate($question, \"Game Over, you score \" + score + \" points!\");\n\t\t\twindow.clearInterval(interval);\n\t\t\thide($form);\n\t\t\tshow($start);\n\t\t}", "function gameOver(x) {\n console.log('it is game over!');\n // tell the user it's over\n x.game.server_sendMessage('Time has run out!');\n // play a 'losing' sound here!\n x.game.server_playSound({\n name: 'win.m4a',\n gain: 0.5\n });\n // cancel all arrows\n x.p.cancelAll();\n // cancel the tick interval on the emitter\n x.clock.stop();\n return x;\n }", "function checkForGameOver() {\r\n if (health <= 0) {\r\n clearCanvases();\r\n var newHighScore = checkHighScore();\r\n cancelAnimationFrame(animation);\r\n animation = requestAnimationFrame(() => gameOver(newHighScore));\r\n }\r\n}", "function gameOver() {\n if (lives == 0) {\n gameIsOver = true;\n }\n if (gameIsOver) {\n menu = 3;\n\n if (gameSound.isPlaying()) {\n gameSound.stop();\n gameoverSound.play();\n }\n }\n}", "function lost(){\n pause();\n playing = false;\n lose = true;\n setHighscore();\n html('rows','Game Over')\n }", "function gameOver(){\r\n startOver();\r\n playSound(\"wrong\");\r\n $(\"body\").addClass(\"game-over\");\r\n setTimeout(function () {\r\n $(\"body\").removeClass(\"game-over\");\r\n },200);\r\n $(\"h1\").html(\"game over, press any key to restart\");\r\n}", "function gameOver() {\n stopTimer();\n toggleModal();\n writeModalStats();\n}", "function game_over() {\n if(model.winner == 0) {\n alert(\"Game over, it is a tie!\");\n model.winner = 1;\n } else {\n if(this.turn === \"x\") {\n // alert(\"Player 1 Won!\");\n } else {\n // alert(\"Player 2 Won!\");\n }\n }\n model.tokensInserted = 0;\n // model.restartGame();\n }", "function gameover() {\n if (lossCounter === 3) {\n $(\".main\").hide();\n $(\"#game-over\").show();\n }\n else if (winCounter === 3) {\n $(\".main\").hide();\n $(\"#surprise\").show();\n }\n else {}\n }", "gameOver() {\n clearInterval(this.countdown);\n this.audioController.gameOver();\n document.getElementById('game-over-text').classList.add('visible');\n }", "function gameOver() {\n if(matchedCard.length === fontIcons.length){\n openModal();\n //alert(`game is over you made ${moves} moves`);\n shuffle(fontIcons); //shuffle card.\n clearInterval(i);\n }\n}", "function gameOver() {\n\tctx.fillStlye = \"white\";\n\tctx.font = \"20px Arial, sans-serif\";\n\tctx.textAlign = \"center\";\n\tctx.textBaseline = \"middle\";\n\tctx.fillText(\"Game Over - You scored \"+points+\" points!\", W/2, H/2 + 25 );\n\t\n\t// Stop the Animation\n\twindow.cancelAnimationFrame(init);\n\t\n\t// Set the over flag\n\tover = 1;\n\t\n\t// Show the restart button\n\trestartBtn.draw();\n}", "function gameOver(hasWon) {\r\n isGameEnded = true;\r\n timeRecord = clock.getElapsedTime();\r\n isGameAnimation = true;\r\n backgroundMusic.stop();\r\n if (hasWon) {\r\n displayText(\"You've Won\", 1, 5, -Math.PI /4);\r\n isWon = true;\r\n winFSX.play();\r\n } else {\r\n displayText(\"Game Over\", 1, 5, -Math.PI /4);\r\n isWon = false;\r\n loseFSX.play();\r\n }\r\n}", "checkForGameOver() {\n // game over if misses jump\n if(this.wizard.y > game.config.height) {\n this.gameOver();\n }\n }", "function gameOver() {\n \n hit = true;\n var d = new Date();\n endTime = d.getTime();\n //$(\".player\").css(\"background-image\", \"url(../../../Assets/images/\" + boyOrGirl + \"Hit.png)\");\n lives--;\n $(\".lives\").html(lives);\n\n showScore();\n\n // Post Scores\n saveScore();\n\n saveVariables();\n \n}", "function gameOver(){\n\tif(gameStatus==YOU_LOSE){\n\t\t$(\"#gameOverStatusHeading\").text(\"YOU LOST THE GAME. PRESS RESTART BUTTON TO PLAY AGAIN !!!\")\n\t\t$(\"#gameOverStatus\").addClass(\"attackStatusDisp\");\n\t\t$(\"#gameOverStatus\").removeClass(\"attackStatus\");\n\t\tnew Audio('assets/sounds/loseSound.mp3').play();\n\n\t}else if(gameStatus==YOU_WIN){\n\t\t$(\"#gameOverStatusHeading\").text(\"YOU WON THE GAME. PRESS RESTART BUTTON TO PLAY AGAIN !!!\")\n\t\t$(\"#gameOverStatus\").addClass(\"attackStatusDisp\");\n\t\t$(\"#gameOverStatus\").removeClass(\"attackStatus\");\n\t\tnew Audio('assets/sounds/winSound.mp3').play();\n\t}\n\n\t$(\"#restartButton\").toggleClass(\"resButton\");\n}", "gameOver() {\n this.stopMusic();\n this.gameOverSound.play();\n }", "function gameOver() {\n game.paused = true;\n statoDolci = 2;\n dolciCompari();\n //restart on click function\n game.input.onTap.addOnce(function () {\n game.paused = false;\n game.state.restart();\n time = 0;\n ordine = 0;\n statoDolci = 1;\n dolciCompari();\n });\n}", "gameOver() { \n this.gameOverCount++;\n if (this.gameOverCount == 3) {\n this.gameOverCount = 0;\n this.isGameOver = false;\n this.reset();\n }\n }", "function checkForGameOver () {\n\t\tif (SQUARES[margauxCurrentIndex].classList.contains(\"bug\") && !SQUARES[margauxCurrentIndex].classList.contains(\"scared-bug\")) {\n\t\t\tbugs.forEach(bug => {\n\t\t\t\tclearInterval(bug.timerID);\n\t\t\t\tbug.timerID = NaN;});\n\t\t\tdocument.removeEventListener(\"keydown\", moveMargaux);\n\t\t\tdocument.removeEventListener(\"touchmove\", moveMargaux);\n\t\t\tdocument.documentElement.style.setProperty(\"--img\", \"url(\\\"/images/persoFace.png\\\")\");\n\t\t\tdocument.documentElement.style.setProperty(\"--img2\", \"url(\\\"/images/persoFace.png\\\")\");\n\t\t\tscoreDisplay.innerHTML = score;\n\t\t\tgameMessage.innerHTML = \"GAME OVER\";\n\t\t\tgameMessageText.innerHTML = \"Dommage... La prochaine fois sera la bonne !\";\n\t\t\tgameMessageDiv.style.display = \"block\";\n\t\t}\n\t}", "function gameOver() {\n\n\tvar score = {\n\t\t\"score\": getScore(),\n\t\t\"player\": localStorage.getItem(\"player\"),\n\t\t\"level\": 1\n\t};\n\tnetwork.postNewScore(score);\n\tglitchScreen(500);\n\tdocument.getElementById('gameOverText3').innerHTML = getScore();\n\t$('#gameOverBox').animate({top: '20%'}, 500);\n \tPause = true;\n \tPauseScreen = true;\n movement.unlockPointer();\n}", "function isGameOver(){\n\treturn isMatch(gameOver, jQuery('.nes-screen')[0].getContext('2d').getImageData(88,129,6,6).data);\n}", "function isGameOver(){\n sounds.explosion.cloneNode().play();\n if(lives <= 0){\n triggerModal(overWindow);\n }\n else{\n lives--;\n livesElem.innerText = lives;\n document.querySelector('.footer-left').querySelector('.spaceship').remove()\n }\n}", "function gameOver() {\n\tsaveValues();\n\tmessage = $('<div>GAME OVER</div>');\n\tmessage.css(\"position\", \"absolute\");\n\t$snake.append(message);\n\tplaceDiv(message, (WIDTH/2) - 4, HEIGHT/2);\n\n\t$snake.off(\"keydown\");\n\t$snake.keydown(function(key) {\n\t\t\tkey.preventDefault();\n\t\t\tif (key.which == 32) { //spacebar\n\t\t\t\tmessage.remove();\n\t\t\t\tpaused = false;\n\t\t\t\treset();\n\t\t\t}\n\t\t});\t\n}", "function gameOver() {\n\n // Let the player know \"you are already dead...\"\n alert(\"Game Over!\");\n\n // Restart a new game\n gameStart();\n\n}", "function gameOver() {\n if (leftPaddle.losses > 10 || rightPaddle.losses > 10) {\n\n gameLost = true;\n\n textAlign(CENTER);\n\n push();\n background(0);\n textSize(60);\n textFont(wordFont);\n fill(random(200,255),15,random(10,50));\n text(\"GAME OVER :C\",width/2, height/2);\n pop();\n\n push();\n textSize(20);\n textFont(wordFont);\n fill(random(200,255),15,random(10,50));\n text(\"press enter to beeoopboopbeep again\",width/2,300);\n pop();\n }\n }", "function drawGameOver() {\n\tdrawBackground();\n\tdrawBanner();\n\tif (livesRemaining === 0) {\n\t\tcolorTxt('OUT OF LIVES', canvas.width / 2, canvas.height / 2, '100px Arial', 'center', 'middle', '#fff');\n\t} else {\n\t\tcolorTxt('GAME COMPLETE', canvas.width / 2, canvas.height / 2, '100px Arial', 'center', 'middle', '#fff');\n\t}\n}", "function gameOver() {\n if (!lose) {\n lose = true;\n canPlace = false;\n \n if (currentPipe) {\n currentPipe.sprite.animations.stop();\n }\n \n togglePipeInput(false);\n pauseObstacles();\n pauseCounters();\n setHealth(0);\n\n SFX_loseSound.play();\n SFX_gameMusic.pause();\n\n loseScreen();\n }\n}", "gameOver(){\n clearInterval(this.countDown);\n this.audioController.gameOver();\n document.getElementById(\"game-over\").classList.add(\"visible\");\n }", "function gameOver()\r\n{\r\n alert(\"GAME OVER!\" + \"\\n\" + \"Nombre de mouvements effectues: \" + moveCount + \"\\n\\n\" + \"Le jeu sera recommence apres la fermeture de cette fenêtre.\");\r\n restart();\r\n}", "function isGameOver (){\n if (whoWon()) return true\n return false\n}", "gameOver() {\n //showing the original start screen overlay\n startScreen.style.display = 'block';\n //this method displays a final 'win' or 'loss' message and updates overlay screen with CSS class\n const h1 = document.getElementById('game-over-message');\n if (this.missed < 4) {\n h1.innerHTML = 'Game over';\n startGame.classList.add('lose');\n } else {\n h1.classList.remove('lose');\n h1.innerHTML = 'Congratulations, you won!';\n startScreen.classList.add('win');\n }\n }", "function lose() {\n losses++;\n startGame();\n}", "function checkForGameOver() {\n\tif (\n\t\tsquares[pacmanCurrentIndex].classList.contains('ghost') &&\n\t\t!squares[pacmanCurrentIndex].classList.contains('scared-ghost')\n\t) {\n\t\tghosts.forEach((ghost) => clearInterval(ghost.timerId))\n\t\tdocument.removeEventListener('keyup', movePacman)\n\t\tscoreDisplay.innerHTML = 'GAME OVER !'\n\t}\n}", "function showGameOver() {\n audioError.currentTime = 0;\n audioError.play();\n $(document.body).addClass('game-over');\n h3.html(`Game over at level ${pattern.length}!<br/>Select any direction to start over.`);\n pattern = [];\n}", "function gameOver() {\n if (guessesRemaining < 1) {\n alert('Game Over')\n }\n }", "function isGameOver() {\r\n if (isGameEnded || MeshLeoTorso.position.y > 9) {\r\n return;\r\n }\r\n if (MeshLeoTorso.position.x < boundry.left) {\r\n isFallOff = true;\r\n gameOver(false);\r\n } else if (MeshLeoTorso.position.x > boundry.right) {\r\n isFallOff = true;\r\n gameOver(false);\r\n }\r\n}", "isGameOver() {\n return this.gameState === GAME_OVER;\n }", "function endgame() {\r\n gameOver = true;\r\n\tmusic.playGameOver();\r\n}", "function gameOverFN(player) {\n player.setTint(0xff0000);\n player.setVelocityX(0);\n cop.setVelocityX(0);\n copLobby.setVelocityX(0);\n cam1.setVelocityX(0);\n verhaftet.play();\n player.anims.stop();\n cop.anims.stop();\n copLobby.anims.stop();\n gameOver = true;\n}", "gameOver() {\n $('#overlay').slideDown(1250);\n if (this.missed === 5) {\n $('#overlay h1').text('You lose, maybe next time!')\n $('#overlay').removeClass('win').addClass('lose');\n } else {\n $('#overlay h1').text('Congrats you win! Play another game.');\n $('#overlay').removeClass('lose').addClass('win');\n }\n $('.letter').remove();\n $('.space').remove();\n $key.removeClass('wrong').removeClass('chosen').prop('disabled', false)\n $('.tries img').remove();\n $('.tries').append('<img src=\"images/liveHeart.png\" alt=\"Heart Icon\" height=\"35\" width=\"30\"></img>');\n }", "checkIfGameOver() {\n if (this.character.dead || this.endBoss.dead) {\n this.gameOver.gameFinished = true;\n this.gameOver.lostGame = this.character.dead && !this.endBoss.dead ? true : false;\n this.gameOver.showEndscreen();\n this.AUDIO_BACKGROUND.pause();\n this.AUDIO_GAMEOVER.play();\n this.AUDIO_GAMEOVER.volume = 1;\n }\n }", "function gameOver() {\n if (matchedCards.length === icons.length) {\n stopTimer();\n showModal();\n }\n}", "function gameOver() {\n document.getElementById(\"game-over-tetris\").innerHTML = \"Game Over!\";\n document.getElementById(\"startgame\").innerHTML = \"Play Again ?\";\n score=lineClear*10;\n if( score > highScore)\n highScore = score;\n sound.gameover.play();\n pause=true;\n //if( !alert(\"Game Over\\nScore:\" + score +\"\\nHigh Score:\" + highScore))\n // newGame();\n}", "function gameOver() {\n\t$(\"#gameOver\").show();\n\t$(\"#savebutton\").hide();\n\t$(\"#scoretext\").text(parseInt(pairsFound*pairsFound*pairsFound*100/(hours*60*60+minutes*60+seconds)));\n\ttimerOn = false;\n}", "function gameOver() {\n document.getElementById('game-over').style.display = 'block';\n document.getElementById('game-over-overlay').style.display = 'block'; // Screen over the game?\n isGameOver = true;\n}", "gameOverCheck() {\n if (gameState.lives <= 0) {\n this.hiScoreCheckAndSave(); \n this.cameras.main.fade(gameState.FADE_TIME_FAST, 0, 0, 0, false, function(camera, progress) {\n if (progress >= 1.0) {\n sfx.gameover.play();\n this.scene.stop('MainScene');\n\t\t\t this.scene.start('GameOverScene');\n }\n });\n }\n }", "function gameOver() {\t\n\t\t$('#score').html(score);\n\t\t$('#game-over').show(200);\n\t}", "function isGameOver() {\n //game is over if the player has 6 wrong guesses\n if (wrongGuesses === 6) {\n //display game over\n $(\"#gameOver\").text(\"You Lost! Maggie will be lost in space!\").css(\"color\", \"red\").show();\n $(\"#hangman\").hide();\n }\n //game is over if the player has guessed the word\n if (dashes.join(\"\") === randomWordArray.join(\"\")) {\n //display you won, yay\n $(\"#gameOver\").text(\"You guessed it! Maggie can get back to her ship now!\").css(\"color\", \"blue\").show();\n $(\"#hangman\").hide();\n }\n }", "function gameOver() {\n return matchedCounter === 8;\n}", "function gameOver() {\n playerAlive = false; \n\n //Reset health and the health bar.\n currentHealth = maxHealth;\n healthBarReset();\n\n //Clear skeleton interval if applicable. \n if (skeleInterval !== undefined) {\n clearInterval(skeleInterval);\n }\n\n //Kill all enemeis on the level to prevent bugs when resetting. \n for (i = 0; i < enemyCount; i++){\n enemies[i].alive = false; \n }\n\n //Reset inventory to a prior state (stored in resetInventory)\n for (j = 0; j < inventory.length; j++) {\n inventory[j] = (resetInventory[j]);\n }\n\n if (currentLevelID === 'colchisFields' && userIntThis.ritualItemText.alpha > 0) {\n userIntThis.ritualItemText.alpha = 0;\n } else if (userIntThis.ritualItemText.alpha > 0){\n userIntThis.updateRitualItemText();\n }\n\n //Restart the level. \n createThis.scene.restart(currentLevelID);\n}", "function gameOver() {\n\tctx.fillStlye = \"white\";\n\tctx.font = \"20px Arial, sans-serif\";\n\tctx.textAlign = \"center\";\n\tctx.textBaseline = \"middle\";\n\n\tvar playerWinner = (score_jugadores[0] > score_jugadores[1])?\"P1\":\"P2\";\n\tplayerWinner += \" wins!!!\";\n\tvar messageGame = \"\";\n\tif(usuario_id === -1)\n\t\tmessageGame = playerWinner;\n\telse\n\t\tmessageGame = playerWinner +\" - Game Over - You scored \"+score_jugadores[usuario_id -1]+\" points!\"\n\tctx.fillText( messageGame , W/2, H/2 + 25 );\n\t\n\t// Stop the Animation\n\t\t\n\tvar playPromise = perder.play();\n\n\t if (playPromise !== undefined) {\n\t playPromise.then(_ => {\n\t perder.pause();\n\t })\n\t .catch(error => {\n\t // Auto-play was prevented\n\t // Show paused UI.\n\t console.log(\"Error...\");\n\t });\n\t }\n\tcancelRequestAnimFrame(init);\n\t\n\n\t// Set the over flag\n\tover = 1;\n\t\n\t// Show the restart button\n\tif(usuario_id !== -1)\n\t\trestartBtn.draw();\n}", "check_GameOver() {\n if (this.model.winner == 0) {\n if (this.currentPlayerBot == 0) {\n this.scene.undo_play = false;\n this.state = 'WAIT_UNDO';\n }\n else\n this.state = 'CHANGE_PLAYER';\n }\n else{\n this.state = 'GAME_OVER';\n this.scene.showGameMovie = false;\n this.view.incWinsPlayer(this.model.winner);\n }\n }", "function gameOver() {\n alert(\"Game over!!!\");\n clearInterval(game);\n\n}", "function gameOver() {\n $(\"body\").addClass(\"game-over\");\n updateTitle(\"Game Over, Press Any Key to Restart\");\n disableButtonEvent();\n setTimeout(function() {\n resetPage();\n }, 200);\n}", "function isGameOver() {\n return FallingShape.isAboveBoard();\n }", "function gameOver() {\n\t\tcontext.fillStyle = \"#F9C328\";\n\t\tcontext.textAlign=\"center\";\n\t\tcontext.shadowOffsetX = quantum/5\n\t\tcontext.shadowOffsetY = quantum/5\n\t\tcontext.shadowColor = \"black\"\n\t\tcontext.shadowBlur = quantum/5\n\t\tcontext.font = 2*quantum + \"px Bangers, cursive\";\n\t\tcontext.fillText(\"You scored \" + pacmans[0].score + \" points.\",context.canvas.width/2,context.canvas.height/2 + 2.5*quantum);\n\t\tcontext.font = \"bold \" + 3.5*quantum + \"px Bangers, cursive\";\n\t\tcontext.fillText(\"GAME OVER \",context.canvas.width/2, context.canvas.height/2 - 3*quantum);\n\t}", "function gameOver() {\n\n\t\tcanvas.clearRect(0,0,BOARD_SIZE * SQUARE_SIZE, BOARD_SIZE * SQUARE_SIZE);\n\t\tcanvas.font = \"26px Arial\";\n\t\tcanvas.textAlign = 'center';\n\t\tcanvas.fillText(\"Game Over\", 192,192);\n\t\tcanvas.font = \"17px Arial\";\n\t\t//newHighScore();\n\t\t$scope.started = false;\n\t\t$scope.paused = false;\n\t\t$scope.scoreToSave = true;\n\t\t$scope.$apply();\n\t}", "function isGameover() {\n if (isFull() && noMove()) {\n alert(\"Game Over\\nYour scores is: \" + $(\".score-container\").text());\n newGame();\n }\n}", "function gameOver(){\n\tmarioGame.nLevel = 0;\n\tdocument.getElementById('levelnum').innerHTML= marioGame.nLevel+1;\n\tmarioGame.nTurn = 0;\n\tmarioGame.nFrame = 0;\n\tdisableElements();\n\t$('#items').children().each(function(index) {\n\t\t//if(isCompatible() == true){\n\t\t\t$(this).addClass(\"character-removed\");\n\t\t\t$(this).bind(\"webkitTransitionEnd\", removeDiv);\n\t\t\t$(this).bind(\"oTransitionEnd\", removeDiv);\n\t\t\t$(this).bind(\"otransitionend\", removeDiv);\n\t\t\t$(this).bind(\"transitionend\", removeDiv);\n\t\t\t$(this).bind(\"msTransitionEnd\", removeDiv);\n\t\t/*}\n\t\telse\n\t\t{\n\t\t\t$(this).empty();\n\t\t\t$(this).remove();\n\t\t}*/\n\t});\t\n\t$('#game').append(\"<div id='gameover'></div>\");\n\t\n\t// Remove Game over image and display start button\n\tsetTimeout(restart, 5000);\n}", "function gameOver(starsLeft) {\n if (cardsMatched == cards.length){ // Game Over!\n timerStop();\n displayWinPanel(starsLeft);\n }\n}", "gameOver() {\r\n // Supress key input at the end screen\r\n this.suppressKeyInput = true;\r\n const h1 = document.getElementById('game-over-message');\r\n const overlay = document.getElementById('overlay');\r\n overlay.style.display = 'block';\r\n if(this.missed === 5) {\r\n // Lost\r\n h1.textContent = 'Sry, you\\'ve lost the game!';\r\n overlay.className = 'lose';\r\n }\r\n else {\r\n h1.textContent = 'Well done! Game won.';\r\n overlay.className = 'win';\r\n }\r\n }", "function GameOver()\n {\n if(points > 10 || points2 > 10)\n {\n endGame();\n }\n }", "function gameOver(){\n\n\tif((playerScores[0] + playerScores[1] == 8) || (playerScores[0] == 5) || (playerScores[1] == 5)){\n\t\t$(\".card\").off(\"click\", flipCard);\n\t\tdocument.querySelector(\".timerDisplay\").innerHTML = \"Game ended!\";\n\t\treturn true;\n\t}\n\n\treturn false;\n}", "function gameOver() {\r\n\r\n var gameOverSound = new Audio(\"sounds/wrong.mp3\");\r\n gameOverSound.play();\r\n\r\n $(\"body\").addClass(\"game-over\");\r\n setTimeout(function() {\r\n $(\"body\").removeClass(\"game-over\")\r\n }, 100);\r\n\r\n $(\"#level-title\").html(\"Click here to restart\")\r\n level = 0;\r\n userInput = [];\r\n gamePattern = [];\r\n}", "dieScene() {\n this.time+=10\n ufo_sound.stop()\n if(this.count > 6){\n if(this.life <= 0) \n {\n push()\n fill(255)\n textSize(15)\n text('GAME OVER', 130, 130);\n pop()\n this.gameover()\n }\n\n else\n {\n this.changePlayer()\n }\n }\n if(this.time<100 &&this.count<6) {\n image(image_player_dead_1, this.position_x, this.position_y, this.width, this.height);\n }\n else if(this.time>=100&&this.count<6) {\n image(image_player_dead_2, this.position_x, this.position_y, this.width, this.height);\n }\n if(this.time>200) {\n this.time =0\n this.count++\n }\n}", "function gameOver() {\r\n isGameOver = true;\r\n stopAudio(loop0);\r\n stopAudio(loop1);\r\n stopAudio(loop2);\r\n\r\n //random sound\r\n if (sound) {\r\n var s = Math.floor(Math.random() * 3);\r\n switch (s) {\r\n case 0:\r\n dead0.play();\r\n break;\r\n case 1:\r\n dead1.play();\r\n break;\r\n case 2:\r\n dead2.play();\r\n default:\r\n dead2.play();\r\n }\r\n }\r\n\r\n ctx.save();\r\n\r\n ctx.drawImage(wasted, border, 0, canvasWidth - 2 * border, canvasHeight);\r\n\r\n setTimeout(gameOvertext, 1500);\r\n ctx.restore();\r\n}", "function gameOver() {\n if (bossHealth == 0) {\n clearInterval(timer)\n alert(\"Player Win!\")\n }else if (yourHealth == 0) {\n clearInterval(timer)\n alert(\"Player Lose!\")\n }\n}", "function checkTooBad() {\n\n if (xPosition === xZombiePos && yPosition === yZombiePos) {\n gameOver();\n }\n}", "winGame() {\n gameWon();\n }" ]
[ "0.84893155", "0.8010906", "0.800335", "0.79886425", "0.7971993", "0.7964767", "0.79334044", "0.7927763", "0.79084", "0.78725964", "0.78541034", "0.7815751", "0.7794266", "0.777794", "0.7767837", "0.7752036", "0.7730443", "0.7730377", "0.7717406", "0.77043515", "0.76926523", "0.7676594", "0.76587266", "0.76497763", "0.76114243", "0.76037496", "0.7595435", "0.75900483", "0.75823957", "0.755671", "0.7552474", "0.7535614", "0.7513343", "0.7508407", "0.7506583", "0.7503143", "0.74945426", "0.7462584", "0.7460787", "0.7449478", "0.7439561", "0.74352616", "0.74297947", "0.74252737", "0.7423174", "0.741088", "0.7409861", "0.74096954", "0.7409373", "0.7406978", "0.7398949", "0.7391352", "0.7389138", "0.73887265", "0.73876464", "0.7378685", "0.7376334", "0.73695356", "0.7362196", "0.7362026", "0.733721", "0.7336348", "0.73169047", "0.73075384", "0.7301376", "0.72995824", "0.7282618", "0.72801024", "0.7270285", "0.726735", "0.72652966", "0.7263512", "0.72591555", "0.72571236", "0.72560334", "0.72413534", "0.72398156", "0.7237936", "0.7236057", "0.72314763", "0.7225386", "0.72253394", "0.7225297", "0.72234297", "0.721467", "0.72144985", "0.7207458", "0.72074044", "0.72063816", "0.7201658", "0.7187559", "0.7184925", "0.71801335", "0.7178023", "0.7173485", "0.7172561", "0.7170372", "0.716679", "0.7165874", "0.7162566", "0.7162511" ]
0.0
-1
function to reset game (function called when player presses button to restart the game)
function resetGame() { questionCounter = 0; correctTally = 0; incorrectTally = 0; unansweredTally = 0; counter = 5; generateHTML(); timerWrapper(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function actionOnResetClick () {\n gameRestart();\n }", "function resetGame() {\n resetClockAndTime();\n resetMoves(); \n resetRatings();\n startGame();\n}", "function resetGame() {\n resetClockAndTime();\n resetMoves();\n resetStars();\n initGame();\n activateCards();\n startGame();\n}", "function restart(){\n myGameArea.reset();\n}", "function reset() {\n //Reset the game\n channelResetGame();\n }", "function restartGame()\n{\n\tSnake.reset();\n\tMouse.changeLocation();\n\tScoreboard.reset();\n\t\n\tenterState(\"countdown\");\n}", "function reset() {\n time = 120;\n gameRun = false;\n }", "function reset() {\n timesPlayed = -1;\n right = 0;\n wrong = 0;\n startGame ();\n }", "function resetGame() {\n gBoard = buildBoard();\n gGame.shownCount = 0;\n gGame.isOn = false;\n gLivesCount = 3;\n}", "function resetGame() {\n clearGameCards();\n resetMoves();\n resetTimer();\n}", "function reset() {\n\t\t/**\n\t\t * TODO: create initial game start page and additional\n\t\t * \tinteractivity when game resets once understand more about\n\t\t * animation\n\t\t */\n\t}", "function resetGame() {\n resetTimer();\n resetMoves();\n resetStars();\n shuffleDeck();\n resetCards();\n}", "function resetGame(){\n game_mode='';\n player_sequence=[];\n game_sequence=[];\n player_clicks = 0;\n createGame();\n}", "function resetGame() {\n counter = 0;\n }", "function restartGame() {\n\tallOpenedCards.length = 0;\n\tresetTimer();\n\tresetMoveCount();\n\tresetStar();\n\tresetCards();\n\ttoggleModal();\n\tinit();\n}", "function resetGame() {\n clearGame();\n levelSpace.innerHTML = \"Press Start/Stop to Begin\";\n}", "function resetGame() {\n userScore = 0;\n computerScore = 0;\n gameSwitch(winningScore);\n}", "function reset(){\n\n theme.play();\n\n gameState = PLAY;\n gameOver.visible = false;\n restart.visible = false;\n \n monsterGroup.destroyEach();\n \n Mario.changeAnimation(\"running\",MarioRunning);\n\n score=0;\n\n monsterGroup.destroyEach();\n\n \n}", "function resetGame() {\n // Position of prey and player will reset\n setupPrey();\n setupPlayer();\n // movement and speed of prey will reset\n movePrey();\n // sound will replay\n nightSound.play();\n // Size and color of player will reset\n playerRadius = 20;\n firegreen = 0;\n // score will reset\n preyEaten = 0;\n // prey speed will reset\n preyMaxSpeed = 4\n // All of this when game is over\n gameOver = false;\n}", "function resetGame(){\n console.log(gamePaused);\n gamePaused=false;\n console.log(gamePaused);\n if(!gamePaused && !stopGame){\n removeModal(); \n playGame();\n } else{\n removeModal();\n addCirclesToHoverBar();\n //clearing all dots of game board\n clearGameBoard();\n clearMessageBoard(); \n changeMessageBoardBG(\"none\"); \n stopGame=false;\n count=30;\n startGame();\n } \n}", "function resetGame() {\n \n // reset varaibles\n wrong = 0;\n correct = 0;\n index = -1;\n \n // Update HTML\n clearContent();\n\n // Restart game\n loadQuestion();\n }", "function reset() {\n // make a new game object\n myGame = new Game('X');\n // update the view\n updateView();\n document.getElementById(\"status\").innerHTML = \"Start Game!\";\n document.getElementById(\"reset-btn\").innerHTML = \"Reset Game\";\n}", "function resetCurrentGame() {\n clearGameCards();\n resetMoves();\n resetTimer();\n startGame();\n resetGameSound();\n}", "function restartGame() {\n stopGameClock();\n resetGameClock();\n resetMoves();\n resetStars();\n resetCards();\n shuffle();\n dealTheCards();\n hidePopUp();\n gameStart = 0;\n gameTime = 0;\n moveCount = 0;\n flippedCards = [];\n matchedCards = [];\n}", "function resetGame() {\n stopPongGame();\n\n // reset positions\n\n // reset scores\n\n // start game again\n}", "function resetGame() {\n cardShuffle();\n resetBoard();\n cardsInPlay = [];\n cardInPlayId = -1;\n}", "function reset(){\r\n gameState = PLAY;\r\n gameOver.visible = false;\r\n // restart.visible = false;\r\n enemiesGroup.destroyEach();\r\n blockGroup.destroyEach();\r\n stars1Group.destroyEach();\r\n stars2Group.destroyEach();\r\n candyGirl.addAnimation(\"running\", candygirl_running);\r\n score = 0;\r\n}", "function resetGame() {\n\tresetClockAndTime();\n\tresetMoves();\n\tresetStars();\n\tshuffleDeck();\n\tresetCards();\n\tmatched = 0;\n\ttoggledCards = [];\n}", "function resetGame() {\n stopGoodTones();\n stopErrTone();\n clearScore();\n game.genSeq = [];\n game.playerSeq = [];\n game.err = false;\n }", "function restartButton(k) {\n resetGame(k);\n }", "function resetButton() {\n $('#reset').click(function() {\n startGame(gameSpaces);\n })\n}", "function resetGame() {\n counter = 0;\n correctCounter = 0;\n incorrectCounter = 0;\n unansweredCounter = 0;\n timer = 30;\n startGame();\n timerHolder();\n }", "function resetGame () { \n\t\t\t\t\t\t\tblueNum = 0;\n\t\t\t\t\t\t greenNum = 0;\n\t\t\t\t\t\t\tredNum = 0;\n\t\t\t\t\t\t\tyellowNum = 0;\n\t\t\t\t\t\t scoreResult=0;\n\t\t\t\t\t\t\ttargetScore = 0;\n\t\t\t\t\t\t\tgetNumber(); // Restart the game and assigns new traget number\n\t\t\t\t\t\t\tscoreBoard(); // Update the score board with new values.\n\t\t}", "function reset() {\n generateLevel(0);\n Resources.setGameOver(false);\n paused = false;\n score = 0;\n lives = 3;\n level = 1;\n changeRows = false;\n pressedKeys = {\n left: false,\n right: false,\n up: false,\n down: false\n };\n }", "function gameReset() {\n totalScore = 0;\n setupGame();\n }", "function resetGame() {\n location.reload();\n }", "function resetGame() {\n location.reload()\n}", "function restartGame() {\n playGame();\n }", "function gameReset() {\n\t//maybe add gameOverStatus\n\t//initial gameStatus\n\tcounter = 100;\n\tgameOverStatus = false;\n\twindow.location.hash = \"#game-board\";\n\tmessageBoard.innerText = \"Game Start!\\n\" + \"Current Score: \" + counter + \" points\";\n\tshuffleCards();\n}", "function resetGame() {\n timer.stop();\n startGame();\n}", "function resetGame () {\n clearBoard();\n window.location.reload();\n}", "function resetGame(){\n startingLevel = 1;\n startingScore = 0;\n startingLives = 5;\n\n changeScore(startingLevel, startingScore);\n changeLevel(startingLevel);\n}", "function restartGame() {\n\tthis.game.stats.setStats();\n\t//TODO figure out how to restart the game to reset all variables.\n\tthis.game.state.start(\"Preload\");\n}", "function resetGame() {\n matched = 0;\n resetTimer();\n resetMoves();\n resetStars();\n resetCards();\n shuffleDeck();\n}", "function resetGame() {\n window.cancelAnimationFrame(anim_id);\n playing = false;\n score = 0;\n level = 1;\n new_game = true;\n speed = init_speed\n direction = ''\n snake.reset(init_speed);\n fruit.reset();\n }", "function resetGame() {\n console.log(\"resetGame was called\");\n}", "function resetGame() {\n document.location.reload(true)\n}", "function resetGameState() {\n\t\tgameOngoing = true;\n\t\tcurrentPlayer = player1;\n\t}", "function resetGame() {\n location.reload();\n}", "function resetGame () {\n resetBricks ();\n store.commit ('setScore', 0);\n store.commit ('setLives', 3);\n resetBoard ();\n draw ();\n}", "function reset(){\n score=0;\n gameTime=0;\n updateScore();\n}", "function restartGame() {\n openCards = 0;\n clearTimer();\n clearMoves();\n clearStars();\n clearBoard();\n shuffleCards();\n\n}", "function restart() {\n game.state.restart();\n}", "function restartGame() {\n state = STATES.READY;\n timer = 20;\n gameScore = 0;\n}", "function resetGame(){\n\t\n\tlocation.reload(); \n\t\n}", "function resetGame() {\n toggleMenu(Menu.MAIN);\n $('#statsOutput').hide();\n $('#ammoBarsContainer').hide();\n scene.stopMusic();\n renderer.clear(false, true, true);\n scene = new TheScene(renderer.domElement);\n}", "function resetGame() {\n\n gameOver = false;\n state = `menu`;\n\n scoreMoney = 0;\n score = 0;\n\n setup();\n\n // clearInterval of mouse \n if (minigame1) {\n clearInterval(mousePosInterval);\n }\n // Resets the fishies\n if (minigame2) {\n for (let i = 0; i < NUM_FISHIES; i++) {\n let fish = fishies[i];\n fish.reset();\n }\n }\n}", "function restart() {\n level = 1;\n gamePattern = [];\n userClickedPattern = [];\n startGame = false;\n //console.log(\"restarted\");\n}", "function restartGame() {\n state = 0;\n body.innerHTML = '';\n buildGame();\n gameOver = false;\n}", "function NewGameReset(){\n\t\tconsole.log(\"Game Reset\");\n\n\t\t\n\t\t//Clear Score value and color\n\t\tUtil.one(\"#score\").innerHTML = 0;\n\t\tUtil.one(\"#points\").setAttribute(\"class\", \"grey_background\");\n\t\tUtil.one(\"#score\").setAttribute(\"class\", \"grey_background\");\n\t\tUtil.one(\"#point_text\").setAttribute(\"class\", \"grey_background\");\n\t\t\n\t\t\n\t\t//Reset all event flags\n\t\tcrushing_in_progress = false;\n\t\tshowing_hint = true;\n\t\tlastmove = new Date().getTime();\n\t\t\n\t\t\n}", "function resetGame() {\n\n\t// show it (when page loads the bugs are hidden)\n\t$(\".bug-bg\").css({\n\t\t\"display\": \"block\"\n\t});\n\n\t// reset state vars\n\tcurrentHighestIndex = 0;\n\tnumberErrors = 0;\n\n\tplaySound('#resetSound');\n\n\t// reset visuals\n\t$(\"#currentHighestIndex\").html(currentHighestIndex);\n\t$(\"#numberErrors\").html(numberErrors);\n\t// remove all boxes\n\t$(\".hidden-btn\").removeClass(\"correct\").removeClass(\"incorrect\");\n}", "function restartGame() {\n pipesGroup.clear(true, true);\n pipesGroup.clear(true, true);\n gapsGroup.clear(true, true);\n scoreboardGroup.clear(true, true);\n player.destroy();\n gameOverBanner.visible = false;\n restartButton.visible = false;\n\n const gameScene = game.scene.scenes[0];\n prepareGame(gameScene);\n\n gameScene.physics.resume();\n}", "function resetGame() {\n gameStart();\n stopTimer();\n resetStars();\n resetCards();\n moves = 0;\n movesText.innerHTML = '0';\n second = 0;\n minute = 0;\n hour = 0;\n clock.innerHTML = '0:00';\n}", "function resetGame()\n{\n clearInterval(doAnimation);\n isfarmerRight = isseedsRight = isfoxRight = ischickenRight = false;\n \n updateImages(); //Place and size the images.\n setButtonsAndMessage(false, false, false, false, MSGINTRO);\n}", "function resetGame() {\n account.score = 0;\n account.lines = 0;\n account.level = 0;\n board.reset();\n time = { start: 0, elapsed: 0, level: LEVEL[account.level] };\n}", "function reset() {\n\t$snake.off(\"keydown\");\n\tdeleteSnake();\n\t\n\tmakeSnake();\n\tupdateScores();\n\tassignKeys();\n\tplayGame();\n}", "function gameReset(){\n\t\t\tshowAction(\"RESET!\");\n\t\t\tif(timer) gameEnd();\n\t\t\t$(\".info .timer .sec\").text(0);\n\t\t\t$(\".info .timer .sectext\").hide();\n\t\t\ttime = null;\n\t\t\tcardsleft = settings.cardcnt;\n\t\t\t$(\"#wrap-gameboard li.flip\").removeClass(\"found selected flip\");\n\t\t\t$(\"#wrap-gameboard li.hover\").removeClass(\"hover\");\n\t\t}", "resetGame() {\n\t\t//stop game\n\t\tthis.running = false\n\t\tclearInterval(this.loop);\n\n\t\t//set original values\n\t\tthis.aliens = [1, 3, 5, 7, 9, 23, 25, 27, 29, 31];\n\t\tthis.direction = 1;\n\t\tthis.ship = [104, 114, 115, 116];\n\t\tthis.missiles = [];\n\t\tthis.level = 1;\n\t\tthis.currentLevel = 1;\n\t\tthis.speed = 512;\n\t\tthis.score = 0;\n\n\t\tconsole.log(\"Game reset.\");\n\t}", "function resetGame(e) {\n playerScore = 0, computerScore = 0\n document.getElementById(\"player-score\").textContent = \"You: 0\"\n document.getElementById(\"computer-score\").textContent = \"PC: 0\"\n window['end-screen'].style.visibility = 'hidden'\n game.style.visibility = 'visible'\n}", "function gameReset() {\n\t\tquestionCounter = 0;\n\t\tcorrectGuesses = 0;\n\t\tincorrectGuesses = 0;\n\t}", "function gameReset() {\n\t\tquestionCounter = 0;\n\t\tcorrectGuesses = 0;\n\t\tincorrectGuesses = 0;\n\t}", "function gameReset() {\n\t\tquestionCounter = 0;\n\t\tcorrectGuesses = 0;\n\t\tincorrectGuesses = 0;\n\t}", "function gameReset() {\n\t\tquestionCounter = 0;\n\t\tcorrectGuesses = 0;\n\t\tincorrectGuesses = 0;\n\t}", "function resetGame() {\n // reset game by going through buttons\n for (var i=0; i < buttons.length; i++) {\n buttons[i].style.backgroundColor = ''; // change color back to original\n buttons[i].innerHTML = ''; // delete x's and o's\n }\n gameover = false;\n }", "function restartGame() {\n\tstart = false;\n}", "function gameReset() {\n location.reload();\n}", "function resetGame() {\n localStorage.setItem('Game.State', null);\n document.querySelector('.moves').textContent = \"0\";\n \n if (cardDeck) {\n cardDeck.clear();\n }\n \n cardDeck = new CarDeck();\n cardDeck.shuffle();\n bindClickEvent();\n \n cardDeck.cards.forEach(card => {\n card.closeCard()\n card.unmatch()\n });\n \n state = {\n matchingCard: null,\n isMatching: false,\n totalMoves: 0,\n elapsedSeconds: 0,\n isGameOver: false\n }\n \n updateScreenMode(true)\n }", "function resetGame(){\n setWinner(undefined)\n setPlayerBoard(()=> GameBoard('player'))\n setAiBoard(()=> GameBoard('ai'))\n setAI(() => Player('ai'))\n setIsPlayerTurn(true)\n setUpGame()\n }", "async function reset() {\n if (game == null) {\n return;\n }\n game.reset();\n await calcQValuesAndBestAction();\n game.render();\n /*\n renderSnakeGame(gameCanvas, game,\n showQValuesCheckbox.checked ? currentQValues : null);\n gameStatusSpan.textContent = 'Game started.';\n stepButton.disabled = false;\n autoPlayStopButton.disabled = false;\n */\n\n}", "function resetGame() {\n game.player1.gameScore = 0;\n game.player2.gameScore = 0;\n gameScoreIndex++;\n pointScoreIndex = 0; //for after looking at matchStats\n // gameScoreIndex = 0;\n // game.gameScoreCollection.push(pushArr);\n if (game.startSer === 'player1') {\n swal(game.player2.name + \" serves first\");\n game.startSer = 'player2';\n game.player1.curSer = false;\n game.player2.curSer = true;\n }else if (game.startSer === 'player2'){\n swal(game.player1.name + \" serves first\");\n game.startSer = 'player1';\n game.player1.curSer = true;\n game.player2.curSer = false;\n }\n }", "gameReset() {\n console.log('reset!');\n }", "function resetGame(){\n console.log('stopGame clicked');\n window.location.reload();\n}", "function reset(){\r\n $(\"#score-text\").text(\"Current high score: Level \" + topScore);\r\n $(\"#reset\").hide();\r\n gameOver = false;\r\n sequence = [];\r\n sequenceNum = 0;\r\n level = 1;\r\n start();\r\n}", "function resetGame() {\n\tusedQuestions = [];\n\ttime = 20;\n\tscore = 0;\n\twrongAnswers = 0;\n\tnoAnswer = 0;\n\t$(\"#results\").empty();\n\tsetGame();\n}", "function resetGame() {\n sequence = [];\n playerSequence = [];\n turn = 0;\n clearInterval(turnSpeed);\n clearTimeout();\n $(\"#turnsTaken\").text(\"-\");\n resetButton.classList.add(\"hide-content\");\n startButton.classList.remove(\"hide-content\");\n}", "function restartGame(){\n resetStars();\n initializeVariables();\n shuffleCards(cards);\n displayCards(cards);\n listenForCardFlip();\n $('.odometer').html(score);\n $('.resultsPopUp').hide();\n $('.placeholder').show();\n $(\"#timer\").TimeCircles().restart();\n $('#overlay').css('display', 'none');\n $(\"#try-again\").click(function(){\n restartGame();\n });\n}", "function restart() {\n\tplayer.stage = 0; // reset stage counter\n\tplayer.sprite = player.playerChar[player.stage];// reset player character\n\tplayer.resetPos(); //reset player position\n\twindow.open(\"#close\", \"_self\"); // close popup\n}", "function resetGame() {\n if (dinoStegosaurus.foodEaten + dinoTriceratops.foodEaten >= 20) {\n tornado.reset();\n }\n if (dinoStegosaurus.foodEaten + dinoTriceratops.foodEaten >= 30) {\n fire.reset();\n }\n if (dinoStegosaurus.foodEaten + dinoTriceratops.foodEaten >= 40) {\n meteor.reset();\n }\n foodLeaves.reset();\n foodBerries.reset();\n foodPlant.reset();\n dinoStegosaurus.reset();\n dinoTriceratops.reset();\n gameOverScreen = false;\n titleScreen = true;\n instructionsScreen = false;\n gameWon = false;\n}", "function resetGame() {\n deck.innerHTML = '';\n openCards = [];\n matchedCards = [];\n moves = 0;\n clickCounter = 0;\n clearInterval(timer);\n seconds = 0;\n minutes = 0;\n timer = 0;\n time.textContent = '00:00';\n generateStar(starsLost);\n starsLost = 0;\n initGame();\n}", "function reset() {\n AIRWin = 0;\n HURWin = 0;\n NORWin = 0;\n window.location.reload(false);\n}", "function resetGame() {\n game.correctAnswers = 0;\n game.incorrectAnswers = 0;\n game.unanswered = 0;\n game.time = 0;\n game.questionIndex = 0;\n clearInterval(game.intervalId);\n clearTimeout(game.timeoutID);\n}", "function resetGame() {\n\t// Repopulate card deck\n\tcardDeck = masterDeck.map(function(card) { return card }); \n\t// Empty all containers of their elements\n\t$('#game-board').html('')\n\t$('#p1-hand').html(''); \n\t$('#p2-hand').html('');\n\t$('#p1-points').html('');\n\t$('#p2-points').html('');\n\t$('#turn-count').html('');\n\t// Reset board array\n\tgameBoard = [0, 1, 2, 3, 4, 5, 6, 7, 8]; \n\t// Reset turn count\n\tturnCount = 0;\n\t// Reset points\n\tplayer1.points = 5; \n\tplayer2.points = 5;\n}", "function resetGame() {\n deck.innerHTML = '';\n tally.textContent = 0;\n seconds = 0;\n minutes = 0;\n moves = 0;\n stars.innerHTML = '';\n pairedCards = [];\n setupDeck();\n modal.style.display = 'none';\n}", "function resetGame() {\n // reset the global variables\n cardsCollected = [];\n DeckOfCards = [];\n cardOneElement = null;\n cardTwoElement = null;\n startTime = null;\n currentTurn = 0;\n gameWon = false;\n seconds = 0;\n moves = 0;\n stars = 3;\n}", "function resetGameState() {\r\n\r\n // Reset difficulty and enemy speed.\r\n increaseDifficulty.difficulty = \"start\";\r\n Enemy.v = 4;\r\n toggleEnemySpawner.spawnRate = 2000;\r\n\r\n // Clear the list of game objects.\r\n observers = [];\r\n\r\n // Reset player.\r\n player = new Player();\r\n\r\n // Reset game state data.\r\n time = 90;\r\n document.getElementById(\"time-numeric\").innerHTML = time;\r\n Player.score = 100;\r\n document.getElementById(\"score-numeric\").innerHTML = Player.score;\r\n timeAt100 = 0;\r\n}", "function resetGame() {\n generateTarget();\n generateNumbers();\n distributeNumbers();\n}", "function resetGame() {\r\n\t\r\n\t\tfor(var i=0; i<board.length; i++) {\r\n\t\t\tboard[i].innerHTML = \" \";\r\n\t\t\tboard[i].style.color = 'navy';\r\n\t\t\tboard[i].style.backgroundColor = 'transparent';\r\n\t\t}\r\n\t\tgameOver = false;\r\n\t\tempty = 9;\r\n\t\tsetMessage(player + \" gets to start.\");\r\n\t\tsetMessage2(\"Go!\");\r\n\t\tconsole.log(\"visited resetGame\");\r\n\t}", "function reset() {\n gameMode = modeSelector.options[ modeSelector.selectedIndex ].value;\n gameDifficulty = difficultySelector.options[ difficultySelector.selectedIndex ].value;\n if ( gameDifficulty === \"Easy\" ) {\n playGame( 3 );\n } else {\n playGame( 6 );\n }\n}", "function reset() {\n status.gameArr = [];\n status.level = 0;\n topLeft.off();\n topRight.off();\n bottomLeft.off();\n bottomRight.off();\n status.running = false;\n level.html(\"0\").css(\"color\", 'red');\n start.html('<i class=\"fa fa-play\"></i>').css('color', 'red');\n}", "function gameReset() {\n questionCounter = 0;\n correctGuesses = 0;\n incorrectGuesses = 0;\n }", "function resetGame() {\n moves = 0;\n match_found = 0;\n $('#deck').empty();\n $('#stars').empty();\n $('#game-deck')[0].style.display = \"\";\n $('#sucess-result')[0].style.display = \"none\";\n game_started = false;\n timer.stop();\n $('#timer').html(\"00:00:00\");\n playGame();\n}" ]
[ "0.8691483", "0.86848384", "0.86516255", "0.8635654", "0.8469898", "0.8454153", "0.8448497", "0.84446216", "0.84363186", "0.8423012", "0.84075946", "0.83964264", "0.8380649", "0.83785933", "0.83557516", "0.83191633", "0.8297104", "0.8288342", "0.8285303", "0.8280323", "0.82638127", "0.824388", "0.82384974", "0.8232667", "0.8231943", "0.8230547", "0.8229576", "0.82079375", "0.82018113", "0.819517", "0.8193613", "0.8178809", "0.81775206", "0.8175977", "0.8175241", "0.81627387", "0.81484187", "0.81472033", "0.81461746", "0.8143321", "0.81199306", "0.8118622", "0.81164473", "0.8103484", "0.80832213", "0.8080811", "0.80776477", "0.8076005", "0.8071043", "0.8068805", "0.80641633", "0.8059666", "0.8051148", "0.8048885", "0.8041789", "0.802044", "0.80143416", "0.80057937", "0.800574", "0.79961777", "0.7990186", "0.7988431", "0.79814184", "0.7981149", "0.7977412", "0.7966232", "0.79652476", "0.7957725", "0.79475397", "0.7924059", "0.7924059", "0.7924059", "0.7924059", "0.79235774", "0.7921976", "0.79207146", "0.7916743", "0.7910473", "0.7909448", "0.7907955", "0.790344", "0.79001296", "0.7895889", "0.78922963", "0.7891612", "0.78882253", "0.7873834", "0.7872882", "0.7867214", "0.7862199", "0.78620106", "0.7861278", "0.7858026", "0.78576034", "0.78550434", "0.7851614", "0.78494596", "0.7845766", "0.7843423", "0.78433216", "0.7842958" ]
0.0
-1
props: upgradeSteps, upgradeComplete, setUpgradeComplete
function UpgradeBox(props) { return rce('span', {className: 'upgrade-box'}, rce('img', {src: triangle}, null), rce('span', {className: 'cool-corners steps-and-check'}, props.upgradeSteps, rce('div', {className: 'checkbox-wrapper'}, rce(Checkbox, {checked: props.upgradeComplete, setChecked: props.setUpgradeComplete}) ) ), ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "upgrade() {}", "async function upgrade(){\n logger.log(\"info\", \"Entering upgrade\");\n try{\n await logExistingFiles();\n logger.log(\"debug\", \"|before upgrade|\"); \n let [versionToBkup, upgradeToVersion, preList] = await bkupPrevVersion();\n let sqlScripts = RESTORE_GRAPH[versionToBkup][upgradeToVersion];\n await upgradeToCurrentVersion(versionToBkup, upgradeToVersion, sqlScripts, preList); \n logger.log(\"info\", \"upgrade successful!\"); \n } catch(err){\n logger.log(\"info\", \"upgrade not done|\", err);\n }\n await logExistingFiles();\n logger.log(\"debug\", \"|after upgrade|\");\n logger.log(\"info\", \"Exiting upgrade\");\n}", "[runUpgrades](e) {\n dbUpgrades.slice((e.oldVersion || 0) - e.newVersion).forEach(fn => fn(e));\n }", "function generateUpgradeList() {\n\tfor (var i = 0; i < state.nextUpgradeUnlock; i++) {\n\t\tif (state.upgrades[i].unlocked == 1) {\n\t\t\taddPurchaseUpgrade(i);\n\t\t} else {\n\t\t\taddBoughtUpgrade(i);\n\t\t}\n\t}\n}", "function upgradeFn () {\n // == BEGIN MODULE SCOPE VARIABLES ==================================\n var\n xhiObj = this,\n\n catchFn = xhiObj.catchFn,\n commandMap = xhiObj.commandMap,\n logFn = xhiObj.logFn,\n nextFn = xhiObj.nextFn,\n packageMatrix = xhiObj.packageMatrix,\n prefixStr = xhiObj.makePrefixStr( commandMap ),\n stageStatusMap = xhiObj.stageStatusMap,\n\n aliasStr = commandMap.alias_str,\n postObj\n ;\n // == . END MODULE SCOPE VARIABLES ==================================\n\n // == BEGIN UTILITY METHODS =========================================\n // BEGIN utility /failFn/\n // Purpose: Wrap catchFn to store failure and finish\n //\n function failFn () {\n stageStatusMap[ aliasStr ] = false;\n catchFn( arguments );\n }\n // . END utility /failFn/\n // == . END UTILITY METHODS =========================================\n\n // == BEGIN EVENT HANDLERS ==========================================\n // BEGIN event handler /onOutdatedFn/\n function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }\n // . END event handler /onOutdatedFn/\n\n // BEGIN event handler /onLoadFn/\n function onLoadFn ( error_data, localNpmObj ) {\n if ( error_data ) { return catchFn( error_data ); }\n localNpmObj.outdated( onOutdatedFn );\n }\n // . END event handler /onLoadFn/\n // == . END EVENT HANDLERS ==========================================\n\n // == BEGIN MAIN ====================================================\n function mainFn () {\n logFn( prefixStr + 'Start' );\n xhiObj.npmObj.load( xhiObj.fqPkgFilename, onLoadFn );\n }\n // == . END MAIN ====================================================\n mainFn();\n}", "function buyUpgrades() {\n for (var upgrade in upgradeList) {\n upgrade = upgradeList[upgrade];\n var gameUpgrade = game.upgrades[upgrade];\n var available = (gameUpgrade.allowed > gameUpgrade.done && canAffordTwoLevel(gameUpgrade));\n\t\tif (upgrade == 'Gigastation' && game.global.world >= getPageSetting('VoidMaps')) {\n buyUpgrade('Gigastation', true, true);\n return;\n }\n if (upgrade == 'Coordination' && !canAffordCoordinationTrimps()) continue;\n if (upgrade == 'Shieldblock' && !getPageSetting('BuyShieldblock')) continue;\n if ((game.global.lastWarp >= game.buildings.Warpstation.owned && upgrade == 'Gigastation') || upgrade == 'Gigastation' && (game.global.lastWarp ? (game.buildings.Warpstation.owned < game.global.lastWarp + getPageSetting('DeltaGigastation') + 0 - gameUpgrade.allowed + gameUpgrade.done) : game.buildings.Warpstation.owned < getPageSetting('FirstGigastation'))) continue;\n if ((!game.upgrades.Scientists.done && upgrade != 'Battle') ? (available && upgrade == 'Scientists' && game.upgrades.Scientists.allowed) : (available)) {\n buyUpgrade(upgrade, true, true);\n debug('Upgraded ' + upgrade,\"*upload2\");\n }\n //skip bloodlust during scientist challenges and while we have autofight enabled.\n if (upgrade == 'Bloodlust' && game.global.challengeActive == 'Scientist' && getPageSetting('AutoFight')) continue;\n }\n}", "function upgrade(g) {\n return function (err, done) {\n if (err) { done(err); }\n g(done);\n };\n }", "init_() {\n // Add CSS marker that component upgrade is finished.\n // Useful, but beware flashes of unstyled content when relying on this.\n this.root_.dataset.mdlUpgraded = '';\n }", "upgrade() {\r\n return this.clone(App, \"Upgrade\").postCore();\r\n }", "$_doPropsUpdate(props) {\n const previousProps = this.props\n const previousState = this.state\n const propsWithDefaults = this.$_addDefaultProps(props)\n this.$_doIncreaseTransactionLevel()\n if (!this.$runningPropsUpdate && this.controllerWillReceiveProps) {\n this.$runningPropsUpdate = true\n this.controllerWillReceiveProps(propsWithDefaults)\n this.$runningPropsUpdate = false\n }\n this.$props = propsWithDefaults\n this.$_doDecreaseTransactionLevel(previousProps, previousState)\n }", "upgrade(resource) {\n this.props.changeState({resourceSelected : resource });\n tier = this.props.resource;\n console.log(resource);\n this.props.changeState({upgradeSupplies : true});\n i = gather[resource][0];\n this.props.changeState({supCost1 : i });\n i = gather[resource][1];\n this.props.changeState({supCost2 : i });\n i = gather[resource][2];\n this.props.changeState({supCost3 : i });\n i = gather[resource][3];\n this.props.changeState({supCost4 : i });\n i = gather[resource][4];\n this.props.changeState({supCost5 : i });\n i = this.props.Tier[resource + 'Tier'];\n this.props.changeState({ supTier : i });\n}", "function auto_fabric_upgrade(available_orderer_versions, orderer_docs, up_cb) {\n\t\t\tt.async.eachLimit(orderer_docs, 1, (comp_doc, async_cb) => {\n\t\t\t\tconst upgrade_to_version = find_version_to_use(available_orderer_versions, comp_doc.version);\n\t\t\t\tif (!upgrade_to_version) {\n\t\t\t\t\t// already logged, skip this component & continue\n\t\t\t\t\treturn async_cb();\n\t\t\t\t}\n\n\t\t\t\tshould_upgrade(upgrade_to_version, comp_doc, (_, should_do_upgrade) => {\n\t\t\t\t\tif (!should_do_upgrade) {\n\t\t\t\t\t\tlogger.debug('[fab upgrade] will not upgrade comp:', comp_doc._id, 'version:', comp_doc.version);\n\t\t\t\t\t\treturn async_cb();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.debug('[fab upgrade] upgrading comp:', comp_doc._id, 'version:', comp_doc.version, 'to version:', upgrade_to_version);\n\n\t\t\t\t\t\tconst fake_req = {\n\t\t\t\t\t\t\tparams: {\n\t\t\t\t\t\t\t\tathena_component_id: comp_doc._id\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\theaders: {},\n\t\t\t\t\t\t\tsession: {},\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tversion: upgrade_to_version\t\t\t\t// this is the version we will upgrade to\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\tt.deployer.update_component(fake_req, (err_resp, resp) => {\n\t\t\t\t\t\t\tif (err_resp) {\n\t\t\t\t\t\t\t\tlogger.error('[fab upgrade] failed to upgrade component. dep error.', comp_doc._id, err_resp);\n\t\t\t\t\t\t\t\treturn async_cb(err_resp, resp);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlogger.debug('[fab upgrade] successfully upgraded component:', comp_doc._id, err_resp);\n\t\t\t\t\t\t\t\twait_for_start(comp_doc, (start_err) => {\n\t\t\t\t\t\t\t\t\tif (start_err) {\n\t\t\t\t\t\t\t\t\t\tlogger.error('[fab upgrade] failed to start comp after update. all stop.', start_err);\n\t\t\t\t\t\t\t\t\t\treturn async_cb(start_err, resp);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlogger.debug('[fab upgrade] component has started:', comp_doc._id);\n\t\t\t\t\t\t\t\t\t\treturn async_cb(null, resp);\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});\n\t\t\t}, (auto_error) => {\n\t\t\t\tif (auto_error) {\n\t\t\t\t\tlogger.error('[fab upgrade] blocking error occurred during auto fabric update. stopping auto fab updates.');\n\t\t\t\t}\n\t\t\t\treturn up_cb();\n\t\t\t});\n\t\t}", "configureUpgradeAnalytics() {\n $('.btn-upgrade').each(\n (index, button) => {\n const promotionEventProperties = {\n promotion_id: 'courseware_verified_certificate_upsell',\n creative: $(button).data('creative'),\n name: 'In-Course Verification Prompt',\n position: $(button).data('position'),\n };\n CourseHome.fireSegmentEvent('Promotion Viewed', promotionEventProperties);\n $(button).click(() => {\n CourseHome.fireSegmentEvent('Promotion Clicked', promotionEventProperties);\n });\n },\n );\n }", "function getSteps() {\n return ['Marketplace Integration', 'Shipping Profile', 'Product Import','Product Sync','Import Customers'];\n }", "completeUpgrade() {\n i = this.props.resourceSelected;\n tier = this.props.supTier;\n let rq1 = this.props.supCost1;\n let rq2 = this.props.supCost2;\n let rq3 = this.props.supCost3;\n let rq4 = this.props.supCost4;\n let rq5 = this.props.supCost5;\n let r1 = this.props.wood;\n let r2 = this.props.food;\n let r3 = this.props.metal;\n let r4 = this.props.stone;\n let r5 = this.props.oil;\n console.log(rq1, rq2, rq3, rq4, rq5);\n console.log(r1, r2, r3, r4, r5);\n console.log(i);\n if (tier != 5 && rq1 <= r1 && rq2 <= r2 && rq3 <= r3 && rq4 <= r4 && rq5 <= r5) {\n console.log('leveled up!');\n let object = this.props.Tier;\n console.log(object);\n object[i + 'Tier'] = object[i + 'Tier'] + 1;\n console.log(object[i]);\n this.props.changeState({ Tier : object,\n supTier : this.props.supTier + 1,\n upgradeSupplies : false,\n wood : this.props.wood - rq1,\n food : this.props.food - rq2,\n metal : this.props.metal - rq3,\n stone : this.props.stone - rq4,\n oil : this.props.oil - rq5 });\n // updates the round supplier\n console.log(object);\n this.props.changeState({ woodAdd: 10 * object['woodTier'],\n foodAdd: 10 * object['foodTier'],\n metalAdd: 10 * object['metalTier'],\n stoneAdd: 10 * object['stoneTier'],\n oilAdd: 10 * object['oilTier'],\n // text modifier\n text1 : 'Successfully', text2 : 'Upgraded!' });\n }\n else if (tier === 5) {\n this.props.changeState({ text1 : 'This Building is', text2 : 'Max Level already' });\n console.log('cant upgrade anymore its maxed out');\n }\n else {\n this.props.changeState({ text1 : 'Not Enough Supplies', text2 : 'to upgrade.' });\n console.log('not enough resources');\n }\n}", "function purchaseUpgrade() {\n var val = $(this).attr(\"id\");\n switch (val) {\n case \"squareUpgrade\": // square\n val = squares;\n break;\n case \"circleUpgrade\": // circle\n val = circles;\n break;\n case \"triangleUpgrade\": // triangle\n val = triangles;\n break;\n case \"diamondUpgrade\": // diamonds\n val = diamonds;\n break;\n }\n\n if (currentPointValue >= val.upgradePrice) {\n if (val.upgradeTier < 4) { // upgrade cant be too high of a tier or it messes with updating image\n val.upgradeTier++; // increase tier\n currentPointValue -= val.upgradePrice; // subtract cost of upgrade from total\n val.upgradePrice *= val.upgradePriceMultiplier; // increases upgrade price\n val.pointIncrementValue *= val.upgradePointsMultiplier; // increases the points you income\n val.generateValue *= val.upgradePointsMultiplier; // increases generate value display\n updateUpgradeImage(val);\n updateUpgradeTooltip(val);\n }\n } else {\n var idUpgrade = val.name.slice(0, val.name.length - 1) + \"Upgrade\"; // change upgrade color\n console.log(\"asd\");\n\n $(`#${idUpgrade}`).addClass(\"cantAfford\");\n setTimeout(function() {\n $(`#${idUpgrade}`).removeClass(\"cantAfford\")\n }, 1000);\n }\n }", "upgrade(times) {\n if (times === undefined) {\n times = 1;\n }\n\n let downgrade = false;\n if (times < 0) {\n downgrade = true;\n times = Math.abs(times);\n }\n\n for (let i = 0; i < times; i++) {\n if (downgrade) {\n if (this.proficiency > 0) {\n this.proficiency--;\n this.ability++;\n } else if (this.ability > 0) {\n this.ability--;\n }\n } else {\n if (this.ability > 0) {\n this.ability--;\n this.proficiency++;\n } else {\n this.ability++;\n }\n }\n }\n }", "function buyUpgrades() {\n for (var upgrade in upgradeList) {\n upgrade = upgradeList[upgrade];\n var gameUpgrade = window.game.upgrades[upgrade];\n if (AutoBuyUpgrades() && gameUpgrade.allowed > gameUpgrade.done && window.canAffordTwoLevel(upgrade) /*&& !window.jobs.Scientist.locked*/ ) {\n window.buyUpgrade(upgrade);\n // window.tooltip('hide');\n document.getElementById(\"upgradesAlert\").innerHTML = '';\n }\n\n }\n }", "promoteUpdater() {}", "componentDidMount() {\n const { wizardContext, addressee } = this.props;\n addressee === \"sender\"\n ? this.setState(wizardContext.from)\n : this.setState(wizardContext.to);\n }", "async up() {\n\n this.check()\n const migrations = this.migrations;\n\n let idx = 0;\n let curStep = await this.getCurentIndex();\n this.logger.info(`latest migration run is @${curStep}`)\n\n for (let el of migrations) {\n let loopStep = ++idx;\n\n this.logger.info(\"\")\n this.logger.info(loopStep, el.fileName)\n if (loopStep > curStep) {\n\n // running migration\n await el.up()\n\n // up succeeded, we now store the result\n //this.logger.info(`saving curent migration index @${loopStep}`)\n\n await this.saveCurentIndex(loopStep, el.fileName)\n this.logger.info(`updating migration index to @${loopStep}`)\n }\n else {\n this.logger.info(`skiping migration @${loopStep} (already done <= ${curStep})`)\n }\n }\n }", "function Upgrade(name, text, price, changeName, changeString) {\n\tthis.name = name;\t\t\t\t\t// name of upgrade\n\tthis.text = text;\t\t\t\t\t// display text\n\tthis.price = price;\t\t\t\t\t// price of upgrade\n\tthis.changeName = changeName;\t\t// name of changed variable\n\tthis.changeString = changeString;\t// how to change the variable\n}", "updateComponents(opts) {\nreturn this.generateUpdatedSource(opts);\n}", "changeUpgrade(newUpgrade)\n {\n this.setState({selectedUpgrade:newUpgrade},this.sendSortData);\n }", "function addUpgradesToTable(){\n for (upgrade in upgrades){\n if (checkIfCanUpgrade(upgrade, true)){\n writeUpgradeHTML(upgrade);\n }\n }\n}", "function Upgrade(name, text, price, changeName, changeString) {\n this.name = name;\t\t\t\t\t// name of upgrade\n this.text = text;\t\t\t\t\t// display text\n this.price = price;\t\t\t\t\t// price of upgrade\n this.changeName = changeName;\t\t// name of changed variable\n this.changeString = changeString;\t// how to change the variable\n}", "tierUpgrade() {\n let temp = this.props.supTier + ' of 5 tier building';\n this.props.changeState({ text1 : 'this Resource Building is a', text2 : temp });\n}", "componentWillUpdate(nextProps, nextState, nextContext) {\n console.log('[order summary]check')\n }", "install() {\n\n }", "function getSteps() {\n return [\n \"Marketplace Integration\",\n \"Shipping Profile\",\n \"Product Import\",\n \"Product Sync\",\n \"Import Customers\",\n ];\n}", "function getSteps() {\n return ['Enter Product', 'Add Materials', 'Set Pricing'];\n }", "function onMigrationComplete(context, targetVersion, hasFailures) {\n context.logger.info('');\n context.logger.info(` ✓ Updated Angular Material to ${targetVersion}`);\n context.logger.info('');\n if (hasFailures) {\n context.logger.warn(' ⚠ Some issues were detected but could not be fixed automatically. Please check the ' +\n 'output above and fix these issues manually.');\n }\n }", "function createUpgrade(upgrade){\n var neededUpgrades = 0; //Amount of pre-requisites you have\n for (i = 0; i < upgrades[upgrade]['prerequisites'].length; i++){\n if (upgradesHave.indexOf(upgrades[upgrade]['prerequisites'][i]) > -1){\n neededUpgrades++;\n }\n }\n //If you have the needed amount of pre-requisites\n if (neededUpgrades >= upgrades[upgrade]['prerequisites'].length && !$('#area'+upgrade).length){\n //Check if its a one time upgrade that's not been bought\n if ((upgrades[upgrade]['onetime'] == 0 && upgrades[upgrade]['amount'] == 0) || upgrades[upgrade]['onetime'] == 1){\n var upgradeText = '';\n upgradeText += '<tr id=\"spacer' + upgrade + '\" class=\"spacer\"></tr><tr id=\"area' + upgrade + '\"><td id=\"' + upgrade + 'Button\" onclick=\"getUpgrade(\\''+upgrade+'\\')\" class=\"button greyed-out\">' + upgrades[upgrade]['name'] + '</td><td>' + upgrades[upgrade]['name'];\n if (upgrades[upgrade]['onetime'] == 1){\n upgradeText += ': </td><td class=\"amnt\" id=\"amnt' + upgrade + '\">' + upgrades[upgrade]['amount'] + '</td>\"';\n }\n else { upgradeText += '</td><td></td>\"'; }\n upgradeText += '<td><span class=\"amnt\">' + upgrades[upgrade]['description'] + '</span><br /><span class=\"cost\">';\n for (dolan in upgrades[upgrade]['cost']){\n upgradeText += upgrades[upgrade]['cost'][dolan] + ' ' + properName[dolan] + '; ';\n }\n upgradeText += '</span></td></tr>';\n return upgradeText;\n }\n }\n return '';\n}", "buyUpgrade(player, gameobject, upgrade_field, upgrade_config, tier){\n if(!this.players[player]){\n console.error(`Could not find player ${player}`);\n return false;\n }\n\n if(gameobject === undefined){\n console.error(`Could not find game object ${gameobject} in buyUpgrade`);\n return false;\n }\n\n if(gameobject[upgrade_field] === undefined){\n console.error(`Could not find upgrade field ${upgrade_field} in gameobject ${gameobject}`);\n return false;\n }\n\n if(upgrade_config === undefined){\n console.error(`Could not find upgrade config ${upgrade_config}`);\n return false;\n }\n\n if(tier === undefined){\n console.error(`No tier specified for upgrade`);\n return false;\n }\n\n if(tier <= gameobject[upgrade_field]){\n console.error(`Requested tier ${tier} is less than or equal to current upgrade tier for upgrade ${upgrade_field} on gameobject ${gameobject}`);\n return false;\n }\n\n if(tier >= gameobject[upgrade_field] + 2){\n console.error(`Requested tier ${tier} is more than one tier away from current tier ${gameobject[upgrade_field]} for upgrade ${upgrade_field} on gameobject ${gameobject}`);\n return false;\n }\n\n if(tier >= upgrade_config.length){\n console.error(`Requested tier ${tier} out of bounds`);\n return false;\n }\n\n if(gameobject.owner && gameobject.owner !== player){\n console.error('Cannot buy upgrade for gameobject owned by another player');\n return false;\n }\n\n if(gameobject.base && this.bases[base].owner !== player){\n console.error('Cannot buy upgrade for gameobject owned by another player');\n return false;\n }\n\n if(this.players[player].money < upgrade_config[tier].price){\n console.error(`Not enough money for upgrade purchase`);\n return false;\n }\n\n this.players[player].money -= upgrade_config[tier].price;\n gameobject.upgrade_field = tier;\n console.log(\"Upgrade purchased succesfully.\");\n }", "function getUpgrade(upgrade){\n if (checkIfCanUpgrade(upgrade)){\n if (upgrades[upgrade]['onetime'] == 1){\n $('#amnt' + upgrade).text(upgrades[upgrade]['amount']);\n }\n else{\n upgradesHave.push(upgrade);\n addUpgradesToTable();\n $('#area' + upgrade).remove();\n $('#spacer' + upgrade).remove();\n $('#upgradesBought').html($('#upgradesBought').html() + '<strong>' + upgrades[upgrade]['name'] + ': </strong>' + upgrades[upgrade]['description']+ '<br />');\n }\n upgrades[upgrade]['amount']++;\n for (dolan in upgrades[upgrade]['cost']){\n currency[dolan]['amount'] -= upgrades[upgrade]['cost'][dolan];\n }\n upgrades[upgrade]['function']();\n }\n}", "up() {}", "install() {\n installed = true;\n }", "function buyUpgrade(index) {\n\tif (money < upgrades[index-1].price || upgradesOwned[index-1]) // cannot afford or owned\n\t\treturn;\n\tmoney -= upgrades[index-1].price;\n\tupgradesOwned[index-1] = true;\n\tupgrades[index-1].upgrade();\n\t$(\"#upgradeBought\"+index).css(\"display\",\"initial\");\n\tupdateBuildings();\n}", "function init() {\n self.process = TucPackMigrationProcess.getMigrationProcess();\n self.choosedAdditionalOptions = TucPackMigrationProcess.getOptionsSelected();\n }", "buyUpgradeSale(element, index) {\n if (this.props.score.totalValue >= this.props.upgradesSale[index].price) {\n let newScore = this.props.score;\n newScore.totalValue = newScore.totalValue - this.props.upgradesSale[index].price;\n newScore.tpsSale += this.props.upgradesSale[index].perSecondBonus;\n\n let newUpgradesSale = this.props.upgradesSale[index];\n newUpgradesSale.amount++;\n newUpgradesSale.price = newUpgradesSale.initialPrice * newUpgradesSale.amount;\n newUpgradesSale.price += newUpgradesSale.price * (newUpgradesSale.amount / 10);\n newUpgradesSale.price = Math.floor(newUpgradesSale.price);\n\n this.props.updateScore(newScore);\n this.props.buyUpgradeSale(newUpgradesSale, index);\n\n //update total score and upgrade price before setting class\n if (\n this.props.score.totalValue >= this.props.upgradesSale[index].price &&\n element.disabled.substring(0, 8) === \"disabled\"\n ) {\n this.props.setUpgradeSaleClass(index, \"enabled\");\n setTimeout(() => {\n this.props.setUpgradeSaleClass(index, \"\");\n }, 1000);\n } else if (\n this.props.score.totalValue < this.props.upgradesSale[index].price &&\n element.disabled.substring(0, 8) !== \"disabled\"\n ) {\n this.props.setUpgradeSaleClass(index, \"disabled\");\n }\n }\n }", "buyUpgrade(upgrade) {\n if (this.getCookies() >= this.Model.upgrades[upgrade].price) {\n this.Model.cookieCount -= this.Model.upgrades[upgrade].price;\n this.Model.upgrades[upgrade].population += 1;\n this.Model.upgrades[upgrade].price = Math.floor(this.Model.upgrades[upgrade].price * 1.15);\n }\n }", "function onUpgradeBtnClick() {\r\n let upgradeStats = game.upgradeTower(); \r\n \r\n // figure out how to add towerstats into here TODO: fix that\r\n setTowerStatFields(upgradeStats);\r\n}", "get validUpgradeTargets() {\n return this.getListAttribute('valid_upgrade_targets');\n }", "update ({commit}, executedCmd) {\n commit('updateStep', executedCmd)\n }", "async doMigrations () {\n\t\tthis.idp = new NewRelicIDP();\n\t\tawait this.idp.initialize(this.config);\n\t\tthis.migrationHandler = new NewRelicIDPMigrationHandler({\n\t\t\tdata: this.data,\n\t\t\tlogger: console,\n\t\t\tdryRun: this.dryrun,\n\t\t\tverbose: this.verbose,\n\t\t\tthrottle: this.throttle,\n\t\t\tidp: this.idp\n\t\t});\n\n\t\tconst query = this.company ? \n\t\t\t{\n\t\t\t\t_id: this.data.companies.objectIdSafe(this.company)\n\t\t\t} : {\n\t\t\t\tlinkedNROrgId: { $exists: false },\n\t\t\t\tdeactivated: false\n\t\t\t};\n\t\tconst result = await this.data.companies.getByQuery(query, {\n\t\t\tstream: true,\n\t\t\toverrideHintRequired: true,\n\t\t\tsort: { _id: 1 }\n\t\t});\n\n\t\tlet company;\n\t\tlet totalUsersMigrated = 0;\n\t\tlet totalUsersExisting = 0;\n\t\tlet totalCompaniesMigrated = 0;\n\t\tlet totalCompaniesPartiallyMigrated = 0;\n\t\tlet totalErrors = 0;\n\t\tdo {\n\t\t\tcompany = await result.next();\n\t\t\tif (company) {\n\t\t\t\tconst info = await this.migrateCompany(company);\n\t\t\t\tif (info.error) {\n\t\t\t\t\tconsole.error(`****** COMPANY ${company.id} COULD NOT BE MIGRATED: ${info.error}`);\n\t\t\t\t\ttotalErrors++;\n\t\t\t\t} else if (info.numUserErrors) {\n\t\t\t\t\tconsole.error(`****** COMPANY ${company.id} HAD ${info.numUserErrors} THAT COULD NOT BE MIGRATED`);\n\t\t\t\t\ttotalCompaniesPartiallyMigrated++;\n\t\t\t\t} else {\n\t\t\t\t\ttotalUsersMigrated += info.numUsersMigrated;\n\t\t\t\t\ttotalUsersExisting += info.numUsersExisting;\n\t\t\t\t\ttotalCompaniesMigrated++;\n\t\t\t\t}\n\t\t\t}\n\t\t} while (company);\n\t\tresult.done();\n\t\tconst which = Commander.dryrun ? 'would have been' : 'were'\n\t\tconsole.log(`${totalCompaniesMigrated} companies and ${totalUsersMigrated} users ${which} migrated, ${totalUsersExisting} users already existed`);\n\t\tif (totalCompaniesPartiallyMigrated) {\n\t\t\tconsole.log(`${totalCompaniesPartiallyMigrated} ${which} only partially migrated`);\n\t\t}\n\t}", "updateLoadFilesActionStatus(newProps) {\n var loadFilesActionStatus = newProps.loadFilesActionStatus;\n var oldLoadFilesActionStatus = this.props.loadFilesActionStatus;\n\n if (loadFilesActionStatus && loadFilesActionStatus != oldLoadFilesActionStatus) {\n this.setState({loadFilesActionStatus: loadFilesActionStatus});\n\n return true;\n }\n }", "function BuyAndActivateUpgrade(upg) {\r\n upg.BuyUpgrade = player.currency.Currency.cmp(upg.CostToBuy);\r\n if (upg.isBought && !upg.hasFunctRan) {\r\n upg.upgradeEffectFunction();\r\n upg.hasFunctRan = true;\r\n console.log(\"upg effect has been run\");\r\n }\r\n}", "function fix_upgrades(vals) {\n if (vals.current_tab === 'Upgrades') {\n for (let k in vals.upgrades) {\n var purchase_num = k.substr(k.length-1);\n let hasDisplayed = false;\n for (let i in vals.upgrades[k]) {\n if (vals.upgrades[k][i].cost >= vals.upgrades[\"3\"][\"upgrade1\"].cost/3) {\n $(\"#upg_text_\" + purchase_num).text(\"Cannot Purchase\");\n $('#upgrade_cost_' + purchase_num + '_1').text('[ NaN ');\n $('#upgrade_text_' + purchase_num + '_1').text(\"You cannot yet handle this immense power.\");\n $('#upgrade_lbl_' + purchase_num + '_1').text(\"Unavailable\");\n hasDisplayed = true;\n break;\n } else if (i != \"type\") {\n //set up new div for same challenge unlock\n if (vals.upgrades[k][i].unlocked != true) {\n let cost = 1;\n let percentage = vals.upgrades[k][i].mul * 100;\n let usedValue = percentage - 100;\n if (purchase_num === '2') {\n usedValue = (100 - percentage) * -1;\n }\n let nextUpgrade = i;\n $(\"#upgrade_mul_\" + purchase_num + \"_1\").text(Math.floor(usedValue) + '%');\n $('#upgrade_cost_' + purchase_num + '_1').text('[ ' + truncate_bigint(cost * vals.upgrades[k][nextUpgrade].cost) + ' ');\n $('#upgrade_text_' + purchase_num + '_1').text(vals.upgrades[k][nextUpgrade].description);\n $('#upgrade_lbl_' + purchase_num + '_1').text(vals.upgrades[k][nextUpgrade].label);\n hasDisplayed = true;\n break;\n }\n }\n }\n if (hasDisplayed !== true) {\n $(\"#upgrade_mul_\" + purchase_num + \"_1\").text('1337%');\n $('#upgrade_cost_' + purchase_num + '_1').text('[ NaN');\n $('#upgrade_text_' + purchase_num + '_1').text('You cannot progress this any further.');\n $('#upgrade_lbl_' + purchase_num + '_1').text('Power maxed.'); \n }\n }\n }\n}", "function updatePromo() { }", "function checkForPluginOptionalUpgrades()\n{\n // assume that by the time we get here the plugin is loaded\n // and the user has been prompted for any required update\n // if a plugin update is available show the download button\n if (Callcast.pluginUpdateAvailable())\n {\n app.log(2, \"checkForPluginOptionalUpgrades upgrade available current \" + Callcast.GetVersion() + \" new \" + Callcast.PLUGIN_VERSION_CURRENT);\n $(\"#lower-right > #dlbtn\").css(\"display\", \"block\");\n }\n}", "function performUpgrade() {\r\n\t\t_log(3, \"-> performUpgrade()\");\r\n\t\r\n\tcreateCookie(\"TTQ_CODE_0\", \"\");\r\n\tcreateCookie(\"TTQ_CODE_1\", \"\");\t\r\n\t\t\r\n\tGM_setValue(\"TTQ_VERSION\", sCurrentVersion);\r\n\talert(\"Your Travian Task Queue script has been updated. Please check that the TTQ_CODE_0 and TTQ_CODE_1 cookies for all Travian domains were cleared. (If not sure, delete all cookies from your browser.)\");\t\r\n\t\t_log(3, \"<- performUpgrade()\");\r\n}", "function upDateAll(){\n//UIONOFF = false; \n updateSaleItems1();\n// logSales(\"Shop 1 Called\",{})\n updateSaleItems2();\n// logSales(\"Shop 2 Called\",{})\n updateSaleItems3();\n// logSales(\"Shop 3 Called\",{})\n updateSaleItems4();\n// logSales(\"Shop 4 Called\",{})\n updateSaleItems5();\n// logSales(\"Shop 5 Called\",{})\n updateSaleItems6();\n updateSaleItems7();\n}", "function on_upgrade_needed(event) {\n const request = event.target;\n const conn = request.result;\n const txn = request.transaction;\n\n if (event.oldVersion) {\n console.debug(\n 'Upgrading database from %d to %d', event.oldVersion, conn.version);\n } else {\n console.debug('Creating database with version %d', conn.version);\n }\n\n // This code does not make use of store at the moment, but its coded so as to\n // be easy to extend.\n let store;\n if (event.oldVersion) {\n store = txn.objectStore('entries');\n } else {\n store = conn.createObjectStore('entries', {keyPath: 'origin'});\n }\n}", "setupFinal() {}", "function upgradeAxe()\n\t\t\t{\n\t\t\t\tif (axeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tsharpStoneBank--;\n\t\t\t\t\tsmoothBranchBank--;\n\t\t\t\t\tropeBank--;\n\t\t\t\t}\n\t\t\t\taxeTier++;\n\t\t\t\taction(1,1,1);\n\t\t\t\tadvanceTime();\n\t\t\t\tupdateDisp();\n\t\t\t}", "function setupUI(aFailDownloads, aFailInstalls, aCallback) {\n if (gProvider)\n gProvider.unregister();\n\n gProvider = new MockProvider();\n\n for (var i = 1; i < 5; i++) {\n var addon = new MockAddon(\"test\" + i + \"@tests.mozilla.org\",\n \"Test Add-on \" + i, \"extension\");\n addon.version = \"1.0\";\n addon.userDisabled = (i > 2);\n addon.appDisabled = false;\n addon.isActive = !addon.userDisabled && !addon.appDisabled;\n\n addon.findUpdates = function(aListener, aReason, aAppVersion, aPlatformVersion) {\n var newAddon = new MockAddon(this.id, this.name, \"extension\");\n newAddon.version = \"2.0\";\n var install = new MockInstall(this.name, this.type, newAddon);\n install.existingAddon = this;\n\n install.install = function() {\n this.state = AddonManager.STATE_DOWNLOADING;\n this.callListeners(\"onDownloadStarted\");\n\n var self = this;\n executeSoon(function() {\n if (aFailDownloads) {\n self.state = AddonManager.STATE_DOWNLOAD_FAILED;\n self.callListeners(\"onDownloadFailed\");\n return;\n }\n\n self.type = self._type;\n self.addon = new MockAddon(self.existingAddon.id, self.name, self.type);\n self.addon.version = self.version;\n self.addon.pendingOperations = AddonManager.PENDING_INSTALL;\n self.addon.install = self;\n\n self.existingAddon.pendingUpgrade = self.addon;\n self.existingAddon.pendingOperations |= AddonManager.PENDING_UPGRADE;\n\n self.state = AddonManager.STATE_DOWNLOADED;\n self.callListeners(\"onDownloadEnded\");\n\n self.state = AddonManager.STATE_INSTALLING;\n self.callListeners(\"onInstallStarted\");\n\n if (aFailInstalls) {\n self.state = AddonManager.STATE_INSTALL_FAILED;\n self.callListeners(\"onInstallFailed\");\n return;\n }\n\n self.state = AddonManager.STATE_INSTALLED;\n self.callListeners(\"onInstallEnded\");\n });\n }\n\n aListener.onUpdateAvailable(this, install);\n\n aListener.onUpdateFinished(this, AddonManager.UPDATE_STATUS_NO_ERROR);\n };\n\n gProvider.addAddon(addon);\n }\n\n gWin = Services.ww.openWindow(null,\n \"chrome://mozapps/content/extensions/selectAddons.xul\",\n \"\",\n \"chrome,centerscreen,dialog,titlebar\",\n null);\n waitForFocus(function() {\n waitForView(\"select\", function() {\n var row = gWin.document.getElementById(\"select-rows\").firstChild.nextSibling;\n while (row) {\n if (!row.id || row.id.indexOf(\"@tests.mozilla.org\") < 0) {\n // not a test add-on\n row = row.nextSibling;\n continue;\n }\n\n if (row.id == \"[email protected]\" ||\n row.id == \"[email protected]\") {\n row.disable();\n }\n else {\n row.keep();\n }\n row = row.nextSibling;\n }\n\n waitForView(\"confirm\", function() {\n waitForView(\"update\", aCallback);\n EventUtils.synthesizeMouseAtCenter(gWin.document.getElementById(\"next\"), {}, gWin);\n });\n EventUtils.synthesizeMouseAtCenter(gWin.document.getElementById(\"next\"), {}, gWin);\n });\n }, gWin);\n}", "componentDidUpdate(prevProps) {\r\n if (this.props.scenarioID !== prevProps.scenarioID) {\r\n // scenario has changed or reloded\r\n this.fetchScenarioUAVs();\r\n }\r\n }", "update(props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents)\n ensureListeners(this);\n let prevProps = this._props;\n this._props = props;\n if (props.plugins) {\n props.plugins.forEach(checkStateComponent);\n this.directPlugins = props.plugins;\n }\n this.updateStateInner(props.state, prevProps);\n }", "function checkIfCanUpgrade(upgrade, bypassMoney = false){\n var check = 0;\n for (i in upgrades[upgrade]['cost']){\n if (upgrades[upgrade]['cost'][i] <= currency[i]['amount']){\n check++;\n }\n }\n if ((check == Object.keys(upgrades[upgrade]['cost']).length || bypassMoney == true) && ((upgrades[upgrade]['onetime'] == 0 && upgrades[upgrade]['amount'] == 0) || upgrades[upgrade]['onetime'] == 1)){\n var neededUpgrades = 0;\n for (i = 0; i < upgrades[upgrade]['prerequisites'].length; i++){\n if (upgradesHave.indexOf(upgrades[upgrade]['prerequisites'][i]) > -1){\n neededUpgrades++;\n }\n }\n if (neededUpgrades >= upgrades[upgrade]['prerequisites'].length){\n return true;\n }\n }\n else {\n return false;\n }\n}", "function runTest(downgradeFCV, downgradeWireVersion, maxWireVersion, cmd) {\n // When the featureCompatibilityVersion is upgrading, running hello/isMaster with internalClient\n // returns a response with minWireVersion == maxWireVersion.\n assert.commandWorked(\n adminDB.system.version.update({_id: \"featureCompatibilityVersion\"},\n {$set: {version: downgradeFCV, targetVersion: latestFCV}}));\n let res = cmdAsInternalClient(cmd);\n assert.eq(res.minWireVersion, res.maxWireVersion, tojson(res));\n assert.eq(maxWireVersion, res.maxWireVersion, tojson(res));\n\n // When the featureCompatibilityVersion is downgrading, running hello/isMaster with\n // internalClient returns a response with minWireVersion == maxWireVersion.\n assert.commandWorked(adminDB.system.version.update(\n {_id: \"featureCompatibilityVersion\"},\n {$set: {version: downgradeFCV, targetVersion: downgradeFCV, previousVersion: latestFCV}}));\n res = cmdAsInternalClient(cmd);\n assert.eq(res.minWireVersion, res.maxWireVersion, tojson(res));\n assert.eq(maxWireVersion, res.maxWireVersion, tojson(res));\n\n // When the featureCompatibilityVersion is equal to the downgrade version, running\n // hello/isMaster with internalClient returns a response with minWireVersion + 1 ==\n // maxWireVersion.\n assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: downgradeFCV}));\n res = cmdAsInternalClient(cmd);\n assert.eq(downgradeWireVersion, res.minWireVersion, tojson(res));\n assert.eq(maxWireVersion, res.maxWireVersion, tojson(res));\n\n // When the internalClient field is missing from the hello/isMaster command, the response\n // returns the full wire version range from minWireVersion == 0 to maxWireVersion == latest\n // version, even if the featureCompatibilityVersion is equal to the upgrade version.\n assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));\n res = adminDB.runCommand({[cmd]: 1});\n assert.commandWorked(res);\n assert.eq(res.minWireVersion, 0, tojson(res));\n assert.lt(res.minWireVersion, res.maxWireVersion, tojson(res));\n assert.eq(maxWireVersion, res.maxWireVersion, tojson(res));\n}", "componentWillReceiveProps(nextProps) {\n if (this.props.currentStep !== nextProps.currentStep) {\n this.onUpdateCurrStep(nextProps.currentStep);\n }\n\n this.onUpdateTxHashes(nextProps);\n\n if (this.props.loading && !nextProps.loading) {\n if (nextProps.error) {\n // We had an error\n this.props.showErrorMessage(\n `There was an error deploying the contract: ${nextProps.error}`,\n 8\n );\n } else if (nextProps.contract) {\n // Contract was deployed\n this.props.showSuccessMessage(\n DeployContractSuccess({ contract: nextProps.contract }),\n 5\n );\n }\n }\n }", "function onInstall(event) {\n event.waitUntil(self.skipWaiting());\n}", "function buyUpgrade(index) {\n if (money < upgrades[index-1].price || upgradesOwned[index-1]) // cannot afford or owned\n return;\n money -= upgrades[index-1].price;\n upgradesOwned[index-1] = true;\n upgrades[index-1].upgrade();\n $(\"#upgradeBought\"+index).css(\"display\",\"initial\");\n updateInvestments();\n}", "constructor(propertyValues){\n super(propertyValues);\n this.completedTests = new CompletedTestList();\n }", "constructor() {\n super()\n this.store = 'hello world'\n // this.steps=[\n // { \"Id\": 1, \"Name\": \"Step 1\", \"Description\": \"Installation of pc sofware\", \"Status\": 0, \"Icon\": \"gear\", \"AccountId\": \"\", \"isOpen\": false },\n // { \"Id\": 2, \"Name\": \"Step 2\", \"Description\": \"Sync your quickbooks Data\", \"Status\": 0, \"Icon\": \"refresh\", \"AccountId\": \"\", \"isOpen\": false },\n // { \"Id\": 3, \"Name\": \"Step 3\", \"Description\": \"Who do you want to email summary to\", \"Status\": 0, \"Icon\": \"email\", \"AccountId\": \"\", \"isOpen\": false },\n // { \"Id\": 4, \"Name\": \"Step 4\", \"Description\": \"Have great day (confirmation sent / received)\", \"Status\": 0, \"Icon\": \"thumbsup\", \"AccountId\": \"\", \"isOpen\": false }\n // ];\n }", "function fillUpgradeProduct(upgradeProduct, oldLicenseKey) {\n var order =\n {\n //Reset the cart session to remove everything added to the cart previously.\n 'reset': true,\n\n //Define the product path(s) and the quantity to add.\n 'products': [\n {\n 'path': upgradeProduct,\n 'quantity': 1\n }\n ],\n 'tags': {\n 'key': oldLicenseKey\n },\n\n //Specify that when this JSON object is pushed to the Store Builder Library to begin checkout process.\n 'checkout': true\n };\n\n return order;\n}", "shouldComponentUpdate(next_props){\n if (!next_props.update){\n return false;\n }\n return true;\n }", "function upUser(user){\n if (user.point > 10){\n // long upgrade logic..\n }\n}", "async init(context) {\n if (!rollup) {\n throw new Error('Rollup not found! This plugin requires Rollup to be installed');\n }\n let rollupMajorVersion = (rollup.VERSION) ? rollup.VERSION.split('.')[0] : '';\n if (rollupMajorVersion.length) {\n rollupMajorVersion = Number(rollupMajorVersion);\n if (rollupMajorVersion < 1) {\n throw new Error(' This plugin requires Rollup >= 1');\n }\n }\n // we don't force any inline props into this plugin.\n // if the user marks the dependency as `inline: true` in the browser.json, it is available\n // to be packaged inline in whatever slot name that is defined\n // This can be accessed from `LassoPageResult`.\n if (!this.path) {\n throw new Error('\"path\" property is required');\n }\n\n if (!this.type || this.type !== DEPENDENCY_TYPE) {\n throw new Error('\"type\" property is required');\n }\n\n if (!this['rollup-config'] || typeof this['rollup-config'] !== 'object') {\n throw new Error('rollup-config must be specified as an object');\n }\n\n if (this['rollup-config']) {\n this.outputOptions = this['rollup-config'].output;\n this.plugins = [];\n this.pluginList = this['rollup-config'].plugins || {};\n if (Object.keys(this.pluginList).length) {\n Object.keys(this.pluginList).forEach(keyAsPluginName => {\n const pluginObj = tryRequire(keyAsPluginName);\n if(pluginObj) {\n const pluginConfig = this.pluginList[keyAsPluginName];\n // don't uglify if it is development.\n if (keyAsPluginName === 'rollup-plugin-uglify' && context.config.cacheProfile === 'development') {\n return;\n }\n // pluginObj has to be a function\n if (typeof pluginObj === 'function') {\n // this.plugins.push(pluginObj.bind(null, pluginConfig));\n this.plugins.push(pluginObj(pluginConfig));\n } else if (typeof pluginObj === 'object' && has(pluginConfig, 'initiator')) {\n // or an object. if an object, it uses the initiator as the root fn\n // this.plugins.push(pluginObj[pluginConfig.initiator].bind(null, pluginConfig.config));\n this.plugins.push(pluginObj[pluginConfig.initiator](pluginConfig.config));\n }\n }\n });\n }\n\n if (!has(this.outputOptions, 'format')) {\n this.outputOptions.format = 'umd';\n }\n if (!has(this.outputOptions, 'exports')) {\n this.outputOptions.exports = 'auto';\n }\n if (!has(this.outputOptions, 'name')) {\n throw new Error('rollup-config must specify \"output\" option with a \"name\"');\n }\n if ((this.outputOptions.format === 'amd' || this.outputOptions.format === 'umd') && !has(this.outputOptions, 'amd')) {\n throw new Error('if output format is \"amd\" or \"umd\", rollup-config must specify \"output\" option with \"amd\" property that contains a \"id\" prop');\n }\n // we don't write to disk with this file. This is just passed into rawOutputOptions, something that Rollup expects\n this.outputOptions.file = join(__dirname, '__tmp.js');\n this.outputOptions.sourcemap = (context.config.cacheProfile === 'development' ? 'inline' : false);\n }\n // NOTE: resolvePath can be used to resolve a provided relative path to a full path\n this.path = this.resolvePath(this.path);\n }", "function upgradePickaxe()\n\t\t\t{\n\t\t\t\tif (pickaxeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tsharpStoneBank--;\n\t\t\t\t\tsmoothBranchBank--;\n\t\t\t\t\tropeBank--;\n\t\t\t\t}\n\t\t\t\tpickaxeTier++;\n\t\t\t\taction(1,1,1);\n\t\t\t\tadvanceTime();\n\t\t\t\tupdateDisp();\n\t\t\t}", "function calcSingleUpgrade () {\n\n for (const key in clickUpgrades) {\n \n cheese += clickUpgrades[key].multiplier * clickUpgrades[key].quantity\n\n} \n}", "automatic_upgrader_work_check(roomName){\n var room = Game.rooms[roomName]\n var storage = f.get([room, 'storage'])\n var controller_level = f.get([room, 'controller', 'level'])\n if (! room || ! storage || ! storage.my || ! controller_level || controller_level < 5){\n console.log('This room is not suitable for an upgrader work check: '+roomName)\n return false\n }\n \n // If there is no snapshot on file, this is the first, so just take a\n // snapshot and return\n if (! Memory.room_strategy[roomName].storage_snapshot){\n console.log('Taking initial snapshot of storage')\n Memory.room_strategy[roomName].storage_snapshot = {'tick':Game.time, 'amount':storage.store.energy}\n return Memory.room_strategy[roomName].storage_snapshot \n }\n\n // There is a snapshot on file. Let's compare to it\n var ss = Memory.room_strategy[roomName].storage_snapshot\n\n // Make sure enough time has passed\n if (Game.time - ss.tick < 9000){\n console.log((Game.time - ss.tick)+' is not enough time since the last snapshot')\n return false\n }\n\n // Since enough time has passed, set another snapshot. This won't\n // mess up our processing with ss\n Memory.room_strategy[roomName].storage_snapshot = {'tick':Game.time, 'amount':storage.store.energy}\n\n // First order of business is to fix rooms that may be drawing too much\n // If the storage is low overall, and is decreasing in amount, reduce the work parts\n if (storage.store.energy < 50000 && storage.store.energy - ss.amount < 0){\n console.log('Room is low on energy and decreasing')\n console.log('Decreasing the upgrader work parts in '+roomName)\n return this.increase_upgrader_work(roomName, -2)\n }\n // If the room is suffering great decreases in energy, reduce. \n if (storage.store.energy - ss.amount < -7000){\n console.log('Room is decreasing rapidly')\n console.log('Decreasing the upgrader work parts in '+roomName)\n return this.increase_upgrader_work(roomName, -1)\n }\n \n // Now to check for happy excesses!\n // Make sure there is enough energy\n if (storage.store.energy < 50000){\n console.log('Not enough energy in storage for increase')\n return false\n }\n // Make sure there is an increase of energy, or a continuing excess of energy\n if (storage.store.energy - ss.amount < 7000 && storage.store.energy < 600000){\n console.log('Not enough increase in storage')\n return false\n }\n\n // At this point, we know that the storage has enough energy and is\n // increasing (or has a ton of energy). Now we increase upgrader capacity.\n console.log('Increasing the upgrader work parts in '+roomName)\n return this.increase_upgrader_work(roomName, 1)\n }", "onStepUp(handler) {\n this.me.on('master', (election) => {\n handler(election);\n });\n }", "actionFinal() {\n this.generateAlertMessage(\"Good Job!\",`You won using ${this.steps} steps`,'success');\n this.reset();\n }", "getSnapshotBeforeUpdate(prevProps,prevState){\nconsole.log(\"getSnapshotBeforeUpdate\",prevProps,prevState);\n}", "async function findDepUpgrades(dep) {\n const npmDependency = await npmApi.getDependency(dep.depName);\n const upgrades =\n await versionsHelper.determineUpgrades(npmDependency, dep.currentVersion, config);\n if (upgrades.length > 0) {\n logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`);\n upgrades.forEach((upgrade) => {\n allUpgrades.push(Object.assign({}, dep, upgrade));\n });\n } else {\n logger.verbose(`${dep.depName}: No upgrades required`);\n }\n }", "function isUpgraded() {\n\treturn config.configVersion === CONFIG_VERSION;\n}", "async setup() { }", "runInstall(\n {},\n 'install-should-be-idempotent',\n async (config, reporter) => {\n expect(await getPackageVersion(config, 'dep-a')).toEqual('1.0.0');\n },\n null,\n );\n\n return runInstall({}", "function WizardMain(props) {\n\t var _this = this;\n\t\n\t var steps = [{ name: 'Doctor Diagnosis', component: _react2.default.createElement(_StepNumber2.default, { getStore: function getStore() {\n\t return _this.getStore();\n\t }, updateStore: function updateStore(u) {\n\t _this.updateStore(u);\n\t } }) }, { name: 'Personal Info', component: _react2.default.createElement(_StepNumber4.default, { getStore: function getStore() {\n\t return _this.getStore();\n\t }, updateStore: function updateStore(u) {\n\t _this.updateStore(u);\n\t } }) }, { name: 'Terms', component: _react2.default.createElement(_StepNumber6.default, { getStore: function getStore() {\n\t return _this.getStore();\n\t }, updateStore: function updateStore(u) {\n\t _this.updateStore(u);\n\t } }) }, { name: 'Your Medical Rights', component: _react2.default.createElement(_StepNumber8.default, { getStore: function getStore() {\n\t return _this.getStore();\n\t }, updateStore: function updateStore(u) {\n\t _this.updateStore(u);\n\t } }) }];\n\t\n\t return _react2.default.createElement(\n\t 'div',\n\t null,\n\t _react2.default.createElement(\n\t 'div',\n\t { className: 'step-progress', style: {\n\t width: '100%',\n\t display: 'inline-flex',\n\t flexDirection: 'column',\n\t margin: 'auto',\n\t maxWidth: 1000\n\t } },\n\t _react2.default.createElement(_WizardMainStepper2.default, null),\n\t _react2.default.createElement(\n\t 'span',\n\t { className: _WizardMain2.default['wizard-spacer'], style: {\n\t // width:'100%',\n\t display: 'inline-flex',\n\t margin: 'auto',\n\t maxWidth: 1000\n\t // visibility:'hidden'\n\t } },\n\t 'spacer'\n\t )\n\t )\n\t );\n\t}", "function install() {}", "function install() {}", "function install() {}", "function install() {}", "update(...props) {\n if (this.onUpdate && this._) {\n return this.onUpdate(...props);\n }\n }", "function onMigrationComplete(targetVersion, hasFailures) {\n console.log();\n console.log(chalk_1.default.green(` ✓ Updated Angular Material to ${targetVersion}`));\n console.log();\n if (hasFailures) {\n console.log(chalk_1.default.yellow(' ⚠ Some issues were detected but could not be fixed automatically. Please check the ' +\n 'output above and fix these issues manually.'));\n }\n}", "async function printUpgradesTable({ current, upgraded, ownersChangedDeps, time, }, options) {\n var _a, _b;\n // group\n if ((_a = options.format) === null || _a === void 0 ? void 0 : _a.includes('group')) {\n const groups = (0, version_util_1.getDependencyGroups)(upgraded, current, options);\n // eslint-disable-next-line fp/no-loops -- We must await in each iteration of the loop\n for (const { heading, packages } of groups) {\n print(options, '\\n' + heading);\n print(options, await toDependencyTable({\n from: current,\n to: packages,\n ownersChangedDeps,\n time,\n format: options.format,\n }));\n }\n }\n else {\n if ((_b = options.format) === null || _b === void 0 ? void 0 : _b.includes('lines')) {\n printSimpleJoinedString(upgraded, '\\n');\n }\n else {\n print(options, await toDependencyTable({\n from: current,\n to: upgraded,\n ownersChangedDeps,\n time,\n format: options.format,\n }));\n }\n }\n}", "diffProps(newProps, oldProps) {\n const changeFlags = diffProps(newProps, oldProps);\n\n // iterate over changedTriggers\n if (changeFlags.updateTriggersChanged) {\n for (const key in changeFlags.updateTriggersChanged) {\n if (changeFlags.updateTriggersChanged[key]) {\n this.invalidateAttribute(key);\n }\n }\n }\n\n // trigger uniform transitions\n if (changeFlags.transitionsChanged) {\n for (const key in changeFlags.transitionsChanged) {\n // prop changed and transition is enabled\n this.internalState.uniformTransitions.add(\n key,\n oldProps[key],\n newProps[key],\n newProps.transitions[key]\n );\n }\n }\n\n return this.setChangeFlags(changeFlags);\n }", "async componentDidUpdate(prevProps, prevState) {\n for (const source of this.props.sources) {\n if (!this.state.computed.sources[source.name]) {\n if (source.options.versions) {\n if (Object.keys(source.options.versions).length > 0) {\n await this.loadVersionsFromSource(source);\n }\n }\n }\n }\n }", "upgrade(times) {\n if (times === undefined) {\n times = 1;\n }\n for (let i = 0; i < times; i++) {\n if (this.ability > 0) {\n this.ability--;\n this.proficiency++;\n } else {\n this.ability++;\n }\n }\n }", "onGreeUpdate(updatedProperties, properties) {\n\t\tconst updateJson = JSON.stringify(updatedProperties);\n\t\tconst propJson = JSON.stringify(properties);\n\t\tthis.log.info('ClientPollUpdate: updatesProperties:' + updateJson);\n\t\tthis.log.info('ClientPollUpdate: nowProperties:' + propJson);\n\t\tthis.currentProperties = properties;\n\t\tif ('lights' in updatedProperties)\n\t\t\tthis.setStateAsync('lights', updatedProperties.lights == 'on' ? true : false, true);\n\t\tif ('temperature' in updatedProperties)\n\t\t\tthis.setStateAsync('temperature', updatedProperties.temperature, true);\n\t\tif ('currentTemperature' in updatedProperties)\n\t\t\tthis.setStateAsync('currentTemperature', updatedProperties.currentTemperature, true);\n\t\tif ('power' in updatedProperties)\n\t\t\tthis.setStateAsync('power', updatedProperties.power == 'on', true);\n\t\tif ('mode' in updatedProperties)\n\t\t\tthis.setStateAsync('mode', updatedProperties.mode, true);\n\t\tif ('fanSpeed' in updatedProperties)\n\t\t\tthis.setStateAsync('fanSpeed', updatedProperties.fanSpeed, true);\n\t\tif ('air' in updatedProperties)\n\t\t\tthis.setStateAsync('air', updatedProperties.air, true);\n\t\tif ('blow' in updatedProperties)\n\t\t\tthis.setStateAsync('blow', updatedProperties.blow == 'on', true);\n\t\tif ('health' in updatedProperties)\n\t\t\tthis.setStateAsync('health', updatedProperties.health == 'on', true);\n\t\tif ('sleep' in updatedProperties)\n\t\t\tthis.setStateAsync('sleep', updatedProperties.sleep == 'on', true);\n\t\tif ('quiet' in updatedProperties)\n\t\t\tthis.setStateAsync('quiet', updatedProperties.quiet, true);\n\t\tif ('turbo' in updatedProperties)\n\t\t\tthis.setStateAsync('turbo', updatedProperties.turbo == 'on', true);\n\t\tif ('powerSave' in updatedProperties)\n\t\t\tthis.setStateAsync('powerSave', updatedProperties.powerSave == 'on', true);\n\t\tif ('swingVert' in updatedProperties)\n\t\t\tthis.setStateAsync('swingVert', updatedProperties.swingVert, true);\n\t\tif ('swingHor' in updatedProperties)\n\t\t\tthis.setStateAsync('swingHor', updatedProperties.swingHor, true);\n\n\t}", "function upgradeUser(user){\r\n if (user.plint>10){\r\n // long upgrade logic...\r\n }\r\n}", "function install(data, reason) {}", "function install(data, reason) {}", "componentDidUpdate(oldProps) {\n const newProps = this.props;\n // TODO: support batch updates\n for (const prop in pick(newProps, attributesToStore)) {\n if (!isEqual(oldProps[prop], newProps[prop])) {\n if (prop in reduxActions) {\n let action;\n switch(reduxActions[prop]){\n case 'updateProps':\n action = actions[reduxActions[prop]]({\n key: prop,\n value: newProps[prop],\n });\n break;\n default:\n action = actions[reduxActions[prop]](newProps[prop]);\n }\n this.msaStore.dispatch(action);\n } else {\n console.error(prop, \" is unknown.\");\n }\n }\n }\n }", "onSetupFailed() {\n this.setUIStep(CryptohomeRecoverySetupUIState.ERROR);\n }", "upgradeWallet() {\n // Lock button\n this.okPressed = true;\n // Upgrade\n return this._Wallet.upgrade(this.common, this.selectedWallet).then(()=> {\n this._$timeout(() => {\n // Unlock button\n this.okPressed = false;\n // Clean common object\n this.common = nem.model.objects.get(\"common\");\n // Prepare wallet download link\n this._Wallet.prepareDownload(this.selectedWallet);\n // Store base64 format for safety protocol\n this.rawWallet = this._Wallet.base64Encode(this.selectedWallet);\n //\n this.needsUpgrade = false;\n this.showSafetyMeasure = true;\n });\n },\n (err) => {\n this._$timeout(() => {\n // Unlock button\n this.okPressed = false;\n // Clean common object\n this.common = nem.model.objects.get(\"common\");\n });\n })\n }", "constructor(props){\n super(props);\n this.state = {passed : 0};\n this.step = this.step.bind(this);\n }", "function fortify(\n recentUpgrades = [],\n recentWeapons = [],\n DEPOTRegistry = [],\n fortId,\n srcId = \"\",\n UpgradePlan = \"00111\",\n percentageEnergyCap = 35,\n ) {\n\n\n // 0. parse UpgradePlan\n let target = df.getPlanetWithId(fortId);\n if (isFullRank(target)) {\n //remove\n recentUpgrades = recentUpgrades.filter((v) => v.id != fortId);\n return \"DONE\"\n };\n\n if (target.owner !== df.getAccount()) { return \"NOT Owned\" };\n\n let upgradeArray = UpgradePlan.split(\"\");\n const currentRank = getPlanetRank(target);\n let branch = Number(upgradeArray[currentRank]);\n\n\n // if by error this branch already has3 upgrades\n if (target.upgradeState[branch] == 3) {\n if (branch == 1) branch = 0;\n else branch = 1;\n }\n\n // 1. upgrade if can be upgraded\n //TODO: timer can be smarter. if there is a recent upgrade, set timer to lag longer\n let recentUpgrade;\n\n // start old code block\n if (recentUpgrades.filter((v) => v.id == fortId).length == 0) {\n console.log(\"initializing recentUpgrades\");\n recentUpgrade = { id: fortId, rank: currentRank, isReady: true, timer: 0 }\n recentUpgrades.push(recentUpgrade);\n } else {\n recentUpgrade = recentUpgrades.filter((v) => v.id == fortId)[0];\n }\n\n if (recentUpgrade.isReady == false) { //too recent...\n if ((recentUpgrade.rank < currentRank)) {\n recentUpgrade.isReady == true;\n recentUpgrade.rank = currentRank;\n recentUpgrades = recentUpgrades.filter((v) => v.id != fortId);\n recentUpgrades.push(recentUpgrade);\n } else {\n return \"upgradePENDING\";\n // didnt need to return; could run logistics but too complicated \n }\n }\n\n // end old code block\n\n //==> continue to fix here \n // isReady it now guaranteed to be true \n // if upgradeTimer is set then we do the update and reset the timer\n\n if ((recentUpgrade.timer > 0) && !checkForOOMThreat()) {\n // if (planetCanUpgrade(target) && !checkForOOMThreat()) {\n terminal.println(`Upgrading to Rank ${currentRank + 1} \\n`, 'Green');\n recentUpgrade.timer = 0; //reset the timer\n recentUpgrades = recentUpgrades.filter((v) => v.id != fortId);\n recentUpgrades.push(recentUpgrade); //--<<<<\n df.upgrade(target.locationId, branch);\n // recentUpgrades...\n return \"UPGRADING\";\n }\n\n // if it is ready to upgrade, instead of upgraidng now, put in a timer to do upgrade next cycle;\n if (planetCanUpgrade(target)) {\n recentUpgrade.timer = 30;\n\n //console.log (recentUpgrade);\n recentUpgrades = recentUpgrades.filter((v) => v.id != fortId);\n recentUpgrades.push(recentUpgrade); //--<<<<\n return \"UPGRADING next cycle\";\n // return \"upgrading now\";\n }\n\n // end of upgrade section\n\n let silverTOSEND = getSilverNeededForUpgrade(target);\n\n // look for a supplier \n if (srcId === \"\") {\n srcId = findSilverSupplier(fortId, silverTOSEND, DEPOTRegistry);\n if (srcId === undefined) return \"WAITING 1\";\n }\n\n // 2. ship silver needed for next upgrade; \n let supplier = df.getPlanetWithId(srcId);\n\n if (supplier.owner === PIRATES) { return \"Silver Mine not owned\" };\n if (!isWeaponReady(recentWeapons, supplier)) { return \"TOOSOON\" };\n\n if (silverTOSEND > supplier.silver && supplier.silver == supplier.silverCap)\n silverTOSEND = supplier.silverCap;\n\n if (silverTOSEND <= supplier.silver * 0.95 // dont send full silver; \n && silverTOSEND !== 0\n && (\n (planetEnergy(supplier)\n - df.getEnergyNeededForMove(srcId, fortId, 5))\n > (supplier.energyCap * percentageEnergyCap / 100)\n )) {\n let FORCES = Math.ceil(df.getEnergyNeededForMove(srcId, fortId, 1));\n terminal.println(\"[FORTIFY]: Sending...\");\n seldonMove(supplier, target, FORCES, silverTOSEND, recentWeapons);\n return \"Sending Silver\";\n } else {\n // console.log (silverTOSEND, supplier);\n return \"WAITING 2\";\n }\n\n // 4. call it DONE if srcId has no more silver and it does produce silver\n // (note, upgrade and move action can happen in one go; they are inpendent)\n\n } // Routine FORTIFY ENDS ", "function UpdateProgressMetrics(){\n // Calculate percentage of module progress\n perbaspro = baspro/20*100;\n perpospro = pospro/20*100;\n perfol1pro = fol1pro/20*100;\n perfol2pro = fol2pro/20*100;\n perbashrqpro = bashrqpro/6*100;\n perposhrqpro = poshrqpro/6*100;\n perfol1hrqpro = fol1hrqpro/6*100;\n perfol2hrqpro = fol2hrqpro/6*100;\n perbasmitakpro = basmitakpro/37*100;\n perposmitakpro = posmitakpro/37*100;\n perfol1mitakpro = fol1mitakpro/37*100;\n perfol2mitakpro = fol2mitakpro/37*100;\n permipro = mipro/6*100;\n peroarspro = oarspro/58*100;\n pertarpro = tarpro/33*100;\n perevokpro = evokpro/100*100;\n perplanpro = planpro/11*100;\n perfullmipro = fullmipro/1*100;\n \n // Calculate percentage of skill acquisition based on correct items\n affirmcount = UpdateProgressResponseCorrect(oarsanswercorrect5) + UpdateProgressResponseCorrect(oarsanswercorrect6);\n peraffirm = affirmcount/15*100;\n \n reflectcount = UpdateProgressResponseCorrect(oarsanswercorrect4) + UpdateProgressResponseCorrect(targetanswercorrect2);\n perreflect = reflectcount/11*100;\n \n openclosecount = UpdateProgressResponseCorrect(oarsanswercorrect1) + UpdateProgressResponseCorrect(oarsanswercorrect2) + UpdateProgressResponseCorrect(oarsanswercorrect3);\n peropenclose = openclosecount/39*100;\n \n targetcount = UpdateProgressResponseCorrect(targetanswercorrect1);\n pertarget = targetcount/13*100;\n \n changetalkcount = UpdateProgressResponseCorrect(evokanswercorrect1) + UpdateProgressResponseCorrect(evokanswercorrect2) + UpdateProgressResponseCorrect(evokanswercorrect3) + UpdateProgressResponseCorrect(evokanswercorrect4) + UpdateProgressResponseCorrect(evokanswercorrect5);\n perchangetalk = changetalkcount/88*100;\n \n}" ]
[ "0.637879", "0.5989545", "0.5688554", "0.5596042", "0.5468055", "0.5439752", "0.54389423", "0.5422736", "0.5419075", "0.5405851", "0.5319746", "0.5292955", "0.52844745", "0.52463245", "0.524178", "0.52223927", "0.5215805", "0.52133083", "0.5199023", "0.5161679", "0.51441133", "0.5125495", "0.5120444", "0.5102468", "0.5100973", "0.5064097", "0.5019941", "0.50075984", "0.49811596", "0.49749973", "0.4974382", "0.49606088", "0.49331704", "0.49238154", "0.49103445", "0.4904201", "0.4894691", "0.48939237", "0.48875389", "0.4879362", "0.48637557", "0.48569518", "0.48556417", "0.48549393", "0.48548836", "0.4846134", "0.48317614", "0.4826195", "0.482155", "0.48211154", "0.48178425", "0.4803809", "0.47969383", "0.4786228", "0.47859493", "0.47829756", "0.4777679", "0.47771752", "0.47759798", "0.47742882", "0.47378117", "0.4728527", "0.47281238", "0.47276893", "0.4725364", "0.4722894", "0.47200102", "0.47174564", "0.47066343", "0.4702285", "0.46997377", "0.46977592", "0.46947536", "0.46908158", "0.46873266", "0.46816525", "0.4672424", "0.46681502", "0.46627173", "0.46453327", "0.46441078", "0.46441078", "0.46441078", "0.46441078", "0.46438253", "0.46437892", "0.46424347", "0.4635639", "0.46344954", "0.46292531", "0.46251467", "0.46247113", "0.4622969", "0.4622969", "0.46215782", "0.46146488", "0.46073827", "0.4603955", "0.4601409", "0.4593773" ]
0.48798162
39
How many times we have retried.
function toJson(str) { // Convert the XML output into JSON var output = xt.xmlToJson(str); if(output[0].success) { rtValue = { "Product_ID":output[0].data[1].value, "PTF":output[0].data[2].value, "Release":output[0].data[3].value, "Option":output[0].data[4].value, "LoadID":output[0].data[5].value, "Load_State":output[0].data[6].value, }; } else rtValue = errMsg; if(async) // If it is in asynchronized mode. cb(rtValue); // Run the call back function against the returned value. stop = 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRetryTimeout() {\n return RETRY_SEC * 1000;\n }", "function getRetryLimit() {\n return 5;\n}", "function getRetryLimit() {\n return 5;\n}", "_countAttempts () {\n this.attemptsCount++\n const counter = this.shadowRoot.querySelector('.counter > h3')\n // Grammar correction depending on number of attempts.\n if (this.attemptsCount === 1) {\n counter.textContent = `${this.attemptsCount} Attempt`\n } else {\n counter.textContent = `${this.attemptsCount} Attempts`\n }\n }", "CountRemaining() {}", "_calcRemainingTime() {\n return this._remainingTestsCount;\n }", "function getRetryMultiplier() {\n return 1.5;\n}", "function getRetryMultiplier() {\n return 1.5;\n}", "retryLater(count, fn) {\n var timeout = this._timeout(count);\n\n if (this.retryTimer) clearTimeout(this.retryTimer);\n this.retryTimer = Meteor.setTimeout(fn, timeout);\n return timeout;\n }", "get attempts() {\n return this._.root.current.attempts\n }", "function timesCalled() {\n\tvar nTimes = 0;\n\treturn function() {\n\t\tnTimes++;\n\t\treturn nTimes;\n\t}\n}", "static shouldRetry() {\n return true;\n }", "function count() {\n return counter +=1;\n }", "function getInitialRetryIntervalInMilliseconds() {\n return 3000;\n}", "function getInitialRetryIntervalInMilliseconds() {\n return 3000;\n}", "function countWrongAttempts() {\n // todo: Move variable declarations to top (the let things :P)\n leftAttempts = attempts - wrongKeys.length;\n let domAttempt = document.querySelector(\"#attempts\");\n let counter = document.createElement(\"p\");\n counter.innerText = leftAttempts;\n counter.classList.add(\"counter\");\n let counterp = document.querySelector(\".counter\");\n if (counterp != null) {\n counterp.remove();\n }\n domAttempt.append(counter);\n gameOver();\n}", "function increaseCounter(){\n countNbCall++;\n if(debug){logCounter(countNbCall);}\n return countNbCall;\n }", "function tries() {\n numberOfTries++;\n $t = $('.t');\n $s = $('.s');\n $score = $('.score');\n var one = 'try';\n var more = 'tries';\n var numT = numberOfTries;\n numberOfTries > 1 || numberOfTries === 0 ? $s.html(more) : $s.html(one) ;\n $t.html(numT);\n }", "customBackoff(retryCount, err) { // eslint-disable-line\n if (!err.retryable) { return -1; }\n return 100 + retryCount * 100;\n // returns delay in ms\n }", "async waitForNewItemsCount(originalCount) {\n for (let i = 0; i < 5; i++) {\n I.wait(1);\n const count = this.getCountOfItems();\n\n if (count !== originalCount) {\n return count;\n }\n }\n\n return false;\n }", "handleImageRetries(image) {\n this.setState({ imageWorks: false }, () => {\n\n if (this.state.retryCount <= this.props.retry.count) {\n\n setTimeout(() => {\n // re-attempt fetching the image\n image.src = this.props.src;\n\n // update count and delay\n this.setState((prevState) => {\n let updateDelay;\n if (this.props.retry.accumulate === 'multiply') {\n updateDelay = prevState.retryDelay * this.props.retry.delay;\n } else if (this.props.retry.accumulate === 'add') {\n updateDelay = prevState.retryDelay + this.props.retry.delay;\n } else if (this.props.retry.accumulate === 'noop') {\n updateDelay = this.props.retry.delay;\n } else {\n updateDelay = 'multiply';\n }\n\n return {\n retryDelay: updateDelay,\n retryCount: prevState.retryCount + 1\n };\n });\n }, this.state.retryDelay * 1000);\n }\n\n });\n }", "function updateTriesCounter() {\n document.getElementById('tries').innerText = ' ' + totalMatchAttempts.length;\n}", "getTournamentOverdueCnt() {\n var cnt = 0, i; \n var d = Date.now();\n if (this.tournament.paymentdeadline != \"0\") {\n for (i = 0; i < this.players.length; i++) {\n if (this.players[i].paymentstatus == \"open\" && d > (parseInt(this.players[i].datetime) + (24*60*60*1000 * parseInt(this.tournament.paymentdeadline)))) cnt++;\n }\n }\n return cnt; \n }", "_reset() {\n this._retryState = {\n attempts: 0\n };\n }", "function trigger (retryAfter) {\n requestsMade = limitNo\n since = (Date.now() + retryAfter * 1000)\n }", "function getNumCaught(){\n\treturn s.numCaught;\n}", "function computeCountRemaining () {\n scope.countRemaining = (scope.count)\n ? (parseInt(scope.count) - scope.roleAttachments.length)\n : Number.POSITIVE_INFINITY;\n }", "function getCount() {\n return count;\n}", "function answerIsWrong() {\n count -= 5;\n}", "timeLeft() {\n if (!this.currentTimeout) {\n return 0\n }\n\n const now = new Date().getTime()\n return (this.currentTimeout.getTime() - now) / 1000\n }", "function count() {\n if (timeRemaining > 0) {\n timeRemaining--;\n $(\"#time-display\").text(\"Time Remaining: \" + timeRemaining + \" Seconds\");\n } else {\n unansweredNumber++;\n questionsCompleted++;\n clearInterval(intervalId);\n clearScreen();\n timesUpPrint();\n nextQuestion();\n }\n }", "static get RETRY() { return 2; }", "onRetry_() {\n this.userActed('retry');\n }", "function isLastAttempt() {\n if (typeof maxAttempts === 'undefined') {\n throw new Error('isLastAttempt() cannot be called before the plugin initialized');\n }\n return retriedTimes >= maxAttempts;\n}", "count() {}", "function countTestPost(i) { var k = 0; while (i--) { k++; } return k; }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retry(attempt) {\n const maxRetry = 3;\n if (attempt > maxRetry) {\n return false;\n }\n // Backoff\n Utilities.sleep(UrlFetcher.DelayMs * attempt);\n return true;\n}", "function exceededAttempts(key) {\n if(!failedAttempts[key])\n failedAttempts[key] = 0;\n failedAttempts[key]++;\n Logger.log(`Failed attempts, ${key}: ${failedAttempts[key]}`);\n if (failedAttempts[key] > maxFailedAttempts) {\n EventUtil.genSay(socket)(\"Login attempts exceeded.\");\n Logger.log(`Dropped connection; exceeded max failed login attempts, ${key}: ${failedAttempts[key]}`);\n socket.end();\n // Note: We *could* reset the count to 0 here, but we don't.\n // - The effect at that point is to reduce attempts to 1/connection\n // instead of 3/connection.\n // - Correct passwords will still succeed.\n // - And it'll get reset anyway whenever the server restarts.\n return true;\n }\n }", "N() {\n return this.maxIteration - this.iteration;\n }", "function reset(){\n setTimeout(get_count,checkInterval)\n }", "waitsCompleted(): number {\n return this._waitsCompleted;\n }", "function retry() {\n if (a.withRetry && a.retries > 0) {\n console.log(\"REST: Retrying ! %d more times with delay %s \", a.retries, a.retryInterval);\n a.retries--;\n setTimeout(rest.bind(null, type, apiCall, data, isBinary, extraHeaders, a), a.retryInterval);\n return true;\n }\n return false;\n }", "count() {\n return this.reduce(0, math_1.incr);\n }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "get maximumRetryAttemptsInput() {\n return this._maximumRetryAttempts;\n }", "getSuccessfulCatchPercentage() {\n // TODO: this\n return 1.0\n }", "function resetForTesting () {\n var length = taskQueueLength - nextIndexToProcess;\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0;\n return length\n }", "function retry_timer() {\n timer--;\n if (timer < 0) {\n clearInterval(countdown);\n if (heroes_data.length <= 0) {\n getHeroesData();\n timer = 5;\n }\n }\n}", "function GetNumTiles() {\n var tileCount = 0;\n\n for (var key in ScrabbleTiles) {\n tileCount += ScrabbleTiles[key].number_remaining;\n }\n\n return tileCount;\n}", "function getNumOfChance(){\r\n\tvar numberOfChance = chanceList.length;\r\n\treturn numberOfChance;\r\n}", "function question6 () {\n let c = 0;\n for (let i = 0; i < n; i++){\n if (data[i].who_made == \"i_did\"){\n c += 1;\n }\n } console.log(`${c} items were made by their sellers`)\n return c;\n}", "function counter() {\n\ttimerNow = Math.floor(Date.now() / 1000);\n\tcurrentTimer = timerNow - timerThen;\n\treturn currentTimer;\n}", "function rewriteCounts() {\n $(\"#mistakes\").text(\"Mistakes: \" + wrongCount);\n $(\"#remaining\").text(\"Remaining: \" + (tries - wrongCount));\n}", "function reset_counters() {\n num_connection_retries = 0;\n time_spent = 0;\n time_purchased = 0;\n}", "function timeRemaining() {\n return MAX_RUNTIME_SECONDS - timeRun();\n}", "function turnCount() {\n if (state.turnCount >= 10) return $('#turn-count').text(state.turnCount);\n $('#turn-count').text('0' + state.turnCount);\n }", "get repetitions() {\n\t\treturn this.__repetitions;\n\t}", "static get THRESHOLD () {\n return 9;\n }", "function setCountdown(quiz){\n var quizLength = 0;\n \n //will give 15 seconds per question, as to adapt to differant size quizzes.\n quizLength = quiz.length * 15;\n console.log(\"The quiz will be \" + quizLength + \" seconds\");\n return quizLength;\n}", "get count() {}", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function updateAttemptsRemaining() {\n\t\tattemptsRemainingElement.innerText = attemptsRemaining;\n\t}", "function getTestsCount (){ return this.testsCount }", "function getFlashNumOfTimesUponNewMessage() {\r\n\treturn 10;\r\n}", "count() {\n let sum = this.items.length;\n return sum;\n }", "static retry(message) {\n return new Flag(\"retry\", { message });\n }", "function getTestRunTimeout() {\n var difference = Date.now() - nextTestRun,\n pad = difference > 0 ? 0 : testInterval + Math.abs(difference);\n\n nextTestRun = Date.now() + pad;\n return pad;\n}", "function calcNextBackoff(attempts) {\n\tvar RECONNECT_INTERVAL = 1000\n\tvar MAX_RECONNECT_INTERVAL = 10000\n\tvar RECONNECT_DECAY = 1.5\n\n\tif (!attempts || attempts === -1) return 0 // first time connect\n\tvar delaytime = RECONNECT_INTERVAL * Math.pow(RECONNECT_DECAY, attempts)\n\treturn Math.min(MAX_RECONNECT_INTERVAL, delaytime)\n}", "afterCount(result, params) {\n console.log(\"Hereeeeeeeeeee 10\");\n }", "getCachedItemsCount() {\n return this.options.cache.stats.keys;\n }", "function penaltyTime () {\n secondsLeft += penaltyWrongAnswer;\n}", "function countQuestion() {\n questionCounter--;\n console.log(questionCounter);\n}", "get currentDaySubmissionFailureCount() {\n let v = this._healthReportPrefs.get(\"currentDaySubmissionFailureCount\", 0);\n\n if (!Number.isInteger(v)) {\n v = 0;\n }\n\n return v;\n }", "function countUserTrials() {\n //equals to acc += 1\n acc = acc + 1;\n counterEl.innerHTML = acc;\n}", "async function _TestCurrentConfig(Test) {\n ++TestsStarted;\n let attemptsMade = 0;\n let attemptsFailed = 0;\n const attemptsAllowed = 1 + Config.Retries;\n for (let attemptId = 1; attemptsMade < attemptsAllowed; ++attemptId) {\n try {\n ++TotalAttemptsMade;\n ++attemptsMade;\n await _TestAttempt(Test, attemptId);\n break; // stop on success\n }\n catch (error) {\n ++attemptsFailed;\n if (attemptsMade < attemptsAllowed) {\n const progress = attemptsFailed + \"/\" + attemptsAllowed;\n console.log(`Test attempt failure (${progress}):`, error);\n // keep going\n } else {\n console.log(`Test failure`);\n throw error;\n }\n }\n }\n\n // success\n if (attemptsMade > 1)\n console.log(\"Probability of a test failure:\", attemptsFailed, \"/\", attemptsMade, \"=\", Gadgets.PrettyPercent(attemptsFailed, attemptsMade));\n}", "function timeOut() {\n if (counter === 0) {\n yourWrong(true);\n }; \n }", "set attempts(attempts) {\n // This is done differently to avoid a massive performance penalty.\n var calculated = Math.floor(Math.max(attempts, 0))\n var test = this._.root.current\n\n test.attempts = calculated || test.parent.attempts\n }", "timeTaken(){\n var resultTime = this._endTime - this._startTime; \n var diff = Math.ceil(resultTime / 1000); \n this._timeTaken = diff;\n return diff ;\n }", "function runAgain(respectInterval) {\n\t\t\tif (respectInterval && options.retries && options.interval) {\n\t\t\t\tsetTimeout(runAgain, options.interval *\n\t\t\t\t\tMath.pow(options.factor, options.attempts));\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.retries--;\n\t\t\t\toptions.attempts++;\n\t\t\t\tattempt(tryFunc, options, callback);\n\t\t\t}\n\t\t}", "function countDownTimer(num) {\n if (num === 0) return \"Happy New Year!\";\n const _count = () => {\n num -= 1;\n if (num <= 0) {\n return \"Happy New Year!\";\n } else {\n return _count;\n }\n };\n return _count;\n}", "_activeRiddleCount () {\n return this._activeQueue.filter(r => r.active && !(this._config.get('alwaysAutoquiz') && r.quizzerId === this._clientId)).length\n }", "function timeTaken() {\n let t = -1;\n for (let i = 0; i < result.length; i++) {\n if (result[i].time > t) {\n t = result[i].time;\n }\n }\n\n return t;\n }", "function timedCount() {\n\t// Function call to get the results\n\tresult();\n\t\n\t// Set timer to call this function again in 4 seconds, until 16 second have passed,\n\t// c <= 4, or when search results are obtained. Then stop the timer.\n\tc += 1;\n\tif (c <= 4 && search_results.length < 1)\n\t\tt = setTimeout(\"timedCount()\", 4000);\n\telse\n\t\tstopCount();\n}", "function getDigitizeUsesRemaining() {\n return getMaximumDigitizeUses() - getDigitizeUses();\n}" ]
[ "0.6733216", "0.6695627", "0.6695627", "0.6476172", "0.634825", "0.6310979", "0.6293349", "0.6293349", "0.62714106", "0.6268611", "0.6246035", "0.6222447", "0.60690403", "0.59899974", "0.59899974", "0.5967827", "0.5910319", "0.5881494", "0.5860974", "0.58421546", "0.5817233", "0.58015794", "0.5776033", "0.5758879", "0.57370025", "0.5722594", "0.5693788", "0.5685989", "0.56825876", "0.56783396", "0.5674608", "0.56591666", "0.5646745", "0.56414026", "0.56400806", "0.5638706", "0.56229204", "0.56229204", "0.56229204", "0.55864745", "0.558571", "0.5570358", "0.55410624", "0.55304056", "0.5525382", "0.54855305", "0.5472413", "0.5472413", "0.5472413", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54623795", "0.5438228", "0.54373956", "0.5432035", "0.5416067", "0.5415293", "0.541431", "0.54121137", "0.5393147", "0.5390959", "0.53701717", "0.5360043", "0.53532094", "0.5349649", "0.53485334", "0.5344148", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.53387624", "0.5334892", "0.53254414", "0.53138614", "0.53012943", "0.52989113", "0.529701", "0.52961296", "0.52943933", "0.5286118", "0.528297", "0.5280771", "0.5280383", "0.5280263", "0.5267296", "0.5260952", "0.5259274", "0.52581716", "0.5243132", "0.5232194", "0.52188045", "0.5208206", "0.5207508", "0.52059954" ]
0.0
-1
How many times we have retried.
function toJson(str) { // Convert the XML output into JSON var output = xt.xmlToJson(str); if(output[0].success) { rtValue = { "Product_ID":output[0].data[1].value, "Release":output[0].data[2].value, "Option":output[0].data[3].value, "Load_String":output[0].data[5].value, "Load_Error":output[0].data[6].value, "Load_State":output[0].data[7].value, }; } else rtValue = errMsg; if(async) // If it is in asynchronized mode. cb(rtValue); // Run the call back function against the returned value. stop = 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRetryTimeout() {\n return RETRY_SEC * 1000;\n }", "function getRetryLimit() {\n return 5;\n}", "function getRetryLimit() {\n return 5;\n}", "_countAttempts () {\n this.attemptsCount++\n const counter = this.shadowRoot.querySelector('.counter > h3')\n // Grammar correction depending on number of attempts.\n if (this.attemptsCount === 1) {\n counter.textContent = `${this.attemptsCount} Attempt`\n } else {\n counter.textContent = `${this.attemptsCount} Attempts`\n }\n }", "CountRemaining() {}", "_calcRemainingTime() {\n return this._remainingTestsCount;\n }", "function getRetryMultiplier() {\n return 1.5;\n}", "function getRetryMultiplier() {\n return 1.5;\n}", "retryLater(count, fn) {\n var timeout = this._timeout(count);\n\n if (this.retryTimer) clearTimeout(this.retryTimer);\n this.retryTimer = Meteor.setTimeout(fn, timeout);\n return timeout;\n }", "get attempts() {\n return this._.root.current.attempts\n }", "function timesCalled() {\n\tvar nTimes = 0;\n\treturn function() {\n\t\tnTimes++;\n\t\treturn nTimes;\n\t}\n}", "static shouldRetry() {\n return true;\n }", "function count() {\n return counter +=1;\n }", "function getInitialRetryIntervalInMilliseconds() {\n return 3000;\n}", "function getInitialRetryIntervalInMilliseconds() {\n return 3000;\n}", "function countWrongAttempts() {\n // todo: Move variable declarations to top (the let things :P)\n leftAttempts = attempts - wrongKeys.length;\n let domAttempt = document.querySelector(\"#attempts\");\n let counter = document.createElement(\"p\");\n counter.innerText = leftAttempts;\n counter.classList.add(\"counter\");\n let counterp = document.querySelector(\".counter\");\n if (counterp != null) {\n counterp.remove();\n }\n domAttempt.append(counter);\n gameOver();\n}", "function increaseCounter(){\n countNbCall++;\n if(debug){logCounter(countNbCall);}\n return countNbCall;\n }", "function tries() {\n numberOfTries++;\n $t = $('.t');\n $s = $('.s');\n $score = $('.score');\n var one = 'try';\n var more = 'tries';\n var numT = numberOfTries;\n numberOfTries > 1 || numberOfTries === 0 ? $s.html(more) : $s.html(one) ;\n $t.html(numT);\n }", "customBackoff(retryCount, err) { // eslint-disable-line\n if (!err.retryable) { return -1; }\n return 100 + retryCount * 100;\n // returns delay in ms\n }", "async waitForNewItemsCount(originalCount) {\n for (let i = 0; i < 5; i++) {\n I.wait(1);\n const count = this.getCountOfItems();\n\n if (count !== originalCount) {\n return count;\n }\n }\n\n return false;\n }", "handleImageRetries(image) {\n this.setState({ imageWorks: false }, () => {\n\n if (this.state.retryCount <= this.props.retry.count) {\n\n setTimeout(() => {\n // re-attempt fetching the image\n image.src = this.props.src;\n\n // update count and delay\n this.setState((prevState) => {\n let updateDelay;\n if (this.props.retry.accumulate === 'multiply') {\n updateDelay = prevState.retryDelay * this.props.retry.delay;\n } else if (this.props.retry.accumulate === 'add') {\n updateDelay = prevState.retryDelay + this.props.retry.delay;\n } else if (this.props.retry.accumulate === 'noop') {\n updateDelay = this.props.retry.delay;\n } else {\n updateDelay = 'multiply';\n }\n\n return {\n retryDelay: updateDelay,\n retryCount: prevState.retryCount + 1\n };\n });\n }, this.state.retryDelay * 1000);\n }\n\n });\n }", "function updateTriesCounter() {\n document.getElementById('tries').innerText = ' ' + totalMatchAttempts.length;\n}", "getTournamentOverdueCnt() {\n var cnt = 0, i; \n var d = Date.now();\n if (this.tournament.paymentdeadline != \"0\") {\n for (i = 0; i < this.players.length; i++) {\n if (this.players[i].paymentstatus == \"open\" && d > (parseInt(this.players[i].datetime) + (24*60*60*1000 * parseInt(this.tournament.paymentdeadline)))) cnt++;\n }\n }\n return cnt; \n }", "_reset() {\n this._retryState = {\n attempts: 0\n };\n }", "function trigger (retryAfter) {\n requestsMade = limitNo\n since = (Date.now() + retryAfter * 1000)\n }", "function getNumCaught(){\n\treturn s.numCaught;\n}", "function computeCountRemaining () {\n scope.countRemaining = (scope.count)\n ? (parseInt(scope.count) - scope.roleAttachments.length)\n : Number.POSITIVE_INFINITY;\n }", "function getCount() {\n return count;\n}", "function answerIsWrong() {\n count -= 5;\n}", "timeLeft() {\n if (!this.currentTimeout) {\n return 0\n }\n\n const now = new Date().getTime()\n return (this.currentTimeout.getTime() - now) / 1000\n }", "function count() {\n if (timeRemaining > 0) {\n timeRemaining--;\n $(\"#time-display\").text(\"Time Remaining: \" + timeRemaining + \" Seconds\");\n } else {\n unansweredNumber++;\n questionsCompleted++;\n clearInterval(intervalId);\n clearScreen();\n timesUpPrint();\n nextQuestion();\n }\n }", "static get RETRY() { return 2; }", "onRetry_() {\n this.userActed('retry');\n }", "function isLastAttempt() {\n if (typeof maxAttempts === 'undefined') {\n throw new Error('isLastAttempt() cannot be called before the plugin initialized');\n }\n return retriedTimes >= maxAttempts;\n}", "count() {}", "function countTestPost(i) { var k = 0; while (i--) { k++; } return k; }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retry(attempt) {\n const maxRetry = 3;\n if (attempt > maxRetry) {\n return false;\n }\n // Backoff\n Utilities.sleep(UrlFetcher.DelayMs * attempt);\n return true;\n}", "function exceededAttempts(key) {\n if(!failedAttempts[key])\n failedAttempts[key] = 0;\n failedAttempts[key]++;\n Logger.log(`Failed attempts, ${key}: ${failedAttempts[key]}`);\n if (failedAttempts[key] > maxFailedAttempts) {\n EventUtil.genSay(socket)(\"Login attempts exceeded.\");\n Logger.log(`Dropped connection; exceeded max failed login attempts, ${key}: ${failedAttempts[key]}`);\n socket.end();\n // Note: We *could* reset the count to 0 here, but we don't.\n // - The effect at that point is to reduce attempts to 1/connection\n // instead of 3/connection.\n // - Correct passwords will still succeed.\n // - And it'll get reset anyway whenever the server restarts.\n return true;\n }\n }", "N() {\n return this.maxIteration - this.iteration;\n }", "function reset(){\n setTimeout(get_count,checkInterval)\n }", "waitsCompleted(): number {\n return this._waitsCompleted;\n }", "function retry() {\n if (a.withRetry && a.retries > 0) {\n console.log(\"REST: Retrying ! %d more times with delay %s \", a.retries, a.retryInterval);\n a.retries--;\n setTimeout(rest.bind(null, type, apiCall, data, isBinary, extraHeaders, a), a.retryInterval);\n return true;\n }\n return false;\n }", "count() {\n return this.reduce(0, math_1.incr);\n }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "get maximumRetryAttemptsInput() {\n return this._maximumRetryAttempts;\n }", "getSuccessfulCatchPercentage() {\n // TODO: this\n return 1.0\n }", "function resetForTesting () {\n var length = taskQueueLength - nextIndexToProcess;\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0;\n return length\n }", "function retry_timer() {\n timer--;\n if (timer < 0) {\n clearInterval(countdown);\n if (heroes_data.length <= 0) {\n getHeroesData();\n timer = 5;\n }\n }\n}", "function GetNumTiles() {\n var tileCount = 0;\n\n for (var key in ScrabbleTiles) {\n tileCount += ScrabbleTiles[key].number_remaining;\n }\n\n return tileCount;\n}", "function getNumOfChance(){\r\n\tvar numberOfChance = chanceList.length;\r\n\treturn numberOfChance;\r\n}", "function question6 () {\n let c = 0;\n for (let i = 0; i < n; i++){\n if (data[i].who_made == \"i_did\"){\n c += 1;\n }\n } console.log(`${c} items were made by their sellers`)\n return c;\n}", "function counter() {\n\ttimerNow = Math.floor(Date.now() / 1000);\n\tcurrentTimer = timerNow - timerThen;\n\treturn currentTimer;\n}", "function rewriteCounts() {\n $(\"#mistakes\").text(\"Mistakes: \" + wrongCount);\n $(\"#remaining\").text(\"Remaining: \" + (tries - wrongCount));\n}", "function reset_counters() {\n num_connection_retries = 0;\n time_spent = 0;\n time_purchased = 0;\n}", "function timeRemaining() {\n return MAX_RUNTIME_SECONDS - timeRun();\n}", "function turnCount() {\n if (state.turnCount >= 10) return $('#turn-count').text(state.turnCount);\n $('#turn-count').text('0' + state.turnCount);\n }", "get repetitions() {\n\t\treturn this.__repetitions;\n\t}", "static get THRESHOLD () {\n return 9;\n }", "function setCountdown(quiz){\n var quizLength = 0;\n \n //will give 15 seconds per question, as to adapt to differant size quizzes.\n quizLength = quiz.length * 15;\n console.log(\"The quiz will be \" + quizLength + \" seconds\");\n return quizLength;\n}", "get count() {}", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function updateAttemptsRemaining() {\n\t\tattemptsRemainingElement.innerText = attemptsRemaining;\n\t}", "function getTestsCount (){ return this.testsCount }", "function getFlashNumOfTimesUponNewMessage() {\r\n\treturn 10;\r\n}", "count() {\n let sum = this.items.length;\n return sum;\n }", "static retry(message) {\n return new Flag(\"retry\", { message });\n }", "function getTestRunTimeout() {\n var difference = Date.now() - nextTestRun,\n pad = difference > 0 ? 0 : testInterval + Math.abs(difference);\n\n nextTestRun = Date.now() + pad;\n return pad;\n}", "function calcNextBackoff(attempts) {\n\tvar RECONNECT_INTERVAL = 1000\n\tvar MAX_RECONNECT_INTERVAL = 10000\n\tvar RECONNECT_DECAY = 1.5\n\n\tif (!attempts || attempts === -1) return 0 // first time connect\n\tvar delaytime = RECONNECT_INTERVAL * Math.pow(RECONNECT_DECAY, attempts)\n\treturn Math.min(MAX_RECONNECT_INTERVAL, delaytime)\n}", "afterCount(result, params) {\n console.log(\"Hereeeeeeeeeee 10\");\n }", "getCachedItemsCount() {\n return this.options.cache.stats.keys;\n }", "function penaltyTime () {\n secondsLeft += penaltyWrongAnswer;\n}", "function countQuestion() {\n questionCounter--;\n console.log(questionCounter);\n}", "get currentDaySubmissionFailureCount() {\n let v = this._healthReportPrefs.get(\"currentDaySubmissionFailureCount\", 0);\n\n if (!Number.isInteger(v)) {\n v = 0;\n }\n\n return v;\n }", "function countUserTrials() {\n //equals to acc += 1\n acc = acc + 1;\n counterEl.innerHTML = acc;\n}", "async function _TestCurrentConfig(Test) {\n ++TestsStarted;\n let attemptsMade = 0;\n let attemptsFailed = 0;\n const attemptsAllowed = 1 + Config.Retries;\n for (let attemptId = 1; attemptsMade < attemptsAllowed; ++attemptId) {\n try {\n ++TotalAttemptsMade;\n ++attemptsMade;\n await _TestAttempt(Test, attemptId);\n break; // stop on success\n }\n catch (error) {\n ++attemptsFailed;\n if (attemptsMade < attemptsAllowed) {\n const progress = attemptsFailed + \"/\" + attemptsAllowed;\n console.log(`Test attempt failure (${progress}):`, error);\n // keep going\n } else {\n console.log(`Test failure`);\n throw error;\n }\n }\n }\n\n // success\n if (attemptsMade > 1)\n console.log(\"Probability of a test failure:\", attemptsFailed, \"/\", attemptsMade, \"=\", Gadgets.PrettyPercent(attemptsFailed, attemptsMade));\n}", "function timeOut() {\n if (counter === 0) {\n yourWrong(true);\n }; \n }", "set attempts(attempts) {\n // This is done differently to avoid a massive performance penalty.\n var calculated = Math.floor(Math.max(attempts, 0))\n var test = this._.root.current\n\n test.attempts = calculated || test.parent.attempts\n }", "timeTaken(){\n var resultTime = this._endTime - this._startTime; \n var diff = Math.ceil(resultTime / 1000); \n this._timeTaken = diff;\n return diff ;\n }", "function runAgain(respectInterval) {\n\t\t\tif (respectInterval && options.retries && options.interval) {\n\t\t\t\tsetTimeout(runAgain, options.interval *\n\t\t\t\t\tMath.pow(options.factor, options.attempts));\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.retries--;\n\t\t\t\toptions.attempts++;\n\t\t\t\tattempt(tryFunc, options, callback);\n\t\t\t}\n\t\t}", "function countDownTimer(num) {\n if (num === 0) return \"Happy New Year!\";\n const _count = () => {\n num -= 1;\n if (num <= 0) {\n return \"Happy New Year!\";\n } else {\n return _count;\n }\n };\n return _count;\n}", "_activeRiddleCount () {\n return this._activeQueue.filter(r => r.active && !(this._config.get('alwaysAutoquiz') && r.quizzerId === this._clientId)).length\n }", "function timeTaken() {\n let t = -1;\n for (let i = 0; i < result.length; i++) {\n if (result[i].time > t) {\n t = result[i].time;\n }\n }\n\n return t;\n }", "function timedCount() {\n\t// Function call to get the results\n\tresult();\n\t\n\t// Set timer to call this function again in 4 seconds, until 16 second have passed,\n\t// c <= 4, or when search results are obtained. Then stop the timer.\n\tc += 1;\n\tif (c <= 4 && search_results.length < 1)\n\t\tt = setTimeout(\"timedCount()\", 4000);\n\telse\n\t\tstopCount();\n}", "function getDigitizeUsesRemaining() {\n return getMaximumDigitizeUses() - getDigitizeUses();\n}" ]
[ "0.6733216", "0.6695627", "0.6695627", "0.6476172", "0.634825", "0.6310979", "0.6293349", "0.6293349", "0.62714106", "0.6268611", "0.6246035", "0.6222447", "0.60690403", "0.59899974", "0.59899974", "0.5967827", "0.5910319", "0.5881494", "0.5860974", "0.58421546", "0.5817233", "0.58015794", "0.5776033", "0.5758879", "0.57370025", "0.5722594", "0.5693788", "0.5685989", "0.56825876", "0.56783396", "0.5674608", "0.56591666", "0.5646745", "0.56414026", "0.56400806", "0.5638706", "0.56229204", "0.56229204", "0.56229204", "0.55864745", "0.558571", "0.5570358", "0.55410624", "0.55304056", "0.5525382", "0.54855305", "0.5472413", "0.5472413", "0.5472413", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54623795", "0.5438228", "0.54373956", "0.5432035", "0.5416067", "0.5415293", "0.541431", "0.54121137", "0.5393147", "0.5390959", "0.53701717", "0.5360043", "0.53532094", "0.5349649", "0.53485334", "0.5344148", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.53387624", "0.5334892", "0.53254414", "0.53138614", "0.53012943", "0.52989113", "0.529701", "0.52961296", "0.52943933", "0.5286118", "0.528297", "0.5280771", "0.5280383", "0.5280263", "0.5267296", "0.5260952", "0.5259274", "0.52581716", "0.5243132", "0.5232194", "0.52188045", "0.5208206", "0.5207508", "0.52059954" ]
0.0
-1
How many times we have retried.
function toJson(str) { // Convert the XML output into JSON var output = xt.xmlToJson(str); var length = output[0].data.length; var count = Number(output[0].data[length - 6].value); if(output[0].success) { for(var i = 0; i < count * 5; i+=5) rtValue.push({ "ProductID":output[0].data[i].value, "Option":output[0].data[i+1].value, "Release":output[0].data[i+2].value, "Description":output[0].data[i+4].value }); } else rtValue = errMsg; if(async) // If it is in asynchronized mode. cb(rtValue); // Run the call back function against the returned value. stop = 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRetryTimeout() {\n return RETRY_SEC * 1000;\n }", "function getRetryLimit() {\n return 5;\n}", "function getRetryLimit() {\n return 5;\n}", "_countAttempts () {\n this.attemptsCount++\n const counter = this.shadowRoot.querySelector('.counter > h3')\n // Grammar correction depending on number of attempts.\n if (this.attemptsCount === 1) {\n counter.textContent = `${this.attemptsCount} Attempt`\n } else {\n counter.textContent = `${this.attemptsCount} Attempts`\n }\n }", "CountRemaining() {}", "_calcRemainingTime() {\n return this._remainingTestsCount;\n }", "function getRetryMultiplier() {\n return 1.5;\n}", "function getRetryMultiplier() {\n return 1.5;\n}", "retryLater(count, fn) {\n var timeout = this._timeout(count);\n\n if (this.retryTimer) clearTimeout(this.retryTimer);\n this.retryTimer = Meteor.setTimeout(fn, timeout);\n return timeout;\n }", "get attempts() {\n return this._.root.current.attempts\n }", "function timesCalled() {\n\tvar nTimes = 0;\n\treturn function() {\n\t\tnTimes++;\n\t\treturn nTimes;\n\t}\n}", "static shouldRetry() {\n return true;\n }", "function count() {\n return counter +=1;\n }", "function getInitialRetryIntervalInMilliseconds() {\n return 3000;\n}", "function getInitialRetryIntervalInMilliseconds() {\n return 3000;\n}", "function countWrongAttempts() {\n // todo: Move variable declarations to top (the let things :P)\n leftAttempts = attempts - wrongKeys.length;\n let domAttempt = document.querySelector(\"#attempts\");\n let counter = document.createElement(\"p\");\n counter.innerText = leftAttempts;\n counter.classList.add(\"counter\");\n let counterp = document.querySelector(\".counter\");\n if (counterp != null) {\n counterp.remove();\n }\n domAttempt.append(counter);\n gameOver();\n}", "function increaseCounter(){\n countNbCall++;\n if(debug){logCounter(countNbCall);}\n return countNbCall;\n }", "function tries() {\n numberOfTries++;\n $t = $('.t');\n $s = $('.s');\n $score = $('.score');\n var one = 'try';\n var more = 'tries';\n var numT = numberOfTries;\n numberOfTries > 1 || numberOfTries === 0 ? $s.html(more) : $s.html(one) ;\n $t.html(numT);\n }", "customBackoff(retryCount, err) { // eslint-disable-line\n if (!err.retryable) { return -1; }\n return 100 + retryCount * 100;\n // returns delay in ms\n }", "async waitForNewItemsCount(originalCount) {\n for (let i = 0; i < 5; i++) {\n I.wait(1);\n const count = this.getCountOfItems();\n\n if (count !== originalCount) {\n return count;\n }\n }\n\n return false;\n }", "handleImageRetries(image) {\n this.setState({ imageWorks: false }, () => {\n\n if (this.state.retryCount <= this.props.retry.count) {\n\n setTimeout(() => {\n // re-attempt fetching the image\n image.src = this.props.src;\n\n // update count and delay\n this.setState((prevState) => {\n let updateDelay;\n if (this.props.retry.accumulate === 'multiply') {\n updateDelay = prevState.retryDelay * this.props.retry.delay;\n } else if (this.props.retry.accumulate === 'add') {\n updateDelay = prevState.retryDelay + this.props.retry.delay;\n } else if (this.props.retry.accumulate === 'noop') {\n updateDelay = this.props.retry.delay;\n } else {\n updateDelay = 'multiply';\n }\n\n return {\n retryDelay: updateDelay,\n retryCount: prevState.retryCount + 1\n };\n });\n }, this.state.retryDelay * 1000);\n }\n\n });\n }", "function updateTriesCounter() {\n document.getElementById('tries').innerText = ' ' + totalMatchAttempts.length;\n}", "getTournamentOverdueCnt() {\n var cnt = 0, i; \n var d = Date.now();\n if (this.tournament.paymentdeadline != \"0\") {\n for (i = 0; i < this.players.length; i++) {\n if (this.players[i].paymentstatus == \"open\" && d > (parseInt(this.players[i].datetime) + (24*60*60*1000 * parseInt(this.tournament.paymentdeadline)))) cnt++;\n }\n }\n return cnt; \n }", "_reset() {\n this._retryState = {\n attempts: 0\n };\n }", "function trigger (retryAfter) {\n requestsMade = limitNo\n since = (Date.now() + retryAfter * 1000)\n }", "function getNumCaught(){\n\treturn s.numCaught;\n}", "function computeCountRemaining () {\n scope.countRemaining = (scope.count)\n ? (parseInt(scope.count) - scope.roleAttachments.length)\n : Number.POSITIVE_INFINITY;\n }", "function getCount() {\n return count;\n}", "function answerIsWrong() {\n count -= 5;\n}", "timeLeft() {\n if (!this.currentTimeout) {\n return 0\n }\n\n const now = new Date().getTime()\n return (this.currentTimeout.getTime() - now) / 1000\n }", "function count() {\n if (timeRemaining > 0) {\n timeRemaining--;\n $(\"#time-display\").text(\"Time Remaining: \" + timeRemaining + \" Seconds\");\n } else {\n unansweredNumber++;\n questionsCompleted++;\n clearInterval(intervalId);\n clearScreen();\n timesUpPrint();\n nextQuestion();\n }\n }", "static get RETRY() { return 2; }", "onRetry_() {\n this.userActed('retry');\n }", "function isLastAttempt() {\n if (typeof maxAttempts === 'undefined') {\n throw new Error('isLastAttempt() cannot be called before the plugin initialized');\n }\n return retriedTimes >= maxAttempts;\n}", "count() {}", "function countTestPost(i) { var k = 0; while (i--) { k++; } return k; }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retryRequest() {\n\t var retryDelay = _retryDelays[requestsAttempted - 1];\n\t var retryStartTime = requestStartTime + retryDelay;\n\t // Schedule retry for a configured duration after last request started.\n\t setTimeout(sendTimedRequest, retryStartTime - Date.now());\n\t }", "function retry(attempt) {\n const maxRetry = 3;\n if (attempt > maxRetry) {\n return false;\n }\n // Backoff\n Utilities.sleep(UrlFetcher.DelayMs * attempt);\n return true;\n}", "function exceededAttempts(key) {\n if(!failedAttempts[key])\n failedAttempts[key] = 0;\n failedAttempts[key]++;\n Logger.log(`Failed attempts, ${key}: ${failedAttempts[key]}`);\n if (failedAttempts[key] > maxFailedAttempts) {\n EventUtil.genSay(socket)(\"Login attempts exceeded.\");\n Logger.log(`Dropped connection; exceeded max failed login attempts, ${key}: ${failedAttempts[key]}`);\n socket.end();\n // Note: We *could* reset the count to 0 here, but we don't.\n // - The effect at that point is to reduce attempts to 1/connection\n // instead of 3/connection.\n // - Correct passwords will still succeed.\n // - And it'll get reset anyway whenever the server restarts.\n return true;\n }\n }", "N() {\n return this.maxIteration - this.iteration;\n }", "function reset(){\n setTimeout(get_count,checkInterval)\n }", "waitsCompleted(): number {\n return this._waitsCompleted;\n }", "function retry() {\n if (a.withRetry && a.retries > 0) {\n console.log(\"REST: Retrying ! %d more times with delay %s \", a.retries, a.retryInterval);\n a.retries--;\n setTimeout(rest.bind(null, type, apiCall, data, isBinary, extraHeaders, a), a.retryInterval);\n return true;\n }\n return false;\n }", "count() {\n return this.reduce(0, math_1.incr);\n }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "function shouldRetry(attempt) {\n\t return ExecutionEnvironment.canUseDOM && attempt <= _retryDelays.length;\n\t }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "increasePendingRequestCount() {\n this._pendingCount += 1;\n this._didWork = true;\n return this._pendingCount;\n }", "get maximumRetryAttemptsInput() {\n return this._maximumRetryAttempts;\n }", "getSuccessfulCatchPercentage() {\n // TODO: this\n return 1.0\n }", "function resetForTesting () {\n var length = taskQueueLength - nextIndexToProcess;\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0;\n return length\n }", "function retry_timer() {\n timer--;\n if (timer < 0) {\n clearInterval(countdown);\n if (heroes_data.length <= 0) {\n getHeroesData();\n timer = 5;\n }\n }\n}", "function GetNumTiles() {\n var tileCount = 0;\n\n for (var key in ScrabbleTiles) {\n tileCount += ScrabbleTiles[key].number_remaining;\n }\n\n return tileCount;\n}", "function getNumOfChance(){\r\n\tvar numberOfChance = chanceList.length;\r\n\treturn numberOfChance;\r\n}", "function question6 () {\n let c = 0;\n for (let i = 0; i < n; i++){\n if (data[i].who_made == \"i_did\"){\n c += 1;\n }\n } console.log(`${c} items were made by their sellers`)\n return c;\n}", "function counter() {\n\ttimerNow = Math.floor(Date.now() / 1000);\n\tcurrentTimer = timerNow - timerThen;\n\treturn currentTimer;\n}", "function rewriteCounts() {\n $(\"#mistakes\").text(\"Mistakes: \" + wrongCount);\n $(\"#remaining\").text(\"Remaining: \" + (tries - wrongCount));\n}", "function reset_counters() {\n num_connection_retries = 0;\n time_spent = 0;\n time_purchased = 0;\n}", "function timeRemaining() {\n return MAX_RUNTIME_SECONDS - timeRun();\n}", "function turnCount() {\n if (state.turnCount >= 10) return $('#turn-count').text(state.turnCount);\n $('#turn-count').text('0' + state.turnCount);\n }", "get repetitions() {\n\t\treturn this.__repetitions;\n\t}", "static get THRESHOLD () {\n return 9;\n }", "function setCountdown(quiz){\n var quizLength = 0;\n \n //will give 15 seconds per question, as to adapt to differant size quizzes.\n quizLength = quiz.length * 15;\n console.log(\"The quiz will be \" + quizLength + \" seconds\");\n return quizLength;\n}", "get count() {}", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "decreasePendingRequestCount() {\n this._pendingCount -= 1;\n if (this._pendingCount < 0) {\n throw new Error('pending async requests below zero');\n }\n this._runCallbacksIfReady();\n return this._pendingCount;\n }", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function updateAttemptsRemaining() {\n\t\tattemptsRemainingElement.innerText = attemptsRemaining;\n\t}", "function getTestsCount (){ return this.testsCount }", "function getFlashNumOfTimesUponNewMessage() {\r\n\treturn 10;\r\n}", "count() {\n let sum = this.items.length;\n return sum;\n }", "static retry(message) {\n return new Flag(\"retry\", { message });\n }", "function getTestRunTimeout() {\n var difference = Date.now() - nextTestRun,\n pad = difference > 0 ? 0 : testInterval + Math.abs(difference);\n\n nextTestRun = Date.now() + pad;\n return pad;\n}", "function calcNextBackoff(attempts) {\n\tvar RECONNECT_INTERVAL = 1000\n\tvar MAX_RECONNECT_INTERVAL = 10000\n\tvar RECONNECT_DECAY = 1.5\n\n\tif (!attempts || attempts === -1) return 0 // first time connect\n\tvar delaytime = RECONNECT_INTERVAL * Math.pow(RECONNECT_DECAY, attempts)\n\treturn Math.min(MAX_RECONNECT_INTERVAL, delaytime)\n}", "afterCount(result, params) {\n console.log(\"Hereeeeeeeeeee 10\");\n }", "getCachedItemsCount() {\n return this.options.cache.stats.keys;\n }", "function penaltyTime () {\n secondsLeft += penaltyWrongAnswer;\n}", "function countQuestion() {\n questionCounter--;\n console.log(questionCounter);\n}", "get currentDaySubmissionFailureCount() {\n let v = this._healthReportPrefs.get(\"currentDaySubmissionFailureCount\", 0);\n\n if (!Number.isInteger(v)) {\n v = 0;\n }\n\n return v;\n }", "function countUserTrials() {\n //equals to acc += 1\n acc = acc + 1;\n counterEl.innerHTML = acc;\n}", "async function _TestCurrentConfig(Test) {\n ++TestsStarted;\n let attemptsMade = 0;\n let attemptsFailed = 0;\n const attemptsAllowed = 1 + Config.Retries;\n for (let attemptId = 1; attemptsMade < attemptsAllowed; ++attemptId) {\n try {\n ++TotalAttemptsMade;\n ++attemptsMade;\n await _TestAttempt(Test, attemptId);\n break; // stop on success\n }\n catch (error) {\n ++attemptsFailed;\n if (attemptsMade < attemptsAllowed) {\n const progress = attemptsFailed + \"/\" + attemptsAllowed;\n console.log(`Test attempt failure (${progress}):`, error);\n // keep going\n } else {\n console.log(`Test failure`);\n throw error;\n }\n }\n }\n\n // success\n if (attemptsMade > 1)\n console.log(\"Probability of a test failure:\", attemptsFailed, \"/\", attemptsMade, \"=\", Gadgets.PrettyPercent(attemptsFailed, attemptsMade));\n}", "function timeOut() {\n if (counter === 0) {\n yourWrong(true);\n }; \n }", "set attempts(attempts) {\n // This is done differently to avoid a massive performance penalty.\n var calculated = Math.floor(Math.max(attempts, 0))\n var test = this._.root.current\n\n test.attempts = calculated || test.parent.attempts\n }", "timeTaken(){\n var resultTime = this._endTime - this._startTime; \n var diff = Math.ceil(resultTime / 1000); \n this._timeTaken = diff;\n return diff ;\n }", "function runAgain(respectInterval) {\n\t\t\tif (respectInterval && options.retries && options.interval) {\n\t\t\t\tsetTimeout(runAgain, options.interval *\n\t\t\t\t\tMath.pow(options.factor, options.attempts));\n\t\t\t}\n\t\t\telse {\n\t\t\t\toptions.retries--;\n\t\t\t\toptions.attempts++;\n\t\t\t\tattempt(tryFunc, options, callback);\n\t\t\t}\n\t\t}", "function countDownTimer(num) {\n if (num === 0) return \"Happy New Year!\";\n const _count = () => {\n num -= 1;\n if (num <= 0) {\n return \"Happy New Year!\";\n } else {\n return _count;\n }\n };\n return _count;\n}", "_activeRiddleCount () {\n return this._activeQueue.filter(r => r.active && !(this._config.get('alwaysAutoquiz') && r.quizzerId === this._clientId)).length\n }", "function timeTaken() {\n let t = -1;\n for (let i = 0; i < result.length; i++) {\n if (result[i].time > t) {\n t = result[i].time;\n }\n }\n\n return t;\n }", "function timedCount() {\n\t// Function call to get the results\n\tresult();\n\t\n\t// Set timer to call this function again in 4 seconds, until 16 second have passed,\n\t// c <= 4, or when search results are obtained. Then stop the timer.\n\tc += 1;\n\tif (c <= 4 && search_results.length < 1)\n\t\tt = setTimeout(\"timedCount()\", 4000);\n\telse\n\t\tstopCount();\n}", "function getDigitizeUsesRemaining() {\n return getMaximumDigitizeUses() - getDigitizeUses();\n}" ]
[ "0.6733216", "0.6695627", "0.6695627", "0.6476172", "0.634825", "0.6310979", "0.6293349", "0.6293349", "0.62714106", "0.6268611", "0.6246035", "0.6222447", "0.60690403", "0.59899974", "0.59899974", "0.5967827", "0.5910319", "0.5881494", "0.5860974", "0.58421546", "0.5817233", "0.58015794", "0.5776033", "0.5758879", "0.57370025", "0.5722594", "0.5693788", "0.5685989", "0.56825876", "0.56783396", "0.5674608", "0.56591666", "0.5646745", "0.56414026", "0.56400806", "0.5638706", "0.56229204", "0.56229204", "0.56229204", "0.55864745", "0.558571", "0.5570358", "0.55410624", "0.55304056", "0.5525382", "0.54855305", "0.5472413", "0.5472413", "0.5472413", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54673564", "0.54623795", "0.5438228", "0.54373956", "0.5432035", "0.5416067", "0.5415293", "0.541431", "0.54121137", "0.5393147", "0.5390959", "0.53701717", "0.5360043", "0.53532094", "0.5349649", "0.53485334", "0.5344148", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.5342423", "0.53387624", "0.5334892", "0.53254414", "0.53138614", "0.53012943", "0.52989113", "0.529701", "0.52961296", "0.52943933", "0.5286118", "0.528297", "0.5280771", "0.5280383", "0.5280263", "0.5267296", "0.5260952", "0.5259274", "0.52581716", "0.5243132", "0.5232194", "0.52188045", "0.5208206", "0.5207508", "0.52059954" ]
0.0
-1
handle all other input changes
function handleInputChange(event) { event.persist(); setSuccess(false); setFormValues(currentValues => ({ ...currentValues, [event.target.name]: event.target.value, })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inputChanged() {\n parseInput(this);\n getDataFromTable();\n }", "changedInput() {\n\n\t\tlet {isValid, error} = this.state.wasInvalid ? this.validate() : this.state;\n\t\tlet onChange = this.props.onChange;\n\t\tif (onChange) {\n\t\t\tonChange(this.getValue(), isValid, error);\n\t\t}\n\t\tif (this.context.validationSchema) {\n\t\t\tlet value = this.getValue();\n\t\t\tif (this.state.isMultiSelect && value === '') {\n\t\t\t\tvalue = [];\n\t\t\t}\n\t\t\tif (this.shouldTypeBeNumberBySchemeDefinition(this.props.pointer)) {\n\t\t\t\tvalue = Number(value);\n\t\t\t}\n\t\t\tthis.context.validationParent.onValueChanged(this.props.pointer, value, isValid, error);\n\t\t}\n\t}", "function handleInputChange(event) {\n console.count('input changed');\n }", "handleInput(e) {\n if (this.props.onUpdate) { this.props.onUpdate(e.currentTarget.value) }\n }", "function handleInput() {\n\t\t\tif (onInput) {\n\t\t\t\tonInput(value);\n\t\t\t}\n\t\t}", "internalOnInput(event) {\n const me = this; // Keep the value synced with the inputValue at all times.\n\n me.inputting = true;\n me.value = me.input.value;\n me.inputting = false;\n me.trigger('input', {\n value: me.value,\n event\n });\n me.changeOnKeyStroke && me.changeOnKeyStroke(event); // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onInput\n }", "function MCH_InputChange(el_input) {\n console.log(\" ----- MCH_InputChange ----\")\n console.log(\" el_input\", el_input)\n mod_MCH_dict.has_changes = true;\n MCH_Hide_Inputboxes();\n }", "handleInput(input) {\n\t\t\n\t}", "_onInputChangeHandler(event) {\n // stops the current event\n event.stopPropagation();\n\n const handle = event.target.closest(`.${CLASSNAME_HANDLE}`);\n\n if (event.target === document.activeElement) {\n this._focus(event);\n }\n\n this._updateValue(handle, event.target.value, true);\n }", "internalOnInput(event) {\n const me = this;\n\n // Keep the value synced with the inputValue at all times.\n me.inputting = true;\n me.value = me.input.value;\n me.inputting = false;\n\n me.trigger('input', { value: me.value, event });\n\n me.changeOnKeyStroke && me.changeOnKeyStroke(event);\n\n // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onInput\n }", "function userInputChanges(e) {\n setUserInput(e.target.value);\n }", "function HandleInputChange(el_input){\n console.log(\" --- HandleInputChange ---\")\n\n const tblRow = t_get_tablerow_selected(el_input);\n const data_dict = get_datadict_from_tblRow(tblRow);\n\n if (data_dict){\n const fldName = get_attr_from_el(el_input, \"data-field\");\n const userpermit_pk = data_dict.id;\n const map_value = data_dict[fldName];\n let new_value = el_input.value;\n if(fldName === \"sequence\"){\n new_value = (Number(new_value)) ? Number(new_value) : 1;\n };\n\n if(new_value !== map_value){\n // --- create mod_dict\n const url_str = urls.url_userpermit_upload;\n const upload_dict = {mode: \"update\",\n userpermit_pk: userpermit_pk};\n upload_dict[fldName] = new_value;\n\n // --- upload changes\n UploadChanges(upload_dict, url_str);\n };\n };\n }", "function inputOnchange()\n {\n if(checkRegex())\n {\n inputClearError();\n addTokenToList();\n updateTextarea();\n return;\n }\n inputError();\n }", "handleInputChange() {\n this.setState({\n inputs: this._getInputs(),\n results: null,\n });\n }", "handleChange(e) {\n e.stopPropagation();\n const value = this.getInputEl().value;\n this.model.set({ value }, { fromInput: 1 });\n this.elementUpdated();\n }", "onInput(event) {\n const input = event.target;\n // Let's wait for DOM to be updated\n nextTick().then(() => {\n this.$emit('update:modelValue', nullify(input.value));\n });\n }", "_setOnChanges(){\n\t\tthis.inputs.forEach(i => i.addEventListener('change', this._onChange.bind(this)));\t\n\t}", "handleInput() {}", "function handleChange(e){\n setInput(e.target.value);\n }", "function handleInput(e) {\n\t\tsetInputValue(e.target.value)\n\t}", "update() {\n\t this.value = this.originalInputValue;\n\t }", "change(/*event*/) {\n this._super(...arguments);\n this._parse();\n }", "handleChange() {\n this.forceUpdate();\n }", "handleAllInputs() {\r\n this.limitInputTo(this.inputBill, 99999);\r\n this.limitInputTo(this.inputCustom, 100);\r\n this.limitInputTo(this.inputPeople, 100);\r\n }", "inputOnChange(e) {\n e.target.value = e.target.value;\n this.props.dispatch(updateStateText(e.target.value));\n }", "onInput(e) {\n this.updateFilledState();\n }", "function handleStateChange(event) {\n\n if (event.target.value === \"\") {\n console.log(`Empty value for ${event.target.name}, replacing with ${stateValuesWhenInputIsEmpty[event.target.name]}`);\n state[event.target.name] = stateValuesWhenInputIsEmpty[event.target.name];\n }\n if (isNaN(event.target.value) && event.target.name !== \"indexType\") {\n console.log(`${event.target.value} is not a valid number for ${event.target.name}, ignoring change!`);\n }\n else {\n state[event.target.name] = event.target.value;\n }\n}", "internalOnChange(event) {\n const me = this; // Don't trigger change if we enter invalid value or if value has not changed (for IE when pressing ENTER)\n\n if (me.isValid && me.hasChanged(me._lastValue, me.value)) {\n me.triggerChange(event, true);\n me._lastValue = me.value;\n }\n }", "changeInput(e, input){\n const val = e.target.value;\n this.setState(prev => { // sets the state for that input to the value\n prev.inputs[input] = val;\n return prev;\n });\n }", "afterValidChange() { }", "static get observers() {\n return [\n 'handle_input_data_changed(inputData)'\n ]\n }", "update() {\n\t if (this.originalInputValue === '') {\n\t this._reset();\n\t }\n\t }", "function inputHandle(event) {\n\t\tvar inputValue = event.target.value;\n\t\tinputValueHandle(inputValue);\n\t}", "function HandleInputChange(el_input){\n console.log(\" --- HandleInputChange ---\")\n\n const tblRow = t_get_tablerow_selected(el_input);\n const pk_int = get_attr_from_el_int(tblRow, \"data-pk\");\n const map_id = tblRow.id;\n\n console.log(\" tblRow\", tblRow)\n console.log(\" pk_int\", pk_int)\n console.log(\" map_id\", map_id)\n\n if (selected_btn === \"btn_usercomp_agg\"){\n // reset el_input.value to saved value\n const data_dict = usercomp_agg_dicts[map_id];\n el_input.value = (data_dict && data_dict.uc_meetings) ? data_dict.uc_meetings : null\n b_show_mod_message_html(loc.cannot_enter_meetings_in_tab_compensation + \"<br>\" + loc.select_tab_approvals_to_enter_meetings);\n } else {\n\n if (map_id){\n const data_dict = usercompensation_dicts[map_id];\n\n const fldName = get_attr_from_el(el_input, \"data-field\");\n const usercompensation_pk = data_dict.id;\n const map_value = data_dict[fldName];\n\n let new_value = null;\n if (el_input.value){\n if (!Number(el_input.value) ) {\n const msg_html = [\"'\", el_input.value, \"'\", loc.is_an_invalid_number,\n \"<br>\", loc.must_enter_whole_number_between_0_and_, \"2.\"].join(\"\");\n b_show_mod_message_html(msg_html);\n\n } else if (![0,1,2].includes(Number(el_input.value))) {\n const msg_html = [\"'\", el_input.value, \"'\", loc.is_not_valid,\n \"<br>\", loc.must_enter_whole_number_between_0_and_, \"2.\"].join(\"\");\n b_show_mod_message_html(msg_html);\n } else {\n new_value = Number(el_input.value);\n };\n };\n\n if(new_value !== map_value){\n // --- create mod_dict\n const url_str = urls.url_usercompensation_upload;\n const upload_dict = {mode: \"update\",\n usercompensation_pk: usercompensation_pk};\n upload_dict[fldName] = new_value;\n //console.log(\"upload_dict: \", upload_dict);\n\n // --- upload changes\n UploadChanges(upload_dict, url_str);\n };\n };\n };\n }", "onInputChange(e) {\n\n const newValue = {\n ...this.props.value,\n input: e.target.value\n };\n\n this.props.onChange({\n value: newValue\n });\n }", "_inputPasteHandler() {\n const that = this;\n\n requestAnimationFrame(() => that.$.fireEvent('changing', { 'currentValue': that.$.input.value, 'validValue': that.value, 'radix': that._radixNumber }));\n }", "onInputChange(value) {\r\n if (isObject(this.events) && value == this.events.input) {\r\n console.error(value);\r\n throw new Error(\"Attempt to override Forms.onInput callback with Forms.events.input will lead to infinite loop!\");\r\n }\r\n }", "function handleInput(e) {\n setInput(e.target.value);\n }", "function handleOnInputChange(event) {\n\n let newSource;\n\n switch (event.target.name) {\n case \"query\":\n setKeyWords(event.target.value);\n break;\n case \"scopus\":\n //switch between true and false\n queryData.scopus = true;\n queryData.googleScholar = false;\n queryData.arXiv = false;\n break;\n\n case \"googleScholar\":\n //switch between true and false\n queryData.scopus = false;\n queryData.googleScholar = true;\n queryData.arXiv = false;\n break;\n case \"arXiv\":\n //switch between true and false\n queryData.scopus = false;\n queryData.googleScholar = false;\n queryData.arXiv = true;\n break;\n case \"searchBy\":\n queryData.searchBy = event.target.value;\n break;\n case \"year\":\n queryData.year = event.target.value;\n break;\n default:\n break;\n }\n \n if(event.target.name !== \"query\" && queryData.query && keywords){\n queryData.query = keywords;\n history.push(createQueryStringFromObject(queryData));\n }else{\n setSource({\"scopus\": queryData.scopus, \"googleScholar\": queryData.googleScholar, \"arXiv\": queryData.arXiv});\n setSearchBy(queryData.searchBy);\n setYear(queryData.year);\n }\n\n }", "inputChange(newCode) { // updates the code in the editor\n\t\tthis.props.inputChange(newCode);\n\t}", "handleEventChange() {\n }", "_inputValueChanged(e) {\n // Handle only input events from our inputElement.\n if (e.composedPath().indexOf(this.inputElement) !== -1) {\n this._inputElementValue = this.inputElement[this._propertyForValue];\n\n this._filterFromInput(e);\n }\n }", "function handleChange(e) {\n if (buttonData.map(item => item.keypad).includes(e.key)) {\n input = {\n value: e.key,\n type: buttonData.filter(item => item.keypad === e.key)[0].type\n }\n setOutput(output => (handleDisplay(input, output)))\n }\n }", "function handleInputs(event) {\n props.handleChangeInputs(event.target.value, event.target.name);\n }", "function handleInput(e) {\n\t\tsetInput({\n\t\t\t...input,\n\t\t\t[e.target.name]: e.target.value,\n\t\t});\n\t\tsetErrors(\n\t\t\tvalidate({\n\t\t\t\t...input,\n\t\t\t\t[e.target.name]: e.target.value,\n\t\t\t})\n\t\t);\n\t}", "internalOnInput(event) {\n const me = this,\n value = me.input.value,\n inputLen = value.length; // IE11 triggers input event on focus for some reason, ignoring it if not editable\n\n if (!me.editable) {\n return;\n }\n\n me.updateEmpty();\n me.syncInputWidth();\n me.inputting = true;\n\n if (inputLen >= me.minChars) {\n me.filterList(value);\n } else {\n // During typing, the field is invalid\n if (me.validateFilter && !me.filterParamName) {\n me[inputLen ? 'setError' : 'clearError'](errorValidateFilter);\n }\n\n me.hidePicker();\n }\n\n me.inputting = false;\n /**\n * User typed into the field. Please note that the value attached to this event is the raw input field value and\n * not the combos value\n * @event input\n * @param {Core.widget.Combo} source - The combo\n * @param {String} value - Raw input value\n */\n\n me.trigger('input', {\n value,\n event\n });\n }", "onChange() {\n triggerEvent(this.input, 'input');\n triggerEvent(this.input, 'change');\n }", "change() { }", "onBufferChange(args) {\n // We can have multiple ranges if the user has multiple insert points,\n // such as using alt-shift to insert across multiple lines. We need to\n // deal with each one.\n this.changesSeen++;\n for (const change of args.changes) {\n this.processChange(change);\n }\n }", "function updateWhenChangeType(e){\n\t$inputs = $(e).parents('table').find('input.dataInput');\n\t$.each($inputs,function(){\n\t\tcalculateInput($(this));\n\t});\n}", "internalOnInput(event) {\n const me = this,\n inputLen = me.input.value.length;\n\n // IE11 triggers input event on focus for some reason, ignoring it if not editable\n if (!me.editable) return;\n\n me.updateEmpty();\n\n if (inputLen >= me.minChars) {\n me.filterList(me.input.value);\n } else {\n if (me.validateFilter) {\n me[inputLen ? 'setError' : 'clearError'](fieldvalidateFilterErrorName);\n }\n me.hidePicker();\n }\n\n /**\n * User typed into the field. Please note that the value attached to this event is the raw input field value and\n * not the combos value\n * @event input\n * @param {Common.widget.Combo} source - The combo\n * @param {String} value - Raw input value\n */\n me.trigger('input', { value: me.input.value, event });\n }", "_propagateChange() {\n if (!this._isSelect) {\n // If original element is an input element\n this.element.value = this.value;\n } else {\n // If original element is a select element\n Array.from(this.element.options).forEach(option => {\n option.setAttribute('selected', undefined);\n option.selected = false;\n \n // If option has been added by TagsInput then we remove it\n // Otherwise it is an original option\n if (typeof option.dataset.source !== 'undefined') {\n option.remove();\n }\n });\n \n // Update original element options selected attributes\n this.items.forEach(item => {\n this._updateSelectOptions({\n value: this._objectItems ? item[this.options.itemValue] : item,\n text: this._objectItems ? item[this.options.itemText] : item\n });\n });\n }\n \n // Trigger Change event manually (because original input is now hidden)\n // Trick: Passes current class constructor name to prevent loop with _onOriginalInputChange handler)\n const changeEvent = new CustomEvent('change', {\n 'detail': this.constructor.name\n });\n this.element.dispatchEvent(changeEvent);\n }", "function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }", "function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }", "function startOperation() {\n updateInput = null; changes = []; textChanged = selectionChanged = false;\n }", "update() {\n if (this.originalInputValue === '') {\n this._reset();\n }\n }", "onInputChange( evt ) {\n\t\tconst inputFields = this.state.inputFields\n\t\tinputFields[evt.target.name] = evt.target.value\n\n\t\tthis.setState({ inputFields })\n\t}", "function handleChange(event) {\r\n switch (event.target.name) {\r\n case \"createPass\":\r\n setPass(event.target.value);\r\n break;\r\n case \"reEnter\":\r\n setConfPass(event.target.value);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }", "handleAllInputChanges(evt){\n let e = evt.target.value;\n if(evt.target.name === \"=\"){\n\t\ttry {\n this.setState({\n disres: eval(this.state.result),\n })\n } catch (e) {\n this.setState({\n result: \"error\",\n disres: \"error\"\n })\n }\n\t}else if(evt.target.name === \"C\"){\n\t\tthis.setState({\n\t\t\tdisres: \"\",\n result: \"\"\n\t\t})\n\t}else if(evt.target.name === \"CE\"){\n\t\tthis.setState({\n result: this.state.result.slice(0, -1),\n disres: this.state.disres.slice(0, -1)\n })\n\t}\n\telse{\n\t\tif(e === 'sin(' || e==='cos(' || e==='tan(' || e==='sqrt(' || e==='log(' || e==='⫪'){\n this.setState({result : evt.target.id})\n this.setState({disres:evt.target.value})\n }else{\n this.setState({\n result: this.state.result + evt.target.name,\n disres: this.state.disres + evt.target.name\n })\n }\n\t}\n }", "function updateInput( e ) {\r\n this.set( \"value\", e.newVal );\r\n }", "internalOnChange(event) {\n const me = this,\n value = me.value,\n oldValue = me._lastValue;\n\n // Don't trigger change if we enter invalid value or if value has not changed (for IE when pressing ENTER)\n if (me.isValid && value !== oldValue) {\n me._lastValue = value;\n\n // trigger change event, signaling that origin is from user\n me.trigger('change', { value, oldValue, event, userAction: true });\n\n // per default Field triggers action event on change, but might be reconfigured in subclasses (such as Combo)\n if (me.defaultAction === 'change') {\n me.trigger('action', { value, oldValue, event });\n }\n }\n\n // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onClick and onAction\n }", "function updateInputFromPipes(){\n if ($scope.pipes.query_type == 'simple'){\n updateInputForSimple();\n\n } else if ($scope.pipes.query_type == 'advanced'){\n updateInputForAdvanced();\n\n } else if ($scope.pipes.query_type == 'xpath'){\n updateInputForXPath();\n\n } else if ($scope.pipes.query_type == 'querybuilder'){\n updateInputForQueryBuilder();\n }\n }", "function handleChange(event) {\n setInputValue(event.target.value);\n }", "_noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }", "handleChange(event) {\n let field = event.target.name; // which input\n let value = event.target.value; // what value\n\n let changes = {}; // object to hold changes\n changes[field] = value; // change this field\n this.setState(changes); // update state\n }", "activateUpdateHandler(item_id, inx, type){\n //implement\n if(type==\"input\"){\n try {\n var id = \"priority_\" + inx;\n var weight = document.getElementById(id).value;\n {weight==\"\"? this.setState({ alertopen: true }) : putUpdate(item_id, inx, Number(weight), this.props.updateWeight, this)}\n document.getElementById(id).value=\"\";\n }\n catch(error) {\n //not number value\n this.setState({ alertopen: true });\n }\n }\n else if(type==\"increase\"){\n putUpdate(item_id, inx, this.props.data.event_data[inx].weight + 1, this.props.updateWeight, this);\n }\n else if(type==\"decrease\"){\n putUpdate(item_id, inx, this.props.data.event_data[inx].weight - 1, this.props.updateWeight, this);\n }\n else if(type==\"top\"){\n putUpdate(item_id, inx, this.props.data.event_data[0].weight + 1, this.props.updateWeight, this);\n }\n else if(type==\"bottom\"){\n var len = this.props.data.event_data.length-1;\n var newWeight = this.props.data.event_data[len].weight==0? 0 : this.props.data.event_data[len].weight - 1\n putUpdate(item_id, inx, newWeight, this.props.updateWeight, this);\n }\n }", "function oninput( e ) {\n const newValue = parseInt(this.value);\n csv_message('change_' + this.classList, self[this.classList], this.value);\n self[this.classList] = newValue;\n }", "fireChanged () {\n this.$emit ( 'input', this.model );\n }", "updated(e){}", "_onInput(value) {\n super._onInput(value);\n this._rangeInput._handleChildValueChange();\n }", "_onInput(value) {\n super._onInput(value);\n this._rangeInput._handleChildValueChange();\n }", "_inputChangeHandler(event) {\n event.stopPropagation();\n event.preventDefault();\n }", "handleChange(event) {\n let elemName = event.target.name;\n let value = event.target.value;\n //reason picklist is selected\n if (elemName === \"reasonCombo\"){\n this.objInputFields.sReason = value;\n this.reasonSelected = true;\n }\n //comment text area is selected\n else if (elemName === \"commentField\"){\n this.objInputFields.sComment = value;\n } \n \n //this.sReason = event.target.value;\n //this.reasonSelected = true;\n this.bFormEdited = true;\n }", "inputValueDidChange() {\n let value = parseInt(this.get('inputValue'), 10);\n this.set('value', isNaN(value) ? undefined : value);\n }", "function inputChanged($container){\n var $input = $container.find('input[type=\"text\"]');\n\n if($input.val().length == 0){\n dataChanged($container, {});\n }\n }", "function handleChange(e) {\n //alert('work');\n setInputList(e.target.value);\n }", "handleInput(event) {\n const target = event.target;\n const value = target.value;\n\n this.setState({\n input: value,\n output: this.formatAsTyped(value)\n });\n }", "onChangeInput() {\n this.setState({\n value: !this.state.value,\n manualChangeKey: !this.state.manualChangeKey,\n });\n }", "_inputKeyupHandler(event) {\n const that = this;\n\n if (event.keyCode === 13) {\n // when Enter is pressed, validation occurs\n that._suppressBlurEvent = true;\n\n if (that.$.input.value !== that._cachedInputValue) {\n that._triggerChangeEvent = true;\n that._validate();\n that._triggerChangeEvent = false;\n that.$.input.blur();\n }\n }\n else if (event.keyCode === 27) {\n // when Escape is pressed, changes are discarded\n that.$.input.value = that._editableValue;\n }\n else {\n const inputValue = that.$.input.value;\n\n if (inputValue !== '' && that._regex[that._radixNumber].test(inputValue)) {\n that.$.upButton.disabled = false;\n that.$.downButton.disabled = false;\n }\n else if (inputValue === '') {\n that.$.upButton.disabled = true;\n that.$.downButton.disabled = true;\n }\n\n if (that._keydownInfo &&\n that._keydownInfo.value !== inputValue &&\n !that._keydownInfo.specialKey &&\n !event.altKey && !event.ctrlKey && !event.shiftKey &&\n event.key !== 'Control') {\n that.$.fireEvent('changing', { 'currentValue': inputValue, 'validValue': that.value, 'radix': that._radixNumber });\n }\n }\n\n event.preventDefault();\n }", "_onInputChange(event) {\n if (typeof event.target.oninput === 'undefined') {\n this._onInputChangeHandler(event);\n }\n }", "update() {\r\n this.draw();\r\n inputChange();\r\n }", "handleChange(event) {\n let input = this.state.input;\n input[event.target.name] = event.target.value;\n \n this.setState({\n added: false,\n input: input,\n errors: this.state.errors\n });\n }", "handleInputChanges(evt) {\n this.setState({[evt.target.name]:evt.target.value});\n }", "function handleChange(e) {\n\t\tsetNewData({\n\t\t\t...newData,\n\t\t\t[e.target.name]: e.target.value,\n\t\t})\n\t}", "function x_change(event, ui) {\n $(\".range input\")[ui.handleIndex].value = ui.value;\n $(\"input[name='x1']\").valid();\n $(\"input[name='x2']\").valid();\n getUserInput($(\"#input\")[0]);\n}", "function handleChange(e) {\n setInputValue(e.target.value);\n }", "function handleChange(inputName, valueIn) {\n setFields(prev => prev.map(s => {\n if(s.name === inputName) {\n return {...s, value:valueIn}\n }\n else return s;\n }))\n }", "onInput(calc) {\n let elm = this.getState('dom');\n elm.addEventListener('input', event => {\n // when user types --> update state\n this.setState({ userInput: event.target.value });\n // when state is updated, recall method notifyObservers as render() in Reactjs\n let data = calc(this.getState('userInput')); // calc func always return a string as final result\n this.notifyObservers(data);\n });\n }", "handlePendingInput(input) {\n this.save(input);\n }", "handlePendingInput(input) {\n this.save(input);\n }", "syncInputFieldValue() {\n const me = this,\n input = me.input;\n\n // If we are updating from internalOnInput, we must not update the input field\n if (input && !me.inputting) {\n // Subclasses may implement their own read only inputValue property.\n me.input.value = me.inputValue;\n\n // If it's being manipulated from the outside, highlight it\n if (!me.isConfiguring && !me.containsFocus && me.highlightExternalChange) {\n input.classList.remove('b-field-updated');\n me.clearTimeout('removeUpdatedCls');\n me.highlightChanged();\n }\n }\n me.updateEmpty();\n me.updateInvalid();\n }", "function UploadInputChange(el_input) {\n console.log( \" ==== UploadInputChange ====\");\n console.log(\"el_input: \", el_input);\n // only input fields are: \"uc_corr_amount\", \"uc_corr_meetings\"\n\n// --- upload changes\n if (permit_dict.permit_crud){\n const tblRow = t_get_tablerow_selected(el_input);\n const data_field = get_attr_from_el(el_input, \"data-field\");\n console.log(\"data_field: \", data_field);\n if(tblRow){\n const data_dict = usercompensation_dicts[tblRow.id];\n if (data_dict){\n const new_value = (el_input.value && Number(el_input.value)) ? Number(el_input.value) : 0;\n const old_value = (data_dict[data_field]) ? data_dict[data_field] : null;\n // ??? (data_field === \"uc_corr_meetings\") ? data_dict.uc_meetings : 0;\n\n console.log(\"old_value: \", old_value);\n console.log(\"data_dict: \", data_dict);\n const max_meetings = 2;\n const amount_or_meetings = (data_field === \"uc_corr_amount\") ? data_dict.uc_amount :\n (data_field === \"uc_corr_meetings\") ? data_dict.uc_meetings : 0\n\n const not_valid_txt = [loc.Correction, \" '\", el_input.value, \"'\", loc.is_not_valid, \"<br>\"].join(\"\");\n let msg_txt = null;\n if (el_input.value && !Number(el_input.value)){\n msg_txt = [not_valid_txt, loc.must_enter_whole_number].join(\"\");\n\n // the remainder / modulus operator (%) returns the remainder after (integer) division.\n } else if(new_value % 1) {\n msg_txt = [not_valid_txt, loc.must_enter_whole_number].join(\"\");\n\n } else if (amount_or_meetings + new_value < 0 ){\n msg_txt = [not_valid_txt, loc.cannot_deduct_more_than_original_number].join(\"\");\n\n } else if (data_field === \"uc_corr_meetings\" && amount_or_meetings + new_value > max_meetings ) {\n msg_txt = [not_valid_txt, loc.Total_number_meetings_cannot_be_greater_than, max_meetings, \".\"].join(\"\");\n };\n\n if (msg_txt){\n const msg_html = [\"<p class='border_bg_invalid p-2'>\", msg_txt, \"</p>\"].join(\"\");\n b_show_mod_message_html(msg_html);\n el_input.value = old_value;\n\n } else {\n let upload_dict = {\n table: \"usercompensation\",\n mode: \"update\",\n usercompensation_pk: data_dict.uc_id\n };\n const db_field = (data_field === \"uc_corr_amount\") ? \"correction_amount\" :\n (data_field === \"uc_corr_meetings\") ? \"correction_meetings\" : \"-\";\n upload_dict[db_field] = new_value;\n UploadChanges(upload_dict, urls.url_usercompensation_upload);\n };\n };\n };\n };\n } // UploadInputChange", "function onChange() {\n if (input.get.call(element, valueField) !== observer.oldValue && !element.readOnly) {\n observer.set(input.get.call(element, valueField));\n }\n }", "onInputChange(name, event) {\n\n var change = {};\n \t\tchange[name] = event.target.value;\n \t\tthis.setState(change);\n\n \t}", "async function oninput( e ) {\n const newValue = parseInt(this.value) || 0;\n csv_post_event('change_' + this.classList.toString(), self[this.classList.toString()], this.value);\n self[ this.classList.toString() ] = newValue;\n switch( this.classList.toString() ){\n case \"max\":\n await garage.add_image( newValue - garage.max );\n garage.max = newValue;\n garage.rerender();\n break;\n case \"open_from\": case \"open_to\":\n // ToDo\n break;\n default:\n debugger;\n }\n }", "inputEventReceived(inputEvent) {\n switch (inputEvent.eventType) {\n case 'focusClassAdded':\n // Handle as desired\n break;\n case 'focusClassRemoved':\n // Handle as desired\n break;\n case 'errorClassAdded':\n // Handle as desired\n break;\n case 'errorClassRemoved':\n // Handle as desired\n break;\n case 'cardBrandChanged':\n // Handle as desired\n break;\n case 'postalCodeChanged':\n // Handle as desired\n break;\n default:\n break;\n }\n }", "function processInput(input) {\n switch (input) {\n case \"=\":\n calculate();\n break;\n case \"ce\":\n clearEntry();\n break;\n case \"ac\":\n clearAll();\n break;\n case \"/\":\n case \"*\":\n case \"+\":\n case \"-\":\n case \".\":\n case \"0\":\n validateInput(input);\n break;\n default:\n updateDisplay(input);\n }\n}", "function handleOnChange(event) {\n //event.target.name hold the name of the input that changed\n //event.target.value hold the new value of the input field that changed\n\n //we update the user state with the new value\n setState({\n ...state,\n [event.target.name]: event.target.value,\n });\n }", "onChanged(e){}", "async inputHandler(event) {\n if (event.target.value === \"\" || event.target.value === 0) {\n this.setState({proposal: undefined});\n }\n this.setState({input: event.target.value});\n }", "handleInputChange(event) {\n let newState = {};\n newState[event.target.id] = event.target.value;\n this.setState(newState);\n }" ]
[ "0.73533297", "0.7341883", "0.6961452", "0.6952631", "0.6863717", "0.68561506", "0.6744633", "0.6706013", "0.66919005", "0.6678626", "0.6632247", "0.66103953", "0.66069067", "0.6597832", "0.6574189", "0.65631753", "0.6555126", "0.6528805", "0.64918345", "0.6463922", "0.6449173", "0.64435744", "0.64340144", "0.6432426", "0.6405348", "0.63946533", "0.6355881", "0.63533396", "0.63477767", "0.63201135", "0.63174635", "0.6298868", "0.62966824", "0.6285967", "0.6278955", "0.6267515", "0.6230442", "0.62193376", "0.6213899", "0.61962044", "0.61892664", "0.618305", "0.6174153", "0.6159396", "0.6149789", "0.6144759", "0.6133963", "0.6128762", "0.612771", "0.612093", "0.61198044", "0.6112254", "0.6108101", "0.6108101", "0.6108101", "0.6099343", "0.6098468", "0.6093562", "0.6082286", "0.60737944", "0.6073659", "0.60635525", "0.6063304", "0.6060233", "0.6055696", "0.6047309", "0.6047138", "0.6045426", "0.6042646", "0.6035679", "0.6035679", "0.60348827", "0.6016507", "0.6016475", "0.6012656", "0.600003", "0.5994072", "0.5987417", "0.59861684", "0.59839", "0.59753704", "0.59618044", "0.59504443", "0.5946654", "0.5943787", "0.59436095", "0.59420663", "0.59386665", "0.59335446", "0.59335446", "0.5924558", "0.5923747", "0.59232414", "0.5920762", "0.592064", "0.5916456", "0.59162384", "0.5915619", "0.5914547", "0.5914005", "0.5913697" ]
0.0
-1
function to switch to gold loan from any CJ
function switchToGoldLoan(product_id, quote_id, lead_id, switch_is_interested) { var loan_type_id = ''; if ($('.gold_loan_type:checked').length == 0) { $(".thanx-question").addClass("error"); return false; } else { $(".thanx-question").removeClass("error"); loan_type_id = $('.gold_loan_type:checkbox:checked').map(function () { return this.value; }).get(); } var validator_status = 0; var gold_weight = $.trim($("#gold_weight").val()); if (gold_weight != "" && gold_weight > 0 && gold_weight <= 999 && !isNaN(gold_weight)) { validator_status = 1; } //alert(validator_status); //var validator_status = formatValidatorNew('', $("#gold_weight"), '', '', '', 23, 0, 9999, "", '', ''); if (validator_status == 1 || validator_status == true) { $("#gold_weight").closest('.mRight').find('.thanx-question').removeAttr('style'); } else { $("#gold_weight").closest('.mRight').find('.thanx-question').css("color", "red") return false; } //Save Pincode for gl journey,23112015 var validate_resonse = 0; var gold_pincode = $.trim($("#gold_pincode").val()); var gold_pincode_length = gold_pincode.length; if (gold_pincode != "" && gold_pincode > 0 && gold_pincode_length == 6) { validate_resonse = 1; } if (validate_resonse == 1) { $("#gold_pincode").closest('.mRight').find('.thanx-question').removeAttr('style'); } else { $("#gold_pincode").closest('.mRight').find('.thanx-question').css("color", "red") return false; } //End showLoader('loading', 'display-block'); var data = {step: 'switch_to_gold_loan', product_id: product_id, quote_id: quote_id, lead_id: lead_id, mode: 'switch_to_gold_loan', switch_is_interested: switch_is_interested, loan_type_id: loan_type_id, gold_weight: $.trim($("#gold_weight").val()), pincode: $.trim($("#gold_pincode").val())}; $.post("/gold-loan", data, '', 'json') .done(function (response) { showLoader('loading', 'display-none'); if (switch_is_interested == 1 && response.redirect_url != undefined) { window.location = response.redirect_url; } else { noLoanResponseMessage(); $('.proceed_to_gl_step').remove(); } console.log(response); return false; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function turn_on(target){\n if (coffeeStatus != \"off\") {\n phonon.alert(\"\", \"Coffeemaker is already on!!\", true)\n }\n else {\n query = \"command=on\"\n function state(resultOn){\n alrt = phonon.indicator('Coffeemaker is starting', true);\n window.setTimeout(function(){\n console.log(alrt);\n alrt.close();\n alrt = null;\n }, 2000);\n };\n query_coffeemaker(state, query);\n }\n }", "function gotoVictoryVan(event) {\n\taddNavActionJS(\"initial victory van\", \"\");\n\tswitchTo('victoryVanStart');\n}", "function OnClickObjectiveOk() {\n SetActive('#LO', false);\n OnClickLevel1();\n}", "function livestock_manure(){\n a_FAO_i='livestock_manure';\n initializing_change();\n change();\n}", "function switch_game(home, away) {\n ls_update_all = 1;\n ls_home_id = home;\n ls_away_id = away;\n ls_validate_matchup(ls_home_id,ls_away_id);\n ls_check_if_bye();\n show_game(ls_home_id, ls_away_id);\n update_scores();\n if (ls_includeInjuryStatus) ls_update_injuries();\n ls_add_icons(ls_home_id);\n try { MFLPlayerPopupNewsIcon();} catch (er) {}\n ls_add_caption();\n ls_add_records(ls_home_id, ls_away_id);\n $(\"#LS_AwayTeamName,#LS_AwayTeamRecord,#LS_AwayScore\").trigger('click');\n}", "function onTargetClick(){\r\n\r\n\t\tif( vaultDweller.currentAttackMode === \"single\"){\r\n\t\tvaultDweller.arm(AKS74u);\r\n\t\tvaultDweller.attackSingle(mingvase);\r\n\t\ttargetingOverlay(mingvase);\r\n\t\t\r\n\t\t} else if(vaultDweller.currentAttackMode === \"Melee\"){\r\n\t\t\r\n\t\tvaultDweller.arm(AKS74u);\r\n\t\tvaultDweller.attackMelee(mingvase);\r\n\t\ttargetingOverlay(mingvase);\r\n\t\t\r\n\t\t} else if(vaultDweller.currentAttackMode === \"sprayAndPray\"){\r\n\t\t\r\n\t\tvaultDweller.arm(AKS74u);\r\n\t\tvaultDweller.attack(mingvase);\r\n\t\ttargetingOverlay(mingvase);\r\n\t\t\r\n\t\t} else if(vaultDweller.currentAttackMode === \"grenade\"){\r\n\t\t\r\n\t\tvaultDweller.arm(AKS74u);\r\n\t\tvaultDweller.attackGrenade(mingvase);\r\n\t\ttargetingOverlay(mingvase);\r\n\t\t\r\n\t\t}else{\r\n\t\t\r\n\t\toutput = \"Select a fire mode first!\";\r\n\t\tLogInfo(output);\r\n\t\t}\r\n\r\n\t\r\n}", "function OnClickObjectiveOk()\n{\n SetActive('#LO', false);\n SetActive('#MainMenu', false);\n SetActive('#L1', true);\n SetActive(i_BrainInsId,true,0.1);\n SetActive(fullBodylvlId,true,0.01);\n StopVO2('#p_objective');\n PlayVO2(click_on_brainId);\n}", "function switchLocation() {\n\n\t//make sure we aren't in a banned module\n\tvar banned = new Array(\"editcontact\",\"editcontract\");\n\tvar key = arraySearch(MODULE,banned);\n\n\tif (key!=-1) {\n\t\talert(\"You cannot switch locations while in this module\");\n\t} else {\n\n\t\tvar ref = ge(\"locSwitchDiv\");\n\t\n\t\tif (ref.style.display == \"block\") {\n\t\t\tref.style.display = \"none\";\n\t\t}\n\t\telse {\n\n\t\t\tref.style.display = \"block\";\n\n\t\t\tif (ref.innerHTML.length == 0) {\n\t\n\t\t\t\tref.appendChild(ce(\"div\",\"statusMessage\",\"\",\"Loading Locations\"));\n\t\t\t\tvar url = \"index.php?module=loclist\";\n\t\t\t\tprotoReq(url,\"writeSwitchLocation\");\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}", "function chooseGin() {\n removeDrinkImg();\n removeDrinkInfo();\n liquorSearch(\"gin\");\n}", "function AttackSelected() {\n Orion.Attack(\"lasttarget\");\n}", "function gold(index)\n{\n var gold = 0;\n\n switch(index) {\n case 2://start\n case 3://towels\n gold = 200;\n break;\n\n case 27://Train compartments\n case 30://Cave boxes\n gold = Math.floor((Math.random() * 200) + 200)\n break;\n\n case 35://bushes\n gold = Math.floor((Math.random() * 300) + 300)\n break;\n\n case 41://chest\n gold = Math.floor((Math.random() * 400) + 600)\n break;\n\n default:\n }\n\n GainGold(gold);\n}", "function enterCastle() \n{\nconfirm(\"You open the large oak door and step over the threshold.\");\nconfirm(\"Inside is a dark room that is long and narrow and there are suits of armour on either side of the passage way.\");\nconfirm(\"You are starting to feel a little unsure of your previous decision.\");\nleaveCastle();\n}", "setCurrentGold (gold) {\n this._player.currentGold = gold;\n }", "function goldHandler () {\n\tslowPage(goldTier);\n\n\tsetTimeout(function() {\n\t\tdataCapper(goldTier);\n\t\trestrictAccess(goldRestrictedAccessList);\n\t}, 1);\n\n}", "function goTo(lala) {\n $state.go(lala);\n }", "function bankBorrowMax(){\n\t\t\tborrowLoan(maxloan);\n\t\t}", "function chooseCoal() {\n $('coal_span').addClassName('selected');\n $('oil_span').removeClassName('selected');\n $('gas_span').removeClassName('selected');\n $('nuclear_span').removeClassName('selected');\n $('hydro_span').removeClassName('selected');\n $('all_span').removeClassName('selected');\n // disable and unselect inappropriate units\n $('bbl').disable();\n $('bbl_span').setOpacity(0.3).removeClassName('selected');\n $('ft3').disable();\n $('ft3_span').setOpacity(0.3).removeClassName('selected');\n $('m3').disable();\n $('m3_span').setOpacity(0.3).removeClassName('selected');\n $('twh').disable();\n $('twh_span').setOpacity(0.3).removeClassName('selected');\n // keep current units if possible\n var units = $$('input:checked[type=\"radio\"][name=\"units\"]').pluck('value')[0]; \n if (units == 'joule') {\n $('mtoe').enable();\n $('mtoe_span').setOpacity(1.0).removeClassName('selected');\n $('joule').enable();\n $('joule').checked = true;\n $('joule_span').setOpacity(1.0).addClassName('selected');\n } else { // default to 'mtoe'\n $('mtoe').enable();\n $('mtoe').checked = true;\n $('mtoe_span').setOpacity(1.0).addClassName('selected');\n $('joule').enable();\n $('joule_span').setOpacity(1.0).removeClassName('selected');\n }\n\n requestImage();\n}", "function autoGoldenUpgradesAT() {\n var setting = getPageSetting('AutoGoldenUpgrades');\n //get the numerical value of the selected index of the dropdown box\n try {\n if (setting == \"Off\") return; //if disabled, exit.\n var num = getAvailableGoldenUpgrades();\n if (num == 0) return; //if we have nothing to buy, exit.\n //buy one upgrade per loop.\n var success = buyGoldenUpgrade(setting);\n //Challenge^2 cant Get/Buy Helium, so adapt - do Derskagg mod.\n var challSQ = game.global.runningChallengeSquared; \n var doDerskaggChallSQ = false;\n if (setting == \"Helium\" && challSQ && !success)\n doDerskaggChallSQ = true;\n // DZUGAVILI MOD - SMART VOID GUs\n // Assumption: buyGoldenUpgrades is not an asynchronous operation and resolves completely in function execution.\n // Assumption: \"Locking\" game option is not set or does not prevent buying Golden Void\n if (!success && setting == \"Void\" || doDerskaggChallSQ) {\n num = getAvailableGoldenUpgrades(); //recheck availables.\n if (num == 0) return; //we already bought the upgrade...(unreachable)\n // DerSkagg Mod - Instead of Voids, For every Helium upgrade buy X-1 battle upgrades to maintain speed runs\n var goldStrat = getPageSetting('goldStrat');\n if (goldStrat == \"Alternating\") {\n var goldAlternating = getPageSetting('goldAlternating');\n setting = (game.global.goldenUpgrades%goldAlternating == 0) ? \"Helium\" : \"Battle\";\n } else if (goldStrat == \"Zone\") {\n var goldZone = getPageSetting('goldZone');\n setting = (game.global.world <= goldZone) ? \"Helium\" : \"Battle\";\n } else\n setting = (!challSQ) ? \"Helium\" : \"Battle\";\n buyGoldenUpgrade(setting);\n }\n // END OF DerSkagg & DZUGAVILI MOD\n } catch(err) { debug(\"Error in autoGoldenUpgrades: \" + err.message, \"other\"); }\n}", "function buyGall() {\r\n if(player.gold.num >= player.galleon.price && player.influence >= player.galleon.infMin) {\r\n player.galleon.num++;\r\n player.gold.num -= player.galleon.price;\r\n player.influence += player.galleon.influence;\r\n player.galleon.income = player.galleon.num * player.galleon.gain;\r\n gameLog('Cap\\'n, ye be sure yer not building a war fleet?');\r\n } else {\r\n gameLog('Not chance, Cap\\'n');\r\n };\r\n player.galleon.price = Math.floor(13525 * Math.pow(1.15, player.galleon.num));\r\n document.getElementById('gallCost').innerHTML = player.galleon.price;\r\n document.getElementById('gallNum').innerHTML = player.galleon.num;\r\n document.getElementById('gallGain').innerHTML = player.galleon.income;\r\n document.getElementById('gallInf').innerHTML = player.galleon.influence;\r\n document.getElementById('gold').innerHTML = player.gold.num;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n}", "function BOT_onSwitchBot(oldbotid,newbotid) {\r\n\treturn;\r\n}", "function LoseGold(minusGold)\n{\n var gold;\n gold = localStorage.getItem(\"PlayerGold\");\n gold = parseInt(gold) - parseInt(minusGold);\n localStorage.setItem(\"PlayerGold\", gold);\n StatusLoad()\n}", "function jouer(){\n\t\tafficheScoreCook();\n\t\tstart('180');\t\n}", "function ChangeState1() {\n\tbot.user.setActivity(prefix + \"help | By RisedSky & PLfightX\");\n\tsetTimeout(ChangeState2, 30000);\n}", "harvest(bee){\n let creep = bee.creep;\n let target = Game.getObjectById(creep.memory.target);\n if(target){\n let actionStatus = creep.harvest(target);\n switch (actionStatus) {\n case ERR_NOT_IN_RANGE:\n creep.moveTo(target,{ visualizePathStyle:this.visualizePathStyle });\n creep.say('💰 开采能源!');\n break;\n case OK:\n if(creep.carry.energy === creep.carryCapacity){// Job is done\n delete creep.memory.target;\n //creep.memory.job = this.jobList.None;\n this.findJob(bee);\n }\n break;\n case ERR_TIRED:\n case ERR_NOT_ENOUGH_RESOURCES:\n creep.say('🌙 等待资源重生!');\n break;\n default:\n // Job cause fatal-error\n creep.memory.job = this.jobList.None;\n delete creep.memory.target;\n }\n //console.log(`actionStatus:${actionStatus}`);\n } else {\n // Job is valid\n delete creep.memory.target;\n //creep.memory.job = this.jobList.None;\n this.findJob(bee);\n }\n }", "function Loan(pay, amount){\n if(!pay){ debt += amount; money += amount; }\n if (pay && money >= debt) { money -= debt; debt = 0; }\n updateInvent(null);\n}", "function startNewGame() {\n setGoal();\n updateDisplay();\n randomlizeCrystals();\n storeCrystals();\n}", "function C012_AfterClass_Jennifer_MakeLove() {\n\tCurrentTime = CurrentTime + 50000;\n\tActorSetCloth(\"Naked\");\n\tPlayerClothes(\"Naked\");\n\tC012_AfterClass_Bed_Partner = \"Jennifer\";\n\tSetScene(CurrentChapter, \"Bed\");\n}", "switchScene() {\r\n\t\tswitch(this.id) {\r\n case 'cliffsA':\r\n completeLevels.cliffs[0] = true;\r\n\t\t\t\ttrackEvent('LevelComplete', 'Cliffs A');\r\n\t\t\t\tthis.scene.start('endGame');\r\n\t\t\t\tbreak;\r\n\t\t}\r\n }", "function OpenBranch(){\n\tloadPlayer();\n \tLookPlayerBranch(PlayerLevel , ProID , BranchID);\n//\tuiallcl.show15();\n}", "function switchFromFaint(newPoke) {\n document.getElementById('buttonsBattle').style['display'] = 'none';\n currentPlayerPokemon = newPoke;\n currentPlayerPokemonCry = new Audio(currentPlayerPokemon.cry);\n currentPlayerPokemonCry.play();\n playerPokemonImg.src = currentPlayerPokemon.plrSprite;\n playerPokemon.style['display'] = 'block';\n playerHpBar.style['display'] = 'block';\n rollText(\"battle_text\", `Go, ${currentPlayerPokemon.name}!`, 25);\n updateHealth(currentPlayerPokemon);\n setTimeout(function () { menu() }, 2000);\n}", "function Clerk(name) {\r\n this.name = name;\r\n \r\n this.money = {\r\n 25 : 0,\r\n 50 : 0,\r\n 100: 0 \r\n };\r\n \r\n this.sell = function(element, index, array) {\r\n this.money[element]++;\r\n\r\n switch (element) {\r\n case 25:\r\n return true;\r\n case 50:\r\n this.money[25]--;\r\n break;\r\n case 100:\r\n this.money[50] ? this.money[50]-- : this.money[25] -= 2;\r\n this.money[25]--;\r\n break;\r\n }\r\n return this.money[25] >= 0;\r\n };\r\n}", "function checkGetallen(input){\n if(code[plekInput] == input){\n plekInput = plekInput + 1;\n if(plekInput == 5){\n playSound(camera, \"#correct\", \"0.1\");\n removeGate()\n }\n }\n }", "function SarahPlayerPunishGirls() {\n\tif (SarahShackled()) SarahUnlock();\n\tif (Amanda != null) Amanda.Stage = \"1000\";\n\tif (Sarah != null) Sarah.Stage = \"1000\";\n}", "function switchOppPokemon() {\n rollText(\"battle_text\", `A wild ${currentOppPokemon.name} has appeared!`, 25)\n oppPokemon.style['display'] = 'block';\n oppPokemonImg.src = currentOppPokemon.oppSprite;\n oppCry = new Audio(currentOppPokemon.cry);\n oppCry.play();\n updateHealth(currentOppPokemon);\n oppHpBar.style['display'] = 'block';\n setTimeout(function () { menu() }, 3000)\n}", "function switchTurn()\n{\n if(huidige_speler === SPELER1) {\n huidige_speler = SPELER2;\n } else {\n huidige_speler = SPELER1;\n }\n\n showCurrentPlayer();\n}", "function growlSound(action) {\r\n\r\n\tswitch (action) {\r\n\r\n\t\tcase 'explore':\r\n\t\t\ttextDialogue(narrator, \"Narocube: Good choice, it's probably just a crew members dog\", 1000);\r\n\t\t\texploreship(gameobj.explore);\r\n\t\t\tgameobj.explore++;\r\n\t\tbreak;\r\n\r\n\t\tcase 'sit tight':\r\n\t\t\ttextDialogue(narrator, \"Narocube: Good choice, it's probably just a crew members dog, we should probably wait for John to get back... wheres the dog food?\", 1000);\r\n\t\t\tgameobj.sittight++;\t\r\n\t\tbreak;\r\n\t}\r\n}", "function checkAndChange() {\n\n if(sacred_t.alpha == 1){\n tooth_used = true;\n }\n if(spear_.alpha == 1){\n spear_used = true;\n }\n if(shield_.alpha == 1){\n shield_used = true;\n }\n entering_shop = false;\n if(entering_shop == false){\n shopMusic.pause();\n }\n\n this.NextLevel();\n\n\n}", "function goToLaplides(){\n\t\tif(visitedLap===0){\n\t\t\tvisitedLap=1;\n\t\t\t// artifacts=1;\n\t\t\tgamePrompt(\"You enter orbit around Laplides. Looking down at the planet, you see signs of atomic war and realize there is no option but to turn around.\",beginTravel);\n\t\t}else{\n\t\t\tgamePrompt([\"You've already been here!\",\"Where to next?\"],beginTravel);\n\t\t}\n}", "function calculateGoldNewTurn() {\n gold += getGoldPerTurn();\n }", "function checkout() {\n if (bike_selected()) window.location.href = './payment.html';\n else alert('You must check out with a bike selection.');\n}", "function land_use(){\n a_FAO_i='land_use';\n initializing_change();\n change();\n}", "function C012_AfterClass_Amanda_MakeLove() {\n\tCurrentTime = CurrentTime + 50000;\n\tActorSetCloth(\"Naked\");\n\tPlayerClothes(\"Naked\");\n\tC012_AfterClass_Bed_Partner = \"Amanda\";\n\tSetScene(CurrentChapter, \"Bed\");\n}", "function toogleCentigrate(cgrade) {\n \"use strict\";\n if (cgrade === 'f') {\n $(\"#centigrade\").html(Math.floor((json_info.main.temp) * 9 / 5 - 459.67) + \" &#8457;\");\n $(\"#flip\").html(\"To &#8451;\");\n $(\"#flip\").attr(\"onclick\",\"toogleCentigrate('c');\");\n }\n \n if (cgrade === 'c') {\n $(\"#centigrade\").html(Math.floor(json_info.main.temp - 273.15) + \" &#8451;\" );\n $(\"#flip\").html(\"To &#8457;\");\n $(\"#flip\").attr(\"onclick\",\"toogleCentigrate('f');\");\n }\n \n}", "function goToCramuthea(){\n\t\tif(visitedCram===0){\n\t\t\tvisitedCram=1;\n\t\t\tvar vehicleFuel=vehicleFuel+500;\n\n\t\t\t// artifacts=1;\n\t\t\tgamePrompt(\"Cramuthea has been abandoned due to global environmental disaster, but there are remnants of the people that left. You are able to refuel your ship (+500 gallons) and read a beacon signal that tells you the Cramuthean people have migrated to Smeon T9Q.\",beginTravel);\n\t\t}else{\n\t\t\tgamePrompt([\"You've already been here!\",\"Where to next?\"],beginTravel);\n\t\t}\n}", "function cageSound(action) {\r\n\r\n\tswitch (action) {\r\n\t\tcase 'go look':\r\n\t\t\ttextDialogue(narrator, \"Narocube: oh wow this cage has been pulled apart, what could have caused this!\", 1000);\r\n\t\tbreak;\r\n\r\n\t\tcase 'explore':\r\n\t\t\ttextDialogue(narrator, \"Narocube: Good choice, it's probably just cargo shifting\", 0);\r\n\t\t\texploreship(gameobj.explore);\r\n\t\t\tgameobj.explore++;\r\n\t\tbreak;\r\n\r\n\t\tcase 'sit tight':\r\n\t\t\ttextDialogue(narrator, \"Narocube: Good choice, it's probably just cargo shifting, we should probably wait for John to get back... what does this ship haul anyway?\", 1000);\r\n\t\t\tgameobj.sittight++;\r\n\t\tbreak;\r\n\t}\r\n}", "interact() {\r\n\r\n // lamp light turns on\r\n {\r\n push();\r\n translate(-40, 0);\r\n if (this.light) {\r\n fill(245, 251, 236, 150);\r\n quad(602, 252, 626, 252, 680, 452, 560, 452);\r\n //this.light = false;\r\n } else {\r\n //this.light = false;\r\n }\r\n pop();\r\n }\r\n\r\n //collide with ledge \r\n\r\n }", "function johnHelpsHimself(action) {\r\n\tswitch (action) {\r\n\t\tcase 'explore':\r\n\t\t\ttextDialogue(narrator, \"Narocube: Who knows sarcasim better than you \" + player.name + \" Lets take a peak\", 1000);\r\n\t\t\texploreship(gameobj.explore);\r\n\t\t\tgameobj.explore++;\r\n\t\tbreak;\r\n\r\n\t\tcase 'sit tight':\r\n\t\t\ttextDialogue(narrator, \"Narocube: Good choice, Nothing passive aggression like more passive aggression!\", 1000);\r\n\t\t\tgameobj.sittight++;\r\n\t\tbreak;\r\n\t}\r\n}", "function bootGateditOLC()\r\n{\r\n\tvar oConfig = new Object();\r\n\tvar mode;\r\n\toConfig.type = \"gatedit\";\r\n\toConfig.modes = [];\r\n\t/**** Main Menu ****/\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_MAIN\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tif( vArgs.length && isNumber( vArgs[ 0 ] ) ) {\r\n\t\t\tvar id = parseInt( vArgs[0] );\r\n\t\t\tvar gateKeeperObject = getGateKeeperByID( id );\r\n\t\t\t\r\n\t\t\tif( gateKeeperObject ) {\r\n\t\t\t\tactor.getOLC().gateKeeperObject = gateKeeperObject;\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tactor.send(\"There is no entry with the ID you specified. Either enter an existing ID or choose another option.\");\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif( fLetter == \"A\" ) {\r\n\t\t\tactor.getOLC().switchToMode( \"MODE_ADD_GATE_KEEPER\");\r\n\t\t}\r\n\t\telse if( fLetter == \"D\" ) {\r\n\t\t\tactor.getOLC().switchToMode( \"MODE_DELETE_GATE_KEEPER\");\r\n\t\t}\r\n\t\telse if( fLetter == \"Q\" ) {\r\n\t\t\tactor.cleanupOLC();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tactor.send(\"Invalid option.\\nTry again: \");\r\n\t\t}\r\n\t};\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tgetCharCols(actor);\r\n\t\t/*** Grab the potions from OLC ***/\r\n\t\tvar buffer = \"\";\r\n\t\tvar vGateKeepers = getGateKeeperVector();\r\n\t\tfor(var gateKeeperIndex = 0;gateKeeperIndex < vGateKeepers.length;++gateKeeperIndex) {\r\n\t\t\tvar gateKeeperObject = vGateKeepers[ gateKeeperIndex ];\r\n\t\t\tbuffer += bld + cyn + gateKeeperObject.databaseID + nrm + \") \" + yel + (gateKeeperObject.gateKeeperName ? gateKeeperObject.gateKeeperName : \"<None>\") + nrm + \"\\n\";\r\n\t\t}\r\n\t\tactor.send(\"~~~Gate Keeper Editor~~~\\n\");\r\n\t\tactor.send( buffer );\r\n\t\tactor.send(bld + grn + \"A\" + nrm + \") Add New Gate Keeper\");\r\n\t\tactor.send(bld + grn + \"D\" + nrm + \") Delete Gate Keeper\");\r\n\t\tactor.send(bld + grn + \"Q\" + nrm + \") Quit\");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\t\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_ADD_GATE_KEEPER\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tactor.getOLC().gateKeeperObject = new Object();\r\n\t\tactor.getOLC().gateKeeperObject.gateKeeperName = vArgs.join(\" \");\r\n\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter the name to identify this gate keeper : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\t\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_EDIT_GATE_KEEPER\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tif( vArgs.length > 0 )\r\n\t\t{\r\n\t\t\tif( vArgs[ 0 ] == \"1\" ) {\r\n\t\t\t\tif( actor.getOLC().gateKeeperObject.databaseID != undefined ) {\r\n\t\t\t\t\tactor.send(\"This entry already has an ID. It may only be set once.\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_GATE_KEEPER_DATABASE_ID\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif( vArgs[ 0 ] == \"2\" ) {\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_GATE_KEEPER_NAME\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif( vArgs[ 0 ] == \"3\" ) {\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_GATE_KEEPER_MOB_VNUM\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif( vArgs[ 0 ] == \"4\" ) {\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_GATE_KEEPER_MAIN_ROOM\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif( vArgs[ 0 ] == \"5\" ) {\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_GATE_KEEPER_OTHER_ROOM\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif( vArgs[ 0 ] == \"6\" ) {\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_GATE_KEEPER_PULSES_TO_CLOSE\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif( vArgs[ 0 ].toUpperCase() == \"Q\" ) {\r\n\t\t\t\tactor.getOLC().switchToMode(\"MODE_CONFIRM_SAVE\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tactor.send(\"Invalid option.\\r\\nTry again : \");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tgetCharCols(actor);\r\n\t\tvar gateKeeperObject = actor.getOLC().gateKeeperObject;\r\n\t\tvar gateKeeperName = gateKeeperObject.gateKeeperName;\r\n\t\tvar gateKeeperMob = (gateKeeperObject.gateKeeperVnum != undefined ? getMobProto( gateKeeperObject.gateKeeperVnum ) : null);\r\n\t\tvar gateKeeperMainRoom = (gateKeeperObject.gateKeeperRoomVnum != undefined ? getRoom( gateKeeperObject.gateKeeperRoomVnum ) : null);\r\n\t\tvar gateKeeperOtherRoom =(gateKeeperObject.otherRoomVnum != undefined ? getRoom( gateKeeperObject.otherRoomVnum ) : null);\r\n\t\tvar gateKeeperPulses = (gateKeeperObject.pulsesToWaitForClose != undefined ? gateKeeperObject.pulsesToWaitForClose : 0);\r\n\t\tactor.send( bld + grn + \"1\" + nrm + \") Database ID(must be unique) : \" + yel + (gateKeeperObject.databaseID ? gateKeeperObject.databaseID : \"<None>\") + nrm);\r\n\t\tactor.send( bld + grn + \"2\" + nrm + \") Name : \" + yel + (gateKeeperName ? gateKeeperName : \"<None>\") + nrm);\r\n\t\tactor.send( bld + grn + \"3\" + nrm + \") Gate Keeper MOB : \" + yel + (gateKeeperMob ? \"[ \" + gateKeeperMob.vnum + \" ] \" + gateKeeperMob.name : \"<None>\") + nrm);\r\n\t\tactor.send( bld + grn + \"4\" + nrm + \") Gate Keeper Main Room : \" + yel + (gateKeeperMainRoom ? \"[ \" + gateKeeperMainRoom.vnum + \" ] \" + gateKeeperMainRoom.name : \"<None>\") + nrm);\r\n\t\tactor.send( bld + grn + \"5\" + nrm + \") Gate Keeper Joint Room : \" + yel + (gateKeeperOtherRoom ? \"[ \" + gateKeeperOtherRoom.vnum + \" ] \" + gateKeeperOtherRoom.name : \"<None>\") + nrm);\r\n\t\tactor.send( bld + grn + \"6\" + nrm + \") Pulses Before Gate Closes : \" + yel + (gateKeeperPulses) + nrm);\r\n\t\tactor.send(\"\");//Newline sent.\r\n\t\tactor.send( bld + grn + \"Q\" + nrm + \") Quit\");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_GATE_KEEPER_DATABASE_ID\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tvar id = vArgs.length ? parseInt(vArgs[0]) : -1;\r\n\t\tif( getGateKeeperByID( id ) ) {\r\n\t\t\tactor.send(\"There is already a gate keeper with that ID. Try another.\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\tactor.getOLC().gateKeeperObject.databaseID = id;\r\n\t\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t\t}\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter the unique ID number for this gate keeper : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\t\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_GATE_KEEPER_NAME\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tactor.getOLC().gateKeeperObject.gateKeeperName = vArgs.join(\" \");\r\n\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter a new name for this gate keeper : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\t\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_GATE_KEEPER_MOB_VNUM\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tif( vArgs.length < 1 || !isNumber(vArgs[0]) )\r\n\t\t{\r\n\t\t\tactor.send(\"Input is invalid. You must enter a virtual number.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar vnum = parseInt(vArgs[0]);\r\n\t\tif( !getMobProto( vnum ) ) {\r\n\t\t\tactor.send(\"There is no mob with that vnum.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tactor.getOLC().gateKeeperObject.gateKeeperVnum = vnum;\r\n\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter the virtual number for the gate keeper mob : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_GATE_KEEPER_MAIN_ROOM\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tif( vArgs.length < 1 || !isNumber(vArgs[0]) )\r\n\t\t{\r\n\t\t\tactor.send(\"Input is invalid. You must enter a virtual number.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar vnum = parseInt(vArgs[0]);\r\n\t\tif( !getRoom( vnum ) ) {\r\n\t\t\tactor.send(\"There is no room with that vnum.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tactor.getOLC().gateKeeperObject.gateKeeperRoomVnum = vnum;\r\n\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter a vnum for the room in which the gate keeper resides : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_GATE_KEEPER_OTHER_ROOM\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tif( vArgs.length < 1 || !isNumber(vArgs[0]) )\r\n\t\t{\r\n\t\t\tactor.send(\"Input is invalid. You must enter a virtual number.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar vnum = parseInt(vArgs[0]);\r\n\t\tif( !getRoom( vnum ) ) {\r\n\t\t\tactor.send(\"There is no room with that vnum.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tactor.getOLC().gateKeeperObject.otherRoomVnum = vnum;\r\n\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter a vnum for the room for the room linking to the gate keeper's room : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_GATE_KEEPER_PULSES_TO_CLOSE\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tif( vArgs.length < 1 || !isNumber(vArgs[0]) )\r\n\t\t{\r\n\t\t\tactor.send(\"Input is invalid. You must enter a numeric value.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar iPulses = parseInt(vArgs[0]);\r\n\t\tif( iPulses <= 0 ) {\r\n\t\t\tactor.send(\"Input must be above zero.\\r\\nTry again : \");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tactor.getOLC().gateKeeperObject.pulsesToWaitForClose = iPulses;\r\n\t\tactor.getOLC().switchToMode(\"MODE_EDIT_GATE_KEEPER\");\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter the number of pulses that will go by before the gate will close : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_CONFIRM_SAVE\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tvar vGateKeepers = getGateKeeperVector();\r\n\t\tvar index = -1;\r\n\t\tfor(index = 0;index < vGateKeepers.length;++index) {\r\n\t\t\tif( vGateKeepers[ index ].databaseID == actor.getOLC().gateKeeperObject.databaseID )\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif( fLetter == \"Y\" ) {\r\n\t\t\tif( index != vGateKeepers.length ) {//There is a gate keeper already in the array.\r\n\t\t\t\tvGateKeepers.splice(index,1);\r\n\t\t\t}\r\n\t\t\taddGateKeeper( actor.getOLC().gateKeeperObject );\r\n\t\t\tsaveGateKeeperToDatabase( actor.getOLC().gateKeeperObject );\r\n\t\t\tactor.getOLC().gateKeeperObject = undefined;\r\n\t\t\tactor.getOLC().switchToMode(\"MODE_MAIN\");\r\n\t\t}\r\n\t\telse if( fLetter == \"N\" ){\r\n\t\t\tdelete actor.getOLC().gateKeeperObject;\r\n\t\t\tactor.getOLC().switchToMode(\"MODE_MAIN\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\tactor.send(\"Input must be 'Y' to save or 'N' not to save.\");\r\n\t\t}\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Do you wish to save your changes? (Y/N) : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\t\r\n\t\r\n\tmode = new Object();\r\n\tmode.mode = \"MODE_DELETE_GATE_KEEPER\";\r\n\tmode.parser = function(actor,fLetter,vArgs)\r\n\t{\r\n\t\tvar vGateKeepers = getGateKeeperVector();\r\n\t\tif( vArgs.length < 1 || !isNumber(vArgs[0]) ) {\r\n\t\t\tactor.send(\"Your input must be numeric.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar id = parseInt( vArgs[0] );\r\n\t\tvar gateKeeperObject = getGateKeeperByID( id );\r\n\t\tif( !gateKeeperObject ) {\r\n\t\t\tactor.send(\"No entry was found with that ID.\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\tremoveGateKeeper( id );\r\n\t\t\tremoveGateKeeperFromDatabase( id );\r\n\t\t}\r\n\t\tactor.getOLC().switchToMode( \"MODE_MAIN\" );\r\n\t}\r\n\tmode.display = function(actor)\r\n\t{\r\n\t\tactor.send(\"Enter the ID of the entry you wish to delete : \");\r\n\t}\r\n\toConfig.modes.push( mode );\r\n\t\r\n\tvOLC.push( oConfig );\r\n}", "function gm_attack(direction, pow1id, pow2id, zid, room, opponent_team, card1, normal_attack, underdog, tiebreaker, bribe, ambush) { /* (ttt.up, ) */\r\n\tlet spiked = false;\r\n\tlet reach_target = false;\r\n\tlet target_team = null;\r\n\t//if (direction(zid)>=0)\r\n\t\t//console.log(\"0/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\tif (direction(zid)>=0 && room.game.board[direction(zid)][0]!=\"\") { /* has card */\r\n\t\t//console.log(\"1/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\t\tlet target_card_id = null;\r\n\t\tlet target_zone_id = null;\r\n\t\tif (room.game.board[direction(zid)][2]===opponent_team) { /* is enemy card */\r\n\t\t\ttarget_card_id = parseInt(room.game.board[direction(zid)][1])-1;\r\n\t\t\ttarget_zone_id = direction(zid);\r\n\t\t\tif (room.game.board[direction(zid)][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t} else {\r\n\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t}\r\n\t\t} else \r\n\t\tif (room.game.board[direction(zid)][2]===(opponent_team===\"X\"?\"O\":\"X\")) { /* is allied card */\r\n\t\t\tif ((card1[4]===6 || card1[5]===6) && direction(direction(zid))>=0 && room.game.board[direction(direction(zid))][2]===opponent_team) { // [R]each\r\n\t\t\t\ttarget_card_id = parseInt(room.game.board[direction(direction(zid))][1])-1;\r\n\t\t\t\ttarget_zone_id = direction(direction(zid));\r\n\t\t\t\treach_target = true;\r\n\t\t\t\tif (room.game.board[direction(direction(zid))][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (target_card_id!=null) {\r\n\t\t\t//console.log(\"2/2 gm_attack: \",card2);\r\n\t\t\tlet card2 = null; \r\n\t\t\tif (room.game.players[0].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[0].deck[target_card_id]; \r\n\t\t\t}\r\n\t\t\telse if (room.game.players[1].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[1].deck[target_card_id];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconsole.log(\"\\n{we should never get here #1}\\n\");\r\n\t\t\t}\r\n\t\t\tif (card2!=null) { /* we are gm_attacking this card */\r\n\t\t\t\tlet has_chain = (card2[4]==7 || card2[5]==7);\r\n\t\t\t\tlet pow1 = card1[pow1id];\r\n\t\t\t\tlet pow2 = card2[pow2id];\r\n\t\t\t\tlet cost1 = card1[0]+card1[1]+card1[2]+card1[3];\r\n\t\t\t\tlet cost2 = card2[0]+card2[1]+card2[2]+card2[3];\r\n\t\t\t\tif (pow1>pow2) { /* [N]ormal gm_attack */\r\n\t\t\t\t\tnormal_attack[0]+=1;\r\n\t\t\t\t\tnormal_attack[1]+=pow2;\r\n\t\t\t\t\tnormal_attack[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2 && cost1<cost2) { /* [U]nderdog */\r\n\t\t\t\t\tunderdog[0]+=1;\r\n\t\t\t\t\tunderdog[1]+=pow2;\r\n\t\t\t\t\tunderdog[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2) { /* [T]iebreaker */\r\n\t\t\t\t\ttiebreaker[0]+=1;\r\n\t\t\t\t\ttiebreaker[1]+=pow2;\r\n\t\t\t\t\ttiebreaker[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (cost1===cost2) { /* [B]ribe */\r\n\t\t\t\t\tbribe[0]+=1;\r\n\t\t\t\t\tbribe[1]+=pow2;\r\n\t\t\t\t\tbribe[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (true) { /* [A]mbush */\r\n\t\t\t\t\tambush[0]+=1;\r\n\t\t\t\t\tambush[1]+=pow2;\r\n\t\t\t\t\tambush[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif((card2[4]===9 || card2[5]===9) && reach_target===false && pow1<pow2) {\r\n\t\t\t\t\tspiked = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn spiked;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn spiked;\r\n}", "function runLIRI () {\r\n switch (action) {\r\n case (\"concert-this\"):\r\n concertThis();\r\n break;\r\n case (\"spotify-this-song\"):\r\n spotifyThis();\r\n break;\r\n case (\"movie-this\"):\r\n movieThis();\r\n break;\r\n case (\"do-what-it-says\"):\r\n doThis();\r\n break;\r\n }\r\n}", "function livestock_heads(){\n a_FAO_i='livestock_heads';\n initializing_change();\n change();\n}", "function EarnMoney() {\n //increasing amount of gold\n goldAmount++;\n}", "function change_turn(){\r\n\r\n if(turn == 1){\r\n turn = 2;\r\n }\r\n else{\r\n turn = 1;\r\n }\r\n\r\n}", "function AI(){\r\n let best_choice=bestOption(game_board);\r\n game_board[Math.floor(best_choice/10)][best_choice%10]='o';\r\n document.getElementById(best_choice).classList.toggle('ring_active'); //display on the website\r\n checkEnd();\r\n }", "changeDifficulty(state,cuadrados){\n state.cuadrados = cuadrados\n }", "function upgradeSickle()\n\t\t\t{\n\t\t\t\tif (sickleTier == 0)\n\t\t\t\t{\n\t\t\t\t\tsharpStoneBank--;\n\t\t\t\t\tsmoothBranchBank--;\n\t\t\t\t\tropeBank--;\n\t\t\t\t}\n\t\t\t\tsickleTier++;\n\t\t\t\taction(1,1,1);\n\t\t\t\tadvanceTime();\n\t\t\t\tupdateDisp();\n\t\t\t}", "function gainingLife() {\n switch (lives) {\n case 3:\n\t\t\tfullLives();\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ttwoLives();\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\toneLife();\n\t\t\tbreak;\n }\n}", "function livestock_production(){\n a_FAO_i='livestock_production';\n initializing_change();\n change();\n}", "function chooseAction(me, opponent, t) {\n // This strategy uses the state variable 'evil'.\n // In every round, turn 'not angel' with 10% probability.\n // (And remain this way until the 200 rounds are over.)\n if (Math.random() < 0.1) {\n angel = false;\n }\n\n // If angel, recycle\n if (angel) return 1;\n\n return 0; // Waste otherwise\n }", "function actionOnClick(){\n score = 0;\n health = 100;\n reach = 0;\n day = 1;\n game.state.start('brushing');\n\n console.log('click');\n\n }", "function loan(income, customer) {\n let interestRate = .04\n let special = false \n if ((customer[\"Melon\"] === 'Casaba') || (customer[\"Pets\"] > 5)) {\n special = true\n }\n if (income < 100000 && special === false){\n interestRate = .08\n }\n if (income < 100000 && special === true){\n interestRate = .05 \n }\n if (200000 > income > 100000 && special === false){\n interestRate = .07 \n }\n if (200000 > income > 100000 && special === true){\n interestRate = .04 \n }\n customer.set(\"special\", special);\n // Function to return loan rate\n return interestRate\n}", "function crops_livestock(){\n a_FAO_i='crops_livestock';\n initializing_change();\n change();\n}", "function CastleGates()\n\t{\n\t\t//the user attempts to go into the castle for the first time\n\t\tif(firstlook[2] = false)\n\t\t{\n\t\t\tfirstlook[2] = true;\n\t\t\talert(\"The guards stop you and say, 'What business do you have here?'\")\n\t\t\t// the player has not joined the royal guard/army\n\t\t\tif(inventory.occupation != \"soldier\"){\n\t\t\t\tvar guards = prompt(\"What do you say to them? \\n 1 - 'just looking around' \\n 2 - 'I'd like to join the guard'.\").toLowerCase();\n\t\t\t}\n\t\t\t// the player has already joined the royal guard/army\n\t\t\telse if (townHero = true) \n\t\t\t{\n\t\t\t\talert(\"The guards salute you as you walk inside\");\n\t\t\t\tInsideCastle();\n\t\t\t}\n\t\t\telse{\n\t\t\t\talert(\"The guards stop you and say, 'What business do you have here?'\");\n\t\t\t\tvar guards = prompt (\"What do you say to them? \\n 1 -'just looking around' \\n 2 - 'Soldier \" + inventory.playerName + \" reporting for duty\");\n\t\t\t}\n\t\t}\n\t\telse if (inventory.occupation != \"soldier\" || inventory.occupation != \"knight\" || inventory.occupation != \"commander\" || inventory.occupation != 'captain' || inventory.occupation != \"guard\" || townHero != true)\n\t\t{\n\t\t\talert(\"The soldiers stop you and say, 'You again? What do you want?'\");\n\t\t\tvar guards = prompt(\"What do you say to them? \\n 1 - 'just looking around' \\n 2 - 'I'd like to join the guard'.\").toLowerCase();\n\t\t}\n\t\telse\n\t\t{\n\t\t\talert(\"The guards salute you as you walk inside\");\n\t\t\tInsideCastle();\n\t\t}\n\t\tswitch (guards)\n\t\t\t{\n\t\t\t\tcase \"1\":\n\t\t\t\t\talert(\"The guards say, 'I'm afraid we can't let you pass, these are times of war after all.'\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"2\":\n\t\t\t\t\tif(inventory.occupation != \"soldier\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\talert(\"One of the guards tells you, 'You are going to want to head west of here to the guard barracks, then.\");\n\t\t\t\t\t\t\tOutsideCastle();\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\talert(\"One of them say, 'Very well, then' they get out of your way and salute you as you walk into the castle\");\n\t\t\t\t\t\t\tInsideCastle();\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t}", "function gearMove(a,b,c){\n\t\tsaveDate(defaultGrade-1);\n\t\t//calculateResult(store.getStore('allMoney').money);\n\t\t//clearInterval(timerInterval);\n\t\t//window.cancelAnimationFrame(myAnim)\n\t\tDrawRule.option.stopDraw = false;\n\t\t//if(){\n\t\t\t//DrawRule.init(store.getStore('buyMesg'));\n\t\t// //}\n\t\t// console.log(c)\n\t\t// console.log(store.getStore('buyMesg').gradeLowestInvestAmount);\n\t\tif(store.getStore('buyMesg').gradeLowestInvestAmount>DrawRule.option.totalMoney){\n\t\t\tDrawRule.init(store.getStore('buyMesg'));\n\t\t}\n\t\telse{\n\t\t\tcalculateResult(DrawRule.option.totalMoney);\n\t\t}\n\t\t$gearCot.find('ul').find('span').removeClass('ho-h-on');\n\t\t$gearCot.find('ul').find('li').eq(defaultGrade).find('span').addClass('ho-h-on');\n\t\t$gearCot.find('ul').animate({'margin-left':-(defaultGrade-1)*($w/4)},300);\n\t\tif(a&&b&&c){\n\t\t\t$gearCot.find('li').eq(a).animate({'width':($w/4)+'px'},300).find('.ho-h-tt').animate({'font-size':'1rem'},300);\n\t\t\t$gearCot.find('li').eq(a).animate({'width':($w/4)+'px'},300).find('.ho-h-to').animate({'font-size':'0.75rem'},300);\n\t\t\t$gearCot.find('li').eq(b).animate({'width':(2*$w/4)+'px'},300).find('.ho-h-tt').animate({'font-size':'1.875rem'},300);\n\t\t\t$gearCot.find('li').eq(b).animate({'width':(2*$w/4)+'px'},300).find('.ho-h-to').animate({'font-size':'0.9375rem'},300);\n\t\t\t$gearCot.find('ul').find('li').eq(a).find('.rateLow').hide();\n\t\t\t$gearCot.find('ul').find('li').eq(b).find('.rateLow').show();\n\t\t}\n\t\telse{\n\t\t\t$gearCot.find('li').eq(b).animate({'width':($w/4)+'px'},300).find('.ho-h-tt').animate({'font-size':'1rem'},300);\n\t\t\t$gearCot.find('li').eq(b).animate({'width':($w/4)+'px'},300).find('.ho-h-to').animate({'font-size':'0.75rem'},300);\n\t\t\t$gearCot.find('li').eq(a).animate({'width':(2*$w/4)+'px'},300).find('.ho-h-tt').animate({'font-size':'1.875rem'},300);\n\t\t\t$gearCot.find('li').eq(a).animate({'width':(2*$w/4)+'px'},300).find('.ho-h-to').animate({'font-size':'0.9375rem'},300);\n\t\t}\n\t}", "switchLyricIndex(state, index) {\n\t\t\t\t\tstate.songState.currentLyricIndex = index;\n\t\t\t\t}", "function roboteggCollectorOn () {\n if (gameData.roboteggcollectorNum >= 0 && gameData.cash >= gameData.roboteggcollectorCost) {\n gameData.roboteggcollectorNum++;\n gameData.cash -= gameData.roboteggcollectorCost;\n gameData.roboteggcollectorCost = 10 * Math.pow(1.2, gameData.roboteggcollectorNum + 1); \n duckUpdate();\n }\n}", "function step1GotoStep2() {\n step1AndStep2();\n turnCheck(1);\n turnPurple(2);\n}", "function checkout() {\n\n}", "function iLove(Bryan,skateboarding){\n\treturn 'Bryan loves skateboarding'\n}", "function enemyBuyOptionu() {\n if(enemyCash>300){\n enemyBuyU();\n }\n}", "function map_trans_wis() {\n current_background = Graphics[\"background2\"];\n actors.push( new BigText(\"Level 1 Complete\") );\n actors.push( new SubText(\"Hmmm... Gurnok must be close.\", 330) );\n actors.push( new Continue(\"Click to continue!\", map_wizard1) );\n }", "function C012_AfterClass_Jennifer_KickedOut() {\n\tGameLogAdd(\"KickedOutFromDorm\");\n\tif (CurrentActor == Common_PlayerLover) {\n\t\tActorChangeAttitude(-5, 0);\n\t\tC012_AfterClass_Jennifer_BreakUp();\n\t}\n\tCurrentActor = \"\";\n}", "function onSetGoal() {\n $state.go('app.setGoal');\n }", "function goToBadges(){\n\tif(SOUNDS_MODE){\n\t\taudioClick.play();\t\n\t}\n\t\n\t//load data\n\tvar player = getCurrentPlayer();\n\tgetBadgeData(player.id);\n\t\n\tmtbImport(\"stars_scroll.js\");\n\tbuildBadgesListView();\n\tviewStars.animate(anim_in);\n}", "function betray(name){\n attackXY(); \n swingAxe();\n}", "function switchLanguageInBrickly() {\n var configurationBlocks = null;\n if (Blockly.mainWorkspace !== null) {\n var xmlConfiguration = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);\n configurationBlocks = Blockly.Xml.domToText(xmlConfiguration);\n }\n// translate configuration tab, inject is not possible!\n COMM.json(\"/admin\", {\n \"cmd\" : \"loadT\",\n \"name\" : \"brickEV3\"\n }, showToolbox);\n initConfigurationEnvironment(configurationBlocks);\n}", "function getLoan() {\n // check if person already has a loan\n if (parseFloat(loanBalanceElement.value) > 0) {\n alert(`You cannot take a new loan before you have repayed your outstanding loan. ` +\n `You still need to repay ${loanBalanceElement.value} kr.`);\n // check if bank balance is 0\n } else if (parseFloat(bankBalanceElement.value) === 0) {\n alert(\"You cannot take loan when your bank balance is 0 kr! \" + \n \"You should work a little before you take a loan :)\")\n // check if user has already taken loan and not bought a laptop\n } else if (hasTakenLoan && !hasBoughtLaptop) {\n alert(\"You need to buy a laptop before you can take another loan!\")\n }\n // if not, they can take a loan\n else {\n // ask how much user wants to loan\n const promptText = \"How much would you like to loan?\";\n let amount = prompt(promptText);\n while (true) {\n // check if user inputted number\n if(!isNaN(parseFloat(amount))) {\n // check if user is asking to loan too much\n if (parseFloat(amount) > (parseFloat(bankBalanceElement.value)*2)) {\n amount = prompt(`You cannot loan more than double the amount for your bank balance. ` + \n `The amount you can currently loan is ${(parseFloat(bankBalanceElement.value))*2}` +\n ` kr. \\n ${promptText}`);\n // check if user is asking to loan 0 or less\n } else if (parseFloat(amount) <= 0) {\n amount = prompt(`You cannot loan 0 kr or less. The amount you can currently loan is ` +\n `${(parseFloat(bankBalanceElement.value))*2} kr. \\n ${promptText}`);\n // if not, user can get a loan\n } else {\n bankBalanceElement.value = parseFloat(bankBalanceElement.value) + parseFloat(amount);\n loanBalanceElement.value = parseFloat(amount);\n hasTakenLoan = true;\n // make reapy loan button and loan amount appear\n document.getElementById(\"repayloan-button\").className = 'button'; \n document.getElementById(\"loan-amount\").className = 'container-text'; \n break;\n } \n // if user does not enter a number, prompt again\n } else {\n amount = prompt(`You need to enter a number. \\n ${promptText}`);\n }\n } \n }\n}", "function castle(i,j,turn)\r\n{\r\n if (turn == 1)\r\n {\r\n if(king_1_moved != 1 && flag != 1){\r\n if(name_3.textContent[6] == 1)\r\n {\r\n if(elephant_1_1!=1)\r\n {\r\n common_operation('1eleph1', '1_king_');\r\n \r\n }\r\n }\r\n else\r\n {\r\n if(elephant_1_2 != 1)\r\n {\r\n common_operation('1eleph2', '1_king_');\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n\r\n if(king_2_moved != 1 && flag != 1){\r\n if(name_3.textContent[6] == 1)\r\n {\r\n if(elephant_2_1!=1)\r\n {\r\n common_operation('2eleph1', '2_king_');\r\n }\r\n }\r\n else\r\n {\r\n if(elephant_2_2 != 1)\r\n {\r\n common_operation('2eleph2', '2_king_');\r\n }\r\n }\r\n }\r\n }\r\n\r\n}", "function gamechanger() {\n\n\t\n\t//restarting the game\n\t\n\t\t//restarting widgets\n\n\trestartTimer();\n\trestartFlicker();\n\n\n\tconsole.log(selectLevel.value);\n\n\tif (selectLevel.value === \"game-small\") {\n\t\tmainSection[1].classList.add(\"not-selected\");\n\t\tmainSection[0].classList.remove(\"not-selected\");\n\t\tcards.length = 12;\n\n\t\tboard[0].addEventListener(\"click\", firstChosen);\n\n\t} else {\n\t\tmainSection[0].classList.add(\"not-selected\");\n\t\tmainSection[1].classList.remove(\"not-selected\");\n\t\tcards.length = 18;\n\n\t\tboard[1].addEventListener(\"click\", firstChosen);\n\t}\n\tassign();\n\tplay();\n\tif(firebase.auth().currentUser){recordKeeping(firebase.auth().currentUser.uid)};\n\tgetChampion();\n}", "function luxuryTax() {\n if (turn == \"player\"){\n if(playerCash < 75){\n checkBankruptcy();\n }else{\n playerCash -= 75\n updateCash();\n playerUpdate(\"Room and board. Pay up.\")\n }\n }else if(turn == \"enemy\"){\n if(enemyCash < 75){\n checkEnemyBankruptcy();\n }else{\n enemyCash -= 75\n updateCash();\n enemyUpdate(\"Room and board. Pay up.\")\n }\n }\n}", "function start(action) {\r\n\t\r\n\t\tswitch (action) {\r\n\t\t\tcase 'go look':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: What are you going to look at??\", 1000);\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'explore':\r\n\t\t\t\texploreship(gameobj.explore);\r\n\t\t\t\tgameobj.explore++;\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'sit tight':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: Good choice we should probably wait for John to get back.\", 1000);\r\n\t\t\t\tgameobj.sittight++;\r\n\t\t\tbreak;\t\r\n\t\t}\r\n}", "function changeLight() {\n if (OrangeCounter > 0) {\n LIGHT = \"Orange\";\n OrangeCounter -= 1;\n }\n else if (random() < ChangeProb) {\n newLIGHT = ((LIGHT == \"Red\") ? \"Green\" : \"Red\");\n OrangeCounter = OrangeTime;\n } else if (OrangeCounter <= 0) {\n OrangeCounter = 0;\n LIGHT = newLIGHT;\n }\n}", "function switchLanguageInBlockly() {\n workspace = ROBERTA_PROGRAM.getBlocklyWorkspace();\n translate();\n var programBlocks = null;\n if (workspace !== null) {\n var xmlProgram = Blockly.Xml.workspaceToDom(workspace);\n programBlocks = Blockly.Xml.domToText(xmlProgram);\n }\n // translate programming tab\n ROBERTA_TOOLBOX.loadToolbox(userState.toolbox);\n ROBERTA_PROGRAM.updateRobControls();\n ROBERTA_PROGRAM.initProgramEnvironment(programBlocks);\n }", "function switchToThisTheme(evt) {\n\n evt.preventDefault();\n var $el = ga(evt.target);\n var theme_id = escape($el.attr('id').match(/\\d/g).join('')),\n cover_position = escape($el.data('cvposition')),\n cover_url = $el.data('themeurl');\n createScrollBack();\n customCoverSet(cover_url, theme_id, cover_position);\n\n}", "function onClickFireSecondary() {\r\n\r\n vaultDweller.currentAttackMode = \"grenade\";\r\n\toutput = \"<p> Grenade ready! <span class=\\\"update\\\">Click the target you want to blow to smithereens!</span></p>\";\r\n\t\r\n\tLogInfo(output);\r\n}", "function C101_KinbakuClub_Discipline_Click() {\n\n\t// Jump to the next animation\n\tTextPhase++;\n\t\t\t\n\t// Jump to lunch on phase 3\n\t//if (TextPhase >= 4) SaveMenu(\"C102_KinbakuDiscipline\", \"Intro\");\n\n}", "function gereTourCombat() {\r\n // SI tourJoueur1 = 0 au départ TOUR JOUEUR 1\r\n if(tourJoueur1 < 1) { // tourJoueur1 vaut 0 au début\r\n joueur2.passeSonTourAu(joueur1); // Change le texte de MON TOUR dans l'ATH des joueurs en OUI ou NON\r\n AttaqueOuDefense(); // Demande au joueur 2 de choisir si il attaque ou se défend\r\n tourJoueur1++; // mais il vaudra 1 pour la fonction et pour passer de tour\r\n } else {\r\n joueur1.passeSonTourAu(joueur2);\r\n AttaqueOuDefense();\r\n tourJoueur1--;\r\n }\r\n}", "function C007_LunchBreak_Natalie_OpenGag() {\r\n CurrentTime = CurrentTime + 60000;\r\n PlayerLockInventory(\"DoubleOpenGag\");\r\n}", "function buyGym(){\n\t\t\tbuyClick(\"localgym\");\n\t\t}", "function changeCurrency() {\n if (mainCurrency == 'us') {\n mainCurrency = 'htg';\n inputCurrency.checked = true;\n displayCurrency.textContent = 'US'\n } else {\n mainCurrency = 'us';\n inputCurrency.checked = false;\n displayCurrency.textContent = 'HTG'\n }\n // Refresh the rate\n changeRate();\n calculate();\n}", "function toggleRights() {\n (document.getElementById(\"reprodrights\").clicked === false)? totalCost -= 1250 : totalCost += 1250;\n\n document.getElementById(\"estimate\").innerHTML = \"$\" + totalCost;\n}", "function switchwhoGo(){\n if (whoGo == \"S\"){\n whoGo = \"G\"\n setwhoGoTab()\n } else if (whoGo == \"G\"){\n whoGo = \"S\"\n setwhoGoTab()\n }\n}", "function LightningClickSingle(e){\n\tvar cx = e.pageX-sx;\n\tvar cy = e.pageY-sy;\n\nif(cy<500 && (Date.now()-LastClick)>170){\t\nLastClick = Date.now();\n\tlightning = new Lightning(400, 465, cx, cy);\n\t\n\tfor(var i = 0; i<Enemies.length; i++){\n\tvar ix = cx-Enemies[i].x;\n\tvar iy = cy-Enemies[i].y;\n\tif(Math.sqrt(ix*ix+iy*iy)<Enemies[i].radius && !Enemies[i].dead){\n\tEnemies[i].lightningResist(lightning.damage);\n\n\tsetTimeout(function(){\n\tlightning.lightningJump(Math.round((LightningPower-1)*5), i, lightning.damage*=0.7, (LightningPower-1)*150/LightningPower-10, cx, cy)\n\t}, 25);\n\tbreak;\n\t}\n\t\t}\n\t}else{\n\t\tCheckPressed(cx, cy);\n\t}\n}", "function GoOnCooldown() {\n\tonCooldown = true;\n\tSetImage(\"cooldown\");\n\tChangeKanaText(this.hirigana);\n\tthis.timeLastUsed = Time.time;\n\thudAbilities.timeLastUsed = Time.time;\n\t//Invoke(\"GoOffCooldown\", cooldown);\n}", "function switchLight(lightNumber) {\n allOff();\n var light = LIGHTS[lightNumber];\n light.classList.add(\"on\");\n\n if (lightNumber == 0)\n red();\n\n if (lightNumber == 2)\n ready();\n}", "function suivant(){\n if(active==\"idee\"){\n reunion_open();\n }else if (active==\"reunion\") {\n travail_open();\n }else if (active==\"travail\") {\n deploiement_open();\n }\n }", "function newTurn() {\n\t\n\t// check if we have had a winner already\n\tif (current_team == NONE) return;\n\t\n\tvar bma_string = \"\";\n\t\n\t// work out our new game board state\n\tif (current_team == YELLOW) {\n\t\tcurrent_team = RED;\n\t\tbma_string = \"place_red\";\n\t} else {\n\t\tcurrent_team = YELLOW;\n\t\tbma_string = \"place_yellow\";\n\t}\n\t\n\t// set the placement images at the top of the board\n\tfor (var col = 0; col < max_col; col++) {\n\t\tvar bma = map[col][1];\n\t\tbma.gotoAndPlay(bma_string);\n\t}\n}", "loseTurn(){\n this.playerTurn = (this.playerTurn % 2) + 1;\n this.scene.rotateCamera();\n this.previousBishops = ['LostTurn'];\n this.activeBishop = null;\n }", "function toSwitch(trackingActive, calMets)\n{\n if (!trackingActive && calMets > 10)\n {\n return \"go active\";\n }\n else if (trackingActive && calMets <= 10)\n {\n return \"go inactive\";\n }\n return \"continue\";\n}", "function changeToCivilians()\r\n{\r\n academyFlag = true;\r\n //document.getElementById(\"USNavyBtn\").checked = true;\r\n changeDisplayCategory();\r\n loadUSNavy();\r\n makeCivBar();\r\n}" ]
[ "0.5775484", "0.57092154", "0.56171525", "0.5586435", "0.5569915", "0.55401623", "0.55099064", "0.5484802", "0.54785234", "0.54754204", "0.5451688", "0.5438896", "0.54044884", "0.53793186", "0.53560555", "0.5335163", "0.5316526", "0.53100467", "0.5305946", "0.528372", "0.5261143", "0.52569234", "0.5254004", "0.5248844", "0.52458614", "0.5234627", "0.52202237", "0.5219239", "0.5216217", "0.51985645", "0.51938343", "0.51924825", "0.5189861", "0.51853865", "0.51844245", "0.5181676", "0.5176737", "0.5171279", "0.5168207", "0.5152815", "0.5144104", "0.5143644", "0.51429135", "0.51290977", "0.5126874", "0.5123881", "0.51215625", "0.5107565", "0.51065516", "0.51027817", "0.50996494", "0.50983423", "0.5092443", "0.5088192", "0.5084935", "0.50772154", "0.5076133", "0.50675046", "0.50650364", "0.50487393", "0.5041423", "0.50412834", "0.50400096", "0.5038026", "0.50320923", "0.50241363", "0.5022573", "0.5018191", "0.5016796", "0.5013417", "0.5007487", "0.50068533", "0.5001057", "0.4999358", "0.499624", "0.49900976", "0.49844852", "0.49842155", "0.49787232", "0.4977981", "0.49759385", "0.49720067", "0.49703267", "0.49699968", "0.49670807", "0.4962389", "0.49620703", "0.4961384", "0.49605265", "0.49586862", "0.4950213", "0.49471933", "0.4946174", "0.49431625", "0.49427354", "0.49415258", "0.49398094", "0.49372345", "0.49330038", "0.49321252" ]
0.5369343
14
console.log(find_missing_number([8,3,5,1], [1,5,3])); Time complexity O(n) Declare a function that compares each element to every other element of the list. Then return the element if all the other elements are greater than it. Phase I
function my_min1(arr){ for (let i=0; i<arr.length; i++){ let min= true; for(let k=i+1; k<arr.length; k++){ if (arr[k]<arr[i]){ min = false; } } if (min){ console.log(arr[i]); return arr[i]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMissing() {\n let array = [9, 2, 0, 5, 3, 1, 7, 8, 4];\n // sort the array in ascending order first.\n for (let i = array.length; i >= 0; i--) {\n for (let j = array.length - 1; j >= 0; j--) {\n if (array[i] > array[j]) {\n let tempNum = array[i];\n array[i] = array[j];\n array[j] = tempNum;\n }\n }\n }\n // now find the missing number.\n let missing;\n for (let i = 0; i < array.length; i++) {\n if (array[i] !== i && typeof missing !== \"number\") {\n missing = i;\n console.log(i);\n }\n }\n\n return missing;\n}", "function findMissing(arr) {\n\n //sort the array\n //get the length - 1 for \"n\";\n //check which number is missing\n let n = arr.length -1;\n\n \n\n for (let i = 1; i < arr.length; i++) {\n let j = i - 1;\n let temp = arr[i];\n while(j >=0 && temp < arr[j]) {\n arr[j + 1] = arr[j];\n j = j - 1;\n }\n arr[j + 1] = temp;\n }\n let missingNum = 0;\n\n for (let i = 0; i < arr.length - 1; i++) {\n if(arr[i] + 1 !== arr[i + 1]) {\n missingNum = arr[i] + 1;\n return `${missingNum} is the missing number`;\n }\n }\n\n\n return 'no missing number';\n}", "function missing(arr) {\n var x = 0;\n for (var i = 0; i < arr.length; i++) {\n x = x + 1;\n if (arr[i] != x) {\n return(x);\n }\n }}", "function findMissingNumber(numberList, n) {\n if (!Array.isArray(numberList) || numberList.length === 0) return -1;\n const newArray = [];\n for (let i = 5; i <= n; i++) {\n newArray.push(i);\n }\n for (let i = 0; i < newArray.length; i++) {\n if (numberList[i] !== newArray[i]) return newArray[i];\n }\n return -1;\n}", "function findMissing(numbers){\n // cari min dan max\n var min = Math.min(...numbers)\n var max = Math.max(...numbers)\n\n // looping sebanyak min dan max\n for(var i = min ; i <= max ; i++){\n if( !numbers.includes(i)){\n console.log(i)\n }\n }\n\n // trus cari yang miss\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n \n \n let sorted = Array.from(new Set(A.filter(v => v>0))).sort(function(a,b) {\n return a-b;\n });\n let missing = 1;\n let found = false;\n \n if(sorted.length==0) {\n found = true;\n }\n \n for(let i=0;i<sorted.length && !found;i++) {\n if(sorted[i]>missing) {\n found = true;\n }\n else {\n missing++;\n }\n }\n return missing;\n}", "findMissingNumber(arr) {\n function sumArray() {\n let add = (a, b) => a + b;\n return arr.reduce(add);\n }\n\n function sum() {\n let totalArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n let add = (a, b) => a + b;\n return totalArray.reduce(add);\n }\n\n return sum() - sumArray();\n\n // for (var i = 1; i < arr.length; i++) {\n // if (arr[i] - arr[i - 1] != 1) {\n // //Not consecutive sequence, here you can break or do whatever you want\n // return arr[i] - 1;\n // }\n // }\n }", "missingNumber(arr, n) {\n const check = {};\n arr.sort((a, b) => a - b);\n const mySet = new Set(arr);\n let k = 1;\n for (let item of mySet) {\n if (item > 0) {\n if (item !== k) {\n break;\n } else {\n k++;\n }\n }\n }\n return k;\n }", "function findMissingValue(arr) {\n var x = 0;\n for(let i=0; i < arr.length; i++){\n x = x +1;\n if(arr[i] != x){\n return (x+1);\n }\n }\n\n}", "function findMissing(A) {\n A.sort()\n\n if (A.length === 0) {\n return undefined\n }\n for (let i = 0; i < A.length; i++) {\n if (i === 0) {\n if (A[0] + 1 !== A[1] && A[2] === A[1] + 1) {\n return A[1] - 1\n }\n }\n else if (i === A.length - 1) {\n if (A[i - 1] !== A[i] - 1) {\n return A[i] - 1\n }\n }\n else if (A[i + 1] !== A[i] + 1) {\n return A[i] + 1\n }\n }\n}", "function findSmallestMissingNumber(arr) {\n if (arr[0] !== 0) {\n return 0;\n } else {\n for (let i=0; i<arr.length; i++) {\n if (arr[i+1] - arr[i] > 1) {\n return arr[i] + 1;\n }\n }\n return \"no missing numbers\"\n }\n}", "function findMissingNum(arr) {\n let missing = [];\n let arrLength = Math.max.apply(Math, arr);\n let newArr = arr.filter(function(num) {\n if(num !== 0) {\n return num;\n }\n });\n for(let i = 0; i < arrLength; i++) {\n if(arr.indexOf(i) < 0) {\n missing.push(i);\n }\n }\n return missing;\n }", "function missingNum(arr) {\n for (let i = 1; i <= 10; i++) {\n if (! arr.includes(i)) return i;\n // @HINT: maybe reduce computational effort\n }\n}", "function determineMissingVal(array){\n for(var i=0; i<array; i++)\n if(i + 1 !== i + 1){\n return (i + 1)\n }\n }", "function missingNumber(nr, arrayNr) {\n\tfor(let i=0; i<arrayNr.length-1; ++i) {\n\t\tfor(let j=i+1; j<arrayNr.length; ++j) {\n\t\t\tif(arrayNr[i]>arrayNr[j]) {\n\t\t\t\tlet sw=arrayNr[i];\n\t\t\t\tarrayNr[i]=arrayNr[j];\n\t\t\t\tarrayNr[j]=sw;\n\t\t\t}\n\t\t}\n\t}\n\tif (arrayNr[0]==2) return 1;\n\tfor(let i=0; i<arrayNr.length-1; ++i) {\n\t\tif(arrayNr[i]+1!=arrayNr[i+1]) return arrayNr[i]+1;\n\t}\n\treturn arrayNr[arrayNr.length-1]+1;\n}", "function lostNumbers(first, second, third) {\n\tvar biggest = smallest = first;\n\tvar input_arr = [first, second, third];\n\n\tfor(var input of input_arr){\n\t\tif(biggest < input){\n\t\t\tbiggest = input;\n\t\t}\n\t\tif(smallest > input){\n\t\t\tsmallest = input;\n\t\t}\n\t}\n\n\tfor(var i = smallest+1; i < biggest; i++){\n\t\tif(input_arr.indexOf(i)=== -1){\n\t\t\tconsole.log(i);\n\t\t}\n\t}\n}", "function missingInt(array){\n array.sort()\n for (let i=0; i<=array.length; i++) {\n if(array[i] + 1 !== array[i+1]){\n return array[i] + 1\n }\n }\n}", "function findEle(number,n)\n{\n let output\n for(let i=0;i<number.length;i++)\n {\n if(number[i]>n)\n {\n output=number[i]\n break\n }\n }\n return output;\n}", "function findMissingNum(nums) {\n const numSet = new Set(nums);\n let i = 1;\n while (numSet.has(i)) i++;\n return i;\n}", "function missingNumber(num) {\n var missing = -1;\n\n for (var i = 0; i <= num.length - 1; i++) {\n if (num.indexOf(i) === -1) {\n missing = i;\n }\n }\n return missing;\n}", "function missingPositiveInt(integers) { // parameter is an array\n\n // use the array's indices to track which integers exist in the array,\n // disregarding any number < 1 (not a positive int) or greater than the array\n // length (impossible to be the lowest missing int).\n for (var i = 0; i < integers.length; i++) {\n\n // if element is equal to its index + 1, continue.\n if (integers[i] === i + 1) {\n continue;\n\n // if element is not a positive int or is greater than the array's length,\n // change value to null.\n } else if (integers[i] < 1 || integers[i] > integers.length) {\n integers[i] = null;\n\n // otherwise, move the element to its appropriate position, using the\n // var onDeck to track what needs to be moved next. Repeat until the onDeck\n // int does not need to be moved.\n } else {\n var onDeck = integers[i];\n integers[i] = null;\n\n while (onDeck > 0 && onDeck <= integers.length) {\n\n if (integers[onDeck - 1] === onDeck) {\n break;\n }\n\n // swap onDeck with integers[onDeck - 1]\n var tmp = integers[onDeck - 1];\n integers[onDeck - 1] = onDeck;\n onDeck = tmp;\n }\n }\n }\n\n // the first null value will be the lowest missing positive int\n for (var i = 0; i < integers.length; i++) {\n\n if (integers[i] === null) {\n return i + 1;\n }\n }\n\n //if no null values are found, return the next positive int\n return integers.length + 1;\n}", "function findMissingValue(arr) {\n let sum = 0;\n let natSum = arr.length;\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i];\n natSum += i;\n }\n return natSum - sum;\n} //checked and this one worked", "function missingNumberInArray(array) {\n var xorOfElements = array.reduce((a,b) => a ^ b);\n\n var xorOfRange ;\n for(var i = 0; i <= array[array.length - 1]; i++) {\n xorOfRange = xorOfRange ^ i;\n }\n\n return xorOfElements ^ xorOfRange;\n }", "function missingNumberBetterAlgo(arr) {\n var n = arr.length + 1,\n sum = 0,\n expectedSum = n * (n + 1) / 2;\n for (var i = 0, len = arr.length; i < len; i++) {\n sum += arr[i];\n }\n return expectedSum - sum;\n}", "function findMissingValue(arr) {\n arr.sort();\n for (var i=0; i<arr.length; i++){\n if (arr[i] != i){\n return i;\n }\n } return arr.length;\n}", "function findOutlier(integers) {\n let count = (Math.abs(integers[0] % 2) + Math.abs(integers[1] % 2) + Math.abs(integers[2] % 2)) >= 2 ? 1 : 0;\n console.log(count);\n for (let i = 0; i < integers.length; i++) {\n if (Math.abs(integers[i] % 2) !== count) return integers[i];\n }\n}", "function missingNumber(arr){\n var n = arr.length + 1, \n \n sum = 0,\n \n expectedSum = n * (n+1)/2;\n \n for(var i = 0, len = arr.length; i < len; i++){\n \n sum += arr[i];\n \n }\n \n return expectedSum - sum;\n}", "function missingValue(nums) { }", "function func5(inputArray){\n if(inputArray===[]){\n return 0;\n }\n var result=inputArray[0];\n for(var i=1; i<inputArray.length; i++){\n if(inputArray[i]>result){\n result=inputArray[i];\n }\n }\n return result;\n}", "function findN(number,num){\n const result1=number.find(function(n)\n{\n return n > num\n})\nreturn result1\n}", "function missingNumberCount(array) {\r\n array.sort((a, b) => a - b);\r\n let number = array[array.length - 1] + 1 - array[0] - array.length;\r\n return number;\r\n}", "function missing1(A) {\n const N = A.length + 1;\n\n for (let i = 1; i < N; i++) {\n let found = false;\n for (let j = 0; j < A.length && !found; j++) {\n if (i === A[j]) {\n found = true;\n }\n }\n if (!found) {\n return i;\n }\n }\n}", "function missingNumber(arr) {\n var n = arr.length + 1,\n sum = 0,\n expectedSum = (n * (n + 1)) / 2;\n for (var i = 0, len = arr.length; i < len; i++) sum += arr[i];\n return expectedSum - sum;\n}", "function missing2(A) {\n let N = A.length + 1;\n let fullSum = 0;\n for (let i = 1; i <= n; i++) {\n fullSum = fullSum + i;\n }\n return fullSum;\n}", "function missingNumbers(arr, brr) {\n \n //all but one\n \n // const finArr = []\n\n // arr.sort((a,b)=>{return a-b})\n // brr.sort((a,b)=>{return a-b})\n \n // let i = 0\n // while (i < brr.length) {\n // if (arr[i] !== brr[i]) {\n // const toFin = brr.splice(i, 1)\n // finArr.push(toFin)\n // }\n // else {\n // i++\n // }\n // }\n \n // return finArr.sort((a, b) => {return a - b})\n \n const compareArr = []\n for (let i = 0; i < 10001; i++) {\n compareArr.push(0)\n }\n \n for (let i = 0; i < arr.length; i++) {\n compareArr[arr[i]]--\n }\n \n for (let i = 0; i < brr.length; i++) {\n compareArr[brr[i]]++\n }\n \n const finalArr = []\n for (let i = 0; i < 10001; i++) {\n if (compareArr[i] > 0) {\n finalArr.push(i)\n }\n }\n \n return finalArr\n\n}", "function findMissing(arr) {}", "function find_first_smallest_missing_positive(nums) {\n let i = 0;\n let n = nums.length;\n while (i < n) {\n let j = nums[i] - 1;\n if (nums[i] > 0 && nums[i] <= n && nums[i] !== nums[j]) {\n [nums[i], nums[j]] = [nums[j], nums[i]]; // swap\n } else {\n i += 1;\n }\n }\n for (let i = 0; i < n; i++) {\n if (nums[i] !== i + 1) {\n return i + 1;\n }\n }\n\n return nums.length + 1;\n}", "function findUnique2(numbers) {\n numbers.sort();\n for (var i = 0; i < numbers.length; i += 2) {\n if (numbers[i] !== numbers[i + 1]) {\n return numbers[i];\n }\n }\n return undefined;\n}", "function missing2(A) {\n const N = A.length + 1;\n let fullSum = 0;\n for (let i = 1; i <= N; i++) {\n fullSum += i;\n }\n let sum = 0;\n for (let i = 0; i < A.length; i++) {\n sum += A[i];\n }\n return fullSum - sum;\n}", "function missingNumberSum(numbers) {}", "function missingNumber(arr){\r\n // =========== code starts here =============\r\n var lengthPlus = arr.length+1, \r\n sum = 0,\r\n expectedSum = lengthPlus * (lengthPlus + 1)/2;\r\n \r\n for(var i = 0, len = arr.length; i < len; i++){\r\n sum += arr[i];\r\n }\r\n \r\n return expectedSum - sum;\r\n // =========== code ends here ==============\r\n }", "function missingNum(arr) {\n let sum = 0;\n for (let i = 0; i <= arr.length; i++) {\n sum += i\n }\n\n for (let i = 0; i < arr.length; i++) {\n sum -= arr[i]\n }\n return sum;\n}", "function missing(arr) {\n if (arr.length < 2) return [];\n var result = [];\n var min = arr[0];\n var max = arr[arr.length - 1];\n\n for (var i = min + 1; i < max; i++) {\n if (arr.indexOf(i) === -1) result.push(i);\n }\n return result;\n}", "function missingNum(arr){\n let expectedSum = arr.length;\n let actualSum = 0;\n for(let i = 0; i < arr.length; i++){\n expectedSum += i;\n actualSum += arr[i];\n }\n return expectedSum - actualSum;\n}", "missingNumber(arr, n) {\n //Move all negative to left side of the array\n let k = 0;\n for (let i = 0; i < n; i++) {\n if (arr[i] <= 0) {\n [arr[k], arr[i]] = [arr[i], arr[k]];\n k++;\n }\n }\n }", "function findOutlier(integers){\n //your code here\n var odd = [];\n var even = [];\n \n function remainder(num){\n return num%2;\n }\n \n var numbers = integers.map(remainder)\n \n for(var i = 0; i < numbers.length; i++){\n if (numbers[i] === 0){\n even.push(integers[i]);\n } else {\n odd.push(integers[i]);\n }\n };\n return even.length==1 ? even[0] : odd[0];\n}", "function permMissingElem2(A) {\n\tvar comparisonArray = [];\n\t\n\tfor (var i=0; i < A.length +1; i++) {\n\t\tcomparisonArray[i] = i+1;\n\t}\n\n\tfor (i=0; i < comparisonArray.length; i++) {\n\t\tif (A.indexOf(comparisonArray[i]) === -1) {\n\t\t\treturn comparisonArray[i];\n\t\t} \n\t\n\t}\n\n}", "function findMissing(arr, size) \n{ \n // First separate positive and \n // negative numbers \n let shift = moveNegToLeft(arr, size); \n let arr2 = [];\n let j = 0; \n for (let i = shift; i < arr.length; i++) { \n arr2[j] = arr[i]; \n j++; \n } \n // Shift the array and call \n // findMissingPositive for \n // positive part \n return findMissingPositive(arr2); \n\n}", "function findNegativeNum(nums) {\n return nums.find(function(num) {\n // === nums.find((num) => { : common callback function\n return num < 0;\n });\n}", "function findOutlier(integers){\r\n var oddArray = [];\r\n var evenArray = [];\r\n integers.forEach(function(elem){\r\n if (elem % 2 ==0) {\r\n return evenArray.push(elem);\r\n }\r\n return oddArray.push(elem);\r\n });\r\n if (oddArray.length === 1) {\r\n return oddArray[0];\r\n } else if (evenArray.length === 1) {\r\n return evenArray[0];\r\n} else {\r\n console.log(\"This is not the problem as I understand it\"):\r\n return false;\r\n}\r\n\r\n}", "function findMissingValue(arr) {\n let newArr = [];\n\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr.length + 1; j++) {\n if (arr[i] == j) {\n newArr[j] = arr[i];\n }\n }\n }\n\n console.log(newArr)\n\n for (var k = 0; k < newArr.length - 1; k++) {\n if (newArr[k] === undefined) {\n return k;\n }\n }\n}", "function findSetSumsToWrongNo(input, wrong) {\n for(let i = 0; i < input.length; i++) {\n const elements = [input[i]];\n let sum = parseInt(input[i]);\n\n for(let j = i + 1; j < input.length; j++) {\n sum += parseInt(input[j]);\n elements.push(input[j]);\n\n if(sum == wrong) {\n return elements;\n } else if(elements > wrong) {\n break;\n }\n }\n }\n}", "function missingValue(arr){\n var min = arr[0]\n var max = arr[0]\n for ( var x = 0; x < arr.length; x++){\n if (arr[x] < min){\n min = arr[x]\n }\n if (arr[x] > max){\n max = arr[x]\n }\n }\n if( min <= 0){\n return false\n }\n for (var i = 0; i < arr.length; i++){\n for(var j = 0; j < arr.length; j++){\n if (arr[j] == min +1){\n min = arr[j]\n }\n }\n }\n if( min != max){\n return \"missing value is \" + (min + 1)\n }\n return true\n}", "function missingNumbers(arr, brr) {\n arr = arr.sort(((a, b) => a - b));\n brr = brr.sort(((a, b) => a - b));\n let resultArr = [];\n let j = 0;\n for (let i = 0; i < brr.length; i++) {\n while (brr[i] != arr[j]) {\n if (resultArr[resultArr.length - 1] != brr[i]) resultArr.push(brr[i]);\n i++;\n }\n j++;\n }\n return resultArr;\n}", "function solution(arr){\n let nearNumber =[];\n return arr.filter((item,i,self)=>{\n if(self[i]- self[i+1] === -1){\n return neearNumber.push(self[i],self[i-1]);\n }\n })\n}", "function missingNums(arrayEntered) {\n let comparisonSum = 0;\n for (let i = 1; i <= 10; i++) {\n comparisonSum += i;\n }\n let arrayEnteredSum = arrayEntered.reduce((acc, current) => acc + current);\n return comparisonSum - arrayEnteredSum;\n}", "function findMissing(arr1, arr2) {\n let sortedArr1 = arr1.sort((a,b) => a - b);\n let sortedArr2 = arr2.sort((a,b) => a - b);\n\n for (let i = 0; i < sortedArr1.length; i++) {\n let potential = sortedArr1[i];\n let curr = sortedArr2[i];\n\n if (potential !== curr) {\n return potential;\n }\n }\n}", "function solution(arr) {\n let max = 0,\n map = arr.reduce((accum, num)=> {\n if(num > 0) accum[num] = true;\n if(num > max) max = num;\n return accum;\n }, {});\n\n for(let i=1; i<=max+1; i++) {\n if(!map[i]) return i;\n }\n}", "function findOutlier(integers){\n let n = 0,m = 0;\n let outlier = 0; \n for(let i = 0; i < 3; i++){ /* Count number of odd and even integers for minimum length */\n (Math.abs(integers[i]) % 2 === 0) ? n++ : m++; \n }\n \n if(n > m){ // if there is more even numbers\n let i = 0;\n while(i < integers.length){\n if (Math.abs(integers[i]) % 2 === 1) {\n outlier = integers[i]; // retrieve the only odd number\n }\n i++;\n }\n }\n else{\n let i = 0;\n while(i < integers.length){\n if (Math.abs(integers[i]) % 2 === 0) {\n outlier = integers[i];\n }\n i++;\n } \n }\n return outlier;\n}", "function missingNum(arr) {\n const reduceArr = arr.reduce((acc, crv) => {\n return acc + crv\n }, 0)\n\n const oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\n const startingSum = oneToTen.reduce((acc, crv) => {\n return acc + crv\n }, 0)\n\n return startingSum - reduceArr\n}", "function missingNumbers(arr, brr) {\n // Complete this function\n\n brr.sort();\n arr.sort();\n\n var tmp = [];\n var found = false;\n var arrId = 0;\n\n for (var i = 0; i < brr.length; i++) {\n for (var j = arrId; j < arr.length; j++) {\n if (brr[i] === arr[j]) {\n found = true;\n arrId = j + 1;\n break;\n }\n }\n\n if (!found && tmp[tmp.length - 1] !== brr[i]) {\n tmp.push(brr[i]);\n }\n found = false;\n }\n\n return tmp;\n}", "function iqTest(numbers){\n if (numbers[0] % 2 === 0) {\n for (var i = 0; i < numbers.length; i++) {\n if (numbers[i] % 2 !== 0) {\n indexOfException = numbers.indexOf(numbers[i]);\n indexOfException += 1;\n console.log('this is the position of outlier in array', indexOfException);\n }\n }\n }\n else if (numbers[0] % 2 !== 0) {\n for (var i = 0; i < numbers.length; i++) {\n if (numbers[i] % 2 == 0) {\n indexOfException = numbers.indexOf(numbers[i]);\n indexOfException += 1;\n console.log('this is the position of outlier in array', indexOfException);\n }\n }\n }\n}", "function findWrongNumber(input, p) {\n loop1:\n for(let i = p; i < input.length; i++) {\n let x = input[i];\n let j = i - p;\n let z = i - 1;\n\n let originalP = [];\n let sortedP = [];\n\n for(var1 = j; var1 <= z; var1++) {\n originalP.push(parseInt(input[var1]));\n }\n\n originalP.sort(function(a, b){return a-b});\n\n var1 = 0;\n var2 = originalP.length - 1;\n\n while(var1 < var2) {\n if(originalP[var1] + originalP[var2] == x) {\n continue loop1;\n } else if(originalP[var1] + originalP[var2] > x) {\n var2--;\n } else {\n var1++;\n }\n }\n\n return x;\n }\n}", "function f(n) {\n return [0].indexOf(n - n + 0);\n}", "function missingNumbers(misingNumbersArray, originalArray) {\n\n // Loop through array of missing numbers to get ocurrences\n const incompleteArrOcurrences = getNumberOcurrences(misingNumbersArray);\n\n // Loop through original array to find numbers missing from the first array\n const missingNumbers = findMissingNumbers(incompleteArrOcurrences, originalArray);\n return missingNumbers.sort((a, b) => a - b);\n\n}", "function findLoestValueAraay(numbers2){\n let lowest = numbers2[0];\n for(let j=0;j<numbers2.length;j++){\n const element = numbers2[j];\n if(element<lowest){\n lowest= element;\n }\n\n }return lowest;\n}", "function almostStrictlyIncreasing(arr) {\n\n let hasRemove = false;\n let curr = arr[0]; // creating a pointer to compare three elements at a time\n\n for (let i = 1; i < arr.length; i++) { // one for loop makes it O(n)\n\n if (curr < arr[i]) { // we want to always be storing the smallest of the 3 elements we are looking at\n curr = arr[i];\n }\n else {\n\n if (hasRemove) {\n return false;\n }\n if (i < 2) { //edge case\n curr = arr[i]\n } else {\n curr = arr[i] <= arr[i - 2] ? curr : arr[i];\n // console.log(curr);\n }\n hasRemove = true;\n }\n }\n return true;\n}", "function findGreaterNumbers(arr){\n var ctr = 0;\n for (var i = 0; i < arr.length; i++) {\n for (var j = i + 1; j < arr.length; j++) {\n if (arr[j] > arr[i]) {\n ctr++;\n }\n }\n }\n return ctr;\n}", "function generateNumber(arr, n) {\n let a = arr.find(num => num === n);\n if (!a) return n;\n else \n let values = [];\n let cool = null;\n\n for (let i = 1; i <= 9; i++) {\n for (let j = 9; j >= 1; j--) {\n if (i + j === n) {\n values.push(parseInt(`${i}${j}`));\n }\n }\n }\n\n for (let i = 0; i < values.length; i++) {\n if (!arr.includes(values[i])) {\n cool = values[i];\n break;\n }\n }\n return cool;\n }", "function findOutlier(arr){\n // if arr is mostly odds, oddCount should be 3 or 2\n const oddCount = Math.abs(arr[0] % 2) + Math.abs(arr[1] % 2) + Math.abs(arr[2] % 2);\n const remainder = oddCount >= 2 ? 1 : 0; // expected remainder of most elements of arr\n console.log(oddCount,remainder);\n for(let int of arr){\n if(Math.abs(int % 2) !== remainder) {return int;}\n }\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n var ret = 1;\n A = A.sort((a,b) => a - b);\n var ALength = A.length;\n for(var i = 0; i < ALength; i++){\n if(A[i]!=i+1){\n ret = 0;\n break;\n } \n }\n return ret;\n}", "function solution (A) {\n const N = A.length\n\n if (N === 0) {\n // Empty A\n return A\n }\n\n if (N % 2 === 0 || N > 1000000) {\n // A does not contain an odd number of elements\n return A\n }\n\n if (A.find(x => (x < 1 || x > 1000000))) {\n // An A element is too small or too large\n return A\n }\n\n // Find unique elements\n const one = []\n\n for (let i = 0; i < A.length; i += 1) {\n const num = A[i]\n const index = one.indexOf(num)\n\n if (index === -1) {\n one.push(num)\n } else {\n one.splice(index, 1)\n }\n }\n // Find the unpaired number\n return one[0]\n}", "function stray(numbers) {\n if(numbers[0] !== numbers[1] && numbers[2] == numbers[0]){\n return numbers[1]\n } else if (numbers[0] !== numbers[1] && numbers[2] == numbers[1]){\n return numbers[0]\n } else {\n return numbers.find(function(element){\n return element !== numbers[0];\n });\n }\n}", "function findMissingArray(array){\n let result = [];\n for (let index = 1; index <= 10; index++) {\n if(array.indexOf(index) === -1){\n result.push(index);\n } \n }\n console.log(\"findMissingArray\", result, \"---FAILED\");\n \n }", "function findOutlier(integers){\n return integers.filter(x => x % 2 == 0).length == 1 ? integers.filter(x => x % 2 == 0)[0] : integers.filter(x => x % 2 != 0)[0];\n}", "function missingNumbers(arr, brr) {\n \n var hm=new Map();\n for(var i=0;i<arr.length;i++)\n {\n if(hm.get(arr[i])!=null)\n {\n var value=hm.get(arr[i]);\n \n hm.set(arr[i],value+1);\n }\n else\n {\n hm.set(arr[i],1);\n }\n }\n for(var j=0;j<brr.length;j++)\n {\n if(hm.get(brr[j])!=null)\n {\n var value=hm.get(brr[j]);\n \n hm.set(brr[j],value-1);\n \n \n }\n else{\n hm.set(brr[j],1);\n }\n }\n \n //System.out.println(hm);\n var ar=Array.from(hm);\n var res=[];\n for(var m=0;m<ar.length;m++)\n {\n var arr1=ar[m];\n var key=arr1[0];\n var value=arr1[1];\n if(value!=0)\n {\n res.push(key);\n }\n }\n res.sort(function(a,b)\n {\n return a-b;\n });\n return res;\n\n\n}", "function findUnique(numbers) {\n for (el of numbers) {\n if (numbers.lastIndexOf(el) === numbers.indexOf(el)){\n return el\n }\n }\n }", "function permMissingElem (A) {\n\n\t// corner cases\n\tif (A.length === 0) {\n\t\treturn 1;\n\t} else if (A.length === 1 && A[0] == 1) {\n\t\treturn 2;\n\t} else if (A.length === 1 && A[0] == 2) {\n\t\treturn 1;\n\t}\n\n\t// numerical sort\n\tA.sort(function(a,b) { return a-b; });\n\n\t// if first element missing\n\tif (A[0] == 2) {\n\t\treturn 1;\n\t}\n\t\n\tfor (var i=0; i < A.length; i++) {\n\t\tif (A[i+1]-A[i] != 1) {\n\t\t\treturn A[i]+1;\n\t\t}\n\t\t\n\t}\n\n}", "function returnMissingKey(array){\n let newArray = []\n for(let i = 0; i< array.length; i++){\n newArray.push(parseInt(array[i]))\n }\n for(let i = 0; i< array.length - 1; i++){\n if(newArray[i+1] - newArray[i] != 1){\n let missingIndex = newArray[i] + 1\n return missingIndex;\n }\n }\n let nextKey = newArray.length + 1\n return nextKey\n}", "function solution(A) {\n\n A.forEach(function(a){\n\n });\n for (var i = 0;i < A.length - 1; i++) {\n if(A[i] > A[i + 1]){\n return i + 1;\n }\n }\n}", "function findOutlier(integers){\n var i0 = Math.abs(integers[0]) % 2\n var i1 = Math.abs(integers[1]) % 2\n var i2 = Math.abs(integers[2]) % 2\n if(i0 === i1)\n return (integers.filter(i => Math.abs(i) % 2 !== i0))[0]\n else if(i1 === i2)\n return integers[0]\n else\n return integers[1]\n}", "function findUnique3(numbers) {\n\n // Initialize histogram\n var histogramSize = (numbers.length + 1) / 2;\n var histogram = [];\n for (var i = 0; i < histogramSize; i += 1) {\n histogram[i] = 0;\n }\n\n // Initialize mapping to reduce value range to histogramSize\n var mapping = {};\n var inverseMapping = new Array(histogramSize);\n var index = 0;\n for (var i in numbers) {\n if (!(mapping[numbers[i]] >= 0)) {\n mapping[numbers[i]] = index;\n inverseMapping[index] = numbers[i];\n index += 1;\n }\n }\n\n // Sort values into histogram\n for (var i in numbers) {\n histogram[mapping[numbers[i]]] += 1;\n }\n\n // Find only single element in histogram and return\n for (var i in histogram) {\n if (histogram[i] < 2) {\n return inverseMapping[i];\n }\n }\n\n // Given correct input, this line will not be executed\n return false;\n}", "function findOutlier(integers){\n return integers.slice(0,3).filter(even).length >=2 ? integers.find(odd) : integers.find(even);\n}", "function findMissing(arr1, arr2) {\n let sum1 = 0;\n let sum2 = 0;\n\n for (let i = 0; i < arr1.length; i++) {\n let curr = arr1[i];\n sum1 += curr;\n }\n\n for (let j = 0; j < arr2.length; j++) {\n let curr = arr2[j];\n sum2 += curr;\n }\n\n let target = sum1 - sum2;\n return target;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0)\n \n N = 100001\n var bitmap = Array(N).fill(false);\n for (var i = 0; i < A.length; i ++) {\n if (A[i] > 0 && A[i] <= N) {\n bitmap[A[i]] = true;\n }\n }\n \n for(var j = 1; j <= N; j++) {\n if (!bitmap[j]) {\n return j;\n }\n }\n \n return N + 1;\n}", "function solution(A) { \n var len = A.length,\n arr = [],\n value, i;\n \n for(i = 0; i < len; i++){\n value = A[i];\n if(value > 0){\n arr[value] = true;\n }\n }\n for(i = 1; i < arr.length; i++){\n if(typeof arr[i] === \"undefined\"){\n return i;\n }\n }\n return i;\n}", "function findOutlier(integers) {\n let evenNumbers = integers.filter(a => { return (a % 2) == 0 })\n let oddNumbers = integers.filter(a => { return (a % 2) != 0 })\n\n return (evenNumbers.length > 1) ? (oddNumbers[0]) : (evenNumbers[0])\n \n}", "function findPair(arr, n) {\n arr.sort((a, b) => a - b);\n let num = Math.abs(n);\n let i = 0;\n let j = 1;\n\n while (j < arr.length) {\n let difference = Math.abs(arr[i] - arr[j]);\n\n if (difference === num) return true;\n\n if (difference > num && i === j - 1) {\n i++;\n j++;\n }\n if (difference > num) {\n i++;\n } else {\n j++;\n }\n }\n return false;\n}", "function isIncreasingNumberList(numberList) {\n if (!Array.isArray(numberList) || numberList.length < 2) return false;\n\n for (let index = 1; index < numberList.length; index++) {\n if (numberList[index] >= numberList[index - 1]) return false;\n }\n return true;\n}", "function findThreshold(nums, desired){\n nums.sort((a, b) => a-b);\n let min = Infinity;\n\n //a + ? = desired \n\n for(let i = 0; i < nums.length; i++){\n for(let j = i + 1; j < nums.length; j++){\n let currValue = nums[i] + nums[j]; \n let difference = desired - currValue\n if(difference > 0 && difference < min){\n min = difference\n }\n }\n }\n return min;\n}", "function checkNeg(arr, n) {\n return arr.some(function (el, idx) {\n if (n && idx >= n) return true;\n return el <= 0;\n });\n}", "function abundantCheck(number) {\n let sum = 1;\n for (let i = 2; i <= Math.sqrt(number); i++) {\n if (number % i === 0) {\n sum += i + +(i !== Math.sqrt(number) && number / i);\n }\n }\n return sum > number;\n}", "function findNegativeNum(nums) {\n return nums.find(num => num < 0);\n}", "function missingNumbers(arr, brr) {\n const container = [];\n\n while (brr.length > 0) {\n const matchedIndex = arr.findIndex(num => num === brr[0]);\n\n if (matchedIndex > -1) {\n arr.splice(matchedIndex, 1);\n brr.shift();\n continue;\n }\n\n container.push(brr[0]);\n brr.shift();\n }\n\n return [...new Set(container)].sort((a, b) => a - b)\n}", "function missingNumber(str, arr){\n var n = arr.length + 1;\n var sum = 0;\n var expectedSum = n * (n + 1)/2\n for (var i = 0; i < arr.length; i++){\n sum += arr[i]; \n }\n var missing = expectedSum - sum;\n console.log(str, missing)\n}", "function checknumbers(x, y) { return x - y; }", "function nextGreaterElement2(nums) {\n let ans = []\n let stack = []\n for (let i = nums.length - 1; i >= 0; i--) {\n while (stack.length && stack[stack.length - 1] <= nums[i]) {\n stack.pop()\n }\n ans[i] = stack.length === 0 ? -1 : stack[stack.length - 1]\n stack.push(nums[i])\n }\n return ans\n}", "function containsCloseNums(nums, k) {\n for (let i = 0; i < nums.length; i++) {\n for (let j = 0; j < nums.length; j++) {\n if (i !== j && nums[i] === nums[j]) {\n return Math.abs(i - j) <= k\n }\n }\n }\n return false\n}", "function findDisappearedNumbers(nums) {\n const ints = {};\n\n for (let i = 1; i <= nums.length; i++) {\n if (!ints[i]) {\n ints[i] = 0;\n }\n }\n\n for (let i in nums) {\n let n = nums[i];\n ints[n]++;\n }\n\n const output = [];\n\n for (let int in ints) {\n if (ints[int] === 0) {\n output.push(int);\n }\n }\n\n return output;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n var n = A.length;\n \n A.sort(function(a, b){\n return a - b; \n });\n \n \n if (A[0] != 1) {\n return 0;\n }\n \n for (var i = 1; i < n; i++) {\n if (A[i] - A[i-1] != 1) {\n return 0;\n }\n }\n return 1;\n}" ]
[ "0.76524097", "0.7522754", "0.7431381", "0.7401072", "0.72407895", "0.7215962", "0.7166935", "0.7163105", "0.70930403", "0.7090222", "0.6986603", "0.696486", "0.6934275", "0.692626", "0.6886246", "0.6816413", "0.68081075", "0.66888136", "0.6685135", "0.66517574", "0.66433394", "0.66422755", "0.66280276", "0.6614274", "0.6608372", "0.65997237", "0.6576463", "0.6568147", "0.6566845", "0.65569973", "0.6544519", "0.6510838", "0.6480297", "0.6454209", "0.6448507", "0.64441496", "0.6439883", "0.6427255", "0.64266056", "0.6425326", "0.6392779", "0.639166", "0.6389764", "0.63892555", "0.63881457", "0.63869226", "0.63566804", "0.6348189", "0.63158053", "0.62594706", "0.62493247", "0.62394714", "0.62387216", "0.6217425", "0.62155175", "0.6209687", "0.6199889", "0.6180307", "0.6171148", "0.6133882", "0.6104047", "0.61036795", "0.60978776", "0.6088682", "0.6086755", "0.6084127", "0.60418177", "0.6039794", "0.60274005", "0.60231227", "0.6021385", "0.6014837", "0.59931004", "0.5982181", "0.5979455", "0.5978848", "0.5972596", "0.5967809", "0.59605", "0.5958718", "0.5958002", "0.5957727", "0.5955119", "0.5950324", "0.5948966", "0.5946946", "0.59345734", "0.5930187", "0.59006727", "0.5900645", "0.5899857", "0.5895285", "0.58876914", "0.58841795", "0.58780175", "0.5866632", "0.5853989", "0.58456135", "0.58405024", "0.583562" ]
0.58608615
96
Time Complexity is O(n^2) which is quadratic time and O(n^2) constant space Phase II
function my_min2(arr){ let min = arr[0]; for (let i=1; i<arr.length; i++){ if (arr[i]<min){ min = arr[i]; } } return min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function anotherFunChallenge(input) {\n let a = 5; //O(1)\n let b = 10; //O(1)\n let c = 50; //O(1)\n for (let i = 0; i < input; i++) { //* \n let x = i + 1; // O(n)\n let y = i + 2; // O(n)\n let z = i + 3; // O(n)\n\n }\n for (let j = 0; j < input; j++) { //*\n let p = j * 2; // O(n)\n let q = j * 2; // O(n)\n }\n let whoAmI = \"I don't know\"; //O(1)\n}", "function snt (n) {\n for (let i=2 ; i <=n; i++)\n arr[i]=1;\n console.log(arr)\n arr[0]=arr[1]=0;\n // console.log(arr)\n for (let i =2; i<=Math.sqrt(n); i++)\n if (arr[i])\n for (let j=2*i; j <=n; j += i)\n arr[j]=0\n}", "function anotherFunChallenge(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n for (let i = 0; i < input; i++) {\n // O(n)\n let x = i + 1; // O(n)\n let y = i + 2; // O(n)\n let z = i + 3; // O(n)\n }\n for (let j = 0; j < input; j++) {\n // O(n)\n let p = j * 2; // O(n)\n let q = j * 2; // O(n)\n }\n let whoAmI = \"I don't know\"; // O(1)\n}", "function ex_2_I(n) {\n var sum = 0;\n var i=0;\n var j=0;\n while (i!=n){\n if(j%2==1){\n sum+=j;\n i++;\n j+=2;\n }\n else{j++;}\n }\n\n return sum;\n}", "function anotherFunChallenge(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n for (let i = 0; i < input; i++) {\n // O(n) --> numbers of inputs\n let x = i + 1; // O(n)\n let y = i + 2; // O(n)\n let z = i + 3; // O(n)\n }\n for (let j = 0; j < input; j++) {\n // O(n) --> numbers of inputs\n let p = j * 2; // O(n)\n let q = j * 2; // O(n)\n }\n let whoAmI = \"I don't know\"; // O(1)\n}", "function boooo(n) {\n for (let i = 0; i < n; i++) { // O(1)\n console.log('booooo');\n }\n}", "function o$h(n,o,t){for(let r=0;r<t;++r)o[2*r]=n[r],o[2*r+1]=n[r]-o[2*r];}", "function example2(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n for (let i = 0; i < input; i++) {\n let x = i + 1; // O(n)\n let y = i + 2; // O(n)\n let z = i + 3; // O(n)\n }\n for (let j = 0; j < input; j++) {\n let p = j * 2; // O(n)\n let q = j * 2; // O(n)\n }\n let whoAmI = \"I don't know\"; // O(1)\n}", "function tripleStep2(n) {\n if (n < 0) return 0;\n // n = 1 , n = 2, n<0\n else if (n === 0) return 1;\n else {\n return tripleStep2(n - 1) + tripleStep2(n - 2) + tripleStep2(n - 3);\n }\n}", "function funChallenge(input) {\n let a = 10; // O(1)\n a = 50 + 3; // O(1)\n\n for (let i = 0; i < input.length; i++) {\n // O(n)\n anotherFunction(); // O(n)\n let stranger = true; // O(n)\n a++; // O(n)\n }\n return a; // O(1)\n}", "function funChallenge(input) {\n let a = 10; // O(1)\n a = 50 + 3; // O(1)\n\n for (let i = 0; i < input.length; i++) {\n // O(n) --> number of inputs\n anotherFunction(); // O(n)\n let stranger = true; // O(n)\n a++; // O(n)\n }\n return a; // O(1)\n}", "function naiveSumZero(arr){ // O(n^2)\r\n for(let i = 0; i < arr.length; i++){ // O(n)\r\n for(let j = i + 1; j < arr.length; j++){ // nested O(n)\r\n if(arr[i] + arr[j] === 0){\r\n return [arr[i], arr[j]];\r\n }\r\n }\r\n }\r\n}", "function ps(t) {\n var e = O(t);\n return O(O(e.bh).persistence).Uo();\n}", "function IV(Flag, S, X){\n \n if (Flag==='c'){\n \n if(S - X > 0){\n return S - X;\n }\n else{\n return 0;\n }\n }\n \n if (Flag==='p'){ \n \n if(X - S > 0){\n return X - S;\n }\n else{\n return 0;\n }\n }\n}", "function bai2(n) {\n var tong = 0;\n for (let i = 1; i <= n; i++) {\n tong+=i*i;\n }\n return tong;\n}", "function StairCase(n, arr) {\n\tvar cache = [1];\n\tfor (let i=1; i< n+1; i++) {\n\t\tlet ans = getSumOfPossiblities(i, arr, cache);\n\t\tcache[i] = ans;\n\t}\n\t\n\treturn cache[n];\n}", "function ex_2(myA){\n return myA.filter(x => x % 2 == 0) // O(myA.length)\n .map(a => a * a) // O(myA.length)\n .reduce((acc, x) => acc + x, 0); // O(myA.length)\n}", "function solution2(A) {\n let x1 = A[0]; // xor all elements in array\n let x2 = 1; // xor all elements from 1 to n+1 (n+1 since 1 number is missing)\n for (let i = 1; i < A.length; i++) {\n x1 ^= A[i];\n }\n for (let i = 2; i <= A.length + 1; i++) {\n x2 ^= i;\n }\n\n return x2 ^ x1;\n}", "function i(n){let e=0,t=0;const r=n.length;let i,o=n[t];for(t=0;t<r-1;t++)i=n[t+1],e+=(i[0]-o[0])*(i[1]+o[1]),o=i;return e>=0}", "function problem9(){\n console.time('Problem 9 Runtime')\n let tripletProduct = null\n let startingValue = 500\n for(let c = startingValue; c > 2; c--){\n let c2 = c*c\n for(let b = c-1; b > 1; b--){\n let b2 = b*b\n for(let a = b-1; a > 0; a--){\n let a2 = a*a\n if(a2 + b2 == c2){\n let tripletSum = a+b+c\n if(tripletSum == 1000) {\n tripletProduct = a*b*c\n console.log(tripletProduct)\n console.timeEnd('Problem 9 Runtime')\n return\n }\n }\n }\n }\n }\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n // [1,0] . [0,1]\n let f = A[0];\n let count = 0;\n let getOCount = getCount(A, 1);\n let getZCount = getCount(A, 0);\n console.log(getOCount + \" \" + getZCount);\n if (getOCount >= getZCount) {\n for (let i = 0; i < A.length - 1; ++i) {\n if (A[i] === A[i + 1]) {\n if (A[i] === 1) {\n A[i + 1] = 0;\n } else {\n A[i + 1] = 1;\n }\n count++;\n }\n }\n } else {\n for (let i = 0; i < A.length - 1; ++i) {\n if (A[i] === A[i + 1]) {\n if (A[i + 1] === 1) {\n A[i] = 0;\n } else {\n A[i] = 1;\n }\n count++;\n }\n }\n }\n return count;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0)\n \n N = 100001\n var bitmap = Array(N).fill(false);\n for (var i = 0; i < A.length; i ++) {\n if (A[i] > 0 && A[i] <= N) {\n bitmap[A[i]] = true;\n }\n }\n \n for(var j = 1; j <= N; j++) {\n if (!bitmap[j]) {\n return j;\n }\n }\n \n return N + 1;\n}", "function newPhase() {\n\t// expand outer blossoms with z == 0 (note: these are even)\n\tphases++;\n\tbq.clear();\n\tfor (let b = bloss.firstOuter(); b; b = bloss.nextOuter(b)) {\n\t\tif (zz(b) == 0) bq.enq(b); // note: b must be even\n\t\tsteps++;\n\t}\n\twhile (!bq.empty()) {\n\t\tlet b = bq.deq();\n\t\tlet subs = bloss.expand(b); \n\t\tfor (let sb = subs.first(); sb; sb = subs.next(sb)) {\n\t\t\tif (zz(sb) == 0 && sb > g.n) bq.enq(sb);\n\t\t\tsteps++;\n\t\t}\n\t}\n\n\t// set states/links of remaining outer blossoms based on matching status\n\tfor (let b = bloss.firstOuter(); b; b = bloss.nextOuter(b)) {\n\t\tbloss.state(b, match.at(bloss.base(b)) ? 0 : +1); bloss.link(b,[0,0]);\n\t\tsteps++;\n\t}\n\n\t// rebuild the heaps from scratch\n\t// update the z variables while clearing the vertex and blossom heaps\n\tfor (let u = evh.findmin(); u; u = evh.findmin()) {\n\t\tz[u] = evh.key(u); evh.delete(u); steps++;\n\t}\n\tfor (let u = ovh.findmin(); u; u = ovh.findmin(u)) {\n\t\tz[u] = ovh.key(u); ovh.delete(u); steps++;\n\t}\n\tfor (let b = ebh.findmin(); b; b = ebh.findmin(b)) {\n\t\tz[b] = 2*ebh.key(b); ebh.delete(b); steps++;\n\t}\n\tfor (let b = obh.findmin(); b; b = obh.findmin(b)) {\n\t\tz[b] = 2*obh.key(b); obh.delete(b); steps++;\n\t}\n\texh.clear(); eeh.clear();\n\t// rebuild vertex heaps and edge heaps, using new states\n\tfor (let b = bloss.firstOuter(); b; b = bloss.nextOuter(b)) {\n\t\tif (bloss.state(b) == +1) {\n\t\t\tif (b > g.n) ebh.insert(b, z[b]/2);\n\t\t\t// add ee edges to eeh\n\t\t\tfor (let u = bloss.firstIn(b); u; u = bloss.nextIn(b,u)) {\n\t\t\t\tevh.insert(u,z[u]);\n\t\t\t\tfor (let e = g.firstAt(u); e; e = g.nextAt(u,e)) {\n\t\t\t\t\tlet v = g.mate(u,e); let V = bloss.outer(v);\n\t\t\t\t\tif (V != b && bloss.state(V) == +1 && !eeh.contains(e))\n\t\t\t\t\t\teeh.insert(e, slack(e)/2);\n\t\t\t\t}\n\t\t\t\tsteps++;\n\t\t\t}\n\t\t} else {\n\t\t\t// build subheaps for unbound blossoms in exh\n\t\t\t// order of edges with subheaps matches order of vertices within\n\t\t\t// outer blossoms\n\t\t\tlet laste = 0;\n\t\t\tfor (let u = bloss.firstIn(b); u; u = bloss.nextIn(b,u)) {\n\t\t\t\t// insert dummy edge for u in b's subheap within exh\n\t\t\t\tlet e = u + g.edgeRange;\n\t\t\t\texh.insertAfter(e, b, Infinity, laste); laste = e;\n\t\t\t\tfor (let e = g.firstAt(u); e; e = g.nextAt(u,e)) {\n\t\t\t\t\tlet v = g.mate(u,e); let V = bloss.outer(v);\n\t\t\t\t\tif (bloss.state(V) == +1) {\n\t\t\t\t\t\texh.insertAfter(e, b, slack(e), laste); laste = e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsteps++;\n\t\t\t}\n\t\t\texh.activate(b);\n\t\t}\n\t}\n\tif (trace) {\n\t\tlet s = bloss.blossoms2string(1);\n\t\tif (s.length > 2) traceString += `\t${s}\\n`;\n\t}\n}", "function funChallenge(input) {\n let a = 10; // O(1) Some people don't count assignments\n a = 50 + 3; // O(1)\n\n for (let i = 0; i < input.length; i++) { // O(n) --> n is the input\n anotherFunction(); // O(n)\n let stranger = true; // O(n)\n a++; // O(n)\n }\n return a; // O(1) another thing some people don't count\n}", "function solutionTwo(){\n var last = 0;\n var current = 1;\n var next = 0;\n var evenSum = 0;\n while((next = current + last)<4000000){\n if(next%2==0){\n evenSum += next;\n }\n last = current;\n current = next;\n }\n return evenSum;\n}", "kaleb(n){\n let prev = 2;\n let curr = -1;\n let result = 0;\n for (let i=1; i<n; ++i) {\n result = 2*prev - curr;\n prev = curr;\n curr = result;\n } \n console.log(result);\n return result;\n }", "function prime3(n) {\n const data = new Int8Array((n + 1) / 2);\n data[0] = 1;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] === 0) {\n let k = 2 * i + 1;\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 1;\n }\n }\n }\n const result = [2];\n for(let i = 0; i < data.length; i += 1) {\n if (data[i] == 0) {\n result.push(2 * i + 1);\n }\n }\n return result;\n }", "function solution3(A) {\n count = 0;\n for (i = 0; i < A.length; i++) {\n if (i + 1 > A.length || i + 2 > A.length) {\n } else if (A[i] - A[i + 1] == A[i + 1] - A[i + 2]) {\n count += 1;\n\n let newA = A.slice(i + 2)\n let dist = A[i] - A[i + 1]\n\n for (j = 0; j < newA.length; j++) {\n if (j + 1 >= A.length) {\n console.log(\"No more new array!\")\n } else if (newA[j] - newA[j + 1] == dist) {\n count += 1;\n }\n }\n }\n }\n // console.log(count)\n}", "function evenOddSums() {}", "function solution(n) {\n d = new Array(30);\n l = 0;\n while (n > 0) {\n d[l] = n % 2;\n n = Math.floor(n / 2);\n l += 1;\n }\n console.log('l = ', l);\n console.log('d = ', d);\n for (p = 1; p < 1 + l; ++p) {\n ok = true;\n for (i = 0; i < l - p; ++i) {\n if (d[i] != d[i + p]) {\n ok = false;\n break;\n }\n }\n if (ok) {\n return p;\n }\n }\n return -1;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 4.0.0)\n var size = A.length;\n var sum = ((size + 1) * (size + 2)) / 2;\n for (i = 0; i < size; i++) {\n sum -= A[i];\n }\n return sum;\n}", "vectorize(po,pf,n){//a,b,k\n let data=new Array();\n var pts=(pf-po)/n;\n /*push agrega un valor al array */\n\n for(i=0; i<n;++i){\n data[i]=data+pts;\n }\n\n }", "function nonSimdAobench (n) {\n for (var i = 0; i < n; i++) {\n ambient_occlusion(isect0);\n }\n }", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) { // --> polynomial O(n^2) quadratic\n for (let j = i + 1; j < arr.length; j++) { // --> polynomial 0(n^2) quadratic\n console.log(arr[i] + ', ' + arr[j]); //--> constant\n }\n }\n}", "function solve(input) {\n let elves = [];\n for (let i = 0; i < input; i++) {\n elves.push(i + 1);\n }\n\n function getNextIndex(index) {\n let next = (elves.length / 2) + index;\n if (next >= elves.length) {\n next -= elves.length\n }\n if (!_.isInteger(next)) {\n next = _.floor(next);\n }\n return next;\n }\n\n let current = elves[0];\n // let currentTime = new Date().getTime();\n while (elves.length > 1) {\n let index = _.indexOf(elves, current);\n let nextIndex = getNextIndex(index);\n // if (index % 100 === 0) {\n // let newTime = new Date().getTime();\n // console.log(index, elves[index], elves[nextIndex], elves.length, newTime - currentTime);\n // currentTime = newTime;\n // }\n elves[nextIndex] = 0;\n elves = _.compact(elves);\n let nextCurrent = _.indexOf(elves, current) + 1;\n if (nextCurrent >= elves.length) {\n nextCurrent = 0;\n }\n current = elves[nextCurrent];\n }\n console.log(input, elves[0]);\n}", "function linearTime(n) {\n let cmdCounter = 0;\n let tempArr = [];\n\n\n for(let i = 0; i < n; i ++) {\n // cmdCounter++;\n tempArr.push(i);\n }\n\n console.log(cmdCounter);\n return tempArr\n}", "threesum1(arr) {\n\n var l = arr.length;\n for (var i = 0; i < l - 2; i++) {\n for (var j = i + 1; j < l - 1; j++) {\n for (var k = j + 1; k < l; k++) {\n if (arr[i] + arr[j] + arr[k] == 0) {\n console.log(arr[i] + \",\" + arr[j] + \",\" + arr[k] + \" is a triplet\")\n }\n\n\n }\n }\n }\n }", "function ex_2_I(a) {\n var tot = 0;\n for(i = 0; i < a; ++i) {\n tot += 1 + 2 * i;\n }\n return tot;\n}", "function compressBoxes(input){\n for(var i = 0; i<=100; i++){\n console.log('hi'); // O(100)\n }\n\n input.forEach(function(box){\n console.log(box); // O(n)\n })\n\n input.forEach(function(box){\n console.log(box); //O(n)\n })\n }", "function inverseMod_(x,n) {\n var k=1+2*Math.max(x.length,n.length);\n\n if(!(x[0]&1) && !(n[0]&1)) { //if both inputs are even, then inverse doesn't exist\n copyInt_(x,0);\n return 0;\n }\n\n if (eg_u.length!=k) {\n eg_u=new Array(k);\n eg_v=new Array(k);\n eg_A=new Array(k);\n eg_B=new Array(k);\n eg_C=new Array(k);\n eg_D=new Array(k);\n }\n\n copy_(eg_u,x);\n copy_(eg_v,n);\n copyInt_(eg_A,1);\n copyInt_(eg_B,0);\n copyInt_(eg_C,0);\n copyInt_(eg_D,1);\n for (;;) {\n while(!(eg_u[0]&1)) { //while eg_u is even\n halve_(eg_u);\n if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if eg_A==eg_B==0 mod 2\n halve_(eg_A);\n halve_(eg_B); \n } else {\n add_(eg_A,n); halve_(eg_A);\n sub_(eg_B,x); halve_(eg_B);\n }\n }\n\n while (!(eg_v[0]&1)) { //while eg_v is even\n halve_(eg_v);\n if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if eg_C==eg_D==0 mod 2\n halve_(eg_C);\n halve_(eg_D); \n } else {\n add_(eg_C,n); halve_(eg_C);\n sub_(eg_D,x); halve_(eg_D);\n }\n }\n\n if (!greater(eg_v,eg_u)) { //eg_v <= eg_u\n sub_(eg_u,eg_v);\n sub_(eg_A,eg_C);\n sub_(eg_B,eg_D);\n } else { //eg_v > eg_u\n sub_(eg_v,eg_u);\n sub_(eg_C,eg_A);\n sub_(eg_D,eg_B);\n }\n\n if (equalsInt(eg_u,0)) {\n while (negative(eg_C)) //make sure answer is nonnegative\n add_(eg_C,n);\n copy_(x,eg_C);\n\n if (!equalsInt(eg_v,1)) { //if GCD_(x,n)!=1, then there is no inverse\n copyInt_(x,0);\n return 0;\n }\n return 1;\n }\n }\n }", "function simdAobench (n) {\n for (var i = 0; i < n; i++) {\n ambient_occlusion_simd(isect0);\n }\n }", "function bai8(n) {\n var tong = 0;\n for (let i = 0; i <= n; i++) {\n tong+=((1/2)*((2*i+1)/(i+1)));\n }\n return tong;\n}", "function mystery(n) {\n let r = 0;\n for (let i = 0; i < n; i++) {\n for (let j = i + 1; j <= n; j++) {\n for (let k = 1; k < j; k++) {\n r++;\n }\n }\n }\n return r;\n}", "function inverseMod_(x, n) {\n var k = 1 + 2 * Math.max(x.length, n.length);\n\n if (!(x[0] & 1) && !(n[0] & 1)) { //if both inputs are even, then inverse doesn't exist\n copyInt_(x, 0);\n return 0;\n }\n\n if (eg_u.length != k) {\n eg_u = new Array(k);\n eg_v = new Array(k);\n eg_A = new Array(k);\n eg_B = new Array(k);\n eg_C = new Array(k);\n eg_D = new Array(k);\n }\n\n copy_(eg_u, x);\n copy_(eg_v, n);\n copyInt_(eg_A, 1);\n copyInt_(eg_B, 0);\n copyInt_(eg_C, 0);\n copyInt_(eg_D, 1);\n for (; ; ) {\n while (!(eg_u[0] & 1)) { //while eg_u is even\n halve_(eg_u);\n if (!(eg_A[0] & 1) && !(eg_B[0] & 1)) { //if eg_A==eg_B==0 mod 2\n halve_(eg_A);\n halve_(eg_B);\n } else {\n add_(eg_A, n); halve_(eg_A);\n sub_(eg_B, x); halve_(eg_B);\n }\n }\n\n while (!(eg_v[0] & 1)) { //while eg_v is even\n halve_(eg_v);\n if (!(eg_C[0] & 1) && !(eg_D[0] & 1)) { //if eg_C==eg_D==0 mod 2\n halve_(eg_C);\n halve_(eg_D);\n } else {\n add_(eg_C, n); halve_(eg_C);\n sub_(eg_D, x); halve_(eg_D);\n }\n }\n\n if (!greater(eg_v, eg_u)) { //eg_v <= eg_u\n sub_(eg_u, eg_v);\n sub_(eg_A, eg_C);\n sub_(eg_B, eg_D);\n } else { //eg_v > eg_u\n sub_(eg_v, eg_u);\n sub_(eg_C, eg_A);\n sub_(eg_D, eg_B);\n }\n\n if (equalsInt(eg_u, 0)) {\n if (negative(eg_C)) //make sure answer is nonnegative\n add_(eg_C, n);\n copy_(x, eg_C);\n\n if (!equalsInt(eg_v, 1)) { //if GCD_(x,n)!=1, then there is no inverse\n copyInt_(x, 0);\n return 0;\n }\n return 1;\n }\n }\n }", "function prime2(n) {\n const data = [];\n for (let i = 1; i < n; i += 2) {\n data.push(i);\n }\n data[0] = 0;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] > 0) {\n let k = data[i];\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 0;\n }\n }\n }\n const result = [2];\n for (let i of data) {\n if (i > 0) {\n result.push(i);\n }\n }\n return result;\n }", "function solution_1 (A) {\n\n // INITIALIZATION\n const output = [];\n const refArr = [null]; // if `A[i] === n`, then `refArr[n] === i`. note that we throw in null into index 0. `A` will never contain 0.\n A.forEach((n, i) => refArr[n] = i);\n\n // DEFINE `flip` FUNCTION: given `n`, perform 2 flips to get it in the right spot\n function flip (n) {\n const indexOfN = refArr[n];\n for (let i = 0; i < indexOfN/2; ++i) { // flip all nums from start to `n` (remember to run the for loop only up to half of `indexOfN`)\n const a = A[i];\n const b = A[indexOfN - i];\n [refArr[a], refArr[b]] = [refArr[b], refArr[a]]; // swap opposite `refArr` elements\n [A[i], A[indexOfN - i]] = [A[indexOfN - i], A[i]]; // swap opposite `A` elements\n }\n for (let i = 0; i < (n - 1)/2; ++i) { // flip all nums up to where `n` should go (remember to run the for loop only up to half of `n - 1`)\n const a = A[i];\n const b = A[(n - 1) - i];\n [refArr[a], refArr[b]] = [refArr[b], refArr[a]];\n [A[i], A[(n - 1) - i]] = [A[(n - 1) - i], A[i]];\n }\n output.push(indexOfN + 1, n); // represent the two flips we just performed in `output`\n }\n\n // ITERATION\n for (let i = A.length - 1; i >= 0; --i) {\n const n = i + 1; // `n` is the number that should live in current position\n if (A[i] !== n) flip(n); // if `A[i] === n` then this number is correctly sorted\n }\n\n return output;\n}", "function solution2(n, cache = {2:1, 1:0}) {\n if (n in cache) {\n return cache[n];\n } else {\n cache[n] = solution2(n - 1, cache) + solution2(n - 2, cache);\n return cache[n];\n }\n}", "function solution(n) {\n let cache = {}\n\n function tile(width) {\n if (width <= 0) return 0;\n if (width === 1) return 1;\n if (width === 2) return 3;\n\n if (cache[width]) {\n return cache[width];\n } else {\n cache[width] = (tile(width - 1) + 2 * tile(width - 2)) % 10007;\n return cache[width]\n }\n }\n\n return tile(n);\n}", "function LV(i) {\n if (i <= 1) {\n return 0;\n }\n return THETA * (i - 1) * (S + i - 1);\n}", "function newPhase() {\n\touter.clear(); q.clear(); link.fill(0); state.fill(0);\n\troots.clear();\n\tfor (let k = pmax; k >= 0; k--) {\n\t\tsteps++;\n\t\tif (!first[k]) continue;\n\t\tfor (let u = first[k]; u; u = plists.next(u)) {\n\t\t\tbase[u] = u; steps++;\n\t\t\tif (!match.at(u)) {\n\t\t\t\tstate[u] = 1;\n\t\t\t\tif (k > 0) roots.enq(u);\n\t\t\t}\n\t\t}\n\t}\n\tlet r = 0;\n\twhile (q.empty() && !roots.empty()) {\n\t\tr = roots.deq(); add2q(r);\n\t}\n\treturn r;\n}", "function compute(num) {\n let result = [];\n for (let i = 1; i <= num; i++) {\n //O(n)\n if (i === 1) {\n result.push(0);\n } else if (i === 2) {\n result.push(1);\n } else {\n result.push(result[i - 2] + result[i - 3]);\n }\n }\n return result;\n}", "function firstOdd(n) {\n var tot = 0;\n for(i = 0; i < n; ++i) {\n tot += 1 + 2 * i;\n }\n return tot;\n}", "function bench02(n) {\n\tvar x = 0,\n\t\tsum = 0.0,\n\t\ti;\n\n\tfor (i = 1; i <= n; i++) {\n\t\tsum += i;\n\t\tif (sum >= n) {\n\t\t\tsum -= n;\n\t\t\tx++;\n\t\t}\n\t}\n\treturn x;\n}", "function problem2(){\n var numArr = [1,2];\n while(numArr[numArr.length-1]<4000000){\n numArr.push( numArr[numArr.length - 2] + numArr[numArr.length - 1] );\n }\n numArr = numArr.filter(function(a){ return a%2===0});\n return numArr.reduce(function(a,b){ return a+b; });\n}", "function solution3(n) {\n if (n <= 1) {\n return 0;\n }\n\n if (n === 2) {\n return 1;\n }\n\n let lastTwo = [0, 1];\n let counter = 3;\n\n while(counter <= n) {\n let nextFib = lastTwo[0] + lastTwo[1];\n lastTwo[0] = lastTwo[1];\n lastTwo[1] = nextFib;\n\n counter++;\n }\n\n return lastTwo[1];\n}", "function s(grid) {\n const r = grid.length - 1;\n const c = grid[r].length - 1;\n if (grid[r][c] === 1 || grid[0][0] === 1) return 0;\n for (let i = 0; i <= r; i++) {\n for (let j = 0; j <= c; j++) {\n if (grid[i][j] === 1) grid[i][j] = -1;\n }\n }\n grid[r][c] = 1;\n for (let i = r - 1; i >= 0; i--) {\n if (grid[i][c] === 0) grid[i][c] = grid[i + 1][c];\n }\n for (let i = c - 1; i >= 0; i--) {\n if (grid[r][i] === 0) grid[r][i] = grid[r][i + 1];\n }\n for (let i = r - 1; i >= 0; i--) {\n for (let j = c - 1; j >= 0; j--) {\n if (grid[i][j] < 0) continue;\n grid[i][j] += grid[i][j + 1] > 0 ? grid[i][j + 1] : 0;\n grid[i][j] += grid[i + 1][j] > 0 ? grid[i + 1][j] : 0;\n }\n }\n return grid[0][0] > 0 ? grid[0][0] : 0;\n}", "function ISECT(state)\n{\n const stack = state.stack;\n const pa0i = stack.pop();\n const pa1i = stack.pop();\n const pb0i = stack.pop();\n const pb1i = stack.pop();\n const pi = stack.pop();\n const z0 = state.z0;\n const z1 = state.z1;\n const pa0 = z0[pa0i];\n const pa1 = z0[pa1i];\n const pb0 = z1[pb0i];\n const pb1 = z1[pb1i];\n const p = state.z2[pi];\n\n if (exports.DEBUG) console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi);\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n const x1 = pa0.x;\n const y1 = pa0.y;\n const x2 = pa1.x;\n const y2 = pa1.y;\n const x3 = pb0.x;\n const y3 = pb0.y;\n const x4 = pb1.x;\n const y4 = pb1.y;\n\n const div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n const f1 = x1 * y2 - y1 * x2;\n const f2 = x3 * y4 - y3 * x4;\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div;\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div;\n}", "function sieve(n) {\n let arr = [];\n for (let i = 2; i <= n; i++) arr[i - 2] = i;\n\n for (let i = 2; i * i <= n; i++) {\n // we stop if the square of i is greater than n\n if (arr[i - 2] != 0) {\n // if the number is marked then all it's factors are marked so we move to the next number\n for (let j = Math.pow(i, 2); j <= n; j++) {\n // we start checking from i^2 because all the previous factors of i would be already marked\n if (arr[j - 2] % i == 0) arr[j - 2] = 0;\n }\n }\n }\n return arr;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n let west_cars = 0;\n let passing_cars = 0;\n \n for(let i=A.length-1; i>=0; i--){\n switch(A[i]){\n case 0:\n passing_cars += west_cars;\n break;\n case 1:\n west_cars++;\n break;\n }\n if(passing_cars > 1000000000){\n return -1;\n }\n }\n \n return passing_cars;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n const len = A.length;\n let multiplier = 0;\n let total = 0;\n for (let i=0 ; i<len ; i++) {\n \n if(A[i]===0){\n multiplier++;\n }else{\n total += multiplier*1\n }\n\n \n\n }\n if(total > 1000000000){\n return -1\n }\n return total;\n\n}", "function addOrSubstract(input) {\n let resultArray = [];\n let oldArraySum = 0;\n let resultArraySum = 0;\n\n for (let i = 0; i < input.length; i++) {\n oldArraySum += input[i];\n if (input[i] % 2 === 0) {\n resultArray[i] = input[i] + i;\n resultArraySum += resultArray[i];\n }else{\n resultArray[i] = input[i] - i;\n resultArraySum += resultArray[i];\n }\n \n }\n console.log(resultArray);\n console.log(oldArraySum);\n console.log(resultArraySum);\n}", "function findEvenIndex(arr)\n{\nlet right_sum = 0, left_sum = 0;\n\nfor (let i=1; i<arr.length; i++)\n right_sum = right_sum + arr[i];\n\nfor (let i=0, j=1; j<arr.length; i++, j++){\n right_sum = right_sum - arr[j];\n left_sum = left_sum + arr[i];\n \n if (left_sum === right_sum)\n return i+1;\n}\nreturn \n\n}", "function runningTime(arr) {\n let arrLen = arr.length;\n if (arrLen === 1) {\n return 0;\n }\n let numShift = 0;\n for (let x = 1; x < arrLen; x++) {\n let originIndex = x;\n let targetIndex = x;\n let currShift = 0;\n for (let y = x; y >= 0; y--) {\n if (arr[y] > arr[originIndex]) {\n targetIndex = y;\n currShift = originIndex - targetIndex;\n }\n }\n // if targeted index moved\n if (originIndex != targetIndex) {\n numShift += currShift;\n // remove value from array\n let valToInsert = arr.splice(originIndex, 1)[0];\n arr.splice(targetIndex, 0, valToInsert);\n }\n // console.log(arr.join(' '));\n }\n return numShift;\n}", "function series3(n) {\n let sum = 0;\n for (let i = 2; i <= n; i += 2) {\n sum += i; //? incremented by 2\n }\n return sum;\n}", "function ISECT(state)\n{\n var stack = state.stack;\n var pa0i = stack.pop();\n var pa1i = stack.pop();\n var pb0i = stack.pop();\n var pb1i = stack.pop();\n var pi = stack.pop();\n var z0 = state.z0;\n var z1 = state.z1;\n var pa0 = z0[pa0i];\n var pa1 = z0[pa1i];\n var pb0 = z1[pb0i];\n var pb1 = z1[pb1i];\n var p = state.z2[pi];\n\n if (DEBUG) console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi);\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n var x1 = pa0.x;\n var y1 = pa0.y;\n var x2 = pa1.x;\n var y2 = pa1.y;\n var x3 = pb0.x;\n var y3 = pb0.y;\n var x4 = pb1.x;\n var y4 = pb1.y;\n\n var div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n var f1 = x1 * y2 - y1 * x2;\n var f2 = x3 * y4 - y3 * x4;\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div;\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div;\n}", "function findEvenIndex(arr) {\n // assign two placeholders\n let sum1 = 0\n let sum2 = 0\n // get a full array total sum\n for (let i=0; i<arr.length; i++) {\n sum1 += arr[i]\n console.log(\"Sum1 i: \",sum1)\n }\n // decriment sum1 from index 0, while incrimenting sum2 from index 0\n for (let j=0; j<arr.length; j++) {\n // decriment of sum1\n sum1 -= arr[j]\n console.log(\"Sum1 j: \",sum1)\n // check to see if the two sums are equal\n if (sum2 == sum1) {\n return j\n }\n // incriment of sum2\n sum2 += arr[j]\n console.log(\"Sum2: \", sum2)\n }\n\n return -1\n}", "function even(){\n\n var sum=0;\n for (var i=1;i<=1000;i++){\n if(i%2===0){\n sum = sum + i;\n }\n\n }\n\n return sum;\n}", "function loopTheLoop() {\n // time complexity would be something like 45^47\n for (let i = 0; i < 45; i++) {\n for (let j = 1; j < 47; j++) {\n console.log(i, j);\n }\n }\n}", "function sumEvenNumbers(n){\n let sum = 0;\n for(let i=1; i<=2*n-1; i+=2)\n {\n sum+=i;\n }\n return sum; \n}", "function countInverse(array) {\n\n split(0, array.length - 1);\n // console.log(\"Result:\" + array);\n //console.log(count);\n //console.log(perf + ' ' + array.length * Math.log(array.length));\n\n function split(left, right) {\n // console.log('Split ' + left + \" \" + right)\n var middle = Math.floor((right + left) / 2);\n\n if (middle > left) {\n split(left, middle);\n split(middle + 1, right);\n }\n merge(left, middle, right)\n }\n\n function merge(left, middle, right) {\n //console.log(\"Merge\" + left + ',' + middle + ',' + right);\n var leftArr = array.slice(left, middle + 1);\n var rightArr = array.slice(middle + 1, right + 1);\n // console.log(leftArr);\n // console.log(rightArr);\n while (leftArr.length > 0 && rightArr.length > 0) {\n perf++;\n if (leftArr[0] < rightArr[0]) {\n array[left++] = leftArr.shift();\n } else {\n count = (count+leftArr.length);\n array[left++] = rightArr.shift();\n }\n }\n leftArr.concat(rightArr);\n while (leftArr.length > 0) {\n array[left++] = leftArr.shift();\n }\n }\n return count;\n }", "function compute(input) {\n const busses = input.split(\",\").map(x => +x).map(x => Number.isNaN(x) ? -1 : x);\n\n console.log(busses);\n\n const validBusses = busses.map((b, i) => ({wait: i, id: b})).filter(x => x.id != -1);\n const N = validBusses.map(x => x.id).reduce((a,b) => a*b);\n console.log(N);\n\n const y = [];\n for(var i = 0; i < validBusses.length; i++) {\n y.push(N/validBusses[i].id);\n }\n console.log(y);\n\n const inverse = (a, n) => {\n console.log(\"Inverse\", a, n);\n let t = 0, newt = 1;\n let r = n, newr = a % n;\n\n while(newr !== 0) {\n let quotient = ~~(r / newr);\n //console.log(\"\\t\", r, newr, quotient);\n [t, newt] = [newt, t - quotient * newt];\n [r, newr] = [newr, r - quotient * newr];\n }\n\n if(r > 1)\n return \"a is not invertible\";\n if(t < 0)\n t = t + n;\n\n return t;\n }\n\n let z = [];\n for(var i = 0; i < validBusses.length; i++) {\n console.log(\"Computing z for i=\",i);\n z.push(inverse(y[i], validBusses[i].id));\n }\n console.log(z);\n\n \n //console.log(validBusses.map((x,i) => (x.id - x.wait < 0 ? x.id - x.wait + N : x.id - x.wait) * y[i] * z[i]));\n let a = validBusses.map(x => ({id: x.id, a: x.id - x.wait}))\n .map(x => x.a >= 0 ? x.a : Math.ceil(Math.abs(x.a/x.id)) * x.id + x.a);\n console.log(a);\n \n let x = validBusses.map((x,i) => (((a[i] * y[i])%N) * z[i])%N).reduce((a,b) => (a+b)%N);\n console.log(x);\n \n const valid = (start) => {\n return validBusses.every(x => (start + x.wait) % x.id == 0);\n }\n return [x, valid(x)];\n}", "function whoa(){\n var sum = 0;\n for(var i = -300000; i < 300001; i++){\n if(i % 2 === 1){\n sum = sum+i;\n }\n }\n console.log(sum);\n}", "triples(array, N) {\n var Count = 0;\n for (var i = 0; i < N - 2; i++) {\n for (var j = i + 1; j < N - 1; j++) {\n for (var k = j + 1; j < N; j++) {\n if (array[i] + array[j] + array[k] === 0) {\n Count++;\n console.log(\"triplet are: \" + array[i] + \",\" + array[j] + \",\" + array[k]);\n }\n }\n }\n }\n }", "function bai3(n) {\n var tong = 0;\n for (let i = 1; i <= n; i++) {\n tong+=(1/i);\n }\n return tong;\n}", "function f(n, k){\r\n let dp = new Array(n + 1)\r\n for (let i=0; i<n+1; i++)\r\n dp[i] = new Array(k + 1).fill(0)\r\n \r\n dp[0][0] = 1\r\n \r\n \r\n for (let i=1; i<=n; i++)\r\n for (let j=1; j<=Math.min(i, k); j++) {\r\n dp[i][j] = dp[i - j][j] + dp[i - 1][j - 1]\r\n console.log(dp); \r\n } \r\n return dp[n][k]\r\n}", "function f(n){\nif(n==0) return 0;\nif(n==1) return 1;\nreturn f(n-1) + f(f-2);\n}", "function Hamming(P) {\r\n var W1 = P,\r\n R = P[0].length,\r\n B = [],\r\n e = (1.0 / (P.length - 1.0)) / 2.0,\r\n W2 = [],\r\n a1 = [],\r\n a2 = [],\r\n newRow,\r\n i,j,k,test,z;\r\n \r\n for (i = 0; i < P.length; i++){\r\n B.push([R]);\r\n }\r\n for (i = 0; i < P.length; i++){\r\n newRow = new Array();\r\n for (j = 0; j < R; j++){\r\n if (i === j) {\r\n newRow.push(1.0);\r\n } else {\r\n newRow.push(-1.0 * e);\r\n }\r\n }\r\n W2.push(newRow);\r\n }\r\n \r\n P = tranposeMatrix(P);\r\n\r\n for (i = 0; i < P[0].length; i++) {\r\n a1 = addTwoMatrix(multiplyTwoMatrix(W1,P,i),B);\r\n z = 0;\r\n do{\r\n a2 = transferFunction(multiplyTwoMatrix(W2,a1,0),\"poslin\");\r\n a1 = a2;\r\n console.log(\"after a2 of \" + i + \": \" + a2);\r\n test = 0;\r\n for(k = 0; k < a2.length; k++){\r\n if(a2[k][0] > 0){\r\n test++;\r\n j = k;\r\n }\r\n }\r\n z++;\r\n }while(test > 1 && z < 15);\r\n if(z !== 15){\r\n console.log(\"output of \"+ i + \" is: \" + j);\r\n }\r\n \r\n }\r\n \r\n \r\n \r\n}", "function bai4(n) {\n var tong = 0;\n for (let i = 2; i <= n; i+=2) {\n tong+=(1/i);\n }\n return tong;\n}", "function solution(A, S) {\n // write your code in JavaScript (Node.js 8.9.4\n let result = 0;\n if(A.length<1){\n return result; //base case\n }\n //dymamic\n let runningSum = 0;\n for(let i=0; i<A.length; i++){\n let el = A[i];\n \n runningSum+=el;\n \n // if(el>S){\n // continue;\n // }\n // else if(el===S){\n // result++;\n // }\n // else {\n // remaining=S-el;\n //get left and right of S\n result+= solution(A.slice(0,i), S);\n result+= solution(A.slice(i+1), S);\n //}\n }\n if(Math.floor(runningSum/A.length)===S){\n result++;\n }\n \n \n return result;\n //solutionHelper(A,S,0, A.length-1);\n}", "function sumOdd(n) {\n var tot = 0;\n for(i = 0; i < n; ++i) {\n tot += 1 + 2 *i;\n }\n return tot;\n}", "function threeSquares(t){ //t=1 for player1, t=2 for player2\n\tj=1;\n\twhile (j<n+1){\n\t\ti=1;\n\t\twhile (i<n+1){\n\t\t\tif (state[i][j]==t){\n\t\t\t\tfor (l=j;l<n+1;l++){\n\t\t\t\t\tif (l==j){start=i+1}else{start=1;}\n\t\t\t\t\tfor (k=start;k<n+1;k++){\n\t\t\t\t\t\tif (state[k][l]==t){\n\t\t\t\t\t\t\tif (0<k+l-j && k+l-j<n+1 && 0<l-k+i && l-k+i<n+1 && \n\t\t\t\t\t\t\t\t 0<i+l-j && i+l-j<n+1 && 0<j-k+i && j-k+i<n+1){\n\t\t\t\t\t\t\t\tif (state[k+l-j][l-k+i]==t && state[i+l-j][j-k+i]==0) {alpha=i+l-j; beta=j-k+i; yes=1;}\n\t\t\t\t\t\t\t\tif (state[i+l-j][j-k+i]==t && state[k+l-j][l-k+i]==0) {alpha=k+l-j; beta=l-k+i; yes=1;}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (0<k+j-l && k+j-l<n+1 && 0<l-i+k && l-i+k<n+1 && \n\t\t\t\t\t\t\t\t 0<i+j-l && i+j-l<n+1 && 0<j-i+k && j-i+k<n+1){\n\t\t\t\t\t\t\t\tif (state[k+j-l][l-i+k]==t && state[i+j-l][j-i+k]==0) {alpha=i+j-l; beta=j-i+k; yes=1;}\n\t\t\t\t\t\t\t\tif (state[i+j-l][j-i+k]==t && state[k+j-l][l-i+k]==0) {alpha=k+j-l; beta=l-i+k; yes=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}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tj++; \n\t}\n}", "conjectureP2(x, y) {\n return 0;\n }", "function even(){\n for(var cont=2;cont<=1000;cont+=2){\n console.log(cont);\n //for(var i=1;i<1001;i++){\n // if(i%2===0){\n // console.log(i);\n // }\n //}\n\n }\n}", "function inverse$i(p) {\n var n;\n var x = p.x;\n var y = p.y;\n\n var delta_x = x - this.x0;\n var delta_y = y - this.y0;\n\n // 1. Calculate z\n var z_re = delta_y / this.a;\n var z_im = delta_x / this.a;\n\n // 2a. Calculate theta - first approximation gives km accuracy\n var z_n_re = 1;\n var z_n_im = 0; // z^0\n var z_n_re1;\n var z_n_im1;\n\n var th_re = 0;\n var th_im = 0;\n for (n = 1; n <= 6; n++) {\n z_n_re1 = z_n_re * z_re - z_n_im * z_im;\n z_n_im1 = z_n_im * z_re + z_n_re * z_im;\n z_n_re = z_n_re1;\n z_n_im = z_n_im1;\n th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;\n th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;\n }\n\n // 2b. Iterate to refine the accuracy of the calculation\n // 0 iterations gives km accuracy\n // 1 iteration gives m accuracy -- good enough for most mapping applications\n // 2 iterations bives mm accuracy\n for (var i = 0; i < this.iterations; i++) {\n var th_n_re = th_re;\n var th_n_im = th_im;\n var th_n_re1;\n var th_n_im1;\n\n var num_re = z_re;\n var num_im = z_im;\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n th_n_re = 1;\n th_n_im = 0;\n var den_re = this.B_re[1];\n var den_im = this.B_im[1];\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n // Complex division\n var den2 = den_re * den_re + den_im * den_im;\n th_re = (num_re * den_re + num_im * den_im) / den2;\n th_im = (num_im * den_re - num_re * den_im) / den2;\n }\n\n // 3. Calculate d_phi ... // and d_lambda\n var d_psi = th_re;\n var d_lambda = th_im;\n var d_psi_n = 1; // d_psi^0\n\n var d_phi = 0;\n for (n = 1; n <= 9; n++) {\n d_psi_n = d_psi_n * d_psi;\n d_phi = d_phi + this.D[n] * d_psi_n;\n }\n\n // 4. Calculate latitude and longitude\n // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.\n var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);\n var lon = this.long0 + d_lambda;\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}", "function feibo(n) {\n let n1 = 1,\n n2 = 1;\n if (n === 1 || n === 2) {\n return 1;\n }\n for (let i = 3; i <= n; i++) {\n let a = n1;\n n1 = n2;\n n2 = a + n2;\n }\n return n2;\n}", "function f(array){\n let sum = 0;\n for(let i = 0; i < array.length;i++){\n if(array[i]%2 === 0){\n sum+= array[i];\n }}\n return sum;\n}", "function sift(a, i, n, lo) {\n\t var d = a[--lo + i],\n\t x = f(d),\n\t child;\n\t while ((child = i << 1) <= n) {\n\t if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;\n\t if (x <= f(a[lo + child])) break;\n\t a[lo + i] = a[lo + child];\n\t i = child;\n\t }\n\t a[lo + i] = d;\n\t }", "function Convolution(sequence1, sequence2) {\n let B_sec = sequence1; // big\n let S_sec = sequence2; // small\n let result = [];\n let new_center = sequence1.negative.length + sequence2.negative.length;\n let new_input = '';\n let perdiodicOne = sequence2.periodic || sequence1.periodic;\n let perdiodicBoth = sequence2.periodic && sequence1.periodic;\n\n if (S_sec.sequence.length > B_sec.sequence.length) {\n B_sec = sequence2;\n S_sec = sequence1;\n }\n for (let i = 0; i < S_sec.sequence.length; i++) {\n for (let j = 0; j < B_sec.sequence.length; j++) {\n if (result[j + i] === undefined)\n result[j + i] = 0;\n result[j + i] += B_sec.sequence[j] * S_sec.sequence[i];\n }\n }\n if (perdiodicOne || perdiodicBoth) {\n let temArray1 = [];\n let temArray2 = [];\n let len_periodic = 0;\n if (perdiodicOne && !perdiodicBoth) {\n if(B_sec.periodic) {\n len_periodic = B_sec.sequence.length;\n } else {\n len_periodic = S_sec.sequence.length;\n }\n } else if (perdiodicBoth){\n len_periodic = B_sec.sequence.length;\n }\n for (let i = 0; i < result.length; i++) {\n if (i < len_periodic)\n temArray1.push(result[i]);\n else\n temArray2.push(result[i]);\n }\n for (let i = 0; i < len_periodic; i++)\n temArray2.push(0);\n result = [];\n for (let i = 0; i < temArray1.length; i++) {\n result.push(temArray1[i] + temArray2[i])\n }\n }\n if (perdiodicOne)\n new_input += '...,';\n for (let i = 0; i < result.length; i++) {\n if (i === new_center)\n new_input += result[i].toString() + '#,';\n else\n new_input += result[i].toString() + ',';\n }\n new_input = new_input.substring(0, new_input.length - 1);\n if (perdiodicOne)\n new_input += ',...';\n AddNewResult(new_input);\n}", "function findNUniqueIntegersSumUpToZero(n) {\n let result = n % 2 === 0 ? [n, -n] : [0]\n for (let index = 1; index < n / 2; index++) {\n result.push(index, -index)\n }\n return result\n}", "function ify( x , y , z , n )\n {\n \n const c_szz = 0 ;\n const c_sxx = 1 ;\n const c_syy = 2 ;\n const c_sxy = 3 ;\n const c_sxz = 4 ;\n const c_syz = 5 ;\n\n const c_ux = 6 ;\n const c_uy = 7 ;\n const c_uz = 8 ;\n \n const r_r = 1 ;\n const r_rr = 9 ;\n\n\n var x2 = ( x * x ) ;\n var y2 = ( y * y ) ;\n var z2 = ( z * z ) ;\n \n var r02 = ( x2 + y2 + z2 ) ;\n var r0 = Math.sqrt( r02 ) ;\n var r03 = 0 ;\n\n var r1 = ( z / r0 ) ;\n var r13 = ( r1 * r1 * r1 ) ;\n var r15 = ( r1 * r1 * r13 ) ;\n\n var rz = 0 ;\n var rz2 = 0 ;\n var rrz = 0 ;\n \n var if0 = 0 ;\n var if1 = 0 ;\n var if2 = 0 ;\n \n var if3 = 0 ;\n var if4 = 0 ;\n var if5 = 0 ;\n var if6 = ( (3 * r15) / (2 * Math.PI) ) ;\n \n var r = undefined ;\n var rr = undefined ;\n \n if( n ) r = new Array( r_rr ) ; else r = new Array( r_r ) ;\n\n rr = new Array( 1 ) ;\n \n rr[0] = r ;\n\n if( n ) \n {\n \n r03 = ( r0 * r02 ) ;\n\n rz = ( r0 + z ) ;\n rz2 = ( rz * rz ) ;\n rrz = ( r0 / rz ) ;\n\n if0 = ( 1 - (2 * n) ) ;\n\n if1 = ( 3 / r02 ) ;\n if2 = ( if0 / rz2 ) ;\n if3 = ( (2 * r0) / rz ) ;\n if4 = ( r13 / (2 * Math.PI) ) ;\n if5 = ( 1 / (4 * Math.PI * r0) ) ;\n \n r[c_sxx] = ( if4 * (y / z) * ((if1 * x2) - (if2 * ((3 * r02) - y2 - (if3 * y2)))) ) ;\n r[c_syy] = ( if4 * (y / z) * ((if1 * y2) - (if2 * (r02 - x2 - (if3 * x2)))) ) ;\n \n r[c_sxy] = ( if4 * (x / z) * ((if1 * y2) + (if2 * (r02 - y2 + (if3 * y2)))) ) ;\n r[c_sxz] = ( if6 * ((y * x) / z2) ) ;\n r[c_syz] = ( if6 * (y2 / z2) ) ;\n\n r[c_ux] = ( if5 * (((y * x) / r02) - (if0 * ((y * x) / rz2))) ) ;\n r[c_uy] = ( if5 * (1 + (y2 / r02) + (if0 * (rrz - (y2 / rz2)))) ) ;\n r[c_uz] = ( if5 * (((y * z) / r02) + (if0 * (y / rz))) ) ;\n\n }; // end if -\n \n r[c_szz] = ( if6 * (y / z) ) ;\n \n return( r ) ;\n\n }", "function slow_solution(arr){\n let resultsArr = []\n for(let i=0; i<arr.length;i++){\n resultsArr[i] = 0;\n for(let j=0; j<arr.length; j++){\n if(arr[i] % arr[j] !== 0){\n resultsArr[i] +=1;\n // console.log('|i:', i, '| j:', j,'| arr:', arr[i], '| res:',resultsArr[i])\n }\n }\n }\n return resultsArr\n}", "function pass (m, bs, cs) {\n const ds = bs.concat()\n\n for (let i = 0; i < cs.length && m > 0; i++) {\n if (cs[i] > 0) {\n m -= 1\n ds[i] += 1\n }\n }\n\n return ds\n }", "function findTriplet(n) {\n\n for (let c = Math.floor(n / 3 + 1); c < n / 2; c++) {\n\n let sqa_b = c * c - n * n + 2 * n * c\n let a_b = Math.floor(Math.sqrt(sqa_b));\n\n if (a_b * a_b == sqa_b) {\n let b = (n - c + a_b) / 2;\n let a = n - b - c;\n return a * b * c;\n }\n }\n return -1\n}", "function F(n) {\n if(n == 0) return 1;\n return n - M(F(n-1));\n}", "function solution(A) {\n let jumps = []\n let i = 0\n while (i<=A.length){\n i= i+A[i]\n jumps.push(A[i])\n if (jumps.length >= A.length) {\n return -1}\n } \n return jumps.length \n }", "function buildOddArray(n) {\n a = [];\n for(i = 0; i < n; i++) {\n a[i] = (2 * i) + 1;\n }\n return sumNeg(a);\n}", "function climbStairs(n) {\n if (n < 3) return n;\n\n let arr = [1, 2];\n for (let i = 2; i < n; i += 1) {\n arr[i] = arr[i - 1] + arr[i - 2];\n }\n\n return arr[n - 1];\n}", "function prime4(n) {\n const data = new Int8Array((n + 1) / 2);\n data[0] = 1;\n\n // clear 3's\n for (let j = 4; j < data.length; j += 3) {\n data[j] = 1;\n }\n\n let step = 2;\n let u = 1;\n const result = [2, 3];\n for(let i = 2; i < data.length; i += step) {\n if (data[i] === 0) {\n let k = 2 * i + 1;\n result.push(k);\n if (u < data.length) {\n u = i * (1 + k); // (i + 2 * i**2 + i\n for (let j = u; j < data.length; j += k) {\n data[j] = 1;\n }\n }\n }\n step = 3 - step;\n }\n\n return result;\n }", "function climbStairs(n) {\n let table = new Array(n + 1)\n table[0] = 1\n table[1] = 1\n\n for (let i = 2; i < table.length; i++) {\n table[i] = table[i - 1] + table[i - 2]\n\n }\n return table[table.length - 1]\n}", "function stc(arr){\n var x = 0;\n for(var e=0; e<arr.length/2; e+=2){\n x = arr[e];\n arr[e] = arr[arr.length-1-e];\n arr[arr.length-1-e] = x;\n }\n}", "function solve(a){\n var even = 0\n var odd = 0\n for ( let i = 0 ; i<a.length ; i++){\n if ( typeof(a[i]) === \"number\"){\n if (a[i] %2 ===0){\n even ++\n }else{\n odd ++\n }\n }\n }\n return (even-odd);\n }" ]
[ "0.5929643", "0.58918965", "0.5870955", "0.5828068", "0.5807698", "0.57651836", "0.5749533", "0.5721601", "0.5712676", "0.56322896", "0.5627353", "0.5559439", "0.5507587", "0.5499367", "0.5494092", "0.54710156", "0.5446482", "0.54110646", "0.53637314", "0.53607726", "0.5337351", "0.53249127", "0.53210574", "0.5317797", "0.5316935", "0.5310791", "0.53058654", "0.5291534", "0.52889574", "0.52839535", "0.527903", "0.52736586", "0.5265355", "0.5264476", "0.52642184", "0.5259961", "0.52562886", "0.52561647", "0.52441126", "0.52352667", "0.52314365", "0.5229582", "0.52232707", "0.52114326", "0.520503", "0.5205007", "0.51990026", "0.51970917", "0.5184883", "0.5183594", "0.5183152", "0.5174467", "0.5165631", "0.5156918", "0.5153679", "0.51481014", "0.5137536", "0.51333624", "0.51317173", "0.51278734", "0.5124209", "0.5123819", "0.511967", "0.5115672", "0.5114692", "0.51108456", "0.51095885", "0.51065445", "0.5095345", "0.5095211", "0.5094268", "0.50931466", "0.5088311", "0.50773746", "0.5065904", "0.50624406", "0.5061608", "0.50581944", "0.5057224", "0.5052569", "0.50455636", "0.504471", "0.50439984", "0.5040842", "0.5038569", "0.5037388", "0.50351685", "0.5029828", "0.50246835", "0.50191045", "0.501092", "0.50072587", "0.5006113", "0.5001071", "0.49943882", "0.49910972", "0.49889955", "0.4987978", "0.49873716", "0.49868655", "0.4986034" ]
0.0
-1
console.log(my_min2(list)); // => 5 Largest Contiguous Subsum We have an array of integers, and we need to find the largest contiguous (togetherin sequence) subsum. Find the sums of all the contiguous subarrays and return the max. Phase 1 Write a function that interates through the array and finds all the subarrays using nested loops. Create a new array that holds all the subarrays. Then find the sums of each subarray and return the max.
function largest_contiguous_subsum1(arr){ let arrays = []; for (let i=0; i<arr.length; i++){ for (let k=i; k<arr.length; k++){ let array = []; for (let j=i; j<=k; j++){ array.push(arr[j]); } let sum = array.reduce((a,b) => a+b); arrays.push(sum); } } return Math.max(...arrays); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largest_contiguous_subsum2(arr){\n\n let max_so_far = arr[0];\n let curr_max = arr[0];\n\n for (i=1; i<arr.length; i++){\n curr_max = Math.max(arr[i], curr_max+arr[i]);\n max_so_far = Math.max(max_so_far, curr_max);\n }\n return max_so_far;\n}", "function getMaxSubSum(arr) { \n let max=0;\n for (let i=0; i<arr.length; i++) {\n let sumStart = 0;\n for (let j=i; j<arr.length; j++) {\n sumStart += arr[j];\n max = Math.max(sumStart, max);\n }\n } \n return max;\n} // O(n^2)", "function largestSubarraySum(array){\n\n let target = 0;\n let reversedArray = [...array].reverse();\n const reducer = (accumulator, currentValue) => accumulator + currentValue;\n\n\tfor (let i = 0; i < array.length - 1; i++){\n const slicedArray = array.slice(i);\n const slicedReversedArray = reversedArray.slice(i);\n\n const arr1Sum = slicedArray.reduce(reducer);\n const arr2Sum = slicedReversedArray.reduce(reducer);\n\n const arr3Sum = slicedArray.slice(0, -1).reduce(reducer);\n const arr4Sum = slicedReversedArray.slice(0, -1).reduce(reducer);\n\n target < arr1Sum ? target = arr1Sum : undefined;\n target < arr2Sum ? target = arr2Sum : undefined;\n\n target < arr3Sum ? target = arr3Sum : undefined;\n target < arr4Sum ? target = arr4Sum : undefined;\n\n }\n return target;\n}", "function maxContiguousSum (arr) {\n let sum = Math.max(...arr);\n\n for (let i = 0; i < arr.length - 1; i++) {\n let tempSum = arr[i];\n\n for (let j = i + 1; j < arr.length; j++) {\n tempSum += arr[j];\n\n if (sum < tempSum) sum = tempSum;\n }\n }\n\n return sum;\n}", "maxSubArray(arr) {\n const len = arr.length;\n if(len === 0) return 0;\n\n let maxSum = 0;\n for (let start = 0; start < len; start++) {\n for (let end = start; end < len; end++) {\n let sum = 0;\n for (let i = start; i <= end; i++) {\n sum += arr[i];\n }\n maxSum = Math.max(sum, maxSum);\n }\n }\n return maxSum;\n }", "function maxSubarraySum(array, number) {\n\n if (number > array.length) {\n return null;\n }\n // get the sum of the first subarray\n\n //slide through the whole array checking if a subsequence is more\n\n let maxIndexStart = 0;\n let maxSum = 0;\n let nextSum = 0;\n let currentSum = 0;\n //sum of first subarray\n for (let i = 0; i < number; i++) {\n maxSum += array[i];\n }\n\n currentSum = maxSum;\n for (let i = 0; i < array.length - number; i++) {\n nextSum = currentSum - array[i] + array[i + number]\n if (nextSum > maxSum) {\n maxIndexStart = i + 1;\n maxSum = nextSum;\n }\n currentSum = nextSum;\n\n }\n return {\n indexStart: maxIndexStart,\n sum: maxSum\n }\n}", "function maxSubsetSum(arr) {\n if (arr.length === 1)\n return arr[0];\n else if (arr.length === 2)\n return Math.max(arr[0], arr[1]);\n\n // iterationResult used to save iteration result of arr (from back)\n // index 0 means the result for the last number, index 1 means the result for the last 2 numbers, etc.\n let lastIndex = arr.length - 1;\n let iterationResult = [arr[lastIndex], Math.max(arr[lastIndex], arr[lastIndex - 1])];\n\n while (iterationResult.length !== arr.length) {\n let nextNumber = arr[arr.length - 1 - iterationResult.length];\n let lastIdx = iterationResult.length - 1, nextResult;\n nextResult = Math.max(nextNumber, nextNumber + iterationResult[lastIdx - 1], iterationResult[lastIdx]);\n iterationResult.push(nextResult);\n }\n\n return iterationResult[iterationResult.length - 1];\n}", "function maxSumIncreasingSubsequence(array) {\n\tlet map = new Map();\n\tfor (let i = 0; i < array.length; i++) {\n\t\tlet curr = array[i];\n\t\tmap.set(curr, []);\n\t\tfor (let j = i + 1; j < array.length; j++) {\n\t\t\tif (array[j] > curr) {\n\t\t\t\tmap.get(curr).push(array[j]);\n\t\t\t}\n\t\t}\n\t}\n\tlet max = -Infinity;\n\tlet vals = [];\n\tlet large = [];\n\tfor (let [key, value] of map) {\n\t\tvals = [];\n\t\tlet sum = key;\n\t\tlet prev = key;\n\t\tvals.push(key);\n\t\tfor (let val of value) {\n\t\t\tif (val > prev) {\n\t\t\t\tsum += val;\n\t\t\t\tprev = val;\n\t\t\t\tvals.push(val);\n\t\t\t} else {\n\t\t\t\twhile (vals[vals.length - 1] >= val) {\n\t\t\t\t\tsum -= vals.pop();\n\t\t\t\t}\n\t\t\t\tvals.push(val);\n\t\t\t\tsum += val;\n\t\t\t\tprev = val;\n\t\t\t}\n\t\t\tif (max < sum) {\n\t\t\t\tmax = sum;\n\t\t\t\tlarge = vals.slice();\n\t\t\t}\n\t\t}\n\t\tif (max < sum) {\n\t\t\tmax = sum;\n\t\t\tlarge = vals.slice();\n\t\t}\n\t}\n\treturn [max, large];\n}", "function maxSubArray(arr) {\n let results = [];\n let sums = [];\n for (var start = 0; start < arr.length; start++) {\n for (var end = 0; end < arr.length; end++) {\n if (end >= start) {\n results.push(arr.slice(start, end + 1));\n console.log(\"start=\", start, \"end=\", end, arr.slice(start, end + 1));\n }\n }\n }\n for (subarr in results) {\n sums.push(results[subarr].reduce((a, b) => a + b, 0));\n }\n sums.sort((a, b) => a - b);\n return sums[sums.length - 1];\n}", "function maxSumIncreasingSubsequence(array) {\n\tlet maxValues = array.slice();\n\tlet indecies = new Array(array.length).fill(null);\n\tlet maxSumIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tlet currentValue = array[i];\n\t\tfor (let j = 0; j < i; j++) {\n\t\t\tlet prev = array[j];\n\t\t\tif (prev < currentValue && maxValues[j] + currentValue >= maxValues[i]) {\n\t\t\t\tmaxValues[i] = maxValues[j] + currentValue;\n\t\t\t\tindecies[i] = j;\n\t\t\t}\n\t\t}\n\t\tif (maxValues[i] >= maxValues[maxSumIdx]) {\n\t\t\tmaxSumIdx = i;\n\t\t}\n\t}\n\treturn [maxValues[maxSumIdx], buildReturnValue(array, indecies, maxSumIdx)];\n}", "function maxSubArraySum(arr, num) {\n if(num > arr.length) {\n return null;\n }\n let max = -Infinity;\n for(let i=0;i<arr.length-num+1;i++) {\n let temp = 0;\n for(let j=0;j<num;j++) {\n temp += arr[i+j] //sum of three consuctive number and next number\n }\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n }", "function maxSumIncreasingSubsequence(array) {\n\tlet maxSeq = array.map(val => val);\n\tlet max = new Array(array.length).fill(null);\n\tlet maxIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tfor (let j = 0; j < i; j++) {\n\t\t\t\tif (array[i] > array[j] && maxSeq[j] + array[i] > maxSeq[i]) {\n\t\t\t\t\tmaxSeq[i] = maxSeq[j] + array[i];\n\t\t\t\t\tmax[i] = j;\n\t\t\t\t}\n\t\t}\n\t\tif (maxSeq[maxIdx] < maxSeq[i]) maxIdx = i;\n\t}\n\tlet result = [];\n\tlet maxValue = maxSeq[maxIdx];\n\twhile (maxIdx !== null) {\n\t\tresult.push(array[maxIdx]);\n\t\tmaxIdx = max[maxIdx];\n\t}\n\tlet reversedResult = result.reverse();\n\treturn [maxValue, reversedResult];\n}", "function maxSubArraySum(arr, n){ // O(n^2) // naive solution\r\n let maxSum = 0;\r\n for(let i = 0; i < arr.length - n + 1; i++){ // O(n)\r\n let temp = 0;\r\n for(let j = 0; j < n; j++){ // nested O(n)\r\n temp += arr[i + j];\r\n }\r\n if(temp > maxSum){\r\n maxSum = temp;\r\n }\r\n }\r\n return maxSum;\r\n}", "function maxSubarraySum(array, num) {\n // create 2 variables to hold max and temp sum\n let max = 0;\n let temp = 0;\n // if num is larger than the array length\n if (num > array.length) {\n // return null\n return null;\n }\n // iterate over num to grab the first consecutive nums\n for (let i = 0; i < num; i++) {\n // max adding all arrs in num\n max += array[i];\n }\n // set tempsum to be max\n temp = max;\n // iterate over the arr length\n for (let i = num; i < array.length; i++) {\n // set tempsum to be tempsum - beginning of arr and end\n temp = temp - array[i-num] + array[i];\n // set maxsum to be max of temp and max\n max = Math.max(max, temp);\n }\n // return max\n return max;\n }", "function maxConSubarray(arr){\n var i,\n len,\n tmp = [],\n sum = 0,\n cash,\n cashArr = [],\n // If find subarray with length more than 2.\n flag = true;\n /* To find\n positive subarray: posORneg = -1;\n negative subarray: posORneg = 1;\n */\n function subArr(arr,posORneg){\n for(i = 0, len = arr.length; i < len; i += 1){\n if(arr[i] === arr[i+1] + posORneg){\n flag = false;\n tmp.push(arr[i]);\n // Pushing last element to tmp because if will not check when i = length.\n if(i === len - 2){\n tmp.push(arr[i+1]);\n }\n } else {\n // If in the middle last element of subarray push it to tmp for negative subarray.\n if(posORneg === 1 && i !== len -1){\n tmp.push(arr[i]);\n }\n // If for correct work of reduce(). And skip it when negative subarray.\n if(tmp.length > 0 && posORneg === -1){\n // If in the middle last element of subarray push it to tmp.\n if (i !== len -1){\n tmp.push(arr[i]);\n }\n cash = tmp.reduce(function(previousValue, currentValue) {\n return previousValue + currentValue;\n });\n // Max sum.\n if (sum < cash){\n sum = cash;\n }\n // Clearing tmp.\n tmp = [];\n }\n }\n }\n }\n /* Comparing parameter of array with previous.\n If arrays are different makes flag = true and sum = 0.\n */\n function init(arr){\n len = arr.length;\n if (cashArr.length === 0) {\n cashArr = arr;\n }\n if (cashArr.length !== len){\n flag = true;\n sum = 0;\n }\n if (cashArr.length === len){\n for(i = 0; i < len; i += 1){\n if(cashArr[i] !== arr[i]){\n flag = true;\n sum = 0;\n break;\n }\n }\n }\n }\n\n return function(arr){\n init(arr);\n subArr(arr, -1);\n subArr(arr, 1);\n if(flag){\n return Math.max.apply(null,arr);\n } else return sum;\n }\n }", "function maxSubArraySum(arr, n) {\n let maxSum = 0;\n let tempSum = 0;\n\n if(arr.length < num) return null;\n\n //get the sum of n numbers\n for(let i = 0; i < arr.length; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for(let i = num; i < arr.length; i++) {\n //[2, 4, 1, 4, 1, 5, 1, 5]\n // s -tempsum- e\n let startOfWindow = arr[i - num];\n let endOfWindow = arr[i];\n tempSum = tempSum - startOfWindow + endOfWindow;\n maxSum = Math.max(tempSum, maxSum)\n }\n\n return maxSum;\n}", "function findMaxSumArray(numberList) {\n if (!Array.isArray(numberList) || numberList.length === 0) return [];\n\n const newArray = findAllIncreasingSubArr(numberList);\n let sum = -Infinity;\n newArray.forEach((x) => {\n let temporary = 0;\n x.forEach((item) => {\n temporary += item;\n });\n if (temporary > sum) sum = temporary;\n });\n return sum;\n}", "function maxSubarraySum(arr, num) {\n if (arr.length < num) {\n return null;\n }\n // outer array = subarray\n //[4, 2, 1, 6, 2], 4 ==> 13\n // why do arr.length - num + 1?\n // because we don't want to reach the end of the array\n // for example, the above example takes in 4, which means\n // I want to stop at 2 which is index(1)\n // arr.length (5) - 4 === 1, which means i needs to be less than 1 + 1 \n // which is 2\n \n // this is to account for negative sum\n // in the above solution I assigned biggestSum to null but\n // if there were negative numbers\n // null > -1 equates to true, null > 0 false\n // so the biggestSum will never be replaced and the results will be\n // unpredictable\n let max = -Infinity;\n\n for (let i = 0; i < arr.length - num + 1; i++) {\n let temp = 0;\n // use num as a part of the loop because we know\n for (let j = 0; j < num; j++) {\n // this works because in the inner loop, the j will increase\n // then once j is done, then i will increase\n temp += arr[i + j];\n }\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function maxSubArray(arr) {\n if (arr.length === 1) return arr[0];\n let smallest = 0;\n\n let running_total = 0;\n let answer = arr[0];\n for (var i = 0; i < arr.length; i++) {\n let value = arr[i];\n running_total += value;\n\n // if(answer < running_total - smallest){\n // answer = running_total - smallest\n // console.log(\"a \", answer)\n // }\n answer = Math.max(answer, running_total - smallest);\n smallest = Math.min(smallest, running_total);\n\n console.log(\n // i, \"value=\",value,\n \"runningtotal=\",\n running_total,\n \"smallest=\",\n smallest,\n \"biggest= runningtotal-smallest\",\n running_total - smallest,\n \"answer=\",\n answer\n );\n }\n\n return answer;\n}", "function maxSubarraySum(arr, num) {\n // Instantiate variables to hold max sum and temporary sum values\n let maxSum = 0;\n let tempSum = 0;\n\n // Check if array length is less than n (num), if so return null (handles arrays with not enough n consecutive numbers)\n if (arr.length < num) {\n return null;\n }\n\n // Iterate through array to find the first n (num) consecutive sum of values\n for (let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n\n // Assign initial tempSum value equal to the initial maxSum value\n tempSum = maxSum;\n\n // Iterate through array starting at n (num)\n for (let i = num; i < arr.length; i++) {\n // Assign new tempSum value by substracting the last num (to the left) and adding the current index value at (i)\n tempSum = tempSum - arr[i - num] + arr[i];\n\n // Assign maxSum to the highest value of either the current maxSum value or new tempSum value\n maxSum = Math.max(maxSum, tempSum);\n }\n\n return maxSum;\n}", "function maxSubArraySum(arr, num) {\n\tif (arr.length < num) return null;\n\tlet max = 0;\n\tlet tempMax = 0;\n\n\tfor (let i = 0; i < num; i++) {\n\t\ttempMax += arr[i];\n\t}\n max = tempMax;\n\tfor (let i = num; i < arr.length; i++) {\n tempMax = tempMax + arr[i] - arr[i-num];\n max = Math.max(tempMax,max) \n }\n console.log(max)\n}", "function maxSubarray(array) {\n // currentNum + nextNum\n // currentNum + nextNum + nextnextNum\n // splice -\n\n let maxSum = array[0];\n for (let i = 1; i < array.length; i++) {\n let currentNum = array[i];\n\n if (sumRange(array.splice(0, currentNum)) > maxSum) {\n maxSum = sumRange(array.splice(0, currentNum));\n }\n }\n}", "function maxSubarraySum(arr) {\n let max_ending = 0; let max_so_far = 0;\n for (let i = 0; i < arr.length; i++) {\n max_ending = arr[i] + max_ending;\n if (max_ending < 0)\n max_ending = 0\n else if (max_so_far < max_ending) {\n max_so_far = max_ending;\n }\n }\n return max_so_far;\n}", "function maxSubarraySum1(arr, n) {\n if (arr[1] === undefined) return null;\n let max = -Infinity;\n let total = 0;\n\n for (let i = 0; i <= arr.length - n; i++) {\n total = 0;\n for (let j = 0; j < n; j++) {\n total += arr[i + j];\n }\n if (max < total) max = total;\n }\n\n return max;\n}", "function maxSubarraySum(arr, n){\n if(n > arr.length) return null\n let sum = 0\n for (let i=0; i<n; i++){\n sum += arr[i]\n }\n let maxSum = sum\n\n for(let j=n; j<arr.length; j++){\n sum = sum + arr[j] - arr[j-n]\n maxSum = Math.max(maxSum, sum)\n }\n return maxSum\n}", "function maxSubarraySum(arr, num) {\n if (num > arr.length) {\n return null; \n } \n var max = -Infinity; \n for (let i = 0; i < arr.length - num + 1; i++) {\n let temp = 0; \n for (let j = 0; j < num; j++) {\n temp += arr[i + j]; \n }\n if (temp > max) {\n max = temp; \n }\n }\n return max; \n}", "function maxSubarraySum2(arr, n) {\n if (arr.length < n) return null;\n let max = 0;\n let temp = 0;\n\n for (let i = 0; i < n; i++) {\n max += arr[i];\n }\n\n t = max;\n\n for (let i = n; i < arr.length; i++) {\n t = t - arr[i - n] + arr[i];\n max = Math.max(max, t);\n }\n\n return max;\n\n}", "function maxSubarraySum(arr, num){\n if(num > arr.length){\n return null;\n }\n var max = -Infinity;\n for(let i=0; i< arr.length-num + 1; i++){\n temp = 0;\n for(let j=0; j< num; j++){\n temp += arr[i+j];\n }\n if(temp > max){\n max = temp;\n }\n }\n return max;\n}", "function refMaxSubArraySum(arr, num) {\n let maxSum = 0;\n let tempSum = 0;\n if (arr.length < num) {\n return null;\n }\n for (let i = 0; i < num; i++) {\n // We loop over the array one time here\n maxSum += arr[i];\n // console.log('max: ', maxSum);\n }\n tempSum = maxSum;\n for (let i = num; i < arr.length; i++) {\n tempSum = tempSum - arr[i - num] + arr[i];\n // console.log('arr-: ', arr[i - num], 'arr+: ', arr[i]);\n // This line above subtracts the preceding digit in the numbers and adds the next one to the line of numbers for the next sum\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function maxSubarraySum(arr, num) {\n let biggestSum = null;\n for (let i = 0; i < arr.length; i++) {\n let clone = arr.slice(0);\n let subArray = clone.splice(i, num);\n let sum = subArray.reduce((x, y) => { return x + y });\n if (biggestSum < sum) {\n biggestSum = sum;\n }\n }\n return biggestSum;\n}", "function findMaximumSubarray2(A) {\n \n}", "function maxSubarraySum(arr, num){\n if (arr.length < num) return null;\n \n let total = 0;\n for (let i=0; i<num; i++){\n total += arr[i];\n }\n let currentTotal = total;\n for (let i = num; i < arr.length; i++) {\n currentTotal += arr[i] - arr[i-num];\n total = Math.max(total, currentTotal);\n }\n return total;\n}", "function maxSubsetSumNoAdjacent(array) {\n // edge case, if the array has no length\n if (!array.length) return 0;\n if (array.length === 1) return array[0];\n // create an array that we will push values to as we iterate through the array\n const dynamicArr = array.slice()\n dynamicArr[1] = Math.max(array[0], array[1]) // make sure you start of with hte maximum value -- etch case where there is a skip later on\n // create for loop to iterate through the array, and add value based off the best case scenario (typic)\n for (let i = 2; i < array.length; i++) {\n // take the maximum off array[i] + array[i - 2] versus dynamicArr[i - 1]\n dynamicArr[i] = Math.max(dynamicArr[i] + dynamicArr[i - 2], dynamicArr[i - 1])\n console.log(dynamicArr)\n }\n return dynamicArr[dynamicArr.length - 1]\n}", "function maxSubarraySum2(arr, num){\r\n if(arr.length < num){\r\n return false;\r\n }\r\n\r\n let total = 0;\r\n\r\n for (let i = 0; i < num; i++){\r\n total += arr[i];\r\n }\r\n\r\n let currentTotal = total;\r\n\r\n for (let i = num; i < arr.length; i++){\r\n currentTotal += arr[i] - arr[i - num];\r\n total = Math.max(total, currentTotal);\r\n }\r\n\r\n return total;\r\n}", "function maxSubArraySum(arr, num){\r\n\tlet maxSum = 0;\r\n\tlet tempSum = 0;\r\n\tif(arr.length<num) \r\n\t\treturn null;\r\n\r\n\tfor(let i = 0; i<num; i++){\r\n\t\tmaxSum += arr[i];\r\n\t}\r\n\r\n\ttempSum = maxSum;\r\n\r\n\tfor(let i = num; i<arr.length; i++){\r\n\t\ttempSum = tempSum - arr[i - num] + arr[i];\r\n\t\tmaxSum = Math.max(maxSum, tempSum);\r\n\t}\r\n\treturn maxSum;\r\n}", "function maxSubArraySum(arr, num) {\n let maxSum = 0;\n let tempSum = 0;\n if(arr.length < num ) return null;\n\n for(let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n tempSum = maxSum;\n for(let i = num; i < arr.length; i++) {\n tempSum = tempSum - arr[i - num] + arr[i];\n console.log(arr[i -num]);\n maxSum = Math.max(maxSum, tempSum);\n }\n\n return maxSum;\n}", "function maxSubArraySum(arr,num){\n if(num > arr.length) return null\n //if the array contains all negative numbers \n let maxSum = 0\n let currentSum = 0\n for(let i = 0; i < num; i++){\n maxSum += arr[i]\n }\n currentSum = maxSum\n for(let i = num; i < arr.length; i++){\n currentSum = currentSum - arr[i - num]+ arr[i]\n maxSum = Math.max(maxSum, currentSum)\n }\n return maxSum\n }", "function maxSubArray(nums) {\n if (nums.length < 1) {\n return null;\n }\n\n let max_result = -Infinity, \n temp_max = 0;\n \n for (let i = 0; i < nums.length; i++) {\n temp_max += nums[i]\n \n if (max_result < temp_max) {\n max_result = temp_max;\n }\n\n if (temp_max < 0) {\n temp_max = 0;\n }\n }\n\n return max_result;\n}", "function maxSubsetSumNoAdjacent(array){\n if (array.length === 0) return 0;\n if (array.length === 1) return array[0];\n\n let previousSum = array[0];\n let maxSum = Math.max(array[0], array[1])\n\n for (let i = 2; i < array.length; i++) {\n const current = Math.max(maxSum, previousSum + array[i]);\n previousSum = maxSum;\n maxSum = current;\n }\n return maxSum;\n}", "maxSubArrayLinear(arr) {\n const len = arr.length;\n if(len === 0) return 0;\n \n const sub = [Math.max(arr[0], 0)];\n for (let i = 1; i < len; i++) {\n sub[i] = Math.max(sub[i - 1] + arr[i], 0);\n }\n\n return Math.max(...sub);\n }", "function maxSubarraySum3(arr, num) {\n if (arr.length < num) return null;\n let maxSum = 0;\n let tempSum = 0;\n\n for (let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for (let i = 0; i < arr.length; i++) {\n tempSum = tempSum - arr[i] + arr[i + num];\n if (tempSum > maxSum) maxSum = tempSum;\n }\n\n return maxSum;\n}", "function maxSubsetSumNoAdjacent(array) {\n\t// if array is empty return 0\n\tif(array.length === 0) {\n\t\treturn 0;\n\t}\n\t// if length is 1 return the value\n\tif (array.length === 1) {\n\t\treturn array[0];\n\t}\n\t// pointer for n-2\n let second = array[0];\n\t// pointer for n -1\n let first = Math.max(array[0], array[1]);\n\t\n\t// loop through array starting at 2\n\tfor (let i = 2; i < array.length; i++) {\n\t\t// current index - 1\n let current = Math.max(first, second + array[i]);\n second = first;\n first = current;\n\t}\n\t// return last index as it's the max Sum\n\treturn first;\n}", "function findMaxSum(a) {\n let splitIntoIndependentSequences = a => {\n let seqs = [];\n let currentSeq = [];\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] > 0) {\n currentSeq.push(a[i]);\n } else {\n if (currentSeq.length > 0) {\n seqs.push(currentSeq);\n }\n\n currentSeq = [];\n }\n }\n\n if (currentSeq.length > 0) {\n seqs.push(currentSeq);\n }\n\n return seqs;\n }\n\n let findMaxSumHelper = a => {\n // this function assumes that none of the values in a are < 1\n\n if (a.length === 0) {\n return 0;\n }\n\n if (a.length === 1) {\n return a[0];\n }\n\n if (a.length === 2) {\n return Math.max(a[0], a[1]);\n }\n\n return Math.max(\n findMaxSumHelper(a.slice(1)),\n a[0] + findMaxSumHelper(a.slice(2))\n );\n }\n\n let seqs = splitIntoIndependentSequences(a);\n let sum = 0;\n\n for (let i = 0; i < seqs.length; i++) {\n sum += findMaxSumHelper(seqs[i]);\n }\n\n return sum;\n}", "function maxSubarraySum(arr, num) {\n if (num > arr.length) return null;\n let temp = 0;\n let max = 0;\n\n for (let i = 0; i < num; i++) {\n max += arr[i]\n }\n temp = max;\n // make sure i < arr.length - num + 1\n for (let i = 1; i < arr.length - num + 1; i++) {\n temp = temp - arr[i - 1] + arr[i + (num - 1)];\n max = Math.max(max, temp);\n }\n return max;\n}", "function maxSubArraySum(arr, num) {\n let maxSum = 0;\n let tempSum = 0;\n\n // if the array length is less than the num passed. Return null \n if (arr.length < num) return null;\n\n\n for (let i = 0; i < num; i++) {\n // the maxSum = the first # of (num) passed \n maxSum += arr[i];\n }\n\n // setting the temp sum = maxSum\n tempSum = maxSum;\n\n\n for (let i = num; i < arr.length; i++) {\n /*\n first pass is as follows: \n tempSum = 11 - (arr[3 - 3] = 2) + (arr[3] = 7) = 16\n */\n tempSum = tempSum - arr[i - num] + arr[i];\n // maxSum = the max number between tempSum and maxSum\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function maxSubarraySum(arr, num){\r\n let maxSum = 0;\r\n let tempSum = 0;\r\n\r\n if(arr.length < num) return null; //egdecase\r\n\r\n for (let i = 0; i < num; i++){\r\n maxSum += arr[i];\r\n }\r\n\r\n tempSum = maxSum;\r\n\r\n for (let i = num; i < arr.length; i++){\r\n tempSum = tempSum - arr[i - num] + arr[i];\r\n maxSum = Math.max(maxSum, tempSum) \r\n }\r\n\r\n return maxSum;\r\n}", "function maxSubarraySum(array, num) {\n let maxSum = 0;\n let tempSum = 0;\n if (array.length < num) return null;\n\n for (let i = 0; i < num; i++) {\n maxSum += array[i];\n }\n tempSum = maxSum;\n for (let i = num; i < array.length; i++) {\n tempSum = tempSum - array[i - num] + array[i];\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function maxSubarraySum(arr, num) {\n let maxSum = -Infinity; //start here, in case all numbers in array are negative\n let tempSum = 0\n if (arr.length < num) return null //handles edge case if there are not num numbers\n for (let i = 0; i < num; i++) {\n maxSum += arr[i] //sets maxSum to the initial subset\n }\n tempSum = maxSum //sets starting point for sliding window\n for (let i = num; i < arr.length; i++) {// now we have to go to the end of the array\n tempSum = tempSum - arr[i - num] + arr[i]; //starts at next element, after initial\n //subarray, subtracts original first element, adds current element\n maxSum = Math.max(tempSum, maxSum) // sets maxSum to whichever is larger\n }\n return maxSum\n}", "function maxSubarraySum(arr, num) {\n //declaring an initial max value and temp value for comparing.\n let maxSum = 0;\n let tempSum = 0;\n\n // If the consecutive number arguement is larger than the length of the array return null.\n if (arr.length < num) return null;\n\n // This loop sets the first summed n values in the array. \n for (let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n // This loop now moves the window through the array by subracting the first number in the window from the \n // total and adding the next number after the window. Effectivly moving the window one space and\n // getting the new summed value for it. Afterward the maxSum is updated if the temp sum is larger than \n // the current maxSum value. \n for (let i = num; i < arr.length; i++) {\n tempSum = tempSum - arr[i - num] + arr[i];\n maxSum = Math.max(maxSum, tempSum);\n }\n console.log(maxSum);\n return maxSum;\n}", "function minSubArrayLen(arr, num) {\n // create maxSum \n // create tempSumLen\n // create tempIdex\n\n // iterate through the given array \n // sum the subarray until maxSum >= num and then update tempIdex, break the loop\n // iterate through the same array but start at tempIdex\n // firs pointer at index 1 and second pointer at tempIdex + i\n // subtract maxSum by arr[firstPointer] and add arr[tempIdex + i]\n // repeat \n // if tempSum > maxSum then update tempSum\n\n}", "function maxSubarraySum(arr, num) {\n if (arr.length < num) return null;\n let subSum = 0;\n for (let i = 0; i < num; i++) {\n subSum += arr[i];\n }\n let max = subSum;\n for (let j = num; j < arr.length; j++) {\n subSum = subSum - arr[j - num] + arr[j];\n max = Math.max(subSum, max);\n }\n return max;\n}", "function maxSubarraySum(array, num) {\n if (num > array.length) {\n return null;\n }\n var max = -Infinity;\n for (let i = 0; i < array.length; i++) {\n temp = 0;\n for (let j = 0; j < num; j++) {\n temp += array[i + j];\n }\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function maxSubarraySum(arr, n) {\n\n if (n > arr.length) return null;\n\n let max = -Infinity;\n\n for (var i = 0; i < arr.length - n + 1; i++) {\n\n let temp = 0;\n for (var j = 0; j < n; j++) {\n temp += arr[i + j];\n }\n\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function maxSubarraySum(arr, num) {\n let maxSum = 0;\n let tempSum = 0;\n if(arr.length < num) return null;\n\n for(let i = 0; i < num; i++) {\n maxSum += arr[i];\n };\n \n tempSum = maxSum;\n\n for(let i = num; i < arr.length; i++) {\n tmepSum = tempSum - arr[i - num] + arr[i];\n maxSum = Math.max(maxSum, tmepSum);\n };\n\n return maxSum;\n}", "function maxSubarraySum(arr, num) {\n if(num > arr.length) {\n return null;\n };\n\n let max = -Infinity;\n for(let i = 0; i < arr.length - num + 1; i++) {\n temp = 0;\n for(let j = 0; j < num; j++) { \n temp += arr[i + j];\n };\n if(temp > max) {\n max = temp;\n };\n };\n return max;\n}", "function maxSubarraySum(arr, num) {\n if (arr.length < num) return null;\n\n let tempSum = 0;\n let maxSum = 0;\n\n for (let i = 0; i < num; i++) {\n tempSum += arr[i];\n }\n\n maxSum = tempSum;\n\n for (let i = num; i < arr.length; i++) {\n tempSum = tempSum - arr[i - num] + arr[i];\n if (tempSum > maxSum) {\n maxSum = tempSum;\n }\n }\n\n return maxSum;\n}", "function LargestSum() {\n\tvar test = [1, 3, -5, 23, -11, 6, 37, 21, -31, 10, 9, 19];\n\n\tfunction dpLargeSum(collection) {\n\t\tvar largest = [];\n\t\tlargest[0] = collection[0];\n\t\t// var lastIndex = 0;\n\t\tfor (var i = 1; i < collection.length; i++) {\n\t\t\t// largest[i] represents the largest sum for sub sequence ending with collection[i]\n\t\t\t// largest[i] does not mean the largest sum for the first i items (which could make things much more complicated)\n\t\t\tlargest[i] = largest[i - 1] + collection[i] > collection[i] ? largest[i - 1] + collection[i] : collection[i];\n\t\t}\n\t\tconsole.log(largest);\n\t\treturn max(largest);\n\t}\n\n\tfunction max(collection) {\n\t\tvar maxVal = collection[0];\n\t\tcollection.forEach((item) => {\n\t\t\tif (item > maxVal) {\n\t\t\t\tmaxVal = item;\n\t\t\t}\n\t\t});\n\t\treturn maxVal;\n\t}\n\n\tfunction bruteForce(collection) {\n\t\tvar sum = 0;\n\t\tvar max = 0;\n\t\t// starting index\n\t\tfor (var i = 0; i < collection.length; i++) {\n\t\t\t// define the length of this loop\n\t\t\tfor (var j = 0; j < collection.length - i; j++) {\n\t\t\t\t// starting index to index + length\n\t\t\t\tfor (var k = i; k < j + i + 1; k++) {\n\t\t\t\t\tsum += collection[k]\n\t\t\t\t}\n\t\t\t\tif (sum > max) {\n\t\t\t\t\tmax = sum;\n\t\t\t\t}\n\t\t\t\tsum = 0;\n\t\t\t}\n\t\t}\n\t\treturn max;\n\t}\n\n\tconsole.log(dpLargeSum(test));\n\tconsole.log(bruteForce(test));\n}", "function maxSubsetSumNoAdjacent(array) {\n // Write your code here.\n if (array.length === 0) {\n return 0;\n }\n var maximumSums = [];\n for (var i = 0; i < array.length; i++) {\n if (i === 0) {\n maximumSums.push(array[i]);\n }\n else if (i === 1) {\n maximumSums.push(Math.max(array[i - 1], array[i]));\n }\n else {\n maximumSums.push(Math.max(maximumSums[i - 1], maximumSums[i - 2] + array[i]));\n }\n }\n return maximumSums[maximumSums.length - 1];\n}", "function getMaxSum(array) {\n let result = 0;\n for (let i = 1; i < array.length-1; i++) {\n for (let j = 1; j < array[i].length-1; j++) {\n if (array[i-1][j-1] !== undefined && array[i+1][j+1] !== undefined && array[i-1][j+1] !== undefined && array[i+1][j-1] !== undefined){\n let sum = array[i][j] + array[i-1][j-1] + array[i-1][j] + array[i-1][j+1] + array[i+1][j-1] + array[i+1][j] + array[i+1][j+1];\n if (sum > result) { result = sum; }\n }\n }\n }\n return result;\n}", "function sumArray(array) {\n var highestSum = array[0];\n\n function traverseSubsetsAtIndexN (startIndex) {\n var current = array[startIndex];\n\n //single element \n if (current > highestSum) {\n highestSum = current;\n }\n\n //continguous elements\n for (var i = startIndex+1; i < array.length; i++) {\n current = current + array[i];\n if (current > highestSum) {\n highestSum = current;\n }\n }\n }\n\n for (var i = 0; i < array.length; i++) {\n traverseSubsetsAtIndexN(i);\n }\n\n return highestSum;\n}", "function maxSubarraySum(arr, n) {\n let maxSum = 0;\n let tempSum = 0;\n if (arr.length < n) return null;\n for (let i = 0; i < n; i++) {\n maxSum += arr[i];\n }\n tempSum = maxSum;\n for (let i = n; i < arr.length; i++) {\n tempSum = tempSum + arr[i] - arr[i - n];\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function maxSubarraySum(arr, num) {\n\tif (arr.length < num) return null;\n\n\tlet maxSum = 0;\n\tlet tempSum = 0;\n\t//this is just a loop to get the first num amount of items in the array added to start\n\tfor (let i = 0; i < num; i++) {\n\t\tmaxSum += arr[i];\n\t}\n\ttempSum = maxSum;\n\t//i = num skips the items grabbed above\n\tfor (let i = num; i < arr.length; i++) {\n\t\ttempSum = tempSum - arr[i - num] + arr[i];\n\t\tmaxSum = Math.max(maxSum, tempSum);\n\t}\n\tconsole.log(maxSum);\n\treturn maxSum;\n}", "function maxSubarraySum(arr, num) {\n\t// declare a maxValue empty variable\n\tlet maxValue = 0;\n\tlet length = num;\n\tfor (let j = 0; j < arr.length; j++) {\n\t\tif (length <= arr.length ) {\n let sum = 0;\n for (let i = j; i < length; i++) {\n sum += arr[i];\n\t\t\t}\n maxValue = Math.max(maxValue, sum);\n\t\t\tlength++;\n\t\t}\n\n\t}\n\treturn (maxValue)\n}", "function maxSubArraySum(arr, num) {\n if(num > arr.length) {\n return null\n }\n let maxSum = 0;\n let tempSum = 0;\n for(let i=0;i<num;i++) {\n maxSum += arr[i];\n }\n tempSum = maxSum\n for(let i=num;i<arr.length; i++) {\n tempSum = tempSum - arr[i-num] + arr[i] //tempsum conatin total sum of num digit, minus first digit and add current digit\n maxSum = Math.max(tempSum, maxSum)\n }\n return maxSum\n }", "function maxSubsetSumNoAdjacent(array) {\n // Write your code here.\n if (array.length === 0) {\n return 0;\n }\n if (array.length === 1) {\n return array[0];\n }\n var second = array[0];\n var first = Math.max(array[0], array[1]);\n var temp;\n for (var i = 2; i < array.length; i++) {\n temp = Math.max(first, second + array[i]);\n second = first;\n first = temp;\n }\n return first;\n}", "function maxSubArraySum(arr, num){\n if (arr.length < num) return null;\n\n let total = 0;\n for (let i=0; i<num; i++){\n total += arr[i];\n }\n let currentTotal = total;\n for (let i = num; i < arr.length; i++) {\n // we only swap out first and last numbers and then compare the values, e.g. num is 2 we swap 1 with 3 and compare\n // /\n // 1,2,3,4,5,6\n // /\n currentTotal += arr[i] - arr[i-num];\n total = Math.max(total, currentTotal);\n }\n return total;\n}", "function MaxSubArraySum(array,num)\r\n{\r\n\tvar res=[];\r\n\tvar sum=0;\r\n\tvar count=0;\r\n\tvar remainder=0;\r\n\tvar pointer=0;\r\n\tfor(var i=0;i<array.length;i++)\r\n\t{\r\n\t\tvar j=0;\r\n\t\tsum=array.slice(j,array.length-i);\r\n\t\tremainder=sum.reduce((a,b)=>a+b);\r\n\t\tres.push(remainder%num);\r\n\t\tcount=(array.length-i)%num;\r\n\t\tres.push(count);\r\n\t}\r\n\t\r\n\t\r\n\t//after that values are used\r\n\treturn Math.max(...res);\r\n}", "function maxSubarraySum(arr, num) {\n if(arr.length < num) return null;\n\n let total = 0;\n for (let i = 0; i < num; i++) {\n total += arr[i];\n }\n let currentTotal = total;\n for (let i = num; i < arr.length; i++) {\n currentTotal += arr[i] - arr[i-num];\n total = Math.max(total, currentTotal);\n }\n return total;\n}", "function maxSubarraySum(arr, num) {\n if (num > arr.length) {\n return null;\n }\n\n let max = -Infinity;\n for (let i = 0; i < arr.length - num + 1; i++) {\n temp = 0;\n for (let j = 0; j < num; j++) {\n temp += arr[i + j];\n }\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function subarray_sum_max(arr){\n // let temp = arr[i]\n let temp=0\n let max_limit = -(Number.MIN_VALUE) // Number.MIN_VALUE gives the smallest positive numeric value representable in JavaScript.\n for(let i=0;i<arr.length;i++){\n temp = temp+arr[i]\n if(max_limit<temp){\n max_limit = temp\n }\n if(temp<0){\n temp = 0\n }\n \n }\n if(max_limit>0){\n return max_limit\n }else{\n return 0\n }\n \n}", "function maxSubarraySum(arr, num) {\n if (arr.length < num) return null;\n\n let maxSum = 0,\n tempSum = 0;\n\n for (let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for (let i = num; i < arr.length; i++) {\n tempSum = tempSum - arr[i - num] + arr[i];\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function maxSubArraySumNaive(arr, num) {\n if(num > arr.length) return null;\n\n let max = -Infinity;\n\n for (let i = 0; i < arr.length -num + 1; i++) {\n temp = 0;\n for(let j = 0; j < num; j++) {\n temp += arr[i + j];\n }\n // console.log(temp, max)\n if(temp > max) max = temp;\n }\n return max;\n}", "function maxSubarraySum(arr, num){\n // add whatever parameters you deem necessary - good luck!\n let max = 0\n if (num > arr.length) return null\n for (let i = 0; i < num; i++) {\n max += arr[i]\n }\n let temp = max\n for (let i = num; i < arr.length; i++) {\n temp += arr[i] - arr[i - num] \n if (temp>max) max=temp\n }\n return max\n}", "function solution(A) {\n \n let maxEnding = [];\n maxEnding.push(0);\n \n let maxBeginning = [];\n maxBeginning[A.length-1] = 0\n \n for (let i = 1; i < A.length-2; i++){\n maxEnding[i] = Math.max(0, maxEnding[i-1]+A[i]);\n }\n \n for (let i = A.length-2; i >= 2; i--){\n maxBeginning[i] = Math.max(0, maxBeginning[i+1]+A[i]);\n }\n \n let maxSum = 0;\n for (let i = 0; i < A.length-2; i++){\n let sum = maxEnding[i] + maxBeginning[i+2];\n if (sum > maxSum){\n maxSum = sum;\n }\n }\n \n return maxSum;\n}", "function maxSubsetSum(arr) {\n let exclusive = 0; // holds current max value excluding with addition to this position\n let inclusive = 0; // holds current max value including with addition to this position\n \n for (let i = 0; i < arr.length; i++) {\n let temp = inclusive;\n inclusive = Math.max(exclusive + arr[i], inclusive);\n exclusive = temp;\n }\n \n return inclusive;\n }", "function maxSubarray(a) {\n var opt = [];\n for (var from = 0; from < a.length; from++) {\n opt[from] = new Array(a.length);\n opt[from] = opt[from].map(function() {return 0;});\n opt[from][from] = a[from];\n for (var to = from+1; to < a.length; to++) {\n opt[from][to] = opt[from][to-1] + a[to];\n }\n }\n\n var max = Number.MIN_VALUE;\n var maxRange = [];\n for (var from = 0; from < a.length; from++) {\n for (var to = from; to < a.length; to++) {\n if (opt[from][to]>max) {\n max = opt[from][to];\n maxRange = [from, to+1];\n }\n }\n }\n\n return Array.prototype.slice.apply(a, maxRange);\n}", "function maxSubArray(nums, start = 0, end = nums.length - 1) {\n// base case: when left and right array are length 1, take max of (left, right, their crossum)\n if (start === end) {\n return nums[start];\n }\n\n let midPoint = Math.floor((start + end) / 2)\n let leftMaxSubArray = maxSubArray(nums, start, midPoint);\n let rightMaxSubArray = maxSubArray(nums, midPoint + 1, end);\n let maxCrossSum = getMaxCrossSum(nums, start, midPoint, end);\n\n return Math.max(leftMaxSubArray, rightMaxSubArray, maxCrossSum);\n}", "function maxSubArrayDP(data){\n var sum = Array(data.length);\n sum[0] = data[0];\n var resultValue = sum[0];\n var result = Array(data.length);\n result[0] = [data[0]];\n var resultIndex = 0;\n for (var i=1;i<data.length;i++){\n if (sum[i-1] + data[i] > data[i]){\n sum[i] = sum[i-1] + data[i];\n result[i] = result[i-1].slice(); // FIXME: how to copy array in O(1) time?\n result[i].push(data[i]);\n }else{\n sum[i] = data[i];\n result[i] = [data[i]];\n }\n if (sum[i] > resultValue){\n resultValue = sum[i];\n resultIndex = i;\n }\n }\n return result[resultIndex];\n}", "function maxSum(arr){\n if (arr.length === 1){\n return arr[0];\n }\n let sum = 0;\n let tempArr = arr;\n for (let j =0; j< arr.length; j++){\n let temp = 0;\n for (let i=0;i<tempArr.length;i++){\n temp += tempArr[i];\n if (temp > sum){\n sum = temp;\n }\n }\n tempArr.shift();\n }\n return sum;\n}", "function maxSequence(arr) {\n if (arr.every(n => n < 0)) {return 0;}\n\n let currentSum = arr[0];\n \n return arr.slice(1).reduce((maxSum, n) => {\n currentSum = Math.max(currentSum + n, n);\n return maxSum = Math.max(currentSum, maxSum);\n }, currentSum);\n}", "function maxSumOfArray(nums, n){\n // set variables for both the final sum and temp sum that will be checked each time to see which is greater\n sum = 0;\n tempSum = 0;\n // for loop to go through the indexes of the array\n for (i = 0; i < n-1; i++){\n // add the sums of consecutive numbers and assign them to the temp sum\n tempSum += nums[i];\n }\n // second for loop to check tempSum against Sum and return the higher value\n for( i = n - 1; i < nums.length; i++){\n // sum of \n tempSum += nums[i];\n // checks the values of tempSum and sum and sets the higher value to sum\n if (tempSum > sum){\n // sets higher value to sum\n sum = tempSum;\n }\n \n tempSum -= numfs[i-n+1]\n }\n return sum;\n}", "function maxSub(arr,num){\n if(num > arr.length){\n return null;\n }\n\n var max = -Infinity\n\n for(let i=0; i < arr.length - num + 1; i++){\n temp = 0;\n for(let j=0; j < num; j++){\n //j < num means we want to look ahead by 3 elements\n temp += arr[i+j];\n }\n if(temp > max){\n max = temp;\n }\n }\n\nreturn max;\n}", "function maxSequenceSum(arr) {\n arr = arr.slice();\n var length = arr.length;\n\n for (var i = length - 2; i >= 0; i--) {\n /*eslint-disable no-loop-func*/\n arr[i] = arr[i].map(function(value, j) {\n return value + Math.max(\n arr[i + 1][j],\n arr[i + 1][j + 1]\n );\n });\n /*eslint-enable no-loop-func*/\n }\n\n return arr[0][0];\n}", "function maxSum(arr) {\n let highestSum = 0;\n let currentSum = 0;\n for (let startIndex = 0; startIndex < arr.length; startIndex++) {\n currentSum = 0;\n for (let i = startIndex; i < arr.length; i++) {\n currentSum = currentSum + arr[i];\n if (currentSum > highestSum) {\n highestSum = currentSum;\n }\n }\n //console.log(`current highest sum is ${highestSum}`);\n }\n return highestSum;\n}", "function maxSum(arr) {\n var tempSum = 0;\n var tempSum2 = 0;\n var m = 1;\n\n for (j = 0; j < arr.length; j++) {\n tempSum = tempSum + arr[j];\n }\n\n for (k = 0; k < arr.length; k++) {\n\n for (i = m; i < arr.length; i++) {\n var tempSum2 = tempSum2 + arr[i];\n }\n console.log(\"temp2\", tempSum2)\n if (tempSum2 > tempSum) {\n tempSum = tempSum2\n }\n tempSum2 = 0;\n m++\n }\n console.log(\"tempSum2\", tempSum2);\n\n return tempSum;\n}", "function naiveMaxSubArraySum(arr, num) {\n if (num > arr.length) return null;\n\n let max = -Infinity,\n temp;\n\n for (let i = 0; i < arr.length - num + 1; i++) {\n temp = 0;\n\n for (let j = 0; j < num; j++) {\n temp += arr[i + j];\n }\n\n if (temp > max) max = temp;\n }\n\n return max;\n}", "function maxLeftSubarraySum(arr, size, sumArr) {\n\n var maxSoFar = arr[0];\n var currMax = arr[0];\n sumArr[0] = maxSoFar;\n\n for (var i = 1; i < size; i++) {\n\n currMax = Math.max(arr[i], currMax + arr[i]);\n maxSoFar = Math.max(maxSoFar, currMax);\n sumArr[i] = maxSoFar;\n\n }\n\n return maxSoFar;\n\n}", "function largestSumNoAdj(array) {\r\n if (!array.length) return 0;\r\n if (array.length == 1) return array[0];\r\n const maxSums = array.slice();\r\n maxSums[1] = Math.max(array[0], array[1]);\r\n for (let i = 2; i < array.length; i++) {\r\n maxSums[i] = Math.max(maxSums[i - 1], maxSums[i - 2] + array[i]);\r\n console.log(maxSums);\r\n }\r\n return maxSums[maxSums.length - 1];\r\n}", "function arrayEnum2(array) {\n var maxSoFar = 0;\n var subLen; // Starts at 1 because 1 is the smallest subarray we can have.\n var subSum = 0;\n\n // Loop over all possible sub array sizes.\n for(subLen = 0; subLen < array.length; subLen++) {\n subSum = 0; // Reset our temporary sum container.\n\n // Loop over each possible position the sub array can occupy.\n for(var i = subLen; i < array.length; i++) {\n\n // Sum the sub array.\n subSum += array[i];\n\n // Check to see if sub array sum is larger than current largest.\n if(maxSoFar < subSum) {\n maxSoFar = subSum;\n }\n\n }\n\n }\n return maxSoFar;\n}", "function findMaxSumOfSubArray(arr, k) {\n let sum = 0;\n let currentSum = 0;\n\n for (let i = 0; i < arr.length; i++) {\n const winSize = i + k;\n let j = i + 1;\n\n currentSum = arr[i];\n\n while (j < winSize) {\n currentSum += arr[j];\n j++;\n }\n\n if (currentSum > sum) {\n sum = currentSum;\n }\n }\n\n return sum;\n}", "function maxSequence(arr) {\n if (arr.every(n => n < 0)) {return 0;}\n\n let maxSum = arr[0];\n let currentSum = maxSum;\n\n for (let i = 1; i < arr.length; i++) {\n currentSum = Math.max(currentSum + arr[i], arr[i]);\n maxSum = Math.max(maxSum, currentSum);\n }\n\n return maxSum;\n}", "function maximumSubsequence(population) {\n const length = population.length;\n let answer = population[0], sum = answer;\n for(let step = 1; step <= length; step++){\n innerLoop:\n for(let from = 0; from < length; from++){\n if((from + step) > length){\n break innerLoop;\n }\n const subPopulation = population.slice(from, from + step);\n const total = subPopulation.reduce((cummulative, current) => {\n return cummulative + current;\n }, 0);\n if(total > sum){\n sum = total;\n answer = [...subPopulation];\n }\n }\n }\n return [...answer];\n }", "function maxSum(arr) {\n if (arr.length == 0) return 0;\n var tempSum = 0;\n var tempSum2 = 0;\n\n for (j = 0; j < arr.length; j++) {\n tempSum = tempSum + arr[j];\n }\n var max = tempSum;\n for (i = 0; i < arr.length; i++) {\n tempSum2 = tempSum - arr[i];\n if (tempSum2 > max)\n max = tempSum2\n tempSum = tempSum2;\n }\n return max;\n}", "maxSubArrayConstantSpace(arr) {\n const len = arr.length;\n if(len === 0) return 0;\n\n let currentMax = arr[0];\n let max = Math.max(arr[0], 0);\n for (let i = 1; i < len; i++) {\n currentMax = Math.max(currentMax + arr[i], arr[i]);\n max = Math.max(max, currentMax);\n }\n return max;\n }", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0)\n\n var splits=A.length-1;\n var maxDiff=null;\n\n // since we are starting at max sum.\n var rightSum=0;\n var leftSum=A[0];\n for(var i=1;i<A.length;i++)\n rightSum+=A[i];\n\n for(var i=1;i<=splits;i++)\n {\n var diff=Math.abs(leftSum-rightSum);\n if(maxDiff==null || diff<maxDiff)\n maxDiff=diff;\n rightSum-=A[i];\n leftSum+=A[i];\n }\n\n return maxDiff;\n}", "function maxSubarraySumSliderWindow(arr, num) {\n\n if (arr.length < num) {\n return null;\n }\n\n let temp = 0;\n let max = 0;\n\n for (let i = 0; i < num; i++) {\n max += arr[i];\n }\n\n temp = max;\n\n for (let j = num; j < arr.length; j++) {\n\n temp = temp - arr[j - num] + arr[j];\n\n max = Math.max(temp, max);\n\n }\n\n return max;\n\n}", "function smallest_subarray_with_given_sum(s, arr) {\n // Arr.length == 0\n if (!arr.length) return 0;\n // let startWindow: the start of a subarray\n // let i: index of the current value in our Array\n \n // let arraySum : Store the overall sum of our sub array\n // let minLength : the minimum length of our subarray where arraySum >= s\n // let subLength: the length of the subarray\n // [1 ,3 ,4, 4, 7] s=5\n // TODO: Write code here\n let startWindow=0, i=0, arraySum=0, subLength=0;\n\n let minLength = Number.MAX_SAFE_INTEGER;\n const arrLength = arr.length;\n \n while( i < arrLength){\n arraySum += arr[i];\n subLength +=1; \n if (arraySum >= s){\n minLength = subLength < minLength ? subLength : minLength;\n arraySum -= arr[startWindow];\n startWindow += 1;\n subLength -= 1;\n }\n i+=1;\n }\n return subLength;\n}", "function miniMaxSum(arr) {\n // find sum for all 5 integer\n let sum = 0;\n for (let i = 0; i<arr.length; i++) {\n sum += arr[i];\n }\n // sum of 4 values = sum of 5 values less one value\n // iterate thru the array to make the sum4, and at the same time find min4sum and max4sum\n let min4Sum = sum-arr[0];\n let max4Sum = sum-arr[0];\n for (let i = 1; i<arr.length; i++) {\n if (sum-arr[i] > max4Sum) {max4Sum = sum-arr[i];}\n if (sum-arr[i] < min4Sum) {min4Sum = sum-arr[i];}\n }\n console.log(min4Sum + \" \" + max4Sum);\n}", "function largestSumNoAdj1(array) {\r\n if (!array.length) return 0;\r\n if (array.length === 1) return array[0];\r\n let max_including_last = array[1];\r\n let max_excluding_last = array[0];\r\n for (let i = 2; i < array.length; i++) {\r\n const current = Math.max(max_including_last, max_excluding_last + array[i]);\r\n max_excluding_last = max_including_last;\r\n max_including_last = current;\r\n }\r\n return max_including_last;\r\n}", "function maxSum(arr) {\n \n var max = null;\n \n function findMax(result, arr) {\n console.log(result, arr);\n //first time around result will be null\n if (result !== null) {\n //update max if current consecutive sum is greater\n //than max\n if (max === null || result > max) {\n max = result;\n }\n }\n \n if (arr.length === 0) {\n return;\n }\n \n for (var i = 0; i < arr.length; i++) {\n if (result === null) {\n result = arr[i];\n } else {\n result = result + arr[i];\n }\n var next_arr = arr.slice(i+1);\n findMax(result, next_arr);\n \n }\n }\n \n findMax(null, arr);\n console.log(max);\n \n}" ]
[ "0.86087215", "0.804534", "0.7817947", "0.77800906", "0.77481604", "0.7629411", "0.75651944", "0.7529762", "0.7519463", "0.7472336", "0.7471453", "0.7446639", "0.7392624", "0.7384808", "0.7374659", "0.73616666", "0.73517835", "0.73487926", "0.73056227", "0.72722715", "0.72620374", "0.72575057", "0.72390103", "0.7231442", "0.72246426", "0.72220474", "0.7213156", "0.72061396", "0.7191712", "0.71895146", "0.7186437", "0.71828187", "0.7174753", "0.7161172", "0.7158712", "0.7154744", "0.71528566", "0.71528196", "0.7150081", "0.7149498", "0.7149331", "0.7147295", "0.7146026", "0.71434075", "0.7141209", "0.7138004", "0.71304303", "0.7129042", "0.71262276", "0.7122336", "0.71209085", "0.71072954", "0.71064276", "0.71038634", "0.71006346", "0.7094129", "0.70707643", "0.70562476", "0.70495135", "0.70488477", "0.70439094", "0.702581", "0.702564", "0.7021279", "0.702034", "0.7019176", "0.701797", "0.7016483", "0.7012566", "0.70095235", "0.7003615", "0.70026106", "0.7001372", "0.6998298", "0.6998126", "0.6991888", "0.6980272", "0.6977191", "0.6940448", "0.6930611", "0.6926695", "0.6913084", "0.6854758", "0.684421", "0.6829957", "0.68239117", "0.68228793", "0.6804111", "0.67838144", "0.67803013", "0.6759996", "0.6757264", "0.6745895", "0.6730733", "0.67225015", "0.670968", "0.67093134", "0.66984355", "0.66819954", "0.6675722" ]
0.8231295
1
Time complexity is 0(n3) which is cubic time and cubic space. Phase II Write a new function using O(n) time and O(1) memory. Keep a running tally of the largest sum.
function largest_contiguous_subsum2(arr){ let max_so_far = arr[0]; let curr_max = arr[0]; for (i=1; i<arr.length; i++){ curr_max = Math.max(arr[i], curr_max+arr[i]); max_so_far = Math.max(max_so_far, curr_max); } return max_so_far; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maximumSumBruteForce(arr, n) {\n if (n > arr.length) return null\n let max = 0\n /**\n * [* * *] // deepest calculation\n * iterates over until the length of the array - n. [1, 2, 3, 4]\n * because we do not want to pass the end of the array we iterate to length minus the number of values we want to sum\n * first iteration\n * [1, 2, 3, 4]\n * [* * *]\n * i = 0\n *\n * inner loop iteration\n * j = 0\n * temp = 0\n * max = 0\n *\n * inner loop iteration\n * i = 0\n * j = 1\n * temp = 3\n * max = 3\n *\n * inner loop iteration\n * i = 0\n * j = 2\n * temp = 6\n * max = 6\n *\n * [1, 2, 3, 4]\n * [* * *]\n * second iteration\n * i = 1\n * inner loop iteration\n * j = 0\n * temp = 6\n * max = 6\n *\n * inner loop iteration\n * i = 1\n * j = 1\n * temp = 5\n * max = 6\n *\n * inner loop iteration\n * i = 1\n * j = 2\n * temp = 9\n * max = 9\n * return 9 because that is the greatest sum of three digits in this array\n */\n for (let i = 0; i < arr.length - n + 1; i++) {\n let temp = 0\n for (let j = 0; j < n; j++) {\n temp += arr[i + j]\n }\n if (temp > max) {\n max = temp\n }\n }\n return max\n}", "function LargestSum() {\n\tvar test = [1, 3, -5, 23, -11, 6, 37, 21, -31, 10, 9, 19];\n\n\tfunction dpLargeSum(collection) {\n\t\tvar largest = [];\n\t\tlargest[0] = collection[0];\n\t\t// var lastIndex = 0;\n\t\tfor (var i = 1; i < collection.length; i++) {\n\t\t\t// largest[i] represents the largest sum for sub sequence ending with collection[i]\n\t\t\t// largest[i] does not mean the largest sum for the first i items (which could make things much more complicated)\n\t\t\tlargest[i] = largest[i - 1] + collection[i] > collection[i] ? largest[i - 1] + collection[i] : collection[i];\n\t\t}\n\t\tconsole.log(largest);\n\t\treturn max(largest);\n\t}\n\n\tfunction max(collection) {\n\t\tvar maxVal = collection[0];\n\t\tcollection.forEach((item) => {\n\t\t\tif (item > maxVal) {\n\t\t\t\tmaxVal = item;\n\t\t\t}\n\t\t});\n\t\treturn maxVal;\n\t}\n\n\tfunction bruteForce(collection) {\n\t\tvar sum = 0;\n\t\tvar max = 0;\n\t\t// starting index\n\t\tfor (var i = 0; i < collection.length; i++) {\n\t\t\t// define the length of this loop\n\t\t\tfor (var j = 0; j < collection.length - i; j++) {\n\t\t\t\t// starting index to index + length\n\t\t\t\tfor (var k = i; k < j + i + 1; k++) {\n\t\t\t\t\tsum += collection[k]\n\t\t\t\t}\n\t\t\t\tif (sum > max) {\n\t\t\t\t\tmax = sum;\n\t\t\t\t}\n\t\t\t\tsum = 0;\n\t\t\t}\n\t\t}\n\t\treturn max;\n\t}\n\n\tconsole.log(dpLargeSum(test));\n\tconsole.log(bruteForce(test));\n}", "function maxSumOfArray(nums, n){\n // set variables for both the final sum and temp sum that will be checked each time to see which is greater\n sum = 0;\n tempSum = 0;\n // for loop to go through the indexes of the array\n for (i = 0; i < n-1; i++){\n // add the sums of consecutive numbers and assign them to the temp sum\n tempSum += nums[i];\n }\n // second for loop to check tempSum against Sum and return the higher value\n for( i = n - 1; i < nums.length; i++){\n // sum of \n tempSum += nums[i];\n // checks the values of tempSum and sum and sets the higher value to sum\n if (tempSum > sum){\n // sets higher value to sum\n sum = tempSum;\n }\n \n tempSum -= numfs[i-n+1]\n }\n return sum;\n}", "function largestSum(arr){\n let currentSum = 0;\n let oldSum = 0;\n let highest\n for (let i=0;i<arr.length; i++){\n currentSum+= arr[i]\n if (currentSum > oldSum) {\n highest = currentSum\n oldSum = currentSum;\n }\n }\n return highest\n }", "function maxSubArraySum(arr, n){ // O(n^2) // naive solution\r\n let maxSum = 0;\r\n for(let i = 0; i < arr.length - n + 1; i++){ // O(n)\r\n let temp = 0;\r\n for(let j = 0; j < n; j++){ // nested O(n)\r\n temp += arr[i + j];\r\n }\r\n if(temp > maxSum){\r\n maxSum = temp;\r\n }\r\n }\r\n return maxSum;\r\n}", "function largestSum(arr){\n let result = 0, currentResult = 0;\n\n for (let i = 0; i < arr.length; i += 1) {\n currentResult += arr[i];\n if (currentResult < 0) currentResult = 0;\n if (currentResult > result) result = currentResult;\n }\n\n return result;\n}", "function maxSubarraySum3(arr, num) {\n if (arr.length < num) return null;\n let maxSum = 0;\n let tempSum = 0;\n\n for (let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for (let i = 0; i < arr.length; i++) {\n tempSum = tempSum - arr[i] + arr[i + num];\n if (tempSum > maxSum) maxSum = tempSum;\n }\n\n return maxSum;\n}", "function maxSum(arr) {\n var tempSum = 0;\n var tempSum2 = 0;\n var m = 1;\n\n for (j = 0; j < arr.length; j++) {\n tempSum = tempSum + arr[j];\n }\n\n for (k = 0; k < arr.length; k++) {\n\n for (i = m; i < arr.length; i++) {\n var tempSum2 = tempSum2 + arr[i];\n }\n console.log(\"temp2\", tempSum2)\n if (tempSum2 > tempSum) {\n tempSum = tempSum2\n }\n tempSum2 = 0;\n m++\n }\n console.log(\"tempSum2\", tempSum2);\n\n return tempSum;\n}", "function largestSubarraySum(array){\n\n let target = 0;\n let reversedArray = [...array].reverse();\n const reducer = (accumulator, currentValue) => accumulator + currentValue;\n\n\tfor (let i = 0; i < array.length - 1; i++){\n const slicedArray = array.slice(i);\n const slicedReversedArray = reversedArray.slice(i);\n\n const arr1Sum = slicedArray.reduce(reducer);\n const arr2Sum = slicedReversedArray.reduce(reducer);\n\n const arr3Sum = slicedArray.slice(0, -1).reduce(reducer);\n const arr4Sum = slicedReversedArray.slice(0, -1).reduce(reducer);\n\n target < arr1Sum ? target = arr1Sum : undefined;\n target < arr2Sum ? target = arr2Sum : undefined;\n\n target < arr3Sum ? target = arr3Sum : undefined;\n target < arr4Sum ? target = arr4Sum : undefined;\n\n }\n return target;\n}", "function maxSubarraySum2(arr, n) {\n if (arr.length < n) return null;\n let max = 0;\n let temp = 0;\n\n for (let i = 0; i < n; i++) {\n max += arr[i];\n }\n\n t = max;\n\n for (let i = n; i < arr.length; i++) {\n t = t - arr[i - n] + arr[i];\n max = Math.max(max, t);\n }\n\n return max;\n\n}", "function maxSum(arr) {\n if (arr.length < 2) throw new Error('array must have at least 2 numbers');\n\n let max = arr[0] + arr[1];\n\n /**\n * O(n^2)\n */\n\n /* n times */\n for (let i = 0; i < arr.length; i++) {\n let sum = arr[i];\n /* n - i times */\n for (let j = i + 1; j < arr.length; j++) {\n sum += arr[j];\n if (sum > max) max = sum;\n }\n\n\n return max;\n }\n}", "function main() {\n var t = parseInt(readLine());\n for(var a0 = 0; a0 < t; a0++){\n var n = parseInt(readLine());\n\n\n\n var biggest = [0,0];\n\n for(var i=0; i<n; i++){\n var acc=[0,0];\n if ((n-i)%5===0 && i%3===0){\n acc =[i,n-i];\n }\n\n if((n-i)%3===0 && i%5===0){\n acc =[n-i,i];\n }\n\n if(acc[0]>biggest[0]){\n biggest = acc;\n } else if(acc[1]>biggest[1]){\n biggest = acc;\n }\n\n }\n\n\n var ans=0;\n for(var j=0; j<biggest[1]; j++){\n ans+= (Math.pow(10,j) *3);\n }\n for(var j=biggest[1]; j<biggest[1]+ biggest[0]; j++){\n ans+= (Math.pow(10,j) *5);\n }\n\n if(biggest[0]===0 && biggest[1]===0){\n console.log(-1);\n } else {\n console.log(ans);\n }\n }\n}", "function solution(N, A) {\r\n // write your code in JavaScript (Node.js 8.9.4)\r\n\tlet counters = new Array(N).fill(0);\r\n\tlet maxNum = 0;\r\n\tlet lastMaxNum = 0;\r\n\t\r\n\tA.forEach(item => {\r\n\t\tif (item <= N) {\r\n\t\t\tif (counters[item - 1] < lastMaxNum) {\r\n\t\t\t\tcounters[item - 1] = lastMaxNum;\r\n\t\t\t}\r\n\t\t\tcounters[item - 1]++;\r\n\t\t\t\r\n\t\t\tif (counters[item - 1] > maxNum) {\r\n\t\t\t\tmaxNum = counters[item - 1];\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlastMaxNum = maxNum;\r\n\t\t}\r\n\t});\r\n\t\r\n\tfor (const i in counters) {\r\n\t\tif (counters[i] < lastMaxNum) {\r\n\t\t\tcounters[i] = lastMaxNum;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn counters;\r\n}", "function largestSumNoAdj(array) {\r\n if (!array.length) return 0;\r\n if (array.length == 1) return array[0];\r\n const maxSums = array.slice();\r\n maxSums[1] = Math.max(array[0], array[1]);\r\n for (let i = 2; i < array.length; i++) {\r\n maxSums[i] = Math.max(maxSums[i - 1], maxSums[i - 2] + array[i]);\r\n console.log(maxSums);\r\n }\r\n return maxSums[maxSums.length - 1];\r\n}", "function maxSum(arr){\n if (arr.length === 1){\n return arr[0];\n }\n let sum = 0;\n let tempArr = arr;\n for (let j =0; j< arr.length; j++){\n let temp = 0;\n for (let i=0;i<tempArr.length;i++){\n temp += tempArr[i];\n if (temp > sum){\n sum = temp;\n }\n }\n tempArr.shift();\n }\n return sum;\n}", "function getMaxSubSum(arr) { \n let max=0;\n for (let i=0; i<arr.length; i++) {\n let sumStart = 0;\n for (let j=i; j<arr.length; j++) {\n sumStart += arr[j];\n max = Math.max(sumStart, max);\n }\n } \n return max;\n} // O(n^2)", "function solution3(n) {\n if (n <= 1) {\n return 0;\n }\n\n if (n === 2) {\n return 1;\n }\n\n let lastTwo = [0, 1];\n let counter = 3;\n\n while(counter <= n) {\n let nextFib = lastTwo[0] + lastTwo[1];\n lastTwo[0] = lastTwo[1];\n lastTwo[1] = nextFib;\n\n counter++;\n }\n\n return lastTwo[1];\n}", "function maxSum(arr) {\n let highestSum = 0;\n let currentSum = 0;\n for (let startIndex = 0; startIndex < arr.length; startIndex++) {\n currentSum = 0;\n for (let i = startIndex; i < arr.length; i++) {\n currentSum = currentSum + arr[i];\n if (currentSum > highestSum) {\n highestSum = currentSum;\n }\n }\n //console.log(`current highest sum is ${highestSum}`);\n }\n return highestSum;\n}", "function MaximumProductOfThree(array) {\n let temp;\n for (let i = 0; i < array.length; i++) {\n for (let j = i; j < array.length; j++) {\n if (array[i] > array[j]) {\n temp = array[j];\n array[j] = array[i];\n array[i] = temp;\n }\n }\n }\n return (\n array[array.length - 1] * array[array.length - 2] * array[array.length - 3]\n );\n}", "function solution(N, A) {\n // write your code in JavaScript (Node.js 8.9.4)\n const counters = Array(N + 1).fill(0);\n let max = 0;\n let prevmax = 0;\n for (let i = 0; i < A.length; i++) {\n const op = A[i];\n if (op >= 1 && op <= N) {\n counters[op]++;\n max = Math.max(counters[op], max);\n // max;\n } else if (op === N + 1) {\n if (max !== prevmax) {\n prevmax = max;\n counters.fill(max);\n }\n // counters\n }\n }\n return counters.splice(1);\n}", "function maxSum(arr) {\n if (arr.length == 0) return 0;\n var tempSum = 0;\n var tempSum2 = 0;\n\n for (j = 0; j < arr.length; j++) {\n tempSum = tempSum + arr[j];\n }\n var max = tempSum;\n for (i = 0; i < arr.length; i++) {\n tempSum2 = tempSum - arr[i];\n if (tempSum2 > max)\n max = tempSum2\n tempSum = tempSum2;\n }\n return max;\n}", "function getMaxSum(array) {\n let result = 0;\n for (let i = 1; i < array.length-1; i++) {\n for (let j = 1; j < array[i].length-1; j++) {\n if (array[i-1][j-1] !== undefined && array[i+1][j+1] !== undefined && array[i-1][j+1] !== undefined && array[i+1][j-1] !== undefined){\n let sum = array[i][j] + array[i-1][j-1] + array[i-1][j] + array[i-1][j+1] + array[i+1][j-1] + array[i+1][j] + array[i+1][j+1];\n if (sum > result) { result = sum; }\n }\n }\n }\n return result;\n}", "function threeNumberSum(array, targetSum) {\n array.sort((a,b)=>a-b); //0 (nlog n)\n //3rd+2nd=targetSum-1st\n //b+c=t-a\n let answerArray=[]\n let possibleCombos=[]\n\n \n\n for(let i=0;i<array.length-2;i++){\n let firstValue=array[i],secondValue=i+1,thirdValue=array.length-1\n \n while(secondValue<thirdValue){\n possibleCombos.push([firstValue,array[secondValue],array[thirdValue]])\n if(targetSum===firstValue+array[secondValue]+array[thirdValue]){\n answerArray.push([firstValue,array[secondValue],array[thirdValue]])\n secondValue++\n thirdValue--\n } \n else if(firstValue+array[secondValue]+array[thirdValue]>targetSum){\n thirdValue--\n }else{\n secondValue++\n }\n }\n // possibleCombos.push('done',i)\n }\n console.log(possibleCombos)\n return answerArray;\n }", "function solution(a) { // O(N)\n let max1; // O(1)\n let max2; // O(1)\n\n for (let value of a) { // O(N)\n if (!max1) { // O(1)\n max1 = value; // O(1)\n } else if (value > max1) { // O(1)\n max2 = max1; // O(1)\n max1 = value; // O(1)\n } else if (value < max1) { // O(1)\n if (!max2) { // O(1)\n max2 = value; // O(1)\n } else if (value > max2) { // O(1)\n max2 = value; // O(1)\n }\n }\n }\n\n return max2; // O(1)\n}", "function maxSubArraySum(arr, n) {\n let maxSum = 0;\n let tempSum = 0;\n\n if(arr.length < num) return null;\n\n //get the sum of n numbers\n for(let i = 0; i < arr.length; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for(let i = num; i < arr.length; i++) {\n //[2, 4, 1, 4, 1, 5, 1, 5]\n // s -tempsum- e\n let startOfWindow = arr[i - num];\n let endOfWindow = arr[i];\n tempSum = tempSum - startOfWindow + endOfWindow;\n maxSum = Math.max(tempSum, maxSum)\n }\n\n return maxSum;\n}", "function maxSubarraySum(arr, n) {\n let maxSum = 0;\n let tempSum = 0;\n if (arr.length < n) return null;\n for (let i = 0; i < n; i++) {\n maxSum += arr[i];\n }\n tempSum = maxSum;\n for (let i = n; i < arr.length; i++) {\n tempSum = tempSum + arr[i] - arr[i - n];\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function main() {\n var n_temp = readLine().split(' ');\n var n = parseInt(n_temp[0]);\n var m = parseInt(n_temp[1]);\n \n var res = [];\n var sum = 0;\n var max = 0;\n \n for (var i = 0; i < n; i++) {\n res.push(0);\n }\n \n for(var a0 = 0; a0 < m; a0++){\n var a_temp = readLine().split(' ');\n var a = parseInt(a_temp[0]);\n var b = parseInt(a_temp[1]);\n var k = parseInt(a_temp[2]);\n \n res[a-1] += k;\n if(b<n) res[b] -= k;\n }\n \n for (var i = 0; i < n; i++) {\n sum += res[i];\n if(max < sum) max = sum;\n }\n console.log(max);\n}", "function maxSubarraySum(arr, n){\n if(n > arr.length) return null\n let sum = 0\n for (let i=0; i<n; i++){\n sum += arr[i]\n }\n let maxSum = sum\n\n for(let j=n; j<arr.length; j++){\n sum = sum + arr[j] - arr[j-n]\n maxSum = Math.max(maxSum, sum)\n }\n return maxSum\n}", "function solution (arr) {\n\t// if input has length of 1\n\tif ( arr.length === 1 ) {\n\t\t// return -1\n\t\treturn -1; \n\t}\n\t// make a store\n\tlet store = {};\n\t// make a max\n\tlet max=0;\n\t// iterate th input\n\tfor ( let i = 0; i < arr.length; i ++ ) {\n\t\t// put every value into store\n\t\tstore[arr[i]]= true;\n\t}\n\t// iterate th input again\n\tfor ( let j = 0; j < arr.length; j++ ) {\n\t\t// for every value P\n\t\tlet P = arr[j];\n\t\t\t// for every suprior value Q\n\t\t\tfor (let k = j+1; k < arr.length; k++ ) {\n\t\t\t\tlet Q = arr[k];\n\t\t\t// if abs P - Q is bigger than max\n\t\t\t\tif ( Math.abs( P - Q) > max ) {\n\t\t\t\t\t// make an ongoing run\n\t\t\t\t\tlet ongoingRun = 0\t\n\t\t\t\t\t// get max value btw P and Q\n\t\t\t\t\tconst maxVal = P > Q ? P : Q;\n\t\t\t\t\tconst minVal = P < Q ? P : Q;\n\t\t\t\t\t// go from max to min decrementing 1 (inter value)\n\t\t\t\t\tfor ( let interValue = maxVal-1; interValue >= minVal; interValue -=1 ) {\n\n\t\t\t\t\t\tongoingRun++;\n\t\t\t\t\t\t// if loop has finished : adajcent found\n\t\t\t\t\t\tif ( interValue === minVal ) {\n\t\t\t\t\t\t\t// if ongoing run is bigger than max\n\t\t\t\t\t\t\t// max = ongoing run\n\t\t\t\t\t\t\tmax = max >= ongoingRun ? max : ongoingRun\n\t\t\t\t\t\t\t// exit\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\t// if inter value is in store\n\t\t\t\t\t\tif ( store[interValue] === true ) {\n\t\t\t\t\t\t\t// ongoing run = 0\n\t\t\t\t\t\t\tongoingRun=0;\n\t\t\t\t\t\t\t// break\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t}\t\t\n\t\t\t}\t\t\n\t}\n\t// return max\n\treturn max;\n}", "function addto(arr,num){\n if(arr.length < num){\n return null;\n }\n let tempSum = 0;\n let maxSum = 0;\n for(let i = 0; i<num ; i++){\n maxSum += arr[i];\n }\n \ntempSum = maxSum;\n for(let i = num;i<arr.length;i++){\n \n tempSum = tempSum - arr[i-num] + arr[i]; //8+arr[2]-arr[2-2] === 8+0-7\n maxSum = Math.max(tempSum,maxSum);\n console.log(maxSum)\n }\n return maxSum;\n}", "function solution(N, A) {\n // write your code in JavaScript (Node.js 8.9.4)\n let counters = new Array(N).fill(0);\n let max = 0;\n let tmp = 0;\n\n for (let v of A) {\n if (v <= N) {\n let idx = v - 1;\n\n counters[idx] = Math.max(counters[idx], max);\n counters[idx] += 1;\n tmp = Math.max(counters[idx], tmp);\n } else {\n max = tmp;\n }\n }\n\n return counters.map((v) => {\n return Math.max(v, max);\n })\n}", "function solution(A) {\n \n let maxEnding = [];\n maxEnding.push(0);\n \n let maxBeginning = [];\n maxBeginning[A.length-1] = 0\n \n for (let i = 1; i < A.length-2; i++){\n maxEnding[i] = Math.max(0, maxEnding[i-1]+A[i]);\n }\n \n for (let i = A.length-2; i >= 2; i--){\n maxBeginning[i] = Math.max(0, maxBeginning[i+1]+A[i]);\n }\n \n let maxSum = 0;\n for (let i = 0; i < A.length-2; i++){\n let sum = maxEnding[i] + maxBeginning[i+2];\n if (sum > maxSum){\n maxSum = sum;\n }\n }\n \n return maxSum;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0) \n let len =A.length;\n if(len==3) return A[0]*A[1]*A[2];\n let sortedA = A.sort((a,b)=>{return a-b});\n let zeroThree=A[len-1]*A[len-2]*A[len-3];\n let twoOne=A[0]*A[1]*A[len-1];\n //if A has more than two negative numbers, the result will always be positive;\n if(A[0]<0 && A[1]<0) {\n return Math.max(twoOne, zeroThree);\n } else {\n //if A has no more than one negative numbers, the result will always be the product of the largest three; \n return zeroThree\n }\n}", "function sum(numArr) {\n //keep track of highest sum\n let highestSum = 0;\n\n for (let i = 0; i < numArr.length; i++) {\n for (let j = i; j < numArr.length; j++) {\n let sum = 0;\n for (let k = i; k <= j; k++) {\n sum = sum + numArr[k];\n }\n if (sum > highestSum) {\n highestSum = sum;\n }\n }\n }\n return highestSum;\n}", "function findHighestSpending(input, n, k) {\n if (n < k) {\n console.error(\"Error: n must be greater than k\");\n return -1;\n }\n\n // Find sum of first subarray of size k \n var highestSpending = 0;\n for (var i = 0; i < k; i++) {\n highestSpending += input[i];\n }\n\n // Create temporary variable to store total number on each slide \n var window_sum = highestSpending;\n // Slide along the array by adding the next value, while removing the last value\n for (var i = k; i < input.length; i++) {\n window_sum += input[i] - input[i - k];\n highestSpending = Math.max(highestSpending, window_sum);\n }\n return highestSpending;\n}", "function isSumPossible3(a, n) {\n var iMdone = 0,\n len = a.length,\n cursorR, cursorL,\n arr, compareFn;\n\n if (len < 2) {\n return iMdone;\n }\n if (len === 2) {\n return a[0]+a[1] === n ? 1 : 0;\n }\n \n var compareFn = function compare(a, b) {\n if (a > b) {\n return -1;\n }\n if (a < b) {\n return 1;\n }\n return 0;\n }\n \n arr = a.sort(compareFn);\n cursorL = 0;\n cursorR = len-1;\n \n while (cursorL < cursorR) {\n if (arr[cursorL] > n) {\n cursorL += 1;\n continue;\n }\n if (arr[cursorL] + arr[cursorR] === n) {\n iMdone = 1;\n break;\n } else if (arr[cursorL] + arr[cursorR] > n) {\n cursorL += 1;\n } else {\n cursorR -= 1;\n }\n }\n\n return iMdone; \n }", "function largestSumNoAdj1(array) {\r\n if (!array.length) return 0;\r\n if (array.length === 1) return array[0];\r\n let max_including_last = array[1];\r\n let max_excluding_last = array[0];\r\n for (let i = 2; i < array.length; i++) {\r\n const current = Math.max(max_including_last, max_excluding_last + array[i]);\r\n max_excluding_last = max_including_last;\r\n max_including_last = current;\r\n }\r\n return max_including_last;\r\n}", "function maxSubarraySum(arr, n) {\n\n if (n > arr.length) return null;\n\n let max = -Infinity;\n\n for (var i = 0; i < arr.length - n + 1; i++) {\n\n let temp = 0;\n for (var j = 0; j < n; j++) {\n temp += arr[i + j];\n }\n\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function largestPairSum(numbers) {\n var largestSum = -1000;\n // loop through twice\n for (let i = 0; i < numbers.length; i++) {\n for (let j = 0; j < numbers.length; j++) {\n // if i and j are not the same number and larger than largestSum\n if (i != j && numbers[i] + numbers[j] > largestSum) {\n largestSum = numbers[i] + numbers[j];\n // make largest sum i+j\n }\n }\n }\n return largestSum;\n}", "function maxSubArraySum(arr, num) {\n if(num > arr.length) {\n return null;\n }\n let max = -Infinity;\n for(let i=0;i<arr.length-num+1;i++) {\n let temp = 0;\n for(let j=0;j<num;j++) {\n temp += arr[i+j] //sum of three consuctive number and next number\n }\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n }", "function largest_contiguous_subsum1(arr){\n let arrays = [];\n for (let i=0; i<arr.length; i++){\n for (let k=i; k<arr.length; k++){\n let array = [];\n for (let j=i; j<=k; j++){\n array.push(arr[j]);\n }\n let sum = array.reduce((a,b) => a+b);\n arrays.push(sum);\n }\n }\n return Math.max(...arrays);\n }", "function largestSum(numberArray,k){\n if(k===1){\n return productOfEntries(numberArray);\n }\n for(let i=1;i<=numberArray.length-k+1;i++){\n return productOfEntries(numberArray.slice(0,i))+largestSum(numberArray.slice(i),k-1);\n }\n}", "function solution(A) {\n let len = A.length;\n let storage = {};\n let maxEl = 0, maxCount = 0;\n\n if (len === 0) {\n return -1;\n }\n\n if (len === 1) {\n return 0;\n }\n\n // Solution\n // we used an object(storage) to save every total count of each different number\n // maxEl is used to save element which has highest number so far\n // e.g array A [3, 4, 3, -1, 3] \n // loop 1: storage { '3' : [0] }, maxEl = 3\n // loop 2: storage { '3' : [0], '4' : [1] }, maxEl = 3\n // loop 3: storage { '3' : [0, 2], '4' : [1] }, maxEl = 3\n // loop 4: storage { '3' : [0, 2], '4' : [1], '-1' : [3] }, maxEl = 3\n // loop 5: storage { '3' : [0, 2, 4], '4' : [1], '-1' : [3] }, maxEl = 3\n // check if max element's count over half of array then return max element array index\n // if not then return -1\n // in this case we should return [0, 2, 4]\n\n for (let i = 0; i < len; i++) {\n let el = A[i];\n\n if (storage[el] === undefined) {\n storage[el] = [];\n storage[el].push(i);\n } else {\n storage[el].push(i);\n }\n\n if (storage[el].length > maxCount) {\n maxEl = el;\n maxCount = storage[el].length;\n }\n }\n\n // If every element has equal count , e.g [1, 2, 3] or [-1, -2, 1]\n if (maxCount === 1) {\n return -1;\n }\n\n // Check if max element's count over half array or not\n if (storage[maxEl].length / len <= 0.5) {\n return -1;\n }\n\n return storage[maxEl][0];\n}", "function max_sum_refratored(arr, n) {\n\tif (n > arr.length) return null;\n\n\tlet maxSum = 0;\n\tlet tempSum = 0;\n\t// Iterate one time to get the main \"window\"\n\tfor (let i = 0; i < n; i++) {\n\t\tmaxSum += arr[i];\n\t}\n\t// Starter window size\n\ttempSum = maxSum;\n\t// Sliding Window Algorithm \"movement\"\n\tfor (let i = n; i < arr.length; i++) {\n\t\ttempSum = tempSum - arr[i - n] + arr[i];\n\n\t\t// Update maxSum\n\t\tif (tempSum > maxSum) {\n\t\t\tmaxSum = tempSum;\n\t\t}\n\t}\n\treturn maxSum;\n}", "function highestProductOf3_3(arr) {\n\tif (!arguments.length && !Array.isArray(arr))\n\t\tthrow new Error('Expecting an array to be passed as an argument');\n\t\n\tvar maxValues = [];\n\tfor (var i = 0, len = arr.length; i < len; i++) {\n\t\tif (!maxValues.length || maxValues.length < 3) {\n\t\t\tmaxValues.push(arr[i]);\n\t\t}\n\t\t\n\t\tif (maxValues.length && maxValues.length === 3) {\n\t\t\tvar m = Math.max.apply(Math, maxValues);\n\t\t\tif (arr[i] > m) {\n\t\t\t\tvar idx = maxValues.indexOf(m);\n\t\t\t\tmaxValues.splice(idx, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar res = 1;\n\tfor (var j = 0; j < maxValues.length; j++)\n\t\tres *= maxValues[j];\n\treturn res;\n}", "function largestProductOfThree() {\n\t// YOUR CODE HERE\n\t// find the largest 3 numbers in the array because the largest three numbers will give the largest product.\n\t// find the largest number then remove it.\n\t// in the new array find the largets number and remove it.\n\t// in the new array find the largest number and remove it.\n\t// after saving all three numbers multiply them and return the result.\n}", "function integerRightTriangles(n) {\n var sum = n;\n var a, b, c;\n var count = 0,\n maxCount = 0,\n maxSum = 0;\n for(sum = 1; sum <= n; sum++) {\n count = 0;\n //only search the case a < b < c\n for(c = Math.ceil(sum/3); c < sum/2; c++) {\n for(b = Math.ceil((sum - c)/2); b < c; b++) {\n a = sum - c - b;\n if(a*a + b*b - c*c === 0) {\n count++;\n }\n }\n }\n if(count > maxCount) {\n maxCount = count;\n maxSum = sum;\n }\n }\n return maxSum;\n}", "function powerfulDigitSum(n) {\n var maxSum = 0;\n var a, b, sum;\n var bigInt;\n for (i = 2; i < n; i++) {\n bigInt = bigInteger(i);\n for (j = 1; j < n; j++) {\n sum = bigInt.sum();\n if (sum > maxSum) {\n maxSum = sum;\n }\n bigInt.multiply(i);\n }\n }\n return maxSum;\n}", "function findMaxSum(a) {\n let splitIntoIndependentSequences = a => {\n let seqs = [];\n let currentSeq = [];\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] > 0) {\n currentSeq.push(a[i]);\n } else {\n if (currentSeq.length > 0) {\n seqs.push(currentSeq);\n }\n\n currentSeq = [];\n }\n }\n\n if (currentSeq.length > 0) {\n seqs.push(currentSeq);\n }\n\n return seqs;\n }\n\n let findMaxSumHelper = a => {\n // this function assumes that none of the values in a are < 1\n\n if (a.length === 0) {\n return 0;\n }\n\n if (a.length === 1) {\n return a[0];\n }\n\n if (a.length === 2) {\n return Math.max(a[0], a[1]);\n }\n\n return Math.max(\n findMaxSumHelper(a.slice(1)),\n a[0] + findMaxSumHelper(a.slice(2))\n );\n }\n\n let seqs = splitIntoIndependentSequences(a);\n let sum = 0;\n\n for (let i = 0; i < seqs.length; i++) {\n sum += findMaxSumHelper(seqs[i]);\n }\n\n return sum;\n}", "function lcs(n) {\n var startSum = 0;\n var largestSum = n[0];\n\n for (var i = 0; i < n.length; i++) {\n\n startSum += n[i];\n if (startSum < 0) {\n startSum = 0;\n }\n\n if (largestSum < startSum) {\n largestSum = startSum;\n }\n }\n return largestSum;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n let maxK1 = [];\n let maxK2 = [];\n maxK1[0] = maxK2[0] = 0;\n maxK1[A.length - 1] = maxK2[A.length - 1] = 0;\n for (let i = 1; i < A.length; i++) {\n if (i < A.length - 1) {\n maxK1[i] = Math.max(maxK1[i - 1] + A[i], 0);\n }\n let j = A.length - i;\n if (j < A.length - 1) {\n maxK2[j] = Math.max(maxK2[j + 1] + A[j], 0);\n }\n }\n let max = 0;\n for (let i = 1; i < A.length - 1; i++) {\n max = Math.max(max, maxK1[i-1] + maxK2[i+1]);\n }\n return max;\n}", "function maxSumOfKConsecutive2(n, array, k) {\n\tlet max_sum = -Infinity;\n\tlet sum = 0;\n\n\tfor (let i = 0; i < k; i++) {\n\t\tsum += array[i];\n\t}\n\n\tfor (let i = k; i < n; i++) {\n\t\tsum = sum - array[i - k] + array[i];\n\t\tmax_sum = Math.max(max_sum, sum);\n\t}\n\treturn max_sum;\n}", "function maxSub(arr,num){\n if(num > arr.length){\n return null;\n }\n\n var max = -Infinity\n\n for(let i=0; i < arr.length - num + 1; i++){\n temp = 0;\n for(let j=0; j < num; j++){\n //j < num means we want to look ahead by 3 elements\n temp += arr[i+j];\n }\n if(temp > max){\n max = temp;\n }\n }\n\nreturn max;\n}", "function maxNum(arr, k) {\n if (k > arr.length)\n return -1;\n let max = 0;\n for (let i = 0; i < arr.length - k + 1; i++) {\n let s = 0;\n for (let j = 0; j < k; j++) {\n s += arr[i + j];\n }\n if (!max)\n max = s;\n else if (s > max)\n max = s;\n }\n // console.log(max)\n return max;\n}", "function arrayMaxConsecutiveSum(array, n) {\n let sum = 0\n let max = 0\n for (let index = 0; index < n; index++) {\n sum += array[index]\n }\n max = sum\n for (let index = n; index < array.length; index++) {\n sum = array[index] + sum - array[index - n]\n if (sum > max) {\n max = sum\n }\n }\n return max\n}", "function maxSubarraySum1(arr, n) {\n if (arr[1] === undefined) return null;\n let max = -Infinity;\n let total = 0;\n\n for (let i = 0; i <= arr.length - n; i++) {\n total = 0;\n for (let j = 0; j < n; j++) {\n total += arr[i + j];\n }\n if (max < total) max = total;\n }\n\n return max;\n}", "function kadaneAlgo(nums) {\n let currSum = nums[0], maxSum = nums[0];\n\n for (let i = 1; i < nums.length; i++) {\n if (currSum < 0) currSum = 0;\n currSum = currSum + nums[i];\n maxSum = Math.max(currSum, maxSum);\n }\n return maxSum;\n }", "function maxSubArraySumNaive(arr, num) {\n if(num > arr.length) return null;\n\n let max = -Infinity;\n\n for (let i = 0; i < arr.length -num + 1; i++) {\n temp = 0;\n for(let j = 0; j < num; j++) {\n temp += arr[i + j];\n }\n // console.log(temp, max)\n if(temp > max) max = temp;\n }\n return max;\n}", "function maxSumIncreasingSubsequence(array) {\n\tlet map = new Map();\n\tfor (let i = 0; i < array.length; i++) {\n\t\tlet curr = array[i];\n\t\tmap.set(curr, []);\n\t\tfor (let j = i + 1; j < array.length; j++) {\n\t\t\tif (array[j] > curr) {\n\t\t\t\tmap.get(curr).push(array[j]);\n\t\t\t}\n\t\t}\n\t}\n\tlet max = -Infinity;\n\tlet vals = [];\n\tlet large = [];\n\tfor (let [key, value] of map) {\n\t\tvals = [];\n\t\tlet sum = key;\n\t\tlet prev = key;\n\t\tvals.push(key);\n\t\tfor (let val of value) {\n\t\t\tif (val > prev) {\n\t\t\t\tsum += val;\n\t\t\t\tprev = val;\n\t\t\t\tvals.push(val);\n\t\t\t} else {\n\t\t\t\twhile (vals[vals.length - 1] >= val) {\n\t\t\t\t\tsum -= vals.pop();\n\t\t\t\t}\n\t\t\t\tvals.push(val);\n\t\t\t\tsum += val;\n\t\t\t\tprev = val;\n\t\t\t}\n\t\t\tif (max < sum) {\n\t\t\t\tmax = sum;\n\t\t\t\tlarge = vals.slice();\n\t\t\t}\n\t\t}\n\t\tif (max < sum) {\n\t\t\tmax = sum;\n\t\t\tlarge = vals.slice();\n\t\t}\n\t}\n\treturn [max, large];\n}", "function threeSum(arr){\n if(arr.length < 3) return [] \n var sortedArr = sort(arr)\n var output = {}\n for(var i = 0; i < sortedArr.length; i++){\n var target = 0 - sortedArr[i]\n //Optimization if the current num was same as the last one, we do not need.\n if (i == 0 || (i > 0 && sortedArr[i] != sortedArr[i-1])) {\n twoSums = twoSumInSortedArr(sortedArr, target, i+1, sortedArr.length-1)\n for (var j = 0; j < twoSums.length; j++) {\n twoSums[j].push(sortedArr[i])\n storeOutput(output, twoSums[j])\n }\n }\n }\n return Object.values(output)\n}", "function largestProductOfThree (array) {\n array.sort((a, b) => a - b);\n const product = (sum, value) => (\n sum * value\n );\n const product1 = array.slice(Math.max(array.length - 3, 0)).reduce(product);\n\n // Edge Case: negative numbers\n const greatestPositive = array.reduce((greatest, value) => Math.max(greatest, value));\n const leastNegative = array.slice(0, Math.min(array.length, 2)).reduce(product);\n const product2 = leastNegative * greatestPositive;\n\n return Math.max(product1, product2);\n}", "function topSum(arr) {\n // if (arr.length === 0) return 0;\n // if (arr.length === 1) return arr[0]\n // arr.sort((a, b) => a-b)\n // return arr[0] + arr[1]\n\n //better complexity\n // Just find the two largest number and return sum of them\n let max1 = arr[0];\n let max2 = arr[1];\n if (max1 < max2) {\n max1 = arr[1];\n max2 = arr[0];\n }\n for (let i = 2; i < arr.length; i++) {\n if (max1 < arr[i]) {\n max2 = max1;\n max1 = arr[i];\n } else if (arr[i] > max2) max2 = arr[i];\n }\n return max1 + max2;\n}", "function maxSequence(arr) {\n if (arr.every(n => n < 0)) {return 0;}\n\n let currentSum = arr[0];\n \n return arr.slice(1).reduce((maxSum, n) => {\n currentSum = Math.max(currentSum + n, n);\n return maxSum = Math.max(currentSum, maxSum);\n }, currentSum);\n}", "function highestProductOf3(arrayOfNumbers) {\n if (arrayOfNumbers.length < 3) {\n throw Error(\"Less than 3 items!\");\n }\n\n // we're going to start at the 3rd item (at index 2)\n // so pre-populate highests and lowests based on the first 2 items.\n // we could also start these as null and check below if they're set\n // but this is arguably cleaner\n var highest = Math.max(arrayOfNumbers[0], arrayOfNumbers[1]);\n var lowest = Math.min(arrayOfNumbers[0], arrayOfNumbers[1]);\n\n var highestProductOf2 = arrayOfNumbers[0] * arrayOfNumbers[1];\n var lowestProductOf2 = arrayOfNumbers[0] * arrayOfNumbers[1];\n /**\n * Write code more clean\n * var highestProductOf2 = lowestProductOf2 = arrayOfNumbers[0] * arrayOfNumbers[1];\n * or just avoid repeat calculation\n * var lowestProductOf2 = highestProductOf2;\n */\n\n // except this one--we pre-populate it for the first *3* items.\n // this means in our first pass it'll check against itself, which is fine.\n var highestProductOf3 = arrayOfNumbers[0] * arrayOfNumbers[1] * arrayOfNumbers[2];\n /**\n * Instead use Number.NEGATIVE_INFINITY if i start with 2\n * var highestProductOf3 = Number.NEGATIVE_INFINITY;\n */\n\n // walk through items, starting at index 2\n for (var i = 2; i < arrayOfNumbers.length; ++i) { /** Why ++i instead of i++? */\n var current = arrayOfNumbers[i];\n\n // do we have a new highest product of 3?\n // it's either the current highest,\n // or the current times the highest product of two\n // or the current times the lowest product of two\n highestProductOf3 = Math.max(\n highestProductOf3,\n current * highestProductOf2,\n current * lowestProductOf2);\n /**\n * This is for Negative value? For this you can use \n * highestProductOf3 = Math.max(highestProductOf3, current ? current * highestProductOf2 : current * lowestProductOf2);\n */\n\n // do we have a new highest product of two?\n highestProductOf2 = Math.max(\n highestProductOf2,\n current * highest,\n current * lowest);\n\n // do we have a new lowest product of two?\n lowestProductOf2 = Math.min(\n lowestProductOf2,\n current * highest,\n current * lowest);\n /**\n * Again reputation and negative case. Math.min or Math.max itself do comparision inside.\n * var currentLowest = current ? current * lowest : current * highest;\n * var currentHightest = current ? current * highest : current * lowest;\n * highestProductOf2 = Math.max(highestProductOf2, currentHightest);\n * lowestProductOf2 = Math.min(highestProductOf2, currentLowest);\n */\n\n // do we have a new highest?\n highest = Math.max(highest, current);\n\n // do we have a new lowest?\n lowest = Math.min(lowest, current);\n }\n\n return highestProductOf3;\n}", "function solution3(arr) {\n let max; // -2\n let i=0; \n while(i< arr.length) {\n i++;\n if (arr[i] < 0) {\n max = arr[i];\n }\n }\n let j=0;\n while(j<arr.length) {\n j++;\n if(arr[j] < 0) {\n if (arr[j] > max) {\n max = arr[j];\n }\n } \n }\n\n console.log(max);\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0)\n\n var splits=A.length-1;\n var maxDiff=null;\n\n // since we are starting at max sum.\n var rightSum=0;\n var leftSum=A[0];\n for(var i=1;i<A.length;i++)\n rightSum+=A[i];\n\n for(var i=1;i<=splits;i++)\n {\n var diff=Math.abs(leftSum-rightSum);\n if(maxDiff==null || diff<maxDiff)\n maxDiff=diff;\n rightSum-=A[i];\n leftSum+=A[i];\n }\n\n return maxDiff;\n}", "function maxSequence(arr) {\n if (arr.every(n => n < 0)) {return 0;}\n\n let maxSum = arr[0];\n let currentSum = maxSum;\n\n for (let i = 1; i < arr.length; i++) {\n currentSum = Math.max(currentSum + arr[i], arr[i]);\n maxSum = Math.max(maxSum, currentSum);\n }\n\n return maxSum;\n}", "function maxTreeSum(high, n) {\n var result = 0;\n for (var i = 0; i < n; i++) {\n high += high;\n result += high;\n }\n return result;\n}", "function nthLargest(arr, n) {}", "function maxOfSum(arr, k) {\n var max = 0;\n for (var i = 0; i < arr.length - k + 1; i++) {\n var sum = 0;\n for (var j = i; j < i + k; j++) {\n sum += arr[j];\n }\n if (max < sum) {\n max = sum;\n }\n }\n return max;\n}", "function maxSubArraySum(arr, num) {\n\tif (arr.length < num) return null;\n\tlet max = 0;\n\tlet tempMax = 0;\n\n\tfor (let i = 0; i < num; i++) {\n\t\ttempMax += arr[i];\n\t}\n max = tempMax;\n\tfor (let i = num; i < arr.length; i++) {\n tempMax = tempMax + arr[i] - arr[i-num];\n max = Math.max(tempMax,max) \n }\n console.log(max)\n}", "function highestSum(arr) {\n let first = arr[0];\n let second = 0;\n for (let index = 1; index < arr.length; index++) {\n const el = arr[index];\n if (el > first) {\n second = first;\n first = el; \n } else if (el > second) {\n second = el;\n }\n }\n return first + second;\n}", "function largeSum(arr){\n let input = arr.sort((a,b) => {\n return b-a\n })\n output = input[0] + input[1]\n return output\n}", "function maxOfSumChain(arr,k){\n // write code here.\n let result = 0;\n let tempSum = 0;\n var i = 0;\n \n while( i < k - 1) {\n tempSum += arr[i];\n i++;\n }\n i = k - 1;\n \n while( i < arr.length ) {\n tempSum += arr[i];\n if(tempSum > result) {\n result = tempSum;\n }\n tempSum -= arr[i - k + 1];\n i++;\n }\n return result;\n }", "function sum(array){\n let max = 0;\n \n for(let i=0; i < array.length; i++){\n let total =array[i];\n for(let j=i+1; j<array.length; j++){\n total += array[j];\n if (total>max){\n max =total;\n }\n \n }\n \n }\n return max;\n}", "function solve(args){\n let N = args.shift(),\n array = args.map(Number),\n counter = 1,\n maxCounter=1;\n // console.log(array);\n // console.log(N);\n for (let i=0; i<N-1; i+=1){\n if(array[i+1] > array[i]){\n counter+=1;\n }\n \n if (array [i+1] <= array[i] && counter>1 ){\n if(counter>maxCounter){\n maxCounter=counter;\n }\n counter=1;\n }\n\n\n }\n if(counter>maxCounter){\n maxCounter=counter;\n }\n console.log(maxCounter);\n}", "function kadanesAlgorithm(array) {\n\tlet maxSum = array[0] // -2 \n\tlet currentSum = array[0] // -2 \n\tfor (let i = 1; i < array.length; i++ ) {\n\t\tcurrentSum += array[i]\n\t\tcurrentSum = Math.max(array[i], currentSum)\n\t\tmaxSum = Math.max(currentSum, maxSum) \n\t}\n\treturn maxSum\n}", "function maxSum(arr) {\n let max = 0;\n let sum = 0\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i]\n if (sum > max) {\n max = sum\n }\n }\n return max\n}", "function sol(nums, k) {\n // sum : index\n const map = {};\n map[0] = -1;\n let sum = 0;\n let maxLen = 0;\n for (let i = 0; i < nums.length; i++) {\n sum += nums[i];\n if (map[`${sum - k}`]) {\n maxLen = Math.max(maxLen, i - map[`${sum - k}`]);\n }\n if (!map[sum]) map[sum] = i;\n }\n\n return maxLen;\n}", "function runProgram(input){\n let input_arr = input.trim().split(\"\\n\")\n\n for(let i = 2; i < input_arr.length; i = i+2){\n let array = input_arr[i].trim().split(\" \").map(Number).sort((a,b) => a - b)\n \n let max = 0\n for(let k = 0; k < array.length; k++){\n let answer = 0\n let index = k\n for(let j = 0; j < array.length ; j++){\n if(j < index){\n answer += (-1 * array[j]) \n }\n else{\n answer += (array.length - j) * array[index]\n break\n }\n }\n if(max < answer){\n max = answer\n }\n }\n\n console.log(max)\n }\n}", "function maxSum(array) {\n let max = 0;\n let sum = 0;\n for (let i = 0; i < array.length; i++) {\n sum += array[i];\n if(sum > max){\n max = sum;\n }if(sum < 0){\n sum = 0;\n }\n}\nreturn max;\n}", "function maxSubArraySum(arr, num) {\n let maxSum = 0;\n let tempSum = 0;\n\n // if the array length is less than the num passed. Return null \n if (arr.length < num) return null;\n\n\n for (let i = 0; i < num; i++) {\n // the maxSum = the first # of (num) passed \n maxSum += arr[i];\n }\n\n // setting the temp sum = maxSum\n tempSum = maxSum;\n\n\n for (let i = num; i < arr.length; i++) {\n /*\n first pass is as follows: \n tempSum = 11 - (arr[3 - 3] = 2) + (arr[3] = 7) = 16\n */\n tempSum = tempSum - arr[i - num] + arr[i];\n // maxSum = the max number between tempSum and maxSum\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function hourglassSum(arr) {\n let highestSum = -100;\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n const sum = calculateSum(arr, [i,j]);\n if (sum > highestSum) {\n highestSum = sum;\n }\n }\n }\n return highestSum\n}", "function solution(N, A) {\n // N: number of counters, A: operations\n // 1. Create N length counter and set all values to 0\n // 2. Loop through an array A and check condition\n // 2-1. If A[K] = X(1 <= X <= N), increase X by 1\n // 2-2. If If A[K] = N + 1, set all counters to max\n // 3. Return counter array\n\n // let counter = Array(N).fill(0);\n let counter = Array.from(Array(N), (_) => 0);\n let maxValue = 0;\n\n for(let i = 0; i < A.length; i++) {\n if(A[i] <= N) {\n counter[A[i]-1]++;\n // maxValue = Math.max(...counter);\n maxValue = Math.max(maxValue, counter[A[i]-1]); // 💣\n } else if(A[i] === N + 1) {\n counter = Array(N).fill(maxValue);\n }\n // console.log(counter)\n }\n return counter;\n}", "function three(nums, target) {\n // store count of how many times a triplet sum is less than target number\n // sort array\n // iterate through array stopping 2 numbers before end\n}", "function maxSubsetSum(arr) {\n if (arr.length === 1)\n return arr[0];\n else if (arr.length === 2)\n return Math.max(arr[0], arr[1]);\n\n // iterationResult used to save iteration result of arr (from back)\n // index 0 means the result for the last number, index 1 means the result for the last 2 numbers, etc.\n let lastIndex = arr.length - 1;\n let iterationResult = [arr[lastIndex], Math.max(arr[lastIndex], arr[lastIndex - 1])];\n\n while (iterationResult.length !== arr.length) {\n let nextNumber = arr[arr.length - 1 - iterationResult.length];\n let lastIdx = iterationResult.length - 1, nextResult;\n nextResult = Math.max(nextNumber, nextNumber + iterationResult[lastIdx - 1], iterationResult[lastIdx]);\n iterationResult.push(nextResult);\n }\n\n return iterationResult[iterationResult.length - 1];\n}", "function maxSumIncreasingSubsequence(array) {\n\tlet maxValues = array.slice();\n\tlet indecies = new Array(array.length).fill(null);\n\tlet maxSumIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tlet currentValue = array[i];\n\t\tfor (let j = 0; j < i; j++) {\n\t\t\tlet prev = array[j];\n\t\t\tif (prev < currentValue && maxValues[j] + currentValue >= maxValues[i]) {\n\t\t\t\tmaxValues[i] = maxValues[j] + currentValue;\n\t\t\t\tindecies[i] = j;\n\t\t\t}\n\t\t}\n\t\tif (maxValues[i] >= maxValues[maxSumIdx]) {\n\t\t\tmaxSumIdx = i;\n\t\t}\n\t}\n\treturn [maxValues[maxSumIdx], buildReturnValue(array, indecies, maxSumIdx)];\n}", "function solution(A) {\r\n // write your code in JavaScript (Node.js 8.9.4)\r\n let a1 = A.map(i => 0);\r\n let a2 = A.map(i => 0);\r\n \r\n for (let i = 1, iR = A.length - 2; iR > 1; i++, iR--) {\r\n a1[i] = Math.max(A[i] + a1[i - 1], 0);\r\n a2[iR] = Math.max(A[iR] + a2[iR + 1], 0);\r\n }\r\n \r\n let maxNum = a1[0] + a2[2]; \r\n for (let i = 2; i < A.length - 1; i++) {\r\n maxNum = Math.max(a1[i - 1] + a2[i + 1], maxNum)\r\n }\r\n \r\n return maxNum;\r\n}", "function maxSubarraySum(array, number) {\n\n if (number > array.length) {\n return null;\n }\n // get the sum of the first subarray\n\n //slide through the whole array checking if a subsequence is more\n\n let maxIndexStart = 0;\n let maxSum = 0;\n let nextSum = 0;\n let currentSum = 0;\n //sum of first subarray\n for (let i = 0; i < number; i++) {\n maxSum += array[i];\n }\n\n currentSum = maxSum;\n for (let i = 0; i < array.length - number; i++) {\n nextSum = currentSum - array[i] + array[i + number]\n if (nextSum > maxSum) {\n maxIndexStart = i + 1;\n maxSum = nextSum;\n }\n currentSum = nextSum;\n\n }\n return {\n indexStart: maxIndexStart,\n sum: maxSum\n }\n}", "function maxSubArraySum(arr, num) {\n let maxSum = 0;\n let tempSum = 0;\n if(arr.length < num ) return null;\n\n for(let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n tempSum = maxSum;\n for(let i = num; i < arr.length; i++) {\n tempSum = tempSum - arr[i - num] + arr[i];\n console.log(arr[i -num]);\n maxSum = Math.max(maxSum, tempSum);\n }\n\n return maxSum;\n}", "function solution(A) {\r\n // write your code in JavaScript (Node.js 8.9.4)\r\n\tlet positiveMaxNums0 = [-1, -1, -1];\r\n\tlet positiveMaxNums1 = [-1, -1, -1];\r\n\tlet negativeMaxNums0 = [-1, -1, -1];\r\n\tlet negativeMaxNums1 = [-1, -1, -1];\r\n\tA.forEach((item, i) => {\r\n\t\tif (item >= 0) {\r\n\t\t\tif (positiveMaxNums0[2] === -1 || A[positiveMaxNums0[2]] < item) {\r\n\t\t\t\tpositiveMaxNums0[0] = positiveMaxNums0[1];\r\n\t\t\t\tpositiveMaxNums0[1] = positiveMaxNums0[2];\t\t\t\r\n\t\t\t\tpositiveMaxNums0[2] = i;\r\n\t\t\t} else if (positiveMaxNums0[1] === -1 || A[positiveMaxNums0[1]] < item){\r\n\t\t\t\tpositiveMaxNums0[0] = positiveMaxNums0[1];\r\n\t\t\t\tpositiveMaxNums0[1] = i;\r\n\t\t\t} else if (positiveMaxNums0[0] === -1 || A[positiveMaxNums0[0]] < item) {\r\n\t\t\t\tpositiveMaxNums0[0] = i;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (positiveMaxNums1[0] === -1 || A[positiveMaxNums1[0]] > item) {\r\n\t\t\t\tpositiveMaxNums1[0] = i;\r\n\t\t\t} else if (positiveMaxNums1[1] === -1 || A[positiveMaxNums1[1]] > item){\r\n\t\t\t\tpositiveMaxNums1[1] = i;\r\n\t\t\t} else if (positiveMaxNums1[2] === -1 || A[positiveMaxNums1[2]] > item) {\r\n\t\t\t\tpositiveMaxNums1[2] = i;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (negativeMaxNums0[2] === -1 || A[negativeMaxNums0[2]] > item) {\r\n\t\t\t\tnegativeMaxNums0[0] = negativeMaxNums0[1];\r\n\t\t\t\tnegativeMaxNums0[1] = negativeMaxNums0[2];\r\n\t\t\t\tnegativeMaxNums0[2] = i;\r\n\t\t\t} else if (negativeMaxNums0[1] === -1 || A[negativeMaxNums0[1]] > item) {\r\n\t\t\t\tnegativeMaxNums0[0] = negativeMaxNums0[1];\r\n\t\t\t\tnegativeMaxNums0[1] = i;\r\n\t\t\t} else if (negativeMaxNums0[0] === -1 || A[negativeMaxNums0[0]] > item) {\r\n\t\t\t\tnegativeMaxNums0[0] = i;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (negativeMaxNums1[2] === -1 || A[negativeMaxNums1[2]] < item) {\r\n\t\t\t\tnegativeMaxNums1[0] = negativeMaxNums1[1];\r\n\t\t\t\tnegativeMaxNums1[1] = negativeMaxNums1[2];\t\r\n\t\t\t\tnegativeMaxNums1[2] = i;\r\n\t\t\t} else if (negativeMaxNums1[1] === -1 || A[negativeMaxNums1[1]] < item) {\r\n\t\t\t\tnegativeMaxNums1[0] = negativeMaxNums1[1];\r\n\t\t\t\tnegativeMaxNums1[1] = i;\r\n\t\t\t} else if (negativeMaxNums1[0] === -1 || A[negativeMaxNums1[0]] < item) {\r\n\t\t\t\tnegativeMaxNums1[0] = i;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t\r\n\tconst num1 = positiveMaxNums0.filter((item) => item !== -1).length;\r\n\tconst num2 = negativeMaxNums0.filter((item) => item !== -1).length;\r\n\t\r\n\tif (num1 === 0) {\r\n\t\treturn A[negativeMaxNums1[0]] * A[negativeMaxNums1[1]] * A[negativeMaxNums1[2]];\r\n\t} else if (num2 === 0) {\r\n\t\treturn A[positiveMaxNums0[0]] * A[positiveMaxNums0[1]] * A[positiveMaxNums0[2]];\r\n\t} else if (num1 === 1) {\r\n\t\treturn A[positiveMaxNums0[2]] * A[negativeMaxNums0[2]] * A[negativeMaxNums0[1]];\r\n\t} else if (num1 === 2) {\r\n\t\tif (num2 === 1) {\r\n\t\t\treturn A[negativeMaxNums1[2]] * A[positiveMaxNums1[0]] * A[positiveMaxNums1[1]];\r\n\t\t} else {\r\n\t\t\treturn A[positiveMaxNums0[2]] * A[negativeMaxNums0[1]] * A[negativeMaxNums0[2]];\r\n\t\t}\t\t\r\n\t} else if (num1 === 3) {\r\n\t\tconst multiple1 = A[positiveMaxNums0[0]] * A[positiveMaxNums0[1]] * A[positiveMaxNums0[2]];\r\n\t\tif (num2 === 1) {\r\n\t\t\treturn multiple1;\r\n\t\t} else {\r\n\t\t\tconst multiple2 = A[positiveMaxNums0[2]] * A[negativeMaxNums0[1]] * A[negativeMaxNums0[2]];\r\n\t\t\treturn multiple1 > multiple2 ? multiple1 : multiple2;\r\n\t\t}\r\n\t}\r\n}", "function p5(){\n var arr = [1,3,22,43,65,103,1002,1738,1990,1776]\n var sum = 0\n for(var i = 0; i < arr.length; i++){\n if(arr[i] > sum){\n sum = arr[i]\n }\n }\n console.log(\"The largest number in the array is: \" + sum)\n}", "function findLargestProductOf3(array) {\n if (array.length < 3) throw new Error('Array too small!')\n let largest;\n let secondLargest;\n let thirdLargest;\n let smallest;\n let secondSmallest;\n\n for (let currNum of array) {\n if (currNum > largest || largest === undefined) {\n thirdLargest = secondLargest;\n secondLargest = largest;\n largest = currNum;\n } else if (currNum > secondLargest || secondLargest === undefined) {\n thirdLargest = secondLargest;\n secondLargest = currNum;\n } else if (currNum > thirdLargest || thirdLargest === undefined) {\n thirdLargest = currNum;\n }\n\n if (currNum < smallest || smallest === undefined){\n secondSmallest = smallest;\n smallest = currNum;\n } else if (currNum < secondSmallest || secondSmallest === undefined) {\n secondSmallest = currNum;\n }\n }\n\n if (largest < 0) return [largest, secondLargest, thirdLargest]\n return secondLargest * thirdLargest > smallest * secondSmallest ? [largest, secondLargest, thirdLargest] : [largest, secondSmallest, smallest];\n}", "function maxSum(arr){\n let max = 0;\n let sum = 0;\n for(let i = 0; i < arr.length - 1; i++){\n sum = sum + arr[i];\n if(sum > max){\n max = sum;\n }\n }\n console.log(max);\n}", "function threeSum(nums){\n // var output = []\n // if(nums.length <=3) return output\n // for(let i=0;i<nums.length;i++){\n // for(let j=0;j<nums.length;j++){\n // for(let k = 0;k<nums.length;k++){\n // if(i!=j&& j!=k && i!=k && nums[i]+nums[j]+nums[k]===0)\n // output.push([nums[i],nums[j],nums[k]])\n // }\n // }\n // }\n // return output\n\n var output = []\n nums = nums.sort((a,b) => a-b)\n for(var i=0;i<nums.length-2;i++){\n if(nums[i]>0) break\n if(i>0 && nums[i]===nums[i-1]) continue\n var left = i+1\n var right = nums.length-1\n while(left<right){\n if(nums[i]+nums[left]+nums[right]<0) left++\n else if(nums[i]+nums[left]+nums[right]>0) right --\n else {\n output.push([nums[i],nums[left],nums[right]])\n \n while(left<right&& nums[left]===nums[left+1]) left++\n while(left<right && nums[right]===nums[right-1]) right--\n left++\n right--\n }\n }\n }\n return output\n}", "function greedySubarraySum(array){\n let maxEndingHere = 0\n let maxSoFar\n for (let index = 0; index < array.length; index++) {\n maxEndingHere = maxEndingHere + array[index]\n // if we don't have a sum to beat, we set it here.\n // can also declare at top of function as - Number.MAX_SAFE_INTEGER\n if (!maxSoFar) maxSoFar = maxEndingHere\n if (maxSoFar < maxEndingHere){\n maxSoFar = maxEndingHere\n }\n if (maxEndingHere < 0){\n maxEndingHere = 0\n }\n }\n return maxSoFar\n}", "function maxSum(arr) {\n \n var max = null;\n \n function findMax(result, arr) {\n console.log(result, arr);\n //first time around result will be null\n if (result !== null) {\n //update max if current consecutive sum is greater\n //than max\n if (max === null || result > max) {\n max = result;\n }\n }\n \n if (arr.length === 0) {\n return;\n }\n \n for (var i = 0; i < arr.length; i++) {\n if (result === null) {\n result = arr[i];\n } else {\n result = result + arr[i];\n }\n var next_arr = arr.slice(i+1);\n findMax(result, next_arr);\n \n }\n }\n \n findMax(null, arr);\n console.log(max);\n \n}", "function maxSum(array) {\n let currentSum = 0;\n let currentHighest = array[0]; // Initialize this with array[0] instead of 0 in case we have an array with all negative numbers\n\n array.forEach(number => {\n currentSum += number;\n if (currentSum > currentHighest) {\n currentHighest = currentSum;\n }\n })\n\n console.log(currentHighest);\n return currentHighest;\n}", "function possibleSums(arr, max) {\n var sums = [];\n for (var i = 0; i < arr.length; i++) {\n var num1 = arr[i];\n for (var j = i; j < arr.length; j++) {\n if (num1 + arr[j] >= max) {\n continue;\n }\n sums.push(num1 + arr[j]);\n\n }\n }\n return sums;\n}", "function findMaxSumOfSubArray(arr, k) {\n let sum = 0;\n let currentSum = 0;\n\n for (let i = 0; i < arr.length; i++) {\n const winSize = i + k;\n let j = i + 1;\n\n currentSum = arr[i];\n\n while (j < winSize) {\n currentSum += arr[j];\n j++;\n }\n\n if (currentSum > sum) {\n sum = currentSum;\n }\n }\n\n return sum;\n}" ]
[ "0.73002195", "0.72304404", "0.718815", "0.7182351", "0.71370167", "0.7045055", "0.6952253", "0.69207835", "0.69073343", "0.69040924", "0.68880427", "0.6863262", "0.6853558", "0.6841851", "0.68351406", "0.68329936", "0.6814845", "0.67975795", "0.679301", "0.67837244", "0.67760503", "0.6770421", "0.67179877", "0.67164695", "0.669978", "0.66837406", "0.66815585", "0.66746455", "0.6652539", "0.6650216", "0.66489166", "0.6644201", "0.6641033", "0.6634806", "0.6625436", "0.6625247", "0.66143185", "0.6609546", "0.6606569", "0.6585926", "0.6572701", "0.6550415", "0.65427387", "0.65388775", "0.6526805", "0.6520353", "0.6515853", "0.6513508", "0.6511296", "0.6509973", "0.6505773", "0.6503891", "0.6500775", "0.6482326", "0.6464994", "0.64630026", "0.6462119", "0.64530575", "0.6452816", "0.6441843", "0.64301676", "0.6419498", "0.6418655", "0.6409078", "0.64086145", "0.6401908", "0.6395724", "0.63897455", "0.63884294", "0.6388253", "0.63837755", "0.6383082", "0.6381742", "0.6381478", "0.6372429", "0.63643956", "0.63597226", "0.63534", "0.63470274", "0.63413364", "0.63344145", "0.633205", "0.6320207", "0.6314054", "0.6313964", "0.63117397", "0.6308812", "0.62912273", "0.6280999", "0.6280067", "0.62795675", "0.6273153", "0.6269985", "0.6264777", "0.6264177", "0.62615013", "0.6261334", "0.6250515", "0.62476534", "0.6247027" ]
0.68228924
16
console.log(largest_contiguous_subsum2(list)); // => 8 (from [7, 6, 7]) Time complexity is O(n) time which is linear time and O(1) memory which is constant. Big O Is Shuffle Given three strings, return if the third string is composed of the first two strings. It also preserves the sequence of the characters.
function is_shuffle(str1, str2, str3) { var seen_candidates = {}; var candidates = [[0, 0]]; while (candidates.length != 0) { var temp = candidates.shift(); var str1_used_len = candidates[0]; var str2_used_len = candidates[1]; var str3_used_len = str1_used_len + str2_used_len; if (str3_used_len == str3.length) { return true; } if (str1[str1_used_len] == str3[str3_used_len]) { var new_candidate = [str1_used_len + 1, str2_used_len]; if (!seen_candidates[new_candidate]) { candidates.push(new_candidate); seen_candidates[new_candidate] = true; } } if (str2[str2_used_len] == str3[str3_used_len]) { var new_candidate = [str1_used_len, str2_used_len + 1]; if (!seen_candidates[new_candidate]) { candidates.push(new_candidate); seen_candidates[new_candidate] = true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largest_contiguous_subsum2(arr){\n\n let max_so_far = arr[0];\n let curr_max = arr[0];\n\n for (i=1; i<arr.length; i++){\n curr_max = Math.max(arr[i], curr_max+arr[i]);\n max_so_far = Math.max(max_so_far, curr_max);\n }\n return max_so_far;\n}", "function largest_contiguous_subsum1(arr){\n let arrays = [];\n for (let i=0; i<arr.length; i++){\n for (let k=i; k<arr.length; k++){\n let array = [];\n for (let j=i; j<=k; j++){\n array.push(arr[j]);\n }\n let sum = array.reduce((a,b) => a+b);\n arrays.push(sum);\n }\n }\n return Math.max(...arrays);\n }", "function getMaxSubSum(arr) { \n let max=0;\n for (let i=0; i<arr.length; i++) {\n let sumStart = 0;\n for (let j=i; j<arr.length; j++) {\n sumStart += arr[j];\n max = Math.max(sumStart, max);\n }\n } \n return max;\n} // O(n^2)", "function maxConSubarray(arr){\n var i,\n len,\n tmp = [],\n sum = 0,\n cash,\n cashArr = [],\n // If find subarray with length more than 2.\n flag = true;\n /* To find\n positive subarray: posORneg = -1;\n negative subarray: posORneg = 1;\n */\n function subArr(arr,posORneg){\n for(i = 0, len = arr.length; i < len; i += 1){\n if(arr[i] === arr[i+1] + posORneg){\n flag = false;\n tmp.push(arr[i]);\n // Pushing last element to tmp because if will not check when i = length.\n if(i === len - 2){\n tmp.push(arr[i+1]);\n }\n } else {\n // If in the middle last element of subarray push it to tmp for negative subarray.\n if(posORneg === 1 && i !== len -1){\n tmp.push(arr[i]);\n }\n // If for correct work of reduce(). And skip it when negative subarray.\n if(tmp.length > 0 && posORneg === -1){\n // If in the middle last element of subarray push it to tmp.\n if (i !== len -1){\n tmp.push(arr[i]);\n }\n cash = tmp.reduce(function(previousValue, currentValue) {\n return previousValue + currentValue;\n });\n // Max sum.\n if (sum < cash){\n sum = cash;\n }\n // Clearing tmp.\n tmp = [];\n }\n }\n }\n }\n /* Comparing parameter of array with previous.\n If arrays are different makes flag = true and sum = 0.\n */\n function init(arr){\n len = arr.length;\n if (cashArr.length === 0) {\n cashArr = arr;\n }\n if (cashArr.length !== len){\n flag = true;\n sum = 0;\n }\n if (cashArr.length === len){\n for(i = 0; i < len; i += 1){\n if(cashArr[i] !== arr[i]){\n flag = true;\n sum = 0;\n break;\n }\n }\n }\n }\n\n return function(arr){\n init(arr);\n subArr(arr, -1);\n subArr(arr, 1);\n if(flag){\n return Math.max.apply(null,arr);\n } else return sum;\n }\n }", "function findLongestRepeatingSubSeq(str) {\n let n = str.length;\n\n let dp = new Array(n + 1);\n for (let i = 0; i <= n; i++) {\n dp[i] = new Array(n + 1);\n for (let j = 0; j <= n; j++) dp[i][j] = 0;\n }\n\n // now use LCS function\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= n; j++) {\n if (str[i - 1] === str[j - 1] && i != j) dp[i][j] = 1 + dp[i - 1][j - 1];\n else dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);\n }\n }\n return dp[n][n];\n}", "function isSumPossible3(a, n) {\n var iMdone = 0,\n len = a.length,\n cursorR, cursorL,\n arr, compareFn;\n\n if (len < 2) {\n return iMdone;\n }\n if (len === 2) {\n return a[0]+a[1] === n ? 1 : 0;\n }\n \n var compareFn = function compare(a, b) {\n if (a > b) {\n return -1;\n }\n if (a < b) {\n return 1;\n }\n return 0;\n }\n \n arr = a.sort(compareFn);\n cursorL = 0;\n cursorR = len-1;\n \n while (cursorL < cursorR) {\n if (arr[cursorL] > n) {\n cursorL += 1;\n continue;\n }\n if (arr[cursorL] + arr[cursorR] === n) {\n iMdone = 1;\n break;\n } else if (arr[cursorL] + arr[cursorR] > n) {\n cursorL += 1;\n } else {\n cursorR -= 1;\n }\n }\n\n return iMdone; \n }", "function largestSubarraySum(array){\n\n let target = 0;\n let reversedArray = [...array].reverse();\n const reducer = (accumulator, currentValue) => accumulator + currentValue;\n\n\tfor (let i = 0; i < array.length - 1; i++){\n const slicedArray = array.slice(i);\n const slicedReversedArray = reversedArray.slice(i);\n\n const arr1Sum = slicedArray.reduce(reducer);\n const arr2Sum = slicedReversedArray.reduce(reducer);\n\n const arr3Sum = slicedArray.slice(0, -1).reduce(reducer);\n const arr4Sum = slicedReversedArray.slice(0, -1).reduce(reducer);\n\n target < arr1Sum ? target = arr1Sum : undefined;\n target < arr2Sum ? target = arr2Sum : undefined;\n\n target < arr3Sum ? target = arr3Sum : undefined;\n target < arr4Sum ? target = arr4Sum : undefined;\n\n }\n return target;\n}", "function maxContiguousSum (arr) {\n let sum = Math.max(...arr);\n\n for (let i = 0; i < arr.length - 1; i++) {\n let tempSum = arr[i];\n\n for (let j = i + 1; j < arr.length; j++) {\n tempSum += arr[j];\n\n if (sum < tempSum) sum = tempSum;\n }\n }\n\n return sum;\n}", "function maxSubArraySum(arr, n){ // O(n^2) // naive solution\r\n let maxSum = 0;\r\n for(let i = 0; i < arr.length - n + 1; i++){ // O(n)\r\n let temp = 0;\r\n for(let j = 0; j < n; j++){ // nested O(n)\r\n temp += arr[i + j];\r\n }\r\n if(temp > maxSum){\r\n maxSum = temp;\r\n }\r\n }\r\n return maxSum;\r\n}", "function findSumSubArray(arr, sum) {\n let startI = 0;\n let currentSum = 0;\n\n for (let j = 0; j < arr.length; j++) {\n currentSum += arr[j];\n\n while (currentSum > sum) {\n currentSum -= arr[startI];\n startI++;\n }\n\n if (currentSum === sum) {\n return (`${startI}, ${j}`);\n }\n }\n\n return false;\n}", "function threeSum(nums){\n // var output = []\n // if(nums.length <=3) return output\n // for(let i=0;i<nums.length;i++){\n // for(let j=0;j<nums.length;j++){\n // for(let k = 0;k<nums.length;k++){\n // if(i!=j&& j!=k && i!=k && nums[i]+nums[j]+nums[k]===0)\n // output.push([nums[i],nums[j],nums[k]])\n // }\n // }\n // }\n // return output\n\n var output = []\n nums = nums.sort((a,b) => a-b)\n for(var i=0;i<nums.length-2;i++){\n if(nums[i]>0) break\n if(i>0 && nums[i]===nums[i-1]) continue\n var left = i+1\n var right = nums.length-1\n while(left<right){\n if(nums[i]+nums[left]+nums[right]<0) left++\n else if(nums[i]+nums[left]+nums[right]>0) right --\n else {\n output.push([nums[i],nums[left],nums[right]])\n \n while(left<right&& nums[left]===nums[left+1]) left++\n while(left<right && nums[right]===nums[right-1]) right--\n left++\n right--\n }\n }\n }\n return output\n}", "function secondLargest(arr) {\n const uniq = [...new Set(arr)];\n uniq.sort(function(a,b) {return a-b});\n return uniq[uniq.length-2];\n}", "function findLongestSubstring(s) {\n let maxSub = 0;\n for (let i = 0; i < s.length; i++) {\n const seen = new Set();\n for (let j = i; j < s.length; j++) {\n if (!seen.has(s[j])) {\n seen.add(s[j]);\n } else {\n maxSub = Math.max(seen.size, maxSub);\n break;\n }\n }\n }\n console.log(s, maxSub);\n return maxSub;\n}", "function subarrayWithGivenSum(arr, s) {\n // brute force\n for (let i = 0; i < arr.length; i++) {\n let currSum = 0;\n for (let j = i; j < arr.length; j++) {\n currSum += arr[j];\n if (currSum === s) return [i, j];\n }\n }\n return [-1, -1];\n // two pointer\n // let start = 0, end = 0;\n // let currSum = 0;\n // while (start < arr.length && end < arr.length) {\n // currSum += arr[end];\n // if (currSum === s) return [start, end];\n // if (currSum + arr[end] > s) start++;\n // else if (currSum + arr[end] < s) end++;\n // }\n // while (start < arr.length) {\n // currSum -= arr[start]\n // if (currSum === s) return [start, end];\n // start++;\n // }\n}", "function LargestSum() {\n\tvar test = [1, 3, -5, 23, -11, 6, 37, 21, -31, 10, 9, 19];\n\n\tfunction dpLargeSum(collection) {\n\t\tvar largest = [];\n\t\tlargest[0] = collection[0];\n\t\t// var lastIndex = 0;\n\t\tfor (var i = 1; i < collection.length; i++) {\n\t\t\t// largest[i] represents the largest sum for sub sequence ending with collection[i]\n\t\t\t// largest[i] does not mean the largest sum for the first i items (which could make things much more complicated)\n\t\t\tlargest[i] = largest[i - 1] + collection[i] > collection[i] ? largest[i - 1] + collection[i] : collection[i];\n\t\t}\n\t\tconsole.log(largest);\n\t\treturn max(largest);\n\t}\n\n\tfunction max(collection) {\n\t\tvar maxVal = collection[0];\n\t\tcollection.forEach((item) => {\n\t\t\tif (item > maxVal) {\n\t\t\t\tmaxVal = item;\n\t\t\t}\n\t\t});\n\t\treturn maxVal;\n\t}\n\n\tfunction bruteForce(collection) {\n\t\tvar sum = 0;\n\t\tvar max = 0;\n\t\t// starting index\n\t\tfor (var i = 0; i < collection.length; i++) {\n\t\t\t// define the length of this loop\n\t\t\tfor (var j = 0; j < collection.length - i; j++) {\n\t\t\t\t// starting index to index + length\n\t\t\t\tfor (var k = i; k < j + i + 1; k++) {\n\t\t\t\t\tsum += collection[k]\n\t\t\t\t}\n\t\t\t\tif (sum > max) {\n\t\t\t\t\tmax = sum;\n\t\t\t\t}\n\t\t\t\tsum = 0;\n\t\t\t}\n\t\t}\n\t\treturn max;\n\t}\n\n\tconsole.log(dpLargeSum(test));\n\tconsole.log(bruteForce(test));\n}", "function maxInversions2(arr) {\n let arrLength = arr.length;\n let inversionCount = 0;\n\n // Subsequence of 3: Iterate through N^3 possibilities\n for (let i = 0; i < arrLength - 2; i++) {\n for (let j = i + 1; j < arrLength - 1; j++) {\n if (arr[i] > arr[j]) {\n for (let k = j + 1; k < arrLength; k++) {\n if (arr[j] > arr[k]) {\n inversionCount++;\n }\n }\n }\n }\n }\n return inversionCount;\n}", "function twoSum(arr, n) {\n const cache = new Set();\n for (let i = 0; i < arr.length; i++) {\n if (cache.has(n - arr[i])) {\n return true;\n }\n cache.add(arr[i]);\n }\n return false;\n}", "function maximumSubsequence(population) {\n const length = population.length;\n let answer = population[0], sum = answer;\n for(let step = 1; step <= length; step++){\n innerLoop:\n for(let from = 0; from < length; from++){\n if((from + step) > length){\n break innerLoop;\n }\n const subPopulation = population.slice(from, from + step);\n const total = subPopulation.reduce((cummulative, current) => {\n return cummulative + current;\n }, 0);\n if(total > sum){\n sum = total;\n answer = [...subPopulation];\n }\n }\n }\n return [...answer];\n }", "function threeSum(nums, tar = 0) {\n let map = {};\n let retMemo = new Set();\n let retArr = [];\n\n // Add all 2 sums in the array into map\n for (let i = 0; i < nums.length; i++) {\n for (let j = i + 1; j < nums.length; j++) {\n if (map[nums[i] + nums[j]] === undefined)\n map[nums[i] + nums[j]] = [[i, j]];\n else\n map[nums[i] + nums[j]].push([i, j]);\n }\n }\n\n // Iterate over arr again looking for complement of arr[i] in map\n for (let i = 0; i < nums.length; i++) {\n if (map[tar - nums[i]] !== undefined) {\n // Each arr holds n sub-arrays of indices that their values add up to the complement of arr[i]\n let arr = map[tar - nums[i]];\n\n for (let j = 0; j < arr.length; j++) {\n // Do not use an index more than once in a sum\n if (i !== arr[j][0] && i !== arr[j][1]) {\n // Sort values and store them as strings so they are only added to the retArr once\n let tmp = [nums[i], nums[arr[j][0]], nums[arr[j][1]]].sort((a, b) => { return a - b })\n if (retMemo.has(`${tmp[0]},${tmp[1]},${tmp[2]}`) === false) {\n retArr.push(tmp);\n retMemo.add(`${tmp[0]},${tmp[1]},${tmp[2]}`);\n }\n }\n }\n }\n }\n\n return retArr;\n}", "function maxSumIncreasingSubsequence(array) {\n\tlet map = new Map();\n\tfor (let i = 0; i < array.length; i++) {\n\t\tlet curr = array[i];\n\t\tmap.set(curr, []);\n\t\tfor (let j = i + 1; j < array.length; j++) {\n\t\t\tif (array[j] > curr) {\n\t\t\t\tmap.get(curr).push(array[j]);\n\t\t\t}\n\t\t}\n\t}\n\tlet max = -Infinity;\n\tlet vals = [];\n\tlet large = [];\n\tfor (let [key, value] of map) {\n\t\tvals = [];\n\t\tlet sum = key;\n\t\tlet prev = key;\n\t\tvals.push(key);\n\t\tfor (let val of value) {\n\t\t\tif (val > prev) {\n\t\t\t\tsum += val;\n\t\t\t\tprev = val;\n\t\t\t\tvals.push(val);\n\t\t\t} else {\n\t\t\t\twhile (vals[vals.length - 1] >= val) {\n\t\t\t\t\tsum -= vals.pop();\n\t\t\t\t}\n\t\t\t\tvals.push(val);\n\t\t\t\tsum += val;\n\t\t\t\tprev = val;\n\t\t\t}\n\t\t\tif (max < sum) {\n\t\t\t\tmax = sum;\n\t\t\t\tlarge = vals.slice();\n\t\t\t}\n\t\t}\n\t\tif (max < sum) {\n\t\t\tmax = sum;\n\t\t\tlarge = vals.slice();\n\t\t}\n\t}\n\treturn [max, large];\n}", "function largestSubstringWithKDistinctChar(s, k) {\n let currentLargestSubstring = '';\n\n for (let i = 0; i < s.length; i++) {\n for (let j = i+1; j < s.length; j++) {\n let substring = s.slice(i, j);\n if (containsKDistinctChars(substring, k) && currentLargestSubstring.length < substring.length) {\n currentLargestSubstring = substring;\n } \n\n console.log(substring);\n } \n }\n\n return currentLargestSubstring;\n}", "function LongestCommonSub_Iterative(str1, str2, m, n) {\n\n var tabulation = [];\n\n for (var i = 0; i <= m; i++) {\n for (var j = 0; j <= n; j++) {\n // initialize i=0 and j=0 rows and cols with 0, as we need these as initial state \n if (i === 0 || j === 0) {\n if (tabulation[i] === undefined) {\n tabulation[i] = [];\n }\n //takes care of populating a row with all Zero\n //Happens only for first row and first column i.e., i=0 || j=0\n tabulation[i][j] = 0;\n } else {\n if (str1.charAt(i - 1) === str2.charAt(j - 1)) {\n //If they match then its reduced to 1 + LCS( str1 - 1char, str2 - 1char)\n tabulation[i][j] = 1 + tabulation[i - 1][j - 1]\n } else {\n //If they don't match then its reduced to Max of [ LCS( str1 - 1char, str2) , LCS( str1, str2 - 1char) ] \n tabulation[i][j] = Math.max(tabulation[i - 1][j], tabulation[i][j - 1]);\n }\n }\n }\n }\n\n printLCS(str1, str2, m, n, tabulation);\n return tabulation;\n\n}", "function firstRecurringCharacter(input) {\n for (let i = 0; i < input.length; i++) {\n for (let j = i + 1; j < input.length; j++) {\n if(input[i] === input[j]) {\n return input[i];\n }\n }\n }\n return undefined\n}//O(n^2) with Space Complexicity O(1)", "function twoSum(numbers, sum) {\n let indexes = [];\n let found = false;\n for (let i = 0; i <= numbers.length && !found; i++) {\n const complement = numbers.indexOf(sum - numbers[i]);\n if (complement !== -1 && complement !== i) {\n indexes.push(i);\n indexes.push(complement);\n found = true;\n }\n }\n // sorting made this run with less memory\n return indexes.sort((a, b) => a - b);\n}", "function isShuffle3(str1, str2, str3) {\n let stringIndecies = [0, 0];\n\n while (stringIndecies.length) {\n let str1Idx = stringIndecies.shift(),\n str2Idx = stringIndecies.shift(),\n str3Idx = str1Idx + str2Idx;\n if (str3Idx === str3.length) {\n return true;\n }\n\n if (str1[str1Idx] === str3[str3Idx]) {\n stringIndecies = [str1Idx + 1, str2Idx];\n }\n\n if (str2[str2Idx] === str3[str3Idx]) {\n stringIndecies = [str1Idx, str2Idx + 1];\n }\n }\n return false;\n}", "function longestIncreasingSubsequence(nums){\n var array = [];\n //Al principio todos tienen subsequence max de 1\n var max = 1;\n if(nums.length === 0) return 0;\n\n for(var i = 0; i < nums.length; i++){\n array[i] = 1;\n for(var j = 0; j < i; j++){\n if(nums[j] < nums[i] && (array[j] + 1 > array[i])){\n array[i] = array[j] + 1;\n max = Math.max(max, array[i]);\n }\n }\n }\n return max;\n}", "function isShuffle4(str1, str2, str3) {\n let candidates = [[0, 0]],\n seen = {};\n\n while (candidates.length) {\n let candidate = candidates.shift(),\n str1Idx = candidate.shift();\n str2Idx = candidate.shift(),\n str3Idx = str1Idx + str2Idx;\n if (str3Idx === str3.length) {\n return true;\n }\n\n if (str1[str1Idx] === str3[str3Idx]) {\n candidate = [str1Idx + 1, str2Idx];\n if (!seen[candidate]) {\n seen[candidate] = true;\n candidates.push(candidate);\n }\n }\n\n if (str2[str2Idx] === str3[str3Idx]) {\n candidate = [str1Idx, str2Idx + 1];\n if (!seen[candidate]) {\n seen[candidate] = true;\n candidates.push(candidate);\n }\n }\n }\n return false;\n}", "function threeSum(nums) {\n let len = nums.length;\n let res = [];\n nums.sort((a, b) => a-b); \n for(let i = 0; i < len - 2; i++) {\n if(i > 0 && nums[i] === nums[i - 1])\n continue;\n let left = i + 1;\n let right = len - 1;\n while(left < right) {\n let sum = nums[i] + nums[left] + nums[right];\n if(sum === 0) {\n res.push([nums[i], nums[left], nums[right]]);\n left++;\n right--;\n while(left < right && nums[left] === nums[left - 1]) {\n left++;\n }\n while(left < right && nums[right] === nums[right + 1]) {\n right--;\n }\n } else if(sum > 0) {\n right--;\n } else if(sum < 0) {\n left++;\n }\n }\n }\n return res;\n}", "function longestIncreasingSubsequence(nums){\n var max = 1;\n //Al principio todos tienen subsequence de 1\n var array = new Array(nums.length).fill(1);\n if(nums.length === 0) return 0;\n\n for(var i = 1; i < nums.length; i++){\n for(var j = 0; j < i; j++){\n if(nums[j] < nums[i] && (array[j] + 1 > array[i])){\n array[i] = array[j] + 1;\n max = Math.max(max, array[i]);\n }\n }\n }\n return max;\n}", "function mostseq2 (k,arr){\n var count=0;\n for (var i=0;i<arr.length;i++)\n if (arr[i]==k)\n count++;\n return count;\n}", "function longestCommonSubsequence(text1, text2) {\n /*\n - Think of the rows as the outer loop and the columns as the inner loop.\n - Use 2 pointers, one for each string (imagine it being a matrix). One is for rows and the other for columns.\n - Rows -> text1\n - Columns -> text2\n - Like in the Coin Change problem, build the matrix and traverse it backwards when necessary.\n - When initializing the matrix, add an additional row and column BEFORE and initialize them to 0s.\n - If both characters match, move 1 row and col forward and add 1 to it (down diagonally).\n - If characters don't match, calculate the max of going back in the col (cell above) and going back in the row (cell to the left). Doing this we carry forward the maximum common subsequence\n X a b c d e X a b c d e\n X 0 0 0 0 0 0 X 0 0 0 0 0 0\n a 0 1 0 0 0 0 a 0 1 1 1 1 1\n c 0 0 0 0 0 0 c 0 1 1 2 2 2\n e 0 0 0 0 0 0 e 0 3 3 3 3 3\n */\n\n const dp = []\n\n // Generate the starting matrix adding the additional row and col. Fill the matrix with 0s\n for (let i = 0; i < text1.length + 1; i++) {\n dp.push(Array(text2.length + 1).fill(0))\n }\n\n // Scan from left to right through the string\n for (let i = 0; i < text1.length; i++) {\n for (let j = 0; j < text2.length; j++) {\n // If the values match move 1 row and col forward and add 1 to it (down-right diagonally).\n if (text1[i] === text2[j]) {\n // The new value will be the diagonal\n const diagonal = dp[i][j]\n // Calculate the cell taking into account the offset of the additional row/col\n // Increment by the value of the diagonal\n dp[i + 1][j + 1] = diagonal + 1\n }\n // If characters don't match carry forward the maximum common subsequence\n else {\n const above = dp[i][j + 1]\n const left = dp[i + 1][j]\n // Calculate the max of the cell above and the one to the left\n dp[i + 1][j + 1] = Math.max(above, left)\n }\n }\n }\n\n // If we found the LCS the it's length would be saved in the bottom-right corner.\n // If no subsequence was found the value of the last cell will be 0\n return dp[text1.length][text2.length]\n}", "function threeSum(nums) {\n nums.sort((a, b) => a - b);\n\n const result = [];\n for (let indexA = 0; indexA < nums.length - 2; indexA++) {\n const a = nums[indexA];\n\n if (a > 0) return result;\n if (a === nums[indexA - 1]) continue;\n\n let indexB = indexA + 1;\n let indexC = nums.length - 1;\n\n while (indexB < indexC) {\n const b = nums[indexB];\n const c = nums[indexC];\n\n if (a + b + c === 0) {\n result.push([a, b, c]);\n }\n\n if (a + b + c >= 0) {\n while (nums[indexC - 1] === c) {\n indexC--;\n }\n indexC--;\n }\n\n if (a + b + c <= 0) {\n while (nums[indexB + 1] === b) {\n indexB++;\n }\n indexB++;\n }\n }\n }\n return result;\n}", "function isShuffle2(str1, str2, str3) {\n if (!str3.length) {\n return (str2.length === 0 && str1.length === 0);\n }\n if (str3[0] === str1[0]) {\n return (isShuffle2(str1.slice(1), str2, str3.slice(1)));\n }\n\n if (str3[0] === str2[0]) {\n return (isShuffle2(str1, str2.slice(1), str3.slice(1)));\n }\n return false;\n}", "function findHighestSumSublistAndDisplayResult (numbers) {\n if(!numbers || numbers.length === 0) {\n throw new Error('You mast pass a list of numbers as argument.')\n }\n\n const argumentIsNotANumber = numbers.find(isNaN)\n if(argumentIsNotANumber) {\n throw new Error(`'${argumentIsNotANumber}' is not a number.`)\n }\n\n const argumentNumbers = numbers.map(Number)\n\n const numberList = new NumberList(argumentNumbers)\n const highestSumSublistIndexes = numberList.getHighestSumSublistIndexes()\n\n return `The contiguous sublist with highest begins at ${highestSumSublistIndexes.start} and ends at ${highestSumSublistIndexes.finish}`\n}", "function longest(nums) {\n/*\n assume each number is a increasing subsequence with length of 1\n create an array to record longest increasing subsquence at each number\n\n By iterating nums array, update the LIS at each number by iterating \n previous number. \n\n time complexity O(n^2), space complexity O(n)\n*/\n\n // const lengths = new Array(nums.length).fill(1);\n // let maxLength = 1;\n\n // for(let i = 0; i < nums.length; i++) {\n // for(let j = i - 1; j >= 0; j--) {\n // if (nums[i] > nums[j]) {\n // lengths[i] = Math.max(lengths[j] + 1, lengths[i]);\n // if (lengths[i] > maxLength) maxLength = lengths[i];\n // }\n // }\n // }\n\n // return maxLength;\n\n/*\n in order to reduce time complexity to O(n log n), a different approach is needed\n\n The general idea is keep all possible increasing subsequences and update them under 3 conditions\n By iterating nums, compare each num with the last element of each IS\n\n Case 1: If num is greater than all last elements of ISs, clone LIS and attach num to its clone\n Case 2: If num is smaller than all last elements of ISs, create a new IS with the num OR replace previous single IS with num\n Case 3: If num is in between the above two conditions, find the IS with largest last element which is smaller than num.\n Clone it and attach num. discard all other ISs with same length\n\n As IS update, make sure *** ISs[i].last_element > ISs[i - 1].last_element ***\n\n Ex. input = [10, 9, 2, 5, 3, 7, 101, 18]\n\n num = 10 (no IS yet)\n 10\n ------------------------------------------------\n num = 9 (case 2)\n 9\n ------------------------------------------------\n num = 2 (case 2)\n 2\n ------------------------------------------------\n num = 5 (case 1)\n 2\n 2, 5\n ------------------------------------------------\n num = 3 (case 3)\n 2\n 2, 3\n 2, 5 (discard)\n ------------------------------------------------\n num = 7 (case 1)\n 2\n 2, 3\n 2, 3, 7\n ------------------------------------------------\n num = 101 (case 1)\n 2\n 2, 3\n 2, 3, 7\n 2, 3, 7, 101\n ------------------------------------------------\n num = 18 (case 3)\n 2\n 2, 3\n 2, 3, 7\n 2, 3, 7, 18 (ANSWER!!)\n 2, 3, 7, 101 (discard)\n\n The way to store IS can be simplified down to an TAIL array. \n Index represents length of IS at this index (index 0 = IS of length 1, index 1 = IS of length 2...) \n Value at this index represents last/largest element of the IS. (tails[0] = 10 => 9 => 2 from example input)\n Therefore: \n\n Ex. input = [10, 9, 2, 5, 3, 7, 101, 18]\n\n num = 10 (no IS yet)\n 10\n ------------------------------------------------\n num = 9\n 9\n ------------------------------------------------\n num = 2\n 2\n ------------------------------------------------\n num = 5\n 2, 5\n ------------------------------------------------\n num = 3\n 2, 3\n ------------------------------------------------\n num = 7\n 2, 3, 7\n ------------------------------------------------\n num = 101\n 2, 3, 7, 101\n ------------------------------------------------\n num = 18\n 2, 3, 7, 18\n\n*/\n\n const arr = [nums[0]];\n\n for(let i = 1; i < nums.length; i++) {\n const idx = bSearch(nums[i]);\n arr[idx] = nums[i];\n }\n\n return arr.length;\n \n function bSearch(num) {\n let i = 0;\n let j = arr.length - 1;\n while (i < arr.length && j >= 0) {\n const mid = Math.floor((i + j) / 2);\n if (arr[mid] > num) {\n if (arr[mid - 1] === num) return mid - 1;\n if (arr[mid - 1] < num) return mid;\n j = mid - 1;\n } else if (arr[mid] < num) {\n if (arr[mid + 1] >= num) return mid + 1;\n i = mid + 1;\n } else {\n return mid;\n }\n }\n\n return i;\n }\n}", "function largestPairSum(numbers) {\n var largestSum = -1000;\n // loop through twice\n for (let i = 0; i < numbers.length; i++) {\n for (let j = 0; j < numbers.length; j++) {\n // if i and j are not the same number and larger than largestSum\n if (i != j && numbers[i] + numbers[j] > largestSum) {\n largestSum = numbers[i] + numbers[j];\n // make largest sum i+j\n }\n }\n }\n return largestSum;\n}", "function largestPair(num) {\n let output = 0;\n let str = num.toString();\n for (let i = 0; i < str.length - 1; i += 1) {\n let test = str.slice(i, i + 2);\n if (test > output) {output = test}\n }\n return output;\n}", "function smartFindTriplet(arr,sum){\n var result = false;\n arr = arr.sort(function(a,b) { return a - b; });\n var next;\n var last;\n for(var i =0; i< arr.length-2;i++){\n next = i+1;\n last = arr.length - 1;\n while(next < last){\n if(arr[i] + arr[next] + arr[last] === sum) {\n \tresult = true;\n break;\n } else if (arr[i] + arr[next] + arr[last] < sum){\n \tnext++;\n } else {\n \tlast--;\n }\n }\n }\n return result;\n}", "function s(s1, s2, s3) {\n // must alternate between s1 and s2\n const l1 = s1.length;\n const l2 = s2.length;\n const l3 = s3.length;\n\n const memo = {};\n return helper(0, 0, 0);\n\n function helper(p1, p2, p3) {\n if (p3 === l3) {\n return p1 === l1 && p2 === l2 ? true : false;\n }\n\n const key = `${p1}-${p2}-${p3}`;\n if (memo[key]) return memo[key];\n\n if (p1 === l1) {\n return (memo[key] =\n s2[p2] === s3[p3] ? helper(p1, p2 + 1, p3 + 1) : false);\n }\n if (p2 === l1) {\n return (memo[key] =\n s1[p1] === s3[p3] ? helper(p1 + 1, p2, p3 + 1) : false);\n }\n\n let one = false;\n let two = false;\n if (s1[p1] === s3[p3]) {\n one = helper(p1 + 1, p2, p3 + 1);\n }\n if (s2[p2] === s3[p3]) {\n two = helper(p1, p2 + 1, p3 + 1);\n }\n\n return (memo[key] = one || two);\n }\n}", "function hasPairSum2(array, sum) { // time: O(n), space: O(n)\n // loop over\n const complements = new Set()\n for(let i=0; i<array.length; i++) {\n // if set has current, return true\n if (complements.has(array[i])){\n return true;\n }\n // add sum - current\n complements.add(sum - array[i]);\n }\n return false;\n}", "function solution(A) {\n let result = false\n // write your code in JavaScript (Node.js 8.9.4)\n let i = 0;\n let j = (A.length - 1);\n let couter = 0;\n for (i = (j - 1); i > 0; i-- , j--) {\n if (A[i] < A[j]) {\n couter++;\n }\n }\n\n result = (couter >= 2) ? false : true\n return result;\n}", "function threeSumProblem(arr, target) {\n arr.sort((a, b) => a - b);\n //console.log(arr);\n for (let i = 0; i < arr.length; i++) {\n let part1 = arr[i];\n\n if (part1 * 3 === target) return true;\n\n let j = 0;\n let k = arr.length - 1;\n let part2 = arr[j];\n let part3 = arr[k];\n let remainder = target - part1;\n\n while (part2 <= part3) {\n if (part2 + part3 === remainder) return true;\n else if (part2 + part3 < remainder) part2 = arr[k++];\n else part3 = arr[j--];\n }\n }\n\n return false;\n}", "function find(s) {\n let map = {}\n for (let i = 0; i < s.length; i++) {\n map[s[i]] = 0\n }\n\n let start = 0\n let end = 0\n let maxLen = 0\n let counter = 0\n\n while (end < s.length) {\n let c1 = s[end]\n\n if (map[c1] === 0) counter++\n map[c1]++\n end++\n\n while (counter > 2) {\n let c2 = s[start]\n\n if (map[c2] === 1) counter--\n map[c2]--\n start++\n }\n maxLen = Math.max(maxLen, end - start);\n }\n return maxLen\n}", "function findConsqSums(nums, targetSum) {\n // code here\n}", "function threeNumberSum(array, targetSum) {\n array.sort((a,b)=>a-b); //0 (nlog n)\n //3rd+2nd=targetSum-1st\n //b+c=t-a\n let answerArray=[]\n let possibleCombos=[]\n\n \n\n for(let i=0;i<array.length-2;i++){\n let firstValue=array[i],secondValue=i+1,thirdValue=array.length-1\n \n while(secondValue<thirdValue){\n possibleCombos.push([firstValue,array[secondValue],array[thirdValue]])\n if(targetSum===firstValue+array[secondValue]+array[thirdValue]){\n answerArray.push([firstValue,array[secondValue],array[thirdValue]])\n secondValue++\n thirdValue--\n } \n else if(firstValue+array[secondValue]+array[thirdValue]>targetSum){\n thirdValue--\n }else{\n secondValue++\n }\n }\n // possibleCombos.push('done',i)\n }\n console.log(possibleCombos)\n return answerArray;\n }", "function firstRecurringCharacter3(input) {\n for(let i = 0; i < input.length - 1; i++ ){\n for (let j = i + 1; j >= 0; j--) {\n if (input[i] === input[j] && i !== j) {\n return input[i];\n }\n }\n }\n return undefined;\n}", "function countSubstrings(str, cache = {}) {\n let windowSize = 1;\n let palindromeCounter = 0;\n\n while (windowSize <= str.length) {\n for (let start = 0; start + windowSize <= str.length; start++) {\n let currentSubstring = str.slice(start, start + windowSize);\n let stringIsPalindrome = cache[currentSubstring] === undefined ? isPalindrome(currentSubstring, cache) : cache[currentSubstring];\n cache[currentSubstring] = stringIsPalindrome;\n if (stringIsPalindrome) {\n palindromeCounter++;\n }\n }\n windowSize++;\n }\n\n return palindromeCounter;\n}", "function isSumPossible2(a, n) {\n var iMdone = 0,\n len = a.length,\n cursorR, cursorL;\n\n if (len < 2) {\n return iMdone;\n }\n if (len === 2) {\n return a[0]+a[1] === n ? 1 : 0;\n }\n \n do {\n if (a[cursorL] + a[cursorR] === n) {\n iMdone = 1;\n break;\n }\n if (cursorR+1 === len) {\n cursorL += 1;\n cursorR = cursorL+1;\n } else {\n cursorR += 1; \n }\n } while(cursorL !== len-1)\n\n return iMdone; \n}", "function longestCollatzSequence(searchMax) {\n var n, i, j, len, path;\n //store known results, expect no more than 1 million records\n //improve search of 1,000,000 from 10 sec to 2 sec\n var memo = {1: 1};\n var maxLen = 1\n , maxNum = 1;\n for (i = 2; i < searchMax; i++) {\n n = i;\n path = [];\n while (true) {\n if (memo[n]) {\n //hit cache, remember 1 is already in the cache\n //so this is our exit of the while loop\n len = memo[n];\n break;\n }\n else {\n path.push(n);\n if (n % 2 === 0) {\n //even\n n = n / 2;\n }\n else {\n n = 3 * n + 1;\n }\n }\n }\n //unwind the stack, add to memo\n for (j = path.length - 1; j >= 0; j--) {\n len++;\n memo[path[j]] = len;\n }\n if (len > maxLen) {\n //save max result\n maxLen = len;\n maxNum = i;\n }\n }\n return maxNum;\n}", "function longestConsecutive(nums) {\n if (nums.length <= 1) {\n return nums.length;\n }\n\n const numbers = new Set(nums); // set has constant time access like map\n let longest = 0;\n\n for (let i = 0; i < nums.length; i++) {\n if (!numbers.has(nums[i] - 1)) {\n let length = 0;\n while (numbers.has(nums[i] + length)) {\n length++;\n }\n\n if (length > longest) longest = length;\n }\n }\n\n return longest;\n}", "function maxSumIncreasingSubsequence(array) {\n\tlet maxSeq = array.map(val => val);\n\tlet max = new Array(array.length).fill(null);\n\tlet maxIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tfor (let j = 0; j < i; j++) {\n\t\t\t\tif (array[i] > array[j] && maxSeq[j] + array[i] > maxSeq[i]) {\n\t\t\t\t\tmaxSeq[i] = maxSeq[j] + array[i];\n\t\t\t\t\tmax[i] = j;\n\t\t\t\t}\n\t\t}\n\t\tif (maxSeq[maxIdx] < maxSeq[i]) maxIdx = i;\n\t}\n\tlet result = [];\n\tlet maxValue = maxSeq[maxIdx];\n\twhile (maxIdx !== null) {\n\t\tresult.push(array[maxIdx]);\n\t\tmaxIdx = max[maxIdx];\n\t}\n\tlet reversedResult = result.reverse();\n\treturn [maxValue, reversedResult];\n}", "function longestCommonSubstring(string1, string2) {\n\t// Convert strings to arrays to treat unicode symbols length correctly.\n\t// For example:\n\t// '𐌵'.length === 2\n\t// [...'𐌵'].length === 1\n\tconst s1 = [...string1];\n\tconst s2 = [...string2];\n\n\t// Init the matrix of all substring lengths to use Dynamic Programming approach.\n\tconst substringMatrix = Array(s2.length + 1)\n\t\t.fill(null)\n\t\t.map(() => {\n\t\t\treturn Array(s1.length + 1).fill(null);\n\t\t});\n\n\t// Fill the first row and first column with zeros to provide initial values.\n\tfor (let columnIndex = 0; columnIndex <= s1.length; columnIndex += 1) {\n\t\tsubstringMatrix[0][columnIndex] = 0;\n\t}\n\n\tfor (let rowIndex = 0; rowIndex <= s2.length; rowIndex += 1) {\n\t\tsubstringMatrix[rowIndex][0] = 0;\n\t}\n\n\t// Build the matrix of all substring lengths to use Dynamic Programming approach.\n\tlet longestSubstringLength = 0;\n\tlet longestSubstringColumn = 0;\n\tlet longestSubstringRow = 0;\n\n\t//creates a table comparing each character in the strings\n\tfor (let rowIndex = 1; rowIndex <= s2.length; rowIndex += 1) {\n\t\tfor (let columnIndex = 1; columnIndex <= s1.length; columnIndex += 1) {\n\t\t\t//if (s1[columnIndex - 1] === s2[rowIndex - 1]) {\n\t\t\t//hack to change rowIndex to <= 6 since that was the longest substring...so it stops looking after the 6th match\n\t\t\tif (s1[columnIndex - 1] === s2[rowIndex - 1] && rowIndex <= 6) {\n\t\t\t\tsubstringMatrix[rowIndex][columnIndex] =\n\t\t\t\t\tsubstringMatrix[rowIndex - 1][columnIndex - 1] + 1;\n\t\t\t} else {\n\t\t\t\tsubstringMatrix[rowIndex][columnIndex] = 0;\n\t\t\t}\n\n\t\t\t// Try to find the biggest length of all common substring lengths\n\t\t\t// and to memorize its last character position (indices)\n\t\t\t// if (substringMatrix[rowIndex][columnIndex] > longestSubstringLength) {\n\t\t\tif (substringMatrix[rowIndex][columnIndex] > longestSubstringLength) {\n\t\t\t\tlongestSubstringLength = substringMatrix[rowIndex][columnIndex];\n\t\t\t\tlongestSubstringColumn = columnIndex;\n\t\t\t\tlongestSubstringRow = rowIndex;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (longestSubstringLength === 0) {\n\t\t// Longest common substring has not been found.\n\t\treturn \"\";\n\t}\n\n\t// Detect the longest substring from the matrix.\n\tlet longestSubstring = \"\";\n\n\twhile (substringMatrix[longestSubstringRow][longestSubstringColumn] > 0) {\n\t\t//\twhile (substringMatrix[longestSubstringRow][longestSubstringColumn] > 0 &&\tlongestSubstringRow <= 2) {\n\t\tlongestSubstring = s1[longestSubstringColumn - 1] + longestSubstring;\n\t\tlongestSubstringRow -= 1;\n\t\tlongestSubstringColumn -= 1;\n\t}\n\n\treturn longestSubstring;\n}", "function threeSum(nums, tar = 0) {\n let ret = [];\n let memo = new Set();\n nums.sort((a, b) => { return a - b });\n\n for (let k = 0; k < nums.length; k++) {\n let i = k + 1;\n let j = nums.length - 1;\n while (i < j) {\n let sum = nums[k] + nums[i] + nums[j];\n if (sum > tar)\n j--;\n else if (sum < tar)\n i++;\n else {\n if (!memo.has(`${nums[k]},${nums[i]},${nums[j]}`)) {\n ret.push([nums[k], nums[i], nums[j]]);\n memo.add(`${nums[k]},${nums[i]},${nums[j]}`)\n }\n i++;\n j--;\n }\n }\n }\n\n return ret;\n}", "function longestConsecutive(nums) {\n \n if(nums.length === 0) return 0;\n if(nums.length === 1) return 1;\n\n let longestConsecutiveSequenceNumber = [[]];\n let indexOfElement = 0;\n let maxLength = 0;\n \n nums = nums.sort((a,b) => a-b);\n noDuplicateNums = [];\n noDuplicateNums.push(nums[0]);\n\n for(let i = 1; i < nums.length; i++){\n if(nums[i - 1] !== nums[i]) {\n noDuplicateNums.push(nums[i]);\n }\n }\n\n longestConsecutiveSequenceNumber[0].push(noDuplicateNums[0]);\n \n for(let i = 1; i < noDuplicateNums.length; i++) {\n if(noDuplicateNums[i-1] + 1 !== noDuplicateNums[i]) {\n indexOfElement++;\n longestConsecutiveSequenceNumber.push([]);\n }\n longestConsecutiveSequenceNumber[indexOfElement].push(noDuplicateNums[i]);\n }\n \n longestConsecutiveSequenceNumber.forEach((seq) => {\n if (seq.length > maxLength) {\n maxLength = seq.length;\n };\n });\n \n return maxLength;\n}", "function tripletsOpt(arr, sum) {\n // sort the array in asc order\n arr = arr.sort((a, b) => a - b)\n let count = 0\n for (let i = 0; i < arr.length - 2; i++) {\n // set 2 corner pointers: \n // j starting from the idx next to i, k starting from the last idx\n let j = i + 1\n let k = arr.length - 1\n // Meet In the Middle concept:\n while (j < k) {\n if (arr[i] + arr[j] + arr[k] >= sum) {\n // if the current sum is largest than target sum,\n // move k to a smaller value\n k--\n } else {\n // otherwise, we found our target sum!\n // for current i and j, there are (k - j) third elements that meet our target\n count += (k - j)\n // increase j to find the next potential triplets\n j++\n }\n }\n }\n return count\n}", "function findSolution(arr) {\n const x = [];\n let longestSubArrayLength = 0;\n let subArrayLength = 0;\n for (i = 0; i < arr.length; i++) {\n if (x.includes(arr[i])) {\n if (subArrayLength > longestSubArrayLength) {\n longestSubArrayLength = subArrayLength;\n }\n subArrayLength = 1;\n x.length = 0;\n } else {\n x.push(arr[i]);\n subArrayLength += 1;\n }\n }\n return subArrayLength > longestSubArrayLength\n ? subArrayLength\n : longestSubArrayLength;\n}", "function longestIncreasingSubsequence(sequence){\n if (sequence.length === 1) return 1;\n let lengths = new Array(sequence.length).fill(1);\n\n for (let i = 1; i < sequence.length; i++){\n for (let j = 0; j < i; j++){\n const isIncreasing = sequence[j] < sequence[i];\n const sequenceLength = lengths[j] + 1\n const isLonger = sequenceLength > lengths[i]\n if (isIncreasing && isLonger){\n lengths[i] = sequenceLength;\n }\n }\n }\n return Math.max(...lengths);\n}", "function twoSum(a, sum){\n let cur_max =0, max_so_far = 0, result= [];\n cur_max = a[0];\n for(let i=0; i<a.length; i++){\n var diff = sum - a[i];\n var k = a.indexOf(diff);\n if(k > -1 && k !==i){\n result.push(i);\n result.push(k);\n }\n }\n return result;\n}", "function SearchingChallenge1(str) {\n const array = [...str];\n const k = Number(array.shift());\n\n let substring = [];\n let n = 1;\n\n let index = 0;\n\n let res = [];\n\n while (index < array.length) {\n if (substring === [] || substring.includes(array[index])) {\n substring.push(array[index]);\n index++;\n console.log(\"substring\", substring);\n } else if (!substring.includes(array[index]) && n <= k) {\n substring.push(array[index]);\n n++;\n index++;\n console.log(\"substring\", substring);\n } else {\n res.push(substring.join(\"\"));\n console.log(\"res during\", res);\n substring = [];\n n = 1;\n index--;\n console.log(\"substring after []\", substring.length);\n }\n }\n\n res.push(substring.join(\"\"));\n\n console.log(\"res final\", res);\n\n const lengths = res.map((e) => e.length);\n\n return res[lengths.indexOf(Math.max(...lengths))];\n}", "function bestSum(targetSum, numbers, memo = {}) {\n // Time complexity O(m^2*n)\n // Space complexity O(m^2)\n if (targetSum in memo) return memo[targetSum];\n if (targetSum === 0) return [];\n if (targetSum < 0) return null;\n let shortestCombination = null;\n\n for (const num of numbers) {\n const remainder = targetSum - num;\n const remainderResult = bestSum(remainder, numbers, memo);\n if (remainderResult !== null) {\n const combination = [...remainderResult, num];\n if (\n shortestCombination === null ||\n combination.length < shortestCombination.length\n )\n shortestCombination = combination;\n }\n }\n return (memo[targetSum] = shortestCombination && shortestCombination);\n}", "function s(nums) {\n let lo = 0;\n let hi = nums.length - 1;\n while (lo < hi) {\n const mid = Math.floor((hi + lo) / 2);\n if (nums[mid] > nums[hi]) {\n lo = mid + 1;\n } else if (nums[mid] === nums[hi]) {\n hi--;\n } else {\n hi = mid;\n }\n }\n return nums[lo];\n}", "function solution(S) {\n const a_indexes = findIndexesOfA(S);\n if (!a_indexes.length) return [...subsets(S.split(''), 3)].length; // all possible three groups\n if (a_indexes.length % 3) return 0; // not possible to split in three groups having same amount of 'a' chars\n // now we're sure that it can be splitted in three\n // and there are same number of 'a' chars in each group\n const measureUnit = a_indexes.length / 3;\n const firstGroupLastA = a_indexes[measureUnit - 1];\n const middleGroupFirstA = a_indexes[measureUnit];\n const middleGroupLastA = a_indexes[2 * measureUnit - 1];\n const lastGroupFirstA = a_indexes[2 * measureUnit];\n\n return (middleGroupFirstA - firstGroupLastA) * (lastGroupFirstA - middleGroupLastA);\n}", "function subarraySum(arr, k) {\n let left = 0;\n let right = 0;\n let maxCount = 0;\n let sum = arr[0];\n while (left <= right) {\n console.log(left, right);\n if (sum < k) {\n if (right < arr.length - 1) {\n right++;\n sum += arr[right];\n } else {\n sum -= arr[left];\n left++;\n }\n } else if (sum === k) {\n maxCount++;\n if (right < arr.length - 1) {\n sum -= arr[left];\n left++;\n right++;\n sum += arr[right];\n } else {\n sum -= arr[left];\n left++;\n }\n } else {\n if (right < arr.length - 1) {\n if (right == left) {\n sum -= arr[left];\n left++;\n right++;\n sum += arr[right];\n } else {\n sum -= arr[left];\n left++;\n }\n } else {\n sum -= arr[left];\n left++;\n }\n }\n // }\n }\n return maxCount;\n}", "function findLongestSubstring (s) {\n let win = s.length;\n while (win > 0) {\n let start = 0;\n while (start + win <= s.length) {\n const seen = new Set(s.slice(start, start + win));\n if (seen.size === win) {\n return win;\n }\n start += 1;\n }\n win -= 1;\n }\n return 0;\n}", "function countSubstringsDP(str) {\n const dp = Array(str.length);\n for (let i = 0; i < str.length; i++) {\n dp[i] = Array(str.length).fill(false);\n }\n\n let ans = 0;\n for (let i = 0; i < str.length; i++) {\n for (let j = i; j < str.length; j++) {\n if (i === j || (i - 1 >= 0 && j + 1 < str.length && dp[i - 1] && dp[i - 1][j + 1])) {\n dp[i][j] = true;\n } else dp[i][j] = checkPalindrome(str, i, j);\n\n if (dp[i][j]) ans++;\n }\n }\n return ans;\n}", "function maxCharacter(str) {\r\n final = new Array\r\n for(i = 0; i< str.length; i++)\r\n {\r\n contained = false\r\n for(j=0; j<final.length && !contained; j++)\r\n {\r\n if(final[j][0] === str[i])\r\n {\r\n final[j][1]++;\r\n contained=true;\r\n } \r\n \r\n }\r\n if(!contained)\r\n {\r\n a = [str[i], 1]\r\n final.push(a)\r\n } \r\n }\r\n\r\n let highest=['z',0];\r\n console.log(final)\r\n for(i=0; i<final.length; i++)\r\n {\r\n if(final[i][1] > highest[1])\r\n {\r\n highest[0] = final[i][0]\r\n highest[1] = final[i][1]\r\n }\r\n }\r\n return highest;\r\n}", "maxSubArray(arr) {\n const len = arr.length;\n if(len === 0) return 0;\n\n let maxSum = 0;\n for (let start = 0; start < len; start++) {\n for (let end = start; end < len; end++) {\n let sum = 0;\n for (let i = start; i <= end; i++) {\n sum += arr[i];\n }\n maxSum = Math.max(sum, maxSum);\n }\n }\n return maxSum;\n }", "function isSumPossible(a, n, z) {\n var iMdone = 0,\n len = a.length;\n\n if (len < z || z < 0) {\n return iMdone;\n }\n if (len === z) {\n var sum = 0;\n for (var i=0; i<len; i+=1){\n sum += a[i];\n }\n return sum === n ? 1 : 0;\n }\n\n var val, arr;\n var Node = function(length, level, parent) {\n return {\n length: length !== null ? length : null,\n level: level || 1,\n parent: parent || null\n }\n };\n var proceedNode = function(array, parent) {\n var innerVal, innerArr;\n if (iMdone) {\n return;\n }\n if (parent.length === n && parent.level === z) {\n iMdone = 1;\n return;\n }\n if (parent && parent.level < z && parent.length <= n) {\n for (var i=0, l=array.length; i<l; i+=1) {\n innerVal = array[i];\n if (parent.level + 1 === z && parent.length + innerVal === n) {\n iMdone = 1;\n break;\n } else if (parent.length + innerVal > n) {\n break;\n }\n innerArr = array.slice(0);\n innerArr.splice(i, 1);\n proceedNode(innerArr, new Node(parent.length + innerVal, parent.level + 1, parent));\n }\n }\n };\n\n for (var i=0, l=a.length; i<l; i+=1) {\n val = a[i];\n if (iMdone) {\n break;\n }\n arr = a.slice(0);\n arr.splice(i, 1);\n proceedNode(arr, new Node(val, null, null));\n }\n\n return iMdone;\n}", "function find() {\n var array = [3, \"a\", \"a\", \"a\", 2, 3, \"a\", 3, \"a\", 2, 4, 9, 3];\n var mostFrequent = 1;\n var m = 0;\n var item;\n for (var i = 0; i < array.length; i++) {\n for (var j = i; j < array.length; j++) {\n if (array[i] == array[j]) {\n m++;\n }\n if (mostFrequent < m) {\n mostFrequent = m;\n item = array[i];\n }\n }\n m = 0;\n }\n return item + \" ( \" + mostFrequent + \" times ) \";\n}", "function solution(A) {\n \n let maxEnding = [];\n maxEnding.push(0);\n \n let maxBeginning = [];\n maxBeginning[A.length-1] = 0\n \n for (let i = 1; i < A.length-2; i++){\n maxEnding[i] = Math.max(0, maxEnding[i-1]+A[i]);\n }\n \n for (let i = A.length-2; i >= 2; i--){\n maxBeginning[i] = Math.max(0, maxBeginning[i+1]+A[i]);\n }\n \n let maxSum = 0;\n for (let i = 0; i < A.length-2; i++){\n let sum = maxEnding[i] + maxBeginning[i+2];\n if (sum > maxSum){\n maxSum = sum;\n }\n }\n \n return maxSum;\n}", "function solve(s) {\n let subStrings = [];\n for (let index = 0; index < s.length; index++) {\n for (let index2 = index; index2 < s.length; index2++) {\n let subString = s.slice(index, index2 + 1);\n subStrings.push(subString);\n }\n }\n return subStrings.reduce((count, subStr) => {\n if (Number(subStr) % 2 === 1) {\n count += 1;\n }\n return count;\n }, 0);\n}", "function maxSubarraySum2(arr, num){\r\n if(arr.length < num){\r\n return false;\r\n }\r\n\r\n let total = 0;\r\n\r\n for (let i = 0; i < num; i++){\r\n total += arr[i];\r\n }\r\n\r\n let currentTotal = total;\r\n\r\n for (let i = num; i < arr.length; i++){\r\n currentTotal += arr[i] - arr[i - num];\r\n total = Math.max(total, currentTotal);\r\n }\r\n\r\n return total;\r\n}", "function maxSubarraySum3(arr, num) {\n if (arr.length < num) return null;\n let maxSum = 0;\n let tempSum = 0;\n\n for (let i = 0; i < num; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for (let i = 0; i < arr.length; i++) {\n tempSum = tempSum - arr[i] + arr[i + num];\n if (tempSum > maxSum) maxSum = tempSum;\n }\n\n return maxSum;\n}", "function allPossibilities (input, memo = {}) {\n const key = input.join(',')\n // by having this memo as a look up, you don't have to calculate\n // possibilities that have already been calculated previsouly\n if (key in memo) {\n return memo[key]\n }\n\n let result = 1\n\n // can't remove starting outlet (0) or ending outlet\n for (let i = 1; i < input.length - 1; i++) {\n const previous = input[i - 1]\n const next = input[i + 1]\n if (next - previous <= 3) {\n // remove the current number in the array if within 3 jolts\n // and get all possible combinations of the rest of the array\n const combination = [previous].concat(input.slice(i + 1))\n result += allPossibilities(combination, memo)\n }\n }\n // on completed recursion save result (a number of combinations)\n // the key is the possible items in the array and result is the number combinations for that array\n memo[key] = result\n // console.log(memo)\n return result\n}", "function maxSubArray(arr) {\n let results = [];\n let sums = [];\n for (var start = 0; start < arr.length; start++) {\n for (var end = 0; end < arr.length; end++) {\n if (end >= start) {\n results.push(arr.slice(start, end + 1));\n console.log(\"start=\", start, \"end=\", end, arr.slice(start, end + 1));\n }\n }\n }\n for (subarr in results) {\n sums.push(results[subarr].reduce((a, b) => a + b, 0));\n }\n sums.sort((a, b) => a - b);\n return sums[sums.length - 1];\n}", "function solution(A) {\n\n A.sort();\n for (let i = 0;i < A.length; i++) {\n let br = 1;\n while(A[i] === A[i + 1]) {\n i++;\n br++;\n }\n if(br%2 !== 0){\n return A[i];\n }\n }\n return A[A.length - 1];\n}", "function candies(n, arr) {\n let candiesArr = Array.apply(null, Array(arr.length)).map((el) => 1);\n\n let i = 0;\n\n while(i < arr.length) {\n if(arr[i - 1] && arr[i] > arr[i - 1] && candiesArr[i] <= candiesArr[i - 1]) {\n candiesArr[i] = Math.max(candiesArr[i - 1] + 1, candiesArr[i]);\n } else if(arr[i + 1] && arr[i] > arr[i + 1] && candiesArr[i] <= candiesArr[i + 1]) {\n candiesArr[i] = Math.max(candiesArr[i + 1] + 1, candiesArr[i]);\n } else if(arr[i - 1] && arr[i] < arr[i - 1] && candiesArr[i] >= candiesArr[i - 1]) {\n i--;\n } else {\n i++;\n }\n }\n\n return candiesArr.reduce((sum, a) => sum + a, 0);\n}", "function lcs(n) {\n var startSum = 0;\n var largestSum = n[0];\n\n for (var i = 0; i < n.length; i++) {\n\n startSum += n[i];\n if (startSum < 0) {\n startSum = 0;\n }\n\n if (largestSum < startSum) {\n largestSum = startSum;\n }\n }\n return largestSum;\n}", "function solution(a) { // O(N)\n let max1; // O(1)\n let max2; // O(1)\n\n for (let value of a) { // O(N)\n if (!max1) { // O(1)\n max1 = value; // O(1)\n } else if (value > max1) { // O(1)\n max2 = max1; // O(1)\n max1 = value; // O(1)\n } else if (value < max1) { // O(1)\n if (!max2) { // O(1)\n max2 = value; // O(1)\n } else if (value > max2) { // O(1)\n max2 = value; // O(1)\n }\n }\n }\n\n return max2; // O(1)\n}", "function exercise6b(arr, s, n) {\n var count = 0;\n var exists = false;\n arr.forEach(function(value) {\n if (value === s)\n count = count + 1;\n });\n if (count >= n)\n exists = true;\n return exists;\n }", "function maxSubsetSumNoAdjacent(array) {\n // Write your code here.\n if (array.length === 0) {\n return 0;\n }\n if (array.length === 1) {\n return array[0];\n }\n var second = array[0];\n var first = Math.max(array[0], array[1]);\n var temp;\n for (var i = 2; i < array.length; i++) {\n temp = Math.max(first, second + array[i]);\n second = first;\n first = temp;\n }\n return first;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n if (A.length == 1)\n return A[0];\n \n A.sort();\n while (A.length > 0) {\n var a = A.pop();\n var b = A[A.length-1];\n if (a != b)\n return a;\n A.pop(); \n } \n}", "function longestSubstring(s) {\n let maxSub = 0,\n visited = {};\n for (let i = 0, j = 0; i < s.length; i++) {\n if (visited.hasOwnProperty(s[i])) {\n j = Math.max(j, visited[s[i]] + 1);\n }\n visited[s[i]] = i;\n let currMax = i - j + 1;\n maxSub = Math.max(maxSub, currMax);\n }\n return maxSub;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n A.sort((a,b)=>(a-b));\n let count = 0;\n for(let i = 0; i< A.length-2; i++){\n let leftIndex = i+1;\n let rightIndex = i+2;\n while(leftIndex<A.length-1){\n if(A[i]+A[leftIndex]>A[rightIndex] && rightIndex<A.length){\n rightIndex++;\n }else{\n count = count + (rightIndex-leftIndex-1);\n leftIndex++;\n }\n }\n }\n return count;\n}", "function twoSum(numsArr, target) {\n // more basic code\n\n // for (let i = 0; i < numsArr.length; i++) {\n\n // for (let j = 0; j < numsArr.length; j++) {\n // if(i != j){\n // if (numsArr[i] + numsArr[j] == target) {\n // return [i, j];\n // }\n // }\n // }\n // }\n\n // faster code\n var sumPartners = {};\n for(var i = 0; i < nums.length; i++) {\n sumPartners[target - nums[i]] = i;\n if (sumPartners[nums[i]] && sumPartners[nums[i]] !== i) {\n return [sumPartners[nums[i]], i];\n }\n }\n \n for(var j = 0; j < nums.length; j++) {\n if (sumPartners[nums[j]] && sumPartners[nums[j]] !== j) {\n return [j, sumPartners[nums[j]]];\n }\n }\n}", "function sumFinder2(arr, sum) {\n var len = arr.length,\n substract;\n for(var i =0; i<len; i++) {\n substract = sum - arr[i];\n if ((array.indexOf(substract) > -1) && (substract !== arr[i])) {\n return true;\n }\n }\n return false;\n}", "function threeSum(arr) {\n let firVal = arr.shift(); //take out first element in array, store in variable \n let result = false; //set result to true, only change if 3 distinct elements can sum up to firVal\n arr = arr.sort((a, b) => a - b) //sort arr ascending \n\n \n for (let i = 0; i < arr.length - 2; i += 1) { //loop though arr \n let s = i + 1; //s = start of array + 1\n let e = arr.length - 1; //e = end of array \n\n while (s < e) { //Continue as long as the start variable is less than end variable \n if(arr[s] + arr[e] + arr[i] === firVal){ result = true; break; } //Only enter if all three nums add up to firVal\n else if(arr[s] + arr[e] + arr[i] < firVal){ s++ } //if all three nums add up to less than firVal, increment s\n else{ e-- } //else decrement e\n }//end of while loop\n }\n return result; //return 'true' if 3 distinct elements sum to the first element, otherwise return false\n}", "function findConsqSums(arr, k) {\n let sol=[]\n let lptr=0;\n let rptr=0;\n while(sum(arr,lptr,rptr)<k){\n rptr++;\n }\n while (lptr<arr.length){\n let s=sum(arr,lptr,((rptr<arr.length)?rptr:arr.length-1))\n if(s==k){\n sol.push(arr.slice(lptr, rptr+1))\n rptr++;\n while(arr[rptr]===0){\n sol.push(arr.slice(lptr, rptr+1))\n rptr++;\n console.log(\"inner\",sum(arr,lptr,rptr))\n }\n }\n else if(s>k){\n lptr++;\n }\n else if(s<k){\n if(rptr<arr.length){\n rptr++;\n }\n else{\n break;\n }\n }\n console.log(\"outer\",sum(arr,lptr,rptr))\n }\n return sol;\n}", "function secondBig (a) {\n if (process.argv.length <= 3) {\n return 0;\n } else {\n a.sort((x, y) => x - y);\n a.pop();\n return (a.pop());\n }\n}", "function solution(list) {\n let result = [];\n let queue = [list[0]];\n \n function flush() {\n if (queue.length > 2) {\n result.push(`${queue.shift()}-${queue.pop()}`);\n } else {\n result = result.concat(queue);\n }\n queue = [];\n }\n \n for (let i = 1; i < list.length; i += 1) {\n if ((list[i - 1] + 1) !== list[i]) {\n flush();\n }\n queue.push(list[i]);\n }\n flush();\n \n return result.join(',');\n}", "function findLongestSubString(string) {\n if (string.length === 0) return 0\n\n let set = new Set()\n let left = 0\n let right = 0\n let maxLen = 1\n\n while (right < string.length) {\n if (!set.has(string[right])) {\n set.add(string[right])\n maxLen = Math.max(maxLen, right - left + 1)\n right++\n } else if (set.has(string[right]) && string[right] === string[left]) {\n left++\n right++\n } else {\n set.delete(string[left])\n left++\n }\n }\n return maxLen\n}", "function maxSub(arr,num){\n if(num > arr.length){\n return null;\n }\n\n var max = -Infinity\n\n for(let i=0; i < arr.length - num + 1; i++){\n temp = 0;\n for(let j=0; j < num; j++){\n //j < num means we want to look ahead by 3 elements\n temp += arr[i+j];\n }\n if(temp > max){\n max = temp;\n }\n }\n\nreturn max;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n A = A.sort((a,b) => a - b);\n var arrayLength = A.length;\n var cur = A[0];\n var curlength = 1;\n for(var i = 1; i < arrayLength; i ++ ){\n if(cur == A[i]){\n curlength += 1;\n }else{\n if(curlength % 2 == 1){\n break;\n }else{\n cur = A[i];\n curlength = 1;\n }\n }\n }\n return cur;\n}", "function maxSubarraySum2(arr, n) {\n if (arr.length < n) return null;\n let max = 0;\n let temp = 0;\n\n for (let i = 0; i < n; i++) {\n max += arr[i];\n }\n\n t = max;\n\n for (let i = n; i < arr.length; i++) {\n t = t - arr[i - n] + arr[i];\n max = Math.max(max, t);\n }\n\n return max;\n\n}", "function solution2(array, targetSum) {\n array.sort((a,b) => a -b );\n const result = [];\n for (let i = 0; i < array.length; i++) {\n let x = array[i];\n let leftPtr = i + 1;\n let rightPtr = array.length - 1;\n \n while (leftPtr < rightPtr) {\n let y = array[leftPtr];\n let z = array[rightPtr];\n let currentSum = x + y + z;\n if (currentSum === targetSum) {\n result.push([x, y , z]);\n leftPtr++;\n rightPtr = array.length - 1;\n } else if (currentSum < targetSum) {\n leftPtr++;\n } else if (currentSum > targetSum) {\n rightPtr--;\n }\n }\n }\n\n return result;\n }", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n B = A.slice();\n A.sort();\n var candidate = A[Math.floor(A.length / 2)];\n var count = 0;\n var index = -1;\n for (var i = 0; i < B.length; i++) {\n if (B[i] == candidate) {\n count++;\n index = i;\n }\n }\n if (count > B.length / 2) return index;\n else return -1;\n}", "function findLongestArraySnippetBasedOnSum(s, arr) {\n\n}", "function maxSubsetSum(arr) {\n if (arr.length === 1)\n return arr[0];\n else if (arr.length === 2)\n return Math.max(arr[0], arr[1]);\n\n // iterationResult used to save iteration result of arr (from back)\n // index 0 means the result for the last number, index 1 means the result for the last 2 numbers, etc.\n let lastIndex = arr.length - 1;\n let iterationResult = [arr[lastIndex], Math.max(arr[lastIndex], arr[lastIndex - 1])];\n\n while (iterationResult.length !== arr.length) {\n let nextNumber = arr[arr.length - 1 - iterationResult.length];\n let lastIdx = iterationResult.length - 1, nextResult;\n nextResult = Math.max(nextNumber, nextNumber + iterationResult[lastIdx - 1], iterationResult[lastIdx]);\n iterationResult.push(nextResult);\n }\n\n return iterationResult[iterationResult.length - 1];\n}", "function subsetsWithDups2( nums ) {\n nums.sort( ( a, b ) => a - b ); // Sort for duplicate checking\n\n const backtrack = ( subsets, partial, offset ) => {\n const completeSubset = Array.prototype.concat.call( partial );\n subsets.push( completeSubset );\n for ( let i = offset; i < nums.length; i++ ) {\n if ( i > offset && nums[i] === nums[i-1] ) {\n continue;\n }\n partial.push( nums[i] );\n backtrack( subsets, partial, i+1 );\n partial.pop();\n }\n return subsets;\n };\n\n return backtrack( [], [], 0 );\n}", "function secondLargest(array) {\n if(array <= 0 || !Array.isArray(array)) return undefined;\n let filteredNum = [...new Set(array)].filter(e => /\\d+$/.test(e)).map(e => e).sort((a, b) => b - a)[1];\n if(array.every((e, i, arr) => e === arr[0])) return undefined\n return +filteredNum;\n}" ]
[ "0.7232479", "0.688215", "0.60438263", "0.59723204", "0.59661424", "0.59362054", "0.58410186", "0.58243066", "0.5799806", "0.57910436", "0.5728125", "0.5725404", "0.57239693", "0.57215697", "0.5718321", "0.57033706", "0.56951517", "0.5678769", "0.5670136", "0.5648168", "0.5634795", "0.5634451", "0.5606341", "0.5591092", "0.5568155", "0.55632234", "0.55576307", "0.55558074", "0.5528297", "0.55262935", "0.5519485", "0.55145115", "0.5489694", "0.5477524", "0.54747313", "0.54387677", "0.5417594", "0.5411976", "0.540434", "0.5402509", "0.53947955", "0.5391072", "0.53898066", "0.53842497", "0.5381429", "0.53756505", "0.5368515", "0.5364558", "0.5355591", "0.5355019", "0.5350663", "0.5340094", "0.53285444", "0.5320221", "0.53198665", "0.53138614", "0.53098977", "0.53046113", "0.5294996", "0.52937263", "0.52922136", "0.5283537", "0.52824855", "0.52750444", "0.5271318", "0.52671665", "0.52671295", "0.5266517", "0.52656895", "0.5262671", "0.52588695", "0.5257514", "0.5255945", "0.52505034", "0.5249317", "0.52404034", "0.52370614", "0.52349746", "0.52317107", "0.52258724", "0.5222627", "0.5222454", "0.5214947", "0.5207795", "0.5205994", "0.52010846", "0.5199981", "0.51998585", "0.5195427", "0.51870257", "0.51859397", "0.5185875", "0.5183084", "0.51828426", "0.51802516", "0.51801336", "0.51798683", "0.5179433", "0.5178024", "0.5177735" ]
0.5605692
23
declaring variables for position, animation frames, and time
constructor(){ this.x = 100; this.y = 100; this.frameHeight = 53; this.frameWidth = 64; this.currentFrameX = 23; this.currentFrameY = 16; this.spriteSheet; this.currentFrameNum = 1; this.time = 0; this.timeUntilLast = 0; this.timeFromLast = 0; this.animationTime = 50; this.maxFrame = 6; this.startTime; this.lifeTime; this.alive = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animations() {\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tif (arthur.goRight) {\n\t\tarthur.srcY = arthur.goRowRight * arthur.height;\n\t} else if (arthur.goLeft) {\n\t\tarthur.srcY = arthur.goRowLeft * arthur.height;\n\t} else if (arthur.duckRight) {\n\t\tarthur.srcY = arthur.duckRowRight * arthur.height;\n\t} else if (arthur.atkRight) {\n\t\tarthur.srcY = arthur.atkRowRight * arthur.height;\n\t} else if (arthur.jumpRight) {\n\t\tarthur.srcY = arthur.jumpRowRight * arthur.height;\n\t} else if (arthur.die) {\n\t\tarthur.srcY = arthur.dieRowRight * arthur.height;\n\t}\n}", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "putAnimationBoxes() {\n let cf = this.working_model.frames[this.current_frame];\n\n this.animation_display.selection = {\n x: cf.x,\n y: cf.y,\n w: cf.width,\n h: cf.height\n };\n this.animation_display.sprite_origin = {\n x: cf.offset_x,\n y: cf.offset_y\n };\n }", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function initAnimation() {\n}", "function updateState() {\n animationState.time += guiParams.deltaT;\n var state = setBallPosition(animationState.time);\n animationState.ballPositionX = state[0];\n animationState.ballHeight = state[1];\n}", "function startAnimating() {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n}", "toStartingPosition() {\n\n for (let i = 0; i < this.frameCount; i++) {\n const frame = this[`frame${i}`];\n this.xLoc = 376;\n frame.style.left = `${this.xLoc}px`;\n this.yLoc = 512;\n frame.style.top = `${this.yLoc}px`;\n }\n\n }", "function Legato_Animation( element, run_time )\r\n{\r\n\r\n\t// Store the values.\r\n\tthis.element = $( element );\r\n\tthis.element_properties = Object();\r\n\tthis.run_time = run_time;\r\n\tthis.controller = new Legato_Animation_Controller();\r\n\r\n\tthis.onStart = null;\r\n\tthis.onInterval = null;\r\n\tthis.onAdvance = null;\r\n\tthis.onEventFrame = null;\r\n\tthis.onStop = null;\r\n\tthis.onFinish = null;\r\n\r\n\t// These values are used by the Legato_Animation system internally.\r\n\tthis.status = false;\r\n\tthis.event_frames = new Array();\r\n\r\n\tthis.start_time = null;\r\n\tthis.current_time = null;\r\n\r\n\tthis.begin_width = null;\r\n\tthis.begin_height = null;\r\n\tthis.begin_pos = null;\r\n\tthis.begin_back_color = null;\r\n\tthis.begin_border_color = null;\r\n\tthis.begin_text_color = null;\r\n\tthis.begin_opacity = null;\r\n\r\n\tthis.offset_width = null;\r\n\tthis.offset_height = null;\r\n\tthis.offset_pos = new Legato_Structure_Point();\r\n\tthis.offset_back_color = new Legato_Structure_Color();\r\n\tthis.offset_border_color = new Legato_Structure_Color();\r\n\tthis.offset_text_color = new Legato_Structure_Color();\r\n\tthis.offset_opacity = null;\r\n\r\n\tthis.desired_width = null;\r\n\tthis.desired_height = null;\r\n\tthis.desired_pos = new Legato_Structure_Point();\r\n\tthis.desired_back_color = null;\r\n\tthis.desired_border_color = null;\r\n\tthis.desired_text_color = null;\r\n\tthis.desired_opacity = null;\r\n\r\n}", "hadouken(){\n this.state = \"hadouken\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 2348;\n this.frameHeight = 109;\n this.frameWidth = 125;\n this.maxFrame = 8;\n hadouken1.startTime = millis();\n }", "animation() {}", "function setUpAnim(){\r\n\tanimInstruction = animInstructionsRaw.split(',');\r\n\tanimCurrentInst = 0;\r\n\tmainInput.style.display = \"none\";\r\n\t//\t\tcreate 10 placerholder arrays for points on each line\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\t\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n}", "startAnimating(fps){\n this.fpsInterval = 1000 / fps;\n this.then = Date.now();\n this.animate();\n }", "function frame() {\n //console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos++; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function timerStart() {\n position = 1;\n}", "function AnimationParser() {}", "constructor(x, color, translationRate) {\n // Position properties\n this.x = x;\n this.y = 0;\n // Display properties\n this.color = color;\n this.width = 500;\n this.height = 600;\n // Moving properties\n this.translationRate = translationRate;\n this.ninthFrameX = 4500; // offsetTargetX + timeFrameInterval * 9\n this.resetX = -500;\n }", "function frame() {\n console.log(\"zaim\");\n if (pos == z) {\n clearInterval(id);\n } else {\n pos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = pos+\"px\"; \n x=pos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "constructor(type,movement,shoot,x,y)\r\n\t{\r\n\t\tif(type == 10)type = 9;\r\n\t\tthis.type = type;\r\n\t\tthis.movementAI = movement;\r\n\t\tthis.shootAI = shoot;\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.life = 1000;\r\n\t\tthis.angle = 0;\r\n\t\tthis.frameCount = 0;\r\n\r\n\t\tthis.type = type;\r\n\t\tthis.drawing = type;\r\n\t\tthis.speed = 1;\r\n\t\tthis.tookSmallThisFrame = false\r\n\t\tswitch(type)\r\n\t\t{\r\n\t\t\tcase 0:\r\n\t\t\t\tthis.life = 99999;\r\n\t\t\t\tthis.drawing = 12;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\tthis.life = 500;\r\n\t\t\t\tthis.drawing = 1;\r\n\t\t\t\tthis.speed = 0.5;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tthis.life = 1000;\r\n\t\t\t\tthis.drawing = 2;\r\n\t\t\t\tthis.speed = 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tthis.life = 100;\r\n\t\t\t\tthis.drawing = 3;\r\n\t\t\t\tthis.speed = 1.9;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tthis.life = 1000;\r\n\t\t\t\tthis.drawing = 4;\r\n\t\t\t\tthis.speed = 0.2;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 5:\r\n\t\t\t\tthis.life = 1500;\r\n\t\t\t\tthis.drawing = 5;\r\n\t\t\t\tthis.speed = 1.4;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 6:\r\n\t\t\t\tthis.life = 3000;\r\n\t\t\t\tthis.drawing = 6;\r\n\t\t\t\tthis.speed = 0.8;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 7:\r\n\t\t\t\tthis.life = 2500;\r\n\t\t\t\tthis.drawing = 7;\r\n\t\t\t\tthis.speed = 0.7;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 8:\r\n\t\t\t\tthis.life = 3000;\r\n\t\t\t\tthis.drawing = 8;\r\n\t\t\t\tthis.speed = 1.5;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 9:\r\n\t\t\t\tthis.life = 3000;\r\n\t\t\t\tthis.drawing = 9;\r\n\t\t\t\tthis.speed = 1.5;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 11:\r\n\t\t\t\tthis.life = 5000;\r\n\t\t\t\tthis.drawing = 11;\r\n\t\t\t\tthis.speed = 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 12:\r\n\t\t\t\tthis.life = 15000;\r\n\t\t\t\tthis.drawing = 12;\r\n\t\t\t\tthis.speed = 1;\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\t\tthis.speed /=2;\r\n\t\tthis.fireRate = (shoot%4)*(shoot%4)+1;\r\n\t\tthis.fireType = Math.floor(shoot/4);\r\n\t\tthis.mustRemove = false;\r\n\t\tthis.tookDamage = 0;\r\n\t\tthis.maxTookDamage = 0;\r\n\t\tthis.hit = new Hitbox();\r\n\t\tthis.movementTarget = null;\r\n\t}", "function position(time) {\n return { measure: 0, beat: 0, delay: 0};\n}", "function animationSetUp() {\n // Pacman's frames\n for (let i = 0; i < 5; i++) {\n for (let j = 0; j < 4; j++) {\n let frame = pacmanImg.get(j * 32, i * 32, 32, 32)\n pacmanFrames.push(frame)\n }\n }\n\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 2; j++) {\n leftImages.push(leftGhosts.get(j * 32, i * 32, 32, 32))\n rightImages.push(rightGhosts.get(j * 32, i * 32, 32, 32))\n upImages.push(upGhosts.get(j * 32, i * 32, 32, 32))\n downImages.push(downGhosts.get(j * 32, i * 32, 32, 32))\n }\n }\n}", "function Animator (args) {\n\t\targs = args || {};\n\n\t \tthis.easing = args.easing || function (t) { return t }; // default to linear easing\n\t \tthis.start_pos = args.start || 0;\n\t \tthis.end_pos = args.end || 1;\n\t \tthis.ratio = args.ratio || 0.25; // ratio to total animation --> normalize to 1\n\t \tthis.msec = args.msec || 1000; // default to 1000msec --> 1s\n\t \tthis.order = args.order || 0;\n\n\t \t// Called Flag\n\t \tthis.started = false;\n\n\t \t// Value to be returned\n\t \tthis.value = this.start_pos;\n\n\t \t// Global (local) reference to 'this'\n\t \tvar _this = this;\n\n\t\t// performance.now is guaranteed to increase and gives sub-millisecond resolution\n\t\t// Date.now is susceptible to system clock changes and gives some number of milliseconds resolution\n\t\t_this.start = window.performance.now(); \n\t\tvar delta = _this.end_pos - _this.start_pos; // displacement\n\n\t\tfunction frame() {\n\t\t\tvar now = window.performance.now();\n\t\t\tvar t = (now - _this.start) / _this.msec; // normalize to 0..1\n\n\t\t\tif (t >= 1) { // if animation complete or running over\n\t\t\t\t_this.value = _this.end_pos; // ensure the animation terminates in the specified state\n\t\t\t \treturn;\n\t\t\t}\n\n\t\t\tvar proportion = _this.easing(t); // Call upon the strange magic of your timing function\n\t\t\t\n\t\t\t// delta is our multiplier | this decides our current position relative to starting position\n\t\t\t// update your animation based on this value\n\t\t\t// trig functions are naturally really excited about this,\n\t\t\t// Can I make the whole thing less imperitive? --> Stateless?\n\n\t\t\t_this.value = _this.start_pos + proportion * delta; \t\n\t\t\trequestAnimationFrame(frame); // next frame!\n\t\t}\n\n\t\tthis.animate = function() {\n\t\t\t_this.started = true;\n\t\t\t_this.start = window.performance.now();\n\t\t\trequestAnimationFrame(frame); // you can use setInterval, but this will give a smoother animation --> Call it the first time and it loops forever until return\n\t\t}\n\t}", "function defineVars(){\n isFirstMove = true;\n isFinished = false;\n currColor = \"#ff0000\";\n initHex = 0xFF0000;\n numberMovement = n + 1;\n round = 0;\n side = 0;\n repCounter = 0;\n defineMatrix();\n}", "function frame(){\t\n\tvar t_step = secondsPerAnimatingMillisecond * animationStep;\n\tif(elapsedVirtualTime == 0){ // half step approx\n\t\tt_step = t_step / 2;\n\t\taccel();\n\t\tvel(t_step);\n\t} else {\n\t\tpos(t_step);\n\t\taccel();\n\t\tvel(t_step);\n\t\tredrawCanvas();\n\t}\n\t\n\telapsedVirtualTime += t_step;\n}", "timerPosition() {\n this.scene.translate(0,1,0.25);\n this.scene.scale(0.1,0.1,0.1);\n this.scene.rotate(Math.PI/2, 0, 1, 0);\n }", "animateToLocation(x_, y_, time_){\n let time = time_ || 1000;\n let x = x_ || 0;\n let y = y_ || 0;\n this.position.x = x;\n this.position.y = y;\n this.juggler.animate(time, \">\", 0).move(x,y);\n }", "pos2frame(pos) {\n\n }", "stationaryState(){\n this.state = \"stationary\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 0;\n this.frameHeight = 112;\n this.frameWidth = 79;\n this.maxFrame = 9;\n }", "function animation_play() {\n if (animationState.mode === 'play' || !pointFeature.data()) {\n return;\n }\n var data = pointFeature.data(),\n datalen = data.length;\n if (!datalen) {\n return;\n }\n animationState.duration = 15000; // in milliseconds\n if (animationState.position === undefined || animationState.position === null) {\n animationState.position = 0;\n }\n animationState.startTime = Date.now() - animationState.duration * animationState.position;\n if (!animationState.styleArrays || datalen !== animationState.order.length) {\n animationState.order = new Array(datalen);\n if (!animationState.orderedData) {\n var posFunc = pointFeature.position(), posVal, i;\n // sort our data by x so we get a visual ripple across it\n for (i = 0; i < datalen; i += 1) {\n posVal = posFunc(data[i], i);\n animationState.order[i] = {i: i, x: posVal.x, y: posVal.y};\n }\n animationState.order = animationState.order.sort(function (a, b) {\n if (a.x !== b.x) { return b.x - a.x; }\n if (a.y !== b.y) { return b.y - a.y; }\n return b.i - a.i;\n }).map(function (val) {\n return val.i;\n });\n } else {\n for (i = 0; i < datalen; i += 1) {\n animationState.order[i] = i;\n }\n }\n animationState.styleArrays = {\n p: new Array(datalen),\n radius: new Array(datalen),\n fill: new Array(datalen),\n fillColor: new Array(datalen),\n fillOpacity: new Array(datalen),\n stroke: new Array(datalen),\n strokeColor: new Array(datalen),\n strokeOpacity: new Array(datalen),\n strokeWidth: new Array(datalen)\n };\n for (i = 0; i < datalen; i += 1) {\n animationState.styleArrays.fillColor[i] = {r: 0, g: 0, b: 0};\n animationState.styleArrays.strokeColor[i] = {r: 0, g: 0, b: 0};\n }\n }\n animationState.mode = 'play';\n animation_frame();\n }", "function frame() {\n console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "setup() {\n\t\t\tspeed = 5;\n\t\t\tposition = new Vector2D(this.canvas.width/2, this.canvas.height/2);\n\t\t}", "function AnimationMetadata() { }", "function AnimationMetadata() { }", "getAnimationBoxes() {\n let sel = this.animation_display.selection;\n let ori = this.animation_display.sprite_origin;\n\n let f = {\n x: sel.x,\n y: sel.y,\n width: sel.w,\n height: sel.h,\n offset_x: ori.x,\n offset_y: ori.y\n };\n\n this.working_model.frames[this.current_frame] = f;\n }", "function animation() {\n\t\t\t\t// track time\n\t\t\t\tcurrent = Date.now();\n\t\t\t\telapsed = (current - lastTime) / 1000;\n\t\t\t\tif (elapsed > max_elapsed_wait) {\n\t\t\t\t\telapsed = max_elapsed_wait;\n\t\t\t\t}\n\n\n\t\t\t\tif (counter_time > time_step) {\n\n\n\n\t\t\t\t}\n\t\t\t\t//METEORITOS\n\t\t\t\tif(ygrados>-100000 && temp==1){\n\t\t\t\t\tygrados = ygrados - 0.01 * 70;\n\n\t\t\t\t\tmono.setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.translate(new CG.Vector3(10,0,250)),CG.Matrix4.scale(new CG.Vector3(3,3,3))),CG.Matrix4.rotateY((Math.radians(ygrados)))));\n\t\t\t\t\tgeometry[0].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(0,0,-1))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\n\t\t\t\t\tgeometry[4].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(10,0,30))),CG.Matrix4.rotateZ((Math.radians(ygrados)))))\n\n\n\t\t\t\t\tgeometry[5].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(50,0,-50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[7].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(80,40,-50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[8].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(30,20,50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[9].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(50,-80,20))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[10].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(70,-150,-20))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[11].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(20,100,-70))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[12].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(20,10,-50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\n\t\t\t\t\tgeometry[13].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(80,60,-20))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t}\n\n\n\t\t\t\tdraw();\n\t\t\t\tcounter_time = 0;\n\t\t\t}", "static fromFrames(frames) {\nvar anim;\n//----------\nanim = new CASAnimation();\nanim.setFromFrames(frames);\nreturn anim;\n}", "function updateAnimationFrames() {\n\tdragon1 = document.getElementById('dragon1');\n\tdragon2 = document.getElementById('dragon2');\n\tdragon1.innerHTML = \"<img src='img/d1\" + state1 + x + \".svg'/>\";\n\tdragon2.innerHTML = \"<img src='img/d2\" + state2 + x + \".svg'/>\";\n\tif (r == false && x < 9) {\n\t\tx++;\n\t}\n\tif (r == true && x >= 0) {\n\t\tx--;\n\t}\n\tif (x == 9 ) {\n\t\tr = true;\n\t}\n\tif (x == 0) {\n\t\tr = false;\n\t}\n}", "function SetFrame() {\n\n if (isPlaying) setTimeout(SetFrame, 1000 / fps);\n\n // Element offset positioning\n pos = element.offsetTop; \n ver = element.offsetLeft; \n\n // Check colision bounds\n if(pos == rect_main.offsetHeight-element_width) {\n d_v = \"top\";\n pos = rect_main.offsetHeight-element_width;\n isresting = 1;\n if(particle_colision_change == true) { ChangeParticle(element); } // Change Particle Size on colision\n } \n if(pos <= 0){ \n d_v = \"down\"; \n pos = 0; \n isresting = 1;\n if(particle_colision_change == true) { ChangeParticle(element); } // Change Particle Size on colision\n }\n if(ver == rect_main.offsetWidth-element_width){ \n d_h = \"left\";\n ver = rect_main.offsetWidth-element_width; \n isresting = 1;\n if(particle_colision_change == true) { ChangeParticle(element); } // Change Particle Size on colision\n } \n if(ver <= 0){ \n d_h = \"right\";\n ver = 0;\n isresting = 1;\n if(particle_colision_change == true) { ChangeParticle(element); } // Change Particle Size on colision\n }\n \n // It won add another position until the end of transition\n if(isresting == 1)\n {\n\n var RandomTransitionTime = Math.floor(Math.random() * (max_transition_speed - min_transition_speed + 1)) + min_transition_speed;\n element.style.transitionDuration = RandomTransitionTime+\"ms\";\n\n // Check Position\n if(d_v == \"down\" && d_h == 'left')\n {\n element.style.left = Number(element.offsetLeft) - Number(300) + \"px\"; \n element.style.top = rect_main.offsetHeight-Number(element_width) + \"px\"; \n isresting = 0;\n }\n if(d_v == \"down\" && d_h == 'right')\n {\n element.style.left = Number(element.offsetLeft) + Number(300) + \"px\"; \n element.style.top = rect_main.offsetHeight-Number(element_width) + \"px\"; \n isresting = 0;\n \n }\n if(d_v == \"top\" && d_h == 'left')\n {\n element.style.left = Number(element.offsetLeft)-Number(element_width) - Number(300) + \"px\"; \n element.style.top = \"0px\"; \n isresting = 0;\n \n }\n if(d_v == \"top\" && d_h == 'right') \n {\n element.style.left = Number(element.offsetLeft)-Number(element_width) + Number(300) + \"px\"; \n element.style.top = \"0px\"; \n isresting = 0;\n } \n }\n \n // Saves particle position to array\n if(element.offsetLeft != 0 && element.offsetTop != 0) { particle_x_ray[element.id] = ({'id': element.id, 'x': element.offsetLeft, 'y': element.offsetTop}); }\n \n }", "initAnimations() {\n var idle = this.level.player.animations.add('idle', [0, 1, 2, 3], 5);\n var walk_left = this.level.player.animations.add('walk_left', [5, 6, 7, 8]);\n var walk_right = this.level.player.animations.add('walk_right', [10, 11, 12, 13]);\n var jump = this.level.player.animations.add('jump', [15, 16, 17, 18]);\n var attack_left = this.level.player.animations.add('attack_left', [20, 21, 22, 23, 24]);\n var attack_right = this.level.player.animations.add('attack_right', [25, 26, 27, 28, 29]);\n }", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "constructor(scene,x,y){\n super(scene,x,y,'pig1',1,100);\n this.setScale(0.1);\n this.scene.anims.create({\n key: 'piganim',\n frames: [\n {key : 'pig1', frame : null},\n {key : 'pig2', frame : null},\n {key : 'pig3', frame : null},\n {key : 'pig4', frame : null},\n {key : 'pig5', frame : null},\n {key : 'pig6', frame : null},\n {key : 'pig7', frame : null},\n {key : 'pig8', frame : null},\n {key : 'pig9', frame : null},\n {key : 'pig10', frame : null},\n {key : 'pig11', frame : null},\n {key : 'pig12', frame : null},\n {key : 'pig13', frame : null},\n ],\n frameRate: 8,\n repeat: -1\n })\n\n this.play(\"piganim\");\n }", "function animation_memory_location (delta){\t \n show_arrow (delta);\n}", "constructor(p, data, startHrs, startMins, am, width, height, fogTimes) {\n this.p = p;\n this.baseTimeMinutes = timeInMins(startHrs, startMins);\n this.ampm = am;\n this.data = data;\n this.fogTimes = fogTimes;\n\n /**\n * ANIMATION TIME CONSTANTS\n */\n /* Canvas will refresh 60 times a second */\n this.fRate = 60;\n /* A 'minute' in the animation will last 100 frames. */\n this.framesPerMin = 100;\n /** The length of this animation, in minutes. \n * Based on latest departure time of any visitor in the data array.\n * Add 5 to allow time for the latest departure to exit the screen\n * before restarting the animation. */\n this.durationInMins = 5 + getLatestDeparture(data);\n console.log(this.durationInMins);\n\n /**\n * ANIMATION LIFECYCLE STATE\n * Reset at the start of every animation\n */\n this.frameCount = 0;\n\n /**\n * MINUTE-BY-MINUTE STATE\n * Updated every minute for visitors within that minute\n */\n /* Array of objects that have x;N, y;N, and data:VisitorData fields,\n where VisitorData is {type:{r|c|w}, dir{up|down}, arrival:Minute, [departure:Minute]} */\n this.activeVisitors = [];\n // Shallow copy of data that can be mutated\n this.waitingVisitors = this.data.slice();\n /* Number of frames that elapse between each visitor in the current minute */\n this.framesPerVisitor;\n /* Array of VisitorData objects, the visitors that will be added\n to the animation during the current minute */\n this.visitorsInMin = [];\n\n /**\n * DRAWING (size + color) CONSTANTS\n * Known / given constants,\n * and dynamically calculated constants.\n */\n this.myWidth = width; // should be windowWidth when constructed\n this.myHeight = height; // should be 400 when constructed\n this.visitorDotSize = 10; // size of visitor dots in animatino\n // Calculate + set width-dependent drawing constants.\n this.initSizeConstants();\n // Init the color constants.\n this.initColorConstants();\n }", "function Animation(spriteSheet, frameWidth, frameHeight,\n sheetWidth, frameDuration, frames, loop, scale) {\n this.spriteSheet = spriteSheet;\n this.frameWidth = frameWidth;\n this.frameDuration = frameDuration;\n this.frameHeight = frameHeight;\n this.sheetWidth = sheetWidth;\n this.frames = frames;\n this.totalTime = frameDuration * frames;\n this.elapsedTime = 0;\n this.loop = loop;\n this.scale = scale;\n}", "function Animations() {\n this.x = 0;\n this.y = 0;\n this.scale = 0\n this.\n}", "function update() {\n frames++;\n fish.update();\n //console.log(fish.y);\n}", "function Animation(values_, interval_) {\n\t\t/* The count increases with each update until it reaches the interval. */\n\t\t/* When that happens, the frame value changes and that's what we call animation. */\n\t\tthis.count = 0;\n\t\t/* The index is like the playhead in an animation. */\n\t\t/* The values array holds the frames and the index runs over the frames. */\n\t\t/* Basically, it's the index of the frame value in the frame values array. */\n\t\tthis.index = 0;\n\t\tthis.interval = interval_;\n\t\t/* We start the value at the first frame value in the animation. */\n\t\tthis.value = values_[0];\n\t\tthis.values = values_;\n\t}", "animate (now) {\r\n const timeDelta = (this.then - now) / 1000\r\n this.then = now\r\n this.player.updatePosition(timeDelta, this.currentMeshes)\r\n this.player.updateRotation()\r\n this.updateMeshes()\r\n this.view.draw(this.player.getCamera())\r\n\r\n const pos = this.mouseFocus.getNewBlockPosition()\r\n infoBox.textContent = pos\r\n ? `${pos.x}, ${pos.y}, ${pos.z}`\r\n : 'Nö, einfach nö!'\r\n\r\n requestAnimationFrame(this.animate.bind(this))\r\n }", "function firstState() {\n resetAnimationState();\n var state = setBallPosition(animationState.time);\n animationState.ballPositionX = state[0];\n animationState.ballHeight = state[1];\n TW.render();\n}", "function animate() {\n //stats.update();\n\tstep++;\n\tvar normSpeed = 5;\n\tvar normDistance = .5;\n\t\n mercury.position.x = .3*normDistance*((Math.cos(step/(.240*normSpeed))));\n\tmercury.position.y = .3*normDistance*((Math.sin(step/(.240*normSpeed)))); \n\tvenus.position.x = .6*normDistance*((Math.cos(step/(.615*normSpeed))));\n\tvenus.position.y = .6*normDistance*((Math.sin(step/(.615*normSpeed)))); \n\tearth.position.x = 1*normDistance*((Math.cos(step/normSpeed)));\n\tearth.position.y = 1*normDistance*((Math.sin(step/normSpeed))); \n\tmars.position.x = 1.5*normDistance*((Math.cos(step/(1.88*normSpeed))));\n\tmars.position.y = 1.5*normDistance*((Math.sin(step/(1.88*normSpeed)))); \n\tjupiter.position.x = 2.5*normDistance*((Math.cos(step/(11.862*normSpeed))));\n\tjupiter.position.y = 2.5*normDistance*((Math.sin(step/(11.862*normSpeed))));\n\tsaturn.position.x = 3.5*normDistance*((Math.cos(step/(29.457*normSpeed))));\n\tsaturn.position.y = 3.5*normDistance*((Math.sin(step/(29.457*normSpeed))));\n\turanus.position.x = 5.5*normDistance*((Math.cos(step/(84.017*normSpeed))));\n\turanus.position.y = 5.5*normDistance*((Math.sin(step/(84.017*normSpeed)))); \t \t\n\tneptune.position.x = 8.5*normDistance*((Math.cos(step/(164.8*normSpeed))));\n\tneptune.position.y = 8.5*normDistance*((Math.sin(step/(164.8*normSpeed))));\n\n // render using requestAnimationFrame\n requestAnimationFrame(animate);\n renderer.render(scene, camera);\n}", "function startAnimation () {\r\n on = true; // Animation angeschaltet\r\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\r\n t0 = new Date(); // Neuer Bezugszeitpunkt \r\n }", "function Init() {\n /**\n * SETUP VARIABLE AT FIRST\n */\n an.rubyID = DB.GetRubyID($anim);\n myData = that.data = vData[an.rubyID];\n // Setup initialization timer of object\n if (myData.tsInit == UNDE)\n myData.tsInit = VA.tsCur;\n // Properties & options of object\n var prop = myData.prop, opts = myData.opts;\n an.propEnd = prop[prop.length - 1];\n an.optsEnd = opts[opts.length - 1];\n /**\n * SETUP AFTER START ANIMATION\n */\n SetupStyleBegin();\n Start();\n }", "function startMoving(){\n ninjaLevitation(animTime);\n //sunrise();\n var particular4transl_50 = 50 / animTime;\n var particular4transl_100 = 100 / animTime;\n var particular4opacity_0 = 1 / animTime;\n var particular4opacity_075 = 0.75 / animTime;\n animate(function(timePassed) {\n forBackgnd.attr({opacity : particular4opacity_0 * timePassed});\n instagramLogo.attr({opacity : particular4opacity_0 * timePassed, 'transform' : 't 0, '+(100 - particular4transl_100 * timePassed)});\n mountFog.attr({opacity : 0.75 - particular4opacity_075 * timePassed});\n sunRays.attr({opacity : particular4opacity_0 * timePassed, 'transform' : 't 0, '+(50 - particular4transl_50 * timePassed)});\n }, animTime);\n}", "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "function startTimeAnimation() {\n\n\t// reset the time slider\n\t$('#time_slider').slider('value', 0);\n\t\n\t// update the map\n\tupdateMapTimePeriod(0);\n\t\n\t// update the time marker\n\tcurrentTimeInterval = 1;\n\t\n\t// set a timeout for the continue time animation\n\tnextTimeout = setTimeout('continueTimeAnimation()', 3000);\n\t\n\t// update the message\n\t$('#animation_message').empty().append('Animation running…');\n\n}", "function getPosition() { //------------------------ start \"getPosition()\"\n var myClcokWidth = myClock.width(),\n myClcokHeight = myClock.height();\n // positioning parts and set size\n myHourHand.css({\n 'width' : myClcokWidth * 0.065 + 'px',\n 'height' : myClcokWidth * 0.25 + 'px'\n });\n \n var myHourHandWidth = myHourHand.width(),\n myHousrHandHeight = myHourHand.height();\n \n myHourHand.css({\n 'left' : (myClcokWidth - myHourHandWidth)/2 + 'px',\n 'top' : (myClcokHeight/2) - myHousrHandHeight + 'px'\n });\n \n myMinuteHand.css({\n 'width' : myClcokWidth * 0.03 + 'px',\n 'height' : myClcokWidth * 0.35 + 'px'\n });\n \n var myMinuteHandWidth = myMinuteHand.width(),\n myMinuteHandHeight = myMinuteHand.height();\n \n myMinuteHand.css({ \n 'left' : (myClcokWidth - myMinuteHandWidth)/2 + 'px',\n 'top' : (myClcokHeight/2) - myMinuteHandHeight + 'px'\n });\n \n mySecondHand.css({\n 'width' : myClcokWidth * 0.01 + 'px',\n 'height' : myClcokWidth * 0.4 + 'px'\n });\n \n var mySecondHandWidth = mySecondHand.width(),\n mySecondHandHeight = mySecondHand.height();\n \n mySecondHand.css({\n 'left' : (myClcokWidth - mySecondHandWidth)/2 + 'px',\n 'top' : (myClcokHeight/2) - mySecondHandHeight + 'px'\n });\n\n} //-------------------------------------------------------- end \"getPosition()\"", "function updatePositions() {\n animating = false;\n frame++;\n window.performance.mark(MARK_START_FRAME);\n var currentScrollY = lastScrollY;\n\n var items = document.getElementsByClassName('.mover');\n for (var i = 0; i < items.length; i++) {\n var phase = Math.sin((currentScrollY / 1250) + (i % 5));\n items[i].style.transform = 'translateX(' + 100 * phase + 'px)'; //animate on translate property - increased performance\n }\n\n\n // User Timing API to the rescue again. Seriously, it's worth learning.\n // Super easy to create custom metrics.\n window.performance.mark(MARK_END_FRAME);\n window.performance.measure(MEASURE_FRAME_DURATION, MARK_START_FRAME, MARK_END_FRAME);\n if (frame % 10 === 0) {\n var timesToUpdatePosition = window.performance.getEntriesByName(MEASURE_FRAME_DURATION);\n logAverageFrame(timesToUpdatePosition);\n }\n}", "function AnimationAnimateMetadata() { }", "function AnimationAnimateMetadata() { }", "function Animation(duration, width, height, image){\r\n\tthis.duration = duration;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tthis.internalClock = duration / fps;\r\n\tthis.finished = false;\r\n\tthis.element = document.createElement('div');\r\n\r\n\tthis.element.style.width = width + 'px';\r\n\tthis.element.style.height = height + 'px';\r\n\tthis.element.style.minHeight = height + 'px';\r\n\tthis.element.style.minWidth = width + 'px';\r\n\tthis.element.style.backgroundImage = 'url(' + image + ')';\r\n\t//this.element.style.border = 'black solid 5px';\r\n\tthis.element.style.position = 'relative';\r\n\tthis.element.style.overflow = 'hidden';\r\n\tthis.tick = 0;\r\n\t\r\n\tthis.addMoment = function(img, stage){\r\n\r\n\t};\r\n\r\n\tthis.setX = function(x){ this.element.style.left = x + 'px'; };\r\n\tthis.setY = function(y){ this.element.style.top = y + 'px'; };\r\n\t\r\n\tthis.render = function(){\r\n\t\t//alert(this.tick);\t\t\r\n\t\tthis.tick += 1;// % duration; \r\n\t\t//alert('tick' + this.tick);\r\n\t\tif(this.tick > this.duration){\r\n\t\t\t//alert('hola');\r\n\t\t\tthis.animationEnd();\r\n\t\t\treturn\r\n\t\t};\r\n\t\t//this.tick = this.tick % this.duration;\r\n\t\tthis.element.style.backgroundPosition = '-' + this.tick * this.width + 'px 0px';\r\n\t\t//alert(this.element.style.backgroundPosition);\r\n\t\t//this.frames[this.tick].style.display = 'none';\r\n\t};\r\n\t\r\n\tthis.animationEnd;\r\n}", "getSignAndFrameInfo() {\n//------------------\n// Handle frame beyond end of animation\nif (this.fCur === this.fCount) {\nreturn [\"[none]\", this.signs.length, this.fCur];\n} else {\n// Rely on @frameCur being set according to @fCur\nreturn [this.frameCur.sign.gloss, this.frameCur.sign.i, this.fCur];\n}\n}", "function Animation(tileset, frames, frameDuration) {\n this.tileset = tileset;\n this.frames = frames;\n this.currentFrame = 0;\n this.frameTimer = Date.now();\n this.frameDuration = frameDuration;\n}", "function main(){\r\n\tvar TL=fl.getDocumentDOM().getTimeline()\r\n\tvar curL=TL.currentLayer;\r\n\tvar curF=TL.currentFrame;\r\n\tvar frame=TL.layers[curL].frames[curF];\r\n\tif(curF>frame.startFrame){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t}else if(curF==frame.startFrame && curF>0){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t\tvar prevFrame=TL.layers[curL].frames[frame.startFrame-1];\r\n\t\tTL.currentFrame=frame.startFrame-(prevFrame.duration);\r\n\t}\r\n}", "constructor(speed, rowOnAsset, row, col, pointsWhenKilled = 15, dim_x = 16, dim_y = 16) {\n\t\t//which y position on asset png is player/monster\n\t\tthis.idle = false; //is character currently moving?\n\n\t\tthis.moveSpeed = speed; // movespeed is the value to modify\n\t\t// speed is the calculated value from movespeed to make character move in the correct speed\n\t\tthis.speed = Math.round((6.66666666667 * GAME_SPEED) / this.moveSpeed);\n\n\t\tthis.pointsWhenKilled = pointsWhenKilled; //how many points does a player get when he kills this character\n\n\t\tthis.position = {\n\t\t\trow: row, //row on matrix (number of rows equals number of vertical tiles)\n\t\t\tcol: col,\n\t\t\tpix_x: col * tileSize, //current position in pixel on canvas. later, this is used to calc the offset\n\t\t\tpix_y: row * tileSize,\n\t\t};\n\n\t\tthis.direction = new Array(5); //up, down, right\n\n\t\t//up\n\t\tthis.direction[0] = new Array(3);\n\t\tthis.direction[0][0] = new AnimationFrame(0, rowOnAsset, dim_x, dim_y); //idle\n\t\tthis.direction[0][1] = new AnimationFrame(8 * dim_x, rowOnAsset, dim_x, dim_y); //animation up #1\n\t\tthis.direction[0][2] = new AnimationFrame(9 * dim_x, rowOnAsset, dim_x, dim_y); //animation up #\n\n\t\t//down\n\t\tthis.direction[1] = new Array(3);\n\t\tthis.direction[1][0] = new AnimationFrame(1 * dim_x, rowOnAsset, dim_x, dim_y); //idle\n\t\tthis.direction[1][1] = new AnimationFrame(2 * dim_x, rowOnAsset, dim_x, dim_y); //animation down #1\n\t\tthis.direction[1][2] = new AnimationFrame(3 * dim_x, rowOnAsset, dim_x, dim_y); //animation down #2\n\n\t\t//right\n\t\tthis.direction[2] = new Array(4);\n\t\tthis.direction[2][0] = new AnimationFrame(4 * dim_x, rowOnAsset, dim_x, dim_y); //idle\n\t\tthis.direction[2][1] = new AnimationFrame(5 * dim_x, rowOnAsset, dim_x, dim_y); //animation right #1\n\t\tthis.direction[2][2] = new AnimationFrame(6 * dim_x, rowOnAsset, dim_x, dim_y); //animation right #2\n\t\tthis.direction[2][3] = new AnimationFrame(7 * dim_x, rowOnAsset, dim_x, dim_y); //animation right #3\n\n\t\t//left\n\t\tthis.direction[3] = new Array(4);\n\t\tthis.direction[3][0] = new AnimationFrame(10 * dim_x, rowOnAsset, dim_x, dim_y); //idle\n\t\tthis.direction[3][1] = new AnimationFrame(11 * dim_x, rowOnAsset, dim_x, dim_y); //animation left #1\n\t\tthis.direction[3][2] = new AnimationFrame(12 * dim_x, rowOnAsset, dim_x, dim_y); //animation left #2\n\t\tthis.direction[3][3] = new AnimationFrame(13 * dim_x, rowOnAsset, dim_x, dim_y); //animation left #3\n\n\t\t// empty tile, for if a player has died, but the game still goes on\n\t\tthis.direction[4] = new Array(1);\n\t\tthis.direction[4][0] = new AnimationFrame(1 * dim_x, 18 * 16, dim_x, dim_y);\n\n\t\tthis.last_direction = DIRECTION.UP; //up per default\n\t\tthis.tick = 0; //used for calculating wich animation is displayed\n\t\tthis.frame_cnt = -1; //used for calculation of pixel offset when moving\n\n\t}", "animate() {\n if (this.animationFrames.length > 1) {\n this.animationTimer += 1;\n const quotient = Math.floor(this.animationTimer / this.animationFrameDuration)\n const frame = quotient % this.animationFrames.length;\n this.srcImage = this.animationFrames[frame];\n if (this.animationTimer === this.animationFrameDuration * this.animationFrames.length) {\n this.animationTimer = 0;\n }\n }\n }", "function init()\t\t\t\t\t\t\t\t\t\t\t\t\r\n{\r\n\trandom_position();\r\n\tinit_ball();\r\n\ttimeleft=10;\r\n\tgoal_counter=0;\r\n\t\r\n}", "moveTo(inX, inY) {\n\n for (let i = 0; i < this.frameCount; i++) {\n this[`frame${i}`].style.left = `${inX}px`;\n this[`frame${i}`].style.top = `${inY}px`;\n }\n\n }", "function tick () {\n console.log('mario x position', window.nes.ppu.spriteMem[23])\n console.log('mario y position', window.nes.ppu.spriteMem[28])\n console.log('luigi x position', window.nes.ppu.spriteMem[43])\n console.log('luigi y position', window.nes.ppu.spriteMem[48])\n }", "function updatePositions() {\n\t//******User Timing API******\n\tframe ++;\n\twindow.performance.mark(\"mark_start_frame\");\n\n\t//without querying the DOM, this asks for scroll info and moves the sliding pizzas\n\tvar currentScrollY = lastKnownScrollY;\n\tvar items = document.getElementsByClassName(\"mover\");\n\tvar howMany = items.length;\n\tvar phase;\n\tfor (var i = 0; i < howMany; i++) {\n\t\tphase = Math.sin((currentScrollY / 1250) + (i % 5));\n\t\t//CSS Triggers: swapped all movement calls to 'transform.translate' \n\t\titems[i].style.transform = \"translateX(\" + 100 * (phase) + \"px)\";\n\t}\n\tticking = false;\n\n//******User Timing API******\n window.performance.mark(\"mark_end_frame\");\n window.performance.measure(\"measure_frame_duration\", \"mark_start_frame\", \"mark_end_frame\");\n if (frame % 10 === 0) {\n var timesToUpdatePosition = window.performance.getEntriesByName(\"measure_frame_duration\");\n logAverageFrame(timesToUpdatePosition);\n }\n}", "function initialisationOfVariables() {\n gravity = 9.8; /** Initial graviational value of environmetn */\n mass_of_flywheel = 5; /** Initial mass of fly wheel */\n diameter_of_flywheel = 10; /** Initial diameterof fly wheel */\n mass_of_rings = 200; /** Initial mass of hanging weight */\n diameter_of_axle = 2; /** Initial diameter of axl of fly wheel */\n no_of_wound = 1; /** Initial number of wounds on fly wheel */\n rotation_speed = wheel_rotation_speed = 33600/4; /** Initially speed rate of fly wheel in milli seconds */\n speed_correction = 2.0001; /** Speed correction value for adjusting the speed of fly wheel */\n thread_anim_frame = 0; /** First frame of thread animation image */\n time_slots =[]; /** Array store the time taken for each rotation */\n time_slot_indx = 0; /** Index of time slot array */\n line_mask = new createjs.Shape();\n line_mask.name = \"line_mask\";\n rotation = 0;\n rotation_decimal = 0;\n line_mask.graphics.drawRect(300, 0, 200, 555);\n line_mask.y = 0;\n long_string.mask = line_mask;\n thread_anim_width = 199.869; /** Variable to indicate the width of each frame of thread animation image */\n wound = new createjs.Shape(); /** Shape object to create wound over axl of fly wheel */\n string_x_pos = 0; /** Initial position of string wounded over axl of fly wheel */\n itration = 0; /** Variable to increment the length of long string while releasing string */\n x_decrement = 0; /** Variable to set the horizontal position of long string whilw releasing the string */\n drawLongString(385); /** Function to draw hanging string */\n rolling = false; /** Variable to indicate that strating of fly wheel rotation, and it used to differentiate initial wheel rotation and wheel rotation after pause */\n INTERVAL = 0.2; /** Basic time interval of simulation(200 milli second) */\n total_rotation = 360; /** One roation of fly wheel */\n angular_velocity = 0; /** Initial value of angular velocity */\n angular_distance = 0; /** Initial value of angular distance */\n number_of_rotation = 0; /** Initial value of number of rotation */\n final_rotation = false;\n getChildName(\"height_txt\").text = \"02cm\";\n}", "function AnimationSequenceMetadata() { }", "function AnimationSequenceMetadata() { }", "constructor(){\n this.inProgressAnimation;\n this.elementToAnimate;\n this.animationDuration;\n }", "function frame() {\n\t\tleft += 2.5;\n\t\t//opacity += 0.02;\n\t\tanimal.style.left = left + 'px';\n\t\t//txt.style.opacity = opacity;\n\t\tif (left >= 15) {\n\t\t\tclearInterval(interval);\n\t\t\tanimal.style.left = \"15px\";\n\t\t\t//txt.style.opacity = 1;\n\t\t\tspots_disabled = false;\n\t\t\tfadein_text();\n\t\t}\n\t}", "function setup() {\n\n createCanvas(windowWidth, windowHeight);\n song = loadSound('thing_sound.wav');\n //create a new sprite object\n thing = createSprite(200, 150, 150, 200);\n\n //add the 3 animations to the object\n //(label, first frame, last frame)\n var myAnim = thing.addAnimation(\"floating\", \"thing_still01.png\", \"thing_still02.png\");\n myAnim.offY = 18;\n thing.addAnimation(\"moving\", \"thing_walk01.png\", \"thing_walk02.png\");\n thing.addAnimation(\"spinning\", \"thing_walk01.png\", \"thing_walk01.png\");\n\n}", "function animate() {\r\n var timeNow = new Date().getTime();\r\n if (lastTime != 0) {\r\n var elapsed = timeNow - lastTime;\r\n\r\n if (speed != 0) {\r\n xPosition -= Math.sin(degToRad(yaw)) * speed * elapsed;\r\n zPosition -= Math.cos(degToRad(yaw)) * speed * elapsed;\r\n\r\n joggingAngle += elapsed * 0.6; // 0.6 \"fiddle factor\" - makes it feel more realistic :-)\r\n yPosition = Math.sin(degToRad(joggingAngle)) / 20 + 3\r\n }\r\n\r\n yaw += yawRate * elapsed;\r\n pitch += pitchRate * elapsed;\r\n\r\n }\r\n lastTime = timeNow;\r\n}", "animate() {\n\t\tlet self = this,\n\t\t\theight = this.height,\n\t\t\tdotHeight = this.randomNumber;\n\n\t\tif (this.isBonus) {\n\t\t\tthis.move = setTimeout(function moving() {\n\t\t\t\tif (!self.parent.paused) {\n\t\t\t\t\tif (self.pos+dotHeight > height){\n\t\t\t\t\t\tclearInterval(self.move);\n\t\t\t\t\t\tself.remove();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.pos++;\n\t\t\t\t\t\tself.ctx.style.bottom = self.pos + 'px';\n\t\t\t\t\t\tself.move = setTimeout(moving, 1000/250);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tclearInterval(self.move);\n\t\t\t\t} \n\t\t\t}, 1000/250);\n\t\t} else {\n\t\t\tthis.move = setTimeout(function moving() {\n\t\t\t\tif (!self.parent.paused) {\n\t\t\t\t\tif (self.pos+dotHeight > height){\n\t\t\t\t\t\tclearInterval(self.move);\n\t\t\t\t\t\tself.remove();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.pos++;\n\t\t\t\t\t\tself.ctx.style.bottom = self.pos + 'px';\n\t\t\t\t\t\tself.move = setTimeout(moving, 1000/self.parent.fallingSpeed);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tclearInterval(self.move);\n\t\t\t\t} \n\t\t\t}, 1000/self.parent.fallingSpeed);\n\t\t}\n\t}", "function animateFrame()\n{\n // Update the current camera and scene\n if (currentCamera !== undefined) currentCamera.updateProjectionMatrix();\n if (currentScene !== undefined) currentScene.traverse(runScripts);\n\n // Update previous mouse state here because animateFrame\n // out of sync with mouse listeners (onMouseMove, onMouseWheel)\n mousePrevX = mouseX;\n mousePrevY = mouseY;\n mousePrevScroll = mouseScroll;\n\n var t = getElapsedTime();\n frameDuration = t - frameStartTime;\n frameStartTime = t;\n frameNum++;\n}", "function _setTimes(position, duration) {\n\t\t\tvar time = _convertTime(position/1000);\n\t\t\tif(currentTime != time) {\n\t\t\t\t$main.find('#fap-current-time').text(time);\n\t\t\t\t$main.find('#fap-total-time').text(_convertTime(duration / 1000));\n\t\t\t\t_setSliderPosition(position / duration);\n\t\t\t}\n\t\t\tcurrentTime = time;\n\t\t}", "InitAnims() {\n this.scene.anims.create({\n key: 'idle',\n frames: this.scene.anims.generateFrameNumbers('player_idle', { start: 0, end: 5 }),\n frameRate: 8,\n repeat: -1\n });\n this.scene.anims.create({\n key: 'run',\n frames: this.scene.anims.generateFrameNumbers('player_run', { start: 0, end: 39 }),\n frameRate: 60,\n repeat: -1\n });\n this.scene.anims.create({\n key: 'jump',\n frames: [{ key: 'player_jump', frame: 0 }],\n frameRate: 24\n });\n this.scene.anims.create({\n key: 'attack',\n frames: this.scene.anims.generateFrameNumbers('player_attack', { start: 0, end: 7 }),\n frameRate: 24,\n showOnStart: true,\n hideOnComplete: true\n });\n this.scene.anims.create({\n key: 'death',\n frames: this.scene.anims.generateFrameNumbers('player_death', { start: 0, end: 7 }),\n frameRate: 4,\n showOnStart: true,\n hideOnComplete: false\n });\n }", "function onStartFrame(t, state) {\n // (KTR) TODO implement option so a person could pause and resume elapsed time\n // if someone visits, leaves, and later returns\n let tStart = t;\n if (!state.tStart) {\n state.tStart = t;\n state.time = t;\n }\n\n tStart = state.tStart;\n\n let now = (t - tStart);\n // different from t, since t is the total elapsed time in the entire system, best to use \"state.time\"\n state.time = now;\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n let time = now / 1000;\n\n gl.uniform1f(state.uTimeLoc, time);\n\n gl.uniform4fv(state.uLightsLoc[0].dir, [.6917,.6917,.2075,0.]);\n gl.uniform3fv(state.uLightsLoc[0].col, [1., 1., 1.]);\n gl.uniform4fv(state.uLightsLoc[1].dir, [-.5774,.5774,-.5774,0.]);\n gl.uniform3fv(state.uLightsLoc[1].col, [1., 1., 1.]);\n\n gl.uniform1i(state.uShapesLoc[0].type, 1);\n gl.uniform4fv(state.uShapesLoc[0].center, [-.45*Math.sin(time),.45*Math.sin(time),.45*Math.cos(time), 1.]);\n gl.uniform1f(state.uShapesLoc[0].size, .12);\n\n gl.uniform3fv(state.uMaterialsLoc[0].ambient , [0.,.2,.8]);\n gl.uniform3fv(state.uMaterialsLoc[0].diffuse , [.8,.5,.5]);\n gl.uniform3fv(state.uMaterialsLoc[0].specular , [0.,.5,.5]);\n gl.uniform1f (state.uMaterialsLoc[0].power , 6.);\n gl.uniform3fv(state.uMaterialsLoc[0].reflection , [0.0392, 0.7098, 0.9137]);\n gl.uniform3fv(state.uMaterialsLoc[0].transparency, [0.0, 0.5176, 1.0]);\n gl.uniform1f (state.uMaterialsLoc[0].indexOfRefelction, 1.2);\n\n gl.uniform1i(state.uShapesLoc[1].type, 2);\n gl.uniform4fv(state.uShapesLoc[1].center, [.45*Math.sin(time),-.45*Math.cos(time),.45*Math.cos(time), 1.]);\n gl.uniform1f(state.uShapesLoc[1].size, .12);\n\n gl.uniform3fv(state.uMaterialsLoc[1].ambient , [0.7882, 0.1059, 0.1059]);\n gl.uniform3fv(state.uMaterialsLoc[1].diffuse , [.5,.5,0.]);\n gl.uniform3fv(state.uMaterialsLoc[1].specular , [.5,.5,0.]);\n gl.uniform1f (state.uMaterialsLoc[1].power , 10.);\n gl.uniform3fv(state.uMaterialsLoc[1].reflection , [0.9059, 0.0314, 0.0314]);\n gl.uniform3fv(state.uMaterialsLoc[1].transparency, [0.6275, 0.1569, 0.1569]);\n gl.uniform1f (state.uMaterialsLoc[1].indexOfRefelction, 1.4);\n\n gl.uniform1i(state.uShapesLoc[2].type, 2);\n gl.uniform4fv(state.uShapesLoc[2].center, [.45*Math.sin(time),.45*Math.cos(time),-.45*Math.sin(time), 1.]);\n gl.uniform1f(state.uShapesLoc[2].size, .12);\n\n gl.uniform3fv(state.uMaterialsLoc[2].ambient , [0.6157, 0.149, 0.4353]);\n gl.uniform3fv(state.uMaterialsLoc[2].diffuse , [0.8392, 0.7922, 0.149]);\n gl.uniform3fv(state.uMaterialsLoc[2].specular , [0.1725, 0.1725, 0.1098]);\n gl.uniform1f (state.uMaterialsLoc[2].power , 4.);\n gl.uniform3fv(state.uMaterialsLoc[2].reflection , [0.6549, 0.2549, 0.6235]);\n gl.uniform3fv(state.uMaterialsLoc[2].transparency, [0.7255, 0.1098, 0.698]);\n gl.uniform1f (state.uMaterialsLoc[2].indexOfRefelction, 1.5);\n \n gl.uniform1i(state.uShapesLoc[3].type, 0);\n gl.uniform4fv(state.uShapesLoc[3].center, [0.,0.,0.,1.]);\n gl.uniform1f(state.uShapesLoc[3].size, .18);\n\n gl.uniform3fv(state.uMaterialsLoc[3].ambient , [0.0549, 0.4275, 0.2118]);\n gl.uniform3fv(state.uMaterialsLoc[3].diffuse , [0.0196, 0.1647, 0.2314]);\n gl.uniform3fv(state.uMaterialsLoc[3].specular , [0.0824, 0.0196, 0.2]);\n gl.uniform1f (state.uMaterialsLoc[3].power , 6.);\n gl.uniform3fv(state.uMaterialsLoc[3].reflection , [0.3216, 0.8667, 0.0706]);\n gl.uniform3fv(state.uMaterialsLoc[3].transparency, [0.0, 1.0, 0.8353]);\n gl.uniform1f (state.uMaterialsLoc[3].indexOfRefelction, 1.2);\n\n gl.enable(gl.DEPTH_TEST);\n}", "function draw() {\n /* Drawing function where you can get all the objects moving\n *\n */\n\n background(100, 140, 130);\n screenStats();\n checkBoudaries();\n arrivalParticle();\n timeelapsed();\n particleX();\n console.log('How Many Frames per Second : ' + requestAnimFrame());\n}", "animateToPosition(position_, time_) {\n let time = time_ || 1000;\n this.animateToLocation(position_.x, position_.y, time)\n this.animateToAngle(position_.angle, time);\n }", "function frame()\n {\n //Clear the element if it reaches below a certain pixel range\n if (pos == 1024)//setting of the finish line\n {\n clearInterval(id);\n eball.remove();\n }\n //Continue to move till the finish line hits.\n else\n {\n pos++;//Add the position\n eball.style.top = pos + 'px';//Continuosly keep on adding the position value to account for the movement\n }\n }", "function startAnimation() {\n timerId = setInterval(updateAnimation, 16);\n }", "function animation(time) {\n clearCanvas();\n\n updateAudioEffects();\n dessineEtDeplaceLesEtoiles();\n drawVolumeMeter();\n visualize();\n measureFPS(time);\n\n me.draw(ctx);\n badboy.draw(ctx);\n me.update();\n badboy.update();\n\n var rand = Math.random();\n rect1 = new Etoile();\n etoiles.push(rect1);\n\n // 4 on rappelle la boucle d'animation 60 fois / s\n if (state == 1){\n requestAnimationFrame(animation);\n } else {\n // c'etait la derniere iteration de l'anim , on repasse au menu\n etoiles=[];\n }\n}", "function animation() {\n //Fait une rotation sur chaque astéroid à chaque image\n for (let i = 0; i < asteroids.length; i++) {\n asteroids[i].rotation.x += asteroids[i].userData.rx;\n asteroids[i].rotation.y += asteroids[i].userData.ry;\n }\n //Fait une rotation sur chaque anneau et coeur à chaque image\n for (let i = 0; i < rings.length; i++) {\n rings[i].rotation.z += 0.05;\n hearts[i].rotation.z += 0.05;\n }\n //Fait avancer le vaisseau et la caméra vers l'avant \n vaisseau.position.z -= vaisseau.userData.speed;\n camera.position.set(vaisseau.position.x,vaisseau.position.y + vaisseau.userData.cameraY,vaisseau.position.z + vaisseau.userData.cameraZ);\n //Focalise la caméra sur la position du vaisseau\n control.target = vaisseau.position;\n //Si on arrive à une certaine distance, une suite d'actions se déclanche\n if (vaisseau.position.z <= -5000) {\n //le vaisseau revient au début du parcours\n vaisseau.position.z = 100;\n camera.position.z = 104;\n //Le niveau augmente\n vaisseau.userData.level += 1;\n levelId.innerHTML = 'Level : ' + vaisseau.userData.level;\n //le score est multiplié par x1.1\n scoreMultiplication = scoreMultiplication*2;\n //La vitesse est multipliée par x2\n vaisseau.userData.speed = vaisseau.userData.speed * 1.1;\n currentSpeed = vaisseau.userData.speed;\n }\n //si le jeu n'est pas mis sur pause, le score augmente à la vitesse correspondante au niveau\n if (play) {\n vaisseau.userData.score += scoreMultiplication;\n }\n\n remainingLives();\n\n scoreId.innerHTML = vaisseau.userData.score;\n\n control.update();\n\n collision(); \n\n renderer.render(scene, camera);\n \n let animationFrame = requestAnimationFrame(animation);\n\n}", "function ANIMATE($anim) {\n var that = this, an = {}, myData = {}, styleCur = {}, isOverflowOnNode;\n /**\n * FUNCTION CLASS\n */\n /**\n * CHECK & INITIALIZATION ANIMATION\n */\n function Init() {\n /**\n * SETUP VARIABLE AT FIRST\n */\n an.rubyID = DB.GetRubyID($anim);\n myData = that.data = vData[an.rubyID];\n // Setup initialization timer of object\n if (myData.tsInit == UNDE)\n myData.tsInit = VA.tsCur;\n // Properties & options of object\n var prop = myData.prop, opts = myData.opts;\n an.propEnd = prop[prop.length - 1];\n an.optsEnd = opts[opts.length - 1];\n /**\n * SETUP AFTER START ANIMATION\n */\n SetupStyleBegin();\n Start();\n }\n /**\n * SETUP VALUE OF STYLE & TRANSFORM AT FIRST\n */\n function SetupStyleBegin() {\n // Setup properties of normal Style\n StyleBegin();\n // Setup properties of transform CSS\n TransformBegin();\n }\n /**\n * SETUP VALUE OF STYLE AT FIRST\n */\n function StyleBegin() {\n var styleBegin = an.optsEnd.styleBegin, styleEnd = an.optsEnd.styleEnd, opts = myData.opts, isAnimMulti = opts.length > 1;\n /**\n * LOOP TO SETUP VALUE NOT BE TRANSFORM CSS\n */\n for (var name in an.propEnd) {\n if ($.inArray(name, VA.nameTf) === -1) {\n /**\n * SETUP STYLE END\n * + Parse & convert value of StyleEnd\n */\n var valueCur = an['propEnd'][name];\n styleEnd[name] = M.ParseCssStyle(valueCur);\n /**\n * SETUP STYLE BEGIN\n */\n // Case: name of properties have fixed value -> inherit value of tfEnd\n if ($.inArray(name, VA.propFixed) !== -1) {\n styleBegin[name] = styleEnd[name];\n }\n else {\n // Parse & convert value of StyleBegin\n valueCur = $anim.css(name);\n styleBegin[name] = M.ParseCssStyle(valueCur);\n }\n }\n }\n // Inherit StyleEnd of animation before\n if (isAnimMulti)\n styleBegin = $.extend(styleBegin, opts[opts.length - 2]['styleEnd']);\n // Inherit properties of CSS Style 'point' have setup before\n if (myData.cssStyle !== null) {\n styleBegin = $.extend(true, styleBegin, myData.cssStyle);\n // Remove properties CSS Style after inherit\n myData.cssStyle = null;\n }\n /**\n * SETUP INHERIT PROPERTIES OF STYLE-END FROM STYLE-BEGIN\n */\n for (var name in styleBegin) {\n if (styleEnd[name] === UNDE) {\n styleEnd[name] = styleBegin[name];\n }\n }\n }\n /**\n * SETUP VALUE OF TRANSFORM AT FIRST\n */\n function TransformBegin() {\n var opts = myData.opts;\n /**\n * GET TRANSFORM OF OBJECT AT FIRST\n */\n // Case: have many continuous animation\n var tfBegin;\n if (opts.length > 1) {\n // Get Transform-begin from Transform-end before\n tfBegin = $.extend({}, opts[opts.length - 2]['tfEnd']);\n }\n else {\n tfBegin = myData.tfCur;\n if (tfBegin == UNDE) {\n var matrixBegin = MATRIX.getFromItem($anim);\n /**\n * PARSE MATRIX TO INITIAL PROPERTIES\n */\n tfBegin = MATRIX.parse(matrixBegin);\n }\n }\n // Inherit the properties CSS Transform 'point' have setup before\n if (myData.cssTf !== null) {\n tfBegin = $.extend(true, tfBegin, myData.cssTf);\n // Remove CSS Transform property after inherit\n myData.cssTf = null;\n }\n /**\n * GET TRANSFORM-END FROM SETUP PROPERTIES\n */\n var tfEnd = TF.FromProp(an.propEnd);\n /**\n * SETUP TRANSFORM INHERIT FROM PROPERTIES BEFORE\n */\n // Inherit 'tfBegin' properties but 'tfEnd' does not have, order of Transform depends on options\n tfEnd = TF.Extend(tfBegin, tfEnd, an.optsEnd);\n var tfDefault = VA.tfDefault;\n for (var name in tfEnd) {\n /**\n * ADDITIONAL PROPERTIES WITH TRANSFORM-BEGIN\n */\n if (tfBegin[name] === UNDE) {\n // Case: value of properties !== default value\n if (tfEnd[name] != tfDefault[name]) {\n // Case: name of property has fixed value -> inherit value from 'tfEnd'\n if ($.inArray(name, VA.propFixed) !== -1)\n tfBegin[name] = tfEnd[name];\n else\n tfBegin[name] = tfDefault[name];\n }\n else {\n delete tfEnd[name];\n }\n }\n /**\n * REMOVE PROPERTIES ON TRANSFORM BEGIN - END SIMILAR TO DEFAULT PROPERTIES\n */\n if (tfBegin[name] == tfDefault[name] && tfEnd[name] == tfDefault[name]) {\n delete tfBegin[name];\n delete tfEnd[name];\n }\n }\n an.optsEnd.tfBegin = tfBegin;\n an.optsEnd.tfEnd = tfEnd;\n }\n /**\n * SETUP VALUE WHEN BEGIN ANIMATION\n */\n function Start() {\n /**\n * INSERT STYLE 'OVERFLOW' AT FIRST: FIXED FOR OLD BROWSER\n */\n var style = $anim.attr('style');\n isOverflowOnNode = style && style.indexOf('overflow') !== -1;\n // Unavailable\n // !isOverflowOnNode && $anim.css('overflow', 'hidden');\n /**\n * EXECUTE FUNCTION 'START' AT FIRST\n */\n !!an.optsEnd.start && an.optsEnd.start();\n }\n /**\n * SETUP NEXT VALUE OF OBJECT, CALL FUNCTION FROM 'TWEEN'\n * @param boolean isForceAnim Allways setup style for object\n */\n that.next = function (isForceAnim) {\n /**\n * SETUP CURRENT TIME\n * @param Int an.xCur Current time, in range [0, 1]\n * @param Boolean isAnimate Check setup current animation\n */\n var opts = myData.opts, isAnimate = false, isComplete = false, tCur = myData.tCur = VA.tsCur - myData.tsInit;\n for (var i = 0, len = opts.length; i < len; i++) {\n var optsCur = opts[i];\n // Case: tCur at the forward position the first Aniamtion\n if (tCur < optsCur.tPlay && i == 0) {\n // Case: allways setup Style of object\n if (isForceAnim) {\n an.optsPos = i;\n an.xCur = 0;\n }\n else\n an.xCur = null;\n break;\n }\n else if (tCur > optsCur.tEnd && i == len - 1) {\n an.optsPos = i;\n an.xCur = 1;\n isComplete = true;\n break;\n }\n else if (optsCur.tPlay <= tCur && tCur <= optsCur.tEnd) {\n an.optsPos = i;\n an.xCur = $.GSGDEasing[optsCur.easing](null, tCur - optsCur.tPlay, 0, 1, optsCur.duration);\n isAnimate = true;\n break;\n }\n else if (!!opts[i + 1] && optsCur.tEnd < tCur && tCur < opts[i + 1].tPlay) {\n an.optsPos = i;\n an.xCur = 1;\n break;\n }\n }\n /**\n * SETUP VALUE OF CURRENT STYLE ON OBJECT\n */\n if (an.xCur !== null && opts.length) {\n // First, reset size of Item\n GetSizeItem();\n // Reset variable 'styleCur'\n styleCur = {};\n // Setup current Style value of the object\n StyleNormalCur();\n StyleTransformCur();\n $anim.css(styleCur);\n }\n /**\n * EXECUTE OPTION 'COMPLETE'\n */\n if (isComplete) {\n var optsCur = opts[an.optsPos];\n !!optsCur.complete && optsCur.complete();\n }\n /**\n * Return value check have Animation\n */\n return isAnimate;\n };\n /**\n * CONVERT VALUE HAS OTHER UNIT TO 'PX'\n * + Support convert '%' to 'px'\n */\n function ConvertValue(name, valueCur) {\n /*\n * CASE: STRING\n */\n if (typeof valueCur == 'string') {\n /**\n * CASE: UNIT IS 'PX'\n */\n if (/px$/.test(valueCur)) {\n valueCur = parseFloat(valueCur);\n }\n else if (/\\%$/.test(valueCur)) {\n // Name of property exist in conversion system\n var nameSizeFn = VA.percentRef[name];\n if (nameSizeFn !== UNDE) {\n var sizeCur = an['size'][nameSizeFn];\n valueCur = sizeCur * parseFloat(valueCur) / 100;\n }\n }\n }\n /**\n * RETURN VALUE AFTER SETUP\n */\n return valueCur;\n }\n /**\n * GET SIZE OF ITEM IN CURRENT TIME\n */\n function GetSizeItem() {\n an.size = {\n 'OuterWidth': M.OuterWidth($anim),\n 'OuterHeight': M.OuterHeight($anim)\n };\n }\n /**\n * SETUP VALUE PLUS DEPENDS ON PROPERTY NAME\n */\n function ValueCurForNumber(name, valueBegin, valueEnd) {\n var nameToFloat = ['opacity'], plus = (valueEnd - valueBegin) * an.xCur;\n // Case: rounded number float\n if ($.inArray(name, nameToFloat) !== -1) {\n plus = Math.round(plus * 1000) / 1000;\n }\n else {\n /**\n * ADDITIONAL 1 FRACTION : ANIMATE SMOOTHER\n */\n plus = Math.round(plus * 10) / 10;\n }\n return valueBegin + plus;\n }\n /**\n * SETUP VALUE OF PROPERTY IS ARRAY[]\n */\n function ValueCurForArray(name, valueBegin, valueEnd) {\n var aValue = [];\n /**\n * SETUP EACH VALUE IN ARRAY[]\n * + Remove element >= 2 : Browser not support Transform 3D\n */\n for (var i = 0, len = valueEnd.length; i < len && !(i >= 2 && !VA.isTf3D); i++) {\n /**\n * CONVERT VALUE BEGIN - END\n */\n var vaEndCur = ConvertValue(name + i, valueEnd[i]), vaBeginCur = ConvertValue(name + i, valueBegin[i]);\n // Case: value 'begin' not exist\n if (vaBeginCur === UNDE)\n vaBeginCur = vaEndCur;\n /**\n * SETUP CURRENT VALUE + STORE IN ARRAY[]\n */\n var plus = (vaEndCur - vaBeginCur) * an.xCur, valueCur = Math.round((vaBeginCur + plus) * 10) / 10;\n aValue.push(valueCur + 'px');\n }\n /**\n * CONVERT ARRAY TO STRING\n */\n return aValue.join(' ');\n }\n /**\n * SETUP NORMAL PROPERTIES AT THE CURRENT TIME\n */\n function StyleNormalCur() {\n var optsCur = myData['opts'][an.optsPos];\n for (var name in optsCur['styleBegin']) {\n var valueBegin = optsCur['styleBegin'][name], valueEnd = optsCur['styleEnd'][name], valueCur;\n /**\n * CASE: PROPERTY HAS VALUE IS ARRAY[]\n */\n if ($.isArray(valueBegin)) {\n valueCur = ValueCurForArray(name, valueBegin, valueEnd);\n }\n else {\n // Convert value String to Number (if posible)\n valueBegin = ConvertValue(name, valueBegin);\n valueEnd = ConvertValue(name, valueEnd);\n // Case: value of property is Number\n if ($.isNumeric(valueBegin) && $.isNumeric(valueEnd)) {\n valueCur = ValueCurForNumber(name, valueBegin, valueEnd);\n }\n else {\n valueCur = valueBegin;\n }\n }\n /**\n * REMOVE STYLES HAVE DEFAULT VALUE\n */\n if (optsCur.isClearStyleDefault && VA['styleDefault'][name] === valueCur) {\n valueCur = '';\n }\n /**\n * STORE VALUE OF CURRENT PROPERTY\n */\n styleCur[name] = valueCur;\n }\n }\n /**\n * SETUP 'TRANSFORM' IN CURRENT TIME\n */\n function StyleTransformCur() {\n /**\n * SETUP CURRENT VALUE EACH TRANSFORM PROPERTIES\n */\n var optsCur = myData['opts'][an.optsPos], tfBegin = optsCur.tfBegin, tfEnd = optsCur.tfEnd, tfCur = {};\n for (var name in tfEnd) {\n // Setup value 'plus' of each properties\n var tfBeginCur = TF.ConvertValueToPX($anim, name, tfBegin[name]), tfEndCur = TF.ConvertValueToPX($anim, name, tfEnd[name]), valuePlus = (tfEndCur - tfBeginCur) * an.xCur, valueCur = tfBeginCur + valuePlus;\n // Value of current property\n tfCur[name] = valueCur;\n }\n /**\n * CONVERT PARTICULAR PROPERTY OF TRANSFORM TO CSS\n */\n var cssTf = TF.ToCss(tfCur, optsCur);\n /**\n * STORE CURRENT TRANSFORM CSS\n */\n var nameTf = VA.prefix + 'transform';\n styleCur[nameTf] = cssTf;\n // Store current Transform into system\n myData.tfCur = tfCur;\n }\n // Initialize Animation\n Init();\n }", "function step(timestamp){\n\n //update css variable\n positionLeft1 += speedX1;\n positionTop1 += speedY1;\n\n positionLeft2 += speedX2;\n positionTop2 += speedY2;\n\n positionLeft3 += speedX3;\n positionTop3 += speedY3;\n\n //change speed and direction variable if the ball hits the edge of the screen\n if(positionLeft1 > width){\n speedX1 = speedX1 * -1;\n }\n\n if(positionLeft1 < 0){\n speedX1 = speedX1 * -1;\n }\n\n if(positionTop1 > height){\n speedY1 = speedY1 * -1;\n }\n\n if(positionTop1 < 0 ){\n speedY1 = speedY1 * -1;\n }\n\n\n\n\n\n if(positionLeft2 > width){\n speedX2 = speedX2 * -1;\n }\n\n if(positionLeft2 < 0){\n speedX2 = speedX2 * -1;\n }\n\n if(positionTop2 > height){\n speedY2 = speedY2 * -1;\n }\n\n if(positionTop2 < 0 ){\n speedY2 = speedY2 * -1;\n }\n\n\n\n\n\n if(positionLeft3 > width){\n speedX3 = speedX3 * -1;\n }\n\n if(positionLeft3 < 0){\n speedX3 = speedX3 * -1;\n }\n\n if(positionTop3 > height){\n speedY3 = speedY3 * -1;\n }\n\n if(positionTop3 < 0 ){\n speedY3 = speedY3 * -1;\n }\n\n $('#shape1').css(\"left\", positionLeft1)\n $('#shape1').css(\"top\", positionTop1)\n\n $('#shape2').css(\"left\", positionLeft2)\n $('#shape2').css(\"top\", positionTop2)\n\n $('#shape3').css(\"left\", positionLeft3)\n $('#shape3').css(\"top\", positionTop3)\n window.requestAnimationFrame(step);\n}", "handlePlayerFrame(){\n if(this.speedY < 0){\n this.frameY = 3\n }else{\n this.frameY = 0\n }\n if (this.frameX < 3){\n this.frameX++\n } else {\n this.frameX = 0\n }\n }", "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime;\n\n if (speed != 0) {\n xPosition -= Math.sin(degToRad(yaw)) * speed * elapsed;\n zPosition -= Math.cos(degToRad(yaw)) * speed * elapsed;\n\n joggingAngle += elapsed * 0.6; // 0.6 \"fiddle factor\" - makes it feel more realistic :-)\n yPosition = Math.sin(degToRad(joggingAngle)) / 20 + 0.4\n }\n\n yaw += yawRate * elapsed;\n pitch += pitchRate * elapsed;\n }\n lastTime = timeNow;\n}", "addAnimations() {\n\n // eyes animations (moving eyes of the inspector)\n let frameRate = 50; // frame rate of the animation\n\n // from mid to right\n this.anims.create({\n key: 'midToRight',\n frames: this.anims.generateFrameNames('eyes', {frames: [0, 1, 2, 3, 4, 5]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from right to mid\n this.anims.create({\n key: 'rightToMid',\n frames: this.anims.generateFrameNames('eyes', {frames: [5, 4, 3, 2, 1, 0]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from mid to left\n this.anims.create({\n key: 'midToLeft',\n frames: this.anims.generateFrameNames('eyes', {frames: [0, 6, 7, 8, 9, 10]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from left to mid\n this.anims.create({\n key: 'leftToMid',\n frames: this.anims.generateFrameNames('eyes', {frames: [10, 9, 8, 7, 6, 0]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from left to right\n this.anims.create({\n key: 'leftToRight',\n frames: this.anims.generateFrameNames('eyes', {frames: [10, 9, 8, 7, 6, 0, 1, 2, 3, 4, 5]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from right to left\n this.anims.create({\n key: 'rightToLeft',\n frames: this.anims.generateFrameNames('eyes', {frames: [5, 4, 3, 2, 1, 0, 6, 7, 8, 9, 10]}),\n frameRate: frameRate,\n paused: true\n });\n\n }", "update( time ) {\r\n let animation = this.animationList[this.current];\r\n if( !animation ) return;\r\n this.progress += time * animation.fps;\r\n while( this.progress >= 1.0 ) {\r\n this.progress -= 1.0;\r\n this.frame++;\r\n if( this.frame >= animation.startFrame + animation.numFrames ) {\r\n this.frame = animation.startFrame;\r\n }\r\n }\r\n }", "onAnimFrame() {\n const now = Date.now();\n const delta = now - this.previousFrameTime;\n const interval = 1000 / this.props.fps;\n\n this.requestId = window.requestAnimationFrame(this.onAnimFrame);\n\n if (delta > interval) {\n this.previousFrameTime = now - (delta % interval);\n this.drawCurrentFrame();\n\n // Clamp playback between start & end frame range, looping\n // whenever we run past the end frame.\n if (this.frame < this.startFrame || this.frame > this.endFrame) {\n this.frame = this.startFrame;\n }\n }\n }", "function startAnimation(){ // Codes nang pagpagalaw nang box\n\n\n\n\tvar decideMove = Math.floor(Math.random() * 3) +1; // mag generate nang number between 1 - 3;\n\n\t// \tvar snd1 = new Howl({\n\t// \t\tsrc:['../assets/sounds/switching-box.mp3'],\n\t// \t\tvolume:0.5,\n\t// });\n\t\t\n\t// \tsnd1.play();\n\t\n\tif (decideMove == 1) { // and number na generated is = 1\n\n\n\n\t\t$(positionA).animate({\n\t\t\t'left' : b2pos,\n\t\t},200); // change position nang left box to center box\n\n\t\t$(positionB).animate({\n\t\t\t'left' : b1pos,\n\t\t},200); // change position nang center box to left box\n\n\t\tvar pos1 = positionA; // mag set nang variable para sa new position\n\t\tvar pos2 = positionB; // mag set nang variable para sa new position\n\n\t\tpositionA = pos2; // pag palitin yung position ni #box-object-1 at #box-object-2\n\t\tpositionB = pos1; // pag palitin yung position ni #box-object-2 at #box-object-1\n\n\t\t// !NOTE need i change ang result so may track kung saan yung box na may laman\n\n\n\n\t}else if (decideMove == 2) { // and number na generated is = 2\n\n\t\t$(positionB).animate({\n\t\t\t'left' : b3pos,\n\t\t},200);\n\t\t$(positionC).animate({\n\t\t\t'left' : b2pos,\n\t\t},200);\n\n\t\tvar pos1 = positionB;\n\t\tvar pos2 = positionC;\n\n\t\tpositionB = pos2;\n\t\tpositionC = pos1;\n\n\n\n\n\t}else if (decideMove == 3) { // and number na generated is = 3\n\t\t$(positionA).animate({\n\t\t\t'left' : b3pos,\n\t\t},200);\n\t\t$(positionC).animate({\n\t\t\t'left' : b1pos,\n\t\t},200);\n\n\t\tvar pos1 = positionA;\n\t\tvar pos2 = positionC;\n\n\t\tpositionA = pos2;\n\t\tpositionC = pos1;\n\n\t}\n\n\tsetTimeout(function(){ // Kada 0.3 seconds \n\t\t\n\t\tif (runtimes < 20 ) { // compare yung value ni runtimes kung mas maliit pa sya kay 20\n\t\t\truntimes++; // pag nag true plus 1 kay runtimes\n\t\t\t\n\t\t\treturn startAnimation(); // run nya ulit yung startAnimation\n\t\t\n\t\t} else { // if runtimes is = 20\n\t\t\t\n\n \n showResult(); // para lumabas ang result\n\t\tsetTimeout(function(){\n\t\tresetgame(); // resetNa yung game back to normal layour\n\t\t},11000)\n\t\t}\n\t},300);\n\n}", "createSpriteAnimations() {\n const haloFrames = this.anims.generateFrameNames('haloHit', { \n start: 1, end: 84, zeroPad: 5,\n prefix: 'Halo_' , suffix: '.png'\n });\n\n this.anims.create({ key: 'haloHit', frames: haloFrames, frameRate: 60, repeat: 0 });\n\n const sparkFrames = this.anims.generateFrameNames('sparkHit', { \n start: 1, end: 84, zeroPad: 5,\n prefix: 'Spark_' , suffix: '.png'\n });\n\n this.anims.create({ key: 'sparkHit', frames: sparkFrames, frameRate: 60, repeat: -1 });\n }" ]
[ "0.69716364", "0.6904034", "0.68851423", "0.67007816", "0.6552989", "0.6547332", "0.65439856", "0.65439767", "0.65066624", "0.64970833", "0.6486129", "0.64780354", "0.6476743", "0.64639014", "0.6432951", "0.6432079", "0.64233345", "0.64219034", "0.6420977", "0.63988847", "0.6393673", "0.63674295", "0.63567907", "0.6346632", "0.6317655", "0.62809193", "0.62753105", "0.62697864", "0.6265674", "0.6259495", "0.6253028", "0.6231055", "0.62269396", "0.62269396", "0.6204021", "0.6199962", "0.619814", "0.6182585", "0.6176403", "0.61633784", "0.6162046", "0.6149352", "0.6144999", "0.6140243", "0.612939", "0.6127547", "0.6091347", "0.60801536", "0.6077256", "0.60756534", "0.6070519", "0.60687804", "0.6064651", "0.6063533", "0.6061455", "0.6061455", "0.6061455", "0.60492104", "0.6042869", "0.6036353", "0.60353345", "0.60353345", "0.6035172", "0.6031633", "0.60297686", "0.6028043", "0.6027264", "0.6018921", "0.6016733", "0.6014113", "0.6012332", "0.601233", "0.6012155", "0.60105413", "0.60105413", "0.60103077", "0.6004459", "0.5997795", "0.59956664", "0.59797907", "0.59765995", "0.596894", "0.59626514", "0.5958531", "0.59565866", "0.595554", "0.59522825", "0.5951475", "0.59489477", "0.594375", "0.5942151", "0.5939721", "0.5936305", "0.59361863", "0.5922766", "0.5911778", "0.59069246", "0.589602", "0.5895779", "0.5894017" ]
0.7134445
0
function for setting the start coordinates for the projectile
setStart(x, y){ if (this.alive == false){ this.x = x + 130; this.y = y + 17; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setStartingPosition() {\n this.x = CELL_WIDTH * 2;\n this.y = CELL_HEIGHT * COLS;\n }", "setStart() {\n this.start = this.setPos();\n this.locationX = this.start.x;\n this.locationY = this.start.y;\n this.field[this.start.y][this.start.x] = pathCharacter;\n }", "rtnStartPos() {\n this.x = this.plyrSrtPosX;\n this.y = this.plyrSrtPosY;\n}", "setStartPosition() {\n this.x = DrunkenSailor.canvas.width - 20;\n this.y = 560;\n }", "function Projectile(x,y, width, height){\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.actualX = x + (50-width)/2;\n}", "sendToStartPos() {\n this.x = this.spawnX;\n this.y = this.spawnY;\n }", "function projectileObj() {\r\n this.coords = null;\r\n}", "constructor(startX, startY) {\r\n this.x = startX;\r\n this.y = startY;\r\n }", "function dragStart() {\n this.ox = this.attr(\"x\");\n this.oy = this.attr(\"y\");\n }", "startOver() {\n //x cordinates\n this.x = this.beginX;\n //y cordinates\n this.y = this.beginY;\n }", "set tileOrigin(coord) {\n this.x = coord.x * 8;\n this.y = coord.y * 8;\n }", "getStartingPosition(){\n return [this.x,this.y];\n }", "start() {\n if (this.mode !== mode.move) return;\n\n this.ox = this.box.attr(\"x\");\n this.oy = this.box.attr(\"y\");\n }", "toStartingPosition() {\n\n for (let i = 0; i < this.frameCount; i++) {\n const frame = this[`frame${i}`];\n this.xLoc = 376;\n frame.style.left = `${this.xLoc}px`;\n this.yLoc = 512;\n frame.style.top = `${this.yLoc}px`;\n }\n\n }", "function Start () {\nstartpos = transform.position;\n}", "mouseLocationStart(e){\n this.xStart = e.offsetX;\n this.yStart = e.offsetY;\n }", "start(file, canvas, x, y) {\n this.startPos = {x,y};\n }", "constructor(startCell) {\n this.currentCell = startCell;\n this.x = startCell.column;\n this.y = startCell.row;\n }", "function Position(start) {\n\t this.start = start;\n\t this.end = { line: lineno, column: column };\n\t this.source = options.source;\n\t }", "function Position(start) {\n this.start = start\n this.end = {line: lineno, column: column}\n this.source = options.source\n }", "function start(elem) {\n return new Point(magic).moveToStart(elem);\n}", "get tileOrigin() {\n return { x: Math.round(this.x / 8), y: Math.round(this.y / 8) }\n }", "function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }", "function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }", "function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }", "function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }", "function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }", "function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }", "_setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates;\n }", "_setStartCameraPosition() {\n this._startCameraPosition = new Vector2(this._camera.x, this._camera.y);\n }", "moveTo(x, y) {\n this.x = x;\n this.y = y;\n }", "function Position(start) {\n this.start = start;\n this.end = {\n line: lineno,\n column\n };\n this.source = options.source;\n }", "teleportToInitialPosition() {\n let coords = game.calculateCoordinatesByPosition(this.row, this.column);\n this.x = coords[0];\n this.y = coords[1];\n if (this.elem.style.display === \"none\") {\n this.elem.style.display = \"inline\";\n }\n if (!this.collisionable)\n this.collisionable = true;\n }", "async function shootProjectile(startX, startY, firstX, firstY) {\r\n\t\tvar orientation = commandHistory[commandHistory.length - 1];\r\n\t\t// The next coordinates for the projectile.\r\n\t\tvar nextXCord = startX;\r\n\t\tvar nextYCord = startY;\r\n\r\n\t\tswitch (orientation) {\r\n\t\t\tcase \"w\":\r\n\t\t\t\tnextYCord -= 1;\r\n\t\t\t\tnextXCord = startX;\r\n\r\n\t\t\t\twidth = projectileHeight;\r\n\t\t\t\theight = tileHeight;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"a\":\r\n\t\t\t\tnextXCord -= 1;\r\n\t\t\t\tnextYCord = startY;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"d\":\r\n\t\t\t\tnextXCord += 1;\r\n\t\t\t\tnextYCord = startY;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"s\":\r\n\t\t\t\tnextYCord += 1;\r\n\t\t\t\tnextXCord = startX;\r\n\r\n\t\t\t\twidth = projectileHeight;\r\n\t\t\t\theight = tileHeight;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tif (!isOutside(nextXCord, nextYCord)) {\r\n\r\n\t\t\t// Do not update 2d world array to a projectile/abyss if there is an enemy there.\r\n\t\t\tif (nextXCord != posEnemyX && nextYCord != posEnemyY) {\r\n\t\t\t\tworld[nextXCord][nextYCord] = 2;\r\n\t\t\t}\r\n\r\n\t\t\tif (startX != posEnemyX && startY != posEnemyY) {\r\n\t\t\t\tworld[startX][startY] = 0;\r\n\t\t\t}\r\n\t\t\tredraw(world);\r\n\r\n\t\t\tawait sleep(10);\r\n\t\t\tshootProjectile(nextXCord, nextYCord, firstX, firstY);\r\n\t\t} else {\r\n\t\t\tworld[startX][startY] = 0;\r\n\t\t}\r\n\r\n\t}", "function setUpStartState() {\n startState.x = width / 2;\n startState.y = 200;\n startState.vx = 5;\n startState.vy = 1;\n startState.size = 45;\n}", "function coordonnees() {\n // code fictif\n return { x:25, y:12.5 };\n}", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "init() {\n this.x = 200;\n this.y = 410; \n }", "function projectile(num) {\n this.x = 0;\n this.y = 0;\n this.width = 20;\n this.height = 20;\n this.moving = \"right\";\n this.damage = 1;\n this.destroyed = 0;\n this.launchedBy = 0;\n}", "moveTo(x, y) {\n this.params.x = x\n this.params.y = y\n this.updateParams()\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n console.error('Impossible to identify start Cell point.', startPoint);\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n console.error('Impossible to identify start Row point.', startPoint);\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "function setStart(rownum,colnum){\n //TODO: Gather the row/col number from the user\n // var rownum = 0\n // var colnum = 0\n //TODO: preset here, need modification\n if(rownum < 0 || rownum >= GRID_ROW_SIZE || colnum < 0 || colnum >= GRID_COL_SIZE){\n console.log(\"Invalid number: data out of bound\")\n }\n if(rownum == EndPoint[0] && colnum == EndPoint[1]){\n // cannot override endpoint\n return\n }\n Grid[StartPoint[0]][StartPoint[1]].State = \"NULL\"\n document.getElementById(Grid[StartPoint[0]][StartPoint[1]].id).innerHTML=\"\";\n\n Grid[rownum][colnum].State = \"Start\"\n document.getElementById(Grid[rownum][colnum].id).innerHTML=\"<div class='\"+setterMode+\"'></div>\";\n StartPoint = [rownum,colnum]\n\n\n\n return\n\n}", "function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n // Impossible to identify start Cell point\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n // Impossible to identify start Row point\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }", "goalReached(){\n this.x = startX;\n this.y = startY;\n this.hasWon = true;\n }", "function Projectile(objSprite, intBaseYPosition, intMovementSpeed, intDamage)\n{\n this.objSprite = objSprite;\n //TODO : set x to front of ship\n this.x = 10;\n this.y = intBaseYPosition;\n this.intMovementSpeed = intMovementSpeed;\n this.intDamage = intDamage;\n \n //Projectile's horizontal movement\n this.HorizontalMovement = function()\n {\n this.x += this.intMovementSpeed;\n };\n}", "move() {\n this.x += this.xdir * .5;\n this.y += this.ydir * .5;\n }", "setupCoordinates(){\n // Start the circle off screen to the bottom left.\n // We divide the size by two because we're drawing from the center.\n this.xPos = -circleSize / 2;\n this.yPos = height + circleSize / 2;\n }", "get position() { return p5.prototype.createVector(0, this.height + Earth.RADIUS, 0); }", "function Position(start) {\n this.start = start;\n this.end = now();\n }", "function Position(start) {\n this.start = start;\n this.end = now();\n }", "function Position(start) {\n this.start = start;\n this.end = now();\n }", "function Position(start) {\n this.start = start;\n this.end = now();\n }", "function Position(start) {\n this.start = start;\n this.end = now();\n }", "function dragStart() {\n mx = d3.event.x;\n my = d3.event.y;\n }", "projectile(enemy) {\n this.vx = this.speed * cos(this.angle);\n this.vy = this.speed * sin(this.angle);\n\n this.x += this.vx;\n this.y += this.vy;\n\n if (this.x > width) {\n this.active = false;\n } else if (this.y > height) {\n this.active = false;\n }\n\n //Gray round projectile\n fill(75);\n ellipse(this.x, this.y, this.size);\n\n if (this.fired) {\n ellipse(this.x, this.y, this.size);\n }\n }", "setupCoordinates(){\n // Starts the circle and square off screen to the bottom left\n // We divide their size by two because we're drawing from the center\n this.xPos = width + squareSize / 2;\n this.yPos = height + squareSize / 2;\n }", "move() {\n this.geometricMidpoint = this.setGeometricMidpoint();\n this.in.X = this.position.X - this.geometricMidpoint.X;\n this.in.Y = this.position.Y - this.geometricMidpoint.Y;\n }", "function Position(start) {\n this.start = start\n this.end = now()\n }", "constructor(x_pos, y_pos) {\n this.x_pos = x_pos;\n this.y_pos = y_pos;\n }", "moveTo(x, y) {\n\n this.tr.x = x;\n this.tr.y = y;\n }", "function Origin(){\n this.x = midWidth;\n this.y = midHeight;\n}", "function setLoc() {\n xLoc = random(60, width - 60);\n yLoc = random(60, height - 60);\n}", "function Projectile(spriteSheet, originX, originY, xTarget, yTarget, belongsTo) {\n this.origin = belongsTo;\n\n this.width = 100;\n this.height = 100;\n this.animation = new Animation(spriteSheet, this.width, this.height, 1, .085, 8, true, .75);\n\n this.targetType = 4;\n this.x = originX - CAMERA.x;\n this.y = originY - CAMERA.y;\n\n this.xTar = xTarget - 20;\n this.yTar = yTarget - 35;\n // Determining where the projectile should go angle wise.\n this.angle = Math.atan2(this.yTar - this.y, this.xTar - this.x);\n this.counter = 0; // Counter to make damage consistent\n this.childUpdate;//function\n this.childDraw;//function\n this.childCollide;//function\n this.speed = 200;\n this.projectileSpeed = 7.5;\n this.damageObj = DS.CreateDamageObject(15, 0, DTypes.Normal, null);\n this.penetrative = false;\n this.aniX = -18;\n this.aniY = -5;\n Entity.call(this, GAME_ENGINE, originX, originY);\n\n this.boundingbox = new BoundingBox(this.x + 8, this.y + 25,\n this.width - 75, this.height - 75);\n\n}", "position() {\n // p5.Vector.fromAngle() makes a new 2D vector from an angle\n // millis returns the number of milliseconds since starting the sketch when setup() is called)\n let formula = p5.Vector.fromAngle(millis() / this.millisDivider, this.length);\n translate(formula);\n }", "function precal_loc() {\n buffer_loc.forEach((obj)=>{obj.x = (obj.longitude + 180) * 10; obj.y = (90 - obj.latitude) * 10;});\n}", "start (lat, lon) {\r\n this._creationTime = Date.now()\r\n this._pastPos.push([lat, lon, this._creationTime])\r\n this._pastPos.shift()\r\n }", "function setFinalPoint() {\n let x = document.getElementById('final-x').value\n let y = document.getElementById('final-y').value\n map.updateFinalDest(finalDest.x, finalDest.y, x - 1, y - 1)\n document\n .getElementById(`output-${finalDest.x}-${finalDest.y}`)\n .classList.remove('goal')\n finalDest.x = x - 1\n finalDest.y = y - 1\n document\n .getElementById(`output-${finalDest.x}-${finalDest.y}`)\n .classList.add('goal')\n}", "function setLandingPosition(){\n landingPosition.x = Math.floor(Math.random() * (landingLimitCoordinates.right - landingLimitCoordinates.left + 1) + landingLimitCoordinates.left);\n landingPosition.y = Math.floor(Math.random() * (landingLimitCoordinates.down - landingLimitCoordinates.up + 1) + landingLimitCoordinates.up);\n}", "function setPiecesStartPosition() {\n piecesArr.forEach((piece) => {\n setPieceLocation(\n `${piece.position.i},${piece.position.j}`,\n piece.name,\n piece.icon,\n piece.type\n );\n });\n}", "setPositionToTile(tile = this.assignment) {\n if (!this.pixi)\n this.draw(true);\n this.pixi.position = tile.getCenter().clone();\n\n // Reset the visual position, if any\n delete this.pixi.data.position;\n }", "setStartPosition() {\n if (this.props.debug && this.props.selectReil) {\n return (((this.props.sliderReil - this.props.selectReil) * Reel.iconHeight) * -1)\n }\n return ((Math.floor((Math.random() * 5))) * Reel.iconHeight) * -1;\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}", "setInitialBowlerPosition() {\n\t\tthis.startBowlPosX = config.width * 0.55;\n\t\tthis.startBowlPosY = config.height * 0.35;\n\t}", "restart() {\n this.y = this.startY;\n this.x = this.startX;\n }", "function setPosition(start, end) {\n var pos = { to: -1, start: -1, end: -1 };\n mRoot.objEntities.forEach(function (entity) {\n var holders = entity.holders;\n for (var i = 0; i < holders.length; i++) {\n var holder = holders[i];\n var limit = {\n min: {\n x: holder.attr(\"x\") - 5,\n y: holder.attr(\"y\") - 5\n },\n max: {\n x: holder.attr(\"x\") + holder.attr(\"width\") + 5,\n y: holder.attr(\"y\") + holder.attr(\"height\") + 5\n }\n }\n if (limit.min.x <= start.x && start.x <= limit.max.x &&\n limit.min.y <= start.y && start.y <= limit.max.y) {\n pos.start = holder.id;\n }\n if (limit.min.x <= end.x && end.x <= limit.max.x &&\n limit.min.y <= end.y && end.y <= limit.max.y) {\n pos.end = holder.id;\n pos.to = entity.id;\n }\n }\n });\n return pos;\n }", "startAt(first_move) {\n this.move_index = typeof first_move==\"number\" ? first_move-1 : -1; //which move to load if provided, else -1\n\n this.draw_everything();\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 }", "moveTo(g, x, y, speed = this.baseMapSpeed*2)\n {\n if (this.x == x && this.y == y)\n return\n if (Settings.get(\"cut_skip\") == true)\n {\n this.teleport(g, x, y);\n return;\n }\n\n return new Promise( async (resolve) => {\n let p = await generatePath(g, this.x, this.y, x, y, this.movcost);\n if (p == null)\n {\n\tthrow \"Could not find path to (x, y) = (\" + this.x + \", \" + this.y + \") to (\" + x + \", \" + y + \").\";\n }\n this.path_iter = p.iter();\n this.path_iter.onDone = resolve;\n this.path_iter.counter = speed;\n this.mapSpeed = speed;\n this.path_iter.next();\n this.moving = true;\n g.Map.removeUnit(this);\n g.Map.getTile(x, y).unit = this;\n });\n }", "translate(newPosX, newPosY) {\n this.posX = newPosX\n this.imgProperties.posX = newPosX - (this.tileSize - this.width) / 2\n this.posY = newPosY\n this.imgProperties.posY = newPosY - this.tileSize * 0.65\n }", "function startPosition(){\n painting = true;\n }", "setCoordinates() {\n while (this.coordinates == null || !this.isWithinShape(this.coordinates)) {\n // Position the circle within the shape\n this.coordinates = createVector(random(width), random(height)); \n } \n }", "setTarget(x, y) {\n this.targetX = x;\n this.targetY = y;\n //Check if the distance is a lot (40 min)\n //console.log(x - this.x);\n // this.setPosition(x, y);\n }", "function dragstart(element) {\r\n dragobjekt = element;\r\n dragx = posx - dragobjekt.offsetLeft;\r\n dragy = posy - dragobjekt.offsetTop;\r\n}", "start(editor, at) {\n return Editor.point(editor, at, {\n edge: 'start'\n });\n }", "start(editor, at) {\n return Editor.point(editor, at, {\n edge: 'start'\n });\n }", "function Waypoint( startX, startY, endX, endY, carHeading, initialActive )\n{\n\tthis.sX = startX;\n\tthis.sY = startY;\n\tthis.eX = endX;\n\tthis.eY = endY;\n\tthis.active = initialActive ? true : false;\n\t\n\tthis.spawnX = ( startX + endX ) / 2 ;\n\tthis.spawnY = ( startY + endY ) / 2;\n\tthis.heading = carHeading;\n}", "set start(value) {}", "function dragStart() {\n //console.log(\"start\");\n tick = 50;\n dragTop = \"\";\n dragging = true;\n vStartX = \"\";\n vStartY = \"\";\n vStartX = parseInt($(\"#pukBox\").offset().left - $(\"#gameBox\").offset().left);\n vStartY = parseInt($(\"#pukBox\").offset().top - $(\"#gameBox\").offset().top);\n //console.log(\"vStartX::\" + vStartX + \"//vStartY::\" + vStartY);\n}", "move() {\n this.x = mouseX;\n this.y = mouseY;\n }", "_projectCoordinates() {\n var _point;\n return this._coordinates.map(latlon => {\n _point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * _point.x;\n this._offset.y = -1 * _point.y;\n\n this._options.pointScale = this._world.pointScale(latlon);\n }\n\n return _point;\n });\n }", "function startPoint()\n{\n\n}" ]
[ "0.6912226", "0.6832978", "0.6782371", "0.67650247", "0.6622884", "0.6473286", "0.64385235", "0.6422049", "0.63959634", "0.6380487", "0.6364963", "0.63424397", "0.63280666", "0.632175", "0.6293732", "0.622061", "0.6207966", "0.6100578", "0.6099007", "0.60922694", "0.60753715", "0.6066476", "0.60520667", "0.60520667", "0.60520667", "0.60520667", "0.60520667", "0.60520667", "0.6048306", "0.6044646", "0.6034801", "0.6012991", "0.60062784", "0.59986573", "0.5988034", "0.5983352", "0.5974266", "0.5974266", "0.5974266", "0.5961553", "0.5955917", "0.5955917", "0.5955917", "0.5955917", "0.59447604", "0.5942485", "0.5924205", "0.5917978", "0.5917978", "0.5917978", "0.5909773", "0.5905523", "0.59006244", "0.5897717", "0.5849886", "0.58393586", "0.5835861", "0.58316284", "0.58316284", "0.58316284", "0.58316284", "0.58316284", "0.5821408", "0.58174825", "0.5811629", "0.58110654", "0.5799809", "0.5752463", "0.57499033", "0.5748234", "0.5745518", "0.5737914", "0.57326967", "0.5724693", "0.5716804", "0.5710525", "0.5696318", "0.5684903", "0.5682538", "0.56737185", "0.56672806", "0.5661921", "0.5659938", "0.5658775", "0.56571335", "0.564962", "0.5643001", "0.5641147", "0.56364244", "0.5633177", "0.562673", "0.5615317", "0.56135494", "0.56135494", "0.5605286", "0.56031966", "0.5600326", "0.5597825", "0.5594852", "0.5591355" ]
0.70478463
0
drawing the projectile if it is "alive"
draw(){ if (this.alive === true) image(this.spriteSheet, this.x, this.y, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "projectile(enemy) {\n this.vx = this.speed * cos(this.angle);\n this.vy = this.speed * sin(this.angle);\n\n this.x += this.vx;\n this.y += this.vy;\n\n if (this.x > width) {\n this.active = false;\n } else if (this.y > height) {\n this.active = false;\n }\n\n //Gray round projectile\n fill(75);\n ellipse(this.x, this.y, this.size);\n\n if (this.fired) {\n ellipse(this.x, this.y, this.size);\n }\n }", "function drawProjectiles(){\n for(i = 0; i < projectiles.length; i++){\n if(projectiles[i].type == \"water\"){\n ctx.strokeStyle = \"#233dbc\";\n ctx.beginPath();\n ctx.arc(projectiles[i].x, projectiles[i].y, projectiles[i].r, 0, 2*Math.PI);\n ctx.stroke();\n }else if(projectiles[i].type == \"bug\"){\n if(projectiles[i].dx < 0 ){\n ctx.drawImage(images[\"flyRight\"], projectiles[i].x - projectiles[i].r/2, projectiles[i].y - projectiles[i].r/2);\n }else{\n ctx.drawImage(images[\"flyLeft\"], projectiles[i].x - projectiles[i].r/2, projectiles[i].y - projectiles[i].r/2);\n }\n }\n \n }\n}", "function ProjectileHandling()\n{\n arr_activeProjectiles.forEach(function(element, index)\n {\n //Before drawing the object, we move it\n element.HorizontalMovement();\n //Delete the projectile if it reached the end of the level\n if(element.x > element.objSprite.width + intLevelWidth)\n {\n arr_activeProjectiles.splice(index, 1);\n }\n });\n}", "function launch(){\n gamePlay = false;\n weapon = curPlayer.getweapon();\n var t = 0;\n var x = curPlayer.getnx();\n var y = curPlayer.getny();\n var clear = false;\n var ani = setInterval(function(){projectile()}, 10);\n\n function projectile(){\n if(gamePaused== false){\n t+=1;\n redraw();\n if(y<terrainY[Math.round(x)] && x<=width && x>=0&&clear==false){\n x = curPlayer.getnx() + weapons[weapon][1]*Math.cos(curPlayer.angle())*curPlayer.getpower()*t/100;//percentage of power\n y = curPlayer.getny() - weapons[weapon][1]*Math.sin(curPlayer.angle())*curPlayer.getpower()*t/100 + (0.5*gravity)*(t*t);\n circle(ctx, x, y,weapons[weapon][0],weapons[weapon][2]);\n clear = checkDirectHit(x,y,otherPlayer);\n }\n else \n if((y>terrainY[Math.round(x)] || x>width || x<0) && clear ==false){\n explode(x,y,weapons[weapon][0]*2,otherPlayer);\n clear = true;\n }\n }\n \n if(clear==true){\n clearInterval(ani);\n if(curPlayer.getplayer()==1){\n curPlayer = tank2;\n otherPlayer = tank1;\n }\n else{\n curPlayer = tank1;\n otherPlayer = tank2; \n }\n gamePlay=true;\n ++rally;\n if(rally%2==0 && rally!=0)++volley;\n \n redraw();\n }\n }\n}", "draw(){\n\t\tif(this.dead === false){\n\t\t\tpush();\n\t\t\ttranslate(this.loc.x, this.loc.y);\n\t\t\tlet angle = this.vel.heading();\n\t\t\trotate(angle);\n\t\t\t//rotate(this.angle);\n\t\t\t//rectMode(RADIUS);\n\t\t\tfill(255, 0, 0);\n\t\t\tnoStroke();\n\t\t\t//rect(0,0, 14, 14);\n\t\t\ttriangle(20, 0, -10, 14, -10, -14);\n\t\t\tpop();\n\t\t}\n\t}", "function bullet(){\n var b = false;\n for(i = 1; i < bulletTrav.length; i++){\n rect(bulletTrav[i].x, bulletTrav[i].y + bulletTrav[i].speed, 10, 10);\n bulletTrav[i].y = bulletTrav[i].y + bulletTrav[i].speed;\n if(dist(bulletTrav[i].x, bulletTrav[i].y, targetRem[0].circX, targetRem[0].circY) < 50){\n console.log(\"hit\");\n //a = 9000;\n b = true;\n explosion();\n circSetup();\n crash();\n victory();\n \n }else{\n b = false;\n }\n }\n circReset.push(b);\n}", "function createProjectile() {\n\n if (!GAME_PAUSED){\n\n var projectileDivStr = \"<div id='a-\" + projectileIdx + \"' class='projectile'></div>\"\n // Add the snowball to the screen\n gwhGame.append(projectileDivStr);\n // Create and projectile handle based on newest index\n var $curProjectile = $('#a-'+projectileIdx);\n\n projectileIdx++; // update the index to maintain uniqueness next time\n\n var projectileEnemyID = Math.floor(Math.random() * NUM_ENEMIES);\n $curProjectile.css('width', PROJECTILE_SIZE+\"px\");\n $curProjectile.css('height', PROJECTILE_SIZE+\"px\");\n\n if(Math.random() < 1/3){\n $curProjectile.append(\"<img src='img/blueBook.png' height='\" + PROJECTILE_SIZE + \"'/>\")\n } else if(Math.random() < 2/3) {\n $curProjectile.append(\"<img src='img/icicle.png' height='\" + PROJECTILE_SIZE + \"'/>\")\n } else {\n $curProjectile.append(\"<img src='img/glasses.png' height='\" + PROJECTILE_SIZE + \"'/>\")\n }\n\n var index = 0\n let startingPositionLeft;\n let startingPositionBottom;\n $('.enemy').each( function() {\n var $curEnemy = $(this);\n if(index === projectileEnemyID){\n startingPositionLeft = parseInt($curEnemy.css('left')) + parseInt($curEnemy.css('width'))/2.5\n startingPositionBottom = parseInt($curEnemy.css('top')) + parseInt($curEnemy.css('height'))\n }\n index++\n });\n\n $curProjectile.css('left', startingPositionLeft+\"px\");\n $curProjectile.css('top', startingPositionBottom+\"px\");\n\n // Make the projectiles fall towards the bottom\n setInterval( function() {\n $curProjectile.css('top', parseInt($curProjectile.css('top'))+PROJECTILE_SPEED);\n // Check to see if the projectile has left the game/viewing window\n if (parseInt($curProjectile.css('top')) > (gwhGame.height() - $curProjectile.height())) {\n $curProjectile.remove();\n }\n }, OBJECT_REFRESH_RATE);\n }\n\n}", "function renderFlagpole()\n{\n \n push()\n stroke(150);\n strokeWeight(5);\n line(flagpole.x_pos, floorPos_y, flagpole.x_pos, floorPos_y - 200);\n \n if(flagpole.isReached)\n {\n fill(255,0,0);\n rect(flagpole.x_pos, floorPos_y -200, 50,50);\n }\n \n else\n {\n fill(255,0,0);\n rect(flagpole.x_pos, floorPos_y -50, 50,50);\n }\n \n pop();\n \n}", "function drawMissile() {\n ctx.beginPath();\n ctx.arc(missile.x, missile.y, missile.size, 0, Math.PI * 2);\n ctx.fillStyle = \"#0095dd\";\n ctx.fill();\n ctx.closePath();\n}", "function fireProjectile() {\n const { x } = tank;\n projectiles.push(\n new Projectile(x + CANVAS_WIDTH / 2, CANVAS_HEIGHT - PADDING_TANK)\n );\n}", "function renderFlagpole()\n{\n checkFlagpole(); \n push();\n strokeWeight(5);\n stroke(180);\n line(flagpole.x_pos, floorPos_y, flagpole.x_pos, floorPos_y-250);\n noStroke();\n fill(250,0, 250);\n if (flagpole.isReached)\n { \n rect(flagpole.x_pos,floorPos_y-250, 50, 50);\n }\n else\n { \n rect(flagpole.x_pos,floorPos_y-50, 50, 50);\n }\n pop(); \n}", "function checkCollition (){\n obst.forEach(function(obstacle){\n if(mrJeffers.isTouching(obstacle)){\n mrJeffers.y-=3;\n console.log ('yei');\n }\n });\n}", "function shoot() {\n // Add a new projectile to the projectiles array\n data.world.projectiles.push(\n // Projectile object\n {\n // Separate strength and health?\n \"strength\": random(2000, 2500),\n \"velocity\": {\n \"x\": (((data.input.mouse.x + data.settings.offset.x) / data.settings.zoom) - data.world.player.location.x) * random(10, 10),\n \"y\": (((data.input.mouse.y + data.settings.offset.y) / data.settings.zoom) - data.world.player.location.y) * random(10, 10)\n },\n \"location\": {\n \"x\": data.world.player.location.x,\n \"y\": data.world.player.location.y\n },\n \"getPoints\": function() {\n var x = this.location.x;\n var y = this.location.y;\n var points = [\n {\n \"x\": x - 0.2,\n \"y\": y - 0.2,\n },\n {\n \"x\": x + 0.2,\n \"y\": y - 0.2\n },\n {\n \"x\": x + 0.2,\n \"y\": y + 0.2\n },\n {\n \"x\": x - 0.2,\n \"y\": y + 0.2\n }\n ];\n\n return points;\n }\n }\n );\n}", "function Invasion(){\n \n\t\tfor(var i = AlienToShoot() ; i < Enemyx.length; i++){\n \n\t\t\tif(AlienToShoot() <= 40 ){\n\t\t\t\tEnemyShoot[i] == true\n\t\t\t\n\t\t\t}\n\n\t\t\tif(EnemyShoot[i] == true){\n\n \n\t\t\t\t\tctx.fillStyle = 'red';\n\t\t\t\t\tctx.fillRect(EnemyLx[i] + 13, EnemyLy[i] + 13 , 5, 10);\n\t\t\t\t\tEnemyLy[i] += 15;\n\t\t\t\t}\n\t\t\t\tif(EnemyLy[i] >= 460){\n\t\t\t\t\tEnemyShoot[i] = false;\n\t\t\t\t}\n\t\t\t\tif(EnemyLy[i] >= 460 && EnemyShoot[i] == false){\n\t\t\t\t\t\tEnemyLy[i] = 300000;\n\t\t\t\t\t\tEnemyLy[i] -= 0;\n\t\t\t\t}\n \n\t\t}\n\t}", "function draw() {\n clear();\n if(jaguar){\n if(jaguar.isShot(mouseX, mouseY)){\n killCircle = {x: mouseX, y: mouseY};\n } else {\n killCircle = undefined;\n }\n drawKillCircles();\n jaguar.render();\n\n }\n}", "function drawBullet(){\n if(playerBullet.firing){\n playerBullet.x+=playerBullet.direction*5;\n }\n //console.log(playerBullet.firing);\n for(var i = 0; i<platforms.length; i++){\n if(playerBullet.x+playerBullet.width>platforms[i].x && playerBullet.x<platforms[i].x+platforms[i].width &&\n playerBullet.y+playerBullet.height>platforms[i].y && playerBullet.y<platforms[i].y+platforms[i].height){\n console.log(platforms[i]);\n playerBullet.firing = false;\n playerBullet.x = levelDimensions.right+500;\n playerBullet.y = levelDimensions.right+500;\n }\n }\n ctx.beginPath();\n ctx.rect(playerBullet.x-cameraX,playerBullet.y-cameraY,playerBullet.width,playerBullet.height);\n ctx.fillStyle = \"#FF00FF\";\n ctx.fill();\n ctx.closePath(); \n}", "function bombCheck() {\n\tif (x==1 && y==2 || x==18 && y==3 || x==18 && y==9 || x==13 && y==2 || x==3 && y==7 || x==14 && y==6 || x==17 && y==7) {\n\t\tconst position = getPosition();\n\t\tposition.append(bombImg);\n\t\talert('You hit the bomb!')\n\t\thealth -= 10;\n\t}\n}", "function shoot() {\n\tif (bulletDelay < 0) {\n\t\tprojectiles.push({\n\t\t\tx: player.x + (player.width / 2) - scrollDistance,\n\t\t\ty: player.y + (player.height / 2) - (coinSize / 2)\n\t\t})\n\t\tbulletDelay = 30;\n\t}\n}", "function wormIsAlive(currentWorm)\r\n{\r\n\tradians = currentWorm.angle*(Math.PI/180);\r\n\tsin = Math.sin(radians*sizeMultiplier);\r\n\tcos = Math.cos(radians*sizeMultiplier);\r\n\tstorePreviuosCoordinates(currentWorm);\r\n\tcurrentWorm.y += sin;\r\n\tcurrentWorm.x += cos;\r\n\tdrawWorm(currentWorm);\t\r\n}", "draw() {\n requestAnimationFrame(() => {\n const ctx = this.#canvas.getContext('2d');\n ctx.fillStyle = this.#style.color;\n for (let x = 0; x < this.#width; x += 1) {\n for (let y = 0; y < this.#height; y += 1) {\n if (this.cell(x, y) === alive) {\n ctx.fillRect(\n x * this.#style.size,\n y * this.#style.size,\n this.#style.size,\n this.#style.size);\n }\n else {\n ctx.clearRect(\n x * this.#style.size,\n y * this.#style.size,\n this.#style.size,\n this.#style.size);\n }\n }\n }\n });\n }", "function draw() {\n background(\"#c5c5c5\");\n\nif(avatar.alive){\n displayAvatar();\n updateAvatar();\n displayFood();\n updateFood();\n checkCollision();\n}\n}", "function Projectile(spriteSheet, originX, originY, xTarget, yTarget, belongsTo) {\n this.origin = belongsTo;\n\n this.width = 100;\n this.height = 100;\n this.animation = new Animation(spriteSheet, this.width, this.height, 1, .085, 8, true, .75);\n\n this.targetType = 4;\n this.x = originX - CAMERA.x;\n this.y = originY - CAMERA.y;\n\n this.xTar = xTarget - 20;\n this.yTar = yTarget - 35;\n // Determining where the projectile should go angle wise.\n this.angle = Math.atan2(this.yTar - this.y, this.xTar - this.x);\n this.counter = 0; // Counter to make damage consistent\n this.childUpdate;//function\n this.childDraw;//function\n this.childCollide;//function\n this.speed = 200;\n this.projectileSpeed = 7.5;\n this.damageObj = DS.CreateDamageObject(15, 0, DTypes.Normal, null);\n this.penetrative = false;\n this.aniX = -18;\n this.aniY = -5;\n Entity.call(this, GAME_ENGINE, originX, originY);\n\n this.boundingbox = new BoundingBox(this.x + 8, this.y + 25,\n this.width - 75, this.height - 75);\n\n}", "function drawCollectable(t_collectable)\n{\n if(t_collectable.isFound == false)\n {\n fill(255,255,120);\n stroke(0);\n ellipse(t_collectable.x_Pos, t_collectable.y_Pos, t_collectable.size +30,80);\n ellipse(t_collectable.x_Pos, t_collectable.y_Pos, t_collectable.size);\n fill(100,155,255);\n rect(t_collectable.x_Pos -10,t_collectable.y_Pos -9,t_collectable.size -30,20);\n }\n}", "function Missiles(x, y, color) {\n this.x = x; // Coordonnée X du Missile\n this.y = y; // Coordonnée Y du Missile\n this.color = color // Couleur du missile\n this.rayon = 5; // Taille du Rayon du Missile\n \n\n // FONCTION DESSINER MISSILE\n this.drawMissile = function() {\n ctx.beginPath();\n ctx.fillStyle = this.color;\n ctx.arc(this.x, this.y, this.rayon, 0, Math.PI * 2);\n ctx.fill();\n };\n \n // FONCTION TRAJECTOIRE MISSILE\n this.trajectoireMissile = function() {\n this.y -= box * 2; // EFFET D'ANIMATION EN DECREMENTANT \"Y\" ( DONC TRAJECTOIRE MONTANTE )\n };\n\n // FONCTION TRAJECTOIRE MISSILE ALIEN\n this.trajectoireMissileAlien = function() {\n this.y = this.y + (box * 2); // EFFET D'ANIMATION EN INCREMENTANT \"Y\" ( DONC TRAJECTOIRE DESCENDANTE )\n };\n\n // FONCTION COLLISION MISSILE PLAYER ALIEN\n this.checkedCollisionAlien = function(target) { // DEFINITION ZONE INTERVALLE DE PERCUTION DES ALIENS\n // SI LES COORDONNEES \"X\" ET \"Y\" DE MON MISSILE SONT EGALES AUX COORDONNEES \"X\" ET \"Y\" DE MON ALIEN return TRUE sinon FALSE\n if ((this.y === target.y && this.x === target.x) || (this.x <= target.x + 30 && this.x >= target.x && this.y == target.y) || (this.y === (target.y + 30) && this.x === (target.x + 30))) {\n console.log(\"boom\"); \n return true;\n }else{\n return false;\n }\n }\n\n this.checkedCollisionPlayer = function(target) { // DEFINITION ZONE INTERVALLE DE PERCUTION DU PLAYER\n if ((this.x >= target.x && this.x <= target.x + target.width) && this.y === target.y){\n console.log(\"booooooommmmm\")\n return true;\n }else{\n return false;\n }\n }\n}", "isImpacted(bullet) {\n const enemyLeft = this.x;\n const enemyRight = this.x + this.size;\n const enemyTop = this.y;\n const enemyBottom = this.y + this.size;\n\n const bulletLeft = bullet.x;\n const bulletRight = bullet.x + bullet.size;\n const bulletTop = bullet.y;\n const bulletBottom = bullet.y + bullet.size;\n\n const crossLeft = bulletRight <= enemyRight && bulletRight >= enemyLeft;\n const crossRight = bulletRight >= enemyLeft && bulletLeft <= enemyRight;\n const crossBottom = bulletBottom >= enemyTop && bulletBottom <= enemyBottom;\n const crossTop = bulletTop <= enemyBottom && bulletTop >= enemyTop;\n\n if ((crossLeft || crossRight) && (crossTop || crossBottom)) {\n return true;\n } else {\n return false;\n }\n }", "run(obs) {\n if (!this.stopped) {\n this.update();\n // If I hit an edge or an obstacle\n if ((this.borders()) || (this.checkObstacles(obs))) {\n this.stopped = true;\n this.dead = true;\n }\n }\n // Draw me!\n this.display();\n }", "step() {\n this.draw();\n return !this.alive;\n }", "function hitBomb(player, bomb)\n{\n //game pauses\n this.physics.pause();\n //player turns red as if dead\n player.setTint(0xff0000);\n //last image of player when dead is the turn animation\n player.anims.play('turn');\n //gameOver is true as a result\n gameOver = true;\n}", "function isDraw() {\n if (occupiedCells === 9 && !isGameOver()) {\n playerDisplay.textContent = \"IT'S A TIE!\";\n modalHeader.textContent = \"IT'S A TIE!\";\n modalText.textContent = \"\";\n\n isGameOver(true);\n }\n}", "function itsAHit(proj, currEnemy)\r\n{\r\n //if the projectiles y coordinate is within the enemies current y range\r\n if(proj.y >= currEnemy.y && proj.y <= (currEnemy.y + currEnemy.height)){\r\n //if the projectiles x coordinate is within the enemies current x range\r\n if((proj.x+proj.width) >= currEnemy.x && proj.x <= (currEnemy.x+currEnemy.width)){\r\n //return true cuz its a hit\r\n return true;\r\n }\r\n else{\r\n //return false cuz not in x range\r\n return false;\r\n }\r\n }\r\n else{\r\n //return false cuz not in y range\r\n return false;\r\n }\r\n}", "function checkCollision() {\n if (hasShot == true) {\n $(\"#playerProjectile\").css(\"top\", parseInt($(\"#playerProjectile\").css(\"top\").replace(\"px\",\"\"))-10);\n if ($(\"#playerProjectile\").offset().top <= $(\"#main\").offset().top) {\n // The projectile reaches the screen's top\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n hasShot = false;\n }\n else if ( !((($(\"#playerProjectile\").offset().top + $(\"#playerProjectile\").height()) < ($(\"#enemyShipSkills\").offset().top)) ||\n ($(\"#playerProjectile\").offset().top > ($(\"#enemyShipSkills\").offset().top + $(\"#enemyShipSkills\").height())) ||\n (($(\"#playerProjectile\").offset().left + $(\"#playerProjectile\").width()) < $(\"#enemyShipSkills\").offset().left) ||\n ($(\"#playerProjectile\").offset().left > ($(\"#enemyShipSkills\").offset().left + $(\"#enemyShipSkills\").width())))) {\n // the projectile hits the skills enemy. Good job, you just ruined someone's talents.\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n $(\"#explosion\").css(\"top\", $(\"#enemyShipSkills\").offset().top - 25);\n $(\"#explosion\").css(\"left\", $(\"#enemyShipSkills\").offset().left - 10);\n $(\"#explosion\").attr(\"src\",\"\");\n $(\"#enemyShipSkills\").css(\"display\",\"none\");\n $(\"#explosion\").attr(\"src\",\"img/ship/cv_enemy_explosion.gif\");\n hasShot = false;\n showSkills();\n }\n else if ( !((($(\"#playerProjectile\").offset().top + $(\"#playerProjectile\").height()) < ($(\"#enemyShipExperience\").offset().top)) ||\n ($(\"#playerProjectile\").offset().top > ($(\"#enemyShipExperience\").offset().top + $(\"#enemyShipExperience\").height())) ||\n (($(\"#playerProjectile\").offset().left + $(\"#playerProjectile\").width()) < $(\"#enemyShipExperience\").offset().left) ||\n ($(\"#playerProjectile\").offset().left > ($(\"#enemyShipExperience\").offset().left + $(\"#enemyShipExperience\").width())))) {\n // the projectile hits the experience's enemy. Good job, you just ruined someone's history.\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n $(\"#explosion\").css(\"top\", $(\"#enemyShipExperience\").offset().top - 25);\n $(\"#explosion\").css(\"left\", $(\"#enemyShipExperience\").offset().left - 10);\n $(\"#explosion\").attr(\"src\",\"\");\n $(\"#enemyShipExperience\").css(\"display\",\"none\");\n $(\"#explosion\").attr(\"src\",\"img/ship/cv_enemy_explosion.gif\");\n hasShot = false;\n showExperience();\n }\n else if ( !((($(\"#playerProjectile\").offset().top + $(\"#playerProjectile\").height()) < ($(\"#enemyShipFormation\").offset().top)) ||\n ($(\"#playerProjectile\").offset().top > ($(\"#enemyShipFormation\").offset().top + $(\"#enemyShipFormation\").height())) ||\n (($(\"#playerProjectile\").offset().left + $(\"#playerProjectile\").width()) < $(\"#enemyShipFormation\").offset().left) ||\n ($(\"#playerProjectile\").offset().left > ($(\"#enemyShipFormation\").offset().left + $(\"#enemyShipFormation\").width())))) {\n // the projectile hits the formation's enemy. Good job, you just ruined someone's studies.\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n $(\"#explosion\").css(\"top\", $(\"#enemyShipFormation\").offset().top - 25);\n $(\"#explosion\").css(\"left\", $(\"#enemyShipFormation\").offset().left - 10);\n $(\"#explosion\").attr(\"src\",\"\");\n $(\"#enemyShipFormation\").css(\"display\",\"none\");\n $(\"#explosion\").attr(\"src\",\"img/ship/cv_enemy_explosion.gif\");\n hasShot = false;\n showFormation();\n }\n }\n}", "display() {\n push();\n fill(0,0,0);\n ellipse(this.x, this.y, this.size);\n pop();\n // if (x < 0 || x > width || y < 0 || y > height) {\n // var removed = bullets.splice(this.index, 1);\n // }\n }", "draw() {\n if (this.isAlive) {\n fill(color(200, 0, 200));\n } else {\n fill(color(240));\n }\n noStroke();\n rect(this.column * this.size + 1, this.row * this.size + 1, this.size - 1, this.size - 1);\n }", "bonanza() {\n while (!this.collides(0, 1, this.shape)) {\n this.moveDown()\n }\n }", "function isBullet_Clash_obstacle() {\r\n for (let j in stages.obstacles) {\r\n for (let i in rocket1.bullet) {\r\n if (\r\n rocket1.bullet[i].y >= stages.obstacles[j].y &&\r\n rocket1.bullet[i].y <=\r\n stages.obstacles[j].y + stages.obstacles[j].height &&\r\n rocket1.bullet[i].x + 40 >= stages.obstacles[j].x &&\r\n rocket1.bullet[i].x <= stages.obstacles[j].x\r\n ) {\r\n soundDestroy();\r\n drawBlast(\r\n imageBlast,\r\n stages.obstacles[j].x + 10,\r\n stages.obstacles[j].y,\r\n stages.obstacles[j].width + 20,\r\n stages.obstacles[j].height + 20\r\n );\r\n stages.obstacles[j].x = -100;\r\n rocket1.bullet[i].x = context1.width + 10;\r\n score += 10;\r\n }\r\n }\r\n }\r\n }", "display() {\n levelPath[this.x][this.y] = 2;\n\n for (let x = 0; x < GRIDSIZE; x++) {\n for (let y = 0; y < GRIDSIZE; y++) {\n if (levelPath[x][y] === 2) {\n fill(\"black\");\n rect(this.x * this.width, this.y * this.height, this.width, this.height);\n }\n }\n }\n }", "function checkCollition(){\n pipes.forEach(function(pipe){\n if(flappy.isTouching(pipe)) gameOver();\n });\n\n}", "update() {\n fill(0, 0, this.blue);\n rect (this.x, this.y, this.w, this.h);\n\n // console.log(\"ground is good\");\n\n\n }", "display(){\n if(this.speed != -1){ //On dit qu'une balle sortie du jeu a une vitesse de -1\n this.updatePos();\n var ctx = this.gameboard.disp.getContext(\"2d\");\n ctx.beginPath();\n ctx.arc(this.posx, this.posy, this.size, 0, 2 * Math.PI);\n ctx.fillStyle = \"white\";\n ctx.fill();\n ctx.stroke();\n ctx.closePath();\n }\n }", "function drawBulletEnemies(t_bullet)\n{\n t_bullet.x_pos -= t_bullet.speed; // Decreases x_pos to make Bullet fly across the word.\n \n if (t_bullet.x_pos <= -1300) //Resets Bullet Positioning if has reached the defined boundries.\n {\n t_bullet.x_pos = 3500;\n }\n \n \n x = t_bullet.x_pos;\n y = t_bullet.y_pos;\n size = t_bullet.size;\n push();\n \n if (t_bullet.deadly)\n { \n fill(170, 13, 0);\n }\n else\n { \n fill(0); \n }\n \n \n first_part = {\n x: x,\n y: y,\n width: 25 * size,\n height: 25 * size\n };\n rect(first_part.x, first_part.y, first_part.width, first_part.height, 360, 0, 0, 360);\n\n \n fill(10); \n second_part = {\n x: x + (25 * size),\n y: y + (2.5 * size),\n width: 4 * size,\n height: 20 * size\n };\n rect(second_part.x, second_part.y, second_part.width, second_part.height);\n \n \n fill(0);\n third_part = {\n x: (x + (25 * size) + 4 * size),\n y: y,\n width: 2 * size,\n height: 25 * size\n };\n rect(third_part.x, third_part.y, third_part.width, third_part.height);\n\n \n fill(255);\n eyes_blank = {\n x_pos: x + (8.5 * size),\n y_pos: y + (6.5 * size),\n width: 8 * size,\n height: 9 * size\n }; \n arc(eyes_blank.x_pos, eyes_blank.y_pos, eyes_blank.width,\n eyes_blank.height, -HALF_PI + QUARTER_PI, PI + -QUARTER_PI, CHORD);\n\n eyes_pupil = {\n x_pos: x + (8.5 * size),\n y_pos: y + (6.5 * size),\n width: 3 * size,\n height: 4.5 * size\n };\n \n //Eyes\n fill(0);\n arc(eyes_pupil.x_pos, eyes_pupil.y_pos, eyes_pupil.width,\n eyes_pupil.height, -HALF_PI + QUARTER_PI, PI + -QUARTER_PI, CHORD);\n\n \n //Mouth\n fill(255, 0, 0);\n mouth = {\n x_pos: x * 3,\n y_pos: y * 2.6\n };\n\n beginShape();\n vertex(x + (2.5 * size), y + (20 * size));\n bezierVertex( x + (10 * size), y + (10 * size),\n x + (13 * size), y + (22 * size),\n x + (6 * size), y + (23 * size));\n endShape();\n pop();\n\n //Sets the center x and y properties of bullet object based on full width and height of shapes\n t_bullet.center_x = x + ( (first_part.width + second_part.width + third_part.width) / 2); \n t_bullet.center_y = y + ( first_part.height / 2); \n \n checkBulletEnemies(t_bullet); //Check bullet object collision.\n}", "draw() {\n if (this.imgLoaded) {\n if (this.isGrounded) {\n let frameStr = '';\n this.currentInvincibility == 0\n ? frameStr = `frame${this.currentFrame}`\n : frameStr = `frame${this.currentFrame + 4}`;\n engine.gfxController.drawSprite(\n this.img,\n this.spriteCoordinates[frameStr][0],\n this.spriteCoordinates[frameStr][1],\n 72,\n 128,\n this.x,\n this.y,\n this.spriteWidth,\n this.spriteHeight\n );\n \n if (!this.isStopped) {\n this.waitFrames--;\n if (this.waitFrames < 1) {\n this.currentFrame++;\n if (this.currentFrame > 4) {\n this.currentFrame = 1;\n }\n this.waitFrames = this.maxWaitFrames;\n }\n }\n } else {\n let jumpStr = (this.jumpDirection > 0)\n ? \"jumpUp\"\n : \"jumpDown\";\n if (this.currentInvincibility != 0) {\n jumpStr += \"Hit\";\n } \n engine.gfxController.drawSprite(\n this.img,\n this.spriteCoordinates[jumpStr][0],\n this.spriteCoordinates[jumpStr][1],\n 72,\n 128,\n this.x,\n this.y,\n this.spriteWidth,\n this.spriteHeight);\n }\n }\n }", "drawFinishIfLessThan3Points(){\n this.hull=this.points;\n this.drawFinish();\n this.stop(); \n }", "function draw() {\n // Clear Canvas\n // Iterate through all GameObjects\n // Draw each GameObject\n // console.log(\"Draw\");\n for (i = 0; i < gameobjects.length; i++) \n {\n if (gameobjects[i].health > 0) \n {\n console.log(\"Image :\" + gameobjects[i].img);\n\n animate();\n\n }\n }\n\n}", "function drawBullets() {\n\t\n\t// Retire todos los proyectiles que han pasado fuera de la pantalla.\n\tfor (var b = 0; b < bullets.length; b++) {\n\t\tif (bullets[b].defunct == true || bullets[b].y <= 0) {\n\t\t\tbullets.splice(b, 1);\n\t\t\tb--;\n\t\t}\n\t}\n\t\n\t// pinta todas las balas que aún quedan.\n\tfor (var b = 0; b < bullets.length; b++) {\n\t\t\n\t\t// Mueva la bala un poco.\n\t\tbullets[b].y -= DELTA_BULLET;\n\t\t\n\t\t// Si la bala ha afectado a alguna de las naves espaciales!\n\t\tvar hit = false;\n\t\tfor (var s = 0; s < spaceships.length && hit == false; s++) {\n\t\t\t\n\t\t\t// Es un éxito de la prueba para ver si la bala ha afectado esta nave espacial.\n\t\t\tif ((Math.abs(spaceships[s].x - bullets[b].x) < HIT_PROXIMITY) &&\n\t\t\t\t(Math.abs(spaceships[s].y - bullets[b].y) < HIT_PROXIMITY)) {\n\t\t\t\t\n\t\t\t\t// Es un éxito! Así que marquen la nave espacial y la bala como \"defunct\".\n\n ctx.drawImage(explosion, spaceships[s].x, spaceships[s].y);\n\n\n\n\t\t\t\tspaceships[s].defunct = true;\n\t\t\t\tbullets[b].defunct = true;\n\t\t\t\thit = true;\n\n\t\t\tpunto++;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Si la bala no alcanzó ninguna de las naves espaciales, a continuación, dibuje la bala.\n\t\tif (!hit) {\n\t\t\tctx.drawImage(bullet, bullets[b].x, bullets[b].y);\n\t\t}\n\t}\n}", "function draw() {\n // Clear Canvas\n // Iterate through all GameObjects\n // Draw each GameObject\n // console.log(\"Draw\");\n for (i = 0; i < gameobjects.length; i++) {\n if (gameobjects[i].health > 0) {\n console.log(\"Image :\" + gameobjects[i].img);\n }\n }\n animate();\n}", "function createProjectile(){\n //projectile vars\n var projectileX;\n var projectileY;\n var projectileRadius = Math.random() * (10 - 3) + 3; \n var projectileVelocityX;\n var projectileVelocityY;\n\n //place the projectile at the same angle as the player and give it proper velocities\n projectileX = playerX + (Math.random() * (10 + 10) -10) + Math.cos(playerRotation * Math.PI / 180) * playerRadius;\n projectileY = playerY + (Math.random() * (10 + 10) -10) + Math.sin(playerRotation * Math.PI / 180) * playerRadius;\n projectileVelocityX = projectileSpeed * Math.cos(playerRotation * Math.PI / 180);\n projectileVelocityY = projectileSpeed * Math.sin(playerRotation * Math.PI / 180);\n\n\n //make sure the the placed projectile is not overlapping any others, get them to spread down and \"surround the fish\"\n for(i = 0; i < projectiles.length; i++){\n if(computeDistanceBetweenCircles(projectileRadius, projectileX, projectileY, projectiles[i].r, projectiles[i].x, projectiles[i].y) < projectileRadius + projectiles[i].r){\n while(computeDistanceBetweenCircles(projectileRadius, projectileX, projectileY, projectiles[i].r, projectiles[i].x, projectiles[i].y) < projectileRadius + projectiles[i].r){\n var cordToChange = Math.round(Math.random());\n if(cordToChange == 0){\n projectileX -= 1;\n }else{\n projectileY -= 1;\n }\n } \n }\n }\n\n //add projectile to projectile array\n projectiles.push({x: projectileX, y:projectileY, r: projectileRadius, dx: projectileVelocityX, dy: projectileVelocityY, type: \"water\"});\n}", "draw(ctx) {\n let xOffset = 0;\n let yOffset = 0;\n if (this.dead) {\n if (this.deadAudio) {\n ASSET_MANAGER.playAsset(\"./audio/player_death.mp3\")\n this.deadAudio = false;\n }\n\n if (this.weapon === 0 && this.facing === 0) {\n xOffset = -45;\n yOffset = -23;\n } else if (this.weapon === 0 && this.facing === 1) {\n xOffset = -35;\n yOffset = -20;\n } else if (this.weapon === 1 && this.facing === 0) {\n xOffset = -75;\n yOffset = -45;\n } else if (this.weapon === 1 && this.facing === 1) {\n xOffset = -0;\n yOffset = -42;\n } else if (this.weapon === 2 && this.facing === 0) {\n xOffset = -65;\n yOffset = -40;\n } else if (this.weapon === 2 && this.facing === 1) {\n xOffset = -30;\n yOffset = -30;\n\n }\n if (this.facing === 0) {\n this.deadAnimR[this.weapon].drawFrame(this.game.clockTick, ctx, this.x - this.game.camera.x + xOffset,\n this.y - this.game.camera.y + yOffset, 1);\n } else {\n this.deadAnimL[this.weapon].drawFrame(this.game.clockTick, ctx, this.x - this.game.camera.x + xOffset,\n this.y - this.game.camera.y + yOffset, 1);\n }\n } else {\n if (this.weapon === 0) {\n xOffset = 0;\n yOffset = 0;\n } else if (this.weapon === 1) {\n if (this.state === 0) {\n if (this.facing === 1) yOffset = 1;\n this.facing === 0 ? xOffset = 0 : xOffset = -27;\n } else if (this.state === 1 && this.facing === 1) {\n xOffset = -15;\n yOffset = 0;\n } else if (this.state === 2 && this.facing === 0) {\n xOffset = -18;\n yOffset = -15;\n } else if (this.state === 2 && this.facing === 1) {\n xOffset = -68;\n yOffset = -15;\n } else if (this.state === 3 && this.facing === 1) {\n xOffset = -45;\n yOffset = 0;\n } else if (this.state === 4 && this.facing === 1) {\n xOffset = -20;\n yOffset = -5;\n }\n } else { //if bow\n //console.log(this.facing + \" \" + this.state);\n if (this.state === 0) {\n yOffset = 1;\n this.facing === 0 ? xOffset = 0 : xOffset = 0;\n } else if (this.state === 2) {\n this.facing === 0 ? xOffset = 0 : xOffset = -7;\n } else if (this.state === 4) {\n yOffset = 5;\n }\n\n }\n yOffset -= 5;\n this.animations[this.state][this.facing][this.weapon].drawFrame(this.game.clockTick, ctx,\n this.x - this.game.camera.x + xOffset, this.y - this.game.camera.y + yOffset, 1);\n\n }\n\n if (PARAMS.DEBUG) {\n // ctx.strokeStyle = 'Red';\n // ctx.strokeRect(this.BB.x - this.game.camera.x, this.BB.y - this.game.camera.y, this.BB.width, this.BB.height);\n ctx.strokeStyle = 'Blue';\n ctx.strokeRect(this.ABB.x - this.game.camera.x, this.ABB.y - this.game.camera.y, this.ABB.width, this.ABB.height);\n\n } else if (this.weapon === 2) {\n ctx.strokeStyle = 'White';\n //ctx.arc()\n ctx.strokeRect(this.ABB.x - this.game.camera.x, this.ABB.y - this.game.camera.y, this.ABB.width, .25);\n }\n }", "function iShoot(enemy) {\r\n enemy.classList.add('dead');\r\n if(!livingEnemies().length) {\r\n setTimeout(() => {\r\n document.querySelector('#victory').style.display = 'inline'\r\n }, 1000);\r\n } \r\n}", "function projectile(num) {\n this.x = 0;\n this.y = 0;\n this.width = 20;\n this.height = 20;\n this.moving = \"right\";\n this.damage = 1;\n this.destroyed = 0;\n this.launchedBy = 0;\n}", "function isRocket_Clash_Bomb() {\r\n for (let i in stages.bomb) {\r\n if (\r\n stages.bomb[i].y >= rocket1.y &&\r\n stages.bomb[i].y <= rocket1.y + rocket1.height &&\r\n stages.bomb[i].x - rocket1.width <= rocket1.x &&\r\n stages.bomb[i].x >= rocket1.x\r\n ) {\r\n stages.bomb[i].x = -200;\r\n soundDestroy();\r\n drawBlast(\r\n imageBlast,\r\n rocket1.x,\r\n rocket1.y - 10,\r\n rocket1.width + 10,\r\n rocket1.height + 10\r\n );\r\n rocket1.x = 0;\r\n lives -= 1;\r\n }\r\n }\r\n }", "function Shoot()\n{\n\t//go through projectiles and find one that isn't in play\n\tfor (var i = 0; i < projectiles.length; i++)\n\t{\n\t\tif (!projectiles[i].GetComponent(W2BossProjectileController).OnScreen)\n\t\t{\n\t\t\t//pull into play\n\t\t\tprojectiles[i].GetComponent(W2BossProjectileController).move = this.transform.forward * ProjectileSpeed * -1;\n\t\t\tprojectiles[i].transform.position = this.transform.position + (projectiles[i].GetComponent(W2BossProjectileController).move);\n//\t\t\tprojectiles[i].tag = \"Untagged\";\n\t\t\treturn; //break out of the loop\n\t\t}\n\t}\n}", "on_ground() {\n return this.pos[1] >= GROUND;\n }", "function checkTooBad() {\n\n if (xPosition === xZombiePos && yPosition === yZombiePos) {\n gameOver();\n }\n}", "function projectileObj() {\r\n this.coords = null;\r\n}", "draw() {\n // PNG room draw\n super.draw();\n\n drawSprite(this.piggySprite)\n\n // talk() function gets called\n playerSprite.overlap(this.piggySprite, talkToPiggy);\n \n if( this.talk2 !== null && talkedToPiggy === true ) {\n image(this.talk2, this.drawX + 40, this.drawY - 190);\n }\n }", "function draw() {\n background(204, 231, 227)\n checkState();\n}", "function Projectile(game, world, spritesheet, x, y, radius, damage, isleft) {\n this.animation = new Animation(spritesheet, 0, 0, 64, 64, 0.08, 1, true);\n this.isleft = isleft;\n this.ctx = game.ctx;\n this.damage = damage;\n Entity.call(this, game, world, x, y+radius, 16, 2);\n}", "collide() {\n this.image.src = this.myImageDead;\n this.dead = true;\n }", "function isRocket_Clash_obstacle() {\r\n for (let j in stages.obstacles) {\r\n if (\r\n stages.obstacles[j].x - rocket1.width / 1.2 <= rocket1.x &&\r\n stages.obstacles[j].x >= rocket1.x &&\r\n stages.obstacles[j].y >= rocket1.y - rocket1.height &&\r\n stages.obstacles[j].y <= rocket1.y + rocket1.height\r\n ) {\r\n stages.obstacles[j].x = -200;\r\n soundDestroy();\r\n drawBlast(\r\n imageBlast,\r\n rocket1.x,\r\n rocket1.y - 10,\r\n rocket1.width + 10,\r\n rocket1.height + 10\r\n );\r\n rocket1.x = 0;\r\n lives -= 1;\r\n }\r\n }\r\n }", "boolean isDead() {\n if (center.x > width || center.x < 0 || \n center.y > height || center.y < 0 || lifespan < 0) {\n return true;\n } \n else {\n return false;\n }\n }", "function checkCanyon(t_canyon)\n{\n if(gameChar_world_x <= t_canyon.x_pos + 100 && gameChar_y >= t_canyon.y_pos && gameChar_world_x > t_canyon.x_pos)\n \n {\n isPlummeting = true;\n gameChar_y += 2;\n }\n else \n {\n \n isPlummeting = false;\n \n }\n \n \n}", "checkPosition(){\r\n if(isCriticalPosition(this.pos)){\r\n //if((this.pos.x-8)%16 == 0 && (this.pos.y-8)%16 == 0){//checks if pacman is on a critical spot\r\n //let arrPosition = createVector((this.pos.x-8)/16, (this.pos.y-8)/16);//changes location to an array position\r\n let arrPosition = pixelToTile(this.pos);\r\n //resets all paths for the ghosts\r\n //this.blinky.setPath();\r\n //this.pinky.setPath();\r\n //this.clyde.setPath();\r\n //this.inky.setPath();\r\n //Checks if the position has been eaten or not, blank spaces are considered eaten\r\n if(!this.tiles[floor(arrPosition.y)][floor(arrPosition.x)].eaten){\r\n this.tiles[floor(arrPosition.y)][floor(arrPosition.x)].eaten = true;\r\n //score+=10;//adds points for eating\r\n this.score+=1;\r\n this.dotsEaten++;\r\n this.ttl = 600;\r\n if(this.tiles[floor(arrPosition.y)][floor(arrPosition.x)].bigDot){//checks if the big dot is eaten\r\n //set all ghosts to frightened mode\r\n if(!this.blinky.goHome && !this.blinky.tempDead){\r\n this.blinky.frightened = true;\r\n this.blinky.flashCount = 0;\r\n }if(!this.clyde.goHome && !this.clyde.tempDead){\r\n this.clyde.frightened = true;\r\n this.clyde.flashCount = 0;\r\n }if(!this.pinky.goHome && !this.pinky.tempDead){\r\n this.pinky.frightened = true;\r\n this.pinky.flashCount = 0;\r\n }if(!this.inky.goHome && !this.inky.tempDead){\r\n this.inky.frightened = true;\r\n this.inky.flashCount = 0;\r\n }\r\n }\r\n }\r\n //the position in the tiles array that pacman is turning towards\r\n let positionToCheck = new createVector(arrPosition.x + this.goTo.x, arrPosition.y + this.goTo.y);\r\n //console.log(\"Position to Check X: \", positionToCheck.x, \" Y: \", positionToCheck.y);\r\n if(this.tiles[floor(positionToCheck.y)][floor(positionToCheck.x)].tunnel){//checks if the next position will be in the tunnel\r\n this.specialCase(this.pos);\r\n }if(this.tiles[floor(positionToCheck.y)][floor(positionToCheck.x)].wall){//checks if the space is not a wall\r\n if(tiles[floor(arrPosition.y + vel.y)][floor(arrPosition.x + vel.x)].wall){\r\n this.vel = createVector(this.goTo.x, this.goTo.y);//Not sure about this line...\r\n return false;\r\n }else{//moving ahead is free\r\n return true;\r\n }//return !(this.tiles[floor(arrPosition.y + this.vel.y)][floor(arrPosition.x + this.vel.x)].wall);//if both are walls then don't move\r\n }else{//allows pacman to turn\r\n this.vel = createVector(this.goTo.x, this.goTo.y);\r\n return true;\r\n }\r\n }else{//if pacman is not on a critial spot\r\n let ahead = createVector(this.pos.x+10*this.vel.x, this.pos.y+10*this.vel.y);\r\n //if((this.pos.x+10*this.vel.x-8)%16 == 0 && (this.pos.y+10*this.vel.y-8)%16 == 0){\r\n if(isCriticalPosition(ahead)){\r\n //let arrPosition = createVector((this.pos.x+10*this.vel.y-8)/16, (this.pos.y+10*this.vel.y)/16);\r\n let arrPostion = pixelToTile(ahead);//convert to an array position\r\n if(!this.tiles[floor(arrPosition.y)][floor(arrPosition.x)].eaten){\r\n this.tiles[floor(arrPosition.y)][floor(arrPosition.x)].eaten = true;//eat the dot\r\n this.score+=1;//10\r\n this.dotsEaten++;\r\n ttl = 600;\r\n if(this.tiles[floor(arrPosition.y)][floor(arrPosition.x)].bigDot && bigDotsActive){\r\n //this.score+=40;//could be used to give a better reward for getting the big dots\r\n //sets all ghosts to frightened mode\r\n if(!this.blinky.goHome && !this.blinky.tempDead){\r\n this.blinky.frightened = true;\r\n this.blinky.flashCount = 0;\r\n }if(!this.clyde.goHome && !this.clyde.tempDead){\r\n this.clyde.frightened = true;\r\n this.clyde.flashCount = 0;\r\n }if(!this.pinky.goHome && !this.pinky.tempDead){\r\n this.pinky.frightened = true;\r\n this.pinky.flashCount = 0;\r\n }if(!this.inky.goHome && !this.inky.tempDead){\r\n this.inky.frightened = true;\r\n this.inky.flashCount = 0;\r\n }\r\n }\r\n } \r\n }if(this.goTo.x+this.vel.x == 0 && this.vel.y+this.goTo.y == 0){//if turning change directions entirely, 180 degrees\r\n this.vel = createVector(this.goTo.x, this.goTo.y);//turn\r\n return true;\r\n }return true;//if it is not a critical position then it will continue forward\r\n }\r\n }", "drawZombieWon() {\n let g = this,\n cxt = g.context,\n img = imageFromPath(allImg.zombieWon);\n cxt.drawImage(img, 293, 66);\n }", "function detectCollision(playerObj, enemyObj) {\r\n\r\n if (playerObj.x < enemyObj.x + 40 &&\r\n playerObj.x + 40 > enemyObj.x &&\r\n playerObj.y < enemyObj.y + 40 &&\r\n playerObj.y + 40 > enemyObj.y\r\n ) {\r\n //ctx.drawImage(splash, 300, 430);\r\n splash = new Splash();\r\n splash.x = playerObj.x;\r\n splash.y = playerObj.y;\r\n resetRendering();\r\n\r\n }\r\n\r\n}", "_drawWalkableArea() {\n if (this.scene && this.scene.walkable) {\n this.graphics.beginFill(0xFF3300, 0.0);\n this.graphics.lineStyle(1, 0xFF3300, 1.0);\n this.graphics.drawPolygon(this.scene.walkable);\n this.graphics.endFill();\n }\n }", "appear()\n {\n\n this.canvas.fillStyle = Fruit.COLORS[Fruit.getRndInteger(0,Fruit.COLORS.length-1)];\n this.canvas.fillRect(this.x,this.y,this.w,this.h);\n\n }", "function updateMonsters(){\n for(var i = 0; i<monsters.length; i++){\n if(monsters[i].level == level){\n var m = monsters[i];\n if(m.x<m.xMin || m.x>m.xMax){\n monsters[i].direction*=-1;\n }\n monsters[i].x += m.direction;\n //console.log(collisionDetection(playerBullet,monsters[i]))\n if(playerBullet.x+playerBullet.width>monsters[i].x && playerBullet.x<monsters[i].x+monsters[i].width &&\n playerBullet.y+playerBullet.height>monsters[i].y && playerBullet.y<monsters[i].y+monsters[i].height){\n //console.log(\"true\");\n monsters[i].lives-=1;\n playerBullet.firing = false;\n playerBullet.x = levelDimensions.right+500;\n playerBullet.y = levelDimensions.right+500;\n }\n if(collisionDetection(player,m)&&m.lives>0){\n teleport(10,310);\n }\n m = monsters[i]\n if(m.lives>0){\n ctx.beginPath();\n ctx.rect(m.x-cameraX,m.y-cameraY,m.width,m.height);\n if(m.type==1){\n ctx.fillStyle = \"#558800\";\n }else if(m.type == 2){\n ctx.fillStyle = \"#AA0000\";\n }else if(m.type==3){\n ctx.fillStyle = \"#332299\"\n }else if(m.type==4){\n ctx.fillStyle = \"#AABBCC\";\n }else if(m.type ==5){\n ctx.fillStyle = \"#AA1166\";\n }else if(m.type == 6){\n ctx.fillStyle = \"#100120\";\n }\n ctx.fill();\n ctx.closePath();\n }\n }\n }\n}", "function Bullet(p) {\n Sprite.call(this, p);\n this.dx = p.dx;\n this.dy = p.dy;\n this.range = 400;\n this.target = p.target;\n this.speed = 1.7;\n this.step = function() {\n this.x += this.speed * Math.cos( this.angle );\n this.y += this.speed * Math.sin( this.angle );\n var stopped = false;\n // it will not float forever...\n if (stopped || this.range < 0) {\n this.isDead = true;\n if (stopped) {\n this.target.isDead = true;\n }\n }\n this.range--;\n };\n this.draw = function(ctx) {\n ctx.strokeStyle = this.color;\n ctx.translate(this.x, this.y);\n ctx.rotate(this.angle);\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.arc(0, 0, 4, 0, Math.PI * 2, false);\n ctx.stroke();\n };\n this.checkColision = function(arrObject , ctx) {\n var bulletColisionRangeX1 = this.x - 30;\n var bulletColisionRangeY1 = this.y - 30;\n\n function insideX(objX) {\n return (bulletColisionRangeX1 <= objX && objX <= ( bulletColisionRangeX1 + 60 ) );\n }\n\n function insideY(objY) {\n return (bulletColisionRangeY1 <= objY && objY <= ( bulletColisionRangeY1 + 60 ) );\n }\n\n var objLength = arrObject.length;\n for(var i = 0; i < objLength ; i++){\n var obj = arrObject[i];\n if (insideX(obj.x) && insideY(obj.y)) {\n if ((obj.x - obj.width ) <= (this.x + 2) && (this.x - 2) <= (obj.x + obj.width) && (obj.y - obj.width) <= (this.y + 2) && (this.y - 2) <= (obj.y + obj.width)) {\n this.isDead = true;\n obj.isDead = true;\n }\n }\n }\n };\n }", "update(){\n\n // make sure the dirt is not already grounded... \n if ( !this.grounded){\n\n // create a for loop for collision detection... \n for (let i = 0; i < dirt_list.length; i++){\n\n // detectCol against the other dirts.. :D\n if (detectCol( dirt_list[i], this ) ) {\n\n // only modify the dirt if the dirt isn't colliding against itself\n if (dirt_list[i] != this) {\n \n // a collision against another dirt has occurred... \n // this dirt particle is now grounded... \n this.grounded = true;\n }\n }\n }\n\n // if the dirt particle is not grounded \n // it should fall \n this.y += this.gravity;\n }\n\n // verify that an ammo was fired... \n if (ammo_list.length > 0) {\n\n // check for a collision against the first bullet in the ammo_list\n // against this specific dirt\n if (detectCol( this, ammo_list[0] ) ){\n\n this.visible = false; \n\n // end of collision check... \n }\n\n // end of the check for ammo_list.length check ... we only do this if \n // there's at least 1 ammo\n }\n\n // first we need to check to make sure that the particle ...\n // has not already touched the planet.. (bottom of screen)\n if (this.y > 508 ){\n \n // we should no longer be affected by gravity since \n // this particle of dirt is now grounded\n this.grounded = true;\n }\n\n // end of the Dirt Update method\n }", "function draw(){\nobstacle(a,b);\nif (b >= 700-obrad) obstacle(a2,b2-obrad);\ndrawline();\nball();\n}", "isDraw() {\n\tif(!this.isFinished()||this.getWinner()!==null)\n return false;\n else\n return true;\n }", "show() {\n push();\n noStroke();\n fill(120, 180, 255, 150);\n\n translate(this.position.x, this.position.y);\n\n if (this.crashed) {\n fill(255, 0, 0);\n\n circle(0, 0, 12);\n\n pop();\n return;\n }\n\n circle(0, 0, 14);\n pop();\n }", "hit() {\n\n //if 1 splash occurs add a splash\n if(splash = 1) {\n splash++;\n }\n \n\n //if it reaches 10 splashes reset to 0, and add blue color into the ground. \n if(splash = 10) {\n \n splash = 0;\n this.blue = this.blue + 2;\n\n \n\n console.log(\"hit\");\n\n }\n\n }", "function drawAlienShoot() {\n graphics.drawImage(bullet, bulletX, bulletY + 35, 50, 50);\n }", "function collisionCheck() {\n ghosts.forEach(ghost => {\n if(squares[ghost.index].classList.contains('pacman') && ghost.className !== 'dead') {\n if(!ghost.isBlue) {\n deadPlayer()\n } else {\n deadGhost(ghost)\n }\n }\n })\n}", "isAlive() {\n return this.currentHitPoints > 0 && !this.completed && !this.removeMe\n }", "goalReached(){\n this.x = startX;\n this.y = startY;\n this.hasWon = true;\n }", "function draw() {\n\tbackground(100, 155, 255); // fill the sky blue\n\n\tnoStroke();\n\tfill(0, 155, 0);\n\trect(0, floorPos_y, width, height / 4); // draw some green ground\n\n\tpush();\n\ttranslate(scrollPos, 0);\n\n\t// Draw mountains.\n\tmountains.forEach(mountain => (mountain).draw());\n\n\t// Draw clouds.\n\tclouds.forEach(function (cloud) {\n\t\tcloud.draw();\n\t\tcloud.x += 0.1;\n\t\tif (cloud.x > width + 1500) {\n\t\t\tcloud.x = -500;\n\t\t}\n\t});\n\n\t// Draw trees.\n\ttrees.forEach(tree => (tree).draw());\n\n\t// Draw canyons\n\tcanyons.forEach(function (canyon) {\n\t\tcanyon.draw();\n\t\tcanyon.checkCanyon();\n\t});\n\n\t// Draw collectable items.\n\tcollectables.forEach(function (colectable) {\n\t\tif (!colectable.isFound) {\n\t\t\tcolectable.draw();\n\t\t\tcolectable.checkCollectable(gameChar_world_x, gameChar_y);\n\t\t}\n\t});\n\n\tplatforms.forEach(function (platform) {\n\t\tplatform.draw();\n\t});\n\n\t// Draw backpack\n\tbackpack.checkBackpack();\n\tbackpack.draw();\n\n\t// Draw backpack flames\n\tflames.forEach(function(flame)\n\t{\n\t\tflame.draw();\n\t\tflame.update();\n\t});\n\t// Draw enemies\n\tenemies.forEach(function(enemy)\n\t{\n\t\tlet isContact = enemy.checkContact(gameChar_world_x, gameChar_y);\n\t\tenemy.draw();\n\t\tenemy.update();\n\t\tif(isContact)\n\t\t{\n\t\t\tif(lives > 0)\n\t\t\t{\n\t\t\t\tstartGame();\n\t\t\t\t//break;\n\t\t\t}\n\t\t}\n\t\t\n\t});\n\n\t// Draw flag pole reached\n\trenderFlagpole();\n\n\t// Check remaining lives\n\tcheckPlayerDie();\n\tpop();\n\t// Draw game character.\n\tdrawGameChar();\n\n\t// Draw Score text\n\tdrawScore();\n\n\t// Draw lives tokens\n\tdrawLivesToken();\n\n\t// Logic for displays \"Game over\" when lives is less than 1\n\tif (lives < 1) {\n\t\ttextAlign(CENTER);\n\t\ttextStyle(BOLD);\n\t\tstroke(255, 99, 71);\n\t\tfill(255, 215, 0);\n\t\ttextSize(50);\n\t\ttext(\"GAME OVER\", width / 2, height / 2);\n\t\ttextSize(20);\n\t\ttext(\"INSERT COIN\", width / 2, height * 0.55);\n\t\treturn;\n\t}\n\n\t// Logic for displays \"Level complete. Press space to continue.\" when `flagpole.isReached` is true.\n\tif (flagpole.isReached == true) {\n\t\ttextAlign(CENTER);\n\t\ttextStyle(BOLD);\n\t\ttext(\"Press space to continue\", width / 2, height / 3);\n\t\treturn;\n\t}\n\n\t// Logic to make the game character move or the background scroll.\n\tif (isLeft) {\n\t\tif (gameChar_x > width * 0.2) {\n\t\t\tgameChar_x -= 5;\n\t\t} else {\n\t\t\tscrollPos += 5;\n\t\t}\n\t}\n\n\tif (isRight) {\n\t\tif (gameChar_x < width * 0.8) {\n\t\t\tgameChar_x += 5;\n\t\t} else {\n\t\t\tscrollPos -= 5; // negative for moving against the background\n\t\t}\n\t}\n\n\t// Logic to make the game character rise and fall.\n\tif (gameChar_y < floorPos_y) {\n\t\tlet isContact = false;\n\t\tfor (let i = 0; i < platforms.length; i++) {\n\t\t\tif (platforms[i].checkContact(gameChar_world_x, gameChar_y)) {\n\t\t\t\tisContact = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!isContact) {\n\t\t\tgameChar_y += 2;\n\t\t\tisFalling = true;\n\t\t}\n\t} else {\n\t\tisFalling = false;\n\t}\n\n\t// Update real position of gameChar for collision detection.\n\tgameChar_world_x = gameChar_x - scrollPos;\n\n\t// Check collision detection game character with flag pole\n\tif (flagpole.isReached == false) {\n\t\tcheckFlagpole();\n\t}\n\n\n}", "show() {\n noStroke();\n if (currentScene === 3) {\n switch(this.quality) {\n case 1:\n fill(\"white\");\n break;\n case 2:\n fill(\"grey\");\n break;\n case 3:\n fill(\"black\");\n break;\n }\n }\n if (currentScene === 4) {\n fill(0)\n this.vel = createVector(-1, 0);\n }\n // changing these numbers makes the collision not work, why?\n rect(this.pos.x, this.pos.y, 10, 10) // try changing the numbers in person collision too\n \n }", "function put_one_element(pcanvas, layer, ptile, pedge, pcorner, punit, \n pcity, canvas_x, canvas_y, citymode)\n{\n\n var tile_sprs = fill_sprite_array(layer, ptile, pedge, pcorner, punit, pcity, citymode);\n\t\t\t\t \n var fog = (ptile != null && draw_fog_of_war\n\t && TILE_KNOWN_UNSEEN == tile_get_known(ptile));\t\t\t\t \n\n put_drawn_sprites(pcanvas, canvas_x, canvas_y, tile_sprs, fog);\n \n \n}", "project() {\r\n for (let j = 0; j < this.objs.length; j++) {\r\n let item = this.objs[j];\r\n for (let i = 0; i < item.vertexs.length && i < 3; i++) {\r\n if (item.changed[i]) { // if the drawable has moved position\r\n let fur = this.locate(item.vertexs[i]);\r\n let htheta = Math.atan(fur[2]/fur[0]); // verticle theta\r\n let vtheta = Math.atan(fur[1]/fur[0]); // horizontal theta\r\n\r\n //console.log('fur', fur, 'horiz theta', htheta, 'verticle theta', vtheta);\r\n\r\n if (Math.abs(htheta) < this.cam.fovHoriz && \r\n Math.abs(vtheta) < this.cam.fovVert) item._visible[i] = true;\r\n else item._visible[i] = false;\r\n\r\n // this could be changed to be xy scaled by distance?\r\n let w = this.cvs.width/2;\r\n let h = this.cvs.height/2;\r\n item.projected[i] = [\r\n w + (htheta/this.cam.fovHoriz * w), \r\n h - (vtheta/this.cam.fovVert * h), \r\n fur[2]\r\n ];\r\n \r\n //console.log('vertex visible', item._visible[i], item.projected[i]);\r\n }\r\n }\r\n \r\n }\r\n }", "display() {\n if (this.show){\n push();\n rectMode(CENTER);\n ellipseMode(CENTER);\n angleMode(DEGREES);\n stroke(255);\n strokeWeight(2);\n fill(this.color);\n ellipse(this.x, this.y, this.size);\n noStroke();\n fill(255);\n ellipse(this.x, this.y, this.size / 4);\n // if dies, it will shrink\n if (this.dead) {\n this.size -= 0.5;\n this.speed = 0;\n if (this.playOnce){\n Die.play();\n this.playOnce = false;\n }\n if (this.size <= 0) {\n this.animationFinished = true;\n this.show = false;\n // if it dies, the enemy base is no longer under attack\n if (this.theEnemyBase!=null){\n this.theEnemyBase.underAttack = false;\n }\n }\n }\n pop();\n }\n }", "function drawPaddle() {\n ctx.beginPath();\n ctx.rect(paddle.x, paddle.y, paddle.w, paddle.h);\n ctx.fillStyle = paddle.visible ? \"#095d86\" : \"transparent\";\n ctx.fill();\n ctx.closePath();\n}", "function checkIfGrounded() {\n if (p.grounded()) {\n p.jumps = p.jumpsAmount;\n p.isJumping = false;\n }\n }", "function drop() {\nif(move(down)==false){\nif(active.pivot.r < 1) {\n setTimeout(gameEnd,100);\n }\n checkLines();\n setTimeout(spawnPiece,100);\n\n}\n}", "animateWeapon() {\n //Do animation then set shooting to false here\n shooting_3D = false;\n }", "function draw() {\n //check if mouse is on item\n if(currentState ===`inspection`){\n //calculates the distance between mouse and items\n let distRemote = dist(mouseX,mouseY,item_remote.x,item_remote.y);\n let distAc = dist(mouseX,mouseY,item_ac.x,item_ac.y);\n let distpenpen = dist(mouseX,mouseY,item_penpen.x,item_penpen.y);\n let distPictureBoard = dist(mouseX,mouseY,item_pictureBoard.x,item_pictureBoard.y);\n if (distRemote <=20\n && inItemDialogue === false\n && itemChecklist.acRemote_Checked ===false){\n cursor(CROSS);\n currentItem = `acRemote`;\n if (mouseIsPressed){\n inItemDialogue = true;\n }\n }else if(distAc <=40\n && inItemDialogue === false\n && itemChecklist.ac_Checked ===false) {\n cursor(CROSS);\n currentItem = `ac`;\n if (mouseIsPressed){\n inItemDialogue = true;\n }\n }else if(distpenpen <= 30\n && inItemDialogue === false\n && itemChecklist.penpen_Checked ===false){\n cursor(CROSS);\n currentItem = `penpen`;\n if (mouseIsPressed){\n inItemDialogue = true;\n }\n }else if(distPictureBoard <= 40\n && inItemDialogue === false\n && itemChecklist.pictureBoard_Checked ===false){\n cursor(CROSS);\n currentItem = `pictureBoard`;\n if (mouseIsPressed){\n inItemDialogue = true;\n }\n }else{\n cursor(ARROW);\n }\n }\n}", "function drawPlayer(){\n\t//draw hard drop position\n\tplayer.shape.forEach((row,y)=>{\n\t\trow.forEach((value,x)=>{\n\t\t\tif(player.shape[y][x] != 0){\n\t\t\t\tcontext.lineWidth = 3;\n\t\t\t\tcontext.strokeStyle = 'white';\n\t\t\t\tcontext.strokeRect(25*(x+player.hPos.X)+4,25*(y+player.hPos.Y)+4,16,16);\n\t\t\t}\n\t\t});\n\t});\n\t\n\t//draw player piece\n\tplayer.shape.forEach((row,y) =>{\n\t\trow.forEach((value, x) =>{\n\t\t\tif(player.shape[y][x] != 0){\n\t\t\t\tswitch(player.shape[y][x]){//tioszlj\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'mediumpurple','purple');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'darkcyan','cyan');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'goldenrod','gold');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'green','lawngreen');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'darkred','red');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 6:\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'darkorange','orange');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 7:\t\t\t\n\t\t\t\t\t\tfillPiece(context,player.pos.X+x,player.pos.Y+y,'darkblue','blue');\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t});\n\t});\t\n}", "draw() {\n // Player icon is thinking normally, dizzy when losing a life, and smirking on powerup\n const playerImg = new Image();\n playerImg.src = 'images/thinking-face.png';\n\n switch (this.state) {\n case 'alive':\n break;\n case 'dead':\n playerImg.src = 'images/dizzy-face.png';\n break;\n\n case 'smirk':\n playerImg.src = 'images/smirking-face.png';\n break;\n }\n\n playerImg.width *= 0.25;\n playerImg.height *= 0.25;\n ctx.drawImage(playerImg, this.x - playerImg.width / 2, this.y - playerImg.height / 2, playerImg.width, playerImg.height);\n\n // ctx.beginPath();\n // ctx.arc(this.x, this.y, this.r, 0, Math.PI*2);\n // ctx.fillStyle = this.alive ? '#0095DD' : '#FF0055';\n // ctx.fill();\n // ctx.closePath();\n }", "function draw() {\n computeBoardSize(board);\n\n context.drawImage(\n this,\n current_x_offset,\n current_y_offset,\n board.width,\n board.height\n );\n\n positionPlayer();\n clearBlinkers();\n\n for (let i of allObjects) {\n if (isInView(i.x, i.y) && !i.completed) {\n const [x, y] = normalize_image_position(i.x, i.y);\n createBlinker(x, y, i.isGold);\n }\n }\n }", "shoot () {\n\t\tnew Bullet (this.containerElement, this.mapInstance, this.position, this.direction);\n\t}", "drawPiece(piece){\n let context = this.canvas.getContext(\"2d\");\n let shiftX = this.cell_w * piece.pos.x;\n let shiftY = this.cell_h * piece.pos.y;\n let imageObj = undefined;\n\n context.save();\n context.lineWidth = \"2\";\n context.strokeStyle = \"black\";\n context.beginPath();\n context.rect(shiftX + 5, shiftY + 5, this.cell_w - 10, this.cell_h - 10);\n context.stroke();\n context.closePath();\n\n let rank = piece.rank;\n let scale = 0.7;\n let imageW = 64 * 0.7, imageH = 64 * 0.7;\n let ssx = (64 - imageW)/ 2, ssy = (64 - imageW)/ 2 - 2;\n let colorW= \"\", colorB = \"\"\n\n if (piece.team == 1){\n colorB = \"black\"\n colorW = \"white\"\n imageObj = this.game.imageObjs.get(IMAGE_PATH[0]);\n }else if (piece.team == 2){\n colorB = \"white\"\n colorW = \"black\"\n imageObj = this.game.imageObjs.get(IMAGE_PATH[1]);\n }\n context.fillStyle= colorB;\n context.fill();\n context.stroke();\n\n\n if (!piece.isHide){\n context.drawImage(imageObj, piece.rank * this.cell_w, 0, this.cell_w, this.cell_h, shiftX + ssx, shiftY + ssy, imageW, imageH)\n context.font=\"10px Verdana\";\n context.fillStyle= colorW;\n rank = rank == 0 ? \"B\" : (rank == \"11\" ? \"F\" : rank);\n context.fillText(\"RANK \" + rank, shiftX + ssx + 2, shiftY + ssy + 45);\n }\n context.restore();\n }", "display()\n {\n image(this.sprite, this.bulletX, this.bulletY);\n }", "passes(bird) {\n if (\n bird.xpos <= (this.xpos + this.width + 1) &&\n bird.xpos >= (this.xpos + this.width)\n ) {\n return true;\n } else {\n return false;\n }\n }", "function draw() {\r\n requestAnimationFrame(draw);\r\n if (numberOfMissiles < 50) {\r\n missileGeneration();\r\n }\r\n moveMissile();\r\n TWEEN.update();\r\n renderer.render(scene,camera);\r\n}", "function renderFlagpole() {\n\n\tvar flagY = floorPos_y - 30;\n\tstroke(255);\n\tstrokeWeight(5);\n\tline(flagpole.x_pos, floorPos_y, flagpole.x_pos, floorPos_y - 200);\n\tfill(255, 0, 255);\n\tnoStroke();\n\tif (!flagpole.isReached) {\n\t\trect(flagpole.x_pos, flagY, 40, 30);\n\t} else {\n\t\trect(flagpole.x_pos, flagY - 200, 40, 30);\n\t}\n}", "function colision(){\n \n if(i == (Math.round(yetiY - 345)/30) && j == (Math.round(yetiX - 155)/30) || i == (Math.round(yetiY - 345)/30) && j+1 == (Math.round(yetiX - 155)/30)){\n life--;\n destX = Math.round(getRandomArbitrary(1,10))*30+155;\n destY = Math.round(getRandomArbitrary(1,10))*30+345;\n setTimeout(function(){\n setInterval(function(){\n $('#container').show();\n },100)\n $('#container').hide();\n },300)\n \n if(life == 0){\n looseWindow();\n }\n }\n \n }", "interact(frog) {\n if (this.collide(frog)) {\n frog.col = -10;\n return true;\n }\n return false;\n }", "function updateProjectile(proj, timeDelta) {\n if (proj.type == BULLET_TYPE) {\n var timeSinceSpawn = (Date.now() - proj.spawnTime) / 1000;\n\n // We start i at 1, because if this gets run in the same millisecond that the bullet\n // spawn, the loop guard will fail on the first iteration, and i will stay set to 0,\n // which will cause `proj.path[i - 1]` after the loop to access the -1st element of\n // proj.path, which is undefined and will cause a crash.\n var i = 1;\n while (proj.path[i].time < timeSinceSpawn) {\n i += 1;\n\n // We do the 'has the bullet despawned' here, rather than as an if statement earlier,\n // because sometimes (very rarely), a millisecond will tick over between the if\n // statement evaluating Date.now() and the calculation of timeSinceSpawn and this will\n // leave i being equal to the length of the array, which will cause a crash when access\n // of that array element is attempted.\n if (i == proj.path.length) {\n return true;\n }\n }\n\n var lerpFactor = inverseLerp(proj.path[i - 1].time, proj.path[i].time, timeSinceSpawn);\n var vec = vecLerp(\n new Vec2(proj.path[i - 1].x, proj.path[i - 1].y),\n new Vec2(proj.path[i].x, proj.path[i].y),\n lerpFactor\n );\n\n proj.x = vec.x;\n proj.y = vec.y;\n\n return false;\n } else {\n console.error(\"Unknown projectile type \" + proj.type);\n\n return false;\n }\n}", "bigBang() {\n // draws universe\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n for (let i = 0; i < this.row; i++) {\n for (let j = 0; j < this.col; j++) {\n // if the cell is DEAD (WHITE SQUARES) 0\n if (this.universe.grid[i][j] === 0) {\n this.ctx.beginPath();\n this.ctx.rect(j * this.scale, i * this.scale, this.scale, this.scale);\n this.ctx.stroke();\n } else if (this.universe.grid[i][j] === 1) { // if cell is ALIVE (BLACK SQUARES) 1\n this.ctx.fillRect(j * this.scale, i * this.scale, this.scale, this.scale);\n }\n }\n }\n }" ]
[ "0.72319365", "0.69851524", "0.6584378", "0.65443337", "0.65265095", "0.6457312", "0.64331245", "0.63287836", "0.62822413", "0.62814957", "0.62703824", "0.6269629", "0.6249608", "0.6248368", "0.6239905", "0.62342167", "0.6231608", "0.6230253", "0.622411", "0.6194181", "0.61938083", "0.61765057", "0.61628103", "0.61445016", "0.61274004", "0.61199605", "0.6118533", "0.6112001", "0.6106798", "0.60712755", "0.6071103", "0.60645616", "0.60413426", "0.6040357", "0.6039051", "0.6035601", "0.6009657", "0.5992193", "0.5987501", "0.59868324", "0.59856665", "0.5981204", "0.59767765", "0.59680355", "0.5962957", "0.5949428", "0.5947639", "0.5947126", "0.59454566", "0.5940524", "0.5937858", "0.59371597", "0.5935236", "0.59243894", "0.59172255", "0.59111094", "0.59104526", "0.5909661", "0.5907714", "0.5890386", "0.5876546", "0.5873227", "0.5872323", "0.5867694", "0.5862587", "0.58596814", "0.5858009", "0.5849625", "0.58494335", "0.58456755", "0.58413863", "0.5841377", "0.5841143", "0.5828588", "0.5820704", "0.58140737", "0.58125955", "0.58050567", "0.58026654", "0.57968736", "0.5793075", "0.57890916", "0.57845634", "0.5781007", "0.5779485", "0.5769259", "0.57686174", "0.576779", "0.57676023", "0.5766094", "0.5761038", "0.5759549", "0.5758118", "0.5755623", "0.5754895", "0.57513934", "0.5748524", "0.5747814", "0.5740572", "0.57353216" ]
0.6533748
4
using 'millis()' to get the time and the time from the last animation frame switch as well as the lifetime of the projectile
getTime(){ this.time = millis(); this.timeFromLast = this.time - this.timeUntilLast; this.lifeTime = this.time - this.startTime; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "function calcAnimationLength() {\r\n return data[data.length - 1].time / 1000 + \"s\"\r\n}", "function frame1eyeAppear(waitTime){\n var time = waitTime;\n console.log(time);\n\n tl = new TimelineMax({delay: time});\n tl\n .from(frame1_eye, 0.3, {opacity:0})\n}", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function PlayerHandling()\n{\n //Moves the player\n PlayerMovementExecute();\n \n //Creates a projectile if the timer is equal to 0\n intFramesLeftBeforeFiring--;\n if(intFramesLeftBeforeFiring == 0)\n {\n CreateNewProjectile(intPlayery + 0.5 * objPlayerSprite.height - 0.5 * objDefaultProjectileSprite.height);\n intFramesLeftBeforeFiring = intFireRate;\n }\n}", "function frame1eye1Appear(waitTime){\n var time = waitTime;\n console.log(time);\n\n tl = new TimelineMax({delay: time});\n tl\n .from(frame1_eye1, 1, {opacity:0} , '+=0.5')\n .to(frame1, 1, {opacity:0})\n}", "function getDeltaTime()\r\n{\r\n\tendFrameMillis = startFrameMillis;\r\n\tstartFrameMillis = Date.now();\r\n\r\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\r\n\t\t// We need to modify the delta time to something we can use.\r\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\r\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \r\n\t\t// animations appear at the right speed, though we may need to use\r\n\t\t// some large values to get objects movement and rotation correct\r\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\r\n\t\r\n\t\t// validate that the delta is within range\r\n\tif(deltaTime > 1)\r\n\t\tdeltaTime = 1;\r\n\t\t\r\n\treturn deltaTime;\r\n}", "constructor(){\n this.x = 100;\n this.y = 100;\n this.frameHeight = 53;\n this.frameWidth = 64;\n this.currentFrameX = 23;\n this.currentFrameY = 16;\n this.spriteSheet;\n this.currentFrameNum = 1;\n this.time = 0;\n this.timeUntilLast = 0;\n this.timeFromLast = 0;\n this.animationTime = 50;\n this.maxFrame = 6;\n this.startTime;\n this.lifeTime;\n this.alive = false;\n\n\n \n\n }", "update( time ) {\r\n let animation = this.animationList[this.current];\r\n if( !animation ) return;\r\n this.progress += time * animation.fps;\r\n while( this.progress >= 1.0 ) {\r\n this.progress -= 1.0;\r\n this.frame++;\r\n if( this.frame >= animation.startFrame + animation.numFrames ) {\r\n this.frame = animation.startFrame;\r\n }\r\n }\r\n }", "function animation(time) {\n clearCanvas();\n\n updateAudioEffects();\n dessineEtDeplaceLesEtoiles();\n drawVolumeMeter();\n visualize();\n measureFPS(time);\n\n me.draw(ctx);\n badboy.draw(ctx);\n me.update();\n badboy.update();\n\n var rand = Math.random();\n rect1 = new Etoile();\n etoiles.push(rect1);\n\n // 4 on rappelle la boucle d'animation 60 fois / s\n if (state == 1){\n requestAnimationFrame(animation);\n } else {\n // c'etait la derniere iteration de l'anim , on repasse au menu\n etoiles=[];\n }\n}", "get animateTime() {\n\t\treturn this._animateTime;\n\t}", "animate(time){\n const timeDelta = time - this.lastTime;\n\n //step is for constant moving obj (bullets)\n this.game.step(timeDelta);\n\n this.game.draw(this.ctx);\n this.lastTime = time; \n\n //check if the game is over!\n this.gameOver();\n requestAnimationFrame(this.animate.bind(this));\n }", "function lastFrameTimeUpdate(theKeyAnimationsLength,theKeyFrameAnimations,theLastFrameCurrentTime) {\n var i;\n for (i = 0; i < theKeyAnimationsLength; i+=1) {\n theLastFrameCurrentTime[i] = theKeyFrameAnimations[i].currentTime;\n }\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function updateAnimationState(time){\n\t\t// console.log(lastUpdate);\n\t\tfor(var i = 0; i < characters.length;i++){\n\t\t\tc = characters[i];\n\t\t\tc.updateAnimationState(time);\n\t\t}\n\t\t// lastUpdate = time;\n\t}", "get current_animation() { return (this.is_playing() ? this.playback.assigned : '') }", "getGameTime() {\n return this.time / 1200;\n }", "hadouken(){\n this.state = \"hadouken\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 2348;\n this.frameHeight = 109;\n this.frameWidth = 125;\n this.maxFrame = 8;\n hadouken1.startTime = millis();\n }", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "function getDeltaTime() {\n endFrameMillis = startFrameMillis;\n startFrameMillis = Date.now();\n\n // Find the delta time (dt) - the change in time since the last drawFrame\n // We need to modify the delta time to something we can use.\n // We want 1 to represent 1 second, so if the delta is in milliseconds\n // we divide it by 1000 (or multiply by 0.001). This will make our\n // animations appear at the right speed, though we may need to use\n // some large values to get objects movement and rotation correct\n var deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\n // validate that the delta is within range\n if (deltaTime > 1)\n deltaTime = 1;\n\n return deltaTime;\n}", "timeStepFireEffect() {\n if (this.fireEffect.animationCounter > 0) {\n this.fireEffect.fireEffectSound.play()\n let fireEffectLocationHash = this.fireEffect.fireLocation(this.dino)\n this.fireEffect.killCrates(this.cratesArray, fireEffectLocationHash, this.newScore)\n this.canvasContext.drawImage(this.fireEffect.returnImage(), fireEffectLocationHash['xLoc'], fireEffectLocationHash['yLoc'], fireEffectLocationHash['xSize'], fireEffectLocationHash['ySize'])\n }\n }", "function updateAnimation() {\n drawCanvas();\n puckCollision();\n if (goalScored()) {\n resetPuck();\n resetStrikers();\n }\n moveCPUStriker();\n seconds = seconds - (16 / 1000);\n // as long as there is time remaining, don't stop\n if (seconds > 0) {\n document.getElementById(\"time\").innerHTML = Math.round(seconds, 2);\n } else {\n // if less than 3 periods have elapsed, do the following\n if (periodNum < 3) {\n nextPeriod();\n } else {\n stopAnimation();\n }\n }\n }", "function animate(){\n var T;\n var ease;\n var time = (new Date).getTime();\n \n T = limit_3(time-animation.starttime, 0, animation.duration);\n \n if (T >= animation.duration){\n clearInterval (animation.timer);\n animation.timer = null;\n animation.now = animation.to;\n \n }else{\n ease = 0.5 - (0.5 * Math.cos(Math.PI * T / animation.duration));\n animation.now = computeNextFloat (animation.from, animation.to, ease);\n }\n \n animation.firstElement.style.opacity = animation.now;\n}", "getPictureShootTime() {\n return (this.getPictureHeightWithOverlap() / this.mission.flightSpeed).toFixed(2);\n }", "get time ()\n\t{\n\t\tlet speed = parseInt (this.token.actor.data.data.attributes.movement.walk, 10);\n\t\t\n\t\tif (! speed)\n\t\t\tspeed = 30;\n\n\t\treturn speed / this.gridDistance;\n\t}", "function animationLost() {\n\t\tconsole.log(\"he perdido\");\t\n\tposX2=hasta;\t\nhasta=hasta-60;\nposX=posX-60;\n\t\t// Start the animation.\n\t\trequestID2 = requestAnimationFrame(animate2);\n\t}", "animatedMotion(time) {\n const newTime = this.audioPlayer.getTime();\n this.translatePointToCenter(this.createPoint(newTime, 0));\n this.timeoutId = setTimeout(() => this.animatedMotion(time), 10);\n this.toolBoxRef.current.moveSliderFromCanvas();\n }", "function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();}// Generate parameters to create a standard animation", "function updateTime(){\n const { time } = _DotGameGlobal;\n const curr = Date.now();\n time.deltaTime = (curr - time.currTime) / 1000;\n time.currTime = curr;\n}", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "function animation(time) {\n if (prev) {\n const totalTime = time - prev;\n const speed = 0.008; // fly speed\n const activeSegment = stack[stack.length - 1];\n const prevLayer = stack[stack.length - 2];\n const boxShouldMove =\n !end &&\n (!computer ||\n (computer &&\n activeSegment.threejs.position[activeSegment.direction] <\n prevLayer.threejs.position[activeSegment.direction] +\n difficulty));\n if (boxShouldMove) {\n activeSegment.threejs.position[activeSegment.direction] += speed * totalTime;\n activeSegment.cannonjs.position[activeSegment.direction] += speed * totalTime;\n if (activeSegment.threejs.position[activeSegment.direction] > 10) {\n miss();\n }\n } else {\n if (computer) {\n split();\n setdifficulty();\n }\n }\n\n if (camera.position.y < boxHeight * (stack.length - 2) + 4) {\n camera.position.y += speed * totalTime;\n }\n physics(totalTime);\n renderer.render(scene, camera);\n }\n prev = time;\n}", "animate() {\n if (this.animationFrames.length > 1) {\n this.animationTimer += 1;\n const quotient = Math.floor(this.animationTimer / this.animationFrameDuration)\n const frame = quotient % this.animationFrames.length;\n this.srcImage = this.animationFrames[frame];\n if (this.animationTimer === this.animationFrameDuration * this.animationFrames.length) {\n this.animationTimer = 0;\n }\n }\n }", "function startTimeAnimation() {\n\n\t// reset the time slider\n\t$('#time_slider').slider('value', 0);\n\t\n\t// update the map\n\tupdateMapTimePeriod(0);\n\t\n\t// update the time marker\n\tcurrentTimeInterval = 1;\n\t\n\t// set a timeout for the continue time animation\n\tnextTimeout = setTimeout('continueTimeAnimation()', 3000);\n\t\n\t// update the message\n\t$('#animation_message').empty().append('Animation running…');\n\n}", "onAnimFrame() {\n const now = Date.now();\n const delta = now - this.previousFrameTime;\n const interval = 1000 / this.props.fps;\n\n this.requestId = window.requestAnimationFrame(this.onAnimFrame);\n\n if (delta > interval) {\n this.previousFrameTime = now - (delta % interval);\n this.drawCurrentFrame();\n\n // Clamp playback between start & end frame range, looping\n // whenever we run past the end frame.\n if (this.frame < this.startFrame || this.frame > this.endFrame) {\n this.frame = this.startFrame;\n }\n }\n }", "function step(startTime) {\n\n// console.log(\"working\");\n // 'startTime' is provided by requestAnimationName function, and we can consider it as current time\n // first of all we calculate how much time has passed from the last time when frame was update\n if (!timeWhenLastUpdate) timeWhenLastUpdate = startTime;\n timeFromLastUpdate = startTime - timeWhenLastUpdate;\n\n // then we check if it is time to update the frame\n if (timeFromLastUpdate > timePerFrame) {\n // and update it accordingly\n $element.attr('src', imagePath + '/cup-' + frameNumber + '.png');\n // $element.attr('src', imagePath + `/cup-${frameNumber}.png`);\n // reset the last update time\n timeWhenLastUpdate = startTime;\n\n // then increase the frame number or reset it if it is the last frame\n if (frameNumber >= totalFrames) {\n frameNumber = 1;\n } else {\n frameNumber = frameNumber + 1;\n }\n }\n\n requestAnimationFrame(step);\n}", "get animateDeltaTime() {\n\t\treturn this._animateDeltaTime;\n\t}", "setTimeLimit() {\nvar lastframe;\n//-----------\nif (this.fCount === 0) {\nreturn this.tLimit = 0;\n} else {\nlastframe = this.frameAt(this.fCount - 1);\nreturn this.tLimit = (lastframe.getTime()) + (lastframe.getDuration());\n}\n}", "function Legato_Animation( element, run_time )\r\n{\r\n\r\n\t// Store the values.\r\n\tthis.element = $( element );\r\n\tthis.element_properties = Object();\r\n\tthis.run_time = run_time;\r\n\tthis.controller = new Legato_Animation_Controller();\r\n\r\n\tthis.onStart = null;\r\n\tthis.onInterval = null;\r\n\tthis.onAdvance = null;\r\n\tthis.onEventFrame = null;\r\n\tthis.onStop = null;\r\n\tthis.onFinish = null;\r\n\r\n\t// These values are used by the Legato_Animation system internally.\r\n\tthis.status = false;\r\n\tthis.event_frames = new Array();\r\n\r\n\tthis.start_time = null;\r\n\tthis.current_time = null;\r\n\r\n\tthis.begin_width = null;\r\n\tthis.begin_height = null;\r\n\tthis.begin_pos = null;\r\n\tthis.begin_back_color = null;\r\n\tthis.begin_border_color = null;\r\n\tthis.begin_text_color = null;\r\n\tthis.begin_opacity = null;\r\n\r\n\tthis.offset_width = null;\r\n\tthis.offset_height = null;\r\n\tthis.offset_pos = new Legato_Structure_Point();\r\n\tthis.offset_back_color = new Legato_Structure_Color();\r\n\tthis.offset_border_color = new Legato_Structure_Color();\r\n\tthis.offset_text_color = new Legato_Structure_Color();\r\n\tthis.offset_opacity = null;\r\n\r\n\tthis.desired_width = null;\r\n\tthis.desired_height = null;\r\n\tthis.desired_pos = new Legato_Structure_Point();\r\n\tthis.desired_back_color = null;\r\n\tthis.desired_border_color = null;\r\n\tthis.desired_text_color = null;\r\n\tthis.desired_opacity = null;\r\n\r\n}", "function Animate() {\n\n //stop animating if requested\n if (stop_animating) return;\n \n // request another frame\n requestAnimationFrame(Animate);\n\n // calc elapsed time since last loop\n time.now = performance.now();\n time.elapsed = time.now - time.then;\n\n // if enough time has elapsed and all objects finished rendering, draw the next frame\n if ( (time.elapsed > fps_interval) && (UpdateFinished()) ) {\n\n //add this frame duration to the frame array\n fps_array.push( parseInt(1000/ (time.now - time.then) ) );\n\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fps_interval not being a multiple of user screen RAF's interval\n //(16.7ms for 60fps for example).\n time.then = time.now - (time.elapsed % fps_interval);\n\n //Draw the frame\n UpdateTimeDisplay();\n DrawFrame();\n }\n}", "get assigned_animation() { return this.playback.assigned }", "function Animation(duration, width, height, image){\r\n\tthis.duration = duration;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tthis.internalClock = duration / fps;\r\n\tthis.finished = false;\r\n\tthis.element = document.createElement('div');\r\n\r\n\tthis.element.style.width = width + 'px';\r\n\tthis.element.style.height = height + 'px';\r\n\tthis.element.style.minHeight = height + 'px';\r\n\tthis.element.style.minWidth = width + 'px';\r\n\tthis.element.style.backgroundImage = 'url(' + image + ')';\r\n\t//this.element.style.border = 'black solid 5px';\r\n\tthis.element.style.position = 'relative';\r\n\tthis.element.style.overflow = 'hidden';\r\n\tthis.tick = 0;\r\n\t\r\n\tthis.addMoment = function(img, stage){\r\n\r\n\t};\r\n\r\n\tthis.setX = function(x){ this.element.style.left = x + 'px'; };\r\n\tthis.setY = function(y){ this.element.style.top = y + 'px'; };\r\n\t\r\n\tthis.render = function(){\r\n\t\t//alert(this.tick);\t\t\r\n\t\tthis.tick += 1;// % duration; \r\n\t\t//alert('tick' + this.tick);\r\n\t\tif(this.tick > this.duration){\r\n\t\t\t//alert('hola');\r\n\t\t\tthis.animationEnd();\r\n\t\t\treturn\r\n\t\t};\r\n\t\t//this.tick = this.tick % this.duration;\r\n\t\tthis.element.style.backgroundPosition = '-' + this.tick * this.width + 'px 0px';\r\n\t\t//alert(this.element.style.backgroundPosition);\r\n\t\t//this.frames[this.tick].style.display = 'none';\r\n\t};\r\n\t\r\n\tthis.animationEnd;\r\n}", "function animate_game()\n{\n renderer.render(scene2);\n var now = Date.now();\n\n\n emitter.update((now - elapsed) * 0.001);\n elapsed = now;\n update_camera();\n requestAnimationFrame(animate_game);\n}", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();} // Generate parameters to create a standard animation", "function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();} // Generate parameters to create a standard animation", "@autobind\n updateTime(event) {\n this.material.uniforms[ 'time' ].value = this.tweenContainer.time;\n }", "slowGameTime()\n {\n this.clockTick = this.clockTick / 6;\n if (this.timeIsSlowed)\n {\n this.specialEffects.prepareCanvasLayersForEffects();\n console.log(\"Slowing\");\n this.specialEffects.performSlowTimeSpecialEffects();\n }\n }", "function tick(){\n // Save the current time\n g_seconds = performance.now()/1000.0-g_startTime;\n //console.log(g_seconds);\n\n //Update animation angles:\n updateAnimationAngles();\n\n // Draw Everything: \n renderAllShapes();\n\n // Tell the browser to update again when it has time \n requestAnimationFrame(tick);\n}", "function Tirar()\n{\n let ahora = Date.now();\n let intervalo = ahora - tirar;\n\n if (intervalo > 500) \n {\n p.moverAbajo();\n tirar = Date.now();\n }\n\n if(gameOver == false)\n {\n requestAnimationFrame(Tirar);\n }\n}", "timeDilation(){\r\n if(game.global.timeDilation > 0){\r\n console.log(\"Beginning time dilation!\");\r\n game.global.timeDilation += 0.1;\r\n console.log(game.global.timeDilation);\r\n } else {\r\n console.log(\"Max time dilation reached!\");\r\n }\r\n }", "function main(){\r\n\tvar TL=fl.getDocumentDOM().getTimeline()\r\n\tvar curL=TL.currentLayer;\r\n\tvar curF=TL.currentFrame;\r\n\tvar frame=TL.layers[curL].frames[curF];\r\n\tif(curF>frame.startFrame){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t}else if(curF==frame.startFrame && curF>0){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t\tvar prevFrame=TL.layers[curL].frames[frame.startFrame-1];\r\n\t\tTL.currentFrame=frame.startFrame-(prevFrame.duration);\r\n\t}\r\n}", "getFrame(t) {\nvar NF, f, frame, resolved, was_complete;\n//-------\n// Allow for the possibility that the frame seqeuence is extended\n// while we are scanning it. In the case where our search apparently\n// hits the sequence limit this means (a) that we should check\n// whether new frames have been added, and (b) that we shouldn''t\n// terminate the animation until we know that it is complete.\n// If I knew more about modern browsers' scheduling, I might realise\n// that this is unnecessarily complicated, or perhaps alternatively\n// that it is not complicated enough to be safe.\nresolved = false;\nwhile (!resolved) {\nwas_complete = this.isComplete;\nNF = this.fCount;\nf = this.getFrameIndex(t, NF);\nresolved = f !== NF || was_complete || NF === this.fCount;\nif (--this.traceMax > 0) {\nif (typeof lggr.trace === \"function\") {\nlggr.trace(`Resolved: ${resolved} f=${f} NF=${NF} fCount=${this.fCount}`);\n}\n}\n}\n// Find result frame\n// Rather than terminate the animation, stick at the last available\n// frame, pending the arrival of possible successors -- via\n// @extendSigns() -- or the indication that there will never be\n// any successors -- via @setCompleted.\nreturn frame = f !== NF ? (this.fIncomplete = 0, this.setFrameAt(f)) : this.isComplete ? null : (this.fIncomplete++, this.fIncomplete < 5 ? typeof lggr.debug === \"function\" ? lggr.debug(\"getFrame: at end of incomplete animation\") : void 0 : void 0, this.setFrameAt(NF - 1));\n}", "startAnimating(fps){\n this.fpsInterval = 1000 / fps;\n this.then = Date.now();\n this.animate();\n }", "update() {\n var now = Date.now();\n var dt = (now - gameNs.game.prevTime);\n gameNs.game.dt = dt;\n gameNs.game.prevTime = now;\n gameNs.game.draw();\n //Update projectile manager\n gameNs.game.pm.update(dt, gameNs.game.mX, gameNs.game.mY);\n dt = 0;\n //Recursively call game.update here to create loop\n window.requestAnimationFrame(gameNs.game.update);\n }", "animate(animation, animationDelay = 0, loopFrame = 0, loopAmount = -1) { //higher animationDelay is slower, every x frame\r\n var isLastFrame = 0;\r\n\t\t//console.log(\"BEFORE currentframe\", this.currentFrame, \"spritenumber\", this.spriteNumber, \"animation length\", animation.length);\r\n\t\t//console.log(\"isLastFrame\", isLastFrame, \"loopcounter\", this.loopCounter, \"loopamount\", loopAmount);\r\n\t\tif(this.animationDelayCounter >= animationDelay) {\r\n\t\t\tthis.currentFrame += 1;\r\n\t\t\tif((this.currentFrame === animation.length)) {// && ((loopAmount === -1) || (this.loopCounter < loopAmount))){\r\n\t\t\t\tthis.currentFrame = loopFrame;\r\n\t\t\t\tthis.loopCounter += 1;\r\n\t\t\t\tisLastFrame += 1;\r\n\t\t\t\t//console.log(\"First If\");\r\n\t\t\t}\r\n if((loopAmount > -1) && (this.loopCounter > loopAmount)) {\r\n isLastFrame += 1;\r\n\t\t\t\tthis.currentFrame = animation.length-1;\r\n\t\t\t\t//console.log(\"Second If\");\r\n }\r\n\t\t\tthis.animationDelayCounter = 0;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.animationDelayCounter += 1;\r\n\t\t}\r\n this.spriteNumber = animation[this.currentFrame];\r\n //console.log(\"AFTER currentframe\", this.currentFrame, \"spritenumber\", this.spriteNumber, \"animation length\", animation.length);\r\n\t\t//console.log(\"isLastFrame\", isLastFrame, \"loopcounter\", this.loopCounter, \"loopamount\", loopAmount);\r\n return isLastFrame;\r\n\t}", "animation() {}", "function animation() {\n\t\t\t\t// track time\n\t\t\t\tcurrent = Date.now();\n\t\t\t\telapsed = (current - lastTime) / 1000;\n\t\t\t\tif (elapsed > max_elapsed_wait) {\n\t\t\t\t\telapsed = max_elapsed_wait;\n\t\t\t\t}\n\n\n\t\t\t\tif (counter_time > time_step) {\n\n\n\n\t\t\t\t}\n\t\t\t\t//METEORITOS\n\t\t\t\tif(ygrados>-100000 && temp==1){\n\t\t\t\t\tygrados = ygrados - 0.01 * 70;\n\n\t\t\t\t\tmono.setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.translate(new CG.Vector3(10,0,250)),CG.Matrix4.scale(new CG.Vector3(3,3,3))),CG.Matrix4.rotateY((Math.radians(ygrados)))));\n\t\t\t\t\tgeometry[0].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(0,0,-1))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\n\t\t\t\t\tgeometry[4].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(10,0,30))),CG.Matrix4.rotateZ((Math.radians(ygrados)))))\n\n\n\t\t\t\t\tgeometry[5].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(50,0,-50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[7].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(80,40,-50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[8].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(30,20,50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[9].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(50,-80,20))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[10].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(70,-150,-20))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[11].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(20,100,-70))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t\tgeometry[12].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(20,10,-50))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\n\t\t\t\t\tgeometry[13].setT(CG.Matrix4.multiply(CG.Matrix4.multiply(CG.Matrix4.rotateX(90*(-Math.PI/180)),CG.Matrix4.translate(new CG.Vector3(80,60,-20))),CG.Matrix4.rotateZ((Math.radians(ygrados)))));\n\n\t\t\t\t}\n\n\n\t\t\t\tdraw();\n\t\t\t\tcounter_time = 0;\n\t\t\t}", "function spawnTime(){\n\tcontext2D.fillStyle = spawner.fillColor;\n\tcontext2D.fillText(spawner.timer,\n\t\tspawner.x - context2D.measureText(spawner.timer).width / 2, spawner.y + 3);\n}", "function moving_phase() {\n game_phase = MOVING;\n\n // Record reaction time as time spent with target visible before moving\n rt = new Date() - begin;\n\n // Start of timer for movement time\n begin = new Date();\n\n mousetm = new Array(200).fill(-1);\n mousetm[0] = [0];\n\n // Start circle disappears\n d3.select('#start').attr('display', 'none');\n\n }", "function animateFrame()\n{\n // Update the current camera and scene\n if (currentCamera !== undefined) currentCamera.updateProjectionMatrix();\n if (currentScene !== undefined) currentScene.traverse(runScripts);\n\n // Update previous mouse state here because animateFrame\n // out of sync with mouse listeners (onMouseMove, onMouseWheel)\n mousePrevX = mouseX;\n mousePrevY = mouseY;\n mousePrevScroll = mouseScroll;\n\n var t = getElapsedTime();\n frameDuration = t - frameStartTime;\n frameStartTime = t;\n frameNum++;\n}", "nextFrame() {\n this.updateParticles();\n this.displayMeasurementTexts(this.stepNo);\n this.stepNo++;\n\n if (this.stepNo < this.history.length - 1) {\n // Set timeout only if playing\n if (this.playing) {\n this.currentTimeout = window.setTimeout(\n this.nextFrame.bind(this),\n this.animationStepDuration\n );\n }\n } else {\n this.finish();\n }\n }", "_updateCamera(deltaTime) {\n ...\n }", "_playAnimation() {\n if (this._animationLast === undefined && this._animationQueue.length > 0) {\n this._animationLast = this._animationCurrent;\n this._animationCurrent = this._animationQueue.shift();\n console.log(\"New: \" + this._animationCurrent.name);\n this._animationCurrent.runCount = 0;\n }\n this._serviceAnimation(this._animationCurrent, true);\n this._serviceAnimation(this._animationLast, false);\n if (this._animationLast && this._animationLast.cleanup) {\n this._animationLast.animation.stop();\n this._animationLast.animation = undefined;\n this._animationLast = undefined;\n }\n }", "getAnimationDuration() {\n const itemsWidth = this.items.reduce((sum, item) => sum + getWidth(item), 0);\n\n // prettier-ignore\n const factor = itemsWidth / (this.initialItemsWidth * 2);\n return factor * this.options.duration;\n }", "function createFxNow(){setTimeout(function(){fxNow = undefined;});return fxNow = jQuery.now();} // Generate parameters to create a standard animation", "isAnimating() {\n return animationFrame > 1;\n }", "set_time( t ){ this.current_time = t; this.draw_fg(); return this; }", "function startMoving(){\n ninjaLevitation(animTime);\n //sunrise();\n var particular4transl_50 = 50 / animTime;\n var particular4transl_100 = 100 / animTime;\n var particular4opacity_0 = 1 / animTime;\n var particular4opacity_075 = 0.75 / animTime;\n animate(function(timePassed) {\n forBackgnd.attr({opacity : particular4opacity_0 * timePassed});\n instagramLogo.attr({opacity : particular4opacity_0 * timePassed, 'transform' : 't 0, '+(100 - particular4transl_100 * timePassed)});\n mountFog.attr({opacity : 0.75 - particular4opacity_075 * timePassed});\n sunRays.attr({opacity : particular4opacity_0 * timePassed, 'transform' : 't 0, '+(50 - particular4transl_50 * timePassed)});\n }, animTime);\n}", "function startAnimation() {\n waited += new Date().getTime() - stopTime\n stopAnim = false;\n Animation();\n}", "function Update (frametime) {\n if (!server.IsRunning()) {\n //GET active users\n if (interval > 100) {\n var transfer = asset.RequestAsset(\"http://vm0063.virtues.fi/gangsters/?active\", \"Binary\", true);\n transfer.Succeeded.connect(function(){\n \tmyHandler(transfer, frametime);\n });\n } else \n interval++;\n if (gwalkToDestination) \n walkToDestination(frametime); \n \n for (var i in scene.EntitiesOfGroup('Player'))\n if(scene.EntitiesOfGroup('Player')[i].animationcontroller.GetActiveAnimations().length < 1)\n checkAnims(scene.EntitiesOfGroup('Player')[i]);\n\n }\n}", "movement_left() {\n if (this.distance != 0) {\n let delay = 1000 / 60;\n this.scene.time.delayedCall(delay, () => {\n this.x -= this.movespeed;\n this.distance -= this.movespeed;\n this.movement_left();\n });\n }\n if (this.distance == 0) { \n console.log(this.x, this.y);\n this.moving = false;\n }\n }", "function timeIt() {\n mousePressedDuration++;\n distance = dist( mouseX, mouseY, width / 2, height / 2);\n if (mousePressedDuration == 28) {\n clearInterval(interval);\n }\n pressSize = map(mousePressedDuration, 0, 28, 5, 70);\n if (distance <= canvasDimension && distance >= 50 && uploaded === false) {\n newPlanetPrev.size = pressSize;\n }\n}", "function tick(){\n //iterate through animations and check for active state\n //if active, run position calculation on animations\n var activityCheck = false;\n var now = $.now();\n //console.log('$.animation.tick', now );\n\n for (var k in animations){\n //console.log(' ',k,animations[k].isActive());\n if (animations[k].isActive()){\n activityCheck = true;\n if ( !animations[k].isComplete() ){\n //console.log(' ','not complete');\n animations[k].enterFrame( now );\n }\n else{\n //console.log(' ','complete');\n //catch complete on next tick\n $.event.trigger(animations[k],'animationcomplete',false,false);\n delete animations[k];\n freeAnimationIds.push( parseInt(k) );\n }\n }\n }\n\n if (activityCheck){\n requestTick();\n }\n else {\n active = false;\n }\n }", "animationTick() {\n let sprite = this.sprite;\n if (sprite == null)\n return;\n\n // Loop the sprite animation if the sprites loop property is set to true\n if (sprite.loop == true) {\n if (sprite.animationTime >= sprite.animationSpeed) {\n sprite.animationTime = 0;\n sprite.animationFrame++;\n if (sprite.animationFrame >= sprite.frameCount) {\n sprite.animationFrame = 0;\n }\n }\n }\n // If loop property is set to false, the animation should stop after the last frame is drawn\n // and the onAnimationEnd method is called\n else {\n if (sprite.animationTime >= sprite.animationSpeed) {\n if (sprite.animationFrame < sprite.frameCount - 1) {\n sprite.animationTime = 0;\n sprite.animationFrame++;\n }\n else {\n this.onAnimationEnd();\n }\n }\n }\n sprite.animationTime += deltaTime;\n }", "function stepTime() {\n currentHourSetting += 1;\n if (currentHourSetting > 83)\n currentHourSetting -= 83;\n drawTimeSlide();\n let promises = updateTime();\n\t$.when.apply($, promises).then(function() {\n\t\tif (animationPlaying)\n\t\t\tanimationTimeout = setTimeout(stepTime, 200);\n\t});\n}", "function animate(timestamp) {\n oneStep();\n animationId = requestAnimationFrame(animate);\n}", "calcTime () {\n this.time = Math.max(0.1, Math.min(Math.abs(this.scrollY - this.scrollTargetY) / this.speed, 0.8))\n }", "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 }", "function displayTimer(){\n push();\n textFont(`Blenny`);\n fill(breadFill.r, breadFill.g, breadFill.b);\n textSize(24);\n text(`${timer} seconds left`, 1050, 190);\n if (frameCount % 60 == 0 && timer > 0) {\n timer --;\n }\n // if (timer == 0) {\n // text(\"GAME OVER\", width, height);\n // }\n pop();\n }", "animationLoop() {\n // increment animateUnit by a fraction each loop\n let delta = this.endUnit - this.startUnit;\n if (delta < 0) {\n delta = this.totalUnits + delta;\n }\n\n this.animateUnit += delta / this.framesPerSec;\n\n if (this.animateUnit >= this.totalUnits) {\n // wrap around from max to 0\n this.animateUnit = 0;\n }\n\n if (Math.floor(this.animateUnit) === this.endUnit) {\n // target reached, disable timer\n clearInterval(this.animationTimer);\n this.animationTimer = null;\n this.animateUnit = this.endUnit;\n this.startUnit = this.endUnit;\n }\n\n // redraw on each animation loop\n this.draw();\n }", "function createFxNow() {\n window.setTimeout(function () {\n fxNow = undefined;\n });\n return fxNow = jQuery.now();\n } // Generate parameters to create a standard animation", "animateToLocation(x_, y_, time_){\n let time = time_ || 1000;\n let x = x_ || 0;\n let y = y_ || 0;\n this.position.x = x;\n this.position.y = y;\n this.juggler.animate(time, \">\", 0).move(x,y);\n }", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n }", "function updateTime(ti) {\n\tvar curDuration = bg.getCurDuration();\n\tvar progress = ti / 400;\n\n\tbg.setTime(progress * curDuration);\n}", "doFrame(moves, currTime, totalTime) {\n if (currTime < totalTime) {\n // Draw animation\n setTimeout(() => {\n this.doFrame(moves, currTime + 1 / FRAME_PER_SECOND, totalTime);\n }, 1 / FRAME_PER_SECOND * 1000);\n\n for (let move of moves) {\n // moves -> [[start[i, j], end[i, j]], ...]\n // move -> [start[i, j], end[i, j]]\n let block = this.blocks[move[0][0]][move[0][1]];\n\n let origin = this.gridToPosition(move[0][0], move[0][1]);\n let destination = this.gridToPosition(move[1][0], move[1][1]);\n let currPosition = [\n origin[0] + currTime / totalTime * (destination[0] - origin[0]),\n origin[1] + currTime / totalTime * (destination[1] - origin[1])\n ]\n\n block.style.top = currPosition[0];\n block.style.left = currPosition[1];\n }\n } else {\n view.drawGame();\n }\n }", "updateTime() {\n\t\tlet now = new Date().getTime();\n\t\tlet x = now - this.startTime;\n\t\tlet time = moment.duration(x);\n\t\tthis.elapsedTime = clc.xterm(242)(time.hours() + 'h ') + clc.xterm(242)(time.minutes() + 'm ') + clc.xterm(242)(time.seconds() + 's');\n\t}", "getAnimationDuration() {\n let min = Streak.durations.min,\n max = Streak.durations.max;\n \n return Number.parseFloat((min + (max - min) * Math.random()).toFixed(2));\n }", "function colourPointsTime() {\n let start = 511;\n if (frame === start) {\n arrayOf.colourPoints = createColourPoints();\n }\n if (frame >= start) {\n updateColourPoints();\n }\n}", "updateSprite(timer) {\n timer % this.animTime === 0 ? this.currentFrame++ : null\n this.currentFrame === this.numberOfFrames ? this.currentFrame = 0 : null\n }", "wait_GM_1st_AnimationEnd(){\n if(this.check_Reset())\n return;\n if (this.numberOfTries > this.maxNumberOfTries) {\n this.numberOfTries = -1;\n\n if (this.currentPlayer == 2)\n {\n this.scene.update_CameraRotation();\n this.state = 'WAIT_GM_CAMERA_ANIMATION_END';\n }\n else\n this.state = 'GAME_MOVIE';\n\n }\n this.numberOfTries++;\n }", "animate (now) {\r\n const timeDelta = (this.then - now) / 1000\r\n this.then = now\r\n this.player.updatePosition(timeDelta, this.currentMeshes)\r\n this.player.updateRotation()\r\n this.updateMeshes()\r\n this.view.draw(this.player.getCamera())\r\n\r\n const pos = this.mouseFocus.getNewBlockPosition()\r\n infoBox.textContent = pos\r\n ? `${pos.x}, ${pos.y}, ${pos.z}`\r\n : 'Nö, einfach nö!'\r\n\r\n requestAnimationFrame(this.animate.bind(this))\r\n }", "function startAnimating() {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n}", "function animate(time){\n requestAnimationFrame(animate);\n TWEEN.update(time);\n }", "function update_time()\n{\n\ttime.timer++;\n\ttime.x += 2;\n\ttime.w -= 2;\n}", "mainLoop(time) {\n this.canvas.updateDimensions();\n this.canvas.clear();\n\n this.windSpeed = Math.sin(time / 8000) * this.windSpeedMax;\n this.wind = this.particleManager.particleOptions.wind += this.windChange; // eslint-disable-line\n\n let numberToAdd = this.framesSinceDrop * this.particlesPerFrame;\n\n while (numberToAdd >= 1) {\n this.particleManager.add();\n numberToAdd -= 1;\n this.framesSinceDrop = 0;\n }\n\n this.particleManager.update();\n this.particleManager.draw();\n\n // Stop calling if no particles left in view (i.e. it's been stopped)\n if (!this.killed || this.particleManager.items.length) {\n this.animationId = requestAnimationFrame(this.mainLoop.bind(this));\n }\n\n this.framesSinceDrop += 1;\n }", "getCountdown() {\n return this.frameRate * (11 - this.level);\n }" ]
[ "0.6714792", "0.66146725", "0.644252", "0.62793094", "0.62427026", "0.6230366", "0.6174319", "0.6162955", "0.61012864", "0.6094267", "0.6085944", "0.60453236", "0.604237", "0.6029735", "0.6029735", "0.6029735", "0.6029735", "0.6029735", "0.59791684", "0.5957901", "0.5957794", "0.59525555", "0.59515274", "0.59486616", "0.59188515", "0.59037524", "0.58913964", "0.5887339", "0.58869916", "0.58869845", "0.5884178", "0.5871308", "0.5870809", "0.5865505", "0.58580494", "0.58536696", "0.58390975", "0.58371806", "0.5829259", "0.5813711", "0.5790959", "0.5737359", "0.57336175", "0.57315004", "0.57291234", "0.5728713", "0.572695", "0.5723705", "0.5723705", "0.5712184", "0.57061106", "0.57049096", "0.5698935", "0.5697824", "0.56933033", "0.5684956", "0.56825334", "0.56796145", "0.5679373", "0.56572366", "0.5656156", "0.56556505", "0.56434125", "0.56374854", "0.5632959", "0.56274855", "0.56274533", "0.5626225", "0.5623825", "0.56223965", "0.56120044", "0.56118923", "0.56046456", "0.5604005", "0.5589979", "0.5588774", "0.5588075", "0.5587247", "0.5587232", "0.55843914", "0.5584355", "0.5575521", "0.557466", "0.55728626", "0.5568537", "0.5563921", "0.5563636", "0.5558952", "0.5558748", "0.55548805", "0.5553689", "0.55494094", "0.5548199", "0.55474496", "0.55418766", "0.5535634", "0.55339026", "0.5527325", "0.5522991", "0.55203974" ]
0.59160703
25
changing animation frames every 55 milliseconds and when it reaches max frame
animate(){ if (this.timeFromLast > this.animationTime){ this.currentFrameNum++; this.currentFrameX += this.frameWidth; this.timeFromLast = 0; this.timeUntilLast = millis(); } if (this.currentFrameNum > this.maxFrame){ this.currentFrameNum = 3; this.currentFrameX = 22; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "animate(framesCounter) {\n\n if (framesCounter % 8 == 0) {\n this.fireImage.framesIndex++;\n }\n \n if (this.fireImage.framesIndex > this.fireImage.frames - 1) {\n this.fireImage.framesIndex = 0;\n\n }\n }", "function animate_ff() {\n console.log(\"1\");\n document.animation.src = images[frame].src;\n //$('#animation').attr('src', images[frame].src);\n frame = (frame + 1) % MAX_FRAMES;\n if (frame == 0) {\n if (timeout_id) clearTimeout(timeout_id);\n timeout_id = setTimeout(\"animate_ff()\", 3000);\n }\n else {\n if (timeout_id) clearTimeout(timeout_id);\n timeout_id = setTimeout(\"animate_ff()\", 150);\n }\n }", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime; \n rotAngle= (rotAngle+1.0) % 360;\n }\n var elapsed=timeNow-lastTime;\n lastTime = timeNow;\n \n //when framecount is less than 120, the effect is just rotation\n //when framecount is between 120 to 240, the effect is shaking from left to right\n //when framecount is between 240 to 360, the effect is enlarging from left to right\n //when framecount is between 360 to 480, the effect is shaking hands\n //when framecount is between 480 to 600, the effect is enlargeing from top to bottom\n //then repeat\n days=days+0.01;\n if(framecount>=120 && framecount <240){\n updateBuffers();\n \n } \n if(framecount>=240 && framecount <360) {\n updateBuffers1();\n updatecolor();\n\n }\n if(framecount>=360 && framecount <480){\n updateBuffers2();\n }\n if (framecount >=480 && framecount < 600) {\n \n updateBuffers3();\n updatecolor();\n \n }\n \n \n \n}", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function changeFrames() {\n enemies.map(enemy => enemy.frame = (++enemy.frame) % numberOfFrames);\n }", "animate() {\n if (this.animationFrames.length > 1) {\n this.animationTimer += 1;\n const quotient = Math.floor(this.animationTimer / this.animationFrameDuration)\n const frame = quotient % this.animationFrames.length;\n this.srcImage = this.animationFrames[frame];\n if (this.animationTimer === this.animationFrameDuration * this.animationFrames.length) {\n this.animationTimer = 0;\n }\n }\n }", "function animateFrames2(id,fps,reps,direction) {\n\n //Get all children of the frame-container\n var children = $(\"#\"+id).children();\n\n //Get the number of max. frames, count starts at 0!\n var max_frame = children.length;\n console.log(\"max frames: \"+max_frame);\n\n //Calculate duration per frame\n var duration = 1000/fps;\n\n //Just iterating the child array downwards\n if(direction===\"reverse\"){\n //Counter\n var frame = max_frame -1;\n //Set interval with defined fps\n var pid = setInterval(function () {\n //decrement frame\n frame--;\n //check if last frame was reached\n if (frame === -1) {\n //Start again at first frame\n if (reps === \"infinite\") {\n frame = max_frame -1; //already decremented!\n } else {\n //for now: Stop animation after one cycle\n clearInterval(pid);\n //save last shown frame in hash map\n threadHashMap[\"_\"+pid] = max_frame;\n return;\n }\n }\n\n //Hide last frame\n if (frame < max_frame -1 ) {\n children.eq(frame + 1).css(\"display\", \"none\");\n } else {\n //in case of a anterior cycle the first frame has to be hidden (no effect if first cycle)\n children.eq(0).css(\"display\", \"none\");\n }\n //Show current frame\n children.eq(frame).css(\"display\", \"block\");\n //save last shown frame in hash\n threadHashMap[\"_\"+pid] = frame;\n }, duration);\n }else {\n\n /* TODO WATCH OUT: HERE THE first frame is still pulled! fix ;)*/\n //Counter\n var frame = 0;\n\n //Set interval with defined fps\n var pid = setInterval(function () {\n\n //increment frame\n frame++;\n\n //check if last frame is reached\n if (frame >= max_frame) {\n //Start again at first frame\n if (reps === \"infinite\") {\n frame = 1; //already incremented!\n } else {\n //save last shown frame in hash\n threadHashMap[\"_\"+pid] = 1; // TODO should be 0 ...\n //for now: Stop animation after one cycle\n clearInterval(pid);\n return;\n }\n }\n\n //Hide last frame\n if (frame > 1) {\n children.eq(frame - 1).css(\"display\", \"none\");\n } else {\n //in case of a anterior cycle the last frame has to be hidden (no effect if first cycle)\n children.eq(max_frame - 1).css(\"display\", \"none\");\n }\n //Show current frame\n children.eq(frame).css(\"display\", \"block\");\n //save last shown frame in hash\n threadHashMap[\"_\"+pid] = frame;\n\n }, duration);\n }\n //Storing the pid of the last started frame thread thread under 'special' key '_0' in hash <_0,pid>, all other entries _n are <pid,frame>\n threadStack.push(pid);\n console.log(\"hash: \"+threadHashMap._0);\n console.log(\"hash-length-control: \"+ Object.keys(threadHashMap).length);\n}", "nextFrame(){\n this.currentFrame++;\n \n if(this.currentFrame >= 5){\n this.currentFrame = 0;\n }\n \n this.setFrame(this.currentFrame);\n }", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "function animateN(n) {\n var cur_frame = 0\n function animate() {\n if (cur_frame < n) {\n Runner.tick(runner, engine, 10)\n cur_frame += 1\n setTimeout(animate, 10)\n } else {\n }\n }\n animate()\n}", "slideLoop() {\n\t\tthis.animation = setTimeout( () => {\n\t\t\tif (this.i < this.indexSlide) {\n \tthis.i++;\n }\n else {\n \tthis.i = 0;\n };\n this.changeSlide();\n this.slideLoop();\n this.launchprogressbar();\n }, this.timeout); // toutes les 5 secondes\n }", "onAnimFrame() {\n const now = Date.now();\n const delta = now - this.previousFrameTime;\n const interval = 1000 / this.props.fps;\n\n this.requestId = window.requestAnimationFrame(this.onAnimFrame);\n\n if (delta > interval) {\n this.previousFrameTime = now - (delta % interval);\n this.drawCurrentFrame();\n\n // Clamp playback between start & end frame range, looping\n // whenever we run past the end frame.\n if (this.frame < this.startFrame || this.frame > this.endFrame) {\n this.frame = this.startFrame;\n }\n }\n }", "updateFrame() {\n let newFrameIndex;\n if(this.isInReverse) {\n newFrameIndex = this.currFrame - 1;\n if(newFrameIndex < 0) {\n if (this.loops) {\n this.isInReverse = false;\n newFrameIndex = this.currFrame + 1;\n } else {\n this.isAnimating = false;\n this.isFinished = true;\n newFrameIndex = 0;\n } \n } \n } else {\n newFrameIndex = this.currFrame + 1;\n if(newFrameIndex >= this.frames.length) {\n if(this.reverses) {\n newFrameIndex = this.currFrame - 1;\n this.isInReverse = true;\n } else if(this.loops) {\n newFrameIndex = 0;\n } else if (this.holds) { \n newFrameIndex = this.frames.length - 1;\n } else {\n this.isAnimating = false;\n this.isFinished = true;\n newFrameIndex = 0;\n }\n }\n }\n\n this.currFrame = newFrameIndex;\n }", "function startAnimation() {\n var lastFrame = +new Date;\n function loop(now) {\n animationID = requestAnimationFrame(loop);\n var deltaT = now - lastFrame;\n // Do not render frame when deltaT is too high\n if (Math.abs(deltaT) < 160) {\n renderFrame(deltaT);\n }\n lastFrame = now;\n }\n loop(lastFrame);\n}", "animate() {\n if (this.tick % 10 != 0)\n return;\n this.tick = 0;\n if (this.index < this.images.length - 1) \n this.index += 1;\n else\n this.index = 0;\n }", "animate() {\n clearTimeout(this.timeout);\n\n this.drawCurrentFrame();\n\n if (this.props.play && (this.props.frame + 1) < this.props.replay.turns.length) {\n this.props.incrementFrame();\n\n // if playing, render again\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => requestAnimationFrame(this.animate), TICK_SPEED);\n }\n }", "function runAnimation(frameFunc){\n let lastTime = null;\n function frame(time){\n if(lastTime!=null){\n let timeStep = Math.min(time - lastTime,100)/1000;\n if(frameFunc(timeStep)==false)return;\n }\n lastTime = time;\n requestAnimationFrame(frame);\n }\n requestAnimationFrame(frame);\n }", "function updateAnimation(anim) {\r\n\t\t\tif (Date.now() - anim.frameTimer > anim.frameDuration) {\r\n\t\t\t\tif (anim.currentFrame < anim.frames.length - 1) anim.currentFrame ++;\r\n\t\t\t\telse anim.currentFrame = 0;\r\n\t\t\t\tanim.frameTimer = Date.now();\r\n\t\t\t}\r\n\t\t}", "_frame () {\n this._drawFrame()\n if (!this.paused) {\n if (this.frameCount % 4 === 0) {\n this._updateGeneration()\n this.matrix = this.nextMatrix\n this.nextMatrix = this._createMatrix()\n this.counter.innerText = 'Generation: ' + this.generationNumber\n }\n }\n this.frameCount++\n requestAnimationFrame(this._frame)\n }", "function updateAnimationFrames() {\n\tdragon1 = document.getElementById('dragon1');\n\tdragon2 = document.getElementById('dragon2');\n\tdragon1.innerHTML = \"<img src='img/d1\" + state1 + x + \".svg'/>\";\n\tdragon2.innerHTML = \"<img src='img/d2\" + state2 + x + \".svg'/>\";\n\tif (r == false && x < 9) {\n\t\tx++;\n\t}\n\tif (r == true && x >= 0) {\n\t\tx--;\n\t}\n\tif (x == 9 ) {\n\t\tr = true;\n\t}\n\tif (x == 0) {\n\t\tr = false;\n\t}\n}", "function updateAnimation(anim) {\n if (Date.now() - anim.frameTimer > anim.frameDuration) {\n if (anim.currentFrame < anim.frames.length - 1) anim.currentFrame ++;\n else anim.currentFrame = 0;\n anim.frameTimer = Date.now();\n }\n}", "function animateFrames(id,fps,reps) {\n //Get the number of max. frames, count starts at 1\n var max_frame=1;\n while ($(\"#\"+id+max_frame).length > 0){\n max_frame++;\n }\n max_frame--;\n //Calculate duration per frame\n var duration = (60/fps)*1000;\n var frame = 1;\n\n //not very intuitive: anonymous function and function vars have the same scope -> see frame-var\n var interval = setInterval(function() {\n if(frame > max_frame) {\n //Start with first frame\n if (reps === \"infinite\") {\n frame = 1;\n }else{\n //Stop with animation after one cycle\n clearInterval(interval);\n return;\n }\n }\n setFrame(id,frame++,max_frame);\n }, duration);\n}", "grow() {\n this.r = sin(frameCount * .01) * 100;\n }", "set interval(interval) {\n this.interval_ = interval < 17 ? 17 : interval; // 17 ~ 60fps\n }", "function animationLoop(timeStamp){\n //7. Clears everything in canvas\n ctx.clearRect(0,0,canvas.width,canvas.height);\n drawBackground();\n walkingAnimation();\n changePositionX();\n changePositionY();\n changeTime();\n changeJump();\n //1-. Cal this function again (Repeat from step 6)\n requestId = requestAnimationFrame(animationLoop);\n\n // 9. Move Image\n}", "startAnimating(fps){\n this.fpsInterval = 1000 / fps;\n this.then = Date.now();\n this.animate();\n }", "function frame() {\n\n frameCount++;\n increment = 22 - frameCount; // move faster every frame\n\n if (increment < 2) increment = 2;\n\n deltaX += increment;\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n if (deltaX >= 100) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n\n // end animation\n if (deltaX >= 215) {\n clearInterval(animation);\n menuToggleBar.style.width = (220 - 40) + 'px';\n menu.style.right = 0 + 'px';\n deltaX = 220;\n isMenuAnimating = false;\n\n }\n }", "function anim() {\r\n Loop();\r\n requestAnimFrame(anim);\r\n }", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "update() {\n this.tickCount += 1;\n if (this.tickCount > this.ticksPerFrame) {\n this.tickCount = 0;\n // If the current frame index is in range\n if (this.frameIndex < this.numberOfFrames - 1) {\n // Go to the next frame\n this.frameIndex += 1;\n } else {\n this.frameIndex = 0;\n }\n }\n }", "nextFrame() {\r\n\t\t\tif (this.frame < this.length - 1) this.frame = this.frame + 1;\r\n\t\t\telse if (this.looping) this.frame = 0;\r\n\r\n\t\t\tthis.targetFrame = -1;\r\n\t\t\tthis.playing = false;\r\n\t\t}", "update( time ) {\r\n let animation = this.animationList[this.current];\r\n if( !animation ) return;\r\n this.progress += time * animation.fps;\r\n while( this.progress >= 1.0 ) {\r\n this.progress -= 1.0;\r\n this.frame++;\r\n if( this.frame >= animation.startFrame + animation.numFrames ) {\r\n this.frame = animation.startFrame;\r\n }\r\n }\r\n }", "function setAcceleratingTimeout(animationFrame, factor)\n{\n var internalCallback = function() {\n return function() {\n if (speed <= 6) { \n newFactor = factor - (speed*speed*5);\n setTimeout(internalCallback, newFactor);\n animationFrame();\n } else {\n setTimeout(internalCallback, newFactor);\n animationFrame();\n }\n }\n }();\n \n window.setTimeout(internalCallback, factor);\n}", "function girb_interval(){\n\t\t//\n\t\tclearInterval(girb_int);\n\t\t//\n\t\tif(Math.random()*100 > 50){\n\t\t\tmove_girb();\n\t\t}else{\n\t\t\treset_interval();\n\t\t\tset_animation(return_randImg(arr_img_idle));\n\t\t}\n\t}", "nextFrame() {\n this.updateParticles();\n this.displayMeasurementTexts(this.stepNo);\n this.stepNo++;\n\n if (this.stepNo < this.history.length - 1) {\n // Set timeout only if playing\n if (this.playing) {\n this.currentTimeout = window.setTimeout(\n this.nextFrame.bind(this),\n this.animationStepDuration\n );\n }\n } else {\n this.finish();\n }\n }", "animate(animation, animationDelay = 0, loopFrame = 0, loopAmount = -1) { //higher animationDelay is slower, every x frame\r\n var isLastFrame = 0;\r\n\t\t//console.log(\"BEFORE currentframe\", this.currentFrame, \"spritenumber\", this.spriteNumber, \"animation length\", animation.length);\r\n\t\t//console.log(\"isLastFrame\", isLastFrame, \"loopcounter\", this.loopCounter, \"loopamount\", loopAmount);\r\n\t\tif(this.animationDelayCounter >= animationDelay) {\r\n\t\t\tthis.currentFrame += 1;\r\n\t\t\tif((this.currentFrame === animation.length)) {// && ((loopAmount === -1) || (this.loopCounter < loopAmount))){\r\n\t\t\t\tthis.currentFrame = loopFrame;\r\n\t\t\t\tthis.loopCounter += 1;\r\n\t\t\t\tisLastFrame += 1;\r\n\t\t\t\t//console.log(\"First If\");\r\n\t\t\t}\r\n if((loopAmount > -1) && (this.loopCounter > loopAmount)) {\r\n isLastFrame += 1;\r\n\t\t\t\tthis.currentFrame = animation.length-1;\r\n\t\t\t\t//console.log(\"Second If\");\r\n }\r\n\t\t\tthis.animationDelayCounter = 0;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.animationDelayCounter += 1;\r\n\t\t}\r\n this.spriteNumber = animation[this.currentFrame];\r\n //console.log(\"AFTER currentframe\", this.currentFrame, \"spritenumber\", this.spriteNumber, \"animation length\", animation.length);\r\n\t\t//console.log(\"isLastFrame\", isLastFrame, \"loopcounter\", this.loopCounter, \"loopamount\", loopAmount);\r\n return isLastFrame;\r\n\t}", "function frame() {\n if (width >= 100) {\n clearInterval(id);\n i = 0;\n } else {\n width = width + 5.8;\n elem.style.width = width + \"%\";\n }\n }", "function updateFrame() {\n // TODO: INSERT CODE TO UPDATE ANY OTHER DATA USED IN DRAWING A FRAME\n y += 0.3;\n if (y > 60) {\n y = -50;\n }\n frameNumber++;\n}", "function animate() {\n\t//get the horizontal offset from the array\n\tvar h_offset = fr_num * (63);\n\tvar v_offset = direction * (63);\n\t//get the image and reslice it\n\timg_element.style.backgroundPosition = `-${h_offset}px -${v_offset}px`; \n\t//update frame counter, 0->1->2->3->0->...\n\tfr_num = ++fr_num % 4;\n}", "function frame() {\n if (width >= 100) {\n clearInterval(id);\n i = 0;\n move2();\n } else {\n width = width + 5.8;\n elem.style.width = width + \"%\";\n }\n }", "animationLoop() {\n // increment animateUnit by a fraction each loop\n let delta = this.endUnit - this.startUnit;\n if (delta < 0) {\n delta = this.totalUnits + delta;\n }\n\n this.animateUnit += delta / this.framesPerSec;\n\n if (this.animateUnit >= this.totalUnits) {\n // wrap around from max to 0\n this.animateUnit = 0;\n }\n\n if (Math.floor(this.animateUnit) === this.endUnit) {\n // target reached, disable timer\n clearInterval(this.animationTimer);\n this.animationTimer = null;\n this.animateUnit = this.endUnit;\n this.startUnit = this.endUnit;\n }\n\n // redraw on each animation loop\n this.draw();\n }", "function frame() {\n\n frameCount++;\n deltaX += -frameCount; // move faster every frame\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n // move top nav bar if needed\n if (deltaX >= 110) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n // end menu bar animation\n else if (deltaX > 90 && deltaX < 110) {\n menuToggleBar.style.width = 60 + 'px';\n }\n // end slide menu animation\n else if (deltaX <= -5) {\n clearInterval(animation);\n menu.style.right = -220 + 'px';\n deltaX = 0;\n frameCount = 0;\n isMenuAnimating = false;\n }\n }", "function draw()//p5.js update loop\n{\n frame += 1;// increment frame count (exhaust frame buffer)\n \n if(frame % (frame_buffer - sSlider.value()) == 0){// update display once our frame buffer is exhausted\n manager.draw_grid();\n if(stats) show_stats();\n }\n}", "_incrementFrame() {\n this._elapsedFrameCount += 1;\n }", "function nextFrame(){\n // Protecting upper bounds\n if (frame === 7781){\n console.log('End of Frames')\n return\n }\n setFrame(frame + 1)\n console.log('Next Frame')\n playerRef.current.seekTo(frame / 60)\n console.log(frame)\n console.log(frame / 60)\n }", "updateSprite(timer) {\n timer % this.animTime === 0 ? this.currentFrame++ : null\n this.currentFrame === this.numberOfFrames ? this.currentFrame = 0 : null\n }", "hadouken(){\n this.state = \"hadouken\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 2348;\n this.frameHeight = 109;\n this.frameWidth = 125;\n this.maxFrame = 8;\n hadouken1.startTime = millis();\n }", "constructor(){\n this.x = 100;\n this.y = 100;\n this.frameHeight = 53;\n this.frameWidth = 64;\n this.currentFrameX = 23;\n this.currentFrameY = 16;\n this.spriteSheet;\n this.currentFrameNum = 1;\n this.time = 0;\n this.timeUntilLast = 0;\n this.timeFromLast = 0;\n this.animationTime = 50;\n this.maxFrame = 6;\n this.startTime;\n this.lifeTime;\n this.alive = false;\n\n\n \n\n }", "function everyinterval(n) {\n if ((myGameArea.frameNo / n) % 1 == 0) { return true; }\n return false;\n}", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "function step(startTime) {\n\n// console.log(\"working\");\n // 'startTime' is provided by requestAnimationName function, and we can consider it as current time\n // first of all we calculate how much time has passed from the last time when frame was update\n if (!timeWhenLastUpdate) timeWhenLastUpdate = startTime;\n timeFromLastUpdate = startTime - timeWhenLastUpdate;\n\n // then we check if it is time to update the frame\n if (timeFromLastUpdate > timePerFrame) {\n // and update it accordingly\n $element.attr('src', imagePath + '/cup-' + frameNumber + '.png');\n // $element.attr('src', imagePath + `/cup-${frameNumber}.png`);\n // reset the last update time\n timeWhenLastUpdate = startTime;\n\n // then increase the frame number or reset it if it is the last frame\n if (frameNumber >= totalFrames) {\n frameNumber = 1;\n } else {\n frameNumber = frameNumber + 1;\n }\n }\n\n requestAnimationFrame(step);\n}", "nextFrame() {\n\t\t\t\tif (this.frame < this.images.length - 1) this.frame = this.frame + 1;\n\t\t\t\telse if (this.looping) this.frame = 0;\n\n\t\t\t\tthis.targetFrame = -1;\n\t\t\t\tthis.playing = false;\n\t\t\t}", "function frames(numFrames, numMins){\n return (numFrames*60) * numMins;\n }", "illuminateSequence(){\r\n for (let i = 0; i < this.level; i++) {\r\n const color=this.numberToColor(this.sequence[i])\r\n setTimeout(()=>this.illuminateColor(color),1000*i)\r\n }\r\n}", "function nextFrame() {\n _timeController.proposeNextFrame();\n }", "setTimeLimit() {\nvar lastframe;\n//-----------\nif (this.fCount === 0) {\nreturn this.tLimit = 0;\n} else {\nlastframe = this.frameAt(this.fCount - 1);\nreturn this.tLimit = (lastframe.getTime()) + (lastframe.getDuration());\n}\n}", "function animationLoop(gl, Date, startTime, setTimeout) {\n setTimeout(animationLoop, 16, gl, Date, startTime, setTimeout);\n currentTime = (new Date()).getTime() * 0.001; // calculate current time for frame\n currentTime -= startTime;\n enterFrameHandler && enterFrameHandler(); // Call onEnterFrame callback if running application has defined one\n gl.clear(gl.COLOR_BUFFER_BIT); // Clear drawing surface with backgroundColor (glColor)\n screen.__draw(gl, gl.mvMatrix); // Start scene-graph render walk\n \n \n //framerate.snapshot();\n }", "function animateFrame()\n{\n // Update the current camera and scene\n if (currentCamera !== undefined) currentCamera.updateProjectionMatrix();\n if (currentScene !== undefined) currentScene.traverse(runScripts);\n\n // Update previous mouse state here because animateFrame\n // out of sync with mouse listeners (onMouseMove, onMouseWheel)\n mousePrevX = mouseX;\n mousePrevY = mouseY;\n mousePrevScroll = mouseScroll;\n\n var t = getElapsedTime();\n frameDuration = t - frameStartTime;\n frameStartTime = t;\n frameNum++;\n}", "function megamanRunLoop(){\n if (frameCount % 15 === 0) {// every 15 frames\n animationFrameCounter += 1;\n }\n if (animationFrameCounter >= 4){//resets the counter every 4 cycles\n animationFrameCounter = 0;\n }\n if (megamanDirection === 1){// if facing right\n //draw the next right-facing image in the animation\n image(rightRunLoop[animationFrameCounter], megamanXPos, megamanYPos, megamanWidth, megamanHeight);\n }\n else{//If facing left\n //draw the next left-facing image in the animation\n image(leftRunLoop[animationFrameCounter], megamanXPos, megamanYPos, megamanWidth, megamanHeight);\n }\n \n }", "function playNextFrame() {\n if (currentFrame >= frames.length) {\n currentFrame = 0;\n }\n\n renderFrames();\n\n var frame = frames[currentFrame];\n for (var i = 0; i < frame.length; i++) {\n if (frame[i] >= threshValue) {\n playSound(i);\n\n if (playFirstNote) {\n break;\n }\n }\n }\n\n currentFrame++;\n}", "function restartAnimation() {\n setup();\n let range = document.getElementById('range');\n elementsLength = parseInt(range.max);\n value = parseInt(range.value);\n min = 0;\n focus = 0;\n frames = 0;\n}", "function step() {\r\n\t\tvar j;\r\n\t\tif(timeout_id) {\r\n\t\t clearTimeout(timeout_id);\r\n\t\t timeout_id = null;\r\n\t\t}\r\n\t\tframe = (frame + dir + imageSum) % imageSum;\r\n\t\tj = frame + 1;\r\n\t\t\r\n\t\tif(images[frame].complete) {\r\n\t\t $('div#animation').html('<img src=\"'+images[frame].src+'\" />');\r\n\t\t $('.label #playlabel').html('step: ');\r\n\t\t $('.label #playstatus').html(j+' of '+imageSum);\r\n\t\t \r\n\t\t if(swingon && (j == imageSum || frame == 0)) {\r\n\t\t\treverse();\r\n\t\t }\r\n\t\t \r\n\t\t playing = 0;\r\n\t\t}\r\n\t }", "function startAnimation() {\n timerId = setInterval(updateAnimation, 16);\n }", "animate(inCollection) {\n\n // Don't animate when not visible.\n if (!this.isVisible) { return; }\n\n // Adjust how often the animation occurs.\n this.frameSkipCount++;\n if (this.frameSkipCount < this.frameSkip) {\n return;\n }\n this.frameSkipCount = 0;\n\n // Hide the img of the current frame.\n this[`frame${this.currentFrame}`].style.display = \"none\";\n // Bump to the next frame, reset when it's time to wrap around.\n this.currentFrame++;\n if (this.currentFrame === this.frameCount) {\n this.currentFrame = 0;\n if (this.animationCallback) {\n this.animationCallback(inCollection);\n }\n }\n // Show the new current frame's img.\n this[`frame${this.currentFrame}`].style.display = \"\";\n\n }", "set_animation_frame(sequence_index, frame) {\r\n\r\n if (sequence_index < 0 || sequence_index > this.sprite.animation_sequence_data.length) {\r\n console.log('error fame does not exist');\r\n return false;\r\n }\r\n\r\n var animObj = this.sprite.animation_sequence_data[sequence_index];\r\n if (frame <0 || frame > animObj.frame_end) {\r\n console.log('frame does not exist');\r\n return false;\r\n }\r\n\r\n animObj.frame_current = frame;\r\n \r\n \r\n }", "doFrame(moves, currTime, totalTime) {\n if (currTime < totalTime) {\n // Draw animation\n setTimeout(() => {\n this.doFrame(moves, currTime + 1 / FRAME_PER_SECOND, totalTime);\n }, 1 / FRAME_PER_SECOND * 1000);\n\n for (let move of moves) {\n // moves -> [[start[i, j], end[i, j]], ...]\n // move -> [start[i, j], end[i, j]]\n let block = this.blocks[move[0][0]][move[0][1]];\n\n let origin = this.gridToPosition(move[0][0], move[0][1]);\n let destination = this.gridToPosition(move[1][0], move[1][1]);\n let currPosition = [\n origin[0] + currTime / totalTime * (destination[0] - origin[0]),\n origin[1] + currTime / totalTime * (destination[1] - origin[1])\n ]\n\n block.style.top = currPosition[0];\n block.style.left = currPosition[1];\n }\n } else {\n view.drawGame();\n }\n }", "walk(framesCounter) {\n this.ctx.drawImage(\n this.imageInstance,\n this.imageInstance.framesIndex * Math.floor(this.imageInstance.width / this.imageInstance.frames),\n 0,\n Math.floor(this.imageInstance.width / this.imageInstance.frames),\n this.imageInstance.height,\n this.shinobiPos.x,\n this.shinobiPos.y,\n this.shinobiSize.w,\n this.shinobiSize.h\n )\n this.animateSprite(framesCounter)\n }", "update_animation() {\r\n\r\n // Are we animating this sprite?\r\n if (this.sprite.animate==false)\r\n return;\r\n\r\n // Get the data for this animation sequence \r\n var sprite_data = this.sprite.animation_sequence_data[this.sprite.animation_sequence];\r\n\r\n\r\n // Only run the animation sequence once \r\n if (sprite_data.repeat == -1 && \r\n sprite_data.frame_current >= sprite_data.frame_end ) \r\n {\r\n return;\r\n } \r\n \r\n\r\n sprite_data.screen_count ++;\r\n\r\n // Move to next frame\r\n if (sprite_data.screen_count >= sprite_data.speed) {\r\n\r\n sprite_data.frame_current ++; // Move next frame\r\n sprite_data.screen_count = 0; // Reset screen count \r\n\r\n // Repeat animation X number of times \r\n if (sprite_data.repeat > 0 && \r\n sprite_data.repeat_count >= sprite_data.repeat-1) \r\n {\r\n return; \r\n }\r\n\r\n\r\n // Move back to start of animation\r\n if (sprite_data.frame_current > sprite_data.frame_end) {\r\n sprite_data.frame_current = sprite_data.frame_start;\r\n\r\n if (sprite_data.repeat > 0)\r\n sprite_data.repeat_count ++;\r\n }\r\n\r\n // reset our count. \r\n sprite_data.screen_count = 0; \r\n } \r\n }", "function runAnimation(frameFunc) {\n\n var lastTime = null;\n\n function frame(time) {\n\n var stop = false;\n\n if (lastTime != null) {\n\n // Set a maximum frame step of 100 milliseconds to prevent\n\n // having big jumps\n\n var timeStep = Math.min(time - lastTime, 100) / 1000;\n\n stop = frameFunc(timeStep) === false;\n\n }\n\n lastTime = time;\n\n if (!stop)\n\n requestAnimationFrame(frame);\n\n }\n\n requestAnimationFrame(frame);\n\n}", "function advanceFrame() {\n\n //Advance the frame if `frameCounter` is less than \n //the state's total frames\n if (frameCounter < numberOfFrames + 1) {\n\n //Advance the frame\n sprite.gotoAndStop(sprite.currentFrame + 1);\n\n //Update the frame counter\n frameCounter += 1;\n\n //If we've reached the last frame and `loop`\n //is `true`, then start from the first frame again\n } else {\n if (sprite.loop) {\n sprite.gotoAndStop(startFrame);\n frameCounter = 1;\n }\n }\n }", "function updateAnimatedCharacter() {\n var ctx = hangmanGame.canvas.getContext(\"2d\");\n\n ctx.drawImage(character.image, 400 * character.frame, 0, 400, 400, 310, 15, 200, 200);\n\n if (hangmanGame.frameCount % 25 === 0) {\n if (character.frame === 0) {\n character.frame++;\n } else {\n character.frame = 0;\n }\n }\n}", "function drawFrame(frame) {\n\t\tvideo.currentTime = (frame.second > video.duration ? video.duration : frame.second);\n\t}", "function introAnimation () {\n let x = 0\n let flash = setInterval(() => {\n flashButtons()\n x++\n if (x >= 3) {\n clearInterval(flash)\n }\n }, 500)\n}", "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "function loop() {\n draw();\n requestAnimFrame(loop);\n}", "function nextFrame(avatarIdToChange){\n\t//get old src (Maxus leading '?/images/animations/' (len=18) and file extension (len=4))\n\t//var fullOldSrc = avatarElement.src.split(\"/images/animations/\")[1]; \n\tvar avatarElementToChange = document.getElementById(avatarIdToChange);\n\tvar splitSrc = avatarElementToChange.src.split(\"/\");\n\t//console.log(splitSrc);\n\t//[0] = \"http:\",\n\t//[1] = \"\",\n\t//[2] = \"localhost:8000\",\n\t//[3] = \"images\",\n\t//[4] = \"ani_vSmall\",\n\t//[5] = \"running\",\n\t//[6] = \"0.png\"\n\t//I don't really need 0-2, 3-5 need to stay the same, 6 needs to be changed\n\tvar oldFrameN = splitSrc[6].substr(0,splitSrc[6].length-4);\t//remove extension\n\tvar newFrameN = parseInt(oldFrameN) + 1;\n\n\n\n\tvar newSrc = splitSrc[3] +'/'+ splitSrc[4] +'/'+ splitSrc[5] +'/'+ newFrameN + \".png\";\n\n\tif ( ! UrlExists(newSrc,newFrameN) ){\t//if animation not found\n\t\t newSrc = splitSrc[3] +'/'+ splitSrc[4] +'/'+ splitSrc[5]+'/'+\"0.png\";//reset to 0 animation\n\t}\n\tavatarElementToChange.src=newSrc;\n\tconsole.log(avatarElementToChange.id + \" frame changed to \" + avatarElementToChange.src);\n}", "function animationLoop() {\n for(let i=0; i<10; i++){\n selectSegments(10).segments[i].style.animation = `moveToUp 5s ease .0${i}s infinite`;\n selectSegments(10).secondSegments[i].style.animation = `moveToDown 5s ease .0${i}s infinite`;\n \n \n }\n for(let i=10; i<20; i++){\n selectSegments(20).segments[i].style.animation = `moveToUp 5s ease .${i}s infinite`;\n selectSegments(20).secondSegments[i].style.animation = `moveToDown 5s ease .${i}s infinite`;\n \n }\n}", "updateAnimation() {\n if (this.isMoving()) {\n if (this.dirX == -1)\n this.animator.changeFrameSet(this.frameSets[\"swim-left\"],\n \"loop\", 5);\n else\n this.animator.changeFrameSet(this.frameSets[\"swim-right\"],\n \"loop\", 5);\n } else {\n if (this.dirX == -1)\n this.animator.changeFrameSet(this.frameSets[\"idle-left\"],\n \"pause\");\n else\n this.animator.changeFrameSet(this.frameSets[\"idle-right\"],\n \"pause\");\n }\n \n this.animator.animate();\n }", "function gameSlow() {\n setInterval(oneFrame, 300);\n setInterval(buff6s, 12000);\n}", "function Tirar()\n{\n let ahora = Date.now();\n let intervalo = ahora - tirar;\n\n if (intervalo > 500) \n {\n p.moverAbajo();\n tirar = Date.now();\n }\n\n if(gameOver == false)\n {\n requestAnimationFrame(Tirar);\n }\n}", "function updateAnimation() {\n drawCanvas();\n puckCollision();\n if (goalScored()) {\n resetPuck();\n resetStrikers();\n }\n moveCPUStriker();\n seconds = seconds - (16 / 1000);\n // as long as there is time remaining, don't stop\n if (seconds > 0) {\n document.getElementById(\"time\").innerHTML = Math.round(seconds, 2);\n } else {\n // if less than 3 periods have elapsed, do the following\n if (periodNum < 3) {\n nextPeriod();\n } else {\n stopAnimation();\n }\n }\n }", "animate () {\n this.x -= this.speed * 5;\n if (this.x < -this.groundImage.width) \n this.x = 0;\n }", "function animloop(){\n\tdraw();\n\trequestAnimFrame(animloop);\n}", "function checkYellowEnemyAnimation() {\n setInterval(function () {\n for (i = 0; i < chickens.length; i++) {\n // if (chickens[i].defeated == false) { //if alive\n let index = SmallEnemyYellowWalkingGraphicsIndex % SmallEnemyYellowWalkingGraphics.length;\n currentSmallYellowEnemyimage = SmallEnemyYellowWalkingGraphics[index];\n SmallEnemyYellowWalkingGraphicsIndex = SmallEnemyYellowWalkingGraphicsIndex + 1;\n // }\n //if (chickens[i].defeated == true) { //if defeated\n // let index = SmallEnemyDefeatedGraphicsIndex % SmallEnemyDefeatedGraphics.length;\n // currentSmallEnemyimage = SmallEnemyDefeatedGraphics[index];\n // SmallEnemyDefeatedGraphicsIndex = SmallEnemyDefeatedGraphicsIndex + 1;\n // }\n }\n }, 150);\n}", "function frame1()\n\t{\n\n\t\tTweenLite.to(over, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(eight, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.1, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(million, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.2, ease: Expo.easeOut});\t\t\n\n\t\tTweenLite.delayedCall(0.8, frame2);\n\t}", "async function myAnimantion() {\n clearInterval(timerId);\n const resp = await fetch(\"http://mumstudents.org/api/animation\", {\n method: \"GET\",\n headers: { \"Authorization\": `Bearer ${token}` }\n })\n const respBody = await resp.text();\n //console.log(respBody);\n frame = respBody.split('=====\\n');\n //console.log(frame);\n\n let count = 0;\n timerId = setInterval(function () {\n document.getElementById(\"animation\").innerHTML = frame[count];\n count++;\n if (count === frame.length) {\n count = 0;\n }\n }, 200);\n }", "function Animate() {\n\n //stop animating if requested\n if (stop_animating) return;\n \n // request another frame\n requestAnimationFrame(Animate);\n\n // calc elapsed time since last loop\n time.now = performance.now();\n time.elapsed = time.now - time.then;\n\n // if enough time has elapsed and all objects finished rendering, draw the next frame\n if ( (time.elapsed > fps_interval) && (UpdateFinished()) ) {\n\n //add this frame duration to the frame array\n fps_array.push( parseInt(1000/ (time.now - time.then) ) );\n\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fps_interval not being a multiple of user screen RAF's interval\n //(16.7ms for 60fps for example).\n time.then = time.now - (time.elapsed % fps_interval);\n\n //Draw the frame\n UpdateTimeDisplay();\n DrawFrame();\n }\n}", "function runAnimation(frameFunc)\n{\n var lastTime = null;\n function frame(time)\n {\n var stop = false;\n if (lastTime != null)\n {\n // Set a maximum frame step of 100 milliseconds to prevent\n // having big jumps\n var timeStep = Math.min(time - lastTime, 100) / 1000;\n stop = frameFunc(timeStep) === false;\n }\n\n lastTime = time;\n\n if (!stop)\n {\n requestAnimationFrame(frame);\n }\n }\n requestAnimationFrame(frame);\n}", "function playAnimWithInterval() {\n let animTag = document.getElementById(\"animTag\");\n let animationLength = animArray.length;\n let animPlayCounter = 0;\n playAnimationInterval = setInterval(() => {\n if (animationLength > 0 && animPlayCounter < animationLength) {\n animTag.innerHTML = animArray[animPlayCounter];\n animPlayCounter++;\n } else {\n animPlayCounter = 0;\n }\n }, 200);\n }", "function playSequence(computerTurn)\r\n{\r\n computerTurn.forEach((color,index)=>{\r\n setTimeout(() => {\r\n animate(color);\r\n }, (index+1)*600);\r\n });\r\n}", "getNextFrame() {\nvar f;\nf = this.fCur + 1;\nif (this.fCount <= f) {\nf = 0;\n}\nreturn this.setFrameAt(f);\n}", "function checkBossAnimation() {\n //if (boss_health > 0) {\n setInterval(function () {\n if (boss_defeated_at == 0) {\n //setInterval(function () {\n let index = bossWalkingGraphicsIndex % bossWalkingGraphics.length;\n currentBossImage = bossWalkingGraphics[index];\n bossWalkingGraphicsIndex = bossWalkingGraphicsIndex + 1;\n //}, 100);\n }\n if (boss_health <= 0) {\n //if (boss_defeated_at > 0) {\n // setInterval(function () {\n let index = bossDefeatedGraphicsIndex % bossDefeatedGraphics.length;\n currentBossImage = bossDefeatedGraphics[index];\n bossDefeatedGraphicsIndex = bossDefeatedGraphicsIndex + 1;\n //}, 100);\n }\n }, 100);\n}", "onNextFrame(dt) {\n if (this.movingLeft) {\n this.x = this.x - (this.speed * dt)\n if (this.x < 0) {\n this.movingLeft = false\n }\n } else {\n this.x = this.x + (this.speed * dt)\n if (this.x >= (globals.CANVAS_WIDTH - this.width)) {\n this.movingLeft = true\n }\n }\n }", "function loop0() {\r\n\r\n\t $('.superhero').animate({\r\n\t \t'right': 100+'%',\r\n\t \t'top': 25+'%'\r\n\t // Animation time in seconds\r\n\t }, 30000, function() {\r\n \t\t\t$(this).animate({\r\n\t\t\t\t'right': 15+'%',\r\n\t\t\t\t'top': '-'+width0\r\n \t\t\t}, 0, 'linear', function() {\r\n \t\t\t\tloop0();\r\n \t\t\t}, 0);\r\n \t\t});\r\n\t}", "function fireNextFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToNextFrame();\n }", "function fireNextFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToNextFrame();\n }", "addAnimation(anims,timeBetween = 1, loop = true){\n var animArr = []\n for (var i = 0; i < anims.length; i++){\n animArr[i] = new Image(this.width, this.height)\n animArr[i].src = anims[i]\n animArr[i].width = this.width\n animArr[i].height = this.height\n }\n\n this.animIndex = 0\n this.animsArray[this.numberOfAnimations] = animArr\n this.numberOfAnimations++;\n if (this.animsArray.length === 1){\n this.anims = animArr;\n this.timeBetweenAnim = timeBetween\n setInterval(function(){\n this.image = this.anims[this.animIndex];\n this.animIndex++;\n if (this.animIndex >=this.anims.length){\n this.animIndex =0\n }\n }.bind(this), this.timeBetweenAnim)\n }\n }", "function start(){\n\tsetInterval(animationLoop, 33);\n}", "function schedule_frames_at_top_speed() {\n if (g_pending_frames < 10) {\n requestFrame();\n }\n window.setTimeout(schedule_frames_at_top_speed, 1);\n}" ]
[ "0.7321077", "0.69107866", "0.6903336", "0.689462", "0.6847129", "0.68330157", "0.6783298", "0.6773496", "0.6739243", "0.67279994", "0.66336834", "0.6625943", "0.65799457", "0.6579243", "0.6539542", "0.65038145", "0.64870876", "0.6486413", "0.64746475", "0.6471799", "0.64579535", "0.6412525", "0.63884103", "0.63782716", "0.63723063", "0.63685787", "0.6346874", "0.6337067", "0.6332989", "0.63211715", "0.6320631", "0.63198894", "0.6311614", "0.63095033", "0.6283592", "0.62736297", "0.6267919", "0.6262139", "0.6246342", "0.6239603", "0.62292635", "0.6222028", "0.62034243", "0.6202946", "0.6187165", "0.61863905", "0.61862576", "0.6183257", "0.6180454", "0.61652386", "0.6131643", "0.6130787", "0.61264473", "0.6115562", "0.6098053", "0.6097002", "0.60944843", "0.60885155", "0.6082113", "0.6069804", "0.60603976", "0.605744", "0.60541815", "0.6050366", "0.60436", "0.6028035", "0.6026861", "0.6017885", "0.6011478", "0.60111934", "0.5994097", "0.59893274", "0.5978344", "0.59749806", "0.59681714", "0.5961327", "0.5958243", "0.59496707", "0.59491944", "0.5944981", "0.59417564", "0.5940291", "0.59355265", "0.5930821", "0.59263855", "0.5925412", "0.592101", "0.5916875", "0.5912766", "0.5908699", "0.5907291", "0.59049493", "0.59014654", "0.5896785", "0.5895315", "0.5892697", "0.5892697", "0.58882356", "0.58870196", "0.58869547" ]
0.7823296
0
checking to see if the projectile is "alive" and making it dead after a certain amount of time
checkAlive(){ if (this.lifeTime > 1000){ this.alive = false; this.lifeTime = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function invincibilityAfterDamage() {\n timeoutInvincible = true;\n setTimeout(function () {\n timeoutInvincible = false;\n }, INVINCIBILITY_DURATION_AFTER_HIT);\n\n}", "function PlayerHandling()\n{\n //Moves the player\n PlayerMovementExecute();\n \n //Creates a projectile if the timer is equal to 0\n intFramesLeftBeforeFiring--;\n if(intFramesLeftBeforeFiring == 0)\n {\n CreateNewProjectile(intPlayery + 0.5 * objPlayerSprite.height - 0.5 * objDefaultProjectileSprite.height);\n intFramesLeftBeforeFiring = intFireRate;\n }\n}", "function drop() {\nif(move(down)==false){\nif(active.pivot.r < 1) {\n setTimeout(gameEnd,100);\n }\n checkLines();\n setTimeout(spawnPiece,100);\n\n}\n}", "checkDeath() {\n if(this.lives <= 0) {\n this.isDead = true;\n }\n }", "function shoot() {\n\tif (bulletDelay < 0) {\n\t\tprojectiles.push({\n\t\t\tx: player.x + (player.width / 2) - scrollDistance,\n\t\t\ty: player.y + (player.height / 2) - (coinSize / 2)\n\t\t})\n\t\tbulletDelay = 30;\n\t}\n}", "dealDamage() {\n let d = dist(this.x, this.y, player.x, player.y);\n if (\n d < this.size / 2 &&\n this.mapX === player.mapX &&\n this.mapY === player.mapY\n ) {\n // if the player touches the projectile, deal damage to them and destroy the projectile to prevent repeating damage\n player.healthTarget -= this.damage;\n sounds.spiritHit.play();\n this.die();\n }\n }", "function pilltaken(ghost) {\n ghost.bias = 2\n gridSquare[ghost.ghostIndex].classList.remove('ghostDead')\n gridSquare[ghost.ghostIndex].classList.remove(ghost.ghostClass)\n gridSquare[ghost.ghostIndex].classList.add('ghostFlee')\n for( let i=0; i<16; i++) {\n clearInterval(caughtIdOne)\n clearInterval(caughtIdTwo)\n clearInterval(caughtIdThree)\n clearInterval(caughtIdFour)\n }\n // this reverses the ghosts direction once Pman has taken the pills\n ghost.lastDirection = -ghost.lastDirection\n gridSquare[ghost.ghostIndex].classList.remove('ghostFlee')\n ghost.ghostIndex = ghost.ghostIndex - ghost.directionMove\n gridSquare[ghost.ghostIndex].classList.add('ghostFlee')\n const pacKillIdOne = setInterval(function(){\n pacKill(ghostOne)\n }, 60)\n const pacKillIdTwo = setInterval(function(){\n pacKill(ghostTwo)\n }, 60)\n const pacKillIdThree = setInterval(function(){\n pacKill(ghostThree)\n }, 60)\n const pacKillIdFour = setInterval(function(){\n pacKill(ghostFour)\n }, 60)\n setTimeout(function(){\n for( let i=0; i<4; i++) {\n clearInterval(pacKillIdOne)\n clearInterval(pacKillIdTwo)\n clearInterval(pacKillIdThree)\n clearInterval(pacKillIdFour)\n }\n pillWareoff(ghost)\n }, pilltime)\n }", "queueLife() {\n if (this.alpha < 1) {\n setTimeout(() => {\n this.alpha += 0.1;\n this.queueLife();\n }, this.delay);\n } else {\n this.dead = false;\n this.queueDeath();\n }\n }", "projectile(enemy) {\n this.vx = this.speed * cos(this.angle);\n this.vy = this.speed * sin(this.angle);\n\n this.x += this.vx;\n this.y += this.vy;\n\n if (this.x > width) {\n this.active = false;\n } else if (this.y > height) {\n this.active = false;\n }\n\n //Gray round projectile\n fill(75);\n ellipse(this.x, this.y, this.size);\n\n if (this.fired) {\n ellipse(this.x, this.y, this.size);\n }\n }", "function iShoot(enemy) {\r\n enemy.classList.add('dead');\r\n if(!livingEnemies().length) {\r\n setTimeout(() => {\r\n document.querySelector('#victory').style.display = 'inline'\r\n }, 1000);\r\n } \r\n}", "function createProjectile() {\n\n if (!GAME_PAUSED){\n\n var projectileDivStr = \"<div id='a-\" + projectileIdx + \"' class='projectile'></div>\"\n // Add the snowball to the screen\n gwhGame.append(projectileDivStr);\n // Create and projectile handle based on newest index\n var $curProjectile = $('#a-'+projectileIdx);\n\n projectileIdx++; // update the index to maintain uniqueness next time\n\n var projectileEnemyID = Math.floor(Math.random() * NUM_ENEMIES);\n $curProjectile.css('width', PROJECTILE_SIZE+\"px\");\n $curProjectile.css('height', PROJECTILE_SIZE+\"px\");\n\n if(Math.random() < 1/3){\n $curProjectile.append(\"<img src='img/blueBook.png' height='\" + PROJECTILE_SIZE + \"'/>\")\n } else if(Math.random() < 2/3) {\n $curProjectile.append(\"<img src='img/icicle.png' height='\" + PROJECTILE_SIZE + \"'/>\")\n } else {\n $curProjectile.append(\"<img src='img/glasses.png' height='\" + PROJECTILE_SIZE + \"'/>\")\n }\n\n var index = 0\n let startingPositionLeft;\n let startingPositionBottom;\n $('.enemy').each( function() {\n var $curEnemy = $(this);\n if(index === projectileEnemyID){\n startingPositionLeft = parseInt($curEnemy.css('left')) + parseInt($curEnemy.css('width'))/2.5\n startingPositionBottom = parseInt($curEnemy.css('top')) + parseInt($curEnemy.css('height'))\n }\n index++\n });\n\n $curProjectile.css('left', startingPositionLeft+\"px\");\n $curProjectile.css('top', startingPositionBottom+\"px\");\n\n // Make the projectiles fall towards the bottom\n setInterval( function() {\n $curProjectile.css('top', parseInt($curProjectile.css('top'))+PROJECTILE_SPEED);\n // Check to see if the projectile has left the game/viewing window\n if (parseInt($curProjectile.css('top')) > (gwhGame.height() - $curProjectile.height())) {\n $curProjectile.remove();\n }\n }, OBJECT_REFRESH_RATE);\n }\n\n}", "function checkCollisionGhost(enemy) {\n \n if (player.x <= (enemy.x + 26) && enemy.x <= (player.x + 26) && player.y <= (enemy.y + 26) && enemy.y <= (player.y + 32) && enemy.alive ) { \n \n if (powerdot.ghosteat) {\n score = score + enemy.points;\n enemy.alive = false;\n console.log(\"you hit \" + enemy.name + \" for \" + enemy2.points + \" points!\");\n } else {\n \n //pause ghost movement fade out ghost while the death animation displays \n pacalive = false;\n enemy.alive = false;\n \n //display death animation \n setTimeout(function () { player.pacmouth = 160, player.pacdir = 0 }, 50);\n setTimeout(function () { player.pacmouth = 192 }, 100);\n setTimeout(function () { player.pacmouth = 224 }, 200);\n setTimeout(function () { player.pacdir = 0 }, 400);\n setTimeout(function () { player.pacdir = 32 }, 600);\n setTimeout(function () { player.pacdir = 64 }, 800);\n setTimeout(function () { player.pacdir = 96 }, 1000);\n setTimeout(function () { player.pacmouth = 256, player.pacdir = 0 }, 1050);\n setTimeout(function () { player.pacdir = 32 }, 1200);\n setTimeout(function () { player.pacdir = 64 }, 1400);\n setTimeout(function () { player.pacdir = 96 }, 1800);\n setTimeout(function () { player.pacdir = 96 }, 2000);\n setTimeout(function () { player.pacmouth = 288, player.pacdir = 0 }, 2050);\n setTimeout(function () { player.pacdir = 32 }, 2400);\n setTimeout(function () { player.pacdir = 64 }, 2600);\n setTimeout(function () { player.pacdir = 96 }, 2800);\n setTimeout(function () { player.pacdir = 96 }, 3000);\n setTimeout(function () { player.pacmouth = 160 }, 3600);\n setTimeout(function () { life-- }, 3650);\n setTimeout(function () { player.x = 280, player.y = 400, pacalive = true, enemy.alive = true }, 3700);\n //set enemy positions to default \n enemy.x = 230;\n enemy.y = 120;\n enemy2.x = 400;\n enemy2.y = 120;\n enemy3.x = 130;\n enemy3.y = 120;\n enemy4.x = 180;\n enemy4.y = 120;\n }\n\n //reset power dot counter \n powerdot.pcountdown = 0;\n\n }\n}", "function C007_LunchBreak_Natalie_Ungag() {\r\n CurrentTime = CurrentTime + 60000;\r\n ActorRemoveInventory(\"TapeGag\");\r\n if (ActorHasInventory(\"Ballgag\")) {\r\n ActorRemoveInventory(\"Ballgag\");\r\n PlayerAddInventory(\"Ballgag\", 1);\r\n }\r\n if (ActorHasInventory(\"ClothGag\")) {\r\n ActorRemoveInventory(\"ClothGag\");\r\n PlayerAddInventory(\"ClothGag\", 1);\r\n }\r\n C007_LunchBreak_Natalie_IsGagged = false;\r\n C007_LunchBreak_Natalie_TimeLimit()\r\n}", "function bullet(){\n var b = false;\n for(i = 1; i < bulletTrav.length; i++){\n rect(bulletTrav[i].x, bulletTrav[i].y + bulletTrav[i].speed, 10, 10);\n bulletTrav[i].y = bulletTrav[i].y + bulletTrav[i].speed;\n if(dist(bulletTrav[i].x, bulletTrav[i].y, targetRem[0].circX, targetRem[0].circY) < 50){\n console.log(\"hit\");\n //a = 9000;\n b = true;\n explosion();\n circSetup();\n crash();\n victory();\n \n }else{\n b = false;\n }\n }\n circReset.push(b);\n}", "function Update () {\r\n bomb_life -= Time.deltaTime;\r\n\r\n if(bomb_life <= 0){\r\n Explode();\r\n }\r\n\t}", "function hit() {\n\t//Do nothing if player is invincible\n\tif (invincible || !alive) return;\n\n\tif (!started) {\n\t\tif (player.body.y > height) {\n\t\t\t//Place him on the platform\n\t\t\tplayer.setPosition(width / 2, height - height * 0.5);\n\n\t\t\tif (multiplayer) {\n\t\t\t\tmqttClient.publish(\n\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\tstatus: 'respawn'\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\thealth--;\n\n\t/**\n\t * If player is about to die\n\t */\n\tif (health === 0) {\n\t\t//Remove the last heart\n\t\thealthObjects[0].classList.add('c-game-overlay__heart--dead');\n\t\tdie();\n\n\t\t/**\n\t\t * If player is not about to die\n\t\t */\n\t} else {\n\t\t//Remove heart\n\t\thealthObjects[health].classList.add('c-game-overlay__heart--dead');\n\n\t\t/**\n\t\t * If player fell of the platform\n\t\t */\n\t\tif (player.body.y > height) {\n\t\t\t//Place him on the platform\n\t\t\tplayer.setPosition(width / 2, height - height * 0.5);\n\n\t\t\t//Set invincible\n\t\t\tinvincible = true;\n\n\t\t\t//If multiplayer send respawn status\n\t\t\tif (multiplayer) {\n\t\t\t\tmqttClient.publish(\n\t\t\t\t\t`afloat/lobby/${lobbyId}/game`,\n\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\tclientId: clientId,\n\t\t\t\t\t\tstatus: 'respawn'\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t\t//Remove invicibility after 2.25 seconds\n\t\t\tsetTimeout(() => {\n\t\t\t\t(invincible = false), (gracePeriodAlpha = false);\n\t\t\t\tplayer.alpha = 1;\n\t\t\t}, 2250);\n\n\t\t\t/**\n\t\t\t * If player got hit by an object\n\t\t\t */\n\t\t} else {\n\t\t\t//Set invincible\n\t\t\tinvincible = true;\n\n\t\t\t//Remove invincibility after 1 second\n\t\t\tsetTimeout(() => {\n\t\t\t\t(invincible = false), (gracePeriodAlpha = false);\n\t\t\t\tplayer.alpha = 1;\n\t\t\t}, 1500);\n\t\t}\n\t}\n}", "queueDeath() {\n if (this.alpha > 0) {\n setTimeout(() => {\n this.alpha -= 0.1;\n this.queueDeath();\n }, this.delay);\n } else {\n this.dead = true;\n this.inversion = Math.random() <= 0.5 ? -1 : 1;\n this.inversion2 = Math.random() <= 0.5 ? -1 : 1;\n this.Xpos =\n this.canvasX + Math.random() * (this.canvasX - 200) * this.inversion;\n this.Ypos =\n this.canvasY + Math.random() * (this.canvasY - 100) * this.inversion2;\n this.blueTint = Math.random() * 100;\n this.greenTint = Math.random() * 50;\n this.queueLife();\n }\n }", "isDead() {\n if (this.lifespan < 0.0) {\n return true;\n } else {\n return false;\n }\n }", "collide() {\n this.state = 'dead';\n this.lives--;\n setTimeout(() => this.state = 'alive', 2000);\n }", "boolean isDead() {\n if (center.x > width || center.x < 0 || \n center.y > height || center.y < 0 || lifespan < 0) {\n return true;\n } \n else {\n return false;\n }\n }", "function peep(){\n const time = randomTime(200,1000);\n const hole = randomHole(holes);\n hole.classList.add('up');\n // after the set time remove the class\n setTimeout(()=>{\n hole.classList.remove('up');\n // if total time is not up (10s) then rerun peep ,otherwise exit\n if(!timeUp){\n peep();\n } \n },time);\n}", "function dead(){\n if (appleY > height){\n state = \"end\";\n }\n else if (millis() > lastTimeSwitched + gametime){\n state = \"end\";\n }\n}", "function checkWaterCollisions(focusObject){\r\n \r\n waterTimer++;\r\n \r\n if(mapGrid[focusObject.y/50][focusObject.x/50] == 5 && focusObject.moveWithGrate == false ){\r\n console.log(\"testing water function\");\r\n focusObject.health -= 1;\r\n waterTimer = 0;\r\n //return false;\r\n }\r\n \r\n //return false;\r\n}", "eggTimer() {\n this.isDead = true\n cells[this.position].classList.remove(this.classname)\n cells[this.position].classList.remove(this.classname)\n cells[337].classList.add('egg')\n setTimeout(() => {\n cells[337].classList.remove('egg')\n this.position = 337\n cells[this.position].classList.add(this.classname)\n this.isDead = false\n }, 6000)\n }", "punch(ninja){\n // Confirm that ninja is an instance of Ninja class.\n if(!(ninja instanceof Ninja) || (typeof ninja.health !== 'number')){\n return false;\n }\n\n // Decrement the ninjas health by 5.\n ninja.health -= 5;\n\n // TODO: Think about returning the new health value instead of true\n return true;\n }", "function EquipedExplosiveMissilesTag() {\n\tthis.timer = 60 * 30; // 30 seconds of explosive missiles\n}", "function createProjectile(){\n //projectile vars\n var projectileX;\n var projectileY;\n var projectileRadius = Math.random() * (10 - 3) + 3; \n var projectileVelocityX;\n var projectileVelocityY;\n\n //place the projectile at the same angle as the player and give it proper velocities\n projectileX = playerX + (Math.random() * (10 + 10) -10) + Math.cos(playerRotation * Math.PI / 180) * playerRadius;\n projectileY = playerY + (Math.random() * (10 + 10) -10) + Math.sin(playerRotation * Math.PI / 180) * playerRadius;\n projectileVelocityX = projectileSpeed * Math.cos(playerRotation * Math.PI / 180);\n projectileVelocityY = projectileSpeed * Math.sin(playerRotation * Math.PI / 180);\n\n\n //make sure the the placed projectile is not overlapping any others, get them to spread down and \"surround the fish\"\n for(i = 0; i < projectiles.length; i++){\n if(computeDistanceBetweenCircles(projectileRadius, projectileX, projectileY, projectiles[i].r, projectiles[i].x, projectiles[i].y) < projectileRadius + projectiles[i].r){\n while(computeDistanceBetweenCircles(projectileRadius, projectileX, projectileY, projectiles[i].r, projectiles[i].x, projectiles[i].y) < projectileRadius + projectiles[i].r){\n var cordToChange = Math.round(Math.random());\n if(cordToChange == 0){\n projectileX -= 1;\n }else{\n projectileY -= 1;\n }\n } \n }\n }\n\n //add projectile to projectile array\n projectiles.push({x: projectileX, y:projectileY, r: projectileRadius, dx: projectileVelocityX, dy: projectileVelocityY, type: \"water\"});\n}", "function ghostRelease() {\n for (var x = 0; x <= 3; x++) {\n if (ghost[x].active == 0) {\n ghost[x].y = (door.y - 1);\n ghost[x].x = door.x\n ghost[x].active = 1;\n break;\n }\n }\n if (pacMan.lives > 0) {\n setTimeout(ghostRelease, 5000);\n }\n}", "isDead(){\n return this.lives < 1;\n }", "function launch(){\n gamePlay = false;\n weapon = curPlayer.getweapon();\n var t = 0;\n var x = curPlayer.getnx();\n var y = curPlayer.getny();\n var clear = false;\n var ani = setInterval(function(){projectile()}, 10);\n\n function projectile(){\n if(gamePaused== false){\n t+=1;\n redraw();\n if(y<terrainY[Math.round(x)] && x<=width && x>=0&&clear==false){\n x = curPlayer.getnx() + weapons[weapon][1]*Math.cos(curPlayer.angle())*curPlayer.getpower()*t/100;//percentage of power\n y = curPlayer.getny() - weapons[weapon][1]*Math.sin(curPlayer.angle())*curPlayer.getpower()*t/100 + (0.5*gravity)*(t*t);\n circle(ctx, x, y,weapons[weapon][0],weapons[weapon][2]);\n clear = checkDirectHit(x,y,otherPlayer);\n }\n else \n if((y>terrainY[Math.round(x)] || x>width || x<0) && clear ==false){\n explode(x,y,weapons[weapon][0]*2,otherPlayer);\n clear = true;\n }\n }\n \n if(clear==true){\n clearInterval(ani);\n if(curPlayer.getplayer()==1){\n curPlayer = tank2;\n otherPlayer = tank1;\n }\n else{\n curPlayer = tank1;\n otherPlayer = tank2; \n }\n gamePlay=true;\n ++rally;\n if(rally%2==0 && rally!=0)++volley;\n \n redraw();\n }\n }\n}", "dies() {\n\t\tif(this.currentPet.hunger === 10 || this.currentPet.sleepiness === 10 || this.currentPet.boredom === 10){\n\t\t\tthis.stopTimer()\n\t\t\tthis.deadPetImage()\n\t\t\tthis.deadFadeOut()\n\t\t\tconsole.log('activated');\n\t\t};\n\t}", "function checkForInjured() {\n /* setInterval(function () {\n if (timeoutInvincible && PlayerLastDirection == 'right') {\n let index = characterGraphicsHurtIndex % characterGraphicsHurtRight.length;\n currentCharacterImage = characterGraphicsHurtRight[index];\n characterGraphicsHurtIndex = characterGraphicsHurtIndex + 1;\n }\n if (timeoutInvincible && PlayerLastDirection == 'left') {\n let index = characterGraphicsHurtIndex % characterGraphicsHurtLeft.length;\n currentCharacterImage = characterGraphicsHurtLeft[index];\n characterGraphicsHurtIndex = characterGraphicsHurtIndex + 1;\n }\n },50);*/\n}", "function moveMissile() {\n squares[missilePosition].classList.remove('missile')\n missilePosition -= width\n // console.log(missilePosition)\n if (missilePosition <= 0) {\n clearInterval(missileMoveTimer)\n console.log('missile has been cleared')\n } else if (squares[missilePosition].classList.contains('enemy')) {\n console.log(`HIT ON ${missilePosition}`, squares[missilePosition])\n const hitEnemy = allEnemies.find(enemy => enemy.enemyIndex === missilePosition)\n hitEnemy.enemyCollision()\n clearInterval(missileMoveTimer)\n } else {\n squares[missilePosition].classList.add('missile')\n }\n}", "function isHit() {\n termElem.src = 'img/termhit-sm.png';\n setTimeout(function() { \n if(player.health <= 0){\n termElem.src = 'img/boom-sm.png'\n }else{\n termElem.src = 'img/term.png' \n }}, 100)\n}", "function bombCheck() {\n\tif (x==1 && y==2 || x==18 && y==3 || x==18 && y==9 || x==13 && y==2 || x==3 && y==7 || x==14 && y==6 || x==17 && y==7) {\n\t\tconst position = getPosition();\n\t\tposition.append(bombImg);\n\t\talert('You hit the bomb!')\n\t\thealth -= 10;\n\t}\n}", "function peep() {\n //get random time\n const time = randomTime(200, 1000);\n //random hole\n const hole = randomHole(holes);\n //add class to that hole\n hole.classList.add('up');\n\n //set time out to remove class afte time has passed\n setTimeout(() => {\n hole.classList.remove('up');\n //run again after time has passed\n if (!timeUp) peep();\n }, time)\n}", "ReachWater()\n {\n if ( this.x > 0 && \n this.x <= 750 && \n this.y > 50 && \n this.y < 100 )\n {\n setTimeout(()=>{\n alert(\"Awesome, You Win! \\n Play it again!\")\n },1000);\n if ( ReachThewater === false)\n {\n NofLives = NofLives +1;\n }\n ReachThewater = true;\n setTimeout(()=>{\n this.ResetGame()\n },1000);\n } \n}", "function bugTimeRand(){\n var p = Math.random();\n // p > 0.5; spawn at current second\n if ((p > 0.5) || (miss == 1)){\n miss = 0;\n return true;\n } else { //p < 0.5, do not spawn; add 0.5 to miss.\n miss += 0.5;\n return false;\n }\n}", "function peep() {\n const time = randTime(vitMin, vitMax);\n const hole = randHole(holes);\n hole.classList.add(\"up\");\n //console.log(\"peep\", time, hole);\n setTimeout(() => {\n let vieBoard = document.querySelector(\".vie\");\n let thend = document.querySelector(\".thend\");\n if (hole.classList.contains(\"up\")) {\n Bump.play();\n vie = vie - 1;\n vieBoard.innerHTML = vie;\n }\n hole.classList.remove(\"up\");\n\n if (vie < 0) {\n endSound.play();\n vieBoard.innerHTML = \"Game Over\";\n thend.style.top = \"-90%\";\n return;\n }\n //console.log(vie);\n if (!timeUp) peep();\n }, time);\n}", "update(){\n this.spawnerTime -= 1000;\n if(this.spawnerTime <= 0){\n this.spawner.spawnProjectiles();\n this.obstacles = this.spawner.obstacles;\n this.spawner.clearObstacles();\n this.spawnerTime = this.spawner.spawnTime;\n }\n }", "function creatureDeathCheck() {\n if (creature.hp < 0) {\n creature.hp = 0;\n enemyHp.innerText = creature.name + ' hit points: ' + creature.hp;\n newMessage(player.name + ' has slain the ' + creature.name + '.');\n kills += 1;\n slain.innerText = 'Enemies slain: ' + kills;\n if (player.itemsBelt.length < 3) {\n itemDrop(creature);\n } else {\n player.itemsBelt = player.itemsBelt;\n }\n newEnemy();\n } else {\n creature.hp = creature.hp;\n }\n}", "function pacKill(ghost){\n console.log('can pac kill')\n for( let i=0; i<16; i++) {\n clearInterval(caughtIdOne)\n clearInterval(caughtIdTwo)\n clearInterval(caughtIdThree)\n clearInterval(caughtIdFour)\n }\n // so pacMan can kill ghost\n if(gridSquare[pacIndex] === gridSquare[ghost.ghostIndex]) {\n scoreNumber = scoreNumber + 200\n infoBox.innerHTML = 'Ghost \\n +200 Points'\n gridSquare[ghost.ghostIndex].classList.remove('ghostFlee')\n gridSquare[ghost.ghostIndex].classList.remove(ghost.ghostClass)\n gridSquare[ghost.ghostIndex].classList.remove('ghostDead')\n ghost.lastDirection = -ghost.lastDirection\n gridSquare[ghost.ghostIndex].classList.remove('ghostDead')\n ghost.ghostIndex = ghost.ghostIndex - ghost.directionMove\n gridSquare[ghost.ghostIndex].classList.add('ghostDead')\n ghost.bias = 3\n }\n }", "function hitBomb(player, bomb)\n{\n //game pauses\n this.physics.pause();\n //player turns red as if dead\n player.setTint(0xff0000);\n //last image of player when dead is the turn animation\n player.anims.play('turn');\n //gameOver is true as a result\n gameOver = true;\n}", "isDead() {\n return this.hp <= 0;\n }", "function checkCollision() {\n if (hasShot == true) {\n $(\"#playerProjectile\").css(\"top\", parseInt($(\"#playerProjectile\").css(\"top\").replace(\"px\",\"\"))-10);\n if ($(\"#playerProjectile\").offset().top <= $(\"#main\").offset().top) {\n // The projectile reaches the screen's top\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n hasShot = false;\n }\n else if ( !((($(\"#playerProjectile\").offset().top + $(\"#playerProjectile\").height()) < ($(\"#enemyShipSkills\").offset().top)) ||\n ($(\"#playerProjectile\").offset().top > ($(\"#enemyShipSkills\").offset().top + $(\"#enemyShipSkills\").height())) ||\n (($(\"#playerProjectile\").offset().left + $(\"#playerProjectile\").width()) < $(\"#enemyShipSkills\").offset().left) ||\n ($(\"#playerProjectile\").offset().left > ($(\"#enemyShipSkills\").offset().left + $(\"#enemyShipSkills\").width())))) {\n // the projectile hits the skills enemy. Good job, you just ruined someone's talents.\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n $(\"#explosion\").css(\"top\", $(\"#enemyShipSkills\").offset().top - 25);\n $(\"#explosion\").css(\"left\", $(\"#enemyShipSkills\").offset().left - 10);\n $(\"#explosion\").attr(\"src\",\"\");\n $(\"#enemyShipSkills\").css(\"display\",\"none\");\n $(\"#explosion\").attr(\"src\",\"img/ship/cv_enemy_explosion.gif\");\n hasShot = false;\n showSkills();\n }\n else if ( !((($(\"#playerProjectile\").offset().top + $(\"#playerProjectile\").height()) < ($(\"#enemyShipExperience\").offset().top)) ||\n ($(\"#playerProjectile\").offset().top > ($(\"#enemyShipExperience\").offset().top + $(\"#enemyShipExperience\").height())) ||\n (($(\"#playerProjectile\").offset().left + $(\"#playerProjectile\").width()) < $(\"#enemyShipExperience\").offset().left) ||\n ($(\"#playerProjectile\").offset().left > ($(\"#enemyShipExperience\").offset().left + $(\"#enemyShipExperience\").width())))) {\n // the projectile hits the experience's enemy. Good job, you just ruined someone's history.\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n $(\"#explosion\").css(\"top\", $(\"#enemyShipExperience\").offset().top - 25);\n $(\"#explosion\").css(\"left\", $(\"#enemyShipExperience\").offset().left - 10);\n $(\"#explosion\").attr(\"src\",\"\");\n $(\"#enemyShipExperience\").css(\"display\",\"none\");\n $(\"#explosion\").attr(\"src\",\"img/ship/cv_enemy_explosion.gif\");\n hasShot = false;\n showExperience();\n }\n else if ( !((($(\"#playerProjectile\").offset().top + $(\"#playerProjectile\").height()) < ($(\"#enemyShipFormation\").offset().top)) ||\n ($(\"#playerProjectile\").offset().top > ($(\"#enemyShipFormation\").offset().top + $(\"#enemyShipFormation\").height())) ||\n (($(\"#playerProjectile\").offset().left + $(\"#playerProjectile\").width()) < $(\"#enemyShipFormation\").offset().left) ||\n ($(\"#playerProjectile\").offset().left > ($(\"#enemyShipFormation\").offset().left + $(\"#enemyShipFormation\").width())))) {\n // the projectile hits the formation's enemy. Good job, you just ruined someone's studies.\n $(\"#playerProjectile\").css(\"display\", \"none\");\n $(\"#playerProjectile\").css(\"top\", \"0\");\n $(\"#explosion\").css(\"top\", $(\"#enemyShipFormation\").offset().top - 25);\n $(\"#explosion\").css(\"left\", $(\"#enemyShipFormation\").offset().left - 10);\n $(\"#explosion\").attr(\"src\",\"\");\n $(\"#enemyShipFormation\").css(\"display\",\"none\");\n $(\"#explosion\").attr(\"src\",\"img/ship/cv_enemy_explosion.gif\");\n hasShot = false;\n showFormation();\n }\n }\n}", "function C007_LunchBreak_Natalie_Untie() {\r\n if (ActorHasInventory(\"Rope\")) {\r\n CurrentTime = CurrentTime + 120000;\r\n ActorRemoveInventory(\"Rope\");\r\n PlayerAddInventory(\"Rope\", 1);\r\n if (C007_LunchBreak_Natalie_TwoRopes) {\r\n CurrentTime = CurrentTime + 120000;\r\n PlayerAddInventory(\"Rope\", 1);\r\n C007_LunchBreak_Natalie_TwoRopes = false;\r\n }\r\n C007_LunchBreak_Natalie_IsRoped = false;\r\n }\r\n C007_LunchBreak_Natalie_TimeLimit()\r\n}", "function drop() {\r\n // Get current timestamp\r\n let now = Date.now();\r\n // Calculate amount of time between this timestamnp and last one\r\n let delta = now - dropStart;\r\n\r\n // If more than 1000ms have passed\r\n if (delta > 1000) {\r\n // Move piece down one row\r\n p.moveDown();\r\n // Set timestamp to current time\r\n dropStart = Date.now();\r\n }\r\n // Request animation frames until gameOver flag is set to true\r\n if (!gameOver) {\r\n requestAnimationFrame(drop);\r\n }\r\n}", "function Shoot()\n{\n\t//go through projectiles and find one that isn't in play\n\tfor (var i = 0; i < projectiles.length; i++)\n\t{\n\t\tif (!projectiles[i].GetComponent(W2BossProjectileController).OnScreen)\n\t\t{\n\t\t\t//pull into play\n\t\t\tprojectiles[i].GetComponent(W2BossProjectileController).move = this.transform.forward * ProjectileSpeed * -1;\n\t\t\tprojectiles[i].transform.position = this.transform.position + (projectiles[i].GetComponent(W2BossProjectileController).move);\n//\t\t\tprojectiles[i].tag = \"Untagged\";\n\t\t\treturn; //break out of the loop\n\t\t}\n\t}\n}", "function updateProjectile(proj, timeDelta) {\n if (proj.type == BULLET_TYPE) {\n var timeSinceSpawn = (Date.now() - proj.spawnTime) / 1000;\n\n // We start i at 1, because if this gets run in the same millisecond that the bullet\n // spawn, the loop guard will fail on the first iteration, and i will stay set to 0,\n // which will cause `proj.path[i - 1]` after the loop to access the -1st element of\n // proj.path, which is undefined and will cause a crash.\n var i = 1;\n while (proj.path[i].time < timeSinceSpawn) {\n i += 1;\n\n // We do the 'has the bullet despawned' here, rather than as an if statement earlier,\n // because sometimes (very rarely), a millisecond will tick over between the if\n // statement evaluating Date.now() and the calculation of timeSinceSpawn and this will\n // leave i being equal to the length of the array, which will cause a crash when access\n // of that array element is attempted.\n if (i == proj.path.length) {\n return true;\n }\n }\n\n var lerpFactor = inverseLerp(proj.path[i - 1].time, proj.path[i].time, timeSinceSpawn);\n var vec = vecLerp(\n new Vec2(proj.path[i - 1].x, proj.path[i - 1].y),\n new Vec2(proj.path[i].x, proj.path[i].y),\n lerpFactor\n );\n\n proj.x = vec.x;\n proj.y = vec.y;\n\n return false;\n } else {\n console.error(\"Unknown projectile type \" + proj.type);\n\n return false;\n }\n}", "checkIfCharacterIsDead() {\n if (this.character.dead) {\n this.endBoss.killedCharacter = true;\n }\n }", "kill() {\n this.dead = true;\n }", "function checkForDead() {\n if (mainPlayer.checkCollision(badguy)) {\n mainPlayer.setPosition(64, 64);\n mainPlayer.speed = 0;\n }\n }", "function momBabyCollison() {\r\n if (data.fruitNum > 0 && !data.gameOver) {\r\n var l = calLength2(mom.x, mom.y, baby.x, baby.y);\r\n if (l < 900) {\r\n baby.babyBodyCount = 0;\r\n mom.momBodyCount = 0;\r\n data.addScore();\r\n halo.born(baby.x,baby.y)\r\n }\r\n }\r\n}", "function clickwalk(t) { \n arrived = true;\n if (player.x < t.x - 5){\n player.x += 10;\n arrived = false;\n }\n if (player.x > t.x + 6){\n player.x -= 10;\n arrived = false;\n }\n if (player.y < t.y - 9){\n player.y += 10;\n arrived = false;\n }\n if (player.y > t.y + 2){\n player.y -= 10;\n arrived = false;\n } \n if (arrived == true){\n clearInterval(pace);\n }\n}", "async attack(player, tile) {\n // <<-- Creer-Merge: attack -->>\n // TS thinks this could be undefined despite the invalidate for some reason, so we check it again.\n if (!tile.tower) {\n return false;\n }\n tile.tower.health -= this.job.damage;\n this.acted = true;\n return true;\n // <<-- /Creer-Merge: attack -->>\n }", "function damagePin() {\n if (!pinLastDamaged || Date.now() - pinLastDamaged > pinDamageInterval) {\n var tl = new TimelineLite();\n pinHealth -= pinDamage;\n pinLastDamaged = Date.now()\n\n //pin damage/lock jiggle animation\n tl.to(pin, (pinDamageInterval / 4) / 1000, {\n rotationZ: pinRot - 2\n });\n tl.to(pin, (pinDamageInterval / 4) / 1000, {\n rotationZ: pinRot\n });\n if (pinHealth <= 0) {\n breakPin();\n }\n }\n}", "collision(enemy) {\n let subdue = dist(this.x, this.y, enemy.x, enemy.y);\n if (this.fired && enemy.active && subdue < this.size / 2 + enemy.size / 2) {\n // Kill the enemy that said bullet hit\n enemy.active = false;\n enemy.numDead++;\n }\n }", "function fireBullet() {\n\n if (game.time.now > bulletTime) {\n bullet = bullets.getFirstExists(false);\n\n if (bullet) {\n bullet.reset(player.x+50, player.y+15);\n bullet.body.velocity.x = 500;\n //This code determines how fast you can fire bullets.\n bulletTime = game.time.now + shootRate;\n enemybulletTime = game.time.now + 100;\n }\n }\n}", "function checkTime(){\n\t\n\tconst endTime = new Date().getTime() + 61000;\n\t\n\tlet interval = setInterval(()=>{\n\t\tconst now = new Date().getTime();\n\t\tif(now >= endTime){\n\t\t\tclearInterval(interval);\n\t\t\tfirebaseObj.ref().update({gameState : \"finished\"});\n\t\t}\n\t}, 1000);\n}", "function wait(timeToWait) {\n //this is invoked after the player collides with a bad object\n var now = new Date().getTime(); //get the current time\n\n while (new Date().getTime() < now + timeToWait) { //wait however long it is instructed to (1 second)\n //wait x seconds\n }\n }", "function update_Speed(){\n if (game.time.now > speedTime) {\n if (cursors.down.isDown && (projectileSpeed > MIN_BULLET_SPEED)){\n projectileSpeed = projectileSpeed -1;\n speedTime = game.time.now + 150;\n }\n if (cursors.up.isDown && (projectileSpeed < MAX_BULLET_SPEED)){\n projectileSpeed = projectileSpeed + 1;\n speedTime = game.time.now + 150;\n }\n }\n}", "hit(dmg){\n hp -= dmg;\n\n /*** The Game Over State ***/\n if(hp <= 0){\n // stop redrawing the game, spawning enemies, and firing enemyProjectiles\n clearInterval(gameInt);\n clearInterval(spawnInt);\n clearInterval(fireInt);\n\n // stop every spider's firing timer\n for (var index = 0; index < enemies.length;index++){\n enemies[index].stop();\n }\n\n // game over message\n alert(\"Game Over! Your final score is \" + score + \"! Refresh Browser to play again!\");\n }\n}", "function shootMissile(ufo) {\n\n for (var i = 0; i < 2; i++) {\n var missile = missiles.create(ufo.centerX, ufo.centerY, 'ufo_dot')\n missile.centerX = ufo.centerX\n missile.centerY = ufo.centerY\n\n game.physics.arcade.enable(missile);\n\n missile.body.mass = 5\n missile.body.maxVelocity.x = 420 // hyvä arvo, testattu \n missile.body.maxVelocity.y = 420\n\n missile.body.allowGravity = false\n\n missile.seekTime = 170\n missile.launchTime = 50\n\n missile.checkWorldBounds = true;\n missile.events.onOutOfBounds.add(possuOut, this);\n\n if (i == 0) {\n missile.body.velocity.x = -100\n\n } else if (i == 1) {\n missile.body.velocity.x = 100\n\n }\n\n }\n\n}", "function enemyBulletShooting() {\r\n\r\n if (shootingDelay <= Math.floor(Math.random() * 20) + 10) {\r\n shootingDelay = shootingDelay + 0.1;\r\n } else {\r\n drawEnemyBullet();\r\n shootingDelay = 0;\r\n }\r\n}", "function popOut(){\n //picking up random time\n const time= Math.random()*1300 +400;\n //this hole var is new and independent from above hole variable\n const hole = pickRandomHole(holes);\n //CSS will animate its child animate with class mole(.hole.up .mole) it will animate its top value from 0 to 100\n hole.classList.add('up');\n \n // this will make a mole to slice down at a random time\n setTimeout(function(){\n hole.classList.remove('up');\n //if time out is false call popout again, to show another mole at a different hole, which means if a person is able to hit the mole at a random time(calculated above) then call popout function again else end the game.\n if(!timeUp) popOut();\n }, time);\n}", "function meteorDestroyed(meteor,missile){\n\tthis.meteor = meteor;\n\tthis.missile= missile;\n\tif(this.missile.hit && p5.Vector.dist(this.missile.target,this.meteor.pos)<=this.missile.r/2+this.meteor.r/2){\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "function checkIfDead() {\n if (player.hp <= 0) {\n console.log(\"death\");\n console.log(badEnding.stuff);\n // go back to start screen\n } else {\n // return to game\n }\n}", "function kill() {\n var pl = $('#pacman').position().left;\n var pt = $('#pacman').position().top;\n\n var gl = $('#ghost').position().left;\n var gt = $('#ghost').position().top;\n\n var gl2 = $('#ghost2').position().left;\n var gt2 = $('#ghost2').position().top;\n\n var gl3 = $('#ghost3').position().left;\n var gt3 = $('#ghost3').position().top;\n\n\n var gl4 = $('#ghost4').position().left;\n var gt4 = $('#ghost4').position().top;\n\n\n if ((pl == gl)&&(pt==gt)) {\n $('#pacman').addClass('hidden');\n lives -=1;\n $('#lives').html(lives);\n } else if\n ((pl == gl2)&&(pt==gt2)) {\n $('#pacman').addClass('hidden');\n lives -=1;\n $('#lives').html(lives);\n } else if\n ((pl == gl3)&&(pt==gt3)) {\n $('#pacman').addClass('hidden');\n lives -=1;\n $('#lives').html(lives);\n } else if\n ((pl == gl4)&&(pt==gt4)) {\n $('#pacman').addClass('hidden');\n lives -=1;\n $('#lives').html(lives);\n }\n\n }", "dieScene() {\n this.time+=10\n ufo_sound.stop()\n if(this.count > 6){\n if(this.life <= 0) \n {\n push()\n fill(255)\n textSize(15)\n text('GAME OVER', 130, 130);\n pop()\n this.gameover()\n }\n\n else\n {\n this.changePlayer()\n }\n }\n if(this.time<100 &&this.count<6) {\n image(image_player_dead_1, this.position_x, this.position_y, this.width, this.height);\n }\n else if(this.time>=100&&this.count<6) {\n image(image_player_dead_2, this.position_x, this.position_y, this.width, this.height);\n }\n if(this.time>200) {\n this.time =0\n this.count++\n }\n}", "function peep(){\n const time = randomTime(20, 2000);\n const hole = randomHole(holes);\n hole.classList.add('up');\n setTimeout(() => {\n hole.classList.remove('up');\n if (!timeUp) peep();\n }, time);\n}", "checkCannonballs() {\n let currentTime = Physics.currentTime();\n this.cannonballs.forEach((cannonball) => {\n if (currentTime - cannonball.createdAt > 2000) {\n this.remove(cannonball);\n }\n });\n }", "isAlive() {\n return this.currentHitPoints > 0 && !this.completed && !this.removeMe\n }", "function attacking(){\n\tif(!this.is_attacking) \n\t\treturn;\n\n\t// la animación para el ataque\n\tthis.animations.play('attack_' + this.direction);\n\n\t// Cuando expira el tiempo del ataque, este se detiene\n\tif(game.time.elapsedSince(this.start_time_attack) > this.timeBetweenAttacks){\n\t\tthis.is_attacking = false;\n\t\tthis.attack.hitEnemy = false;\n\t\tthis.speed = this.SPEED_WALKING;\n\t}\n}", "poisonPill(){\n\t\tclearInterval(this.timer30min);\n\t\tclearInterval(this.timer1min);\n\t\tthis.comics.poisonPill();\n\t}", "function BombBoom(bomb) \n\t{\n\t\tvar explosion = document.createElement('div');\n\t\texplosion.className = 'explosion';\n\t\tdocument.body.appendChild(explosion);\n\t\texplosion.style.top = bomb.offsetTop + 'px';\n\t\texplosion.style.left = bomb.offsetLeft + 'px';\n\t\n\t\tconsole.log(\"kool222\")\n\t\tif (ElementCollide(hooman, explosion))\n\t\t{\n\t\t\tconsole.log(\"kool\")\n\t\t\thoomanHit = true; //sets player collision to true \n\t\t\thooman.classList.add('hit'); \t//plays human's animation when hit\n\t\t\tHP--; //decrease one health point\n\t\t\tlife[0].remove(); //removes life from top left of the screen\n\t\t\tif (HP == 0) //if all 3 lives are gone call die function\n\t\t\t{\n\t\t\t\tDie();\n\t\t\t} \n\t\t\tsetTimeout(function () \n\t\t\t{\n\t\t\t\thoomanHit = false; //sets player's state to normal\n\t\t\t\thooman.classList.remove('hit');\t//also removes the hit animation\n\t\t\t}, 1000);\n\t\t} \n\t\telse\n\t\t{\n\t\t\thigh.innerHTML = 'Points:' + Points;\n\t\t\tPoints = Points + 5; //if player didnt get hit increment score points\n\t\t\tPlayTime++;\t//increment play time\n\t\t}\n\t\tsetTimeout(function () \n\t\t{\n\t\t\texplosion.remove(); //explosion is removed after 100ms\n\t\t}, 100);\n\t}", "function check_time(time){ // Input the unix difference\n // Condition if it is >= to 0(+)\n if(time >= 0){\n // Deployed\n return true\n // Condition if it is < 0(-)\n }else if(time < 0){\n // Mission Complete\n return false\n // When bad things happen\n }else{\n // Yelling\n console.log(\"Play it again, Sam.\")\n }\n }", "function spawnAngrySlimes(spawnRate){\n var angryInterval = setInterval (function(){\n var position = randomCell(cells);\n position.classList.add('angry', 'sprite');\n checkGemTotal(position);\n if (timeLeft <= 0 || lives <= 0){\n clearInterval(angryInterval);\n endGame(); \n }\n else if (timeLeft >= 40 && lives > 0){\n angrySlimeAttack(100, 0.4);\n } \n else if (timeLeft >= 20 && lives > 0){\n angrySlimeAttack(200, 0.5);\n }\n else if (timeLeft > 0 && lives > 0){\n angrySlimeAttack(300, 0.6);\n }\n setTimeout(function(){\n position.classList.remove('angry', 'sprite');\n }, 1000)\n }, spawnRate) \n }", "function CheckAlive() {\n\tif(this.currentHealth <= 0) {\n\t\tDie();\n\t}\n}", "function fireProjectile() {\n const { x } = tank;\n projectiles.push(\n new Projectile(x + CANVAS_WIDTH / 2, CANVAS_HEIGHT - PADDING_TANK)\n );\n}", "function robotDead () {\n\n\t\tvar frame_num = (Math.floor((timer - robot_sprite.death_start_timer) * 0.1) % 4);\t\t\n\t\tif (frame_num < robot_sprite.explode_tex.num_frames) {\n\t\t\trobot_sprite.texture = robot_sprite.explode_tex;\n\t\t\trobot_sprite.anchor.x = 0.28;\n\t\t\trobot_sprite.anchor.y = 0.28;\n\t\t\trobot_sprite.texture.frame = new Rectangle( frame_num * 18, 0, 18, 18);\n\t\t} else {\n\t\t\tsetTimeout(removeRobot, 1, robot_sprite);\n\t\t}\n\t}", "willLikelySurvive() { \n\t\t\tlet cnt = 0;\n\n\t\t\tfor(let each of this.dna) {\n\t\t\t\tif (each === 'C' || each === 'G') {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet perc = (cnt/this.dna.length) * 100;\n\t\t\t// console.log(`percent of survival: ${perc}`);\n\n\t\t\tif (perc >= 60) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "function peep() {\n // Get a random time, passing min/max time.\n const time = randomTime(200, 1000);\n // Get a random 'hole' using all of the 'holes'.\n const hole = randomHole(holes);\n // Animate in the mole. Add a class to pop it up.\n hole.classList.add('up');\n // The time the mole spends popped up.\n setTimeout(() => {\n // Hide the mole. Remove the class that pops it up.\n hole.classList.remove('up');\n // If the time is not up, pop up another mole, peep().\n if (!timeUp) peep();\n }, time); // Duration, random 'time'.\n}", "liveOrDie() { \n if (this.isAlive && this.liveNeighborCount < 2){\n this.isAlive = false; //underpopulation\n } else if (this.isAlive && this.liveNeighborCount > 3){\n this.isAlive = false; //overpopulation\n } else if (!this.isAlive && this.liveNeighborCount === 3){\n this.isAlive = true; //reproduction\n } else if (this.isAlive && this.liveNeighborCount === 2 || this.liveNeighborCount === 3) {\n this.isAlive = true; //lives on the next generation\n }\n }", "function pacGotBusted() {\n clearCharactersFromBoard();\n clearIntervals();\n initPacman();\n initGhosts();\n stopGameMusic();\n\n playSound(caught_sound);\n\n removeLife();\n if (lives === 0){\n endGame(loseFunc);\n }\n else{\n draw();\n playGameMusic();\n // TODO: possible to add 'ready?' animation here\n setTimeout(setGameIntervals, 2200);\n }\n}", "function peep() {\n var time = randomTime(400, 1000);\n var hole = randomHole(holes);\n hole.classList.add('up');\n setTimeout(() => {\n hole.classList.remove('up');\n if (!timeUp) peep();\n }, time);\n }", "function Missile(frame, x, y, tx, ty, speed, power, spin) {\n Unit.call(this, frame, x, y);\n\n var self = this;\n\n var _tx = tx; // target's center x\n var _ty = ty; // target's center y\n\n var _speed = speed;\n var _power = power; // power\n var _spin = spin;\n\n // velocity x\n var _vx;\n\n // velocity y\n var _vy;\n\n // event for a specific time after fire\n var _timeEvent;\n\n // running time\n var _runningTime = 0;\n\n // event for a collision\n var _collisionEvent;\n\n var _timer;\n\n var _pause;\n\n\n self.getTx = function () {\n return _tx;\n };\n\n self.setTx = function (tx) {\n _tx = tx;\n };\n\n self.getTy = function () {\n return _ty;\n };\n\n self.setTy = function (ty) {\n _ty = ty;\n };\n\n self.getVx = function () {\n return _vx;\n };\n\n self.setVx = function (vx) {\n _vx = vx;\n };\n\n self.getVy = function () {\n return _vy;\n };\n\n self.setVy = function (vy) {\n _vy = vy;\n };\n\n // change target point\n self.changeTarget = function (tx, ty) {\n if (arguments.length > 1) {\n _tx = tx;\n _ty = ty;\n calcVelocity(); // update velocity\n }\n };\n\n self.getSpeed = function () {\n return _speed;\n };\n\n self.setSpeed = function (speed) {\n _speed = speed;\n\n };\n\n self.getPower = function () {\n\n return _power;\n\n };\n\n self.setPower = function (power) {\n _power = power;\n };\n\n self.getSpin = function () {\n return _spin;\n };\n\n self.setSpin = function (spin) {\n _spin = spin;\n };\n\n self.getTimeEvent = function () {\n return _timeEvent;\n };\n\n self.setTimeEvent = function (args, func) {\n func.args = args;\n _timeEvent = func;\n };\n\n self.getCollisionEvent = function () {\n return _collisionEvent;\n };\n\n self.setCollisionEvent = function (args, func) {\n func.args = args;\n _collisionEvent = func;\n };\n\n\n // stop interval and remove dome\n self.die = function () {\n\n // check It's collision an collision event exists\n if (_collisionEvent) {\n _collisionEvent(_collisionEvent.args);\n }\n\n self.setAlive(false);\n clearTimeout(_timer);\n self.removeDom();\n };\n\n // overridden\n self.pause = function () {\n _pause = true;\n clearTimeout(_timer);\n };\n\n self.resume = function () {\n _pause = false;\n run();\n };\n\n self.fire = function () {\n\n self.getDom().classList.add(\"missile\");\n self.appendDom();\n self.calcVelocity();\n run();\n };\n\n var run = function () {\n\n if (_pause)\n return;\n\n _timer = setTimeout(function () {\n\n if (self.getX() > 0 && self.getX() < STAGE_WIDTH &&\n self.getY() > 0 && self.getY() < STAGE_HEIGHT) {\n\n self.setX(self.getX() + _vx * _speed);\n self.setY(self.getY() + _vy * _speed);\n\n if (_spin)\n self.setDeg(self.getDeg() + 50);\n\n // trigger the time event when running time > specific time\n if (_timeEvent && _timeEvent.args.time < _runningTime) {\n _timeEvent(_timeEvent.args);\n _timeEvent = null;\n }\n\n _runningTime += DELAY.MISSILE;\n self.nextFrame();\n run();\n }\n else {\n self.removeDom();\n self.setAlive(false);\n }\n }, DELAY.MISSILE);\n };\n\n self.calcVelocity = function () {\n // calculate velocity x and y\n var radian = Math.atan2(self.getY() - _ty, self.getX() - _tx);\n _vx = -Math.cos(radian);\n _vy = -Math.sin(radian);\n };\n\n self.clone = function () {\n return new self.constructor(self.getFrame(), self.getX(), self.getY(),\n _tx, _ty, _speed, _power, _spin);\n };\n}", "function colision(){\n \n if(i == (Math.round(yetiY - 345)/30) && j == (Math.round(yetiX - 155)/30) || i == (Math.round(yetiY - 345)/30) && j+1 == (Math.round(yetiX - 155)/30)){\n life--;\n destX = Math.round(getRandomArbitrary(1,10))*30+155;\n destY = Math.round(getRandomArbitrary(1,10))*30+345;\n setTimeout(function(){\n setInterval(function(){\n $('#container').show();\n },100)\n $('#container').hide();\n },300)\n \n if(life == 0){\n looseWindow();\n }\n }\n \n }", "function shootIfAmmo() {\n const targets = enemiesInRange(player, enemies);\n if (player.ammo > 0 && targets.length > 0) {\n log(\"Found someone to shoot\", targets);\n return true;\n }\n return false;\n }", "function dropBomb() {\n //set interval for new bomb every 1 sec if random cell conatins an invader\n setInterval(() => {\n // random cell\n let randomBomb = Math.floor(Math.random() * cells.length)\n //bombs only dropped from cells with invaders in\n if (cells[randomBomb].classList.contains('spaceInvader')) {\n cells[randomBomb].classList.add('bomb')\n //set interval for bomb movement\n const bombInterval = setInterval(() => {\n cells[randomBomb].classList.remove('bomb')\n randomBomb = randomBomb + width\n cells[randomBomb].classList.add('bomb')\n if (randomBomb > 71) {\n cells[randomBomb].classList.remove('bomb')\n clearInterval(bombInterval)\n }\n if (cells[randomBomb] === cells[spaceShip]) {\n audioPlayer.src = 'sounds/explosion.wav'\n audioPlayer.play()\n playerLife = playerLife - 1\n lifeDisplay.innerHTML = (`LIVES: ${playerLife}`)\n }\n if (playerLife === 0) {\n \n gameOver()\n audioPlayer.src = 'sounds/gameover.wav'\n audioPlayer.play()\n gameoverDisplay.innerHTML = ('GAME OVER')\n }\n },300)\n }\n },300) \n }", "function timer() { // time and spawn mechanic\n ++time;\n if (time % 2 === 0 || time % 3 === 0) {\n spawnChaser();\n }\n if (time % 4 === 0 || time % 6 === 0) {\n spawnRunner();\n }\n if (time % 10 === 0 || time % 15 === 0) {\n spawnBigBoi();\n }\n if (time % 25 === 0) {\n spawnTerminator();\n }\n if (time % 40 === 0) {\n spawnLife();\n }\n if (time % 60 === 0) {\n spawnImmunity();\n }\n }", "function checkPlayerDie()\n{\n if (gameChar_y > height)\n {\n stopGameMusic();\n gameSounds.died.play();\n \n if (lives > 0)\n { \n lives--;\n startGame();\n }\n } \n}", "function Projectile(spriteSheet, originX, originY, xTarget, yTarget, belongsTo) {\n this.origin = belongsTo;\n\n this.width = 100;\n this.height = 100;\n this.animation = new Animation(spriteSheet, this.width, this.height, 1, .085, 8, true, .75);\n\n this.targetType = 4;\n this.x = originX - CAMERA.x;\n this.y = originY - CAMERA.y;\n\n this.xTar = xTarget - 20;\n this.yTar = yTarget - 35;\n // Determining where the projectile should go angle wise.\n this.angle = Math.atan2(this.yTar - this.y, this.xTar - this.x);\n this.counter = 0; // Counter to make damage consistent\n this.childUpdate;//function\n this.childDraw;//function\n this.childCollide;//function\n this.speed = 200;\n this.projectileSpeed = 7.5;\n this.damageObj = DS.CreateDamageObject(15, 0, DTypes.Normal, null);\n this.penetrative = false;\n this.aniX = -18;\n this.aniY = -5;\n Entity.call(this, GAME_ENGINE, originX, originY);\n\n this.boundingbox = new BoundingBox(this.x + 8, this.y + 25,\n this.width - 75, this.height - 75);\n\n}", "function attack(person, damageDone) {\n person.healthPoints = person.healthPoints - damageDone;\n if (person.healthPoints < 1) {\n console.log(`${person.name} has been defeated.`);\n person.destroy();\n return false // false if not defeated\n } else {\n //console.log(`${person.name} now has ${person.healthPoints} health.`);\n return true // true. Stop attacking it's dead.\n }\n }", "function checkIfHandedOff(){\n if (tagpro.players[currentlyScoring].dead){\n timer = clearInterval(timer);\n timer = setInterval(searchForScorer,10);\n }\n}", "hasCollided(threshold = 60) {\n for(const enemy of this.enemies) {\n if(dist(this, enemy) < threshold){\n return true;\n }\n }\n return false;\n }", "function ismdead(){\n if(mdead === true){\n Gate1.parentNode.removeChild(Gate1);\n Gate2.parentNode.removeChild(Gate2);\n minotaur.parentNode.removeChild(minotaur); \n }\n requestAnimationFrame(ismdead);\n}", "function moveForDuration(person){\n if (person.duration > 1.){\n setTimeout(function(){\n move(person)\n }, 1000)\n }\n else {\n setTimeout(function(){\n leave(person)\n }, person.duration * 1000)\n }\n}", "function Shoot(seconds){\n\tif(seconds != savedTime){\n\t\tvar bullit = Instantiate(bullitPrefab, transform.Find(\"spawnPoint\").transform.position, Quaternion.identity); // Enemy's spawnPoint instantiate\n\t\tbullit.rigidbody.AddForce(transform.forward * velocity); // speed of the beam\n\t\tsavedTime = seconds;\n\t}\n}", "survivorAttack() {\n var affectedTiles = []; //An array of tiles affected by the attack.\n var SurvivorTile = this.Survivor.getCurrentTile(); //Survivor's tile.\n var upTile = this.gameBoard[SurvivorTile.getTileX()][SurvivorTile.getTileY() - 1]; //Tile north of survivor.\n var DownTile = this.gameBoard[SurvivorTile.getTileX()][SurvivorTile.getTileY() + 1]; //Tile south of survivor.\n affectedTiles.push(upTile, DownTile); //Add north/south tiles to affected tiles.\n\n //If the survivor is facing right, add the right tile to the array. If not, add the left tile.\n if (this.Survivor.getFacingRight()) {\n var rightTile = this.gameBoard[SurvivorTile.getTileX() + 1][SurvivorTile.getTileY()];\n affectedTiles.push(rightTile);\n } else {\n var leftTile = this.gameBoard[SurvivorTile.getTileX() - 1][SurvivorTile.getTileY()];\n affectedTiles.push(leftTile);\n }\n\n //Have all tiles take damage, if they *can* be damaged.\n for (const t of affectedTiles) {\n t.takeDamage();\n }\n //Have all zombies that may be in those tiles take damage.\n for (const z of this.activeZombies) {\n for (const t of affectedTiles) {\n if (z.getCurrentTile() == t && z.isZombieAlive() === true) {\n this.killZombie(z);\n this.playerScore += 25;\n this.updateUI();\n }\n }\n }\n }", "function collisionPlayerProjectile_and_EnemyBody (player_projectile, enemy) {\n\t\t\n\t\t//Decrease the health of the enemy\n\t\tenemy.health -= playerAttack; //test //Modify later with player attack\n\t\t\n\t\tif (enemy.health < 0)\n\t\t{\n\t\t\tenemy.health = 0;\n\t\t}\n\t\t\n\t\t// When a player projectile hits an enemy, we kill them both\n\t\tplayer_projectile.kill();\n\t\t//enemy.kill(); //test\n\t\t\n\t\t// Increase the experience of the player\n\t\t\n\t\t/*\n\t\tplayerExperience += 5;\n\t\tlabelPlayerExperience.text = playerExperienceString + playerExperience + playerMaxExperienceString + playerMaxExperience;\n\t\t*/\n\t\t\n\t\t//Create an explosion visual effect\n\t\t//var explosion = explosions.getFirstExists(false); //original\n\t\texplosion = explosions.getFirstExists(false); //test\n\t\texplosion.reset(enemy.body.x, enemy.body.y);\n\t\texplosion.play('explosion', 30, false, true);\n\t\t\n\t\t\n\t\tif (enemy.health == 0)\n\t\t{\n\t\t\tplayerExperience += 5;\n\t\t\tlabelPlayerExperience.text = playerExperienceString + playerExperience + playerMaxExperienceString + playerMaxExperience;\n\t\t\t\n\t\t\tenemy.kill(); //test\n\t\t}\n\t\n\t\t//My extra code-----------------------------------------\n\t\t/*\n\t\telse{\n\t\t\n\t\t\t//My code --- play enemy death sound\n\t\t\tsound = game.add.audio(\"enemy_death_sound\"); //test\n\t\t\tsound.play(); //test\n\t\t}\n\t\t*/\n\t}" ]
[ "0.6809358", "0.6721133", "0.66944253", "0.65348965", "0.6498517", "0.6456021", "0.6448426", "0.6435977", "0.6420949", "0.6404034", "0.64015037", "0.63790363", "0.63747144", "0.63722575", "0.63546497", "0.6322217", "0.6289837", "0.627741", "0.62360317", "0.62277955", "0.6224191", "0.6213953", "0.6202677", "0.6201914", "0.6201794", "0.6187547", "0.61806214", "0.61779135", "0.6176062", "0.6175312", "0.6147261", "0.60880286", "0.6022193", "0.60130453", "0.6006987", "0.6002511", "0.5988511", "0.5986497", "0.59861857", "0.5984443", "0.59694684", "0.5967086", "0.5962732", "0.59540355", "0.5953305", "0.5928663", "0.5920104", "0.5917929", "0.59156835", "0.59140456", "0.59038395", "0.5889229", "0.5886286", "0.5878259", "0.58744884", "0.5866694", "0.58594275", "0.58506536", "0.58494127", "0.5849368", "0.58489406", "0.5843333", "0.5827779", "0.5823719", "0.5817119", "0.5812501", "0.5810166", "0.580678", "0.5806321", "0.580462", "0.5803709", "0.57988966", "0.5794572", "0.57936966", "0.5788648", "0.57872415", "0.57859224", "0.578173", "0.57815266", "0.5780639", "0.57773906", "0.5775986", "0.5764263", "0.5758956", "0.5757944", "0.57544804", "0.57493263", "0.57489717", "0.5744687", "0.57445806", "0.57404804", "0.57372975", "0.57370394", "0.5736122", "0.57255113", "0.57255083", "0.5721387", "0.57206136", "0.5716793", "0.5716599" ]
0.66819614
3
changing frames for when the character is facing the right
rightState(){ this.state = "right"; this.animationTime = 40; this.currentFrameNum = 0; this.currentFrameY = 436; this.currentFrameX = 0; this.frameHeight = 114; this.frameWidth = 94; this.maxFrame = 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rightTurn() {\r\n this.fltire.rotateY(-16);\r\n this.frtire.rotateY(-16);\r\n }", "frame () {\n\t\t// If th bonuss is without life, dn't move it.\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direction.rotate(this.rotationSpeed))\n\t}", "frame () {\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direction.rotate(this.rotationSpeed));\n\t}", "leftTurn() {\r\n this.fltire.rotateY(16);\r\n this.frtire.rotateY(16);\r\n }", "function turnR() {\n if(Pointer.dir == \"right\"){\n Pointer.dir = \"down\";\n } else if(Pointer.dir == \"down\") {\n Pointer.dir = \"left\";\n } else if(Pointer.dir == \"left\") {\n Pointer.dir = \"up\";\n } else if(Pointer.dir == \"up\") {\n Pointer.dir = \"right\";\n }\n}", "nextFrame(){\n if(this.health > 0){\n this.shear = this.vel.vector[0] / 2.5;\n /*\n --HERE' S A LITTLE KEY INDEX THING--\n -32: SPACEBAR\n -37: LEFT ARROW\n -38: UP ARROW\n -39: RIGHT ARROW\n -68: 'D' KEY\n -81: 'Q' KEY\n -90: 'Z' KEY\n */\n if(this.color == '#FF3333'){\n this.counter += 1;\n if(this.counter >= 180){\n this.counter = 0;\n this.color = \"#FFCC33\"\n }\n }\n if(keys[37] || keys[81]){\n this.vel.vector[0] += 0 - ((this.vel.vector[0] >= 0 - this.xstep) && !this.wallLeft ? this.accel : 0);\n }\n if(keys[39] || keys[68]){\n this.vel.vector[0] += ((this.vel.vector[0] <= this.xstep) && !this.wallRight ? this.accel : 0);\n }\n if(!keys[39] && !keys[37] && !keys[68] && !keys[81]){\n this.vel.vector[0] = this.vel.vector[0] * this.xfriction;\n }\n \n //check if thing is at borders of screen to set x-vel 0\n if(this.pos.vector[0] < 0){\n this.pos.vector[0] = 0;\n this.vel.vector[0] = 0;\n }\n if(this.pos.vector[0] > canvas.width - this.width){\n this.pos.vector[0] = canvas.width - this.width;\n this.vel.vector[0] = 0;\n }\n if((keys[38] || keys[32] || keys[90]) && this.grounded){\n this.vel.vector[1] -= this.jumph;\n }\n this.vel.vector[1] += this.grounded ? 0 : this.gravity;\n this.pos.plus(this.vel);\n }\n }", "returnFromRight() {\r\n this.fltire.rotateY(16);\r\n this.frtire.rotateY(16);\r\n }", "move(){\n\n this.charY = windowHeight - 200;\n if (this.state === \"right\") this.charX += 4;\n if (this.state === \"left\") this.charX -= 4;\n \n }", "update() {\n frames = 0;\n this.moveDown();\n }", "updateFrame() {\n this.frameX =\n (this.frame - 1) * this.width -\n Math.floor((this.frame - 1) / this.cols) * this.cols * this.width;\n // console.log('right', (this.frame / this.cols * this.cols * this.width));\n // console.log('this.frame / this.cols', (this.frame / this.cols));\n // console.log('this.cols', this.cols, 'this.height', this.height);\n this.frameY = Math.floor((this.frame - 1) / this.cols) * this.height;\n }", "move_player(graphics_state,dt)\r\n {\r\n let temp = Mat4.inverse( graphics_state.camera_transform);\r\n this.battle = temp;\r\n this.battle = this.battle.times(Mat4.translation([0,0,-3]));\r\n //let origin = Vec.of(0,0,0,1);\r\n //temp = temp.times(origin);\r\n \r\n let origin = Vec.of(0,0,0,1);\r\n let char_pos = temp.times(origin);\r\n //console.log(char_pos);\r\n \r\n if(this.rotate_right == true)\r\n {\r\n temp = temp.times(Mat4.rotation( -0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation + 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_right = false;\r\n }\r\n if(this.rotate_left == true)\r\n {\r\n temp = temp.times(Mat4.rotation( 0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation - 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_left = false;\r\n }\r\n\r\n if(this.move_forward == true)\r\n {\r\n \r\n this.velocity = this.velocity.plus(Vec.of(0,0,-0.2*dt));\r\n \r\n /*else\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n }*/\r\n }\r\n if(this.move_backward == true)\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0,0,0.2*dt));\r\n \r\n //else\r\n //{\r\n //this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n //}\r\n }\r\n let old_temp = temp;\r\n temp = temp.times(Mat4.translation(this.velocity));\r\n char_pos = temp.times(origin);\r\n if(this.out_of_bounds(char_pos) == true || this.finished == false)\r\n {\r\n temp = old_temp;\r\n }\r\n if(this.check_door(char_pos) == true)\r\n {\r\n this.touching_door = true;\r\n }\r\n if(this.check_enemy(char_pos) == true && this.touching_door == false)\r\n {\r\n this.touching_enemy = true;\r\n this.enemy = this.map[this.player_room[0]][this.player_room[1]].enemy_type;\r\n this.finished = false;\r\n }\r\n if(this.check_key(char_pos) == true)\r\n {\r\n this.touching_obj = true;\r\n }\r\n temp = Mat4.inverse(temp);\r\n \r\n return temp;\r\n }", "handlePlayerFrame(){\n if(this.speedY < 0){\n this.frameY = 3\n }else{\n this.frameY = 0\n }\n if (this.frameX < 3){\n this.frameX++\n } else {\n this.frameX = 0\n }\n }", "turnRight(){\n this.orientation++;\n if(this.orientation > 3){\n this.orientation = 0;\n }\n this.graphicalObject.rotateY(-Math.PI/2);\n }", "leftState(){\n this.state = \"left\";\n this.animationTime = 40;\n this.currentFrameNum = 0;\n this.currentFrameY = 553;\n this.currentFrameX = 0;\n this.frameHeight = 114;\n this.frameWidth = 94;\n this.maxFrame = 9;\n }", "turnRight() {\n this._currentLinearSpeed = 0;\n this._currentAngularSpeed = -this._angularSpeed;\n }", "playerFrame() {\n // console.log(this.moving);\n if (!this.moving) {\n this.frameY = 1\n if (this.frameX === 5) {\n this.frameX = 0\n }\n else if (this.frameX === 11) {\n this.frameX = 6\n }\n else if (this.frameX === 17) {\n this.frameX = 12\n }\n else if (this.frameX >= 23){\n this.frameX = 18\n }\n }\n if (this.frameX > 22) {\n this.frameX = 0\n }\n this.frameX++ // TODO: this bugs out when holding not dir keys and running into walls\n }", "function frame() {\n\n frameCount++;\n increment = 22 - frameCount; // move faster every frame\n\n if (increment < 2) increment = 2;\n\n deltaX += increment;\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n if (deltaX >= 100) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n\n // end animation\n if (deltaX >= 215) {\n clearInterval(animation);\n menuToggleBar.style.width = (220 - 40) + 'px';\n menu.style.right = 0 + 'px';\n deltaX = 220;\n isMenuAnimating = false;\n\n }\n }", "function animations() {\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tif (arthur.goRight) {\n\t\tarthur.srcY = arthur.goRowRight * arthur.height;\n\t} else if (arthur.goLeft) {\n\t\tarthur.srcY = arthur.goRowLeft * arthur.height;\n\t} else if (arthur.duckRight) {\n\t\tarthur.srcY = arthur.duckRowRight * arthur.height;\n\t} else if (arthur.atkRight) {\n\t\tarthur.srcY = arthur.atkRowRight * arthur.height;\n\t} else if (arthur.jumpRight) {\n\t\tarthur.srcY = arthur.jumpRowRight * arthur.height;\n\t} else if (arthur.die) {\n\t\tarthur.srcY = arthur.dieRowRight * arthur.height;\n\t}\n}", "function walk2(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.x\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.x\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.x\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.x\r\n });\r\n\r\n xSlide.setKeys(keyFrames);\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n\r\n\r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3*Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3 * Math.PI / 2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function renderFrame() {\n let delta = 0;\n if (last_time !== 0) {\n delta = (new Date().getTime() - last_time);\n }\n last_time = new Date().getTime();\n\n // call the LoopCallback function in the WASM module\n exports.LoopCallback(delta,\n leftKeyPress, rightKeyPress,\n upKeyPress, downKeyPress,\n spaceKeyPress, cloakKeyPress);\n\n // Turn of click-shoot\n\n spaceKeyPress = false\n\n // requestAnimationFrame calls renderFrame the next time a frame is rendered\n requestAnimationFrame(renderFrame);\n}", "press(dir) {\n if (dir) {\n this._game._right = true;\n this._game._rightAccelStep = 0;\n } else {\n this._game._left = true;\n this._game._leftAccelStep = 0;\n }\n }", "function frame() {\n if (bottom < newBottom) {\n bottom = bottom + factorBottom\n side = side + factorSide\n elem.style.bottom = bottom + 'px';\n elem.style.right = side + 'px';\n clickable = false; // During the move, clickable is false so no card can be clicked during the movement\n } else {\n\t clearInterval(id);\n moveBack();\n }\n }", "moveFrog(x, y) {\n if(x > 0) { //frog moving right, set facing right\n this.model.frogFaceRight = true;\n }\n else if(x < 0) { //frog moving left, set facing left\n this.model.frogFaceRight = false;\n } \n this.model.setPos(x, y);\n this.view.clearScreen();\n this.view.updateFrog(this.model.frogPos, this.model.frogFaceRight);\n }", "function frame() {\n\t\tleft += 2.5;\n\t\t//opacity += 0.02;\n\t\tanimal.style.left = left + 'px';\n\t\t//txt.style.opacity = opacity;\n\t\tif (left >= 15) {\n\t\t\tclearInterval(interval);\n\t\t\tanimal.style.left = \"15px\";\n\t\t\t//txt.style.opacity = 1;\n\t\t\tspots_disabled = false;\n\t\t\tfadein_text();\n\t\t}\n\t}", "function walk(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.z\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.z\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.z\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.z\r\n });\r\n xSlide.setKeys(keyFrames);\r\n\r\n\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n \r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n \r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function updateAnimation(){\n // scan keyboard\n keyboard.update();\n\n const steps = 50;\n\n // max values\n const maxHeight = 3;\n const handMove = 1.5;\n const headRotate = 1;\n const legRotate = 2.6;\n const downHeight = 0.8;\n const bodyRotate = 0.4;\n const characterRotate = 2;\n\n // Different animation based on keyboard input\n if (character != null){\n //character.rotation.y += 0.002;\n\n // If press 'up', the character jump up and move right\n if (upCount > 0){\n upCount--;\n var parabola = (0.25-(upCount/steps-0.5)*(upCount/steps-0.5));\n character.position.y = maxHeight * parabola;\n leftHand.position.x = -handMove * parabola;\n leftHand.position.y = handMove * parabola;\n rightHand.position.x = handMove * parabola;\n rightHand.position.y = handMove * parabola;\n head.rotation.x = -headRotate * parabola;\n character.position.x += 0.03;\n camera.position.x += 0.03;\n light.position.x += 0.03;\n }\n\n // If press 'down', the character goes down and move right\n else if (downCount > 0){\n downCount--;\n var parabola = (0.25-(downCount/steps-0.5)*(downCount/steps-0.5));\n leftLegPivot.rotation.z = -legRotate * parabola;\n rightLegPivot.rotation.z = legRotate * parabola;\n character.position.y = -downHeight * parabola;\n var handDist = handMove * parabola;\n leftHand.position.set(3 * handDist, -2.5 * handDist, 2.5 * handDist);\n rightHand.position.set(2 * handDist, handDist, -2 * handDist);\n head.rotation.x = headRotate * parabola;\n head.rotation.z = headRotate * parabola;\n body.rotation.x = bodyRotate * parabola;\n character.position.x += 0.03;\n camera.position.x += 0.03;\n light.position.x += 0.03;\n }\n\n // If press 'left', character jump and spin a circle and move right\n else if (leftCount > 0){\n leftCount--;\n var parabola = (0.25-(leftCount/steps-0.5)*(leftCount/steps-0.5));\n character.position.y = maxHeight * parabola;\n leftHand.position.x = -2 * handMove * parabola;\n rightHand.position.x = 2 * handMove * parabola;\n character.rotation.y = -(steps - leftCount) * 2 * Math.PI / steps;\n character.position.x += 0.03;\n camera.position.x += 0.03;\n light.position.x += 0.03;\n }\n\n // If press 'right', character rotate, move right, and rotate back\n else if (rightCount > 0){\n rightCount--;\n if (rightCount >= 75) {\n character.rotation.y += Math.PI / 50;\n }\n else if (legCount > 0){\n legCount--;\n var parabola = (0.25-(legCount/steps-0.5)*(legCount/steps-0.5));\n rightLegPivot.rotation.x = -legRotate * parabola;\n leftLegPivot.rotation.x = legRotate * parabola;\n leftHand.position.z = 3 * handMove * parabola;\n rightHand.position.z = -3 * handMove * parabola;\n character.position.x += 0.05;\n camera.position.x += 0.05;\n light.position.x += 0.05;\n }\n else {\n character.rotation.y += -Math.PI / 50;\n }\n }\n\n else{\n character.position.y = 0;\n character.rotation.y = 0;\n if ( keyboard.pressed('up') ) {\n // jump\n upCount = steps;\n console.log(\"Jump\");\n }\n else if ( keyboard.pressed('down') ) {\n // go down\n downCount = steps;\n console.log(\"Down\");\n }\n else if ( keyboard.pressed('left') ) {\n // move left\n leftCount = steps;\n console.log(\"Left (for audience)\");\n }\n else if ( keyboard.pressed('right') ) {\n // move right\n rightCount = 2 * steps;\n legCount = steps;\n console.log(\"Right (for audience)\");\n }\n }\n\n // When the camera move close to the edge of the plane and there is no connected plane to its right, create new connect ground to ensure that there is always a ground and a back wall in the camera\n if (camera.position.x > (50 * (rightStageCount - 1))){\n createNewStage();\n }\n }\n}", "function rightKey(keyDown) {\n if (keyDown) {\n rightDown = true;\n player.xFace = \"right\";\n } else {\n rightDown = false;\n }\n}", "moveRight() {\n\n if (this.posX <= 670 && pause == false)\n this.posX = this.posX + 5;\n }", "left() {\n // If the LEFT key is down, set the player velocity to move left\n this.sprite.body.velocity.x = -this.RUN_SPEED;\n //this.animate_walk();\n }", "returnFromLeft() {\r\n this.fltire.rotateY(-16);\r\n this.frtire.rotateY(-16);\r\n }", "update(frame) {\n let rotate = ButterflyTools.getWingRotationFromFrame(frame, this.parent.angle, this.parent.speed, this.side);\n mat4.multiply(this.pos, mat4.create(), rotate);\n }", "function rectangle(){\nforward(60);\nright(90);\nforward(30);\nright(90);\nforward(60);\nright(90);\nforward(30);\nright(90);\nforward(60);\n}", "forearmFrameRAction(event) {\n if (this.baseFrameActionActivated) return;\n\n let currentActionInitialEventCoords = VLabUtils.getEventCoords(event.event);\n\n if (this.prevActionInitialEventCoords !== undefined) {\n this.vLab.SceneDispatcher.currentVLabScene.currentControls.disable();\n\n this.setForearmRightFrame(this.ValterLinks.forearmRightFrame.value + this.ValterLinks.forearmRightFrame.step * ((this.prevActionInitialEventCoords.x - currentActionInitialEventCoords.x > 0.0) ? 1 : -1));\n }\n\n this.prevActionInitialEventCoords = new THREE.Vector2();\n this.prevActionInitialEventCoords.copy(currentActionInitialEventCoords);\n }", "function userRight() {\n if (!isStopped) {\n FallingShape.moveRight();\n drawGame();\n }\n }", "turnLeft(){\n this.orientation--;\n if(this.orientation < 0){\n this.orientation = 3;\n }\n this.graphicalObject.rotateY(Math.PI/2);\n }", "function frame() {\n console.log(\"zaim\");\n if (pos == z) {\n clearInterval(id);\n } else {\n pos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = pos+\"px\"; \n x=pos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function updateForFrame() {\r\n rotatingComponents.rotation.y += rotateSpeed;\r\n}", "function updateOrientation(e) {\n var a = Math.round(e.alpha); // Left and Right\n var g = Math.round(e.gamma);// Up and down\n // The below rules for fixing gamma and alpha were found by watching initial values and playing with the phone\n // Fix gamma so it doesn't jump\n if(g < 0)\n {\n g+=180;\n }\n\n g -= 90;\n g = g > CamMotion.verticalMax ? CamMotion.verticalMax : g;\n g = g < CamMotion.verticalMin ? CamMotion.verticalMin : g;\n \n // Fix alpha so it doesn't jump\n // There are different rules if gamma is more than or less than 0\n if(g > 0)\n {\n a -= 180; \n }\n else\n {\n if(a > 180)\n {\n a -= 360;\n }\n }\n a = a > CamMotion.horizontalMax ? CamMotion.horizontalMax : a;\n a = a < -CamMotion.horizontalMax ? -CamMotion.horizontalMax : a;\n \n // This may be useful for debugging other phones someday so leaving it here\n //$('#rotAlpha').text(a);\n //$('#rotBeta').text(b);\n //$('#rotGamma').text(g);\n \n CamMotion.vertical = -g;\n CamMotion.horizontal = -a;\n\n // Update the tilt display\n updateTiltDot();\n \n // Safely send the new info\n safeSendData();\n }", "function forward(){\n if(curFrame <= frames.length-1)\n drawCurFrame();\n}", "setFlip(dir) {\n var localScale;\n if (this.cameraSnapped){\n if ( dir == \"right\" ) {\n localScale = -Math.abs(this.scale);\n this.scale = -Math.abs(this.scale);;\n this.flip = \"right\";\n }\n else if ( dir == \"left\") {\n localScale = Math.abs(this.scale);\n this.scale = Math.abs(this.scale);\n this.flip = \"left\";\n }\n this.animations.forEach(function (value) {\n value.scale.x = localScale;\n }) \n }\n \n }", "function playerRight() {\n\tadjustPlayer(blockWidth - 1, 1);\n}", "function swingLeftRight(ctx) \n{\n\tctx.beginPath();\n\tctx.moveTo(eye1_x, eye1_y);\n\tctx.arc(eye1_x, eye1_y, eye_radius, 0, Math.PI*2);\n\tctx.fill();\n\n\tctx.beginPath();\n\tctx.moveTo(eye2_x, eye2_y);\n\tctx.arc(eye2_x, eye2_y, eye_radius, 0, Math.PI*2);\n\tctx.fill();\n\n\teye1_x += eye_speed;\n\teye2_x += eye_speed;\n\t\n\tif(eye1_x >= eye1_centerx + 30)\n\t\teye_speed = -eye_speed;\n\tif(eye1_x <= eye1_centerx - 30)\n\t\teye_speed = -eye_speed;\n}", "function turnL() {if(--facing < 0) {facing = 3}}", "function panToRight(){\n\tgainL.gain.value = 0;\n\tgainR.gain.value = 1;\n}", "function frame() {\n\n frameCount++;\n deltaX += -frameCount; // move faster every frame\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n // move top nav bar if needed\n if (deltaX >= 110) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n // end menu bar animation\n else if (deltaX > 90 && deltaX < 110) {\n menuToggleBar.style.width = 60 + 'px';\n }\n // end slide menu animation\n else if (deltaX <= -5) {\n clearInterval(animation);\n menu.style.right = -220 + 'px';\n deltaX = 0;\n frameCount = 0;\n isMenuAnimating = false;\n }\n }", "function tick() {\n\n\n var moveSpeed = 2;\n var turnSpeed = 2;\n\n if(keys.left){\n lookAngle -= turnSpeed;\n if(lookAngle < 0) lookAngle = 360 + lookAngle;\n }\n else if(keys.right){\n lookAngle+=turnSpeed;\n if(lookAngle >= 360) lookAngle %= 360;\n }\n if(keys.up) {\n var vec = getMoveVector();\n $scope.eye.x += moveSpeed * vec[0];\n $scope.eye.y += moveSpeed * vec[1];\n }\n else if(keys.down){\n var vec = getMoveVector();\n $scope.eye.x-=moveSpeed*vec[0];\n $scope.eye.y-=moveSpeed*vec[1];\n }\n\n sunAngle++;\n sun.xform = new Matrix4().rotate(sunAngle/80,1,0,0);\n\n\n\n\n\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n for(var a = 0; a < drawables.length; a++){\n drawables[a].render($scope.eye);\n }\n requestAnimationFrame(tick, canvas);\n\n }", "function moveRight() {\n\n if (document.querySelector('.frame').classList.contains('left')) showMiddle();\n else showRight();\n }", "function prevFrameX(){\n\tif(_x<=1 && _x>0) _x-=_offsetX;\n\telse _x=1-_offsetX;\n\trenderer.material.mainTextureOffset= Vector2(_x,_y);\n}", "function keyPressed(){\n //check right arrow is pressed \n //ASCII\n if(keyCode===RIGHT_ARROW){\n Matter.Body.applyForce(ball,{x:0,y:0},{x:0.05,y:0});\n }\n if(keyCode===LEFT_ARROW){\n Matter.Body.applyForce(ball1,{x:0,y:0},{x:-0.05,y:0})\n }\n}", "function moveToRight() {\n picture.animate(\n [\n { transform: 'translateX(10vh)', opacity: 0 },\n { transform: 'translateX(0)', opacity: 1 },\n ],\n {\n duration: 700,\n easing: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',\n fill: 'both',\n }\n );\n}", "function movementOfTheMonkeyLeftRight(newPosition, rotate) {\n lionImage.style.left = `${newPosition}%`;\n lionImage.style.transform = rotate;\n}", "function turnFace(face) {\n var x,y,z;\n var direction,value;\n var mainAxis;\n var oldMat;\n switch (face) {\n case \"L\":\n mainAxis = 0; value = -1; direction = \"L\";\n break;\n case \"R\":\n mainAxis = 0; value = 1; direction = 0;\n break;\n case \"U\":\n mainAxis = 1;value = 1;direction = 0;\n break;\n case \"D\":\n mainAxis = 1;value = -1;direction = \"D\";\n break;\n case \"F\":\n mainAxis = 2;value = 1;direction = 0;\n break;\n case \"B\":\n mainAxis = 2;value = -1;direction = \"B\";\n break;\n case \"M\":\n mainAxis = 0;value = 0; direction = \"M\";\n break;\n case \"E\":\n mainAxis = 1;value = 0;direction = \"E\";\n break;\n case \"S\":\n mainAxis = 2;value = 0;direction = 0;\n break;\n case \"l\":\n mainAxis = 0; value = -1; direction = 0;\n break;\n case \"r\":\n mainAxis = 0; value = 1; direction = \"r\";\n break;\n case \"u\":\n mainAxis = 1;value = 1;direction = \"u\";\n break;\n case \"d\":\n mainAxis = 1;value = -1;direction = 0;\n break;\n case \"f\":\n mainAxis = 2;value = 1;direction = \"f\";\n break;\n case \"b\":\n mainAxis = 2;value = -1;direction = 0;\n break;\n case \"m\":\n mainAxis = 0;value = 0;direction = 0;\n break;\n case \"e\":\n mainAxis = 1;value = 0;direction = 0;\n break;\n case \"s\":\n mainAxis = 2;value = 0;direction = \"s\";\n break;\n }\n for (x = -1; x < 2; x++) {\n for (y = -1; y < 2; y++) {\n for (z = -1; z < 2; z++) {\n if (cubeState[x+1][y+1][z+1][mainAxis] === value) {\n oldMat = getRotationMatrix(x,y,z);\n if (!direction) \n oldMat = mult(oldMat,rotate(rotationAngle,getRotationAxes(x,y,z)[mainAxis]));\n else \n oldMat = mult(oldMat,rotate(rotationAngle,negateVec(getRotationAxes(x,y,z)[mainAxis])));\n setRotationMatrix(x,y,z,oldMat);\n }\n }\n }\n }\n}", "draw(){\n \n \n \n image(this.spriteSheet, this.charX, this.charY, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight);\n }", "update() {\n this.thrust(0.04);\n if (this.angle >= -20 && this.angle <= 20) {\n direction = \"Right\";\n }\n else if (this.angle >= 70 && this.angle <= 110) {\n direction = \"Down\";\n }\n else if (this.angle >= 160 || this.angle <= -160) {\n direction = \"Left\";\n }\n else if (this.angle >= -110 && this.angle <= -70) {\n direction = \"Up\";\n }\n }", "animate() {\r\n if(this.count>6) {\r\n this.count = 0;\r\n if(this.side) { //True = right\r\n if(this.image===this.idleRight) { //Idle changed to a moving sprite\r\n this.image = this.goRight; //Moving - to idle\r\n } else {\r\n this.image = this.idleRight;\r\n }\r\n } else {\r\n if (this.image===this.idleLeft) {\r\n this.image = this.goLeft;\r\n } else {\r\n this.image = this.idleLeft;\r\n }\r\n }\r\n }\r\n }", "function keyControls(){\n \n if(keyWentDown (RIGHT_ARROW)){\n chrono.velocityX=10 \n }\n if(keyWentUp(RIGHT_ARROW)){\n chrono.velocityX=0\n }\n if(chrono.y >-100){\n if(keyDown(\"space\")){\n chrono.velocityY=-4\n }\n }\n \n \n}", "animate() {\n this.renderScene()\n this.frameId = window.requestAnimationFrame(this.animate)\n this.camera.rotation.z -= .0004;\n this.clouds1.rotation.y += .001;\n this.clouds2.rotation.y += .001;\n\n this.yinYang.rotation.y += 0.00;\n this.earth.rotation.y += 0.001;\n this.fire.rotation.y += 0.001;\n this.metal.rotation.y += 0.001;\n this.water.rotation.y += 0.001;\n this.wood.rotation.y += 0.001;\n }", "handleheroFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "right() {\n if (!this.isOnTabletop()) return;\n if (!this.facing) return;\n let degree=FacingOptions.facingToDegree(this.facing);\n degree+=90;\n this.facing=FacingOptions.degreeToFacing(degree);\n }", "function turnL() {\n if(Pointer.dir == \"right\"){\n Pointer.dir = \"up\";\n } else if(Pointer.dir == \"down\") {\n Pointer.dir = \"right\";\n } else if(Pointer.dir == \"left\") {\n Pointer.dir = \"down\";\n } else if(Pointer.dir == \"up\") {\n Pointer.dir = \"left\";\n }\n}", "function moveRight() {\n\n\t\ttry {\n\t\t\t// Pass in the movement to the game.\n\t\t animation.move(\"x\", moveTypes.right);\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(err);\n\t\t}\n\t}", "function ChangeSpriteDirection(){\n\t// right\n\tanimator.SetInteger(\"right\", right);\n\t\n\t// left\n\tanimator.SetInteger(\"left\", left);\n\t\n\t// up\n\tanimator.SetInteger(\"up\", up);\n\t\n\t// down\n\tanimator.SetInteger(\"down\", down);\n\t\n}", "function keydown(e) {\n console.log(e.key + \" pressed\");\n switch (e.key) {\n case \"w\":\n var facing = 0;\n walkingFrame++;\n sprite.style.top = (parseInt(sprite.style.top) - 10) + \"px\";\n break;\n case \"a\":\n facing = 1;\n walkingFrame++;\n sprite.style.left = (parseInt(sprite.style.left) - 10) + \"px\";\n break;\n case \"s\":\n facing = 2;\n walkingFrame++;\n sprite.style.top = (parseInt(sprite.style.top) + 10) + \"px\";\n break;\n case \"d\":\n facing = 3;\n walkingFrame++;\n sprite.style.left = (parseInt(sprite.style.left) + 10) + \"px\";\n break;\n }\n sprite.style.backgroundPositionY = (0 - facing * spriteSize) + \"px\";\n if (walkingFrame > frameCount) {\n walkingFrame = 0;\n }\n sprite.style.backgroundPositionX = (0 - walkingFrame * spriteSize) + \"px\";\n}", "handleDragonFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "rotate(dir) {\n\n if (dir === 'rotateright') {\n\n if (this.rotation === 3){\n this.rotation = -1\n }\n this.rotation ++;\n this.checkGhost();\n this.render();\n\n } else {\n\n if (this.rotation === 0){\n this.rotation = 4;\n }\n this.rotation --;\n this.checkGhost();\n this.render();\n\n }\n\n }", "function draw() {\n ctx.clearRect(0, 0, c.width, c.height);\n if(Space == true) {\n drawBullets(BulletPosX, BulletPosY);\n BulletPosY -= 50;\n }\ndrawCharacter();\n\n\n if(rightPressed == true && character.getX() < c.width - 5) {\n character.updateX(character.getX() + 7);\n }\n\n else if(leftPressed == true && character.getX() > 5) {\n character.updateX(character.getX() - 7);\n }\n\n document.getElementById(\"Placar\").innerHTML = \"Lives: \" + numberOfLives;\n document.getElementById(\"Level\").innerHTML = \"Level: \" + Level;\n document.getElementById(\"Instruction\").innerHTML = \"ARROW KEYS to move <br> ENTER to shoot\";\n\n requestAnimationFrame(draw);\n}", "make_control_panel(graphics_state)\r\n // Draw the scene's buttons, setup their actions and keyboard shortcuts, and monitor live measurement\r\n {\r\n let r = Math.PI/8.\r\n this.control_panel.innerHTML += \"Use these controls to <br> fly your rocket!<br>\";\r\n this.key_triggered_button( \"Rotate up\", [ \"w\" ], () => {\r\n this.rocket_transform = this.rocket_transform.times(Mat4.rotation(r, Vec.of(1,0,0)))\r\n });\r\n this.key_triggered_button( \"Rotate left\", [ \"a\" ], () => {\r\n this.rocket_transform = this.rocket_transform.times(Mat4.rotation(r, Vec.of(0,0,1)))\r\n\r\n });\r\n this.key_triggered_button( \"Rotate down\", [ \"s\" ], () => {\r\n this.rocket_transform = this.rocket_transform.times(Mat4.rotation(-r, Vec.of(1,0,0)))\r\n });\r\n this.new_line();\r\n this.key_triggered_button( \"Rotate right\", [ \"d\" ], () => {\r\n this.rocket_transform = this.rocket_transform.times(Mat4.rotation(-r, Vec.of(0,0,1)))\r\n });\r\n this.key_triggered_button( \"Fire Booster\", [ \"'\" ], () => {\r\n this.rocket_transform = this.rocket_transform.times(Mat4.translation([0, 0.5, 0]))\r\n }); \r\n this.key_triggered_button( \"Fire Reverse Booster\", [ \"[\" ], () => {\r\n this.rocket_transform = this.rocket_transform.times(Mat4.translation([0, -0.5, 0]))\r\n }); this.key_triggered_button( \"Fire laser\", [ \";\" ], () => {\r\n //This shit don't work\r\n let laser_tf = this.rocket_transform;\r\n laser_tf = laser_tf.times(Mat4.translation([0,3,0])); //Current tip of rocket height\r\n laser_tf = laser_tf.times(Mat4.scale([1, 3, 1]));\r\n laser_tf = laser_tf.times(Mat4.translation([0,this.t,0]));\r\n this.shapes.box.draw(graphics_state, laser_tf, this.plastic.override({color: Color.of(57/255,1,20/255,1)}));\r\n });\r\n }", "function draw(){\n background(\"white\");\n if(keyDown(LEFT_ARROW)){\n changePosition(-1,0);\n }\n else if(keyDown(RIGHT_ARROW)){\n changePosition(1,0);\n }\n else if(keyDown(UP_ARROW)){\n changePosition(0,-1);\n }\n else if(keyDown(DOWN_ARROW)){\n changePosition(0,+1);\n }\n drawSprites();\n}", "handleFrame(){\n if(this.frameX === 0){\n this.frameX = (enemySprite.width/3)+5;\n }else if(this.frameX===(enemySprite.width/3)+5){\n this.frameX = (enemySprite.width/1.5)+5;\n }else if (this.frameX ===(enemySprite.width/1.5)+5){\n this.frameX = 0;\n }\n }", "turnRight() {\n if (DIRECTIONS.indexOf(this.position.heading) === 3) {\n this.position.heading = DIRECTIONS[0];\n } else {\n this.position.heading =\n DIRECTIONS[DIRECTIONS.indexOf(this.position.heading) + 1];\n }\n }", "function onFrame(event) {\n\tframePosition += (mousePos - framePosition) / 10;\n\tvar vector = (view.center - framePosition) / 10;\n\tmoveStars(vector * 3);\n\tmoveRainbow(vector, event);\n}", "function btnRightHandler() {\n if ((playerX < canvas.width-playerWidth)\n && (!modoInverso)) {\n playerX += 50;\n } else if (playerX > 0) {\n playerX -= 50;\n }\n}", "function Update() \n{\n\t// Save the state in playing now.\n stateInfo = chrAnimator.GetCurrentAnimatorStateInfo(0);\n\n\t// character moves\n\tvar h : float = Input.GetAxis(\"Horizontal\");\n\tvar v : float = Input.GetAxis(\"Vertical\");\n\tvar axisInput : Vector3 = Vector3(h, 0, v);\n\n\tvar moveSpeed : float = (h*h+v*v) * 0.25;\n\tif(Input.GetButton(\"Fire2\"))\tmoveSpeed += 0.75;\t// for Run\n\n\tchrAnimator.SetFloat(\"Speed\", moveSpeed);\n\n\t// character rotate\n\tif(h + v != 0){\n\t\tif(stateInfo.IsTag(\"InMove\") || stateInfo.IsTag(\"InJump\")){\n\t\t\taxisInput = Camera.main.transform.rotation * axisInput;\n\t\t\taxisInput.y = 0;\n\t\t\ttransform.forward = axisInput;\n\t\t}\n\t}\n\t//transform.Rotate(0, h * rotateSpeed, 0);\n\t\n\t// Bool parameter reset to false. \n\tif(!stateInfo.IsTag(\"InIdle\")){\n\t\tchrAnimator.SetBool(\"LookAround\", false);\n\t\tchrAnimator.SetBool(\"Attack\", false);\n\t\tchrAnimator.SetBool(\"Jiggle\", false);\n\t\tchrAnimator.SetBool(\"Dead\", false);\n\t}\n\n\t// reaction of key input.\n\t// for Attack\n\tif(Input.GetButtonDown(\"Fire1\"))\tchrAnimator.SetBool(\"Attack\", true);\n \n\t// LookAround\n\tif(Input.GetKeyDown(\"z\"))\tchrAnimator.SetBool(\"LookAround\", true);\n\t// Jiggle\n\tif(Input.GetKeyDown(\"x\"))\tchrAnimator.SetBool(\"Jiggle\", true);\n\n\t// Happy!!\n\tif(Input.GetKeyDown(\"c\"))\n\t{\n\t\tchrAnimator.SetBool(\"Happy\", !chrAnimator.GetBool(\"Happy\"));\n\t\tif(chrAnimator.GetBool(\"Happy\") == true)\tchrAnimator.SetBool(\"Sad\", false);\n\t}\n\t// Sad\n\tif(Input.GetKeyDown(\"v\"))\n\t{\n\t\tchrAnimator.SetBool(\"Sad\", !chrAnimator.GetBool(\"Sad\"));\n\t\tif(chrAnimator.GetBool(\"Sad\") == true)\tchrAnimator.SetBool(\"Happy\", false);\n\t}\n\t\n\t// for Dead\n\tif(Input.GetKeyDown(\"b\"))\tchrAnimator.SetBool(\"Dead\", true );\n\n\t// for Jump\n\t// while in jump, I am using Character Controller instead Root Motion, to move the Character.\n\t// in ground.\n\tif(chrController.isGrounded){\n // jump parameter set to false.\n\t\tchrAnimator.SetInteger(\"Jump\", 0);\n // moveDirection set 0, to prevent to move by Character controller.\n\t\tmoveDirection = Vector3.zero;\n // press Jump button. make jump\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n\t}\n // While in Air\n else if(!chrController.isGrounded){\n // press Jump button. can jump once more.\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n // It is moved with Character Controller while in the air,\n // moveDirection is use Axis Input.\n\t\tmoveDirection = Vector3(axisInput.x * 4, moveDirection.y, axisInput.z * 4);\n\t\tmoveDirection.y -= gravity * Time.deltaTime;\n\t}\n\n // character is move by moveDirection.\n\tchrController.Move(moveDirection * Time.deltaTime);\n}", "function update() {\n frames++;\n fish.update();\n //console.log(fish.y);\n}", "function move_right() {\n\t check_pos();\n\t blob_pos_x = blob_pos_x + move_speed;\n\t}", "function Start()\n{\n mForwardDirection = transform.forward;\n mRightDirection = transform.right;\n mUpDirection = transform.up;\n}", "turnLeft() {\n this._currentLinearSpeed = 0;\n this._currentAngularSpeed = this._angularSpeed;\n }", "renderFrame() {\r\n this.context.fillStyle = \"#f8dcb5\";\r\n this.context.fillRect(0,0,this.render.width, this.render.height);\r\n this.handleAccDec();\r\n this.handleTurning();\r\n // Check if player tries to go in reverse\r\n this.player.speed = Math.max(this.player.speed, 0); \r\n // enforce max speed\r\n this.player.speed = Math.min(this.player.speed, this.player.maxSpeed); \r\n this.player.posZ += this.player.speed;\r\n // draw background\r\n this.drawBackground(-this.player.posX);\r\n // render the road\r\n this.renderRoad();\r\n // reset transformation-matrix with identity-matrix\r\n //this.context.setTransform(1, 0, 0, 1, 0, 0);\r\n }", "function left2right() {\n if (_viewerLeft && _viewerRight && !_updatingRight) {\n _updatingLeft = true;\n transferCameras(true);\n setTimeout(function() { _updatingLeft = false; }, 500);\n }\n}", "function tick() {\n\n\n var moveSpeed = 2;\n var turnSpeed = 2;\n\n if (keys.left) {\n lookAngle -= turnSpeed;\n if (lookAngle < 0) lookAngle = 360 + lookAngle;\n }\n else if (keys.right) {\n lookAngle += turnSpeed;\n if (lookAngle >= 360) lookAngle %= 360;\n }\n if (keys.up) {\n var vec = getMoveVector();\n $scope.eye.x += moveSpeed * vec[0];\n $scope.eye.y += moveSpeed * vec[1];\n }\n else if (keys.down) {\n var vec = getMoveVector();\n $scope.eye.x -= moveSpeed * vec[0];\n $scope.eye.y -= moveSpeed * vec[1];\n }\n\n sunAngle++;\n sun.xform = new Matrix4().rotate(sunAngle / 80, 1, 0, 0);\n\n\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n for (var a = 0; a < drawables.length; a++) {\n drawables[a].render($scope.eye, $scope.ambientValue);\n }\n requestAnimationFrame(tick, canvas);\n\n }", "goForward(){\n if(this.isVacant()){\n switch(this.orientation){\n case 0:\n this.positionY--;\n this.graphicalObject.position.z -= (this.room.blockSize + this.room.blockGap); \n break;\n case 1:\n this.positionX++;\n this.graphicalObject.position.x += (this.room.blockSize + this.room.blockGap);\n break;\n case 2:\n this.positionY++;\n this.graphicalObject.position.z += (this.room.blockSize + this.room.blockGap);\n break;\n case 3:\n this.positionX--;\n this.graphicalObject.position.x -= (this.room.blockSize + this.room.blockGap);\n break;\n }\n this.correctHeight();\n }\n }", "function frame() {\n console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function drawGameChar()\n{\n\t// draw game character\n\tif (isLeft && isFalling)\n\t{\n\t\t// add your jumping-left code\n fill(232, 198, 135);\n var head_pos = 17.5\n rect(gameChar_x - head_pos, gameChar_y - 60, 35,35); // Head\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n var body_x = gameChar_x - head_pos + 2;\n var body_y = gameChar_y - 25;\n fill(76, 116, 191);\n rect(body_x - 4, body_y, 10,10); // Left arm\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n fill(76, 116, 191);\n rect(body_x + 25, body_y, 10,10); // right arm\n fill(120, 85, 22);\n rect(gameChar_x - head_pos - 1, gameChar_y -10 , 12, 10); // left leg\n rect(gameChar_x - head_pos + 21 , gameChar_y -10 , 12, 10); // right leg\n\t}\n\telse if (isRight && isFalling)\n\t{\n\t\t// add your jumping-right code\n fill(232, 198, 135);\n var head_pos = 17.5\n rect(gameChar_x - head_pos, gameChar_y - 60, 35,35); // Head\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n var body_x = gameChar_x - head_pos + 2;\n var body_y = gameChar_y - 25;\n fill(76, 116, 191);\n rect(body_x + 25, body_y, 10,10); // right arm\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n fill(76, 116, 191);\n rect(body_x - 4, body_y, 10,10); // Left arm\n fill(120, 85, 22);\n rect(gameChar_x - head_pos + 2 , gameChar_y -10 , 12, 10); // left leg\n rect(gameChar_x - head_pos + 21 + 3, gameChar_y -10 , 12, 10); // right leg\n\t}\n\telse if (isLeft)\n\t{\n\t\t// add your walking left code\n fill(232, 198, 135);\n var head_pos = 17.5\n rect(gameChar_x - head_pos, gameChar_y - 60, 35,35); // Head\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n var body_x = gameChar_x - head_pos + 2;\n var body_y = gameChar_y - 25;\n fill(76, 116, 191);\n rect(body_x - 4, body_y, 10,10); // Left arm\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 18); // Body\n fill(76, 116, 191);\n rect(body_x + 25, body_y, 10,10); // right arm\n fill(120, 85, 22);\n rect(gameChar_x - head_pos -1 , gameChar_y -7 , 12, 10); // left leg\n rect(gameChar_x - head_pos + 21, gameChar_y -7 , 12, 10); // right leg \n\t}\n\telse if (isRight)\n\t{\n\t\t// add your walking right code\n fill(232, 198, 135);\n var head_pos = 17.5\n rect(gameChar_x - head_pos, gameChar_y - 60, 35,35); // Head\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n var body_x = gameChar_x - head_pos + 2;\n var body_y = gameChar_y - 25;\n fill(76, 116, 191);\n rect(body_x + 25, body_y, 10,10); // right arm\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 18); // Body\n fill(76, 116, 191);\n rect(body_x - 4, body_y, 10,10); // Left arm\n fill(120, 85, 22);\n rect(gameChar_x - head_pos +2 , gameChar_y -7 , 12, 10); // left leg\n rect(gameChar_x - head_pos + 24, gameChar_y -7 , 12, 10); // right leg \n\t}\n\telse if (isFalling)\n\t{\n\t\t// add your jumping facing forwards code\n fill(232, 198, 135);\n var head_pos = 17.5\n var body_x = gameChar_x - head_pos + 2;\n var body_y = gameChar_y - 25;\n rect(gameChar_x - head_pos, gameChar_y - 60, 35,35); // Head\n fill(207, 50, 29);\n fill(76, 116, 191);\n rect(body_x + 25, body_y, 10,10); // right arm\n rect(body_x - 4, body_y, 10,10); // Left arm\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 15); // Body\n fill(120, 85, 22);\n rect(gameChar_x - head_pos -1 , gameChar_y -10 , 12, 10); // left leg\n rect(gameChar_x - head_pos + 21 + 3, gameChar_y -10 , 12, 10); // right leg \n\t}\n\telse\n\t{\n\t\t// add your standing front facing code\n fill(232, 198, 135);\n var head_pos = 17.5\n var body_x = gameChar_x - head_pos + 2;\n var body_y = gameChar_y - 25;\n rect(gameChar_x - head_pos, gameChar_y - 60, 35,35); // Head\n fill(76, 116, 191);\n rect(body_x + 25, body_y, 10,10); // right arm\n rect(body_x - 4, body_y, 10,10); // Left arm\n fill(207, 50, 29);\n rect(gameChar_x - head_pos + 2, gameChar_y - 25 , 31, 18); // Body\n fill(120, 85, 22);\n rect(gameChar_x - head_pos + 2, gameChar_y -7 , 12, 10); // left leg\n rect(gameChar_x - head_pos + 21, gameChar_y -7 , 12, 10); // right leg \n\t}\n}", "function keyPressed()\n{\n if(keyCode===RIGHT_ARROW)\n {\n\t Matter.Body.applyForce(ball,{x:0,y:0},{x:0.05,y:0});\n }\n}", "function frame() {\n //console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos++; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function animate(){\n\trequestAnimationFrame(animate);\n\t// Keyboard movement inputs\n\tif(keyboard[87]){ // W key\n\t\tcamera.position.x -= Math.sin(camera.rotation.y) * player.speed;\n\t\tcamera.position.z -= -Math.cos(camera.rotation.y) * player.speed;\n\t}\n\tif(keyboard[83]){ // S key\n\t\tcamera.position.x += Math.sin(camera.rotation.y) * player.speed;\n\t\tcamera.position.z += -Math.cos(camera.rotation.y) * player.speed;\n\t}\n\tif(keyboard[65]){ // A key\n\t\t// Redirect motion by 90 degrees\n\t\tcamera.position.x += Math.sin(camera.rotation.y + Math.PI/2) * player.speed;\n\t\tcamera.position.z += -Math.cos(camera.rotation.y + Math.PI/2) * player.speed;\n\t}\n\tif(keyboard[68]){ // D key\n\t\tcamera.position.x += Math.sin(camera.rotation.y - Math.PI/2) * player.speed;\n\t\tcamera.position.z += -Math.cos(camera.rotation.y - Math.PI/2) * player.speed;\n\t}\n\t\n\t// Keyboard turn inputs\n\tif(keyboard[37]){ // left arrow key\n\t\tcamera.rotation.y -= player.turnSpeed;\n\t}\n\tif(keyboard[39]){ // right arrow key\n\t\tcamera.rotation.y += player.turnSpeed;\n\t}\n\t//rotacion de cada objeto en la escena\n\tfor ( var i in objetos ) {\n\t\t//objetos[i].rotation.x += objetos[i].velx;\n \t\tobjetos[i].rotation.y += objetos[i].vely;\n\t}\n\trenderer.render(scene, camera);\n}", "function nextFrameX(){\n\tif(_x<(1-_offsetX*2) && _x>=0) _x+=_offsetX;\n\telse _x=0;\n\trenderer.material.mainTextureOffset= Vector2(_x,_y);\n}", "function nextFrame() {\r\n if (rot.inProgress) {\r\n advanceRotation();\r\n } else {\r\n if (mouse.down)\r\n nextFrameWithMouseDown();\r\n else\r\n nextFrameWithMouseUp();\r\n }\r\n }", "function panToLeft(){\n\tgainL.gain.value = 1;\n\tgainR.gain.value = 0;\n}", "constructor(){\n this.width = 50;\n this.height = 50;\n this.x = 100;\n this.y = gameWindow.height - this.height;\n this.dx = 0;\n this.dy = 0;\n this.faceLeft = false; // is character facing left\n this.airborne = false;\n this.maxJumps = 2;\n this.avaliableJumps = this.maxJumps;\n this.armY = 5; // where is the Bearer's arm from this.y\n this.firing = false; // in case I want to create a sprite of the Bearer firing the Backscatter Buster\n}", "function goRight() {\n\t\tz.style.background = 'green';\n\t}", "display(){\r\n//give the condition to make the bow move up\r\nif (keyIsDown(UP_ARROW) && this.angle < 2){\r\n//change the value of angle\r\nthis.angle += 0.02;\r\n}\r\n//give the condition to make the bow move down\r\nif (keyIsDown(DOWN_ARROW) && this.angle > 1){\r\n//change the value of angle\r\nthis.angle -= 0.02;\r\n}\r\n//declare a sample variable\r\nvar place = this.body.position;\r\n//mention the required color to be filled in the object\r\nfill(\"black\");\r\n//create the push function\r\npush();\r\n//translate the positions\r\ntranslate(place.x, place.y);\r\n//define rotate function\r\nrotate(this.angle);\r\n//define the imageMode of the object\r\nimageMode(CENTER);\r\n//command to display the image\r\nimage(this.image, 0, 0, this.w, this.h);\r\n//create the pop function\r\npop();\r\n}", "moveLeft() { this.velX -= 0.55; this.dirX = -1; }", "function drawBirdRight(speedBird) {\n drawBackground();\n birdR.display();\n birdR.x -= speedBird;\n if (birdR.x <= 100-birdR.x/3) {\n birdR.x = 1000;\n }\n }", "function updateAnimatedCharacter() {\n var ctx = hangmanGame.canvas.getContext(\"2d\");\n\n ctx.drawImage(character.image, 400 * character.frame, 0, 400, 400, 310, 15, 200, 200);\n\n if (hangmanGame.frameCount % 25 === 0) {\n if (character.frame === 0) {\n character.frame++;\n } else {\n character.frame = 0;\n }\n }\n}", "function animate() {\n requestAnimFrame(animate);\n game.background.draw();\n game.robot.move(); \n}", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime; \n rotAngle= (rotAngle+1.0) % 360;\n }\n var elapsed=timeNow-lastTime;\n lastTime = timeNow;\n \n //when framecount is less than 120, the effect is just rotation\n //when framecount is between 120 to 240, the effect is shaking from left to right\n //when framecount is between 240 to 360, the effect is enlarging from left to right\n //when framecount is between 360 to 480, the effect is shaking hands\n //when framecount is between 480 to 600, the effect is enlargeing from top to bottom\n //then repeat\n days=days+0.01;\n if(framecount>=120 && framecount <240){\n updateBuffers();\n \n } \n if(framecount>=240 && framecount <360) {\n updateBuffers1();\n updatecolor();\n\n }\n if(framecount>=360 && framecount <480){\n updateBuffers2();\n }\n if (framecount >=480 && framecount < 600) {\n \n updateBuffers3();\n updatecolor();\n \n }\n \n \n \n}", "goRight() {\n if (this.x > 800) {\n this.x = -this.width * 5;\n this.carMadeIt = true;\n\n //5% chance of turning right\n if (Math.floor((Math.random() * probability)) == 1) {\n this.turnRight = true;\n }\n\n //go left\n if (Math.floor((Math.random() * probability)) == 1) {\n this.turnLeft = true;\n this.turnRight = false;\n }\n\n } else {\n this.carMadeIt = false;\n }\n\n //Count the cars that made it\n if (this.carMadeIt) {\n carsMadeIt += 1;\n this.carMadeIt = false;\n }\n //\n // if (this.acceleration.x < .3 && this.velocity.x < 3) {\n // this.acceleration.x = (parseFloat(this.acceleration.x) + parseFloat(.008)).toFixed(2);\n // this.velocity.x = (parseFloat(this.velocity.x) + parseFloat(this.acceleration.x)).toFixed(2);\n // }\n // this.x = (parseFloat(this.velocity.x) + parseFloat(this.x)).toFixed(1);\n\n this.x += this.speed;\n }", "function updateFrame() {\n // TODO: INSERT CODE TO UPDATE ANY OTHER DATA USED IN DRAWING A FRAME\n y += 0.3;\n if (y > 60) {\n y = -50;\n }\n frameNumber++;\n}", "move()\n {\n if(keyCode === 39)\n {\n Matter.body.applyForce(this.body,{x:40,y:-30});\n }\n\n if(keyCode === 37)\n {\n Matter.body.applyForce(this.body,{x:-40,y:-30});\n }\n }" ]
[ "0.6988162", "0.6734525", "0.67239493", "0.67080015", "0.6569484", "0.64698386", "0.6454202", "0.6439852", "0.6434033", "0.637835", "0.6367711", "0.63643557", "0.63638145", "0.6348461", "0.6297219", "0.62657034", "0.6243334", "0.62404716", "0.62372714", "0.62338144", "0.6220979", "0.6202761", "0.6196122", "0.61937904", "0.61800486", "0.61787313", "0.61737776", "0.6169665", "0.61087066", "0.61080253", "0.60819143", "0.6081308", "0.60605514", "0.6055949", "0.60450375", "0.6042581", "0.6025849", "0.6022721", "0.6021111", "0.60174465", "0.6011802", "0.60059756", "0.6002968", "0.59980315", "0.5993902", "0.59932446", "0.5989935", "0.5988602", "0.5973964", "0.59698856", "0.5960135", "0.595881", "0.59564453", "0.5948059", "0.59431857", "0.5934384", "0.59338105", "0.5927024", "0.59265184", "0.59261274", "0.59248954", "0.5923592", "0.5915578", "0.5911033", "0.5906565", "0.5902491", "0.5896", "0.58953863", "0.58938277", "0.58915365", "0.5891043", "0.5889483", "0.58887076", "0.5886536", "0.5884856", "0.58827287", "0.58769125", "0.58764607", "0.5862775", "0.58613735", "0.5854913", "0.58547574", "0.58521706", "0.5851233", "0.5845162", "0.58441997", "0.584233", "0.58384097", "0.5824873", "0.582456", "0.58076596", "0.5806654", "0.58039504", "0.5795194", "0.5790912", "0.5787119", "0.5786923", "0.5783734", "0.5778205", "0.57770735" ]
0.71798813
0
frames for when character is facing left
leftState(){ this.state = "left"; this.animationTime = 40; this.currentFrameNum = 0; this.currentFrameY = 553; this.currentFrameX = 0; this.frameHeight = 114; this.frameWidth = 94; this.maxFrame = 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "left() {\n // If the LEFT key is down, set the player velocity to move left\n this.sprite.body.velocity.x = -this.RUN_SPEED;\n //this.animate_walk();\n }", "leftTurn() {\r\n this.fltire.rotateY(16);\r\n this.frtire.rotateY(16);\r\n }", "turnLeft() {\n this._currentLinearSpeed = 0;\n this._currentAngularSpeed = this._angularSpeed;\n }", "function touchingLeft(){\n if (megamanXPos <= megamanWidth/2){\n megamanXSpeed = 0;\n megamanXPos = megamanWidth/2;\n }\n }", "function playerLeft() {\n\tadjustPlayer(0, -1);\n}", "rightState(){\n\n this.state = \"right\";\n this.animationTime = 40;\n this.currentFrameNum = 0;\n this.currentFrameY = 436;\n this.currentFrameX = 0;\n this.frameHeight = 114;\n this.frameWidth = 94;\n this.maxFrame = 9;\n }", "moveLeft() { this.velX -= 0.55; this.dirX = -1; }", "frame () {\n\t\t// If th bonuss is without life, dn't move it.\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direction.rotate(this.rotationSpeed))\n\t}", "function frame() {\n\t\tleft += 2.5;\n\t\t//opacity += 0.02;\n\t\tanimal.style.left = left + 'px';\n\t\t//txt.style.opacity = opacity;\n\t\tif (left >= 15) {\n\t\t\tclearInterval(interval);\n\t\t\tanimal.style.left = \"15px\";\n\t\t\t//txt.style.opacity = 1;\n\t\t\tspots_disabled = false;\n\t\t\tfadein_text();\n\t\t}\n\t}", "handleheroFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "function walkingLeft() {\n// Working on a good animation technqiue; tricky with a single thread!\n//user.src = \"stickfigureart/runl1.png\";\n//setTimeout(donothing, 5);\n//user.src = \"stickfigureart/runl2.png\";\n//setTimeout(donothing, 5);\n user.src = \"stickfigureart/runl3.png\";\n//setTimeout(donothing, 5);\n}", "turnLeft(){\n this.orientation--;\n if(this.orientation < 0){\n this.orientation = 3;\n }\n this.graphicalObject.rotateY(Math.PI/2);\n }", "left() {\n if (!this.isOnTabletop()) return;\n if (!this.facing) return;\n let degree=FacingOptions.facingToDegree(this.facing);\n degree-=90;\n this.facing=FacingOptions.degreeToFacing(degree);\n }", "turnLeft() {\n if (DIRECTIONS.indexOf(this.position.heading) === 0) {\n this.position.heading = DIRECTIONS[3];\n } else {\n this.position.heading =\n DIRECTIONS[DIRECTIONS.indexOf(this.position.heading) - 1];\n }\n }", "function turnL() {if(--facing < 0) {facing = 3}}", "function walk(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.z\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.z\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.z\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.z\r\n });\r\n xSlide.setKeys(keyFrames);\r\n\r\n\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n \r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n \r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "handlePlayerFrame(){\n if(this.speedY < 0){\n this.frameY = 3\n }else{\n this.frameY = 0\n }\n if (this.frameX < 3){\n this.frameX++\n } else {\n this.frameX = 0\n }\n }", "moveLeft() {\n\n if (this.posX >= 10 && pause == false)\n this.posX = this.posX - 5;\n }", "move_player(graphics_state,dt)\r\n {\r\n let temp = Mat4.inverse( graphics_state.camera_transform);\r\n this.battle = temp;\r\n this.battle = this.battle.times(Mat4.translation([0,0,-3]));\r\n //let origin = Vec.of(0,0,0,1);\r\n //temp = temp.times(origin);\r\n \r\n let origin = Vec.of(0,0,0,1);\r\n let char_pos = temp.times(origin);\r\n //console.log(char_pos);\r\n \r\n if(this.rotate_right == true)\r\n {\r\n temp = temp.times(Mat4.rotation( -0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation + 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_right = false;\r\n }\r\n if(this.rotate_left == true)\r\n {\r\n temp = temp.times(Mat4.rotation( 0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation - 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_left = false;\r\n }\r\n\r\n if(this.move_forward == true)\r\n {\r\n \r\n this.velocity = this.velocity.plus(Vec.of(0,0,-0.2*dt));\r\n \r\n /*else\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n }*/\r\n }\r\n if(this.move_backward == true)\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0,0,0.2*dt));\r\n \r\n //else\r\n //{\r\n //this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n //}\r\n }\r\n let old_temp = temp;\r\n temp = temp.times(Mat4.translation(this.velocity));\r\n char_pos = temp.times(origin);\r\n if(this.out_of_bounds(char_pos) == true || this.finished == false)\r\n {\r\n temp = old_temp;\r\n }\r\n if(this.check_door(char_pos) == true)\r\n {\r\n this.touching_door = true;\r\n }\r\n if(this.check_enemy(char_pos) == true && this.touching_door == false)\r\n {\r\n this.touching_enemy = true;\r\n this.enemy = this.map[this.player_room[0]][this.player_room[1]].enemy_type;\r\n this.finished = false;\r\n }\r\n if(this.check_key(char_pos) == true)\r\n {\r\n this.touching_obj = true;\r\n }\r\n temp = Mat4.inverse(temp);\r\n \r\n return temp;\r\n }", "playerFrame() {\n // console.log(this.moving);\n if (!this.moving) {\n this.frameY = 1\n if (this.frameX === 5) {\n this.frameX = 0\n }\n else if (this.frameX === 11) {\n this.frameX = 6\n }\n else if (this.frameX === 17) {\n this.frameX = 12\n }\n else if (this.frameX >= 23){\n this.frameX = 18\n }\n }\n if (this.frameX > 22) {\n this.frameX = 0\n }\n this.frameX++ // TODO: this bugs out when holding not dir keys and running into walls\n }", "function moveLeft() {\n\n\t\ttry {\n\t\t // Pass in the movement to the game.\n\t\t animation.move(\"x\", moveTypes.left);\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(err);\n\t\t}\n\t}", "moveDeerLeft() {\r\n if (this.detectCollisions(this.collidables) != true) {\r\n this.renderer.render(this.scene, this.camera);\r\n\r\n if (this.deerL.position.z < 230) {\r\n this.deerL.translateX(-0.6);\r\n this.deerL.translateZ(.35);\r\n this.deerL.translateY(-0.04);\r\n } else {\r\n cancelAnimationFrame(() => this.moveDeerLeft());\r\n this.scene.remove(this.deerL);\r\n }\r\n\r\n requestAnimationFrame(() => this.moveDeerLeft());\r\n }\r\n }", "function accelLeft(n){\n hero.facingRight = false;\n if(hero.xVel > 0 && hero.onGround){\n hero.xVel = 0;\n }\n hero.xVel -= n;\n if(hero.xVel < -1*hero.maxSpeed){\n hero.xVel = -1*hero.maxSpeed;}\n}", "function walk2(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.x\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.x\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.x\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.x\r\n });\r\n\r\n xSlide.setKeys(keyFrames);\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n\r\n\r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3*Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3 * Math.PI / 2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function uenemy(g){\n if(g.x <= g.leftLimit) {\n g.body.velocity.x = 100;\n g.animations.play('right');\n\n } else if (g.x >= g.rightLimit) {\n g.body.velocity.x = -100;\n g.animations.play('left');\n }\n }", "function moveLeft() {\r\n player.xCenter = player.xCenter - 1//player.xCenter + Math.cos((player.angle + 270) * Math.PI / 180)\r\n //player.yCenter = player.yCenter + Math.sin((player.angle + 270) * Math.PI / 180)\r\n}", "handleDragonFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "returnFromLeft() {\r\n this.fltire.rotateY(-16);\r\n this.frtire.rotateY(-16);\r\n }", "function fireLeft(){\n\t\tconsole.log(\"firing\");\n\t\tdart1.style.left = \"-200px\";\n\t\tdart2.style.left = \"-400px\";\n\t\tdart3.style.left = \"-600px\";\n\t\tdart4.style.left = \"-550px\";\n\t}", "rotateLeft() {\r\n if (this.actual.rotateLeft()) {\r\n this.sounds.play(\"rotate\");\r\n }\r\n }", "frame () {\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direction.rotate(this.rotationSpeed));\n\t}", "nextFrame(){\n if(this.health > 0){\n this.shear = this.vel.vector[0] / 2.5;\n /*\n --HERE' S A LITTLE KEY INDEX THING--\n -32: SPACEBAR\n -37: LEFT ARROW\n -38: UP ARROW\n -39: RIGHT ARROW\n -68: 'D' KEY\n -81: 'Q' KEY\n -90: 'Z' KEY\n */\n if(this.color == '#FF3333'){\n this.counter += 1;\n if(this.counter >= 180){\n this.counter = 0;\n this.color = \"#FFCC33\"\n }\n }\n if(keys[37] || keys[81]){\n this.vel.vector[0] += 0 - ((this.vel.vector[0] >= 0 - this.xstep) && !this.wallLeft ? this.accel : 0);\n }\n if(keys[39] || keys[68]){\n this.vel.vector[0] += ((this.vel.vector[0] <= this.xstep) && !this.wallRight ? this.accel : 0);\n }\n if(!keys[39] && !keys[37] && !keys[68] && !keys[81]){\n this.vel.vector[0] = this.vel.vector[0] * this.xfriction;\n }\n \n //check if thing is at borders of screen to set x-vel 0\n if(this.pos.vector[0] < 0){\n this.pos.vector[0] = 0;\n this.vel.vector[0] = 0;\n }\n if(this.pos.vector[0] > canvas.width - this.width){\n this.pos.vector[0] = canvas.width - this.width;\n this.vel.vector[0] = 0;\n }\n if((keys[38] || keys[32] || keys[90]) && this.grounded){\n this.vel.vector[1] -= this.jumph;\n }\n this.vel.vector[1] += this.grounded ? 0 : this.gravity;\n this.pos.plus(this.vel);\n }\n }", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "turnLeft() {\n this.direction++;\n this.direction = this.direction.mod(4);\n }", "throwBottleLeft() {\n this.speedY = 30;\n this.applyGravity();\n this.the_throw = setInterval(() => {\n if (this.bottleIsCracked || !this.isAboveGround()) {\n this.splashBottle();\n } else\n this.playAnimation(this.IMAGES_ROTATION);\n this.x -= 8;\n }, 25);\n }", "function Attack()\n{\n\tvar speedTowardsPlayer = moveSpeed;\n\t\n\t//if enemy is on the right side of the player move left\n\tif(player.transform.position.x < transform.position.x)\n\t{\n\t\tfacingLeft = true;\n\t\tspeedTowardsPlayer = -speedTowardsPlayer;\n\t\trenderer.material.mainTexture = mainTextures[curFrame]; // Get the current animation frame\n\t}\n\t//if enemy is on the left side of the player move right\n\telse\n\t{\n\t\tfacingLeft = false;\n\t\trenderer.material.mainTexture = altTextures[curFrame]; // Get the current animation frame\n\t}\n\t\t\n\trigidbody.velocity = Vector3(speedTowardsPlayer, rigidbody.velocity.y, 0); // Move to the left\n}", "function b_left() {\nhero.x = hero.x - 5\n\n}", "function catWalkLeft() {\n \n var oldLeft = parseInt(img.style.left);\n var newLeft = oldLeft - 10;\n img.style.left = newLeft + 'px';\n \n if (newLeft == -300) {\n clearInterval(timer2);\n superman.setAttribute(\"class\", \"\"); // off superman gif\n img.src = 'http://www.anniemation.com/clip_art/images/cat-walk.gif'\n timer = setInterval(catWalkRight, 50);\n };\n}", "function moveLeft() {\n testplayer.velocityX -= 0.5;\n}", "update() {\n frames = 0;\n this.moveDown();\n }", "function stepLeft() {\n\n if ( leftNumber > 0 ) {\n DODGER.style.left = `${leftNumber -= 4}px`; // decrement position number in inner scope and return decremented value into string '${/\\d+/}px'\n window.requestAnimationFrame(stepLeft);\n }\n }", "rotateLeft(value){\n let rotation = value / 90;\n this.facing = (this.facing + rotation) % 4\n }", "function frame() {\n\n frameCount++;\n increment = 22 - frameCount; // move faster every frame\n\n if (increment < 2) increment = 2;\n\n deltaX += increment;\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n if (deltaX >= 100) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n\n // end animation\n if (deltaX >= 215) {\n clearInterval(animation);\n menuToggleBar.style.width = (220 - 40) + 'px';\n menu.style.right = 0 + 'px';\n deltaX = 220;\n isMenuAnimating = false;\n\n }\n }", "function moveLeft() {\r\n moveTo(player.x - 1, player.y);\r\n}", "goLeft() {\n gpio.write(this.motors.rightFront, true);\n }", "goLeft() {\n if (this.x <= 0) {\n this.x = 800 + this.width * 5;\n this.carMadeIt = true;\n\n //5% chance of turning right\n if (Math.floor((Math.random() * probability)) == 1) {\n this.turnRight = true;\n }\n\n //5% chance of turning right\n // if (true) {\n // this.turnRight = false;\n // this.turnLeft = true;\n // }\n\n } else {\n this.carMadeIt = false;\n }\n\n if (this.carMadeIt) {\n carsMadeIt += 1;\n this.carMadeIt = false;\n }\n this.x -= this.speed;\n }", "rotateLeft() {\n if (this.direction !== Constants.SKIER_DIRECTIONS.CRASH && this.direction > Constants.SKIER_DIRECTIONS.LEFT) {\n this.setDirection(this.direction - 1);\n }\n }", "moveLeft() {\n if (!this.collides(-1, 0, this.shape)) this.pos.x--\n }", "function userLeft() {\n if (!isStopped) {\n FallingShape.moveLeft();\n drawGame();\n }\n }", "function frame() {\n console.log(\"zaim\");\n if (pos == z) {\n clearInterval(id);\n } else {\n pos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = pos+\"px\"; \n x=pos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function updateAnimation(){\n // scan keyboard\n keyboard.update();\n\n const steps = 50;\n\n // max values\n const maxHeight = 3;\n const handMove = 1.5;\n const headRotate = 1;\n const legRotate = 2.6;\n const downHeight = 0.8;\n const bodyRotate = 0.4;\n const characterRotate = 2;\n\n // Different animation based on keyboard input\n if (character != null){\n //character.rotation.y += 0.002;\n\n // If press 'up', the character jump up and move right\n if (upCount > 0){\n upCount--;\n var parabola = (0.25-(upCount/steps-0.5)*(upCount/steps-0.5));\n character.position.y = maxHeight * parabola;\n leftHand.position.x = -handMove * parabola;\n leftHand.position.y = handMove * parabola;\n rightHand.position.x = handMove * parabola;\n rightHand.position.y = handMove * parabola;\n head.rotation.x = -headRotate * parabola;\n character.position.x += 0.03;\n camera.position.x += 0.03;\n light.position.x += 0.03;\n }\n\n // If press 'down', the character goes down and move right\n else if (downCount > 0){\n downCount--;\n var parabola = (0.25-(downCount/steps-0.5)*(downCount/steps-0.5));\n leftLegPivot.rotation.z = -legRotate * parabola;\n rightLegPivot.rotation.z = legRotate * parabola;\n character.position.y = -downHeight * parabola;\n var handDist = handMove * parabola;\n leftHand.position.set(3 * handDist, -2.5 * handDist, 2.5 * handDist);\n rightHand.position.set(2 * handDist, handDist, -2 * handDist);\n head.rotation.x = headRotate * parabola;\n head.rotation.z = headRotate * parabola;\n body.rotation.x = bodyRotate * parabola;\n character.position.x += 0.03;\n camera.position.x += 0.03;\n light.position.x += 0.03;\n }\n\n // If press 'left', character jump and spin a circle and move right\n else if (leftCount > 0){\n leftCount--;\n var parabola = (0.25-(leftCount/steps-0.5)*(leftCount/steps-0.5));\n character.position.y = maxHeight * parabola;\n leftHand.position.x = -2 * handMove * parabola;\n rightHand.position.x = 2 * handMove * parabola;\n character.rotation.y = -(steps - leftCount) * 2 * Math.PI / steps;\n character.position.x += 0.03;\n camera.position.x += 0.03;\n light.position.x += 0.03;\n }\n\n // If press 'right', character rotate, move right, and rotate back\n else if (rightCount > 0){\n rightCount--;\n if (rightCount >= 75) {\n character.rotation.y += Math.PI / 50;\n }\n else if (legCount > 0){\n legCount--;\n var parabola = (0.25-(legCount/steps-0.5)*(legCount/steps-0.5));\n rightLegPivot.rotation.x = -legRotate * parabola;\n leftLegPivot.rotation.x = legRotate * parabola;\n leftHand.position.z = 3 * handMove * parabola;\n rightHand.position.z = -3 * handMove * parabola;\n character.position.x += 0.05;\n camera.position.x += 0.05;\n light.position.x += 0.05;\n }\n else {\n character.rotation.y += -Math.PI / 50;\n }\n }\n\n else{\n character.position.y = 0;\n character.rotation.y = 0;\n if ( keyboard.pressed('up') ) {\n // jump\n upCount = steps;\n console.log(\"Jump\");\n }\n else if ( keyboard.pressed('down') ) {\n // go down\n downCount = steps;\n console.log(\"Down\");\n }\n else if ( keyboard.pressed('left') ) {\n // move left\n leftCount = steps;\n console.log(\"Left (for audience)\");\n }\n else if ( keyboard.pressed('right') ) {\n // move right\n rightCount = 2 * steps;\n legCount = steps;\n console.log(\"Right (for audience)\");\n }\n }\n\n // When the camera move close to the edge of the plane and there is no connected plane to its right, create new connect ground to ensure that there is always a ground and a back wall in the camera\n if (camera.position.x > (50 * (rightStageCount - 1))){\n createNewStage();\n }\n }\n}", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function characterHitAnimation(charHit, leftOrRight) {\n switch (leftOrRight) {\n case 'left':\n charHit.imageElement.animate({\n left: \"-200px\"\n }, 100, function (event) {\n charHit.imageElement.animate({\n left: \"-140px\"\n }, 100, function (event) {\n charHit.imageElement.animate({\n left: \"-180px\"\n });\n });\n });\n break;\n case 'right':\n charHit.imageElement.animate({\n right: \"-200px\"\n }, 100, function (event) {\n charHit.imageElement.animate({\n right: \"-140px\"\n }, 100, function (event) {\n charHit.imageElement.animate({\n right: \"-180px\"\n });\n });\n });\n break;\n default:\n break;\n }\n}", "animate () {\n this.x -= this.speed * 5;\n if (this.x < -this.groundImage.width) \n this.x = 0;\n }", "function Slide(){\r\n Joey.changeAnimation(\"sliding\",Slide_Joey);\r\n CharacterMotion = \"Slide\"\r\n \r\n}", "press(dir) {\n if (dir) {\n this._game._right = true;\n this._game._rightAccelStep = 0;\n } else {\n this._game._left = true;\n this._game._leftAccelStep = 0;\n }\n }", "function btnLeftHandler() {\n if ((playerX > 0) && (!modoInverso)) {\n playerX -= 50;\n } else if (playerX < canvas.width-playerWidth) {\n playerX += 50;\n }\n}", "function moveLeft() {\n\n if (document.querySelector('.frame').classList.contains('right')) showMiddle();\n else showLeft();\n }", "function move_left() {\n\t check_pos();\n\t blob_pos_x = blob_pos_x - move_speed;\n\t}", "function moveLeft() {\n moveOn();\n }", "function frame1() { //het vakje \r\n\t\t\t\t\tif (pos == 350) {\r\n\t\t\t\t\t\tclearInterval(id); // stop tijd wanneer de positie 350 is bereikt\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpos++; // +1\r\n\t\t\t\t\t\tself1.oImg.style.left = pos + 'px'; // de px wordt bij de positie opgeteld\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}", "rightTurn() {\r\n this.fltire.rotateY(-16);\r\n this.frtire.rotateY(-16);\r\n }", "function turnL() {\n if(Pointer.dir == \"right\"){\n Pointer.dir = \"up\";\n } else if(Pointer.dir == \"down\") {\n Pointer.dir = \"right\";\n } else if(Pointer.dir == \"left\") {\n Pointer.dir = \"down\";\n } else if(Pointer.dir == \"up\") {\n Pointer.dir = \"left\";\n }\n}", "function moveLeft(){\n var left = parseInt(window.getComputedStyle(character).getPropertyValue(\"left\"));\n if(left>0){\n character.style.left = left - 2 + \"px\";\n }\n}", "function Start () { \r\n animation.wrapMode = WrapMode.Loop; \r\n animation.Stop(); \r\n Idle();\r\n}", "function moveToLeft() {\n picture.animate(\n [\n { transform: 'translateX(-10vh)', opacity: 0 },\n { transform: 'translateX(0)', opacity: 1 },\n ],\n {\n duration: 700,\n easing: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',\n fill: 'both',\n }\n );\n}", "function tick(){\n\t\tframes++;\n\t\t//periodically, fire darts!\n\t\tif(frames % 280 == 0){\n\t\t\tfireLeft();\n\t\t}\n\t\tif(frames % 230 == 0){\n\t\t\tfireRight();\n\t\t}\n\t\t\n\t\t// dart speed\n\t\tvar DARTSPEED = 18;\n\t\t//every frame, advance darts\n\t\tvar x1 = parseInt(dart1.style.left);\n\t\tx1 += DARTSPEED;\n\t\tdart1.style.left = x1 + \"px\";\n\t\tvar x2 = parseInt(dart2.style.left);\n\t\tx2 += DARTSPEED;\n\t\tdart2.style.left = x2 + \"px\";\n\t\tvar x3 = parseInt(dart3.style.left);\n\t\tx3 += DARTSPEED;\n\t\tdart3.style.left = x3 + \"px\";\n\t\tvar x4 = parseInt(dart4.style.left);\n\t\tx4 += DARTSPEED;\n\t\tdart4.style.left = x4 + \"px\";\n\t\t\n\t\tvar x5 = parseInt(dart5.style.left);\n\t\tx5 -= DARTSPEED;\n\t\tdart5.style.left = x5 + \"px\";\n\t\tvar x6 = parseInt(dart6.style.left);\n\t\tx6 -= DARTSPEED;\n\t\tdart6.style.left = x6 + \"px\";\n\t\tvar x7 = parseInt(dart7.style.left);\n\t\tx7 -= DARTSPEED;\n\t\tdart7.style.left = x7 + \"px\";\n\t\tvar x8 = parseInt(dart8.style.left);\n\t\tx8 -= DARTSPEED;\n\t\tdart8.style.left = x8 + \"px\";\n\t\t\n\t}", "moveLeft() {\n if (this.x === 0) {\n this.x = this.tape[0].length - 1;\n } else {\n this.x--;\n }\n }", "function Update() \n{\n\t// Save the state in playing now.\n stateInfo = chrAnimator.GetCurrentAnimatorStateInfo(0);\n\n\t// character moves\n\tvar h : float = Input.GetAxis(\"Horizontal\");\n\tvar v : float = Input.GetAxis(\"Vertical\");\n\tvar axisInput : Vector3 = Vector3(h, 0, v);\n\n\tvar moveSpeed : float = (h*h+v*v) * 0.25;\n\tif(Input.GetButton(\"Fire2\"))\tmoveSpeed += 0.75;\t// for Run\n\n\tchrAnimator.SetFloat(\"Speed\", moveSpeed);\n\n\t// character rotate\n\tif(h + v != 0){\n\t\tif(stateInfo.IsTag(\"InMove\") || stateInfo.IsTag(\"InJump\")){\n\t\t\taxisInput = Camera.main.transform.rotation * axisInput;\n\t\t\taxisInput.y = 0;\n\t\t\ttransform.forward = axisInput;\n\t\t}\n\t}\n\t//transform.Rotate(0, h * rotateSpeed, 0);\n\t\n\t// Bool parameter reset to false. \n\tif(!stateInfo.IsTag(\"InIdle\")){\n\t\tchrAnimator.SetBool(\"LookAround\", false);\n\t\tchrAnimator.SetBool(\"Attack\", false);\n\t\tchrAnimator.SetBool(\"Jiggle\", false);\n\t\tchrAnimator.SetBool(\"Dead\", false);\n\t}\n\n\t// reaction of key input.\n\t// for Attack\n\tif(Input.GetButtonDown(\"Fire1\"))\tchrAnimator.SetBool(\"Attack\", true);\n \n\t// LookAround\n\tif(Input.GetKeyDown(\"z\"))\tchrAnimator.SetBool(\"LookAround\", true);\n\t// Jiggle\n\tif(Input.GetKeyDown(\"x\"))\tchrAnimator.SetBool(\"Jiggle\", true);\n\n\t// Happy!!\n\tif(Input.GetKeyDown(\"c\"))\n\t{\n\t\tchrAnimator.SetBool(\"Happy\", !chrAnimator.GetBool(\"Happy\"));\n\t\tif(chrAnimator.GetBool(\"Happy\") == true)\tchrAnimator.SetBool(\"Sad\", false);\n\t}\n\t// Sad\n\tif(Input.GetKeyDown(\"v\"))\n\t{\n\t\tchrAnimator.SetBool(\"Sad\", !chrAnimator.GetBool(\"Sad\"));\n\t\tif(chrAnimator.GetBool(\"Sad\") == true)\tchrAnimator.SetBool(\"Happy\", false);\n\t}\n\t\n\t// for Dead\n\tif(Input.GetKeyDown(\"b\"))\tchrAnimator.SetBool(\"Dead\", true );\n\n\t// for Jump\n\t// while in jump, I am using Character Controller instead Root Motion, to move the Character.\n\t// in ground.\n\tif(chrController.isGrounded){\n // jump parameter set to false.\n\t\tchrAnimator.SetInteger(\"Jump\", 0);\n // moveDirection set 0, to prevent to move by Character controller.\n\t\tmoveDirection = Vector3.zero;\n // press Jump button. make jump\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n\t}\n // While in Air\n else if(!chrController.isGrounded){\n // press Jump button. can jump once more.\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n // It is moved with Character Controller while in the air,\n // moveDirection is use Axis Input.\n\t\tmoveDirection = Vector3(axisInput.x * 4, moveDirection.y, axisInput.z * 4);\n\t\tmoveDirection.y -= gravity * Time.deltaTime;\n\t}\n\n // character is move by moveDirection.\n\tchrController.Move(moveDirection * Time.deltaTime);\n}", "function animations() {\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tif (arthur.goRight) {\n\t\tarthur.srcY = arthur.goRowRight * arthur.height;\n\t} else if (arthur.goLeft) {\n\t\tarthur.srcY = arthur.goRowLeft * arthur.height;\n\t} else if (arthur.duckRight) {\n\t\tarthur.srcY = arthur.duckRowRight * arthur.height;\n\t} else if (arthur.atkRight) {\n\t\tarthur.srcY = arthur.atkRowRight * arthur.height;\n\t} else if (arthur.jumpRight) {\n\t\tarthur.srcY = arthur.jumpRowRight * arthur.height;\n\t} else if (arthur.die) {\n\t\tarthur.srcY = arthur.dieRowRight * arthur.height;\n\t}\n}", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime; \n rotAngle= (rotAngle+1.0) % 360;\n }\n var elapsed=timeNow-lastTime;\n lastTime = timeNow;\n \n //when framecount is less than 120, the effect is just rotation\n //when framecount is between 120 to 240, the effect is shaking from left to right\n //when framecount is between 240 to 360, the effect is enlarging from left to right\n //when framecount is between 360 to 480, the effect is shaking hands\n //when framecount is between 480 to 600, the effect is enlargeing from top to bottom\n //then repeat\n days=days+0.01;\n if(framecount>=120 && framecount <240){\n updateBuffers();\n \n } \n if(framecount>=240 && framecount <360) {\n updateBuffers1();\n updatecolor();\n\n }\n if(framecount>=360 && framecount <480){\n updateBuffers2();\n }\n if (framecount >=480 && framecount < 600) {\n \n updateBuffers3();\n updatecolor();\n \n }\n \n \n \n}", "function panToLeft(){\n\tgainL.gain.value = 1;\n\tgainR.gain.value = 0;\n}", "function overgame()\r\n{\r\n TweenLite.to(gameOver, 2, {rotationX:360, transformOrigin:\"0% 50% -50%\",left:400, ease:Bounce.easeOut, delay:1});\r\n \r\n \r\n}", "function prevFrameX(){\n\tif(_x<=1 && _x>0) _x-=_offsetX;\n\telse _x=1-_offsetX;\n\trenderer.material.mainTextureOffset= Vector2(_x,_y);\n}", "function move(){\n\tif(left){\n\t\tif(player1.x >= 450){\n\t\t\tdiff -= speed;\n\t\t}else{\n\t\t\tplayer1.x += speed;\n\t\t}\n\t\tlastKey = \"left\";\n\t}\t\n\tif(right){\n\t\tif(player1.x <= 10){\n\t\t\tdiff += speed;\n\t\t}else{\n\t\t\tplayer1.x -= speed;\n\t\t}\n\t\tlastKey = \"right\";\n\t}\n}", "function frame() {\n\n frameCount++;\n deltaX += -frameCount; // move faster every frame\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n // move top nav bar if needed\n if (deltaX >= 110) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n // end menu bar animation\n else if (deltaX > 90 && deltaX < 110) {\n menuToggleBar.style.width = 60 + 'px';\n }\n // end slide menu animation\n else if (deltaX <= -5) {\n clearInterval(animation);\n menu.style.right = -220 + 'px';\n deltaX = 0;\n frameCount = 0;\n isMenuAnimating = false;\n }\n }", "animate() {\n setInterval(() => {\n this.moveLeft();\n }, 1000 / 60);\n }", "function moveLeft(){\n let initialPosLeft = witch.getBoundingClientRect().left;\n let lifeLeft = witch_lifeline.getBoundingClientRect().left;\n if(initialPosLeft > 32){\n witch_lifeline.style.left = lifeLeft - 20 + 'px';\n witch.style.left = initialPosLeft - 20 + 'px';\n }\n}", "function turnLeft() {\n baddie.classList.add(\"baddie-left\");\n }", "function forward(){\n if(curFrame <= frames.length-1)\n drawCurFrame();\n}", "move(){\n\n this.charY = windowHeight - 200;\n if (this.state === \"right\") this.charX += 4;\n if (this.state === \"left\") this.charX -= 4;\n \n }", "animate() {\r\n if(this.count>6) {\r\n this.count = 0;\r\n if(this.side) { //True = right\r\n if(this.image===this.idleRight) { //Idle changed to a moving sprite\r\n this.image = this.goRight; //Moving - to idle\r\n } else {\r\n this.image = this.idleRight;\r\n }\r\n } else {\r\n if (this.image===this.idleLeft) {\r\n this.image = this.goLeft;\r\n } else {\r\n this.image = this.idleLeft;\r\n }\r\n }\r\n }\r\n }", "function driveLeft(){\r\n if(carLookingFront()){\r\n document.getElementById(\"outputBox\").value=\"You have to TURN the car in the right direction!\";\r\n return false;\r\n } else {\r\n $(\"#car-icon\").animate({\r\n left: \"0\"\r\n }, 1500).removeClass(\"Moved\").css({right: ''});\n document.getElementById(\"outputBox\").value=\"Car goes wiiiiiiiiiii!!!!!\";\r\n fuel--;\r\n animateFuel();\r\n console.log(\"Fuel is \" + fuel);\r\n }\r\n}", "function fleft() { \n $(\"#flash\").css({\"transform\":\"translateX(0)\"});\n}", "checkAnimation(){\n if(this.keyboard.D.isDown){\n this.player.play(\"rightWalk\", true);\n }\n if(this.keyboard.A.isDown){\n this.player.anims.playReverse(\"rightWalk\",true);\n }\n if(this.keyboard.W.isDown && this.player.body.blocked.down){ \n this.player.play(\"jumping\",true);\n } \n if(this.keyboard.A.isUp && this.keyboard.D.isUp){ // Not moving x \n this.player.play(\"SS\",true);\n }\n\n this.isPlaying = true;\n }", "function Update () {\n\t// Get the input vector from keyboard or analog stick\n\tvar directionVector = new Vector3(Input.GetAxis(\"Horizontal\"), Input.GetAxis(\"Vertical\"), 0);\n\t\n\t_animation = GetComponent(Animation);\n\tif(!_animation){\n\t\t//Debug.Log(\"The character you would like to control doesn't have animations. Moving her might look weird.\");\n\t}\n\t\n\n\t\n\tif(!idleAnimation) {\n\t\t_animation = null;\n\t\t//Debug.Log(\"No idle animation found. Turning off animations.\");\n\t}\n\tif(!walkAnimation) {\n\t\t_animation = null;\n\t\t//Debug.Log(\"No walk animation found. Turning off animations.\");\n\t}\n\tif(!runAnimation) {\n\t\t_animation = null;\n\t\t//Debug.Log(\"No run animation found. Turning off animations.\");\n\t}\n\tif(!jumpPoseAnimation) {\n\t\t_animation = null;\n\t\t//Debug.Log(\"No jump animation found and the character has canJump enabled. Turning off animations.\");\n\t}\n\tif(!attackAnimation) {\n\t\t_animation = null;\n\t\t//Debug.Log(\"No attack animation found. Turning off animations.\");\n\t}\n\t\n\t_characterState = CharacterState.Idle;\n\t\n\tif (directionVector != Vector3.zero) {\n\t\t// Get the length of the directon vector and then normalize it\n\t\t// Dividing by the length is cheaper than normalizing when we already have the length anyway\n\t\tvar directionLength = directionVector.magnitude;\n\t\tdirectionVector = directionVector / directionLength;\n\t\t\n\t\t// Make sure the length is no bigger than 1\n\t\tdirectionLength = Mathf.Min(1, directionLength);\n\t\t\n\t\t// Make the input vector more sensitive towards the extremes and less sensitive in the middle\n\t\t// This makes it easier to control slow speeds when using analog sticks\n\t\tdirectionLength = directionLength * directionLength;\n\t\t\n\t\t// Multiply the normalized direction vector by the modified length\n\t\tdirectionVector = directionVector * directionLength;\n\t\t_characterState = CharacterState.Running;\n\t}\n\t\n\t// Rotate the input vector into camera space so up is camera's up and right is camera's right\n\tdirectionVector = Camera.main.transform.rotation * directionVector;\n\t\n\t// Rotate input vector to be perpendicular to character's up vector\n\tvar camToCharacterSpace = Quaternion.FromToRotation(-Camera.main.transform.forward, transform.up);\n\tdirectionVector = (camToCharacterSpace * directionVector);\n\t\n\t// Apply the direction to the CharacterMotor\n\tmotor.inputMoveDirection = directionVector;\n\tmotor.inputJump = Input.GetButton(\"Jump\");\n\t\n\t// Set rotation to the move direction\t\n\tif (autoRotate && directionVector.sqrMagnitude > 0.01 && motor.timer <= 0) {\n\t\tvar newForward : Vector3 = ConstantSlerp(\n\t\t\ttransform.forward,\n\t\t\tdirectionVector,\n\t\t\tmaxRotationSpeed * Time.deltaTime * 2\n\t\t);\n\t\tnewForward = ProjectOntoPlane(newForward, transform.up);\n\t\ttransform.rotation = Quaternion.LookRotation(newForward, transform.up);\n\t\t\n\t}\n\t\n\t// ANIMATION sector\n\tif(_animation) {\n\t\tif(_characterState == CharacterState.Jumping) \n\t\t{\n\t\t\t\n\t\t\t_animation[jumpPoseAnimation.name].speed = -landAnimationSpeed;\n\t\t\t_animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever;\n\t\t\t_animation.CrossFade(jumpPoseAnimation.name);\t\t\t\t\n\t\t\t\n\t\t} \n\t\telse \n\t\t{\t\n\t\t\tif(motor.movement.velocity.magnitude < 0.1) {\n\t\t\t\t_animation.CrossFade(idleAnimation.name);\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tif(_characterState == CharacterState.Running) {\n\t\t\t\t\t_animation[runAnimation.name].speed = Mathf.Clamp(motor.movement.velocity.magnitude, 0.0, runMaxAnimationSpeed);\n\t\t\t\t\t_animation.CrossFade(runAnimation.name);\t\n\t\t\t\t}\n\t\t\t\telse if(_characterState == CharacterState.Trotting) {\n\t\t\t\t\t_animation[walkAnimation.name].speed = Mathf.Clamp(motor.movement.velocity.magnitude, 0.0, trotMaxAnimationSpeed);\n\t\t\t\t\t_animation.CrossFade(walkAnimation.name);\t\n\t\t\t\t}\n\t\t\t\telse if(_characterState == CharacterState.Walking) {\n\t\t\t\t\t_animation[walkAnimation.name].speed = Mathf.Clamp(motor.movement.velocity.magnitude, 0.0, walkMaxAnimationSpeed);\n\t\t\t\t\t_animation.CrossFade(walkAnimation.name);\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t// ANIMATION sector\n\t\n}", "function keydown(e) {\n console.log(e.key + \" pressed\");\n switch (e.key) {\n case \"w\":\n var facing = 0;\n walkingFrame++;\n sprite.style.top = (parseInt(sprite.style.top) - 10) + \"px\";\n break;\n case \"a\":\n facing = 1;\n walkingFrame++;\n sprite.style.left = (parseInt(sprite.style.left) - 10) + \"px\";\n break;\n case \"s\":\n facing = 2;\n walkingFrame++;\n sprite.style.top = (parseInt(sprite.style.top) + 10) + \"px\";\n break;\n case \"d\":\n facing = 3;\n walkingFrame++;\n sprite.style.left = (parseInt(sprite.style.left) + 10) + \"px\";\n break;\n }\n sprite.style.backgroundPositionY = (0 - facing * spriteSize) + \"px\";\n if (walkingFrame > frameCount) {\n walkingFrame = 0;\n }\n sprite.style.backgroundPositionX = (0 - walkingFrame * spriteSize) + \"px\";\n}", "animate() {\n const body = this.sprite.body;\n if (body.velocity.x < 0) {\n this.sprite.scale.set(-1, 1);\n } else {\n this.sprite.scale.set(1, 1);\n }\n\n if (body.touching.down) {\n if (body.velocity.x > 0) {\n this.sprite.animations.play('walk_shoot', 10, true);\n } else {\n this.sprite.animations.play('idle', 4, true);\n }\n } else {\n //this.sprite.animations.play('jump', 0, false);\n\n //if (body.touching.bottom)\n const velocity_apex = 300;\n if (body.velocity.y > -velocity_apex && body.velocity.y < velocity_apex ) {\n //this.sprite.animations.frame = 1;\n this.sprite.animations.play('jump_apex', 0, false);\n } else {\n //this.sprite.animations.frame = 0;\n this.sprite.animations.play('jump_mid', 0, false);\n }\n }\n }", "function translateLeft() {\n console.log('translate left triggered');\n var m = new THREE.Matrix4();\n m.set( 1, 0, 0, -7.5,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1 );\n geometry.applyMatrix(m);\n // render\n render();\n}", "function movement() {\r\n if (cursors.left.isDown) {\r\n player.body.velocity.x = -150;\r\n keyLeftPressed.animations.play(\"leftArrow\");\r\n }\r\n if (cursors.right.isDown) {\r\n player.body.velocity.x = 150;\r\n keyRightPressed.animations.play(\"rightArrow\");\r\n }\r\n\r\n if (player.body.velocity.x > 0) {\r\n player.animations.play(\"right\");\r\n } else if (player.body.velocity.x < 0) {\r\n player.animations.play(\"left\");\r\n } else {\r\n player.animations.play(\"turn\");\r\n }\r\n if (cursors.up.isDown && player.body.onFloor()) {\r\n player.body.velocity.y = -290;\r\n keyUpPressed.animations.play(\"upArrow\");\r\n jumpSound.play();\r\n jumpSound.volume = 0.15;\r\n }\r\n }", "function Start()\n{\n mForwardDirection = transform.forward;\n mRightDirection = transform.right;\n mUpDirection = transform.up;\n}", "function moveX(){\n if (isMovingRight) {\n megamanXSpeed = (4*xScaler);\n megamanDirection = 1;\n }\n if (isMovingLeft) {\n megamanXSpeed = (-4*xScaler);\n megamanDirection = -1\n }\n }", "function moveLeft() {\n robotLeft -= 10;\n robot.style.left = robotLeft + \"px\";\n }", "function ChangeDirection()\n{\n\tif(facingLeft)\n\t{\n\t\tfacingLeft = false;\n\t}\n\telse\n\t{\n\t\tfacingLeft = true;\n\t}\n\tyield WaitForSeconds(0.2);\n}", "moveForward(forced = false) {\n this.movingForward = true;\n this.movingBackward = false;\n\n this.translateBaseFrame(new THREE.Vector3(0.0, 0.0, 1.0), this.cmd_vel.linear.z);\n\n this.rightWheel.rotateX(this.cmd_vel.linear.z * 8);\n this.leftWheel.rotateX(this.cmd_vel.linear.z * 8);\n this.smallWheelRF.rotateX(this.cmd_vel.linear.z * 12);\n this.smallWheelLF.rotateX(this.cmd_vel.linear.z * 12);\n this.smallWheelRR.rotateX(this.cmd_vel.linear.z * 12);\n this.smallWheelLR.rotateX(this.cmd_vel.linear.z * 12);\n if (this.smallWheelArmatureRF.rotation.y > 0.0) {\n this.smallWheelArmatureRF.rotateY(this.cmd_vel.linear.z * -10);\n } else {\n this.smallWheelArmatureRF.rotateY(this.cmd_vel.linear.z * 10);\n }\n if (this.smallWheelArmatureLF.rotation.y > 0.0) {\n this.smallWheelArmatureLF.rotateY(this.cmd_vel.linear.z * -10);\n } else {\n this.smallWheelArmatureLF.rotateY(this.cmd_vel.linear.z * 10);\n }\n if (this.smallWheelArmatureRR.rotation.y > 0.0) {\n this.smallWheelArmatureRR.rotateY(this.cmd_vel.linear.z * -10);\n } else {\n this.smallWheelArmatureRR.rotateY(this.cmd_vel.linear.z * 10);\n }\n if (this.smallWheelArmatureLR.rotation.y > 0.0) {\n this.smallWheelArmatureLR.rotateY(this.cmd_vel.linear.z * -10);\n } else {\n this.smallWheelArmatureLR.rotateY(this.cmd_vel.linear.z * 10);\n }\n\n if (this.wasd.w || forced) {\n if (this.cmd_vel.linear.z < this.dynamics.maxLinearSpeed) {\n this.cmd_vel.linear.z += this.dynamics.linearAcceleration;\n }\n setTimeout(this.moveForward, 2, forced);\n } else {\n if (this.cmd_vel.linear.z > 0.0) {\n this.cmd_vel.linear.z -= this.dynamics.linearDeceleration;\n setTimeout(this.moveForward, 2);\n } else {\n this.cmd_vel.linear.z = 0.0;\n this.movingForward = false;\n }\n }\n }", "movement_left() {\n if (this.distance != 0) {\n let delay = 1000 / 60;\n this.scene.time.delayedCall(delay, () => {\n this.x -= this.movespeed;\n this.distance -= this.movespeed;\n this.movement_left();\n });\n }\n if (this.distance == 0) { \n console.log(this.x, this.y);\n this.moving = false;\n }\n }", "moveRight() {\n\n if (this.posX <= 670 && pause == false)\n this.posX = this.posX + 5;\n }", "function frame() {\n //console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos++; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "moveBgLeft() {\n let minBgLeft = -this.bgImg.width + width;\n\n if (this.bgLeft - this.moveSpeed > minBgLeft) {\n for(let i = 0; i < lasers.length; i++){\n let laser = lasers[i];\n laser.x -= this.moveSpeed;\n }\n }\n super.moveBgLeft();\n }", "function frame() {\n console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }" ]
[ "0.73133856", "0.693303", "0.6691323", "0.6678744", "0.6556454", "0.6552337", "0.6549804", "0.65222216", "0.65061015", "0.6499008", "0.6482977", "0.643752", "0.6428309", "0.64126855", "0.63954884", "0.6318961", "0.63065434", "0.6305223", "0.62657773", "0.62638646", "0.6261632", "0.62394303", "0.6235949", "0.6232268", "0.62105817", "0.6209441", "0.6189045", "0.6182387", "0.6171335", "0.61616707", "0.6158331", "0.61580026", "0.61530554", "0.61514795", "0.61439097", "0.61271864", "0.61261827", "0.6117794", "0.61163133", "0.6112905", "0.61115426", "0.6101122", "0.60862815", "0.6085223", "0.6084711", "0.60784245", "0.6072708", "0.6071011", "0.6058752", "0.605121", "0.60424346", "0.60229236", "0.60099566", "0.60046476", "0.6002866", "0.5988676", "0.5982827", "0.5980176", "0.5972916", "0.5966113", "0.5953983", "0.59522086", "0.5950201", "0.59478635", "0.594622", "0.5944985", "0.59350634", "0.593325", "0.593184", "0.59231216", "0.59166944", "0.5904067", "0.5892099", "0.5887001", "0.58855796", "0.58848697", "0.5876468", "0.5876361", "0.5873297", "0.58721817", "0.5869597", "0.5869453", "0.58680034", "0.58635217", "0.5859386", "0.58563936", "0.5853251", "0.58524585", "0.5849455", "0.58479136", "0.5839161", "0.5826753", "0.58231044", "0.5819538", "0.5818908", "0.58161783", "0.58150876", "0.5810667", "0.5808031", "0.579141" ]
0.731095
1
frames for when the character is stationary
stationaryState(){ this.state = "stationary"; this.animationTime = 55; this.currentFrameNum = 0; this.willStop = false; this.currentFrameX = 0; this.currentFrameY = 0; this.frameHeight = 112; this.frameWidth = 79; this.maxFrame = 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function frame() {\n //console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos++; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "hadouken(){\n this.state = \"hadouken\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 2348;\n this.frameHeight = 109;\n this.frameWidth = 125;\n this.maxFrame = 8;\n hadouken1.startTime = millis();\n }", "function frame() {\n console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "function update() {\n frames++;\n fish.update();\n //console.log(fish.y);\n}", "constructor(){\n this.x = 100;\n this.y = 100;\n this.frameHeight = 53;\n this.frameWidth = 64;\n this.currentFrameX = 23;\n this.currentFrameY = 16;\n this.spriteSheet;\n this.currentFrameNum = 1;\n this.time = 0;\n this.timeUntilLast = 0;\n this.timeFromLast = 0;\n this.animationTime = 50;\n this.maxFrame = 6;\n this.startTime;\n this.lifeTime;\n this.alive = false;\n\n\n \n\n }", "getSignAndFrameInfo() {\n//------------------\n// Handle frame beyond end of animation\nif (this.fCur === this.fCount) {\nreturn [\"[none]\", this.signs.length, this.fCur];\n} else {\n// Rely on @frameCur being set according to @fCur\nreturn [this.frameCur.sign.gloss, this.frameCur.sign.i, this.fCur];\n}\n}", "function onFrame(event) {\n\tframePosition += (mousePos - framePosition) / 10;\n\tvar vector = (view.center - framePosition) / 10;\n\tmoveStars(vector * 3);\n\tmoveRainbow(vector, event);\n}", "pos2frame(pos) {\n\n }", "function drawPrevFrames() {;\n\tfor (let i = player.prevPosition.length - 1; i >= 0; i--) {\n\t\tctx.globalAlpha = (0.3 / i) + 0.1;\n\t\tif (i % 3 === 2) {\n\t\t\tctx.strokeRect(player.prevPosition[i].x, player.prevPosition[i].y, player.width, player.height);\n\t\t}\n\t\tif (i > 0) {\n\t\t\tplayer.prevPosition[i].x = player.prevPosition[i - 1].x;\n\t\t\tplayer.prevPosition[i].y = player.prevPosition[i - 1].y;\n\t\t} else if ((player.x > scrollBound) && (player.x < (gameWidth / 2))) {\n\t\t\tplayer.prevPosition[i].x = player.x;\n\t\t\tplayer.prevPosition[i].y = player.y;\n\t\t} else {\n\t\t\tplayer.prevPosition[i].x = player.x - (player.xVelocity * (i + 1));\n\t\t\tplayer.prevPosition[i].y = player.y;\n\t\t\tfor (let i = player.prevPosition.length - 1; i >= 0; i--) {\n\t\t\t\tplayer.prevPosition[i].x = player.x - (player.xVelocity * (i + 1));\n\t\t\t}\n\t\t}\n\t}\n\tctx.globalAlpha = 1;\n}", "handleheroFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "function updateAnimationFrames() {\n\tdragon1 = document.getElementById('dragon1');\n\tdragon2 = document.getElementById('dragon2');\n\tdragon1.innerHTML = \"<img src='img/d1\" + state1 + x + \".svg'/>\";\n\tdragon2.innerHTML = \"<img src='img/d2\" + state2 + x + \".svg'/>\";\n\tif (r == false && x < 9) {\n\t\tx++;\n\t}\n\tif (r == true && x >= 0) {\n\t\tx--;\n\t}\n\tif (x == 9 ) {\n\t\tr = true;\n\t}\n\tif (x == 0) {\n\t\tr = false;\n\t}\n}", "onAnimFrame() {\n const now = Date.now();\n const delta = now - this.previousFrameTime;\n const interval = 1000 / this.props.fps;\n\n this.requestId = window.requestAnimationFrame(this.onAnimFrame);\n\n if (delta > interval) {\n this.previousFrameTime = now - (delta % interval);\n this.drawCurrentFrame();\n\n // Clamp playback between start & end frame range, looping\n // whenever we run past the end frame.\n if (this.frame < this.startFrame || this.frame > this.endFrame) {\n this.frame = this.startFrame;\n }\n }\n }", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "getFrame(t) {\nvar NF, f, frame, resolved, was_complete;\n//-------\n// Allow for the possibility that the frame seqeuence is extended\n// while we are scanning it. In the case where our search apparently\n// hits the sequence limit this means (a) that we should check\n// whether new frames have been added, and (b) that we shouldn''t\n// terminate the animation until we know that it is complete.\n// If I knew more about modern browsers' scheduling, I might realise\n// that this is unnecessarily complicated, or perhaps alternatively\n// that it is not complicated enough to be safe.\nresolved = false;\nwhile (!resolved) {\nwas_complete = this.isComplete;\nNF = this.fCount;\nf = this.getFrameIndex(t, NF);\nresolved = f !== NF || was_complete || NF === this.fCount;\nif (--this.traceMax > 0) {\nif (typeof lggr.trace === \"function\") {\nlggr.trace(`Resolved: ${resolved} f=${f} NF=${NF} fCount=${this.fCount}`);\n}\n}\n}\n// Find result frame\n// Rather than terminate the animation, stick at the last available\n// frame, pending the arrival of possible successors -- via\n// @extendSigns() -- or the indication that there will never be\n// any successors -- via @setCompleted.\nreturn frame = f !== NF ? (this.fIncomplete = 0, this.setFrameAt(f)) : this.isComplete ? null : (this.fIncomplete++, this.fIncomplete < 5 ? typeof lggr.debug === \"function\" ? lggr.debug(\"getFrame: at end of incomplete animation\") : void 0 : void 0, this.setFrameAt(NF - 1));\n}", "function frame() {\n\t\tleft += 2.5;\n\t\t//opacity += 0.02;\n\t\tanimal.style.left = left + 'px';\n\t\t//txt.style.opacity = opacity;\n\t\tif (left >= 15) {\n\t\t\tclearInterval(interval);\n\t\t\tanimal.style.left = \"15px\";\n\t\t\t//txt.style.opacity = 1;\n\t\t\tspots_disabled = false;\n\t\t\tfadein_text();\n\t\t}\n\t}", "function main(){\r\n\tvar TL=fl.getDocumentDOM().getTimeline()\r\n\tvar curL=TL.currentLayer;\r\n\tvar curF=TL.currentFrame;\r\n\tvar frame=TL.layers[curL].frames[curF];\r\n\tif(curF>frame.startFrame){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t}else if(curF==frame.startFrame && curF>0){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t\tvar prevFrame=TL.layers[curL].frames[frame.startFrame-1];\r\n\t\tTL.currentFrame=frame.startFrame-(prevFrame.duration);\r\n\t}\r\n}", "function frame1()\n\t{\n\n\t\tTweenLite.to(over, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(eight, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.1, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(million, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.2, ease: Expo.easeOut});\t\t\n\n\t\tTweenLite.delayedCall(0.8, frame2);\n\t}", "function forward(){\n if(curFrame <= frames.length-1)\n drawCurFrame();\n}", "frame2ms(frame) {\n\n }", "function update(tframe){\r\n var dt = (tframe - lastframe) / 1000;\r\n lastframe = tframe;\r\n checkLoose();\r\n checkWin();\r\n checkColor();\r\n shootBubbles(dt);\r\n \r\n }", "function frame() {\n console.log(\"zaim\");\n if (pos == z) {\n clearInterval(id);\n } else {\n pos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = pos+\"px\"; \n x=pos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function updateAnimationState(time){\n\t\t// console.log(lastUpdate);\n\t\tfor(var i = 0; i < characters.length;i++){\n\t\t\tc = characters[i];\n\t\t\tc.updateAnimationState(time);\n\t\t}\n\t\t// lastUpdate = time;\n\t}", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "function update(){\n frames++;\n if (currentstate !== states.Score && currentstate !== states.Start && currentstate !== states.HighScore) {\n fgpos = (fgpos - 2) % 14;\n }\n if (currentstate === states.Game) {\n pipe.update();\n }\n bird.update();\n}", "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "function onFrame() \n{\n\tupdate();\n}", "function updateFrame() {\n // TODO: INSERT CODE TO UPDATE ANY OTHER DATA USED IN DRAWING A FRAME\n y += 0.3;\n if (y > 60) {\n y = -50;\n }\n frameNumber++;\n}", "function animationLost() {\n\t\tconsole.log(\"he perdido\");\t\n\tposX2=hasta;\t\nhasta=hasta-60;\nposX=posX-60;\n\t\t// Start the animation.\n\t\trequestID2 = requestAnimationFrame(animate2);\n\t}", "update() {\n frames = 0;\n this.moveDown();\n }", "function routeFrame(mario) {\n if (mario.jump.falling) {\n return 'jump';\n }\n\n if (mario.go.distance > 0) {\n // used to make mario slide check agian vid 7 min 19\n if ((mario.vel.x > 0 && mario.go.dir < 0) || (mario.vel.x < 0 && mario.go.dir > 0)) {\n return 'break';\n }\n console.log('frame stuff in entities.js:24')\n return runAnim(mario.go.distance);\n }\n\n return 'idle';\n }", "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "function nextFrame() {\n _timeController.proposeNextFrame();\n }", "function drawFrame(frame) {\n\t\tvideo.currentTime = (frame.second > video.duration ? video.duration : frame.second);\n\t}", "function fullRunnersMotionLogicTimeEscape() {\n\n var firstSeparatorStartX = 0;\n var firstSeparatorStartY = 0;\n var secondSeparatorStartX = 0;\n var secondSeparatorStartY = 0;\n\n // Offsets calculation\n for (var offsets = 0; offsets < howManyAllDigits; offsets++) {\n\n if (offsets == choursDigit_1) {\n // FIRST DIGIT !\n\n for (var fd = 0; fd < animGS.allAsciiCharsData[offsets].allCharDefinitionData.length; fd++) {\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fd][0].runnerX =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fd][0].runnerStartingXBackup + animGS.startingTimeTopLeftOffset;\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fd][0].runnerY =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fd][0].runnerStartingYBackup + animGS.startingTimeTopLeftOffset;\n }\n }\n\n if (offsets == choursDigit_2) {\n // SECOND DIGIT !\n\n for (var sd = 0; sd < animGS.allAsciiCharsData[offsets].allCharDefinitionData.length; sd++) {\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerX =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerStartingXBackup + (2 * animGS.startingTimeTopLeftOffset) + animGS.allAsciiCharsData[offsets].oneCharWidth;\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerY =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerStartingYBackup + animGS.startingTimeTopLeftOffset;\n\n if (animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerX > firstSeparatorStartX) {\n firstSeparatorStartX = animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerX;\n }\n\n if (animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerY > firstSeparatorStartY) {\n firstSeparatorStartY = animGS.allAsciiCharsData[offsets].allCharDefinitionData[sd][1].runnerY;\n }\n }\n\n // MIDDLE of CHAR-DIGIT\n firstSeparatorStartY /= 2;\n }\n\n if (offsets == cminutesDigit_1) {\n // THIRD DIGIT !\n\n for (var td = 0; td < animGS.allAsciiCharsData[offsets].allCharDefinitionData.length; td++) {\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[td][2].runnerX =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[td][2].runnerStartingXBackup + (4 * animGS.startingTimeTopLeftOffset) + (2 * animGS.allAsciiCharsData[offsets].oneCharWidth);\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[td][2].runnerY =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[td][2].runnerStartingYBackup + animGS.startingTimeTopLeftOffset;\n }\n }\n\n if (offsets == cminutesDigit_2) {\n // FOURTH DIGIT !\n\n for (var fod = 0; fod < animGS.allAsciiCharsData[offsets].allCharDefinitionData.length; fod++) {\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerX =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerStartingXBackup + (5 * animGS.startingTimeTopLeftOffset) + (3 * animGS.allAsciiCharsData[offsets].oneCharWidth);\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerY =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerStartingYBackup + animGS.startingTimeTopLeftOffset;\n\n if (animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerX > secondSeparatorStartX) {\n secondSeparatorStartX = animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerX;\n }\n\n if (animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerY > secondSeparatorStartY) {\n secondSeparatorStartY = animGS.allAsciiCharsData[offsets].allCharDefinitionData[fod][3].runnerY;\n }\n }\n\n // MIDDLE of CHAR-DIGIT\n secondSeparatorStartY /= 2;\n }\n\n if (offsets == csecondsDigit_1) {\n // FIFTH DIGIT !\n\n for (var fthd = 0; fthd < animGS.allAsciiCharsData[offsets].allCharDefinitionData.length; fthd++) {\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fthd][4].runnerX =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fthd][4].runnerStartingXBackup + (7 * animGS.startingTimeTopLeftOffset) + (4 * animGS.allAsciiCharsData[offsets].oneCharWidth);\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fthd][4].runnerY =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[fthd][4].runnerStartingYBackup + animGS.startingTimeTopLeftOffset;\n }\n }\n\n if (offsets == csecondsDigit_2) {\n // SIXTH DIGIT !\n\n for (var sxthd = 0; sxthd < animGS.allAsciiCharsData[offsets].allCharDefinitionData.length; sxthd++) {\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sxthd][5].runnerX =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sxthd][5].runnerStartingXBackup + (8 * animGS.startingTimeTopLeftOffset) + (5 * animGS.allAsciiCharsData[offsets].oneCharWidth);\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sxthd][5].runnerY =\n animGS.allAsciiCharsData[offsets].allCharDefinitionData[sxthd][5].runnerStartingYBackup + animGS.startingTimeTopLeftOffset;\n }\n }\n }\n\n // Time-separators offsets\n var oneSeparatorDownOffset = 0;\n\n for (var timeSep = 0; timeSep < (animGS.runnersTimerSeparators.length / 2); timeSep++) {\n\n // 0,1 for HOUR-MINUTE separators\n animGS.runnersTimerSeparators[timeSep].runnerX = firstSeparatorStartX + animGS.startingTimeTopLeftOffset;\n animGS.runnersTimerSeparators[timeSep].runnerY = firstSeparatorStartY + oneSeparatorDownOffset;\n\n oneSeparatorDownOffset += animGS.startingTimeTopLeftOffset;\n }\n\n oneSeparatorDownOffset = 0;\n\n for (var timeSep2 = (animGS.runnersTimerSeparators.length / 2); timeSep2 < animGS.runnersTimerSeparators.length; timeSep2++) {\n\n // 2,3 for MINUTE-SECOND separators\n animGS.runnersTimerSeparators[timeSep2].runnerX = secondSeparatorStartX + animGS.startingTimeTopLeftOffset;\n animGS.runnersTimerSeparators[timeSep2].runnerY = secondSeparatorStartY + oneSeparatorDownOffset;\n\n oneSeparatorDownOffset += animGS.startingTimeTopLeftOffset;\n }\n // END: Time-separators offsets\n\n // Single digits-indexes-conters\n var d1 = 0;\n var d2 = 0;\n var d3 = 0;\n var d4 = 0;\n var d5 = 0;\n var d6 = 0;\n\n for (var r = 0; r < animGS.runners.length; r++) {\n\n if (checkForBorder(animGS.runners[r]) === true) {\n\n // We hit border AND moved the runner, we can CONTINUE with other runners\n continue;\n }\n\n if (animGS.runners[r].whichTimeDigitLoyal == 1) {\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.allAsciiCharsData[choursDigit_1].allCharDefinitionData[d1][animGS.runners[r].whichTimeDigitLoyal - 1], d1);\n\n d1++;\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == 2) {\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.allAsciiCharsData[choursDigit_2].allCharDefinitionData[d2][animGS.runners[r].whichTimeDigitLoyal - 1], d2);\n\n d2++;\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == 3) {\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.allAsciiCharsData[cminutesDigit_1].allCharDefinitionData[d3][animGS.runners[r].whichTimeDigitLoyal - 1], d3);\n\n d3++;\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == 4) {\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.allAsciiCharsData[cminutesDigit_2].allCharDefinitionData[d4][animGS.runners[r].whichTimeDigitLoyal - 1], d4);\n\n d4++;\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == 5) {\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.allAsciiCharsData[csecondsDigit_1].allCharDefinitionData[d5][animGS.runners[r].whichTimeDigitLoyal - 1], d5);\n\n d5++;\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == 6) {\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.allAsciiCharsData[csecondsDigit_2].allCharDefinitionData[d6][animGS.runners[r].whichTimeDigitLoyal - 1], d6);\n\n d6++;\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == (howManyAllDigits)) { // 1 point of 1 separator\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.runnersTimerSeparators[0], 0);\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == (howManyAllDigits + 1)) { // 2 point of 1 separator\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.runnersTimerSeparators[1], 1);\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == (howManyAllDigits + 2)) { // 1 point of 2 separator\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.runnersTimerSeparators[2], 2);\n }\n else if (animGS.runners[r].whichTimeDigitLoyal == (howManyAllDigits + 3)) { // 2 point of 2 separator\n\n tryToCatchTheEscapingRunner(\n animGS.runners[r], animGS.runnersTimerSeparators[3], 3);\n }\n\n if (animGS.timeDigitsSingleRunnerLittleBitOffsetBehaviourTypes == 1) {\n // NOTE: NOTHING (just for info.)\n }\n else if (animGS.timeDigitsSingleRunnerLittleBitOffsetBehaviourTypes == 2) {\n // Move little bit more\n runnerMoveNormal(animGS.runners[r]);\n }\n else {\n // Move little bit more - but more randomly\n if (Math.random() > Math.random()) {\n runnerMoveNormal(animGS.runners[r]);\n }\n }\n }\n\n // NOTE: If === 0, we DO NOT use any dynamic movement !\n if (animGS.timeDigitsDynamicMovement === 1) {\n // Time-digits dynamic movement 1!\n makeDynamicTimeDigitMovement1();\n }\n else if (animGS.timeDigitsDynamicMovement === 2) {\n // Time-digits dynamic movement 2!\n makeDynamicTimeDigitMovement2();\n }\n else if (animGS.timeDigitsDynamicMovement === 3) {\n // Time-digits dynamic movement 3!\n makeDynamicTimeDigitMovement3();\n }\n else if (animGS.timeDigitsDynamicMovement === 4) {\n // Time-digits dynamic movement 4!\n makeDynamicTimeDigitMovement4();\n }\n else if (animGS.timeDigitsDynamicMovement === 5) {\n // Time-digits dynamic movement 5!\n makeDynamicTimeDigitMovement5();\n }\n else if (animGS.timeDigitsDynamicMovement === 6) {\n // Time-digits dynamic movement 6!\n makeDynamicTimeDigitMovement6();\n }\n else if (animGS.timeDigitsDynamicMovement === 7) {\n // Time-digits dynamic movement 7!\n makeDynamicTimeDigitMovement7();\n }\n else if (animGS.timeDigitsDynamicMovement === 8) {\n // Time-digits dynamic movement 8!\n makeDynamicTimeDigitMovement8();\n }\n else if (animGS.timeDigitsDynamicMovement === 9) {\n // Time-digits dynamic movement 9!\n makeDynamicTimeDigitMovement9();\n }\n else if (animGS.timeDigitsDynamicMovement === 10) {\n // Time-digits dynamic movement 10!\n makeDynamicTimeDigitMovement10();\n }\n else if (animGS.timeDigitsDynamicMovement === 11) {\n // Time-digits dynamic movement 11!\n makeDynamicTimeDigitMovement11();\n }\n else if (animGS.timeDigitsDynamicMovement === 12) {\n\n // RANDOMLY chosen between movements !\n var choseRandomlyDynamicMovement = calcRndGenMinMax(1, 11);\n eval('makeDynamicTimeDigitMovement' + choseRandomlyDynamicMovement.toString() + '();');\n }\n\n // NOTE: We DO NOT search escapist in Woozy Clock version !\n }", "function renderFrame() {\n let delta = 0;\n if (last_time !== 0) {\n delta = (new Date().getTime() - last_time);\n }\n last_time = new Date().getTime();\n\n // call the LoopCallback function in the WASM module\n exports.LoopCallback(delta,\n leftKeyPress, rightKeyPress,\n upKeyPress, downKeyPress,\n spaceKeyPress, cloakKeyPress);\n\n // Turn of click-shoot\n\n spaceKeyPress = false\n\n // requestAnimationFrame calls renderFrame the next time a frame is rendered\n requestAnimationFrame(renderFrame);\n}", "function trackFrameEnd(){\n}", "function animations() {\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tif (arthur.goRight) {\n\t\tarthur.srcY = arthur.goRowRight * arthur.height;\n\t} else if (arthur.goLeft) {\n\t\tarthur.srcY = arthur.goRowLeft * arthur.height;\n\t} else if (arthur.duckRight) {\n\t\tarthur.srcY = arthur.duckRowRight * arthur.height;\n\t} else if (arthur.atkRight) {\n\t\tarthur.srcY = arthur.atkRowRight * arthur.height;\n\t} else if (arthur.jumpRight) {\n\t\tarthur.srcY = arthur.jumpRowRight * arthur.height;\n\t} else if (arthur.die) {\n\t\tarthur.srcY = arthur.dieRowRight * arthur.height;\n\t}\n}", "handlePlayerFrame(){\n if(this.speedY < 0){\n this.frameY = 3\n }else{\n this.frameY = 0\n }\n if (this.frameX < 3){\n this.frameX++\n } else {\n this.frameX = 0\n }\n }", "frame() {\n this.display();\n this.move();\n this.edgeCheck();\n }", "getNextFrame() {\nvar f;\nf = this.fCur + 1;\nif (this.fCount <= f) {\nf = 0;\n}\nreturn this.setFrameAt(f);\n}", "attack(index) {\n // attack animation \n const swing = (timestamp) => {\n if (t < animationLength) {\n t++;\n if (t === framesPerTick*2 || t === framesPerTick*8) { \n if (this.state.playerPhase) {\n this.setState({ playerFrameX: 0, playerFrameY: -96 }); \n } else {\n bandits[this.state.aggroBandits[this.state.activeBandit]].frameX = 0;\n bandits[this.state.aggroBandits[this.state.activeBandit]].frameY = -96;\n this.setState({bandits: bandits});\n }\n }\n if (t === framesPerTick*3 || t === framesPerTick*5 || t === framesPerTick*7) {\n if (t === framesPerTick*3) { this.hitSound.play() }\n if (this.state.playerPhase) {\n this.setState({ playerFrameX: -72 }, () => {\n if ( t === framesPerTick*3 ) {\n bandits[index].frameY = -192;\n this.setState({ bandits: bandits });\n }\n });\n } else {\n if ( t === framesPerTick*3 ) {\n if (this.targetVillager) {\n villager.frameX = 0;\n villager.frameY = -192;\n this.setState({ villager: villager });\n } else {\n this.setState({ playerFrameY: -192 });\n }\n }\n bandits[this.state.aggroBandits[this.state.activeBandit]].frameX = -72;\n this.setState({bandits: bandits});\n }\n }\n if (t === framesPerTick*4 || t === framesPerTick*6) {\n if (this.state.playerPhase) {\n this.setState({ playerFrameX: -144 }); \n } else {\n bandits[this.state.aggroBandits[this.state.activeBandit]].frameX = -144;\n this.setState({bandits: bandits});\n }\n }\n if (t === framesPerTick*9) {\n if (this.state.playerPhase) {\n this.setState({ playerFrameX: 0, playerFrameY: 0 }); \n } else {\n bandits[this.state.aggroBandits[this.state.activeBandit]].frameX = 0;\n bandits[this.state.aggroBandits[this.state.activeBandit]].frameY = 0;\n this.setState({bandits: bandits});\n }\n }\n requestAnimationFrame(swing);\n } else if (this.state.playerPhase) { \n bandits[index].hp -= (this.state.player.attack - map[bandits[index].map[0]-1][bandits[index].map[1]-1].defense);\n if (bandits[index].hp <= 0) { \n // Gain EXP\n let player = this.state.player;\n player.exp+= 10;\n player.level = this.expForLevel.indexOf(this.expForLevel.find((element) => element > player.exp));\n if (this.expForLevel.includes(player.exp)) {\n player.maxHP+= 2;\n player.attack+= 1;\n if (player.level >= 4) {player.speed = 5}\n }\n this.setState({ player: player }, () => this.displayText(\"dead\", index));\n // death animation\n t = 0;\n animationLength = 163;\n requestAnimationFrame(death);\n } else {\n bandits[index].frameY = 0;\n this.setState({ bandits: bandits, aggroBandits: aggroBandits }, () => this.endTurn(index) );\n }\n } else {\n animationLength = 163;\n t = 0;\n if (this.targetVillager) {\n villager.hp -= this.state.bandits[index].attack;\n if (villager.hp <= 0) {\n this.displayText(\"dead\", index);\n this.villagerLives = false;\n requestAnimationFrame(death);\n } else {\n villager.frameY = 0;\n this.setState({ villager: villager }, () => this.endEnemyTurn(this.state.activeBandit));\n }\n } else {\n let player = this.state.player;\n player.hp -= (this.state.bandits[index].attack - map[this.state.playerMap[0]-1][this.state.playerMap[1]-1].defense);\n if (player.hp <= 0 ) {\n player.hp = 0;\n this.displayText(\"dead\", index);\n requestAnimationFrame(death);\n } else {\n this.setState({ player: player, playerFrameY: 0 }, () => this.endEnemyTurn(this.state.activeBandit));\n }\n }\n } \n \n }\n \n const death = (timestamp) => {\n if (t < animationLength) {\n t++\n if ( t === framesPerTick*2) {\n if (this.state.playerPhase) {\n bandits[index].frameX = -72;\n this.setState({ bandits: bandits }); \n } else {\n if (this.targetVillager) {\n villager.frameX = -72;\n this.setState({ villager: villager });\n } else {\n this.setState({ playerFrameX: -72 });\n }\n }\n } else if ( t === framesPerTick*3) {\n if (this.state.playerPhase) {\n bandits[index].frameX = -144;\n this.setState({ bandits: bandits }); \n } else {\n if (this.targetVillager) {\n villager.frameX = -144;\n this.setState({ villager: villager });\n } else {\n this.setState({ playerFrameX: -144 });\n } \n }\n }\n requestAnimationFrame(death);\n } else {\n if (this.state.playerPhase) {\n // remove from aggro bandits\n let deadAggro = aggroBandits.findIndex(element => element === index);\n aggroBandits.splice(deadAggro, 1);\n // remove from state.bandits\n bandits.splice(index, 1); // this causes aggroBandits not sync with bandits\n aggroBandits.forEach(element => {\n // Need to reduce the index of aggroBandits with a higher index than the one removed\n if (element > index) { aggroBandits[element] = aggroBandits[element] -1 };\n });\n this.setState({ bandits: bandits, aggroBandits: aggroBandits }, () => this.endTurn(index) );\n } else {\n if (this.targetVillager) {\n villager.map = [50, 50];\n this.setState({ villager: villager }, () => this.endEnemyTurn(this.state.activeBandit));\n } else {\n this.setState({ gameOver: true, moving: false }, () => {\n let fightSong = this.fightSong;\n let fadeInterval = setInterval(function(){\n if(fightSong.volume <= 0.01){\n fightSong.pause();\n fightSong.volume = 1;\n clearInterval(fadeInterval);\n return;\n }\n fightSong.volume -= 0.01;\n }, 1);\n })\n }\n }\n\n }\n }\n\n\n // animation parameters\n let t = 0;\n let animationLength = 109;\n let framesPerTick = 12;\n\n let villager = this.state.villager;\n let bandits = this.state.bandits;\n let aggroBandits = this.state.aggroBandits;\n\n let playerDirection = this.state.playerDirection;\n // mark as moving during animation to forbid input\n this.setState({ moving: true }, () => {\n if (this.targetVillager) {\n if (bandits[index].map[0] < villager.map[0] ) {\n bandits[index].direction = 1;\n } else if (bandits[index].map[0] > villager.map[0] ) {\n bandits[index].direction = -1;\n }\n } else {\n if (this.state.bandits[index].map[0] < this.state.playerMap[0]) {\n bandits[index].direction = 1;\n playerDirection = -1;\n } else if (this.state.bandits[index].map[0] > this.state.playerMap[0]) {\n bandits[index].direction = -1;\n playerDirection = 1;\n } else if (this.state.bandits[index].map[0] === this.state.playerMap[0]) {\n if (this.state.playerPhase) {\n bandits[index].direction = playerDirection * -1;\n } else {\n playerDirection = bandits[index].direction * -1\n }\n }\n }\n this.setState(\n { playerDirection: playerDirection, bandits: bandits }, \n () => {\n requestAnimationFrame(swing);\n this.displayText(\"start\", index);\n\n }\n );\n });\n }", "function frame(){\t\n\tvar t_step = secondsPerAnimatingMillisecond * animationStep;\n\tif(elapsedVirtualTime == 0){ // half step approx\n\t\tt_step = t_step / 2;\n\t\taccel();\n\t\tvel(t_step);\n\t} else {\n\t\tpos(t_step);\n\t\taccel();\n\t\tvel(t_step);\n\t\tredrawCanvas();\n\t}\n\t\n\telapsedVirtualTime += t_step;\n}", "rightState(){\n\n this.state = \"right\";\n this.animationTime = 40;\n this.currentFrameNum = 0;\n this.currentFrameY = 436;\n this.currentFrameX = 0;\n this.frameHeight = 114;\n this.frameWidth = 94;\n this.maxFrame = 9;\n }", "frameAt(f) {\n//------\n//ASSERT: 0 <= f < @fCount\nreturn this.frames[f];\n}", "playerFrame() {\n // console.log(this.moving);\n if (!this.moving) {\n this.frameY = 1\n if (this.frameX === 5) {\n this.frameX = 0\n }\n else if (this.frameX === 11) {\n this.frameX = 6\n }\n else if (this.frameX === 17) {\n this.frameX = 12\n }\n else if (this.frameX >= 23){\n this.frameX = 18\n }\n }\n if (this.frameX > 22) {\n this.frameX = 0\n }\n this.frameX++ // TODO: this bugs out when holding not dir keys and running into walls\n }", "function frame()\n {\n //Clear the element if it reaches below a certain pixel range\n if (pos == 1024)//setting of the finish line\n {\n clearInterval(id);\n eball.remove();\n }\n //Continue to move till the finish line hits.\n else\n {\n pos++;//Add the position\n eball.style.top = pos + 'px';//Continuosly keep on adding the position value to account for the movement\n }\n }", "function playerAttackAnimation(delta){\n let prevAttackCounter = player.attackCounter;\n player.attackCounter += (delta / 1000);\n let t = player.attackCounter / PLAYER_ATTACK_ANIMATION_LENGTH;\n if(prevAttackCounter == 0){\n // Create the two parts of the tongue\n playerTongue = new PIXI.Graphics();\n playerTongueTip = new PIXI.Graphics();\n playerTongue.lineStyle(PLAYER_TONGUE_WIDTH, PLAYER_TONGUE_COLOR, 1);\n playerTongueTip.lineStyle(0, PLAYER_TONGUE_COLOR, 1);\n // Draw the tongue line\n playerTongue.moveTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y);\n playerTongue.lineTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y - PLAYER_TONGUE_LENGTH * t);\n // Draw the tongue tip\n playerTongueTip.beginFill(PLAYER_TONGUE_COLOR, 1);\n playerTongueTip.drawCircle(PLAYER_MOUTH_X, PLAYER_MOUTH_Y + 10 - PLAYER_TONGUE_LENGTH * t, 20);\n playerTongueTip.endFill();\n // Add both parts to the player sprite\n player.sprite.addChild(playerTongue);\n player.sprite.addChild(playerTongueTip);\n // Add both parts to the tongue layer\n playerTongue.displayGroup = tongueGroup;\n playerTongueTip.displayGroup = tongueGroup;\n\n } else if(player.attackCounter > PLAYER_ATTACK_ANIMATION_LENGTH){\n\n player.sprite.removeChild(playerTongue);\n player.sprite.removeChild(playerTongueTip);\n player.attacking = false;\n player.attackCounter = 0;\n\n } else {\n // Draw the tongue line\n playerTongue.moveTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y);\n playerTongue.lineTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y - PLAYER_TONGUE_LENGTH * t);\n // Move the tongue tip to the end of the tongue\n playerTongueTip.y = -PLAYER_TONGUE_LENGTH * t;\n // Add the new tongue line\n player.sprite.addChild(playerTongue);\n // Add new tongue line to tongue layer\n playerTongue.displayGroup = tongueGroup;\n // Test for a hit between the tongue tip and the insects\n for(let insect of insectSpawner.insects){\n if(hitTestRectangle(playerTongueTip, insect.sprite)){\n player.sprite.removeChild(playerTongue);\n player.sprite.removeChild(playerTongueTip);\n player.attacking = false;\n player.attackCounter = 0;\n player.eat(insect);\n }\n }\n }\n}", "function walk2(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.x\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.x\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.x\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.x\r\n });\r\n\r\n xSlide.setKeys(keyFrames);\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n\r\n\r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3*Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3 * Math.PI / 2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function walk(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.z\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.z\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.z\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.z\r\n });\r\n xSlide.setKeys(keyFrames);\r\n\r\n\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n \r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n \r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function runForward($el, $bgWidth, duration, frameRate, dir){\n\n var frameWidth = $el.width();\n var frameHeight = $el.height();\n var frameNum = $bgWidth/frameWidth;\n var rate = duration/frameRate;\n var countFrame = 0\n\n var backgroundPos = $el.css('backgroundPosition').split(\" \");\n var xPos = backgroundPos[0],\n yPos = backgroundPos[1];\n\n\n function runStrip() {\n\n setInterval(function() {\n\n if (dir == 'h'){\n if(countFrame<frameNum) {\n $el.css({backgroundPosition: -frameWidth*countFrame + \"px \"+yPos});\n }\n else if(countFrame==frameNum) {\n //run on complete\n }\n }\n\n\n else if (dir == 'v'){\n if(countFrame<frameNum) {\n $el.css({backgroundPosition: xPos+\" \"+ (-frameWidth*countFrame) + \"px\"});\n }\n else if(countFrame==frameNum) {\n //run on complete\n }\n }\n\n\n countFrame++;\n\n }, rate);\n\n }\n\n runStrip();\n}", "function onFrame(gl, event) {\n\t// Update player movement @ 60hz\n\t// The while ensures that we update at a fixed rate even if the rendering bogs down\n\tupdateFrame(event.frameTime,event);\n\tdrawFrame(gl,event);\n return 0;\n}", "function frame() {\n var elem1 = document.getElementById(\"rocketId1\");\n var elem2 = document.getElementById(\"rocketId2\");\n if (_this.position >= 900) {\n // clearInterval(id);\n _this.position = 0;\n _this.launchRocket = false;\n }\n else {\n _this.position += _this.speedRocket / 5000;\n _this.launchRocket = true;\n (_this == rocket1) ? elem1.style.left = _this.position + 'px' : false;\n (_this == rocket2) ? elem2.style.left = _this.position + 'px' : false;\n elem1.innerHTML = \"<span class='txtspeed'>speed :\" + rocket1.speedRocket + \",pos: \" + rocket1.position + \"</span>\";\n elem2.innerHTML = \"<span class='txtspeed'>speed :\" + rocket2.speedRocket + \",pos: \" + rocket2.position + \"</span>\";\n }\n }", "function walk(){\n\t$(document).ready(function(){\n\tif(!checkMove()){ mainGame(); return;}\n\tdocument.getElementById(\"msg\").innerHTML = \"\";\n\tvar f = 0;\n\tvar pace = .5;\n\t//pace determines the speed of the animation. the pace is determined by the gameStatus[PACE]. the fast the in game pace, the faster the animation\n\tif(gameStatus[PACE] == STEADY)\n\t\tpace == 2;\n\telse if (gameStatus[PACE] == STRENUOUS)\n\t\tpace == 1;\n\telse if (gameStatus[PACE] == GRUELING)\n\t\tpace == .5;\n\tvar id = setInterval(frame, 5);\n function frame() {//every 50*pace iterations the frame is changed. it goes through 2 loops before stopping\n\t\tif (f == 0 || f == 200* pace){\n\t\t\t$(\"#ok\").attr(\"src\", \"image/Frame1.png\");\n\t\t}\n\t\telse if (f == (50 * pace) || f == (250 * pace)){\n\t\t\t$(\"#ok\").attr(\"src\", \"image/Frame2.png\");\n\t\t}\n\t\telse if (f == (100 * pace)|| f == (300 * pace)){\n\t\t\t$(\"#ok\").attr(\"src\", \"image/Frame1.png\");\n\t\t}\n\t\telse if (f == (150 * pace)|| f == (350 * pace)){\n\t\t\t$(\"#ok\").attr(\"src\", \"image/Frame4.png\");\n\t\t}\n if (f == 400 * pace) {//interval clears and travel trail is called once finished\n\t\t\t$(\"#ok\").attr(\"src\", \"image/Frame1.png\");\n clearInterval(id);\n\t\t\ttravelTrail();\n } \n\t\telse {\n\t\t\tf ++;\n }\n }\n\t});\n}", "function animation(poll1, text) {\r\n var canvas = document.getElementById(\"myCanvas\");\r\n var content = canvas.getContext(\"2d\");\r\n\r\n // clear canvas\r\n content.clearRect(0, 0, 460, 540);\r\n\r\n content.fillStyle = 'black';\r\n content.textAlign = 'center';\r\n content.font = '20pt Calibri';\r\n\r\n // make the wobbely values stop \r\n if (pollOneH * 2 > prevPotValue + 2 || pollOneH * 2 < prevPotValue - 2) {\r\n prevPotValue = potValue;\r\n potValue = pollOneH * 2;\r\n }\r\n\r\n content.fillText('Potmeter value: ' + potValue, text.x, text.y);\r\n\r\n // render graph \r\n content.fillStyle = 'orange';\r\n content.fillRect(poll1.x, (poll1.y - poll1.h), poll1.w, poll1.h);\r\n\r\n content.fill();\r\n\r\n // request new frame\r\n requestAnimFrame(function() {\r\n // console.log(\"got here\")\r\n if (poll1.h < pollOneH) {\r\n poll1.h += (pollOneH - poll1.h) * .15;\r\n } else if (poll1.h > pollOneH) {\r\n poll1.h -= (poll1.h - pollOneH) * .15;\r\n }\r\n text.y = (poll1.y - poll1.h) - 5;\r\n animation(poll1, text);\r\n });\r\n\r\n}", "function updateAnimatedCharacter() {\n var ctx = hangmanGame.canvas.getContext(\"2d\");\n\n ctx.drawImage(character.image, 400 * character.frame, 0, 400, 400, 310, 15, 200, 200);\n\n if (hangmanGame.frameCount % 25 === 0) {\n if (character.frame === 0) {\n character.frame++;\n } else {\n character.frame = 0;\n }\n }\n}", "function onStartFrame(t, state) {\n // (KTR) TODO implement option so a person could pause and resume elapsed time\n // if someone visits, leaves, and later returns\n let tStart = t;\n if (!state.tStart) {\n state.tStart = t;\n state.time = t;\n }\n\n tStart = state.tStart;\n\n let now = (t - tStart);\n // different from t, since t is the total elapsed time in the entire system, best to use \"state.time\"\n state.time = now;\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n let time = now / 1000;\n\n gl.uniform1f(state.uTimeLoc, time);\n\n gl.uniform4fv(state.uLightsLoc[0].dir, [.6917,.6917,.2075,0.]);\n gl.uniform3fv(state.uLightsLoc[0].col, [1., 1., 1.]);\n gl.uniform4fv(state.uLightsLoc[1].dir, [-.5774,.5774,-.5774,0.]);\n gl.uniform3fv(state.uLightsLoc[1].col, [1., 1., 1.]);\n\n gl.uniform1i(state.uShapesLoc[0].type, 1);\n gl.uniform4fv(state.uShapesLoc[0].center, [-.45*Math.sin(time),.45*Math.sin(time),.45*Math.cos(time), 1.]);\n gl.uniform1f(state.uShapesLoc[0].size, .12);\n\n gl.uniform3fv(state.uMaterialsLoc[0].ambient , [0.,.2,.8]);\n gl.uniform3fv(state.uMaterialsLoc[0].diffuse , [.8,.5,.5]);\n gl.uniform3fv(state.uMaterialsLoc[0].specular , [0.,.5,.5]);\n gl.uniform1f (state.uMaterialsLoc[0].power , 6.);\n gl.uniform3fv(state.uMaterialsLoc[0].reflection , [0.0392, 0.7098, 0.9137]);\n gl.uniform3fv(state.uMaterialsLoc[0].transparency, [0.0, 0.5176, 1.0]);\n gl.uniform1f (state.uMaterialsLoc[0].indexOfRefelction, 1.2);\n\n gl.uniform1i(state.uShapesLoc[1].type, 2);\n gl.uniform4fv(state.uShapesLoc[1].center, [.45*Math.sin(time),-.45*Math.cos(time),.45*Math.cos(time), 1.]);\n gl.uniform1f(state.uShapesLoc[1].size, .12);\n\n gl.uniform3fv(state.uMaterialsLoc[1].ambient , [0.7882, 0.1059, 0.1059]);\n gl.uniform3fv(state.uMaterialsLoc[1].diffuse , [.5,.5,0.]);\n gl.uniform3fv(state.uMaterialsLoc[1].specular , [.5,.5,0.]);\n gl.uniform1f (state.uMaterialsLoc[1].power , 10.);\n gl.uniform3fv(state.uMaterialsLoc[1].reflection , [0.9059, 0.0314, 0.0314]);\n gl.uniform3fv(state.uMaterialsLoc[1].transparency, [0.6275, 0.1569, 0.1569]);\n gl.uniform1f (state.uMaterialsLoc[1].indexOfRefelction, 1.4);\n\n gl.uniform1i(state.uShapesLoc[2].type, 2);\n gl.uniform4fv(state.uShapesLoc[2].center, [.45*Math.sin(time),.45*Math.cos(time),-.45*Math.sin(time), 1.]);\n gl.uniform1f(state.uShapesLoc[2].size, .12);\n\n gl.uniform3fv(state.uMaterialsLoc[2].ambient , [0.6157, 0.149, 0.4353]);\n gl.uniform3fv(state.uMaterialsLoc[2].diffuse , [0.8392, 0.7922, 0.149]);\n gl.uniform3fv(state.uMaterialsLoc[2].specular , [0.1725, 0.1725, 0.1098]);\n gl.uniform1f (state.uMaterialsLoc[2].power , 4.);\n gl.uniform3fv(state.uMaterialsLoc[2].reflection , [0.6549, 0.2549, 0.6235]);\n gl.uniform3fv(state.uMaterialsLoc[2].transparency, [0.7255, 0.1098, 0.698]);\n gl.uniform1f (state.uMaterialsLoc[2].indexOfRefelction, 1.5);\n \n gl.uniform1i(state.uShapesLoc[3].type, 0);\n gl.uniform4fv(state.uShapesLoc[3].center, [0.,0.,0.,1.]);\n gl.uniform1f(state.uShapesLoc[3].size, .18);\n\n gl.uniform3fv(state.uMaterialsLoc[3].ambient , [0.0549, 0.4275, 0.2118]);\n gl.uniform3fv(state.uMaterialsLoc[3].diffuse , [0.0196, 0.1647, 0.2314]);\n gl.uniform3fv(state.uMaterialsLoc[3].specular , [0.0824, 0.0196, 0.2]);\n gl.uniform1f (state.uMaterialsLoc[3].power , 6.);\n gl.uniform3fv(state.uMaterialsLoc[3].reflection , [0.3216, 0.8667, 0.0706]);\n gl.uniform3fv(state.uMaterialsLoc[3].transparency, [0.0, 1.0, 0.8353]);\n gl.uniform1f (state.uMaterialsLoc[3].indexOfRefelction, 1.2);\n\n gl.enable(gl.DEPTH_TEST);\n}", "function firstFrame(){\n\t$(\".mainMenuAnimation\").hide();\n\t$(\"#frame2\").show();\n\tif(blinkTime < 1){\n\t\tsetTimeout(secondFrame, 530)\n\t\t++blinkTime;\n\t}\n\telse{\n\t\tsetTimeout(thirdFrame, 400)\n\t}\n\t\n}", "function frame () {\n\tmap.frame();\n}", "function Frame01() {\n\n\n\n t.to(introCard, .5, { y: -300, ease: Power3.easeInOut, delay: 2 });\n\n t.delayedCall(2, Frame02);\n\n }", "function initialFrame() {\n\t\t$(\"text-area\").value = ANIMATIONS[$(\"animation-dropbox\").value];\n\t}", "play() {\n this.frame = window.requestAnimationFrame(()=>this.firstFrame());\n }", "onFrame() {\n for (let i in this.boids) {\n this.boids[i].react(this.boids, this.obstacles);\n }\n for (let i in this.boids) {\n\n this.boids[i].update();\n }\n\n var nowTime = Date.now();\n this.fpsCounter.content = \"FPS: \" + Math.round(1000 / (nowTime - this.lastFrameTime));\n this.lastFrameTime = nowTime;\n }", "function routeFrame(player) {\n if (player.jump.falling) {\n return 'jump';\n }\n\n if (player.go.distance > 0) {\n if ((player.vel.x > 0 && player.go.dir < 0) || (player.vel.x < 0 && player.go.dir > 0)) {\n return 'break';\n \n }\n return runAnim(player.go.distance);\n }\n return 'idle';\n }", "updateFrame() {\n let newFrameIndex;\n if(this.isInReverse) {\n newFrameIndex = this.currFrame - 1;\n if(newFrameIndex < 0) {\n if (this.loops) {\n this.isInReverse = false;\n newFrameIndex = this.currFrame + 1;\n } else {\n this.isAnimating = false;\n this.isFinished = true;\n newFrameIndex = 0;\n } \n } \n } else {\n newFrameIndex = this.currFrame + 1;\n if(newFrameIndex >= this.frames.length) {\n if(this.reverses) {\n newFrameIndex = this.currFrame - 1;\n this.isInReverse = true;\n } else if(this.loops) {\n newFrameIndex = 0;\n } else if (this.holds) { \n newFrameIndex = this.frames.length - 1;\n } else {\n this.isAnimating = false;\n this.isFinished = true;\n newFrameIndex = 0;\n }\n }\n }\n\n this.currFrame = newFrameIndex;\n }", "function frame() {\n if (width >= 100) {\n clearInterval(id);\n i = 0;\n move2();\n } else {\n width = width + 5.8;\n elem.style.width = width + \"%\";\n }\n }", "function doFrame()\r\n{\r\n updateForFrame();\r\n // checkWallCollisions();\r\n modelMovement();\r\n doFlameRotation(flameRed);\r\n doFlameRotation(flameYell);\r\n lightingSystem();\r\n\r\n\r\n render();\r\n if (!gameover)\r\n {\r\n requestAnimationFrame(doFrame);\r\n } \r\n else if (win)\r\n {\r\n // gameOverLoss(); // For easy loss testing\r\n gameOverWin();\r\n } \r\n else\r\n {\r\n gameOverLoss();\r\n }\r\n}", "function obtenerSegundos(frame){\r\n return frame/fpsVideo;\r\n}", "walk(framesCounter) {\n this.ctx.drawImage(\n this.imageInstance,\n this.imageInstance.framesIndex * Math.floor(this.imageInstance.width / this.imageInstance.frames),\n 0,\n Math.floor(this.imageInstance.width / this.imageInstance.frames),\n this.imageInstance.height,\n this.shinobiPos.x,\n this.shinobiPos.y,\n this.shinobiSize.w,\n this.shinobiSize.h\n )\n this.animateSprite(framesCounter)\n }", "animMoveBack(direction) {\n let anim = this.renderAnimation('moveBack', direction);\n let board = this.board;\n let pixi = this.pixi;\n\n anim.frames.forEach((frame, frameId) => {\n let offsetRatio = (frameId + 1) / anim.frames.length;\n let offset = board.getOffset(-offsetRatio / 2, direction);\n\n anim.splice(frameId, () => pixi.data.position = new PIXI.Point(\n pixi.position.x + offset[0],\n pixi.position.y + offset[1],\n ));\n });\n\n return anim;\n }", "nextFrame() {\n this.updateParticles();\n this.displayMeasurementTexts(this.stepNo);\n this.stepNo++;\n\n if (this.stepNo < this.history.length - 1) {\n // Set timeout only if playing\n if (this.playing) {\n this.currentTimeout = window.setTimeout(\n this.nextFrame.bind(this),\n this.animationStepDuration\n );\n }\n } else {\n this.finish();\n }\n }", "function frame(){\r\n\t\t \t\tupdate();\r\n\t\t \t\tcollides();\r\n\t\t \t\tdraw();\r\n\t\t \t\tloop = requestAnimationFrame(frame);\r\n\t\t \t}", "function frame(){\r\n\t\t \t\tupdate();\r\n\t\t \t\tcollides();\r\n\t\t \t\tdraw();\r\n\t\t \t\tloop = requestAnimationFrame(frame);\r\n\t\t \t}", "loop() {\n if (!this.playing) {\n this.$modeIndicator.text('')\n return\n }\n\n // Update UI\n let dLost = 0\n if (this.action === ATTACKING || this.cancelledAt !== false) {\n dLost = Math.max(0, now() - this.lastChange)\n } else if (this.action === MOVING && this.attackTime > this.cAttackTime) {\n dLost = this.attackTime - this.cAttackTime\n }\n this.$timerTotal.text(formatSeconds(now() - this.startTime))\n this.$timerLost.text(formatSeconds(this.lostTime + dLost))\n this.$modeIndicator.text(this.action === ATTACKING ? ATTACKING_ICON : MOVING_ICON)\n\n let attackTime = this.attackTime = now() - this.lastAttackStart\n\n if (this.cancelledAt !== false) {\n attackTime = this.attackTime = 0\n this.lastHead = 0\n }\n\n if (attackTime > this.cAttackTime) {\n // Start a new attack\n if (this.action === ATTACKING) {\n this.startAttack()\n } else {\n this.lastChange = this.lastAttackStart + this.cAttackTime\n }\n }\n\n if (attackTime <= this.cAttackTime) {\n // Move playhead\n let attackPosition = attackTime / this.cAttackTime\n this.$timeSliderHead.css({ left: `${attackPosition * 100}%` })\n\n // Draw on canvas\n let pos = Math.floor(attackTime / this.cAttackTime * 601)\n this.ctx.save()\n this.ctx.fillStyle = this.action === ATTACKING ? ATTACKING_COLOR : MOVING_COLOR\n this.ctx.fillRect(this.lastHead, 0, pos - this.lastHead, 4)\n this.ctx.restore()\n this.lastHead = pos\n } else {\n this.$timeSliderHead.css({ left: `0%` })\n }\n\n requestAnimationFrame(this.loopBind)\n }", "function frame() {\n if (width >= 100) {\n clearInterval(id);\n i = 0;\n } else {\n width = width + 5.8;\n elem.style.width = width + \"%\";\n }\n }", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime; \n rotAngle= (rotAngle+1.0) % 360;\n }\n var elapsed=timeNow-lastTime;\n lastTime = timeNow;\n \n //when framecount is less than 120, the effect is just rotation\n //when framecount is between 120 to 240, the effect is shaking from left to right\n //when framecount is between 240 to 360, the effect is enlarging from left to right\n //when framecount is between 360 to 480, the effect is shaking hands\n //when framecount is between 480 to 600, the effect is enlargeing from top to bottom\n //then repeat\n days=days+0.01;\n if(framecount>=120 && framecount <240){\n updateBuffers();\n \n } \n if(framecount>=240 && framecount <360) {\n updateBuffers1();\n updatecolor();\n\n }\n if(framecount>=360 && framecount <480){\n updateBuffers2();\n }\n if (framecount >=480 && framecount < 600) {\n \n updateBuffers3();\n updatecolor();\n \n }\n \n \n \n}", "hasFrames() {\nreturn this.fCount !== 0;\n}", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "check_GameMovie(){\n if(this.scene.showGameMovie){\n for (let i = this.model.playsCoords.length - 1; i >= 0; i--) {\n let playCoords = this.model.playsCoords[i];\n let playValues = this.model.playsValues[i];\n this.view.setPieceToStartPos(playCoords[0], playCoords[1], playValues[1]);\n }\n this.state = 'WAIT_GM_1st_ANIMATION_END';\n \n }\n }", "resetCASTiming(fps) {\nreturn [this.ic, this.tc, this.fpsc] = [0, 0, fps];\n}", "animationFrame() {\n requestAnimationFrame(this.animationFrame.bind(this));\n if (this.switchDrawJoints) {\n GlobalVars.animationFrameCount++;\n this.drawBodyJoints();\n }\n\n }", "move(){\r\n if (this.counter % this.trajectory[this.step][Trajectory.Duration] == 0) {\r\n this.hide()\r\n this.step ++\r\n this.counter= 0\r\n basic.pause(50)\r\n if (this.step == this.trajectory.length) {\r\n this.active = false \r\n } else {\r\n this.y = this.trajectory[this.step][Trajectory.Vertical]\r\n led.plotBrightness(this.x, this.y, this.y == 4 ? 255 : this.brightness)\r\n }\r\n this.show()\r\n }\r\n this.counter ++\r\n }", "function checkBottleAnimation() {\n setInterval(function () {\n let index = thrownbottleGraphicsIndex % thrownbottleGraphics.length;\n thrownbottleCurrentImage = thrownbottleGraphics[index];\n thrownbottleGraphicsIndex = thrownbottleGraphicsIndex + 1;\n }, 70);\n}", "getAmbientFrames() {\nvar amb;\n//---------------\namb = this.ambientAnim;\nif (amb) {\nreturn amb.getAmbientFrames();\n} else {\nreturn [this.getEmptyPose()];\n}\n}", "function victoryAnimation() {\n\tfor (let i = 0; i < 8; i++) {\n\t\tflashLetters(i);\n\t}\n}", "_frame () {\n this._drawFrame()\n if (!this.paused) {\n if (this.frameCount % 4 === 0) {\n this._updateGeneration()\n this.matrix = this.nextMatrix\n this.nextMatrix = this._createMatrix()\n this.counter.innerText = 'Generation: ' + this.generationNumber\n }\n }\n this.frameCount++\n requestAnimationFrame(this._frame)\n }", "function updateAnimation() {\n drawCanvas();\n puckCollision();\n if (goalScored()) {\n resetPuck();\n resetStrikers();\n }\n moveCPUStriker();\n seconds = seconds - (16 / 1000);\n // as long as there is time remaining, don't stop\n if (seconds > 0) {\n document.getElementById(\"time\").innerHTML = Math.round(seconds, 2);\n } else {\n // if less than 3 periods have elapsed, do the following\n if (periodNum < 3) {\n nextPeriod();\n } else {\n stopAnimation();\n }\n }\n }", "function update() {\n generatePipes();\n frames++;\n console.log(frames);\n //va creando y borrando, cambiando x & y\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n board.draw();\n faby.draw();\n drawPipes();\n board.drawScore();\n checkCollision();\n}", "function draw() {\n background(\"lightblue\");\n /*Put your main animations and code here*/\n\t \n /*ctx.fillStyle = \"blue\";\n\tt.rect(turt.x, turt.y, 200, 200);*/\n\t\n /*log frame*/\n showFrames();\n}", "function runTimeFrame() {\n g.beginPath();\n evolve();\n draw();\n g.stroke();\n }", "function startScreen() {\n fill(255, 56, 115, opacity);\n rect(0,0,width,height);\n textSize(12);\n if (frameCount%2 == 0){\n fill(255,opacity);\n textAlign(CENTER);\n textSize(12);\n text(\"CLICK TO PLAY\", width/2, height/2);\n }\n}", "leftState(){\n this.state = \"left\";\n this.animationTime = 40;\n this.currentFrameNum = 0;\n this.currentFrameY = 553;\n this.currentFrameX = 0;\n this.frameHeight = 114;\n this.frameWidth = 94;\n this.maxFrame = 9;\n }", "createSpriteAnimations() {\n const haloFrames = this.anims.generateFrameNames('haloHit', { \n start: 1, end: 84, zeroPad: 5,\n prefix: 'Halo_' , suffix: '.png'\n });\n\n this.anims.create({ key: 'haloHit', frames: haloFrames, frameRate: 60, repeat: 0 });\n\n const sparkFrames = this.anims.generateFrameNames('sparkHit', { \n start: 1, end: 84, zeroPad: 5,\n prefix: 'Spark_' , suffix: '.png'\n });\n\n this.anims.create({ key: 'sparkHit', frames: sparkFrames, frameRate: 60, repeat: -1 });\n }", "function frame_f1() {\n\t\t// Set frame content visible\n\t\tsetFrameVisible(frmSec[secIndx-1], false);\n\t\t// In animations\n\t\tTweenLite.set(['#logo'], { opacity: 1 });\n\t\t// Out animations\n\t\tTweenLite.set(['#logo'], { opacity: 0, delay: fD[secIndx] });\n\t\t// Next frame call\n\t\tnextFrameCall(fD[secIndx], frmSec[secIndx]);\n\t}", "setFrame(frame) {\n//-------\nthis.skeleton.setBones(frame.getTRSets());\nreturn this.currentMorphs = frame.getMorphs();\n}", "function animateBoyWalk() {\n if (boyWalkFrame > 10) boyWalkFrame = 1;\n\n var fileName = boywalk + \"frame\" + boyWalkFrame + \".gif\";\n\n boyImage.src = fileName;\n ctx.drawImage(boyImage, boy.x, boy.y, boy.height, boy.width);\n\n //console.log(fileName);\n boyWalkFrame++;\n\n //requestAnimationFrame(animateBoyWalk, 100);\n}", "function stateAnimation(delta) {\n [koiText, endText].forEach(el => {\n if (el.visible === true && !textRunFinished) {\n if (el.x < 120) {\n el.x += el.speed * delta;\n } else {\n el.speed = 0;\n el.x = 120;\n textRunFinished = true;\n }\n }\n });\n}", "handleDragonFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "function checkForRunning() {\n setInterval(function () {\n if (isMovingRight && !isJumping) {\n AUDIO_RUNNING.play();\n let index = characterGraphicsIndex % characterRunningGraphicsRight.length;\n currentCharacterImage = characterRunningGraphicsRight[index];\n characterGraphicsIndex = characterGraphicsIndex + 1;\n PlayerLastDirection = 'right';\n }\n if (isMovingLeft && !isJumping) {\n AUDIO_RUNNING.play();\n let index = characterGraphicsIndex % characterRunningGraphicsLeft.length;\n currentCharacterImage = characterRunningGraphicsLeft[index];\n characterGraphicsIndex = characterGraphicsIndex + 1;\n PlayerLastDirection = 'left';\n }\n if (!isMovingLeft && !isMovingRight && PlayerLastDirection == 'right') {\n AUDIO_RUNNING.pause();\n let index = characterGraphicsIdleIndex % characterIdleGraphicsRight.length;\n currentCharacterImage = characterIdleGraphicsRight[index];\n characterGraphicsIdleIndex = characterGraphicsIdleIndex + 1;\n }\n if (!isMovingLeft && !isMovingRight && PlayerLastDirection == 'left') {\n AUDIO_RUNNING.pause();\n let index = characterGraphicsIdleIndex % characterIdleGraphicsLeft.length;\n currentCharacterImage = characterIdleGraphicsLeft[index];\n characterGraphicsIdleIndex = characterGraphicsIdleIndex + 1;\n }\n \n }, 60);\n}" ]
[ "0.68405306", "0.62424135", "0.6224361", "0.6168025", "0.6137486", "0.60569984", "0.6055182", "0.60536665", "0.6029969", "0.6026117", "0.6007218", "0.6005884", "0.59817666", "0.59764534", "0.5971013", "0.59471613", "0.5947107", "0.59462726", "0.5945132", "0.5942897", "0.5920948", "0.59205127", "0.59120667", "0.59064347", "0.58947915", "0.58844924", "0.58766013", "0.58639747", "0.5858522", "0.58520204", "0.58495206", "0.58452404", "0.5844946", "0.58260435", "0.58206344", "0.58137864", "0.5813708", "0.58036864", "0.58008516", "0.5795478", "0.5793228", "0.5792547", "0.57869357", "0.57774115", "0.5772627", "0.5765132", "0.57518566", "0.57403475", "0.57402456", "0.57236487", "0.5722932", "0.57207096", "0.57189596", "0.5718534", "0.5714729", "0.57108116", "0.5702247", "0.56879675", "0.5682595", "0.56729937", "0.56715196", "0.56610054", "0.5655453", "0.5653885", "0.56519717", "0.56360286", "0.5634906", "0.56338507", "0.562852", "0.56276625", "0.5617904", "0.56124717", "0.561189", "0.561189", "0.5610724", "0.5610553", "0.5610097", "0.56058973", "0.55993676", "0.5594426", "0.55918926", "0.55902654", "0.55870163", "0.55829334", "0.55810654", "0.5580962", "0.5579026", "0.55769444", "0.5576381", "0.55618334", "0.55605066", "0.5558797", "0.5554606", "0.55541915", "0.5547522", "0.55439997", "0.5542187", "0.5536368", "0.55351835", "0.55344063" ]
0.6790762
1
frames for when the character uses the hadouken
hadouken(){ this.state = "hadouken"; this.animationTime = 55; this.currentFrameNum = 0; this.willStop = false; this.currentFrameX = 0; this.currentFrameY = 2348; this.frameHeight = 109; this.frameWidth = 125; this.maxFrame = 8; hadouken1.startTime = millis(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleheroFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "function victoryAnimation() {\n\tfor (let i = 0; i < 8; i++) {\n\t\tflashLetters(i);\n\t}\n}", "function drawFrame() {\n //Fundo e Caixas\n for (var i = 0; i < HUD.length; i++) {\n ctx.drawImage(HUD[i].image, HUD[i].x, HUD[i].y, HUD[i].w, HUD[i].h);\n }\n //Score\n ctx.fillStyle = \"#FFFFFF\"\n ctx.font = (canvas.height / 15) + \"px Roboto\"\n drawCenterText(scoreText, HUD[3].x, HUD[3].y + canvas.height / 14, HUD[3].w);\n //Tepmo\n ctx.fillStyle = \"#FFFFFF\"\n ctx.font = (canvas.height / 15) + \"px Roboto\"\n drawCenterText(Math.trunc(time), HUD[4].x, HUD[4].y + canvas.height / 14, HUD[4].w);\n //Debug\n ctx.fillStyle = \"#FFFFFF\"\n ctx.font = \"8px Roboto\"\n ctx.fillText(\"FPS: \" + fps, canvas.width / 50, canvas.height - 0.1 * modY);\n }", "frame() {\n this.display();\n this.move();\n this.edgeCheck();\n }", "function wobbleTheBrain(input){\n\n\t\t\tif(input === 'start'){\n\t\t\t\tjQuery('.Head')\n\t\t\t\t\t.find('#Colors')\n\t\t\t\t\t.css({\n\t\t\t\t\t\t'-webkit-animation-name': 'BRAINITCH',\n\t\t\t\t\t '-webkit-animation-duration': '0.5s',\n\t\t\t\t\t '-webkit-transform-origin': '50% 50%',\n\t\t\t\t\t '-webkit-animation-iteration-count': 'infinite',\n\t\t\t\t\t '-webkit-animation-timing-function': 'linear'\n\t\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tjQuery('.Head')\n\t\t\t\t\t.find('#Colors')\n\t\t\t\t\t.css({\n\t\t\t\t\t\t'-webkit-animation-name': '',\n\t\t\t\t\t\t'-webkit-transform': 'translate(0px, 0px) rotate(0deg)'\n\t\t\t\t\t});\n\t\t\t}\n\t\t}", "function background(){//play next animation frame\n switch (whois) { // get which backgrouds animations to use\n case 'harvey':\n for(i=0; i < harveyAnimWrong.length; i++){// get the nameToSpells anim\n animWrong.push(harveyAnimWrong[i])\n }\n for(i=0; i < harveyAnimRight.length; i++){// get the nameToSpells anim\n animRight.push(harveyAnimRight[i])\n }\n for(i=0; i < harveyAnimLook.length; i++){// get the nameToSpells anim\n animLook.push(harveyAnimLook[i])\n }\n for(i=0; i < harveyAnimWin.length; i++){// get the nameToSpells anim\n animWin.push(harveyAnimWin[i])\n }\n break;\n case 'emma':\n for(i=0; i < emmaAnimWrong.length; i++){// get the nameToSpells anim\n animWrong.push(emmaAnimWrong[i])\n }\n for(i=0; i < emmaAnimRight.length; i++){// get the nameToSpells anim\n animRight.push(emmaAnimRight[i])\n }\n for(i=0; i < emmaAnimLook.length; i++){// get the nameToSpells anim\n animLook.push(emmaAnimLook[i])\n }\n for(i=0; i < emmaAnimWin.length; i++){// get the nameToSpells anim\n animWin.push(emmaAnimWin[i])\n }\n break;\n default:\n for(i=0; i < harveyAnimWrong.length; i++){// get the nameToSpells anim\n animWrong.push(harveyAnimWrong[i])\n }\n for(i=0; i < harveyAnimRight.length; i++){// get the nameToSpells anim\n animRight.push(harveyAnimRight[i])\n }\n for(i=0; i < harveyAnimLook.length; i++){// get the nameToSpells anim\n animLook.push(harveyAnimLook[i])\n }\n for(i=0; i < harveyAnimWin.length; i++){// get the nameToSpells anim\n animWin.push(harveyAnimWin[i])\n }\n } \n document.body.style.backgroundImage = 'url(\"' + photo + '\"), url(\"' + currentAnim[frame] + '\"),url(\"' + photo + '\")'; // set the background\n}", "function scene14(){\n\n background(25);\n\n fill(0,255,0);\n noStroke();\n textAlign(CENTER);\n textSize(20);\n\n text('YOU HAVE JOURNEYED NOT ONLY ACROSS TIME'.substring(0, frameCount/2),width/2,100)\n text('BUT ACROSS DIFFERENT PLANETS, AND DIFFERENT LIVES AS WELL'.substring(0, frameCount-75/2),width/2,150)\n text('IS THE FUTURE MORE OF THE SAME AS NOW?'.substring(0, frameCount-75/2),width/2,200)\n text('OR IS IT COMPLETELY DIFFERENT?'.substring(0, frameCount-75/2),width/2,250)\n\n\n ///////////////////BENHAM/////////////////////////\n\n push();\n translate(width/2,height-100);\n rotate(frameCount);\n Benham(0,0,250);\n pop();\n\n////////////////////////////////////////////////////\n\n}", "beginFrame() { }", "function frame1()\n\t{\n\n\t\tTweenLite.to(over, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(eight, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.1, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(million, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.2, ease: Expo.easeOut});\t\t\n\n\t\tTweenLite.delayedCall(0.8, frame2);\n\t}", "function frame(string) {\n \n}", "function frame() {\n\t\tleft += 2.5;\n\t\t//opacity += 0.02;\n\t\tanimal.style.left = left + 'px';\n\t\t//txt.style.opacity = opacity;\n\t\tif (left >= 15) {\n\t\t\tclearInterval(interval);\n\t\t\tanimal.style.left = \"15px\";\n\t\t\t//txt.style.opacity = 1;\n\t\t\tspots_disabled = false;\n\t\t\tfadein_text();\n\t\t}\n\t}", "function onFrame(event) {\n\tframePosition += (mousePos - framePosition) / 10;\n\tvar vector = (view.center - framePosition) / 10;\n\tmoveStars(vector * 3);\n\tmoveRainbow(vector, event);\n}", "function playerAttackAnimation(delta){\n let prevAttackCounter = player.attackCounter;\n player.attackCounter += (delta / 1000);\n let t = player.attackCounter / PLAYER_ATTACK_ANIMATION_LENGTH;\n if(prevAttackCounter == 0){\n // Create the two parts of the tongue\n playerTongue = new PIXI.Graphics();\n playerTongueTip = new PIXI.Graphics();\n playerTongue.lineStyle(PLAYER_TONGUE_WIDTH, PLAYER_TONGUE_COLOR, 1);\n playerTongueTip.lineStyle(0, PLAYER_TONGUE_COLOR, 1);\n // Draw the tongue line\n playerTongue.moveTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y);\n playerTongue.lineTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y - PLAYER_TONGUE_LENGTH * t);\n // Draw the tongue tip\n playerTongueTip.beginFill(PLAYER_TONGUE_COLOR, 1);\n playerTongueTip.drawCircle(PLAYER_MOUTH_X, PLAYER_MOUTH_Y + 10 - PLAYER_TONGUE_LENGTH * t, 20);\n playerTongueTip.endFill();\n // Add both parts to the player sprite\n player.sprite.addChild(playerTongue);\n player.sprite.addChild(playerTongueTip);\n // Add both parts to the tongue layer\n playerTongue.displayGroup = tongueGroup;\n playerTongueTip.displayGroup = tongueGroup;\n\n } else if(player.attackCounter > PLAYER_ATTACK_ANIMATION_LENGTH){\n\n player.sprite.removeChild(playerTongue);\n player.sprite.removeChild(playerTongueTip);\n player.attacking = false;\n player.attackCounter = 0;\n\n } else {\n // Draw the tongue line\n playerTongue.moveTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y);\n playerTongue.lineTo(PLAYER_MOUTH_X, PLAYER_MOUTH_Y - PLAYER_TONGUE_LENGTH * t);\n // Move the tongue tip to the end of the tongue\n playerTongueTip.y = -PLAYER_TONGUE_LENGTH * t;\n // Add the new tongue line\n player.sprite.addChild(playerTongue);\n // Add new tongue line to tongue layer\n playerTongue.displayGroup = tongueGroup;\n // Test for a hit between the tongue tip and the insects\n for(let insect of insectSpawner.insects){\n if(hitTestRectangle(playerTongueTip, insect.sprite)){\n player.sprite.removeChild(playerTongue);\n player.sprite.removeChild(playerTongueTip);\n player.attacking = false;\n player.attackCounter = 0;\n player.eat(insect);\n }\n }\n }\n}", "function tick() {\n requestAnimFrame(tick);\t//Funktion des Scripts 'webgl-utils.js': Aktualisiert Seite Browser-unabhaengig (nur wenn Tab aktiv)\n drawScene();\t\t\t//Zeichne neues Bild\n animate();\n\n }", "function update() {\n frames++;\n fish.update();\n //console.log(fish.y);\n}", "function do_frame() {\n\t\t\tupdate_stats();\n\t\t\tif(!call_user_callbacks()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tupdate();\n\t\t\tdraw();\n\n\t\t\tmedeactx.frame_flags = 0;\n\t\t}", "function renderFrame() {\n let delta = 0;\n if (last_time !== 0) {\n delta = (new Date().getTime() - last_time);\n }\n last_time = new Date().getTime();\n\n // call the LoopCallback function in the WASM module\n exports.LoopCallback(delta,\n leftKeyPress, rightKeyPress,\n upKeyPress, downKeyPress,\n spaceKeyPress, cloakKeyPress);\n\n // Turn of click-shoot\n\n spaceKeyPress = false\n\n // requestAnimationFrame calls renderFrame the next time a frame is rendered\n requestAnimationFrame(renderFrame);\n}", "function draw() {\n background(\"lightblue\");\n /*Put your main animations and code here*/\n\t \n /*ctx.fillStyle = \"blue\";\n\tt.rect(turt.x, turt.y, 200, 200);*/\n\t\n /*log frame*/\n showFrames();\n}", "function updateFrame() {\n\tarthur.currentFrame = ++arthur.currentFrame % arthur.colums;\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tarthur.srcY = 0;\n\tcontext.clearRect(arthur.x, arthur.y, 64, 64);\n\n\t// if (myModule.newZombie.isCrashed) {\n\t// \tarthur.die = true;\n\t// \tconsole.log(arthur.die);\n\t// }\n}", "function forward(){\n if(curFrame <= frames.length-1)\n drawCurFrame();\n}", "function onFrame() \n{\n\tupdate();\n}", "function frame() {\n\n frameCount++;\n increment = 22 - frameCount; // move faster every frame\n\n if (increment < 2) increment = 2;\n\n deltaX += increment;\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n if (deltaX >= 100) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n\n // end animation\n if (deltaX >= 215) {\n clearInterval(animation);\n menuToggleBar.style.width = (220 - 40) + 'px';\n menu.style.right = 0 + 'px';\n deltaX = 220;\n isMenuAnimating = false;\n\n }\n }", "display(){\n\n push();\n // stylize this limb\n strokeWeight(1);\n stroke(45, 175);\n\n // vary fill values\n let redFill = cos(radians(frameCount/0.8));\n\n if(this.legOverlap) {\n this.greenFill = 30+cos(radians(frameCount*8 ))*25;\n redFill = 185+cos(radians(frameCount*3))*30;\n }\n else {\n this.greenFill = 200+cos(radians(frameCount*8 ))*45;\n redFill = 30+cos(radians(frameCount*3))*25;\n }\n\n // give arms and legs a different fill\n if(this.flip===1){\n if(this.xflip===1) fill(this.greenFill, redFill, 23);\n if(this.xflip===-1) fill(23, redFill, this.greenFill);\n }\n if(this.flip===-1) fill(redFill, 25, this.greenFill);\n\n // apply thigh rotation\n rotateZ(this.xflip*radians(this.thigh.angle2));\n rotateX(this.flip*this.thigh.angle - radians(dude.back.leanForward));\n rotateY(this.direction*PI - 2* this.xflip*dude.hipMove);\n translate(0, -this.thigh.length/2, 0);\n\n // draw thigh\n box(10, this.thigh.length, 10);\n\n // apply knee rotation\n translate(0, -this.thigh.length/2, 0)\n rotateX(this.knee.angle);\n // rotate this limb to match hip motion\n rotateZ(radians(-3*dude.hipMove));\n translate(0, this.thigh.length/2, 0);\n\n // draw knee\n box(10, this.thigh.length, 10);\n pop();\n }", "onTransitionEnd() {\n this.nextKeyframe();\n }", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function deathAnimation(ran, v2) {\n if (ran == 0) {\n v2.text = '💢'\n setTimeout(() => {\n v2.text = '🤬'\n setTimeout(() => {\n v2.text = '💢'\n setTimeout(() => {\n v2.text = '🤬'\n setTimeout(() => {\n v2.text = '💢'\n }, 100);\n }, 100);\n }, 100);\n }, 100);\n } else if (ran == 1) {\n v2.text = '🔅'\n setTimeout(() => {\n v2.text = '🔆'\n setTimeout(() => {\n v2.text = '🔅'\n setTimeout(() => {\n v2.text = '🔆'\n setTimeout(() => {\n v2.text = '🔅'\n }, 100);\n }, 100);\n }, 100);\n }, 100);\n } else if (ran == 2) {\n v2.text = '🔴'\n setTimeout(() => {\n v2.text = '🔶'\n setTimeout(() => {\n v2.text = '🔴'\n setTimeout(() => {\n v2.text = '🔶'\n setTimeout(() => {\n v2.text = '🔴'\n }, 100);\n }, 100);\n }, 100);\n }, 100);\n } else if (ran == 3) {\n v2.text = '⭕'\n setTimeout(() => {\n v2.text = '⛔'\n setTimeout(() => {\n v2.text = '⭕'\n setTimeout(() => {\n v2.text = '⛔'\n setTimeout(() => {\n v2.text = '⭕'\n }, 100);\n }, 100);\n }, 100);\n }, 100);\n } else {\n v2.text = '🖤'\n setTimeout(() => {\n v2.text = '💔'\n setTimeout(() => {\n v2.text = '🖤'\n setTimeout(() => {\n v2.text = '💔'\n setTimeout(() => {\n v2.text = '🖤'\n }, 100);\n }, 100);\n }, 100);\n }, 100);\n }\n}", "function Frame01() {\n\n\n\n t.to(introCard, .5, { y: -300, ease: Power3.easeInOut, delay: 2 });\n\n t.delayedCall(2, Frame02);\n\n }", "function main(){\r\n\tvar TL=fl.getDocumentDOM().getTimeline()\r\n\tvar curL=TL.currentLayer;\r\n\tvar curF=TL.currentFrame;\r\n\tvar frame=TL.layers[curL].frames[curF];\r\n\tif(curF>frame.startFrame){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t}else if(curF==frame.startFrame && curF>0){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t\tvar prevFrame=TL.layers[curL].frames[frame.startFrame-1];\r\n\t\tTL.currentFrame=frame.startFrame-(prevFrame.duration);\r\n\t}\r\n}", "function AnimateHit():void {\n\tcharDummy.animation.CrossFade(\"hit\", 0.1);\n}", "function showThreesixty () {\n // Fades in the image slider by using the jQuery \"fadeIn\" method\n $images.fadeIn(\"slow\");\n // Sets the \"ready\" variable to true, so the app now reacts to user interaction\n ready = true;\n // Sets the endFrame to an initial value...\n endFrame = -720;\n // ...so when the animation renders, it will initially take 4 complete spins.\n if(!demoMode) {\n refresh();\n } else {\n fakePointerTimer = window.setInterval(moveFakePointer, 100);\n }\n }", "function firstFrame(){\n\t$(\".mainMenuAnimation\").hide();\n\t$(\"#frame2\").show();\n\tif(blinkTime < 1){\n\t\tsetTimeout(secondFrame, 530)\n\t\t++blinkTime;\n\t}\n\telse{\n\t\tsetTimeout(thirdFrame, 400)\n\t}\n\t\n}", "function frame() {\n console.log(\"zaim\");\n if (pos == z) {\n clearInterval(id);\n } else {\n pos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = pos+\"px\"; \n x=pos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function frame() {\n //console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos++; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function trackFrameEnd(){\n}", "function drawHangman() {\n}", "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "function animationLost() {\n\t\tconsole.log(\"he perdido\");\t\n\tposX2=hasta;\t\nhasta=hasta-60;\nposX=posX-60;\n\t\t// Start the animation.\n\t\trequestID2 = requestAnimationFrame(animate2);\n\t}", "function kuroAnimationListener() {\n switch (event.type) {\n case \"animationend\":\n hashtag.style.display = \"none\";\n allCharacters.style.display = \"none\";\n zeros.style.display = \"block\";\n break;\n }\n}", "function drawPrevFrames() {;\n\tfor (let i = player.prevPosition.length - 1; i >= 0; i--) {\n\t\tctx.globalAlpha = (0.3 / i) + 0.1;\n\t\tif (i % 3 === 2) {\n\t\t\tctx.strokeRect(player.prevPosition[i].x, player.prevPosition[i].y, player.width, player.height);\n\t\t}\n\t\tif (i > 0) {\n\t\t\tplayer.prevPosition[i].x = player.prevPosition[i - 1].x;\n\t\t\tplayer.prevPosition[i].y = player.prevPosition[i - 1].y;\n\t\t} else if ((player.x > scrollBound) && (player.x < (gameWidth / 2))) {\n\t\t\tplayer.prevPosition[i].x = player.x;\n\t\t\tplayer.prevPosition[i].y = player.y;\n\t\t} else {\n\t\t\tplayer.prevPosition[i].x = player.x - (player.xVelocity * (i + 1));\n\t\t\tplayer.prevPosition[i].y = player.y;\n\t\t\tfor (let i = player.prevPosition.length - 1; i >= 0; i--) {\n\t\t\t\tplayer.prevPosition[i].x = player.x - (player.xVelocity * (i + 1));\n\t\t\t}\n\t\t}\n\t}\n\tctx.globalAlpha = 1;\n}", "function C010_Revenge_SidneyJennifer_JenniferBark() {\n\tOverridenIntroImage = \"\";\n\tActorSetPose(\"Bark\");\n\tCurrentTime = CurrentTime + 50000;\n}", "function animations() {\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tif (arthur.goRight) {\n\t\tarthur.srcY = arthur.goRowRight * arthur.height;\n\t} else if (arthur.goLeft) {\n\t\tarthur.srcY = arthur.goRowLeft * arthur.height;\n\t} else if (arthur.duckRight) {\n\t\tarthur.srcY = arthur.duckRowRight * arthur.height;\n\t} else if (arthur.atkRight) {\n\t\tarthur.srcY = arthur.atkRowRight * arthur.height;\n\t} else if (arthur.jumpRight) {\n\t\tarthur.srcY = arthur.jumpRowRight * arthur.height;\n\t} else if (arthur.die) {\n\t\tarthur.srcY = arthur.dieRowRight * arthur.height;\n\t}\n}", "function initStage015(stage){\n\nvar item;\n\n// Percent of one unit. if you want to change unit size, change this.\nvar u=8;\n\n/////Animation Parameter/////\n//\n//dsp :display (true/false) startIndex.... display or hide\n//x : position x (percent)\n//y : position y (percent)\n//w : width (percent)\n//h : height (percent)\n//bgc : background-color\n//bdc : border-color\n//img : background-image (filename)\n//opc : opacity (0.0....1.0) default=1.0\n//z : z-index (default=2)\n//wd : character of word\n\n//Answer String\n//helper original string=kkfh\" abc defghi\"kklkk0\" abc defghi\"kkfe\" abc defghi\"kk\nstage.setAnsStr(\"kkfhkklkk0kkfekk\");\nitem=stage.createNewItem();\n\n//class name\nitem.setName(\"vimrio\");\n\n//frame offset. default startindex=0\nitem.setFrameStartIndex(0);\nstage.addItem(item);\n\n//first frame\n//1 start\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":11*u,\"w\":u,\"h\":u,\"bgc\":\"transparent\",\"bdc\":\"blue\",\"img\":\"vimrio01.png\",\"z\":5,\"opc\":1.0,\"wd\":\"\"});\n//following next frames\n\n//2 k\nitem.addAnimation({\"y\":10*u});\n//3 k\nitem.addAnimation({\"y\":9*u});\n//4 f\nitem.addAnimation({\"x\":10*u});\n//5 k\nitem.addAnimation({\"y\":8*u});\n//6 k\nitem.addAnimation({\"y\":7*u});\n//7 l\nitem.addAnimation({\"x\":11*u});\n//8 k\nitem.addAnimation({\"y\":6*u});\n//9 k\nitem.addAnimation({\"y\":5*u});\n//10 0\nitem.addAnimation({\"x\":1*u});\n//11 k\nitem.addAnimation({\"y\":4*u});\n//12 k\nitem.addAnimation({\"y\":3*u});\n//13 f\nitem.addAnimation({\"x\":7*u});\n//14 k\nitem.addAnimation({\"y\":2*u});\n//15 k\nitem.addAnimation({\"y\":1*u});\n\n//1 goal\nitem=stage.createNewItem();\nitem.setName(\"goal\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":1*u,\"w\":u,\"h\":u,\"img\":\"goal01.png\",\"bgc\":\"yellow\",\"bdc\":\"yellow\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [ ] 1\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\" \"});\nstage.addItem(item);\n\n//word \" abc defghi\" [a] 2\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"a\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [b] 3\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"b\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [c] 4\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"c\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [ ] 5\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\" \"});\nstage.addItem(item);\n\n//word \" abc defghi\" [d] 6\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"d\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [e] 7\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"e\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [f] 8\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"f\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [g] 9\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"g\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [h] 10\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word01.png\",\"bgc\":\"transparent\",\"bdc\":\"white\",\"wd\":\"h\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [i] 11\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"i\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [ ] 1\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word01.png\",\"bgc\":\"transparent\",\"bdc\":\"white\",\"wd\":\" \"});\nstage.addItem(item);\n\n//word \" abc defghi\" [a] 2\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"a\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [b] 3\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"b\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [c] 4\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"c\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [ ] 5\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\" \"});\nstage.addItem(item);\n\n//word \" abc defghi\" [d] 6\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"d\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [e] 7\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"e\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [f] 8\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"f\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [g] 9\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"g\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [h] 10\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"h\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [i] 11\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"word04.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"i\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [ ] 1\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\" \"});\nstage.addItem(item);\n\n//word \" abc defghi\" [a] 2\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"a\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [b] 3\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"b\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [c] 4\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"c\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [ ] 5\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\" \"});\nstage.addItem(item);\n\n//word \" abc defghi\" [d] 6\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"d\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [e] 7\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word01.png\",\"bgc\":\"transparent\",\"bdc\":\"white\",\"wd\":\"e\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [f] 8\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"f\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [g] 9\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"g\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [h] 10\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"h\"});\nstage.addItem(item);\n\n//word \" abc defghi\" [i] 11\nitem=stage.createNewItem();\nitem.setName(\"word\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"word02.png\",\"bgc\":\"transparent\",\"bdc\":\"lightgray\",\"wd\":\"i\"});\nstage.addItem(item);\n\n\n\n//wall 1\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":0*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 2\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":0*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 3\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":0*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 4\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":1*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 5\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":1*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 6\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 7\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 8\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 9\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 10\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 11\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 12\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 13\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 14\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 15\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 16\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 17\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":2*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 18\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 19\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":3*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 20\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 21\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 22\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 23\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 24\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 25\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 26\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 27\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 28\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 29\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 30\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 31\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":4*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 32\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 33\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":5*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 34\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 35\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 36\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 37\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 38\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 39\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 40\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 41\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 42\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 43\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 44\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 45\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":6*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 46\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":7*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 47\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":7*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 48\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 49\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 50\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 51\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 52\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 53\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 54\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 55\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 56\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 57\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 58\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 59\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":8*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 60\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 61\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":9*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 62\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 63\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 64\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":3*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 65\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":4*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 66\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":5*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 67\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":6*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 68\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":7*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 69\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":8*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 70\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":9*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 71\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":10*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 72\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":11*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 73\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":12*u,\"y\":10*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 74\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":11*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 75\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":11*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 76\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":0*u,\"y\":12*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 77\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":1*u,\"y\":12*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n//wall 78\nitem=stage.createNewItem();\nitem.setName(\"wall\");\nitem.addAnimation({\"dsp\":true,\"x\":2*u,\"y\":12*u,\"w\":u,\"h\":u,\"img\":\"brick01.png\",\"bgc\":\"BlanchedAlmond\",\"bdc\":\"peru\"});\nstage.addItem(item);\n\n\n}", "function frame() {\n console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function frame () {\n\tmap.frame();\n}", "walk(framesCounter) {\n this.ctx.drawImage(\n this.imageInstance,\n this.imageInstance.framesIndex * Math.floor(this.imageInstance.width / this.imageInstance.frames),\n 0,\n Math.floor(this.imageInstance.width / this.imageInstance.frames),\n this.imageInstance.height,\n this.shinobiPos.x,\n this.shinobiPos.y,\n this.shinobiSize.w,\n this.shinobiSize.h\n )\n this.animateSprite(framesCounter)\n }", "function doFrame()\r\n{\r\n updateForFrame();\r\n // checkWallCollisions();\r\n modelMovement();\r\n doFlameRotation(flameRed);\r\n doFlameRotation(flameYell);\r\n lightingSystem();\r\n\r\n\r\n render();\r\n if (!gameover)\r\n {\r\n requestAnimationFrame(doFrame);\r\n } \r\n else if (win)\r\n {\r\n // gameOverLoss(); // For easy loss testing\r\n gameOverWin();\r\n } \r\n else\r\n {\r\n gameOverLoss();\r\n }\r\n}", "function memeclicker() {\n\tif( frame == 5 ) { frame = 0; }\n\t\telse { frame = frame + 1; }\n\tscore = score + 1;\n\tupdate_values();\n\tdocument.getElementById(\"ugandan\").firstChild.setAttribute(\"src\", \"frames/\" + frame + \".png\");\n}", "function iframes () {\n hero.justHit = false\n}", "createSpriteAnimations() {\n const haloFrames = this.anims.generateFrameNames('haloHit', { \n start: 1, end: 84, zeroPad: 5,\n prefix: 'Halo_' , suffix: '.png'\n });\n\n this.anims.create({ key: 'haloHit', frames: haloFrames, frameRate: 60, repeat: 0 });\n\n const sparkFrames = this.anims.generateFrameNames('sparkHit', { \n start: 1, end: 84, zeroPad: 5,\n prefix: 'Spark_' , suffix: '.png'\n });\n\n this.anims.create({ key: 'sparkHit', frames: sparkFrames, frameRate: 60, repeat: -1 });\n }", "draw(){\n \n \n \n image(this.spriteSheet, this.charX, this.charY, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight);\n }", "function update(){\n frames ++\n ctx.clearRect(0,0,canvas.width, canvas.height)\n bg.draw()\n dancer.draw()\n drawLetters()\n arrow1.draw() \n arrow2.draw()\n arrow3.draw()\n arrow4.draw()\n arrow5.draw()\n speakerScore.draw()\n dansometer.draw()\n deleteOldLetter()\n drawScore()\n chandeDansometer()\n}", "function C012_AfterClass_Jennifer_JenniferSpankPlayer() {\n\tC012_AfterClass_Jennifer_SpankCount++;\n\tif (C012_AfterClass_Jennifer_SpankCount > C012_AfterClass_Jennifer_SpankMaxCount) {\n\t\tC012_AfterClass_Jennifer_CurrentStage = 3933;\n\t\tOverridenIntroText = \"\";\n\t\tOverridenIntroImage = \"\";\n\t} else {\n\t\tOverridenIntroText = GetText(\"SpankPlayer\" + C012_AfterClass_Jennifer_SpankCount.toString());\n\t\tvar Img = (C012_AfterClass_Jennifer_SpankCount % 2).toString();\n\t\tif ((C012_AfterClass_Jennifer_SpankCount < 5) && !Common_PlayerChaste) OverridenIntroImage = \"JenniferSpankPlayer\" + Img + \".jpg\";\n\t\tif ((C012_AfterClass_Jennifer_SpankCount >= 5) && !Common_PlayerChaste) OverridenIntroImage = \"JenniferSpankPlayerRedButt\" + Img + \".jpg\";\n\t\tif ((C012_AfterClass_Jennifer_SpankCount < 5) && Common_PlayerChaste) OverridenIntroImage = \"JenniferSpankPlayerChastity\" + Img + \".jpg\";\n\t\tif ((C012_AfterClass_Jennifer_SpankCount >= 5) && Common_PlayerChaste) OverridenIntroImage = \"JenniferSpankPlayerChastityRedButt\" + Img + \".jpg\";\n\t}\n}", "function startScreen() {\n fill(255, 56, 115, opacity);\n rect(0,0,width,height);\n textSize(12);\n if (frameCount%2 == 0){\n fill(255,opacity);\n textAlign(CENTER);\n textSize(12);\n text(\"CLICK TO PLAY\", width/2, height/2);\n }\n}", "function updateAnimatedCharacter() {\n var ctx = hangmanGame.canvas.getContext(\"2d\");\n\n ctx.drawImage(character.image, 400 * character.frame, 0, 400, 400, 310, 15, 200, 200);\n\n if (hangmanGame.frameCount % 25 === 0) {\n if (character.frame === 0) {\n character.frame++;\n } else {\n character.frame = 0;\n }\n }\n}", "function draw() {\n Gravity();\n Animation();\n FrameBorder(); \n FrameBorderCleaner();\n Controls();\n Interaction();\n}", "function onFrame(event){\n\tif(mouse){\n\t\tcount += 1\n\t\timage.opacity = (count/90)\n\t\ttext1.opacity = (count/120)\n\t\ttext2.opacity = (count/150)\n\t\tteaser.opacity = 1 - (count/90)\n\t} else {\n\t\tteaser.opacity = 1;\n\t\timage.opacity = 0;\n\t\ttext1.opacity = 0;\n\t\ttext2.opacity = 0;\n\t}\n}", "update() {\n frames = 0;\n this.moveDown();\n }", "function frameBuster()\n{\n}", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "function frame() {\n\n frameCount++;\n deltaX += -frameCount; // move faster every frame\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n // move top nav bar if needed\n if (deltaX >= 110) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n // end menu bar animation\n else if (deltaX > 90 && deltaX < 110) {\n menuToggleBar.style.width = 60 + 'px';\n }\n // end slide menu animation\n else if (deltaX <= -5) {\n clearInterval(animation);\n menu.style.right = -220 + 'px';\n deltaX = 0;\n frameCount = 0;\n isMenuAnimating = false;\n }\n }", "function button_insert(){\n animateFrames2(\"bug\",25,\"infinite\",\"reverse\");\n}", "constructor(){\n this.x = 100;\n this.y = 100;\n this.frameHeight = 53;\n this.frameWidth = 64;\n this.currentFrameX = 23;\n this.currentFrameY = 16;\n this.spriteSheet;\n this.currentFrameNum = 1;\n this.time = 0;\n this.timeUntilLast = 0;\n this.timeFromLast = 0;\n this.animationTime = 50;\n this.maxFrame = 6;\n this.startTime;\n this.lifeTime;\n this.alive = false;\n\n\n \n\n }", "fixupFrame() {\n // stub, used by Chaos Dragon\n }", "frame () {\n\t\t// If th bonuss is without life, dn't move it.\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direction.rotate(this.rotationSpeed))\n\t}", "function changeFrames() {\n enemies.map(enemy => enemy.frame = (++enemy.frame) % numberOfFrames);\n }", "function SarahRun() {\n\tSarahLoadNewCharacter();\n\tSarahLoadBackground();\n\tfor (let C = 0; C < SarahCharacter.length; C++)\n\t\tDrawCharacter(SarahCharacter[C], 1000 - (SarahCharacter.length * 250) + (C * 500), (SarahCharacter[C].IsKneeling()) ? -270 : 0, 1);\n\tif (Player.CanWalk()) DrawButton(1885, 25, 90, 90, \"\", \"White\", \"Icons/Exit.png\");\n\tDrawButton(1885, 145, 90, 90, \"\", \"White\", \"Icons/Character.png\");\n}", "function walk(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.z\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.z\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.z - 30\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.z\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.z\r\n });\r\n xSlide.setKeys(keyFrames);\r\n\r\n\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n \r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 0).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n \r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function draw() {\n background(255);\n frameRate(12);\n text(pmouseY - mouseY, 0, height/4);\n}", "function walk2(character) {\r\n var frameRate = 1;\r\n\r\n var xSlide = new BABYLON.Animation(\"xSlide\", \"position.x\", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames = [];\r\n\r\n keyFrames.push({\r\n frame: 0,\r\n value: character.body.position.x\r\n });\r\n\r\n keyFrames.push({\r\n frame: 20 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n keyFrames.push({\r\n frame: 25 * frameRate,\r\n value: character.body.position.x - 25\r\n });\r\n\r\n keyFrames.push({\r\n frame: 45 * frameRate,\r\n value: character.body.position.x\r\n });\r\n keyFrames.push({\r\n frame: 50 * frameRate,\r\n value: character.body.position.x\r\n });\r\n\r\n xSlide.setKeys(keyFrames);\r\n var YRotation = new BABYLON.Animation(\"YRotation\", \"rotation\", frameRate, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);\r\n var keyFrames2 = [];\r\n\r\n\r\n keyFrames2.push({\r\n frame: 0 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 20 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n }); keyFrames2.push({\r\n frame: 25 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3*Math.PI/2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 45 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), 3 * Math.PI / 2).toEulerAngles()\r\n });\r\n keyFrames2.push({\r\n frame: 50 * frameRate,\r\n value: BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0), Math.PI / 2).toEulerAngles()\r\n });\r\n\r\n YRotation.setKeys(keyFrames2);\r\n return scene.beginDirectAnimation(character.body, [xSlide, YRotation], 0, 50 * frameRate, true);\r\n}", "function animate(){\n friender();\n if (friendfo.active == true){\n outc.beginPath();\n outc.arc(friendfo.x*640,friendfo.y*640, 3, 0, Math.PI*2.);\n outc.fill();\n }\n\n name_flash++;\n if (name_flash>3){\n $('#incoming_scrop').html(\"…\");\n }\n}", "function startGame() {\n renderNewWord();\n startBar();\n }", "function frame7() {\n nodes.update({ id: 1, color: { background: '#9575CD' } });\n frame8Id = setTimeout(frame8, 1000);\n }", "function drawFLIframe() {\n var i, j, x, y, c, n, idx;\n var skip, chng, size, red, green, blue;\n var linepos, startline, numlines, start, pak, word, wordt, lastp, p1, p2;\n\n // setup timer for next frame\n if (FLIframeNum <= FLIhead.frames) {\n FLItimer = window.setTimeout(drawFLIframe, FLIpause);\n }\n else {\n // last frame, so prepare stop\n //playOrStop();\n }\n\n // draw frame\n var framePos = FLIfile.getPos();\n var frameChunk = FLIfile.read('fli_frame');\n\n if (frameChunk.type == 0xF1FA) {\n // loop thru all chunks in a frame\n for (c=0; c < frameChunk.chunks; c++) {\n var dataPos = FLIfile.getPos();\n var dataChunk = FLIfile.read('fli_data');\n\n //alert('f=' + FLIframeNum + ' chunk: '+ outSource(dataChunk) ); // TEST\n\n switch (dataChunk.type) {\n case 4: // FLI_COLOR256 - 256-level color palette info\n case 11: // FLI_COLOR - 64-level color palette info\n //alert('f=' + FLIframeNum + ' chunk: '+ outSource(dataChunk) ); // TEST\n idx = 0;\n n = FLIfile.read('int16');\n for (i=0; i < n; i++) {\n skip = FLIfile.read('uint8');\n chng = FLIfile.read('uint8');\n idx += skip;\n if (chng == 0) { chng = 256; }\n for (j=0; j < chng; j++) {\n red = FLIfile.read('uint8');\n green = FLIfile.read('uint8');\n blue = FLIfile.read('uint8');\n if (dataChunk.type == 4) {\n FLI_R[idx] = red;\n FLI_G[idx] = green;\n FLI_B[idx] = blue;\n }\n else {\n FLI_R[idx] = (red << 2) & 0xff;\n FLI_G[idx] = (green << 2) & 0xff;\n FLI_B[idx] = (blue << 2) & 0xff;\n }\n idx++;\n }\n }\n drawPalette(); // TEST\n break;\n\n case 7: // FLI_SS2 - Word-oriented delta compression (FLC)\n //alert('f=' + FLIframeNum + ' chunk: '+ outSource(dataChunk) ); // TEST\n\n linepos = 0;\n pak = 0;\n numlines = FLIfile.read('int16');\n for (y=0; y < numlines; y++) {\n do {\n word = FLIfile.read('uint16');\n wordt = (word & 0xC000);\n switch (wordt) {\n case 0: pak = word; break;\n case 0x8000: lastp = (word & 0xFF); break;\n case 0xC000: linepos += ((0x10000 - word) * FLIhead.width); break;\n }\n } while (wordt != 0);\n x = 0;\n for (i=0; i < pak; i++) {\n skip = FLIfile.read('uint8');\n size = FLIfile.read('int8');\n x += skip;\n if (size < 0) {\n size = -size;\n p1 = FLIfile.read('uint8');\n p2 = FLIfile.read('uint8');\n for (j=0; j < size; j++) {\n FLIi.data[linepos + x] = p1;\n FLIi.data[linepos + x + 1] = p2;\n x += 2;\n }\n }\n else {\n for (j=0; j < size; j++) {\n p1 = FLIfile.read('uint8');\n p2 = FLIfile.read('uint8');\n FLIi.data[linepos + x] = p1;\n FLIi.data[linepos + x + 1] = p2;\n x += 2;\n }\n }\n }\n linepos += FLIhead.width;\n }\n break;\n\n case 12: // FLI_LC - Byte-oriented delta compression\n\n startline = FLIfile.read('int16');\n numlines = FLIfile.read('uint8');\n linepos = startline * FLIhead.width;\n start = FLIfile.read('uint8');\n for (y=0; y < numlines; y++) {\n pak = FLIfile.read('uint8');\n x = start;\n for (i=0; i < pak; i++) {\n skip = FLIfile.read('uint8');\n size = FLIfile.read('int8');\n x += skip;\n if (size < 0) {\n size = -size;\n n = FLIfile.read('uint8');\n for (j=0; j < size; j++) {\n FLIi.data[linepos + x] = n;\n x++;\n }\n }\n else {\n for (j=0; j < size; j++) {\n FLIi.data[linepos + x] = FLIfile.read('uint8');\n x++;\n }\n }\n }\n linepos += FLIhead.width;\n }\n break;\n\n case 13: // FLI_BLACK - Entire frame is color index 0\n\n //alert('f=' + FLIframeNum + ' (FLI_BLACK) chunk: '+ outSource(dataChunk) ); // TEST\n for (i=0; i < FLIi.data.length; i++) {\n FLIi.data[i] = 0;\n }\n break;\n\n case 15: // FLI_BRUN - Byte run length compression\n\n linepos = 0;\n for (y=0; y < FLIhead.height; y++) {\n FLIfile.read('int8'); // first byte ignored\n var x=0;\n while (x < FLIhead.width) {\n size = FLIfile.read('int8'); // does 'byte' return correct value?\n if (size < 0) {\n size = -size;\n for (i=0; i < size; i++) {\n FLIi.data[linepos + x] = FLIfile.read('uint8');\n x++;\n }\n }\n else {\n n = FLIfile.read('uint8');\n for (i=0; i < size; i++) {\n FLIi.data[linepos + x] = n;\n x++;\n }\n }\n }\n linepos += FLIhead.width;\n }\n break;\n\n case 16: // TODO: FLI_COPY - No compression\n\n //alert('f=' + FLIframeNum + ' (FLI_COPY) chunk: '+ outSource(dataChunk) ); // TEST\n break;\n\n case 18: // FLI_PSTAMP - Postage stamp sized image (SKIP)\n\n //alert('f=' + FLIframeNum + ' (FLI_PSTAMP) chunk: '+ outSource(dataChunk) ); // TEST\n break;\n\n default: // Unknown\n //alert('f=' + FLIframeNum + ' ('+ dataChunk.type +') chunk: '+ outSource(dataChunk) ); // TEST\n }\n FLIfile.seek(dataPos + dataChunk.size);\n } // next c\n }\n else {\n // Unknown frame chunk type\n //alert('unknown frame type: '+ outSource(frameChunk) ); // TEST\n }\n FLIfile.seek(framePos + frameChunk.size);\n\n document.getElementById('FLIcount').innerHTML = FLIframeNum + '/' + FLIhead.frames;\n FLIframeNum++;\n\n if (FLIframeNum > FLIhead.frames) {\n //alert('done'); // TEST\n // start again from first frame\n FLIframeNum = 1;\n FLIfile.seek(FLIframe1pos);\n }\n\n // draw the image to canvas context\n updateCanvas();\n\n } // end drawFLIframe()", "function gameLoop()\n {\n // console.log( \"beep!\" , properties.difficulty );\n renderFrame();\n }", "function frame_f1() {\n\t\t// Set frame content visible\n\t\tsetFrameVisible(frmSec[secIndx-1], false);\n\t\t// In animations\n\t\tTweenLite.set(['#logo'], { opacity: 1 });\n\t\t// Out animations\n\t\tTweenLite.set(['#logo'], { opacity: 0, delay: fD[secIndx] });\n\t\t// Next frame call\n\t\tnextFrameCall(fD[secIndx], frmSec[secIndx]);\n\t}", "function update(){\n frames++;\n if (currentstate !== states.Score && currentstate !== states.Start && currentstate !== states.HighScore) {\n fgpos = (fgpos - 2) % 14;\n }\n if (currentstate === states.Game) {\n pipe.update();\n }\n bird.update();\n}", "function frameend() \n{\n shuttle.update();\n}", "function frameend() \n{\n shuttle.update();\n}", "function C010_Revenge_SidneyJennifer_JenniferCrawl() {\n\tOverridenIntroImage = \"\";\n\tActorSetPose(\"Dog\");\n\tCurrentTime = CurrentTime + 50000;\n}", "function main() {\n var N = 22; //Number of animation frames from 0 e.g. N=1 is the same as having two images which swap...\n Conf.augment ? Conf.animate += 1 : Conf.animate -= 1;\n if(Conf.animate === 0 || Conf.animate === N) {\n Conf.augment ? Conf.augment = false : Conf.augment = true;\n }\n }", "pos2frame(pos) {\n\n }", "handlePlayerFrame(){\n if(this.speedY < 0){\n this.frameY = 3\n }else{\n this.frameY = 0\n }\n if (this.frameX < 3){\n this.frameX++\n } else {\n this.frameX = 0\n }\n }", "function updateFrame() {\n // TODO: INSERT CODE TO UPDATE ANY OTHER DATA USED IN DRAWING A FRAME\n y += 0.3;\n if (y > 60) {\n y = -50;\n }\n frameNumber++;\n}", "constructor(lane, height = 75, width = 40, color = 0x777777, type = \"\", direction){\n this.color = color;\n this.direction = direction;\n this.width = width;\n this.height = height;\n this.healthBar = new PIXI.Graphics();\n this.healthBarWidth = 75;\n this.separationDistance = 85;\n this.lane = lane;\n this.x = lane.x + ((lane.pixelLength / 2) * direction*-1);\n this.y = lane.y - (this.height / 2);\n this.animationSpeed = 0.25;\n this.animationTimer = 0;\n this.currentFrame = 0;\n \n this.type = type;\n this.attackTimer = 0;\n this.alive = true;\n \n switch(type){\n case \"SWORD\":\n default:\n this.speed = 100;\n this.maxHealth = 100;\n this.damage = 20;\n this.attackSpeed = 1.25;\n this.attackRange = 50;\n this.texture = this.loadSpriteSheet(`images/SwordUnit.png`);\n this.attackSound = new Howl({src: ['sounds/sword.wav']});\n break;\n case \"SPEAR\":\n this.speed = 75;\n this.maxHealth = 100;\n this.damage = 15;\n this.attackSpeed = 0.75;\n this.attackRange = 150;\n this.texture = this.loadSpriteSheet(`images/SpearUnit.png`);\n this.attackSound = new Howl({src: ['sounds/sword.wav']});\n break;\n case \"BOW\":\n this.speed = 75;\n this.maxHealth = 75;\n this.damage = 10;\n this.attackSpeed = 1;\n this.attackRange = 300;\n this.texture = this.loadSpriteSheet(`images/BowUnit.png`);\n this.attackSound = new Howl({src: ['sounds/arrow.wav']});\n break;\n case \"FLYING\":\n this.speed = 150;\n this.maxHealth = 50;\n this.damage = 15;\n this.attackSpeed = 1;\n this.attackRange = 50;\n this.texture = this.loadSpriteSheet(`images/FastUnit.png`);\n this.attackSound = new Howl({src: ['sounds/sword.wav']});\n break;\n case \"SHIELD\":\n this.speed = 50;\n this.maxHealth = 175;\n this.damage = 25;\n this.attackSpeed = 0.5;\n this.attackRange = 50;\n this.texture = this.loadSpriteSheet(`images/ShieldUnit.png`);\n this.attackSound = new Howl({src: ['sounds/shield.mp3']});\n break;\n }\n \n this.image = new PIXI.extras.AnimatedSprite(this.texture);\n this.image.anchor.set(0.5,0.5);\n \n if(direction == -1){\n this.image.scale.set(-1,1);\n }\n \n this.drawSelf();\n \n this.setFrame(0);\n \n this.health = this.maxHealth;\n }", "function drawFrame(perc) {\n background(backColor);\n}", "function initialFrame() {\n\t\t$(\"text-area\").value = ANIMATIONS[$(\"animation-dropbox\").value];\n\t}", "function find_word_frame(lett, HTU_number, direction){\n\tconsole.log(\"find_word_frame(\"+lett+',HTU:'+HTU_number+',direction'+direction+')');\nvar this_word = new Array(7);\n\tif(direction == 'A') {\n\t\tHTU0 = HTU_number;\n\t\tminicube0 = mini_cubes[HTU0];\n\t\tthis_word[0] = minicube0.cube_letter;\n\n\t\tHTU1 = HTU0 + 1;\n\t\tminicube1 = mini_cubes[HTU1];\n\t\tthis_word[1] = minicube1.cube_letter;\n\t\t\n\t\tHTU2 = HTU1 +1;\n\t\tminicube2 = mini_cubes[HTU2];\n//\t\tconsole.log('HTU0='+HTU0);\n//\t\tconsole.log('HTU1='+HTU1);\n//\t\tconsole.log('HTU2='+HTU2);\n//\t\tconsole.log('HTU2='+HTU2);\n//\t\tconsole.log('mini_cubes.length = '+mini_cubes.length);\n\t\ttest = mini_cubes[270];\n//\t\talert('mini'+test);\n\n\t\t//check_270();\n//\t\tconsole.log('minicube2='+minicube2);\n\t\tthis_word[2] = minicube2.cube_letter;\n\t\t\n\t\tHTU3 = HTU2 +1;\n\t\tminicube3 = mini_cubes[HTU3];\n\t\tthis_word[3] = minicube3.cube_letter;\n\n\t\tHTU4 = HTU3 +1;\n\t\tminicube4 = mini_cubes[HTU4];\n\t\tthis_word[4] = minicube4.cube_letter;\n\t\t\n\t\tHTU5 = HTU4 +1;\n\t\tminicube5 = mini_cubes[HTU5];\n\t\tthis_word[5] = minicube5.cube_letter;\n\t\t\n\t\tHTU6 = HTU5 +1;\n\t\tminicube6 = mini_cubes[HTU6];\n\t\tthis_word[6] = minicube6.cube_letter;\n\t\n\t\n\t}\n\t/* go through list of potential words (answers)\n\t to see what would fit */\n\tfor(ptr = 0; ptr < ANSWER_CLUE.length; ptr++) {\t\n\t\t//console.log('clue='+ANSWER_CLUE[ptr]); \n\t\tsub_ANS = get_ANSWER(ptr);\n\t\t/* strip punctuation from ANSER word */\n\t\tstrip_ANS = [];\n\t\tfor (i = 0; i < sub_ANS.length; i++) {\n\t\t\tif((sub_ANS[i] == '_') || (sub_ANS[i] == ' ') || (sub_ANS[i] == '-')) {\n\t\t\t} else {\n\t\t\t\tstrip_ANS += sub_ANS[i];\n\t\t\t}\n\t\t}\n\t\tif (strip_ANS.length != 7) {\n//\t\t\tconsole.log('length of '+sub_ANS+'wrong at'+strip_ANS.length);\n\t\t}\n\t\t\t\n\t\tmatch = true;\n\t\tthis_ptr = 0;\n\t\tfor (i = 0; i < strip_ANS.length; i++) {\n\t\t\tif ((this_word[i] == strip_ANS[i]) || (this_word[i] == '_')) {\n\t\t\t} else {\n\t\t\t\tmatch = false;\n\t\t\t}\n\t\t}\n\t\tif (match) {\n\t\t\tanswer_number = ptr;\t//probably not used\n//\t\t\tconsole.log('word match with '+strip_ANS);\n\t\t\tadd_to_selection(answer_number, strip_ANS);\n\t\t}\n\t\t\n\t\t\t\n\t}\n}", "function update(tframe){\r\n var dt = (tframe - lastframe) / 1000;\r\n lastframe = tframe;\r\n checkLoose();\r\n checkWin();\r\n checkColor();\r\n shootBubbles(dt);\r\n \r\n }", "function drawFrame() {\n // Reset background\n gl.clearColor(1, 1, 1, 1);\n gl.enable(gl.DEPTH_TEST);\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.viewport(0, 0, canvas.width, canvas.height);\n\n // Bind needle speeds\n // Draw Elements!\n // Topmost code is shown at the front! \n drawVertex(canvas, shaderProgram, gl.TRIANGLES, tri, indices, black);\n\n window.requestAnimationFrame(drawFrame);\n }", "function draw()\n{\n backCtx.clearRect(0, 0, W, H);\n roudningChar.updateFrame();\n updateBackgroundEffects(5);\n drawSpriteImage(backCtx, roundingChar, 10, H / 4, W / 5, W / 4);\n}", "fightEm(){\n // this.character.reposition(320-50,288);\n // this.character2.reposition(320+50,288,576,0);\n // this.character.makeRandomChar();\n // this.character2.makeRandomChar();\n // this.character.reposition(320-50,450);\n // this.character2.reposition(320+50,450,576,0);\n // this.character.makeRandomChar();\n // this.character2.makeRandomChar();\n this.winScreen.visible=false;\n this.loseScreen.visible=false;\n\n if(!this.battleActive){\n\n this.buildBackground();\n this.character.reposition(320-50,475);\n this.character2.reposition(320+50,475,576,0);\n\n this.character2.flipIt();\n\n\n this.character.makeRandomChar(0,0,0);\n\n\n this.character2.makeRandomChar(1,1,1);\n this.battleActive= true;\n this.battleMode();\n }\n\n }", "function animationSetUp() {\n // Pacman's frames\n for (let i = 0; i < 5; i++) {\n for (let j = 0; j < 4; j++) {\n let frame = pacmanImg.get(j * 32, i * 32, 32, 32)\n pacmanFrames.push(frame)\n }\n }\n\n for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 2; j++) {\n leftImages.push(leftGhosts.get(j * 32, i * 32, 32, 32))\n rightImages.push(rightGhosts.get(j * 32, i * 32, 32, 32))\n upImages.push(upGhosts.get(j * 32, i * 32, 32, 32))\n downImages.push(downGhosts.get(j * 32, i * 32, 32, 32))\n }\n }\n}", "function draw() {\n\n noStroke();\n fill(255);\n var extraSpace = 0;//The words have its own length , so it needs to be offset to the right \n // i MEANS THE FIRST LETTER OF THE sentence \n\n for (let i = 0; i < words.length; i++) {\n // appearing over time...\n //note that canvas Is loading 60 times per second which means if the first letter is 1 then when francount reaches and goes beyond 1*100 the first word get pirnted \n\n if (frameCount > i * 100) {\n var wordMarginLeft = 30 * i; //The distance of each word is 30 // letters got print with the distance of 30 \n \n if (i > 0) {\n extraSpace = extraSpace + words[i - 1].length * 13; //we need to add extra space in letters and it's caculated by the length of the letters\n }\n fill(255);\n text(words[i], wordMarginLeft + extraSpace, 20);\n }\n }\n \n \n}", "function frame(){\r\n\t\t \t\tupdate();\r\n\t\t \t\tcollides();\r\n\t\t \t\tdraw();\r\n\t\t \t\tloop = requestAnimationFrame(frame);\r\n\t\t \t}", "function frame(){\r\n\t\t \t\tupdate();\r\n\t\t \t\tcollides();\r\n\t\t \t\tdraw();\r\n\t\t \t\tloop = requestAnimationFrame(frame);\r\n\t\t \t}", "create() {\n this.hero = this.matter.add.sprite(this.game.config.width / 2, this.game.config.height / 2, 'hero');\n this.hero.depth = 1200;\n\n this.matter.world.setBounds(0, 0, game.config.width, game.config.height);\n\n this.anims.create({\n key: 'south_stop',\n frames: [{ key: 'hero', frame: '1.png' }]\n });\n\n this.anims.create({\n key: 'north_stop',\n frames: [{ key: 'hero', frame: '17.png' }]\n });\n\n this.anims.create({\n key: 'west_stop',\n frames: [{ key: 'hero', frame: '9.png' }]\n });\n\n this.anims.create({\n key: 'east_stop',\n frames: [{ key: 'hero', frame: '25.png' }]\n });\n\n this.anims.create({\n key: 'south_walk', // southeast in isometric\n frames: this.anims.generateFrameNames('hero', { prefix: '', suffix: '.png', start: 1, end: 4 }),\n frameRate: 4,\n repeat: -1\n });\n this.anims.create({\n key: 'north_walk', // northwest in isometric\n frames: this.anims.generateFrameNames('hero', { prefix: '', suffix: '.png', start: 17, end: 20 }),\n frameRate: 4,\n repeat: -1\n });\n this.anims.create({\n key: 'west_walk', // southwest in isometric\n frames: this.anims.generateFrameNames('hero', { prefix: '', suffix: '.png', start: 9, end: 12 }),\n frameRate: 4,\n repeat: -1\n });\n this.anims.create({\n key: 'east_walk', // northeast in isometric\n frames: this.anims.generateFrameNames('hero', { prefix: '', suffix: '.png', start: 25, end: 28 }),\n frameRate: 4,\n repeat: -1\n });\n\n // sorcerer.animations.add('southeast', ['1.png','2.png','3.png','4.png'], 6, true);\n // sorcerer.animations.add('south', ['5.png','6.png','7.png','8.png'], 6, true);\n // sorcerer.animations.add('southwest', ['9.png','10.png','11.png','12.png'], 6, true);\n // sorcerer.animations.add('west', ['13.png','14.png','15.png','16.png'], 6, true);\n // sorcerer.animations.add('northwest', ['17.png','18.png','19.png','20.png'], 6, true);\n // sorcerer.animations.add('north', ['21.png','22.png','23.png','24.png'], 6, true);\n // sorcerer.animations.add('northeast', ['25.png','26.png','27.png','28.png'], 6, true);\n // sorcerer.animations.add('east', ['29.png','30.png','31.png','32.png'], 6, true);\n\n //this.cameras.main.startFollow(this.hero);\n\n this.keyUp = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.UP, true, true);\n this.keyUp.on('down', this.key_down_callback, this);\n this.keyUp.on('up', this.key_up_callback, this);\n\n this.keyDown = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.DOWN, true, true);\n this.keyDown.on('down', this.key_down_callback, this);\n this.keyDown.on('up', this.key_up_callback, this);\n\n this.keyLeft = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.LEFT, true, true);\n this.keyLeft.on('down', this.key_down_callback, this);\n this.keyLeft.on('up', this.key_up_callback, this);\n\n this.keyRight = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.RIGHT, true, true);\n this.keyRight.on('down', this.key_down_callback, this);\n this.keyRight.on('up', this.key_up_callback, this);\n }", "animation() {}", "function C012_AfterClass_Jennifer_StartPlayerHumiliation() {\n\tSetScene(CurrentChapter, \"Humiliation\");\n}", "function frame()\n {\n //Clear the element if it reaches below a certain pixel range\n if (pos == 1024)//setting of the finish line\n {\n clearInterval(id);\n eball.remove();\n }\n //Continue to move till the finish line hits.\n else\n {\n pos++;//Add the position\n eball.style.top = pos + 'px';//Continuosly keep on adding the position value to account for the movement\n }\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}" ]
[ "0.6500949", "0.63717014", "0.6194328", "0.6180196", "0.6158472", "0.61305386", "0.6129825", "0.61229867", "0.608366", "0.608046", "0.6079174", "0.6054578", "0.6049512", "0.6047945", "0.6003271", "0.5988211", "0.5986313", "0.59711975", "0.5958426", "0.59512115", "0.59268063", "0.59265935", "0.5920357", "0.59169996", "0.5906617", "0.5898965", "0.58813226", "0.5880041", "0.5878231", "0.5875738", "0.5874395", "0.5865193", "0.58643764", "0.58572346", "0.5855888", "0.58550566", "0.5854147", "0.58533233", "0.58375114", "0.58275867", "0.58250886", "0.5813789", "0.58117515", "0.579931", "0.57956344", "0.57941645", "0.579066", "0.57662064", "0.5763175", "0.57549846", "0.57527024", "0.57500285", "0.57387084", "0.57321393", "0.5730746", "0.5730187", "0.57190627", "0.5717974", "0.57155895", "0.57131124", "0.57117623", "0.5710218", "0.57087666", "0.5705464", "0.5700352", "0.5692187", "0.56817", "0.5677567", "0.5675747", "0.5667128", "0.56653607", "0.56597024", "0.56561106", "0.56554836", "0.5653056", "0.5648489", "0.5645326", "0.5645326", "0.5643818", "0.5638915", "0.56388956", "0.56337255", "0.5633208", "0.5618577", "0.561684", "0.561493", "0.5612118", "0.5610114", "0.56082386", "0.56081104", "0.56076586", "0.5606229", "0.5600613", "0.55976576", "0.55976576", "0.5597101", "0.559698", "0.55881333", "0.5587821", "0.558692" ]
0.7360992
0
loading all the sprites i need from a single file
loadSpriteSheet(){ this.spriteSheet = loadImage('assets/sprites.png'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadSprites() {\n Loader.add(\"assets/imgs/resize1.png\")\n .add(\"assets/imgs/resize2.png\")\n .add(\"assets/imgs/colorize.png\")\n .add(\"assets/imgs/rotate.png\")\n .add(\"assets/imgs/select.png\")\n .add(\"assets/imgs/win.png\")\n .add(\"assets/imgs/logo.png\")\n .add(\"assets/imgs/logo2.png\")\n .add(\"assets/imgs/introFinal.png\")\n .add(\"assets/imgs/btPlay.png\")\n .add(\"assets/imgs/btAgain.png\")\n .load(setup);\n}", "function loadSprites(_objs){\n\t\tfor(i = _objs.length - 1; i >= 0 ; i--) {\n\t\t\tSprites[i].x = _objs[i].loc.x;\n\t\t\tSprites[i].y = _objs[i].loc.y;\n\t\t}\n\t}", "function loadAssets() {\n PIXI.loader\n .add([\n \"./assets/tileset10.png\",\n ])\n .load(gameCreate);\n}", "function loadSprite(fileName) {\n assetsStillLoading++;\n\n let spriteImage = new Image();\n spriteImage.src = \"./assets/sprites/\" + fileName;\n // Once image is done loading, Decease number of assets loading\n spriteImage.onload = function() {\n assetsStillLoading--;\n }\n\n return spriteImage;\n }", "function loadSprite(fileName) {\n assetsStillLoading++;\n \n let spriteImage = new Image();\n spriteImage.src = fileName;\n \n spriteImage.onload = function() {\n assetsStillLoading--;\n }\n\n spriteImage.onerror = function() {\n assetsStillLoading--;\n }\n \n \n return spriteImage;\n }", "function loadSprite(fileName) {\r\n assetsStillLoading++;\r\n let spriteImage = new Image();\r\n spriteImage.src = fileName;\r\n spriteImage.onload = function() {\r\n assetsStillLoading--;\r\n }\r\n spriteImage.onerror = function() {\r\n assetsStillLoading--;\r\n }\r\n return spriteImage;\r\n }", "preload() {\n\t\tthis.load.spritesheet(\"avatar\", \"/assets/avatar.png\", {\n\t\t\tframeWidth: 48,\n\t\t\tframeHeight: 48,\n\t\t});\n\t\tthis.load.spritesheet(\"bird\", \"/assets/bird.png\", {\n\t\t\tframeWidth: 48,\n\t\t\tframeHeight: 48,\n\t\t});\n\t\tthis.load.spritesheet(\"explosion\", \"/assets/explosion.png\", {\n\t\t\tframeWidth: 55,\n\t\t\tframeHeight: 55,\n\t\t});\n\t\tthis.load.image(\"bg\", \"/assets/background.png\");\n\t\tthis.load.image(\"poop\", \"/assets/poop.png\");\n\t\tthis.load.image(\"bullet\", \"/assets/bullet.png\");\n\t\tthis.load.image(\"shoot\", \"/assets/buttons/shoot.png\");\n\t\tthis.load.image(\"navigate\", \"/assets/buttons/navigate.png\");\n\t}", "function loadAssets(callback) {\n // Increase number of assets loading\n function loadSprite(fileName) {\n assetsStillLoading++;\n\n let spriteImage = new Image();\n spriteImage.src = \"./assets/sprites/\" + fileName;\n // Once image is done loading, Decease number of assets loading\n spriteImage.onload = function() {\n assetsStillLoading--;\n }\n\n return spriteImage;\n }\n sprites.background = loadSprite('spr_background5.png');\n sprites.stick = loadSprite('spr_stick.png');\n sprites.whiteBall = loadSprite('spr_ball2.png');\n sprites.redBall = loadSprite('spr_redBall2.png');\n sprites.yellowBall = loadSprite('spr_yellowBall2.png');\n sprites.blackBall = loadSprite('spr_blackBall2.png');\n\n assetsLoadingLoop(callback);\n}", "preload(){\n this.load.spritesheet(\"avatar\", \"/assets/avatar.png\", {\n frameWidth: 48,\n frameHeight: 48\n });\n this.load.spritesheet(\"bird\", \"/assets/bird.png\", {\n frameWidth: 48,\n frameHeight: 48\n })\n\n this.load.image(\"shit\", \"/assets/shit.png\")\n this.load.image(\"bg\", \"/assets/background.png\")\n }", "loadResources(){\n\n const directory = \"./assets/images/\";\n\n //Load Character-related textures\n this.gameContent.skins.forEach(({skin,texture}) => {\n this.loader.add(`skin_${skin}`,`${directory}/skins/${texture}`);\n });\n\n //Load Map textures\n this.gameContent.maps.forEach(({map,source,obstacle}) => {\n\n this.loader\n .add(`map_${map}`,`${directory}/${source}`)\n .add(`obstacle_${map}`,`${directory}/${obstacle.texture}`);\n\n });\n\n //Load UI-related textures\n this.loader\n .add(\"ui_background\", `${directory}/${this.gameContent.ui.background}`)\n .add(\"ui_button\", `${directory}/${this.gameContent.ui.button}`)\n .add(\"ui_button2\", `${directory}/${this.gameContent.ui.button2}`)\n .add(\"ui_button3\", `${directory}/${this.gameContent.ui.button3}`)\n .add(\"ui_arrow\", `${directory}/${this.gameContent.ui.arrow}`)\n .add(\"ui_loader\", `${directory}/${this.gameContent.ui.loader}`)\n .add(\"ui_sound\", `${directory}/${this.gameContent.ui.sound}`)\n .add(\"ui_muted\", `${directory}/${this.gameContent.ui.muted}`);\n\n //Load Sounds *****\n\n }", "function loadResources() {\n var images = [];\n images = images.concat(Player.getSprites());\n images = images.concat(Block.getSprites());\n images = images.concat(Gem.getSprites());\n\n images.push(Enemy.sprite);\n images.push(Heart.sprite);\n images.push(Star.sprite);\n images.push(Key.sprite);\n\n Resources.load(images);\n Resources.onReady(init);\n }", "function loadSprites(src, col, lin, flag, status){\t\r\n\tif (flag == 'txt') {\r\n\t\tsprites.push(new Texto('00', lin, col, status));\r\n\t}else{\r\n\t\tsprites.push(new Personagem(src, col, lin, flag));\r\n\t\tlet indce = sprites.length - 1;\r\n\t\t//console.log('col ==>'+ sprites[indce].col +' lar ==>'+ sprites[indce].lar);\r\n\t\tsprites[indce].status = status;\r\n\t\tsprites[indce].img.onload = function(){\r\n\t\t\t//console.log('img '+ indce +' src = '+ sprites[indce].img.src);\r\n\t\t\t//ajusta largura e altura do quadro conforme medidas / n quadros\r\n\t\t\t//esta medida so pode ser setada depois da imagem carregada............\r\n\t\t\t\tsprites[indce].lar = (sprites[indce].img.width / sprites[indce].col) * sprites[indce].esc;\r\n\t\t\t\tsprites[indce].alt = (sprites[indce].img.height / sprites[indce].lin) * sprites[indce].esc;\r\n\t\t\t\t\r\n\r\n\t\t\tcontImg++;\r\n\t\t}\t\t\r\n\t}\r\n}", "function loadAssets () {\n game.load.image(\"Tesla\", \"assets/sprites/tesla2.png\");\n game.load.image(\"Barrier\", \"assets/sprites/barrier.png\");\n game.load.image(\"Cloud\", \"assets/sprites/cloud.png\");\n game.load.audio(\"meow1\", [\"assets/sounds/meow1.mp3\", \"assets/sounds/meow1.ogg\"]);\n game.load.audio(\"meow2\", [\"assets/sounds/meow2.mp3\", \"assets/sounds/meow2.ogg\"]);\n game.load.audio(\"meow3\", [\"assets/sounds/meow3.mp3\", \"assets/sounds/meow3.ogg\"]);\n game.load.audio(\"meow4\", [\"assets/sounds/meow4.mp3\", \"assets/sounds/meow4.ogg\"]);\n game.load.audio(\"meow5\", [\"assets/sounds/meow5.mp3\", \"assets/sounds/meow5.ogg\"]);\n game.load.audio(\"meow6\", [\"assets/sounds/meow6.mp3\", \"assets/sounds/meow6.ogg\"]);\n game.load.audio(\"flap\", [\"assets/sounds/Jump9.mp3\", \"assets/sounds/Jump9.ogg\"]);\n game.load.audio(\"hit\", [\"assets/sounds/Hit_Hurt2.mp3\", \"assets/sounds/Hit_Hurt2.ogg\"]);\n game.load.bitmapFont(\"font\", \"assets/fonts/font.png\", \"assets/fonts/font.fnt\");\n}", "function preload() {\n //spritesheets\n playerSS = loadImage('assets/collector.png');\n playerJSON = loadJSON('assets/collector.json');\n trashSS = loadImage('assets/bottle.png');\n trashJSON = loadJSON('assets/bottle.json');\n}", "load(name, path, size) {\n let extension = path.substr(path.lastIndexOf(\".\") + 1);\n if (extension === \"png\" ||\n extension === \"PNG\" ||\n extension === \"jpg\" ||\n extension === \"JPG\" ||\n extension === \"jpeg\" ||\n extension === \"JPEG\") {\n this.spriteSize = size;\n let image = new Image();\n image.src = path;\n this.images.set(name, image);\n }\n if (extension === \"json\" || extension === \"JSON\") {\n this.tileSize = size;\n var request = new XMLHttpRequest();\n request.open(\"GET\", path, false);\n request.send(null);\n this.parseJSONDataIntoObject(JSON.parse(request.responseText));\n }\n }", "function loadSprite(filename){\n asseetsStillLoading ++; \n\n let spriteImage = new Image();\n spriteImage.src = \"assets/sprites/\" + filename;\n\n // This is event handler and once the image has fully loaded, the function inside it will execute\n spriteImage.onload = function(){\n asseetsStillLoading --;\n }\n\n return spriteImage;\n }", "preload() {\n this.load.spritesheet(\"tree\", \"assets/tree.png\", { frameWidth: 60, frameHeight: 95 });\n this.load.image('platform', 'assets/platform.png');\n this.load.image('background', 'assets/background.png');\n this.load.spritesheet('dude', 'assets/mike-running.png', { frameWidth: 84, frameHeight: 93 });\n }", "function load(context)\n{\n var nLoad = 0;\n var totLoad = 4;\n var spriteArray = new Array();\n var sArray = new Array(2);\n\n //carregar imagens e criar sprites\n var img = new Image();\n img.addEventListener(\"load\", imgLoadedHandler);\n img.id = \"carroestacionado1\";\n img.src = \"../recursos/carroest12.png\"; //dá ordem de carregamento da imagem\n\n\n var img1 = new Image();\n img1.addEventListener(\"load\", imgLoadedHandler);\n img1.id = \"carroestacionado2\";\n img1.src = \"../recursos/carroest2.png\";\n\n\n var img2 = new Image();\n img2.addEventListener(\"load\", imgLoadedHandler);\n img2.id = \"player1\";\n img2.src = \"../recursos/player1.png\";\n\n var img3 = new Image();\n img3.addEventListener(\"load\", imgLoadedHandler);\n img3.id = \"areaest\";\n img3.src = \"../recursos/areaest.png\";\n\n function imgLoadedHandler(ev)\n {\n var img = ev.target;\n\n\n switch(img.id){\n case \"carroestacionado1\":\n var sp1 = new CarroEstacionado(20, 20,50,100, img);\n var sp2 =new CarroEstacionado(685,20,50,100,img);\n var sp3 =new CarroEstacionado(310, 140,50,100,img);\n spriteArray[0] = sp1;\n spriteArray[1] = sp2;\n spriteArray[2] = sp3;\n break;\n case \"carroestacionado2\":\n var sp4 =new CarroEstacionado(375, 140,50,100,img);\n var sp5 =new CarroEstacionado(683, 154,50,100,img);\n\n spriteArray[3] = sp4;\n spriteArray[4] = sp5;\n\n break;\n case \"player1\":\n var splayer = new CarroPlayer(70,280,100,100,img);\n sArray[0]=splayer;\n console.log(sArray[0]);\n break;\n case \"areaest\":\n var area = new CarroEstacionado(433.5,135,60,110,img);//Talvez criar AreaEst class\n sArray[1]=area;\n break;\n }\n nLoad++;\n\n if (nLoad == totLoad) {\n var ev2 = new Event(\"loadEnd\");\n ev2.spriteArray = spriteArray;\n ev2.sArray = sArray;\n context.canvas.dispatchEvent(ev2);\n }\n }\n}", "function preload ()\n{\n this.load.image('tiles', 'assets/maps/medieval/tiles.png');\n this.load.tilemapCSV('map', 'assets/maps/medieval/map_top.csv');\n this.load.tilemapCSV('background', 'assets/maps/medieval/map_bottom.csv');\n this.load.spritesheet('player', 'assets/sprites/spaceman.png', { frameWidth: 16, frameHeight: 16 });\n}", "function loadImages(){\n if (app)\n app.destroy(true);\n app = new PIXI.Application();\n document.getElementById(\"processContainer\").appendChild(app.view);\n \n textures = [];\n textures[0] = PIXI.Texture.from('star.png');\n\n for(let i = 0; i < imageData.length; i++){\n let image = new Image();\n image.src = imageData[i];\n textures[textures.length] = PIXI.Texture.from(new PIXI.BaseTexture(image));\n }\n reloadSprites();\n}", "preload() {\n this.loadAssets();\n this.load.spritesheet('coin', 'assets/Coin/coin-sprite-png-2.png', {frameWidth: 200, frameHeight: 250, endFrame: 5})\n }", "function loadItem(name){\n var item = this.list[name];\n // if the item sprite array has already been loaded then no need to do it again\n if(item.spriteArray){\n return;\n } \n item.spriteSheet = loader.loadImage('images/'+this.defaults.type+'/'+name+'.png');\n item.spriteArray = [];\n item.spriteCount = 0;\n \n for (var i=0; i < item.spriteImages.length; i++){ \n var constructImageCount = item.spriteImages[i].count; \n var constructDirectionCount = item.spriteImages[i].directions; \n if (constructDirectionCount){\n for (var j=0; j < constructDirectionCount; j++) {\n var constructImageName = item.spriteImages[i].name +\"-\"+j;\n item.spriteArray[constructImageName] = {\n name:constructImageName,\n count:constructImageCount,\n offset:item.spriteCount\n };\n item.spriteCount += constructImageCount;\n };\n } else {\n var constructImageName = item.spriteImages[i].name;\n item.spriteArray[constructImageName] = {\n name:constructImageName,\n count:constructImageCount,\n offset:item.spriteCount\n };\n item.spriteCount += constructImageCount;\n }\n };\n // Load the weapon if item has one\n if(item.weaponType){\n bullets.load(item.weaponType);\n }\n\n}", "function handleImageLoad() {\n // data about the organization of the sprite sheet\n var spriteData = {\n images: [\"/images/cakerush/cake.png\", \"/images/cakerush/fatBlue.png\", \"/images/cakerush/fatRed.png\",\n \"/images/cakerush/fatYellow.png\", \"/images/cakerush/fatGreen.png\"],\n frames: [\n //startx, starty, sizex, sizey, which file in the array, registrationx, registrationy\n //[0, 0, 80, 80, 0, 40, 0],\n //[80, 0, 80, 80, 0, 40, 0],\n //[160, 0, 80, 80, 0, 40, 0],\n //[240, 0, 80, 80, 0, 40, 0],\n //[320, 0, 80, 80, 0, 40, 0],\n\n //cake\n [0, 0, 360, 360, 0, 180, 220], //0\n //blue\n [0, 0, 69, 191, 1, 34, 191], // 1 side step 1\n [69, 0, 69, 191, 1, 34, 191], // 2 side step 2\n [138, 0, 69, 191, 1, 34, 191], // 3 side stand\n [0, 191, 69, 191, 1, 34, 191], // 4 front stand\n [69, 191, 69, 191, 1, 34, 191], // 5 front step 1\n [138, 191, 69, 191, 1, 34, 191], // 6 front step 2\n [0, 382, 69, 191, 1, 34, 191], // 7 back stand\n [69, 382, 69, 191, 1, 34, 191], // 8 back step 1\n [138, 382, 69, 191, 1, 34, 191], // 9 back step 2\n //red\n [0, 0, 69, 191, 2, 34, 191], // 10 side step 1\n [69, 0, 69, 191, 2, 34, 191], // 11 side step 2\n [138, 0, 69, 191, 2, 34, 191], // 12 side stand\n [0, 191, 69, 191, 2, 34, 191], // 13 front stand\n [69, 191, 69, 191, 2, 34, 191], // 14 front step 1\n [138, 191, 69, 191, 2, 34, 191], // 15 front step 2\n [0, 382, 69, 191, 2, 34, 191], // 16 back stand\n [69, 382, 69, 191, 2, 34, 191], // 17 back step 1\n [138, 382, 69, 191, 2, 34, 191], // 18 back step 2\n //yellow\n [0, 0, 69, 191, 3, 34, 191], // 19 side step 1\n [69, 0, 69, 191, 3, 34, 191], // 20 side step 2\n [138, 0, 69, 191, 3, 34, 191], // 21 side stand\n [0, 191, 69, 191, 3, 34, 191], // 22 front stand\n [69, 191, 69, 191, 3, 34, 191], // 23 front step 1\n [138, 191, 69, 191, 3, 34, 191], // 24 front step 2\n [0, 382, 69, 191, 3, 34, 191], // 25 back stand\n [69, 382, 69, 191, 3, 34, 191], // 26 back step 1\n [138, 382, 69, 191, 3, 34, 191], // 27 back step 2\n //green\n [0, 0, 69, 191, 4, 34, 191], // 28 side step 1\n [69, 0, 69, 191, 4, 34, 191], // 29 side step 2\n [138, 0, 69, 191, 4, 34, 191], // 30 side stand\n [0, 191, 69, 191, 4, 34, 191], // 31 front stand\n [69, 191, 69, 191, 4, 34, 191], // 32 front step 1\n [138, 191, 69, 191, 4, 34, 191], // 33 front step 2\n [0, 382, 69, 191, 4, 34, 191], // 34 back stand\n [69, 382, 69, 191, 4, 34, 191], // 35 back step 1\n [138, 382, 69, 191, 4, 34, 191] // 36 back step 2\n ],\n animations: {\n //bluestand: 0,\n //bluewalk: { frames: [1, 0, 2, 0], frequency: 6 },\n //blueattack: { frames: [0, 3, 4, 3], frequency: 6 },\n\n cake: 0,\n bluesidestand:3,\n bluefrontstand:4,\n bluebackstand:7,\n bluesidewalk: { frames: [3,1,3,2], frequency: 6},\n bluefrontwalk: { frames: [4,5,4,6], frequency: 6},\n bluebackwalk: { frames: [7,8,7,9], frequency: 6},\n redsidestand:12,\n redfrontstand:13,\n redbackstand:16,\n redsidewalk: { frames: [12,10,12,11], frequency: 6},\n redfrontwalk: { frames: [13,14,13,15], frequency: 6},\n redbackwalk: { frames: [16,17,16,18], frequency: 6},\n yellowsidestand:21,\n yellowfrontstand:22,\n yellowbackstand:25,\n yellowsidewalk: { frames: [21,19,21,20], frequency: 6},\n yellowfrontwalk: { frames: [22,23,22,24], frequency: 6},\n yellowbackwalk: { frames: [25,26,25,27], frequency: 6},\n greensidestand:30,\n greenfrontstand:31,\n greenbackstand:34,\n greensidewalk: { frames: [30,28,30,29], frequency: 6},\n greenfrontwalk: { frames: [31,32,31,33], frequency: 6},\n greenbackwalk: { frames: [34,35,34,36], frequency: 6}\n\n\n }\n };\n\n // initialize the spritesheet object\n spriteSheet = new createjs.SpriteSheet(spriteData);\n}", "preload() {\n this.load.image('wideBarrier', 'SpriteFolder\\\\wideBarrier.png');\n this.load.image('wideBarrierNew', 'SpriteFolder\\\\wideBarrierNew.png');\n this.load.image('wideBarrierNewRed', 'SpriteFolder\\\\wideBarrierNewRed.png');\n this.load.image('bullet', 'SpriteFolder\\\\newBullet.png');\n this.load.image('ship', 'SpriteFolder\\\\ship.png');\n this.load.image('shipOutline', 'SpriteFolder\\\\shipOutline.png');\n this.load.image('squareBlock', 'SpriteFolder\\\\squareBlock.png');\n }", "function preload()\n {\n app.game.load.spritesheet( \"characters\", \"assets/img/game/character/characters.png\", 128, 128 );\n app.game.load.image( \"marker\", \"assets/img/game/character/charactermarker.png\" );\n app.game.load.image( \"halo\", \"assets/img/game/character/halo.png\" );\n \n app.game.load.spritesheet( \"fire\", \"assets/img/game/world/fire.png\", 128, 128 );\n app.game.load.spritesheet( \"tree\", \"assets/img/game/world/tree.png\", 256, 256 );\n app.game.load.image( \"loveTree\", \"assets/img/game/world/loveTree.png\" );\n \n app.game.load.image( \"flower\", \"assets/img/game/world/flowers.png\" );\n app.game.load.image( \"grass\", \"assets/img/game/world/grass.png\" );\n //app.game.load.image( \"grave\", \"assets/img/game/world/grave.png\" );\n }", "preload() {\n\t\t// Load the sprites.\n this.load.image('player', 'assets/player.png');\n this.load.image('cell', 'assets/cell.png');\n this.load.image('spark', 'assets/spark.png');\n this.load.image('life', 'assets/life.png');\n this.load.image('bullet', 'assets/bullet.png');\n this.load.image('fragment', 'assets/fragments.png');\n this.load.image('line', 'assets/line.png')\n // Load the sound effects.\n this.load.audio('absorb', ['assets/absorb.mp3', 'assets/absorb.ogg']);\n this.load.audio('bullet', ['assets/bullet.mp3', 'assets/bullet.ogg']);\n this.load.audio('extend', ['assets/extend.mp3', 'assets/extend.ogg']);\n this.load.audio('gameover', ['assets/gameover.mp3', 'assets/gameover.ogg']);\n this.load.audio('laser', ['assets/laser.mp3', 'assets/laser.ogg']);\n this.load.audio('levelup', ['assets/levelup.mp3', 'assets/levelup.ogg']);\n this.load.audio('lose', ['assets/lose.mp3', 'assets/lose.ogg']);\n this.load.audio('move', ['assets/move.mp3', 'assets/move.ogg']);\n this.load.audio('ready', ['assets/ready.mp3', 'assets/ready.ogg']);\n\t}", "function preload() {\n spritesheet = loadImage('images/Flakes1.png');\n font = loadFont('font/Freeride.otf');\n}", "function load_media()\n{\n bg_sprite = new Image();\n bg_sprite.src = \"images/Background-stadt_lang.png\";\n box_sprite = new Image();\n box_sprite.src = \"images/Stift.png\";\n main_sprite = new Image();\n main_sprite.src = \"images/IMG_2210_Mini.png\";\n}", "function sprites() {\n \t\tspriteWobblers = new Object();\t\t\t\t\t\t\t\t\t\t\t// Set up arrays for the path/wobbles for each sprite\n \t\tphase4bob = new image(DEMO_ROOT + \"/def/resources/phase4.gif\");\t\t\t// Get the two sprites we've using this demo.\n \t\tatariBob = new image(DEMO_ROOT + \"/def/resources/atari.gif\");\n \t\tvar seperation = 0.30;\t\t\t\t\t\t\t\t\t\t\t\t\t// Distance between sprites\n \t\tvar spritePosition = 0;\t\t\t\t\t\t\t\t\t\t\t\t\t// Position in the path/wobble\n \t\tfor ( var i=0; i < noOfSprites; i++ ) {\t\t\t\t\t\t\t\t\t// For each sprite, set up a path/wobble\n \t\tspriteWobblers[i] = new SeniorDads.Wobbler(\n \t\t\t\t[\n\t \t\t\t\t \t{value: spritePosition, amp: 240, inc:0.08},\n\t \t\t\t\t \t{value: spritePosition, amp: 20, inc:0.30}\n \t\t\t\t],\n \t\t\t\t[\n\t \t\t\t\t \t{value: spritePosition, amp: 120, inc:0.06},\n\t \t\t\t\t \t{value: spritePosition, amp: 20, inc:0.40}\n \t\t\t\t]\n \t\t\t\t);\n \t\tspritePosition += seperation;\t\t\t\t\t\t\t\t\t\t// Move along position in the path/wobble for next sprite.\n \t\t}\n \t}", "loadTextureAtlas() {\n for (let i = 1; i < constants.NUM_OF_REELS + 1; i++) {\n this.load.multiatlas(\n `reel${i}`,\n `texture_atlas/reel${i}/frames.json`,\n `texture_atlas/reel${i}`\n );\n }\n }", "function preload(){\n\n //player image\n this.load.atlas('player','././media/players/player1/playerSprite.png','././media/players/player1/playerAtlas.json');\n \n //enemy image\n this.load.atlas('enemy','././media/players/enemy1/enemySprite.png','././media/players/enemy1/enemyAtlas.json');\n \n //map files\n this.load.tilemapTiledJSON('map1a','./maps/map'+mapNumber+'.json');\n this.load.image('wall','./media/walls/wall1.jpg');\n \n //ground files\n this.load.image('ground','./media/grounds/ground1.png');\n this.load.tilemapTiledJSON('ground','./maps/ground1.json');\n\n //sounds\n this.load.audio('walkSound','././media/sounds/walking.mp3',{instances:1});\n}", "preload () {\n // loading the tile-sheet itself\n this.load.image('environment-tiles', 'assets/images/tiles/environment-tiles.png');\n // loading the json data for the map created with Tiled Editor\n this.load.tilemapTiledJSON('lvl-01-map', 'assets/maps/lvl-01-map.json');\n // Loading individual sprites. Should be refactored to use spritesheet in the future\n this.load.image('grass-patch', 'assets/images/tiles/grass-patch.png');\n // loading the player character\n this.load.spritesheet('player', 'assets/images/entities/player/characters.png', { frameWidth: 16, frameHeight: 16 });\n }", "function preload() {\n //fatcat_sprite_sheet = loadSpriteSheet('images/fatcat.png', 123, 112, 8);\n //hitcat_sprite_sheet = loadSpriteSheet('images/hitcat.png', 124, 116, 10);\n \n fatcat = loadImage(\"images/fatcat.png\");\n hitcat = loadImage(\"images/hitcat.png\");\n yarn = loadImage(\"images/yarn.png\");\n \n}", "function preload() {\n//\n// //create an animation from a sequence of numbered images\n// //pass the first and the last file name and it will try to find the ones in between\n turtle = loadAnimation('sprites/Turtle1.png', 'sprites/Turtle2.png','sprites/Turtle3.png','sprites/Turtle4.png');\n}", "function preload() {\n //caricamento immagini\n game.load.image('sfondo', 'assets/sfondo.png');\n game.load.image('bullet', '/assets/img/bullet.png');\n game.load.image('player', '/assets/img/player.png');\n game.load.image('firstEnemy', '/assets/img/enemy_1.png');\n game.load.spritesheet('explosion', '/assets/img/explode.png', 128, 128);\n }", "function load_images(){\n enemy_img = new Image();\n enemy_img.src = \"assets/virus.png\"\n\n fighter_girl = new Image()\n fighter_girl.src = \"assets/girl.png\"\n\n fighter_boy = new Image()\n fighter_boy.src = \"assets/man.png\"\n\n mask_img = new Image();\n mask_img.src = \"assets/mask.png\"\n\n heart_img = new Image();\n heart_img.src = \"assets/heart.png\"\n}", "function preload() //load all images before game\n{\n this.load.image('sky','./static/sky.png'); //sky\n this.load.image('ground','./static/platform.png'); //platforms\n this.load.image('star','./static/star.png'); //stars\n this.load.image('bomb','./static/bomb.png'); //bombs\n this.load.spritesheet('dude','./static/dude.png',{frameWidth:32,frameHeight:48});//main character\n //with many frames\n}", "function getTileResources(){\n\t//Load default resources\n\tvar tileResources = [\n\t\t{\n\t\t\tid: 'map_pieces',\n\t\t\timage: 'map_spritesheet',\n\t\t\ttileh: 32,\n\t\t\ttilew: 32,\n\t\t\ttilerow: 9,\n\t\t\tgapx: 0,\n\t\t\tgapy: 0\n\t\t},\n\t\t{\n\t\t\tid: 'player_tiles', // Set a unique ID for future reference\n\t\t\timage: 'player_sprite', // Use the 'player_sprite' image, as loaded above\n\t\t\ttileh: 64,\n\t\t\ttilew: 32,\n\t\t\ttilerow: 10,\n\t\t\tgapx: 0,\n\t\t\tgapy: 0\n\t\t},\n\t\t{\n\t\t\tid: 'block_tiles', // Set a unique ID for future reference\n\t\t\timage: 'block_sprite', // Use the 'player_sprite' image, as loaded above\n\t\t\ttileh: 32,\n\t\t\ttilew: 32,\n\t\t\ttilerow: 3,\n\t\t\tgapx: 0,\n\t\t\tgapy: 0\n\t\t},\n\t\t{\n\t\t\tid: 'background_tiles', // Set a unique ID for future reference\n\t\t\timage: 'background_tilesheet', // Use the 'player_sprite' image, as loaded above\n\t\t\ttileh: 32,\n\t\t\ttilew: 32,\n\t\t\ttilerow: 3,\n\t\t\tgapx: 0,\n\t\t\tgapy: 0\n\t\t},\n\t\t{\n\t\t\tid: 'enemy_tiles', // Set a unique ID for future reference\n\t\t\timage: 'enemy_sprite', // Use the 'player_sprite' image, as loaded above\n\t\t\ttileh: 32,\n\t\t\ttilew: 32,\n\t\t\ttilerow: 2,\n\t\t\tgapx: 0,\n\t\t\tgapy: 0\n\t\t},\n\t\t{\n\t\t\tid: 'explosion_tiles', // Set a unique ID for future reference\n\t\t\timage: 'explosion_sprite', // Use the 'player_sprite' image, as loaded above\n\t\t\ttileh: 96,\n\t\t\ttilew: 96,\n\t\t\ttilerow: 14,\n\t\t\tgapx: 0,\n\t\t\tgapy: 0\n\t\t}\n\t];\n\tif($config.use_plugins){\n//\t\ttileResources = [];\n\t\tfor(var plugin in pluginHelper.loadedPlugins){\n\t\t\tif(pluginHelper.loadedPlugins[plugin].tiles){\n\t\t\t\tjQuery.merge(tileResources,pluginHelper.loadedPlugins[plugin].tiles);\n\t\t\t}\n\t\t}\n\t}\n\treturn tileResources;\n}", "function loadRawSprite(\n name,\n src,\n conf = {\n sliceX: 1,\n sliceY: 1,\n gridWidth: 0,\n gridHeight: 0,\n anims: {},\n }\n ) {\n const frames = [];\n const tex = gfx.makeTex(src);\n const sliceX = conf.sliceX || tex.width / (conf.gridWidth || tex.width);\n const sliceY =\n conf.sliceY || tex.height / (conf.gridHeight || tex.height);\n const qw = 1 / sliceX;\n const qh = 1 / sliceY;\n\n for (let j = 0; j < sliceY; j++) {\n for (let i = 0; i < sliceX; i++) {\n frames.push(quad(i * qw, j * qh, qw, qh));\n }\n }\n\n const sprite = {\n tex: tex,\n frames: frames,\n anims: conf.anims || {},\n };\n\n assets.sprites[name] = sprite;\n\n return sprite;\n }", "function preload(){\n game.load.json('map_json', '/map/get?id=242eceff-3ce0-4e23-9183-a63de7cbf66e');\n game.load.image('test', 'roguelikeSheet_transparent.png');\n game.load.spritesheet('sprites', 'roguelikeChar_transparent.png', 16, 16, spacing=1);\n}", "function preload() { //preload all images and files so that its there ready to use.\n back = loadImage('assets/map.PNG');\n p1 = loadImage('assets/p1.jpg');\n p2 = loadImage('assets/p2.PNG');\n p3 = loadImage('assets/p3.PNG');\n // pollutants = loadStrings('csv.csv');\n images[0] = loadImage('assets/p4.jpg');\n images[1] = loadImage('assets/p5.jpg');\n images[2] = loadImage('assets/p6.jpg');\n}", "function preload ()\n{\n this.load.image('sky', 'components/images/sky.png');\n this.load.image('sky1', 'components/images/space1.png');\n this.load.image('ground', 'components/images/ground_1x1.png');\n this.load.image('grass', 'components/images/ground.png');\n this.load.image('alphabet', 'alphabet/letter_A.png');\n this.load.spritesheet('dragon', 'components/spritesheets/dragon.png', { frameWidth: 96, frameHeight:63 });\n this.load.spritesheet('Ninja', 'components/spritesheets/metalslug_monster39x40.png', { frameWidth: 39, frameHeight: 40 });\n this.load.spritesheet('mummy', 'components/spritesheets/mummy37x45.png', { frameWidth: 37, frameHeight: 45 });\n this.load.spritesheet('boom', 'components/spritesheets/explosion.png', { frameWidth: 64, frameHeight: 64, endFrame: 23 });\n}", "function onAssetsLoaded()\r\n{\r\n // create an array of textures from an image path\r\n // var frames = [];\r\n//32\r\n for (var i = 0; i < 48; i++) {\r\n var val = i < 10 ? '0' + i : i;\r\n\r\n // magically works since the spritesheet was loaded with the pixi loader\r\n var temptext = PIXI.Texture.fromFrame('playerOne00' + val + '.png')\r\n playerText.push(temptext);\r\n // pt = PIXI.Texture.fromFrame('playerOne0000.png');\r\n // playerText.push(PIXI.Texture.fromFrame('playerOne0001.png'));\r\n\r\n }\r\n\r\n // movie = new PIXI.extras.MovieClip(playerText);\r\n // movie.animationSpeed = 0.11;\r\n\r\n // movie.play();\r\n\r\n\r\n\r\n // animate();\r\n}", "function loadKeySprites() {\n emojiBet = {\n a: loadImage(\"./keys/a.png\"),\n b: loadImage(\"./keys/b.png\"),\n c: loadImage(\"./keys/c.png\"),\n d: loadImage(\"./keys/d.png\"),\n e: loadImage(\"./keys/e.png\"),\n f: loadImage(\"./keys/f.png\"),\n g: loadImage(\"./keys/g.png\"),\n h: loadImage(\"./keys/h.png\"),\n i: loadImage(\"./keys/i.png\"),\n j: loadImage(\"./keys/j.png\"),\n k: loadImage(\"./keys/k.png\"),\n l: loadImage(\"./keys/l.png\"),\n m: loadImage(\"./keys/m.png\"),\n n: loadImage(\"./keys/n.png\"),\n o: loadImage(\"./keys/o.png\"),\n p: loadImage(\"./keys/p.png\"),\n q: loadImage(\"./keys/q.png\"),\n r: loadImage(\"./keys/r.png\"),\n s: loadImage(\"./keys/s.png\"),\n t: loadImage(\"./keys/t.png\"),\n u: loadImage(\"./keys/u.png\"),\n v: loadImage(\"./keys/v.png\"),\n w: loadImage(\"./keys/w.png\"),\n x: loadImage(\"./keys/x.png\"),\n y: loadImage(\"./keys/y.png\"),\n z: loadImage(\"./keys/z.png\")\n };\n}", "loadPlanetSprites() {\n for (let planet of scenes.sim.planets) {\n let sprite = new PIXI.Sprite.fromImage(planet.map_image);\n sprite.width = planet.radius / DEFAULT_MAP_ZOOM;\n sprite.height = planet.radius / DEFAULT_MAP_ZOOM;\n sprite.anchor.set(0.5, 0.5);\n\n planet.map_sprite = sprite;\n this.stage.addChild(sprite);\n }\n }", "function preload()\n{\n this.load.image('tileset', 'maps/tileset.png');\n this.load.tilemapTiledJSON('island', 'maps/island.json');\n this.load.atlas('hemadi', 'characters/hemadi.png', 'characters/hemadi.json');\n}", "function preload()\r\n{\r\n game.load.image ('field' , 'assets/field.png' );\r\n game.load.spritesheet('guns' , 'assets/guns.png' ,50,50,5);\r\n game.load.spritesheet('bullets' , 'assets/bullets.png' ,10,10,5);\r\n game.load.spritesheet('monster01', 'assets/baddie01.png', 50, 50,4);\r\n\r\n}", "function phaserPreload() {\n // loads the background img\n game.load.image(\"background\", \"/assets/background.jpg\");\n // loads all the game tiles\n game.load.image('tile0', '/assets/tile0.png');\n game.load.image('tile1', '/assets/tile1.png');\n game.load.image('tile2', '/assets/tile2.png');\n game.load.image('tile3', '/assets/tile3.png');\n game.load.image('tile4', '/assets/tile4.png');\n game.load.image('tile5', '/assets/tile5.png');\n // loads the paddle\n game.load.image('paddle', '/assets/paddle.png');\n // loads the ball\n game.load.image('ball', '/assets/ball.png');\n}", "function preload(){\n \n sailing=loadAnimation(\"ship-1.png\",\"ship-2.png\");\n seaimage=loadImage(\"sea.png\");\n\n}", "loadSprites(callback){\n let imagesToLoad = 0;\n\n // Load all environment sprites\n for(let key in this.environmentSprites){\n if(!this.environmentSprites.hasOwnProperty(key)) continue;\n imagesToLoad++;\n let img = new Image();\n img.src = \"client/images/Sprites/\" + this.environmentSprites[key];\n img.onload = function(){\n imagesToLoad--;\n if(imagesToLoad === 0){\n callback();\n }\n };\n this.environmentSprites[key] = img;\n }\n\n // Load all player sprites\n for(let key in this.playerSprites.base) {\n\n if (!this.playerSprites.base.hasOwnProperty(key)) continue;\n\n for(let i=1; i <= 4; i++){ // There are 4 colors\n let color = \"\";\n\n // Colors of the players\n if(i === 1) color = \"White\";\n if(i === 2) color = \"Blue\";\n if(i === 3) color = \"Red\";\n if(i === 4) color = \"Green\";\n\n for(let j=0; j <= 7; j++) { // Every player has 7 animation images\n imagesToLoad++;\n let img = new Image();\n img.src = \"client/images/Sprites/\" + this.playerSprites.base[key][0].replace(\"White\",color).replace(\"f00\",\"f0\"+j);\n img.onload = function () {\n imagesToLoad--;\n if (imagesToLoad === 0) {\n callback();\n }\n };\n\n // Mirror the right side to left side\n if(key === \"side\"){\n this.playerSprites[i].right[j] = img;\n let t = this;\n // Overwrite onload. This is for copying the image to a canvas and mirroring it.\n img.onload = function(){\n let c = document.createElement('canvas');\n c.width = img.width;\n c.height = img.height;\n let ctx = c.getContext('2d');\n ctx.translate(img.width, 0);\n ctx.scale(-1, 1);\n ctx.drawImage(img, 0, 0, img.width, img.height);\n t.playerSprites[i].left[j] = c;\n\n imagesToLoad--;\n if (imagesToLoad === 0) {\n callback();\n }\n };\n }else{\n // Set the player sprites correct\n this.playerSprites[i][key][j] = img;\n }\n }\n }\n }\n }", "preload() {\n var prefix = 'imgs/'\n if(app.gameType == \"3d\")\n prefix = 'imgs/3D/'\n\n\n var boardIndex;\n var pieceIndex;\n var backgroundIndex;\n\n // Load image references into the game for later loading while playing\n game.load.image('X', prefix + 'pieceX'+app.selected.charAt(1)+'.png');\n game.load.image('square', prefix + 'board'+app.selected.charAt(0)+'.png');\n game.load.image('O', prefix + 'pieceO'+app.selected.charAt(1)+'.png');\n game.load.image('background', 'imgs/background'+app.selected.charAt(2)+'.png');\n game.load.image('forfeit', 'imgs/forfeit.png');\n game.load.image('menubackground', 'imgs/menubackgroundtwo.png');\n game.load.image('logo', 'imgs/phaser.png');\n game.load.image('board', 'imgs/angledBoard.png');\n game.load.image('greensquare', prefix + 'greensquare.png')\n game.load.image('redsquare', prefix + 'redsquare.png')\n game.load.image('poopemoji', 'imgs/poop.png')\n game.load.image('square', prefix + 'square.png')\n console.log(prefix)\n }", "preload() {\n // menu elements\n this.load.atlas(\"logo\", \"../../resources/logo.png\", \"../../resources/logo.json\");\n this.load.image(\"button\", \"../../resources/buttons/button.png\");\n this.load.image(\"button_level\", \"../../resources/buttons/button_level.png\");\n this.load.image(\"close\", \"../../resources/buttons/close.png\");\n this.load.image(\"help\", \"../../resources/buttons/help.png\");\n this.load.image(\"options\", \"../../resources/buttons/options.png\");\n\n // sounds\n this.load.audio(\"background_music\", \"../../resources/sounds/music.ogg\");\n this.load.audio(\"background_music_bossfight\", \"../../resources/sounds/bossfight.ogg\");\n this.load.audio(\"hover_sound\", \"../../resources/sounds/hover.mp3\");\n\n // skins\n this.load.atlas(\"player\", \"../../resources/shapes/player.png\", \"../../resources/shapes/player.json\");\n this.load.atlas(\"long\", \"../../resources/shapes/long.png\", \"../../resources/shapes/long.json\");\n this.load.atlas(\"love\", \"../../resources/shapes/love.png\", \"../../resources/shapes/love.json\");\n this.load.atlas(\"eye\", \"../../resources/shapes/eye.png\", \"../../resources/shapes/eye.json\");\n this.load.atlas(\"ghost\", \"../../resources/shapes/ghost.png\", \"../../resources/shapes/ghost.json\");\n this.load.json(\"shapes_physics\", \"../../resources/json/shapes.json\");\n\n // tilesprite elements\n this.load.image(\"lava\", \"../../resources/lava.png\");\n this.load.image(\"spring\", \"../../resources/spring.png\");\n\n // shooting elements\n this.load.image(\"heart\", \"../../resources/heart.png\");\n this.load.image(\"pacman\", \"../../resources/pacman.png\");\n\n // level info\n this.load.json(\"level_info\", \"../../resources/json/levels.json\");\n }", "function loadSprite(\n name,\n src,\n conf = {\n sliceX: 1,\n sliceY: 1,\n anims: {},\n }\n ) {\n // synchronously load sprite from local pixel data\n function loadRawSprite(\n name,\n src,\n conf = {\n sliceX: 1,\n sliceY: 1,\n gridWidth: 0,\n gridHeight: 0,\n anims: {},\n }\n ) {\n const frames = [];\n const tex = gfx.makeTex(src);\n const sliceX = conf.sliceX || tex.width / (conf.gridWidth || tex.width);\n const sliceY =\n conf.sliceY || tex.height / (conf.gridHeight || tex.height);\n const qw = 1 / sliceX;\n const qh = 1 / sliceY;\n\n for (let j = 0; j < sliceY; j++) {\n for (let i = 0; i < sliceX; i++) {\n frames.push(quad(i * qw, j * qh, qw, qh));\n }\n }\n\n const sprite = {\n tex: tex,\n frames: frames,\n anims: conf.anims || {},\n };\n\n assets.sprites[name] = sprite;\n\n return sprite;\n }\n\n const loader = new Promise((resolve, reject) => {\n if (!src) {\n return reject(`expected sprite src for \"${name}\"`);\n }\n\n // from url\n if (typeof src === \"string\") {\n const path = isDataUrl(src) ? src : assets.loadRoot + src;\n loadImg(path)\n .then((img) => {\n resolve(loadRawSprite(name, img, conf));\n })\n .catch(reject);\n } else {\n resolve(loadRawSprite(name, src, conf));\n }\n });\n\n addLoader(loader);\n\n return loader;\n }", "function CreateTextureSheet() {\n Game.ImagesLoading = 0;\n for (var k = 0; k < 10; k++) {\n LoadImage(k);\n }\n}", "load() {\n this.tileIndex.default.tileset = loadImage('tiles/biome-default-16.png');\n this.tileIndex.jungle.tileset = loadImage('tiles/biome-jungle-16.png');\n\n // By default, the image will be transparent black\n this.tileNone = createImage(this.tileSizeDrawn, this.tileSizeDrawn);\n /*this.tileNone.loadPixels();\n this.tileNone.pixels.fill(255);\n this.tileNone.updatePixels();*/\n }", "function preload() { //Función para asignar imágenes\n game.load.image('cielo', 'recursos/sky.png'); // Indica la ubicación del sprite cielo\n game.load.image('suelo', 'recursos/platform.png'); // Indica la ubicación del sprite suelo\n game.load.image('estrella', 'recursos/star.png'); // Indica la ubicación del sprite estrella\n game.load.spritesheet('jugador', 'recursos/dude.png', 32, 48); // Indica la ubicación de la hoja de sprites del jugador\n}", "static preload() {\n\n\t\tlet _onAssetsLoaded = function(e, ressources) {\n\t\t\tShooter.assets = ressources;\n\n\t\t\tShooter.setup();\n\t\t}\n\n\t\tShooter.loader\n\t\t\t.add(Shooter.assetsDir + \"background.jpg\") //TODO : use json objects with index\n\t\t\t.add(Shooter.assetsDir + \"space_ship.png\")\n\t\t\t.add(Shooter.assetsDir + \"space_ship_hit.png\")\n\t\t\t.add(Shooter.assetsDir + \"enemy.png\")\n\t\t\t.add(Shooter.assetsDir + \"bullet.png\")\n\t\t\t.add(Shooter.assetsDir + \"explode.json\");\n\t\t\t\n\t\tShooter.loader.load(_onAssetsLoaded);\n\t}", "function loadAssets(callback){\n\n // This function will load the sprite images\n function loadSprite(filename){\n asseetsStillLoading ++; \n\n let spriteImage = new Image();\n spriteImage.src = \"assets/sprites/\" + filename;\n\n // This is event handler and once the image has fully loaded, the function inside it will execute\n spriteImage.onload = function(){\n asseetsStillLoading --;\n }\n\n return spriteImage;\n }\n\n function loadSound(sound, loop){\n return new Sound(\"assets/sounds/\" + sound, loop);\n }\n\n sprites.background = loadSprite(\"board.png\");\n sprites.hand = loadSprite(\"hand2.png\"); \n sprites.blueBall = loadSprite(\"pointer.png\");\n sprites.queen = loadSprite(\"queen.png\");\n sprites.yellowBall = loadSprite(\"yellow.png\");\n sprites.blackBall = loadSprite(\"black.png\");\n sprites.gameOver = loadSprite(\"gameOver.png\");\n sprites.continue = loadSprite(\"continue.png\");\n sprites.winner = loadSprite(\"finalScore.png\");\n \n sounds.collide = loadSound(\"BallsCollide\");\n sounds.pocket = loadSound(\"pocket\");\n sounds.side = loadSound(\"Side\");\n\n assetsLoadingLoop(callback);\n}", "preload() {\n this.load.setPath('assets/');\n this.load.atlas('hero', 'hero_8_4_41_62.png', 'hero_8_4_41_62.json');\n }", "function loadTextures()\n {\n /*\n var loader2 = new THREE.TextureLoader();\n loader2.load ( '/uploads/humphrys/latin.jpg',\t\tfunction ( thetexture ) {\n thetexture.minFilter = THREE.LinearFilter;\n paintMaze ( new THREE.MeshBasicMaterial( { map: thetexture } ) );\n } );\n */\n var loader3 = new THREE.TextureLoader();\n loader3.load ( '/uploads/humphrys/pacman.jpg',\tfunction ( thetexture ) {\n thetexture.minFilter = THREE.LinearFilter;\n agentMap['mesh'].material = new THREE.MeshBasicMaterial( { map: thetexture } );\n } );\n\n var loader4 = new THREE.TextureLoader();\n loader4.load ( '/uploads/humphrys/ghost.3.png',\tfunction ( thetexture ) {\n thetexture.minFilter = THREE.LinearFilter;\n enemyMap['mesh'].material = new THREE.MeshBasicMaterial( { map: thetexture } );\n } );\n\n }", "function preload () {\n game.load.spritesheet('bean', 'images/red_bean.png', 82, 82);\n game.load.image('background', 'images/desert_background.png');\n}", "function preload_sprites(){\n\t\n\timg1 = new Image();\n\t\n\timg1.src = \"../images/system/bg/versionSprites.png\";\n}", "function loadAllSprites(list, spriteManager) {\n\tconst promises = [];\n\tlist.forEach(data => promises.push(loadImage(data, spriteManager)));\n\treturn Promise.all(promises);\n}", "preload() {\n this._scene.load.spritesheet('dude',\n 'assets/dude.png',\n { frameWidth: 32, frameHeight: 48 }\n );\n }", "function loadAll (cb) {\n var tex = {}\n tex.atlas = load('textures/atlas-p9.png')\n tex.skinHerobrine = load('textures/skin-herobrine.png')\n tex.skinSkeletor = load('textures/skindex-skeletor.png')\n tex.skinOcean = load('textures/skindex-ocean-dusk.png')\n tex.skinPurple = load('textures/skindex-purple-dragongirl.png')\n tex.skinGamer = load('textures/skindex-gamer-boy.png')\n tex.hud = load('textures/hud.png')\n\n var keys = Object.keys(tex)\n var promises = keys.map(function (key) { return tex[key] })\n var loaded = module.exports.loaded\n\n Promise.all(promises)\n .then(function (textures) {\n keys.forEach(function (key, i) { loaded[key] = textures[i] })\n cb()\n })\n .catch(function (err) {\n cb(err)\n })\n}", "function preload() { \n this.load.image('background', 'assets/images/background.png'); //loads up the background\n this.load.image('spike', 'assets/images/spike.png'); //loads up the spikes\n // At last image must be loaded with its JSON\n this.load.atlas('player', 'assets/images/kenney_player.png','assets/images/kenney_player_atlas.json');\n this.load.image('tiles', 'assets/tilesets/platformPack_tilesheet.png'); //loads up the tile sheet\n // Load the export Tiled JSON\n this.load.tilemapTiledJSON('map', 'assets/tilemaps/level1.json');\n\n}", "function preload(){ \n\t// all o the images/files/game files are loaded\n\t// once everything is loaded the create method is called\n\t// loading an image from a disk takes time, so thats why you preload \n\t\tthis.load.image('background', 'assets/images/background.png') // first just a name, then the path\n\t\t// this refers to the current object we are in\n\t\t// load refers to a loader object that phaser has \n\t\t// this.load.spritesheet('', 'assets//', 193, 71);\n\t\tthis.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/sprites.json');\t\n\t}", "function preload()\n{\n this.load.image('nebula', 'assets/nebula.jpg');\n this.load.image('bullet', 'assets/bullet.png');\n this.load.image('player', 'assets/thrust_ship.png');\n this.load.image('baddie', 'assets/baddie.png');\n this.load.image('baddie2', 'assets/space-baddie.png');\n this.load.image('bossbaddie', 'assets/baddie2.png');\n this.load.image('baddiebullet', 'assets/bbullet.png');\n}", "function loadAssets() {\n\thasLoaded = false;\n\tgame.load.onLoadComplete.add(loadComplete, this);\n\n\t// Load enemies defined for this level\n\tfor (const enemy of enemyChoices) {\n\t\tgame.load.image(enemy, getEnemySprite(enemy));\n\t}\n\n\tgame.load.start();\n}", "function loadAssets () {\n OasisAssets = {};\n\n // terrain\n OasisAssets['grass'] = getImage('../../res/', 'grass.png');\n OasisAssets['sand'] = getImage('../../res/', 'sand.png');\n OasisAssets['shore'] = getImage('../../res/', 'shore.png');\n OasisAssets['ocean'] = getImage('../../res/', 'ocean.png');\n OasisAssets['stone'] = getImage('../../res/', 'stone.png');\n OasisAssets['tree'] = getImage('../../res/', 'tree.png');\n OasisAssets['leaves'] = getImage('../../res/', 'leaves.png');\n}", "preload() {\n this.load.image(\"honk\", \"assets/honkhonksnippet.png\");\n this.load.image(\"white_square\", \"assets/white_square.png\");\n\n this.load.image(\"vertical\", \"assets/verticalCollision.png\");\n this.load.image(\"horizontal\", \"assets/horizontalCollision.png\");\n\n /*\n Images below represent walls, 0 = false, 1 = true.\n In order of naming convention - TOP - RIGHT - BOTTOM - LEFT\n 0000 = false, false, false, false - a white sqaure with no walls.\n 1111 = true, true, true, true - a white square with all walls.\n 1010 = true, false, true, false - a white sqaure with a top wall, and a bottom wall.\n */\n this.load.image(\"0000\", \"assets/0000.png\");\n this.load.image(\"0001\", \"assets/0001.png\");\n this.load.image(\"0010\", \"assets/0010.png\");\n this.load.image(\"0011\", \"assets/0011.png\");\n this.load.image(\"0100\", \"assets/0100.png\");\n this.load.image(\"0101\", \"assets/0101.png\");\n this.load.image(\"0110\", \"assets/0110.png\");\n this.load.image(\"0111\", \"assets/0111.png\");\n this.load.image(\"1000\", \"assets/1000.png\");\n this.load.image(\"1001\", \"assets/1001.png\");\n this.load.image(\"1010\", \"assets/1010.png\");\n this.load.image(\"1011\", \"assets/1011.png\");\n this.load.image(\"1100\", \"assets/1100.png\");\n this.load.image(\"1101\", \"assets/1101.png\");\n this.load.image(\"1110\", \"assets/1110.png\");\n this.load.image(\"1111\", \"assets/1111.png\");\n\n this.load.image(\"tilesetimage\", \"assets/fantasy_tiles.png\");//, {frameWidth : 20, frameHeight : 20});\n //this.load.tilemapTiledJSON(\"map\", \"assets/0_0.json\");\n this.load.tilemapTiledJSON(\"template\", \"assets/template.json\");\n //var parsed = JSON.parse(\"map\");\n //window.localStorage.setItem(\"0|0\", string);\n }", "static listGfx(){\n let assets = new Array();\n assets.push(\"gfx/sign_danger.png\");\n assets.push(\"gfx/turtle.png\");\n assets.push(\"gfx/turtle_in_shell_r0.png\");\n assets.push(\"gfx/squished.png\");\n assets.push(\"gfx/spring_jump_up.png\");\n assets.push(\"gfx/bomb.png\");\n assets.push(\"gfx/block_fall_on_touch_damaged_02.png\");\n assets.push(\"gfx/block_pushable.png\");\n assets.push(\"gfx/cloud.png\");\n assets.push(\"gfx/button_floor.png\");\n assets.push(\"gfx/bg-forest.png\");\n assets.push(\"gfx/vampire_wannabe.png\");\n assets.push(\"gfx/stompy.png\");\n assets.push(\"gfx/platform_left_right.png\");\n assets.push(\"gfx/gorilla_projectile.png\");\n assets.push(\"gfx/tombstone.png\");\n assets.push(\"gfx/flying_fire.png\");\n assets.push(\"gfx/jumpee.png\");\n assets.push(\"gfx/l0_splash.png\");\n assets.push(\"gfx/bomb_started.png\");\n assets.push(\"gfx/lava.png\");\n assets.push(\"gfx/block_fall_on_touch.png\");\n assets.push(\"gfx/canon_horizontal.png\");\n assets.push(\"gfx/sphere_within_sphere.png\");\n assets.push(\"gfx/explosion_big.png\");\n assets.push(\"gfx/bush_branch.png\");\n assets.push(\"gfx/elephanko_mad.png\");\n assets.push(\"gfx/button_floor_pressed.png\");\n assets.push(\"gfx/stars_black_sky.png\");\n assets.push(\"gfx/spring_jump_up_extended.png\");\n assets.push(\"gfx/elephanko.png\");\n assets.push(\"gfx/doggy.png\");\n assets.push(\"gfx/pants_gorilla_l0.png\");\n assets.push(\"gfx/explosion_small.png\");\n assets.push(\"gfx/ground_lr.png\");\n assets.push(\"gfx/fancy_city_dweller.png\");\n assets.push(\"gfx/canon_horizontal_shoot_soon.png\");\n assets.push(\"gfx/hero_r0.png\");\n assets.push(\"gfx/wood_texture.png\");\n assets.push(\"gfx/mr_spore.png\");\n assets.push(\"gfx/bomb_ignited.png\");\n assets.push(\"gfx/block_level_transition.png\");\n assets.push(\"gfx/brick_gray_bg.png\");\n assets.push(\"gfx/turtle_in_shell_l0.png\");\n assets.push(\"gfx/door_next_level_wide.png\");\n assets.push(\"gfx/turtle_in_shell.png\");\n assets.push(\"gfx/unknown.png\");\n assets.push(\"gfx/fancy_city_dweller_hat.png\");\n assets.push(\"gfx/canon_bullet_left.png\");\n assets.push(\"gfx/spikes.png\");\n assets.push(\"gfx/ground_lr2.png\");\n assets.push(\"gfx/spike_ceiling.png\");\n assets.push(\"gfx/block_fall_on_touch_damaged.png\");\n assets.push(\"gfx/fountain.png\");\n assets.push(\"gfx/turtle_r0.png\");\n assets.push(\"gfx/sign_its_safe.png\");\n assets.push(\"gfx/door_next_level.png\");\n assets.push(\"gfx/spike_ceiling_falling.png\");\n assets.push(\"gfx/smoke_dust.png\");\n assets.push(\"gfx/bush_stackable.png\");\n assets.push(\"gfx/magic_potion.png\");\n assets.push(\"gfx/pants_gorilla_r0.png\");\n assets.push(\"gfx/rabbit_house.png\");\n assets.push(\"gfx/augustus_of_prima_rabitta.png\");\n assets.push(\"gfx/hero_l0.png\");\n assets.push(\"gfx/turtle_l0.png\");\n assets.push(\"levels/l_00_rabbit_in_house.json\");\n assets.push(\"levels/l_01.json\");\n assets.push(\"levels/l_02_vampire_weekend.json\");\n assets.push(\"levels/l_exp.json\");\n assets.push(\"levels/l_05.json\");\n assets.push(\"levels/l_02.json\");\n assets.push(\"levels/l_04.json\");\n assets.push(\"levels/l_03.json\");\n assets.push(\"levels/l_99_rabbit_in_safe_house.json\");\n assets.push(\"levels/gorilla.json\");\n assets.push(\"levels/l_bug_stomp.json\");\n return assets;\n }", "function preload(){\n /* Load Player */\n game.load.image(\"player\", \"res/bigplayer.png\");\n\n /* Load Masses */\n game.load.image(\"mass-blue\", \"res/mass-blue.png\");\n //game.load.image(\"mass-green\", \"res/mass-green.png\");\n game.load.image(\"mass-pink\", \"res/mass-pink.png\");\n\n /* Load Particles */\n game.load.image(\"particle-orange\", \"res/particle-orange.png\");\n game.load.image(\"particle-blue\", \"res/particle-blue.png\");\n game.load.image(\"particle-pink\", \"res/particle-pink.png\");\n\n /* Load Black Hole */\n game.load.image(\"blackhole\", \"res/blackhole.png\");\n\n\n}", "function preload() {\n game.load.image('planet1', 'assets/planet1_small.png');\n game.load.image('planet1_selected', 'assets/planet1_small_selected.png');\n game.load.image('player1spaceship', 'assets/player1spaceship.png');\n game.load.image('player2spaceship', 'assets/player2spaceship.png');\n game.load.image('player1flag', 'assets/player1flag.png');\n game.load.image('player2flag', 'assets/player2flag.png');\n game.load.image('player1castle', 'assets/player1castle.png');\n game.load.image('player2castle', 'assets/player2castle.png');\n game.load.image('winner', 'assets/monkey_winner_icon.png');\n }", "function preload() {\n\n //create an animation from a sequence of numbered images\n //pass the first and the last file name and it will try to find the ones in between\n ghost = loadAnimation('assets/ghost_standing0001.png', 'assets/ghost_standing0007.png');\n\n //create an animation listing all the images files\n asterisk = loadAnimation('assets/asterisk.png', 'assets/triangle.png', 'assets/square.png', 'assets/cloud.png', 'assets/star.png', 'assets/mess.png', 'assets/monster.png');\n}", "function loaded()\n{\n console.log('Spritesheet loaded.');\n spritesheetLoaded = true;\n createWorld();\n}", "preload() {\n // this.load.image('kraken', './assets/kraken.png');\n // Loop through monster configuration and load each image\n for (let i = 0; i < MONSTERS.length; i++) {\n this.load.image(MONSTERS[i].name, `./assets/${MONSTERS[i].image}`);\n }\n this.load.image('bolt', './assets/bolt.png');\n this.load.image('door', './assets/door.png');\n // Load sound effects\n this.load.audio('hit', './assets/hit_001.wav');\n }", "preload() {\n this.load.image('background', 'assets/images/background.png')\n this.load.image('arrow', 'assets/images/arrow.png')\n\n this.load.spritesheet('rooster', 'assets/images/rooster_spritesheet.png', 128, 128, 4)\n this.load.spritesheet('pig', 'assets/images/pig_spritesheet.png', 128, 128, 4)\n this.load.spritesheet('sheep', 'assets/images/sheep_spritesheet.png', 128, 128, 4)\n\n this.load.audio('roosterSound', ['assets/audio/rooster.ogg', 'assets/audio/rooster.mp3'])\n this.load.audio('pigSound', ['assets/audio/pig.ogg', 'assets/audio/pig.mp3'])\n this.load.audio('sheepSound', ['assets/audio/sheep.ogg', 'assets/audio/sheep.mp3'])\n }", "function loadPlayerBase(base){\n var bg = game.add.sprite(game.world.centerX - 150, game.world.centerY/2, base.background);\n bg.anchor.setTo(.5, .5);\n bg.crop(new Phaser.Rectangle(0, 0, 800, 600));\n bg.scale.setTo(.75, .75);\n for(var i = 0; i < base.list.length; ++i){\n var temp = game.add.sprite((base.list[i].position.x - 130)/2 + game.world.centerX/2 - 150, (base.list[i].position.y + 110)/2, base.list[i].image);\n temp.anchor.setTo(0.5, 0.5);\n temp.scale.setTo(0.5, 0.5);\n }\n }", "function preload() {\n game.load.image('sky', 'asset/sky1.png');\n game.load.spritesheet('dude', 'asset/baddie.png', 32, 32);\n game.load.spritesheet('dude2', 'asset/baddie2.png', 32, 32);\n game.load.image('ground', 'asset/platform1.png');\n}", "function preload () {\n this.load.spritesheet(\n 'dude', './assets/dino.png',\n {frameWidth: 50, frameHeight: 60}\n );\n //=========== Background =============\n this.load.image('treesBushes', './assets/02_treesandbushes.png');\n this.load.image('distantTrees', './assets/03_distant_trees.png');\n this.load.image('bushes', './assets/04_bushes.png');\n this.load.image('hill1', './assets/05_hill1.png');\n this.load.image('hill2', './assets/06_hill2.png');\n this.load.image('hugeClouds', './assets/07_huge_clouds.png');\n this.load.image('clouds', './assets/08_clouds.png');\n this.load.image('distantClouds1', './assets/09_distant_clouds1.png');\n this.load.image('distantClouds2', './assets/10_distant_clouds.png');\n this.load.image('tallBG', './assets/tallBG.png');\n this.load.image('lavaTall', './assets/tallLava.png');\n //========== End Background ===========\n\n //========== Main Structure ============\n this.load.image('ground', './assets/01_ground.png');\n this.load.image('platform', './assets/platform.png');\n this.load.image('rockyTall', './assets/rockyTall.png');\n this.load.image('rockFloorLong', './assets/rocky3.png');\n this.load.image('rockFloor', './assets/rocky02.png');\n this.load.image('floatingIsland', './assets/leafy_ground05.png');\n //========= End Main Structure ===========\n\n //=============== Extras =================\n this.load.image('banana', './assets/banana.png');\n this.load.image('crystalGreen', './assets/crystalGreen.png');\n this.load.image('crystalRed', './assets/crystalRed.png');\n this.load.image('bomb', './assets/asteroid.png');\n this.load.image('lookUp', './assets/boardUp.png');\n this.load.image('lookLeft', './assets/boardLeft.png');\n this.load.image('groundBottom', './assets/groundBottom.png');\n this.load.image('bigStone', './assets/bigStone.png');\n this.load.image('nest', './assets/spikes and grass.png');\n this.load.image('poisonNest', './assets/poisonNest.png');\n this.load.image('firstNest', './assets/grassyFloor.png');\n this.load.image('treasure', './assets/treasureChest.png');\n this.load.image('dangerSign', './assets/danger.png');\n this.load.image('singleMush', './assets/singleMushroom.png');\n this.load.image('tresMap', './assets/treasureMap.png');\n this.load.image('boardUp', './assets/boardUp.png');\n this.load.image('flower1', './assets/flower1.png');\n this.load.image('flower2', './assets/flower2 .png');\n this.load.image('smallRock', './assets/smallRock.png');\n this.load.image('tinyRock', './assets/tinyRock.png');\n this.load.image('venus', './assets/vine.png');\n this.load.image('vertGroundRight', './assets/groundTall.png');\n this.load.image('vertGroundLeft', './assets/groundTallLeft.png');\n this.load.image('groundTop', './assets/groundTop.png');\n this.load.image('topGround', './assets/topGround.png');\n this.load.audio('bubblingLava', \"./assets/lava.mp3\");\n this.load.audio('coins', './assets/coins.mp3');\n this.load.audio('dying', './assets/dying.mp3');\n this.load.audio('jumping', './assets/jumping.mp3');\n this.load.audio('goingHome', './assets/goHome.mp3');\n //============== End Extras ================\n}", "function preload(){\n\nbunnyLeft = loadImage(\"bunny/assets/bunnyLeft.png\");\nbunnyRight = loadImage(\"bunny/assets/bunnyRight.png\");\nbunnyFront = loadImage(\"bunny/assets/bunnyFront.png\");\nbunnyBack = loadImage(\"bunny/assets/bunnyBack.png\");\n\ncarrotimg = loadImage(\"bunny/assets/carrot.png\");\nfloorimg = loadImage(\"bunny/assets/floor.png\");\ntomatoimg = loadImage(\"bunny/assets/tomato.png\");\ngrassimg = loadImage(\"bunny/assets/grass.png\");\n\nbunnyEnd = loadImage(\"bunny/assets/bunnyEnd.png\");\n\nfont = loadFont('bunny/assets/Adelle_Reg.otf');\n\n}", "function preload() {\n game.load.tilemap('map', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON);\n game.load.image('tiles', 'assets/tiles.png');\n this.load.image('bomb', 'assets/bomb.png');\n game.load.spritesheet('baddie', 'assets/baddie.png', 32,32);\n game.load.spritesheet('dude', 'assets/dude.png', 32, 48);\n game.load.spritesheet('explosion', 'assets/explosion17.png', 64, 64);\n game.load.audio('musicPN', 'assets/audio/-003-game-play-normal-.mp3');\n game.load.audio('musicLC', 'assets/audio/-005-level-complete.mp3');\n game.load.audio('musicDead', 'assets/audio/-009-dead.mp3');\n game.load.audio('musicDead', 'assets/audio/-009-dead.mp3');\n game.load.audio('musicBoom', 'assets/audio/bomb-03.mp3');\n game.load.audio('musicSplat', 'assets/audio/splat.mp3');\n game.load.audio('musicBump', 'assets/audio/bump-cut.mp3');\n }", "preload() {\n\t\tvar loadingLabel = game.add.text(80, 150, 'loading...', {font: '30px Courier', fill: '#ffffff'});\n\n\t\t// Load all assets. The first parameter is the variable that \n\t\t// will point to the image, and the second parameter is the \n\t\t// image file itself.\n\t\tgame.load.image('tiledBackground', 'assets/img/tiledBackground.gif');\n\t\tgame.load.image('A', 'assets/img/A.png');\n\t\tgame.load.image('E', 'assets/img/E.png');\n\t\tgame.load.image('I', 'assets/img/I.png');\n\t\tgame.load.image('O', 'assets/img/O.png');\n\t\tgame.load.image('U', 'assets/img/U.png');\n\t\tgame.load.image('questionMark1', 'assets/img/questionMark1.png');\n\t\tgame.load.image('questionMark2', 'assets/img/questionMark2.png');\n\t\tgame.load.image('questionMark3', 'assets/img/questionMark3.png');\n\t\tgame.load.image('questionMark4', 'assets/img/questionMark4.png');\n\t\tgame.load.image('speaker', 'assets/img/speaker.png');\n\t\tgame.load.image('escucha', 'assets/img/escucha.png');\n\t\tgame.load.image('avalancha', 'assets/img/avalancha.png');\n\t\tgame.load.image('restart', 'assets/img/restart.png');\n\t\tgame.load.image('lee', 'assets/img/lee.png');\n\t\tgame.load.image('home', 'assets/img/home.png');\n\t\tgame.load.image('background1', 'assets/img/background1.jpg');\n\t\tgame.load.audio('A', 'assets/audio/A.m4a');\n\t\tgame.load.audio('E', 'assets/audio/E.m4a');\n\t\tgame.load.audio('I', 'assets/audio/I.m4a');\n\t\tgame.load.audio('O', 'assets/audio/O.m4a');\n\t\tgame.load.audio('U', 'assets/audio/U.m4a');\n\t\tgame.load.audio('encuentra', 'assets/audio/encuentra.m4a');\n\n\t}", "preload()\n {\n const base = \"image/\";\n this.load.image('bg',`${base}gameScreen.png`);\n this.load.spritesheet(\"player\", `${base}player.png`, { frameWidth: 72, frameHeight: 90 });\n this.load.image(\"platform\",`${base}platform.png`);\n this.load.image(\"bullet\",`${base}bullet.png`);\n this.load.image(\"codey\",`${base}codey.png`);\n this.load.image('bugGreen', `${base}bugGreen.png`);\n this.load.image('bugRed', `${base}bugRed.png`);\n this.load.image('bugYellow', `${base}bugYellow.png`);\n this.load.image('bugYellowFlipped', `${base}bugYellowFlipped.png`);\n this.load.audio('sound',\"sound/shoot.wav\");\n this.load.audio('dieSound',\"sound/death.wav\");\n this.load.audio('gameOverSound',\"sound/round_end.wav\");\n }", "function preload(){\n img = loadImage(\n \"map.png\"\n );\n img2=loadImage(\n \"plane1.png\" \n );\n img3=loadImage(\n \"correct.png\"\n );\n img4=loadImage(\n \"openBook.jpg\" \n );\n game.init();\n}", "preload() {\n const images = Object.keys(ASSET.IMAGE).map(\n (imgKey) => ASSET.IMAGE[imgKey]\n );\n for (let image of images) {\n this.load.image(image.KEY, image.ASSET);\n }\n }", "function preload(){\n gloria = loadImage(\"Monster.bmp\");\n}", "load_sprite_image(path, sprite_width, sprite_height, num_sprites, pixel_border) {\r\n \r\n this.sprite.width = sprite_width;\r\n this.sprite.height = sprite_height;\r\n\r\n if (typeof pixel_border == 'undefined')\r\n this.sprite.pixel_border = 0;\r\n else\r\n this.sprite.pixel_border = pixel_border; \r\n\r\n //this.num_sprites = num_sprites;\r\n \r\n // Load our image - moved actual load code to the game surface\r\n return this.load_image(path);\r\n \r\n /*\r\n var self = this;\r\n var promise = new Promise(function(resolve, reject) {\r\n self.load_image(path)\r\n .then(function(){\r\n resolve('Success');\r\n },function() {\r\n reject('Cannot find image ' + path);\r\n });\r\n });\r\n return promise;\r\n */ \r\n }", "function preload() {\n\tgen = loadJSON('best_member2.json');\n birdSprite = loadImage('Images/bird.png');\n bg = loadImage('Images/bg2.png');\n pipeTop = loadImage('Images/pipeNorth.png');\n pipeBottom = loadImage('Images/pipeSouth.png');\n pipeTopHasHit = loadImage('Images/pipeHitNorth.png');\n pipeBottomHasHit = loadImage('Images/pipeHitSouth.png');\n\n digitsImage = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"].map(\n number => loadImage(`Images/${number}.png`)\n )\n\n}", "preload(){\n //console.log(\"#####> preload <#####\");\n\n /*\n this.load.image(\"crate\", \"crate.png\");\n\n this.load.image(\"rock_full\", \"data/rock_full.png\");\n this.load.image(\"rock_left_right\", \"data/rock_left_right.png\");\n this.load.image(\"rock_left_left\", \"data/rock_left_left.png\");\n this.load.image(\"rock_right_right\", \"data/rock_right_right.png\");\n this.load.image(\"rock_right_left\", \"data/rock_right_left.png\");\n\n this.load.image(\"rock_tileset\", \"data/rock_map.png\");\n\n this.load.image(\"car\", \"data/car_blue_5.png\");\n this.load.image(\"car2\", \"data/car_red_5.png\");\n\n this.load.image('road_bkg_center', 'data/road_sand18.png');\n this.load.image('road_bkg_left', 'data/road_sand17.png');\n this.load.image('road_bkg_right', 'data/road_sand19.png');\n\n this.load.image('road_bkg_arrival_left', 'data/road_sand65.png');\n this.load.image('road_bkg_arrival_center', 'data/road_sand66.png');\n this.load.image('road_bkg_arrival_right', 'data/road_sand67.png');\n //*/\n \n }", "preload() {\n \n //this.load.image('logo', 'assets/logo.png');\n\n this.load.image('Circle-UI', 'assets/test/circle-ui.png');\n this.load.image('Frog', 'assets/test/Rana1.png');\n this.load.image('Arrow', 'assets/props/arrow.png');\n this.load.image('Cross', 'assets/props/cross.png');\n this.load.image('Tick', 'assets/props/tick.png');\n\n this.load.image('BaseFloor1', ['assets/Level 1/sueloTileado.png', 'assets/Level 1/sueloTileado_n.png']);\n this.load.image('BaseSky1', 'assets/Level 1/cielo_base2.png');\n\n this.load.image('BaseFloor2', 'assets/Level 2/sueloTileadoNoche.png');\n this.load.image('BaseSky2', 'assets/Level 2/cielo_base_noche.png');\n\n this.load.image('WoodFenceNight', 'assets/Level 2/verjas_madera_noche.png');\n this.load.image('BrokenFenceNight', 'assets/Level 2/verjas_rotas_noche.png');\n\n this.load.image('MetalFence', 'assets/props/metal_fence.png');\n this.load.image('WoodFence', ['assets/props/wood_fence_small.png', 'assets/props/wood_fence_small_n.png']);\n this.load.image('Grass', ['assets/props/grass.png', 'assets/props/grass_n.png']);\n this.load.image('GrassNight', 'assets/Level 2/hierba_noche.png');\n this.load.image('Shovel1', ['assets/props/shovel1.png', 'assets/props/shovel1_n.png']);\n this.load.image('Shovel2', ['assets/props/shovel2.png', 'assets/props/shovel2_n.png']);\n this.load.image('Shovel3', ['assets/props/shovel3.png', 'assets/props/shovel3_n.png']);\n this.load.image('Shovel1Night', 'assets/Level 2/pala1_noche.png');\n this.load.image('Shovel2Night', 'assets/Level 2/pala2_noche.png');\n this.load.image('Shovel3Night', 'assets/Level 2/pala3_noche.png');\n this.load.image('Rake', ['assets/props/rake.png', 'assets/props/rake_n.png']);\n this.load.image('RakeNight', 'assets/Level 2/rastrillo_noche.png');\n this.load.image('DarkBackground', 'assets/end-game-backgroundLittle.png');\n this.load.image('LogoJuego', 'assets/main-menu/logo.png');\n this.load.image('House', 'assets/props/house.png');\n this.load.image('gnome-dead', ['assets/character/gnome-dead.png', 'assets/character/gnome-dead_n.png']);\n this.load.image('gnome-hurt', ['assets/character/gnome-hurt.png', 'assets/character/gnome-hurt_n.png']);\n this.load.image('cloud', 'assets/props/cloud.png');\n\n this.load.audio('theme1', 'assets/audio/level1.wav');\n this.load.audio('menu-theme', 'assets/audio/menu-theme.wav');\n this.load.audio('battle-theme1', 'assets/audio/battle-theme1.wav');\n\n this.load.audio('ButtonSound', 'assets/menu-sounds/papersound4.mp3');\n\n this.load.audio('axeAttack', 'assets/audio/sfx/axe-attack.wav');\n this.load.audio('enemyDeath1', 'assets/audio/sfx/death1.wav');\n this.load.audio('enemyDamage1', 'assets/audio/sfx/enemyDamage1.wav');\n this.load.audio('finalAttack1', 'assets/audio/sfx/final-attack.mp3');\n this.load.audio('gnomeDamaged1', 'assets/audio/sfx/gnomeDamaged1.wav');\n this.load.audio('walkSound', 'assets/audio/sfx/walkingSound.mp3');\n this.load.audio('parrySound', 'assets/audio/sfx/parrysound.wav');\n\n this.load.image('SettingsBackground', ['assets/main-menu/settings-background.png', 'assets/main-menu/settings-background_n3.png']);\n this.load.image('SliderBar', 'assets/main-menu/slider-bar.png');\n this.load.image('Plus', 'assets/main-menu/plus.png');\n this.load.image('Minus', 'assets/main-menu/minus.png');\n this.load.image('ExitButton', 'assets/main-menu/exit.png');\n\n this.load.image('Play-Button' , 'assets/main-menu/play.png');\n this.load.image('Settings-Button', 'assets/main-menu/settings.png');\n this.load.image('Credits-Button' , 'assets/main-menu/credits.png');\n this.load.image('Level-1' , 'assets/main-menu/level_1.png');\n this.load.image('Level-2' , 'assets/main-menu/level_2.png');\n this.load.image('Easy-Button' , 'assets/main-menu/easy.png');\n this.load.image('Hard-Button' , 'assets/main-menu/hard.png');\n this.load.image('GnomeHead' , 'assets/character/gnomehead.png');\n this.load.image('AxeIcon', 'assets/main-menu/score-icon.png');\n this.load.image('AxeIconBorderless', 'assets/main-menu/score-icon-borderless.png');\n\n this.load.image('arrowRight' , 'assets/main-menu/right.png');\n this.load.image('arrowLeft' , 'assets/main-menu/left.png');\n\n this.load.image('Exit' , 'assets/props/exit.png');\n\n this.loadAssetsEnemies();\n\n //this.load.video('intro', 'assets/videos/intro.mp4', 'canplaythrough', true, false);\n\n \n\n // Codigo relativo a la barra de carga.\n this.width = this.sys.game.config.width;\n this.height = this.sys.game.config.height;\n var that = this;\n //this.add.image(0, 0, \"simple_bg\").setOrigin(0, 0).setScale(this.width/2, this.height/2);\n this.video = this.add.video(UsefulMethods.RelativePosition(50, \"x\", this), UsefulMethods.RelativePosition(50, \"y\", this), 'intro');\n // video.displayHeight = this.height;\n // video.displayWidth = this.width;\n this.video.play(true);\n this.video.setLoop(true);\n \n this.loadVideo = function(){ \n if(!document[\"hidden\"]){\n that.video = that.add.video(UsefulMethods.RelativePosition(50, \"x\", that), UsefulMethods.RelativePosition(50, \"y\", that), 'intro');\n that.video.play(true);\n that.video.displayHeight = that.height;\n that.video.displayWidth = that.width;\n if(that.video.isPlaying()){\n UsefulMethods.print(that.video.isPlaying());\n }\n that.video.setLoop(true);\n \n }\n }\n document.addEventListener(\"visibilitychange\", this.loadVideo());\n\n let loadingBar = this.add.graphics({\n lineStyle: {\n width: 3,\n color: 0x996600\n },\n fillStyle: {\n color: 0xffff00\n }\n });\n\n var isPC = !(that.sys.game.device.os.android || that.sys.game.device.os.iOS || that.sys.game.device.os.iPad || that.sys.game.device.os.iPhone);\n var size = isPC ? 26 : 18;\n\n let loadingText = this.make.text({\n x: that.width / 2,\n y: that.height / 1.06,\n text: 'Please wait...',\n style: {\n font: size + 'px amazingkids_font',\n fill: '#ffffff'\n \n }\n \n });\n loadingText.setOrigin(0.5, 0.5);\n loadingText.scaleX = UsefulMethods.RelativeScale(0.08, \"x\", this);\n loadingText.scaleY = loadingText.scaleY;\n\n var isPC = !(that.sys.game.device.os.android || that.sys.game.device.os.iOS || that.sys.game.device.os.iPad || that.sys.game.device.os.iPhone);\n var size = isPC ? 22 : 16.5;\n\n let percentText = this.make.text({\n x: that.width / 2,\n y: that.height / 1.11675,\n text: '0%',\n style: {\n font: size + 'px amazingkids_font',\n fill: '#000000'\n }\n });\n percentText.setOrigin(0.5, 0.5);\n percentText.scaleX = UsefulMethods.RelativeScale(0.08, \"x\", this);\n percentText.scaleY = percentText.scaleY;\n\n this.load.on('progress', (percent) => {\n loadingBar.clear();\n percentText.setText(parseInt(percent * 100) + '%');\n\n loadingBar.fillRect(that.width / 2 - that.width / 2.423,\n that.height / 1.145,\n that.width * percent / 1.216,\n that.height/25);\n loadingBar.strokeRect(that.width / 2 - that.width / 2.423,\n that.height / 1.145,\n that.width / 1.216,\n that.height/25); \n })\n\n this.load.on('fileprogress', (file) => {\n\n })\n this.load.on('complete', () => {\n that.isLoading = false;\n var isPC = !(that.sys.game.device.os.android || that.sys.game.device.os.iOS || that.sys.game.device.os.iPad || that.sys.game.device.os.iPhone);\n isPC ? loadingText.setText('Click anywhere to start') : loadingText.setText('Touch anywhere to start');\n })\n }", "function initTextures() {\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"cone.jpg\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"body.jpg\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"fin.jpg\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"moon.png\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"helmet.jpg\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"cdnFlg.jpg\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"space.jpg\");\n\n textureArray.push({});\n loadFileTexture(textureArray[textureArray.length - 1], \"space2.jpg\");\n\n textureArray.push({});\n loadImageTexture(textureArray[textureArray.length - 1], image2);\n\n\n}", "function preload(){\nbackImage=loadImage(\"jungle.jpg\");\n \n player_running=loadAnimation(\"Monkey_01.png\",\"Monkey_02.png\",\"Monkey_03.png\",\"Monkey_04.png\",\"Monkey_05.png\",\"Monkey_06.png\",\"Monkey_07.png\",\"Monkey_08.png\",\"Monkey_09.png\",\"Monkey_10.png\");\n \n bananaImage=loadImage(\"banana.png\");\n obstacleImage=loadImage(\"stone.png\");\n \n obstacleGroup=new Group();\n foodGroup=new Group(); \n}", "function preload () {\n //background image\n game.load.image('background', 'assets/Map-update.png');\n\n //sprites for the characters \n game.load.image('Wizard1', 'assets/Wizard1.png');\n game.load.image('Wizard2', 'assets/Wizard2.png');\n game.load.image('Archer1', 'assets/Archer1.png');\n game.load.image('Archer2', 'assets/Archer2.png');\n game.load.image('Druid1', 'assets/Druid1.png');\n game.load.image('Druid2', 'assets/Druid2.png');\n game.load.image('Enchanter1', 'assets/Enchanter1.png');\n game.load.image('Enchanter2', 'assets/Enchanter2.png');\n game.load.image('Warrior1', 'assets/Warrior1.png');\n game.load.image('Warrior2', 'assets/Warrior2.png');\n game.load.image('Sorcerer1', 'assets/Sorcerer1.png');\n game.load.image('Sorcerer2', 'assets/Sorcerer2.png');\n game.load.image('Paladin1', 'assets/Paladin1.png');\n game.load.image('Paladin2', 'assets/Paladin2.png');\n game.load.image('Assassin1', 'assets/Assassin1.png');\n game.load.image('Assassin2', 'assets/Assassin2.png');\n\n\n\n //Spell assets\n game.load.image('spell0', 'assets/Burst.png');\n game.load.image('spell1', 'assets/Stun.png');\n game.load.image('spell2', 'assets/RangeArmorDebuff.png');\n game.load.image('spell3', 'assets/RangeHeal.png');\n game.load.image('spell4', 'assets/RangeArmorBuff.png');\n game.load.image('spell5', 'assets/Silence.png');\n game.load.image('spell6', 'assets/RangeAttackDebuffCurse.png');\n game.load.image('spell7', 'assets/RangeAttackBuff.png');\n game.load.image('spell8', 'assets/SacrificeHealth.png');\n game.load.image('spell9', 'assets/DeepFreeze.png');\n game.load.image('spell10', 'assets/Frostbolt.png');\n game.load.image('spell11', 'assets/Backstab.png');\n //\"Sprint\"\n game.load.image('spell12', 'assets/SpeedBuff.png');\n game.load.image('spell13', 'assets/Root.png');\n game.load.image('spell14', 'assets/Stun.png');\n game.load.image('spell15', 'assets/ArmorBuff.png');\n game.load.image('spell16', 'assets/Corruption.png');\n\n\n \n //log success\n console.log(\"preload() complete\");\n}", "function preload() {\n\n // if (Koji.config.images.background != \"\") {\n // imgBackground = loadImage(Koji.config.images.background);\n // }\n\n if (Koji.config.images.enemy_sprite != \"\") {\n spritedata = loadImage(Koji.config.images.enemy_sprite);\n\n }\n else {\n if (Koji.config.images.enemy1 != \"\") {\n imgEnemy1 = loadImage(Koji.config.images.enemy1);\n enemies.push(imgEnemy1);\n }\n\n if (Koji.config.images.enemy2 != \"\") {\n imgEnemy2 = loadImage(Koji.config.images.enemy2);\n enemies.push(imgEnemy2);\n }\n\n if (Koji.config.images.enemy3 != \"\") {\n imgEnemy3 = loadImage(Koji.config.images.enemy3);\n enemies.push(imgEnemy3);\n }\n }\n\n if (Koji.config.images.cursor != \"\") {\n imgCursor = loadImage(Koji.config.images.cursor);\n }\n if (Koji.config.images.ground_1 != \"\") {\n imgTile_1 = loadImage(Koji.config.images.ground_1);\n }\n if (Koji.config.images.ground_2 != \"\") {\n imgTile_2 = loadImage(Koji.config.images.ground_2);\n }\n\n //===Load Sounds here\n //Include a simple IF check to make sure there is a sound in config, also include a check when you try to play the sound, so in case there isn't one, it will just be ignored instead of crashing the game\n //if (Koji.config.sounds.tap) sndTap = loadSound(Koji.config.sounds.tap);\n}", "static loadPlayerSelector() {\n if (this._isLoaded(\"player_selector\"))\n return\n\n let game = this.game\n let players = game.cache.getJSON(\"players\")\n\n for (let type in players)\n game.load.spritesheet(type + \"_player\" , \"./assets/players/\" + type + \"/images/player.png?__version__\", players[type][\"sprite\"][\"width\"], players[type][\"sprite\"][\"height\"])\n\n game.load.image('menu_player_up', './assets/menu/images/up.png?__version__')\n game.load.image('menu_player_down', './assets/menu/images/down.png?__version__')\n game.load.audio(\"menu_player_change\", \"./assets/menu/sounds/change.mp3?__version__\");\n game.load.audio(\"menu_player_confirm\", \"./assets/menu/sounds/confirm.mp3?__version__\");\n }", "function preload ()\r\n{\r\n this.load.image('bg', 'assets/bg.png');\r\n this.load.image('ball', 'assets/ball.png');\r\n this.load.image('wall', 'assets/wall.png');\r\n this.load.image('goal', 'assets/goal.png');\r\n this.load.image('cursor','assets/cursor.png');\r\n}", "function loadPixiSprites(sprites) { \n for (let i = 0; i < sprites.length; i++) {\n let texture = new PIXI.Texture.fromImage(sprites[i]);\n let image = new PIXI.Sprite(texture);\n \n if (texts) {\n let textStyle = new PIXI.TextStyle({\n fill: \"#ffffff\",\n wordWrap: true,\n wordWrapWidth: 400\n });\n \n let text = new PIXI.Text(texts[i], textStyle);\n image.addChild(text);\n \n text.anchor.set(0.5);\n text.x = image.width / 2;\n text.y = image.height / 2;\n }\n \n image.anchor.set(0.5);\n image.x = renderer.width / 2;\n image.y = renderer.height / 2;\n \n slidesContainer.addChild(image);\n } \n}", "preload()\r\n {\r\n this.load.image('ball', 'assets/images/ball.png');\r\n this.load.image('leftspike', 'assets/images/leftspike.png');\r\n this.load.image('wall', 'assets/images/wall.png');\r\n this.load.image('rightspike', 'assets/images/rightspike.png');\r\n }" ]
[ "0.76824445", "0.72199464", "0.71704096", "0.71398735", "0.7103305", "0.71013194", "0.7095047", "0.7093334", "0.70919806", "0.70239604", "0.70221657", "0.6981963", "0.6953683", "0.6944999", "0.6860466", "0.68525463", "0.6818738", "0.67565095", "0.6753676", "0.67405385", "0.6737832", "0.673021", "0.67210704", "0.6717432", "0.6711055", "0.6707902", "0.6694163", "0.6667531", "0.6642802", "0.6613032", "0.6608047", "0.66043425", "0.6579899", "0.6577522", "0.65556014", "0.65376514", "0.6513211", "0.6498977", "0.64831924", "0.6466575", "0.6454082", "0.64509094", "0.6441772", "0.6426747", "0.6415207", "0.64149225", "0.64036447", "0.64004135", "0.63995737", "0.6398596", "0.63981384", "0.6397693", "0.639537", "0.63857424", "0.6380903", "0.6378062", "0.6377254", "0.637598", "0.63748693", "0.63722914", "0.637069", "0.6369847", "0.63694173", "0.6367945", "0.6353138", "0.63529825", "0.63349855", "0.6331699", "0.63190335", "0.631424", "0.6313951", "0.63118047", "0.6307159", "0.62955177", "0.629383", "0.62921304", "0.62845844", "0.6284515", "0.62808394", "0.62757224", "0.62645656", "0.62627435", "0.6260471", "0.62601995", "0.62589616", "0.62496364", "0.6249145", "0.6241909", "0.62408537", "0.6234222", "0.6225626", "0.6221896", "0.6217517", "0.62156075", "0.6214082", "0.6212692", "0.6206176", "0.61988676", "0.6197606", "0.6196893" ]
0.68521756
16
function for drawing a certain portion from the spritesheet
draw(){ image(this.spriteSheet, this.charX, this.charY, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawSprite(context){\n const yOffset = 5;\n //rounds down to whole number so sprites aren't drawn looking blurry\n\n //TODO: once board is set, this should draw in the lower left corner of each cell\n const x = Math.ceil(this.center.x) - this.creature.width/2;\n const y = Math.ceil(this.center.y) + Math.ceil(this.depth) - this.creature.height + yOffset;\n\n this.creature.draw(context, x, y);\n\n }", "drawSprite() {\n let x = this.drawingX;\n let y = this.drawingY;\n let colorIndex = 0;\n let colorOffset = colorIndex * this.pixelHeight;\n this.imageOffset = 0;\n game.foregroundContext.drawImage(this.spriteSheet, this.imageOffset * this.pixelWidth, colorOffset, this.pixelWidth, this.pixelHeight, x, y, this.pixelWidth, this.pixelHeight);\n }", "draw() {\n\n // PNG room draw\n super.draw();\n if (x0 === true) this.bookSprites[0].remove();\n if (x1 === true) this.bookSprites[1].remove(); \n if (x2 === true) this.bookSprites[2].remove();\n if (x3 === true) this.bookSprites[3].remove(); \n\n drawSprite(this.bookSprites[0]);\n drawSprite(this.bookSprites[1]);\n drawSprite(this.bookSprites[2]);\n drawSprite(this.bookSprites[3]);\n\n playerSprite.overlap(this.bookSprites[0], this.bookCollect0);\n playerSprite.overlap(this.bookSprites[1], this.bookCollect1);\n playerSprite.overlap(this.bookSprites[2], this.bookCollect2);\n playerSprite.overlap(this.bookSprites[3], this.bookCollect3);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.row * tileHeight - entityOffesetY); \n }", "draw() {\n let sprite = this.sprite;\n if (sprite == null)\n return;\n ctx.drawImage(sprite.sprite, sprite.animationFrame * sprite.width, 0, sprite.width, sprite.height, this.rect.x + sprite.xOffset, this.rect.y + sprite.yOffset, this.rect.width * sprite.xStretch, this.rect.height * sprite.yStretch);\n if (Entity.showEntityRects) {\n ctx.beginPath();\n ctx.lineWidth = \"5\";\n ctx.strokeStyle = \"#00ff00\";\n ctx.rect(this.rect.x, this.rect.y, this.rect.width, this.rect.height);\n ctx.stroke();\n }\n }", "draw() {\n\n\t\tthis.p5.push();\n\n\t\tlet h = this.p5.map(this.sprite.height, 0, 625, 0, this.p5.height);\n\t\tlet w = h * 500/625;\n\t\tthis.p5.image(this.sprite, 0, 0, w, h);\n\n\t\tthis.p5.pop();\n\t\t\n\t}", "render() {\n ctx.drawImage(Resources.get(this.sprite), (this.col-1) * tileWidth, this.row * tileHeight - entityOffesetY);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), (this.col * tileWidth) - tileWidth, this.row * tileHeight - entityOffesetY+10);\n }", "render() {\n\n \tctx.drawImage(Resources.get(this.sprite), ...RENDER_AT_POSITION(this.x,this.y));\n\t}", "render() {\n\n \tctx.drawImage(Resources.get(this.sprite), ...RENDER_AT_POSITION(this.x,this.y));\n\t}", "hort(x, y) {\n //visual blocks\n this.blck = this.add.sprite(x - 65,y - 32,'blck');\n this.blck = this.add.sprite(x - 32,y - 32,'blck');\n this.blck2 = this.add.sprite(x,y - 32,'blck');\n }", "function drawSprite(imgName,row,col,dimensionX,dimensionY,atX,atY)\n{\n\t/*\n\t\tvar maxFrame=image.get(imgName).animationInfo.maxFrame;\n\t\tvar imgN=image.get(imgName);\n\t\tvar dimX=image.get(imgName).width;\n\t\tvar dimY=image.get(imgName).height;\n\t*/\n\t\n\tctx.drawImage(image.get(imgName),(col-1)*dimensionX,(row-1)*dimensionY,dimensionX,dimensionY,atX,atY,dimensionX,dimensionY)\n\t//ctx.drawImage(image.get(imgName),0,0,dimensionX,dimensionY,atX,atY,dimensionX,dimensionY)\n}", "draw() {\n rect(this.x1, this.y1, this.Width, this.Height);\n }", "draw() {\n rect(this.x1, this.y1, this.Width, this.Height);\n }", "render() {\n\t\tif(this.start === true)\n\t\t\tthis.y = this.rowStart;\n\t\tctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n\n\t\tthis.crashZoneX = this.x + 5;\n\t\tthis.crashZoneY = this.y + 83;\n\n\t\tctx.rect(this.crashZoneX, this.crashZoneY, this.crashWidth, this.crashHeight);\n\n\t}", "render () {\r\n ctx.drawImage(Resources.get(this.sprite), this.x-50, this.y-100);\r\n }", "draw(ctx) {\n if (this.health > 18) this.health = 18;\n if (this.health < 1) this.health = 1;\n let sourceY = (18 - Math.floor(this.health)) * 21 + 2;\n //source x, y, source width, height, dest x, y, dest width, height\n ctx.drawImage(this.imagesheet, 2, sourceY, 205, 17, 2, 8, 200, 15);\n }", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.rect(this.position.x - width/2, this.position.y - width/2, width, width);\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "render(sprite,x,y) {\n ctx.drawImage(Resources.get(sprite), x, y);\n }", "function put_drawn_sprites(pcanvas, canvas_x, canvas_y, pdrawn, fog)\n{ \n for (var i = 0; i < pdrawn.length; i++) {\n var offset_x = 0, offset_y = 0;\n if ('offset_x' in pdrawn[i]) {\n offset_x += pdrawn[i]['offset_x'];\n }\n if ('offset_y' in pdrawn[i]) {\n offset_y += pdrawn[i]['offset_y'];\n }\n if (pdrawn[i]['key'] == \"city_text\" ) {\n mapview_put_city_text(pcanvas, pdrawn[i]['text'], canvas_x + offset_x, canvas_y + offset_y);\n \n } else if (pdrawn[i]['key'] == \"unit_activity_text\" ) {\n mapview_put_unit_text(pcanvas, pdrawn[i]['text'], canvas_x + offset_x, canvas_y + offset_y); \n } else if (pdrawn[i]['key'] == \"border\" ) {\n mapview_put_border_line(pcanvas, pdrawn[i]['dir'], pdrawn[i]['color'], canvas_x, canvas_y);\n } else {\n mapview_put_tile(pcanvas, pdrawn[i]['key'], canvas_x + offset_x, canvas_y + offset_y);\n\n } \n }\n \n}", "drawPiece(piece){\n let context = this.canvas.getContext(\"2d\");\n let shiftX = this.cell_w * piece.pos.x;\n let shiftY = this.cell_h * piece.pos.y;\n let imageObj = undefined;\n\n context.save();\n context.lineWidth = \"2\";\n context.strokeStyle = \"black\";\n context.beginPath();\n context.rect(shiftX + 5, shiftY + 5, this.cell_w - 10, this.cell_h - 10);\n context.stroke();\n context.closePath();\n\n let rank = piece.rank;\n let scale = 0.7;\n let imageW = 64 * 0.7, imageH = 64 * 0.7;\n let ssx = (64 - imageW)/ 2, ssy = (64 - imageW)/ 2 - 2;\n let colorW= \"\", colorB = \"\"\n\n if (piece.team == 1){\n colorB = \"black\"\n colorW = \"white\"\n imageObj = this.game.imageObjs.get(IMAGE_PATH[0]);\n }else if (piece.team == 2){\n colorB = \"white\"\n colorW = \"black\"\n imageObj = this.game.imageObjs.get(IMAGE_PATH[1]);\n }\n context.fillStyle= colorB;\n context.fill();\n context.stroke();\n\n\n if (!piece.isHide){\n context.drawImage(imageObj, piece.rank * this.cell_w, 0, this.cell_w, this.cell_h, shiftX + ssx, shiftY + ssy, imageW, imageH)\n context.font=\"10px Verdana\";\n context.fillStyle= colorW;\n rank = rank == 0 ? \"B\" : (rank == \"11\" ? \"F\" : rank);\n context.fillText(\"RANK \" + rank, shiftX + ssx + 2, shiftY + ssy + 45);\n }\n context.restore();\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x+10, this.y, 80, 135);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x+10, this.y, 80, 135);\n }", "draw() {\n this.tiles.forEach(t => {\n var tileCoords = {\n x: this.origin.x + (t.x * 8) + 16,\n y: this.origin.y + (t.y * 8)\n }\n this.context.drawImage(RESOURCE.sprites, t.t * 8, 16, 8, 8, tileCoords.x, tileCoords.y, 8, 8);\n });\n }", "function draw() {\n rectMode(CENTER);\n background(0);\n paper.display();\n ground.display();\n bin1.display();\n bin2.display();\n bin3.display();\n drawSprites();\n \n}", "function drawSprite(x, y, s, o) {\n //Sprites are drawn from the TOP-LEFT corner\n //This is to match the default in p5js\n \n var w = getWidth(s);\n var h = getHeight(s);\n \n for(var i = 0; i < w; i++) {\n for(var j = 0; j < h; j++) {\n var val = s[i][j];\n var rx = x+j;\n var ry = y+i;\n \n switch(val) {\n case '_':\n if(o) {\n setScreen(rx, ry, 0);\n }\n break;\n case '#':\n setScreen(rx, ry, 1)\n break;\n }\n }\n }\n}", "function draw() {\n\n\t//Set rectangle's Mode(starting point of making rectangle ) as (CENTRE)\n\trectMode(CENTER);\n\n\t//Set canvas' color as \"black\"\n\tbackground(0);\n\n\t//Set packageSprite's X position according to packageBody's position X\n\tpackageSprite.x = packageBody.position.x\n\n\t//Set packageSprite's Y position according to packageBody's position Y\n\tpackageSprite.y = packageBody.position.y\n\n\t//Set packageSprite's X position according to helicopter's X position\n\tpackageSprite.x = helicopterSprite.x\n\n\t//Drawing the sprites inside function draw()\n\tdrawSprites();\n\n}", "doDraw(offset) {\n super.doDraw(offset);\n let pp = [this.pos[0] - 64 - offset, this.pos[1] - 256];\n let image = \"wizard-\";\n if (this.dir == 1){\n image+=\"r\";\n } else {\n image+=\"l\";\n }\n drawImage(Graphics[image], pp);\n if (this.spell != undefined) {\n this.spell.doDraw(offset);\n }\n // draw_window.\n for (let i=0; i < this.health; i+=1) { // hud\n drawImage(Graphics[\"wizard_health\"], [canvas_element.width-40, 8 + i*32]);\n }\n \n }", "draw(){\n if (this.alive === true) image(this.spriteSheet, this.x, this.y, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight);\n }", "function draw() {\n //frameRate(1);\n //background (250);\n //xpos = xpos + 10;\n //ypos = ypos - 10;\n console.log(xpos);//check for errors\n \n image(sprite,xpos,ypos);\n}", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n if (this.x > 490) {\n this.x = -5;\n }\n }", "render() {\n const x = this.x - spriteWidth / 2;\n const y = this.y - spriteHeight / 2;\n ctx.drawImage(Resources.get(this.sprite), x, y);\n }", "render() {\n const x = this.x - spriteWidth / 2;\n const y = this.y - spriteHeight / 2;\n ctx.drawImage(Resources.get(this.sprite), x, y);\n }", "drawPlayer(ctx) {\n // draw player\n ctx.save();\n ctx.drawImage(this.PLAYER.playerSprite, this.PLAYER.playerSpriteX, this.PLAYER.playerSpriteY, this.PLAYER.playerWidth, this.PLAYER.playerHeight, this.PLAYER.xPos, this.PLAYER.yPos, this.PLAYER.playerWidth, this.PLAYER.playerHeight);\n ctx.restore();\n // UPDATE WHICH SPRITE TO USE FROM SPRITE SHEET\n if(this.PLAYER.playerSpriteX != 374 && this.PLAYER.spriteOffsetCounter == 5) {\n this.PLAYER.playerSpriteX += 34;\n this.PLAYER.spriteOffsetCounter = 0;\n }\n else if(this.PLAYER.spriteOffsetCounter == 5){\n this.PLAYER.playerSpriteX = 0;\n this.PLAYER.spriteOffsetCounter = 0;\n }\n \n if(this.debug) {\n ctx.save();\n ctx.strokeStyle = \"red\";\n ctx.strokeRect(this.PLAYER.xPos, this.PLAYER.yPos, this.PLAYER.playerWidth, this.PLAYER.playerHeight);\n }\n }", "function DrawTile(xPos, yPos, size, tile) {\r\n\r\n \r\n //Lookup the tile on the spritesheet\r\n //If tile is background, don't bother rendering it\r\n if (tile == null) {\r\n return;\r\n }\r\n\r\n //Draw the tile from the spritesheet to the canvas\r\n //NOTE: The \"+1\"s and \"-2\"s crop the tile by 1 pixel, as\r\n // modern browsers such as chrome use anti aliasing\r\n // which cause the image to bleed with neighbouring\r\n // tiles on the spritesheet.\r\n ctx.drawImage(\r\n img = spriteSheet,\r\n x = (tile[0] * rawTileSize)+1,\r\n y = (tile[1] * rawTileSize)+1,\r\n dw = rawTileSize-2,\r\n dh = rawTileSize-2,\r\n sx = xPos + offset_x,\r\n sy = yPos + offset_y,\r\n swidth = size,\r\n sheight = size\r\n );\r\n}", "function set_board()\n{\n ctx.fillStyle = \"rgb(25, 25, 112)\"; // color: Water-Blue\n ctx.fillRect (0, 0, 399, 272); // Draw Water\n ctx.fillStyle = \"rgb(0, 0, 0)\"; // color: Black\n ctx.fillRect (0, 272, 399, 293); // Draw Street\n ctx.drawImage(sprites, 14, 13, 319, 32, 35, 10, 319, 32); // Title\n ctx.drawImage(sprites, 0, 55, 399, 56, 0, 55, 399, 56); // Grass\n ctx.drawImage(sprites, 0, 119, 399, 35, 0, 272, 399, 35); // Upper Sidewalk\n ctx.drawImage(sprites, 0, 119, 399, 35, 0, 474, 399, 35); // Lower Sidewalk\n update_game();\n update_text();\n}", "render() {\n const x = this.x - this.spriteWidth / 2;\n const y = this.y - this.spriteHeight / 2;\n ctx.drawImage(Resources.get(this.sprite), x, y);\n }", "function printPlayer() {\n\n c.fillStyle = \"#00ff00\";\n c.drawImage(\n player.sprites[player.currentSprite][0],\n 0,\n 64 * player.currentFrame,\n 32,\n 64,\n player.x * cellSize,\n player.y * cellSize,\n player.w * cellSize,\n player.h * cellSize\n );\n\n\n c.stroke();\n c.beginPath();\n\n c.strokeStyle = \"#ff0000\";\n c.rect(\n player.x * cellSize,\n player.y * cellSize + cellSize,\n player.w * cellSize,\n player.h * cellSize - cellSize\n );\n c.closePath();\n c.stroke();\n}", "render(ctx) { \n ctx.strokeStyle = this.strokeStyle\n ctx.lineWidth = this.lineWidth\n ctx.fillStyle = this.fillStyle\n ctx.beginPath()\n //Draw the sprite around its `pivotX` and `pivotY` point\n ctx.rect(\n -this.width * this.pivotX,\n -this.height * this.pivotY,\n this.width,\n this.height\n )\n if(this.strokeStyle !== \"none\") ctx.stroke()\n if(this.fillStyle !== \"none\") ctx.fill()\n if(this.mask && this.mask === true) ctx.clip()\n }", "draw_tile(sprite, x, y){\n console.log('drawing tile');\n this.context.drawImage(\n this.spritesheet, // spritesheet image for map\n (this.get_sprite(sprite) - 1) * this.tile_size, // spritesheet start x\n 0, // spritesheet start y\n this.tile_size, // how much of spritesheet to move x\n this.tile_size, // how much of spritesheet to move x\n x * this.tile_size, // where to place on canvas x\n y * this.tile_size, // where to place on cavas y\n this.tile_size, // how much of canvas to draw x\n this.tile_size // how much of canvas to draw y\n );\n }", "function draw() {\n imageMode(CENTER);\n background(253, 226, 135);\n paper.display();\n ground.display();\n dustbin1.display();\n dustbin2.display();\n dustbin3.display();\n drawSprites();\n\n}", "renderSprite (sprite, x, y) {\n sprite.visible = true\n sprite.position.set(\n (x - this.viewport.pos[0]) * this.cellSize.x * this.zoom,\n (y - this.viewport.pos[1]) * this.cellSize.y * this.zoom\n )\n sprite.scale.set(this.zoom)\n }", "function drawRectangle() {\n}", "doDraw(offset) {\n super.doDraw(offset);\n let pp = [this.pos[0] - 64 - offset, this.pos[1] - 128];\n let image = \"chad-\";\n if (this.stance == 0){\n image+=\"n\";\n } else {\n image+=\"d\";\n }\n if (this.dir == 1){\n image+=\"r\";\n } else {\n image+=\"l\";\n }\n drawImage(Graphics[image], pp);\n\n for (let i=0; i < this.health; i+=1) { // hud\n drawImage(Graphics[\"health\"], [8, 8 + i*32]);\n }\n }", "function drawShooting(x, y){\n graphics.fillRect(x, y, 10, 5);\n graphics.fillStyle = \"Red\";\n //graphics.fillRect(225, 480, 15, 15);\n //graphics.fillRect(x, y, 15, 15);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y); \n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y); \n }", "spr(s, x0, y0) {\n this.cr.renderer.mozImageSmoothingEnabled = false;\n this.cr.renderer.webkitImageSmoothingEnabled = false;\n this.cr.renderer.imageSmoothingEnabled = false;\n let amountFieldsHorizontal = this.images.values().next().value.width / this.spriteSize;\n let yPos = Math.floor(s / amountFieldsHorizontal);\n let xPos = s - amountFieldsHorizontal * yPos;\n this.cr.renderer.drawImage(this.images.values().next().value, xPos * this.spriteSize, yPos * this.spriteSize, 8, 8, x0 * this.cr.options.scaleFactor, y0 * this.cr.options.scaleFactor, this.spriteSize * this.cr.options.scaleFactor, this.spriteSize * this.cr.options.scaleFactor);\n }", "draw() {\n this.range.draw();\n if (this.isSplit()) {\n this.LL.draw();\n this.LH.draw();\n this.HL.draw();\n this.HH.draw();\n }\n }", "draw() {\n this.range.draw();\n if (this.isSplit()) {\n this.LL.draw();\n this.LH.draw();\n this.HL.draw();\n this.HH.draw();\n }\n }", "draw() {\n this.range.draw();\n if (this.isSplit()) {\n this.LL.draw();\n this.LH.draw();\n this.HL.draw();\n this.HH.draw();\n }\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "draw() {\n // PNG room draw\n super.draw();\n\n drawSprite(this.piggySprite)\n\n // talk() function gets called\n playerSprite.overlap(this.piggySprite, talkToPiggy);\n \n if( this.talk2 !== null && talkedToPiggy === true ) {\n image(this.talk2, this.drawX + 40, this.drawY - 190);\n }\n }", "render(){\n // use the getCharcters method and the player sprite index to determine which character to draw\n ctx.drawImage(Resources.get(this.getCharacters()[this.sprite]), this.x, this.y);\n }", "render (){\n\tctx.drawImage(Resources.get(this.sprite), this.actualx, this.actualy);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\r\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\r\n }", "function _spr(x,y,w,h,sx,sy,data) {\n\tfor (var i=0; i<w; i++) {\n\t\tfor (var j=0; j<h; j++) {\n\t\t\tvar c = data[i+j*w]\n\t\t\trect(x+i*sx,y+j*sy,sx,sy,c)\n\t\t}\n\t}\n}", "function draw() {}", "function draw() {}", "draw() {}", "draw() {}", "draw() {}", "draw() {}", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "draw(context) {\r\n\r\n \r\n // Find the src coordinates of the sprite we need.\r\n var src_y = 0;\r\n var src_x = 0;\r\n\r\n\r\n // We are using the sprite animation - wowzers.\r\n var sprite_data = this.sprite.animation_sequence_data[this.sprite.animation_sequence];\r\n\r\n // Each animation sequence in expected to have its own row in the sprite\r\n // graphic - yeah I know but it makes things easier :)\r\n src_y = (this.sprite.animation_sequence * this.sprite.height) + (this.sprite.animation_sequence * this.sprite.pixel_border) + this.sprite.pixel_border;\r\n src_x = (sprite_data.frame_current * this.sprite.width) + (sprite_data.frame_current * this.sprite.pixel_border) + this.sprite.pixel_border;\r\n \r\n //context.globalCompositeOperation = \"hard-light\";\r\n //this.surface.canvas.globalCompositeOperation = \"screen\";\r\n //this.surface.canvas.globalCompositeOperation = \"screen\"; \r\n\r\n context.drawImage(this.surface.canvas,\r\n src_x,//this.sprite * this.sprite_width, \r\n src_y, \r\n this.sprite.width, \r\n this.sprite.height,\r\n this.sprite.x_pos + this.sprite.x_offset,\r\n this.sprite.y_pos + this.sprite.y_offset, \r\n this.sprite.width,\r\n this.sprite.height);\r\n\r\n\r\n\r\n // If an animation sequence has been setup for this sprite\r\n // this will takecare of updating the sprite informaton when\r\n // drawing.\r\n this.update_animation();\r\n\r\n\r\n // If we are debuging - show somw debug info\r\n if (this.sprite.debug) {\r\n\r\n var x = this.sprite.x_pos + this.sprite.x_offset;\r\n var y = this.sprite.y_pos + this.sprite.y_offset;\r\n\r\n // Text output position.\r\n context.font = \"12pt serif\";\r\n context.fillStyle = '#ffffff';\r\n context.fillText('(X=' + x + ', Y=' + y + ')', \r\n x + 20 + this.sprite.width, \r\n y + 20);\r\n\r\n // Show Center point.\r\n context.fillRect(this.sprite.x_pos, this.sprite.y_pos, 4, 4);\r\n }\r\n }", "draw() { }", "draw() { }", "draw() { }", "render(){ \n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "draw(x_in, y_in, w, h)\n\t{\t\t\n\t\t/*\n\t\tfill(255*heat, 0, 255*(1 - heat));\n\t\trect(x, y - bar_h, bar_w, bar_h*2);\n\t\t*/\n\t\t\t\n\t\t\n\t\tthis.world.draw(x_in, y_in);\n\t}", "function drawSprite(img, sX, sY, sW, sH, dX, dY, dW, dH) {\n ctx.drawImage(img, sX, sY, sW, sH, dX, dY, dW, dH);\n}", "function drawSprite (obj, sprite) {\n ctx.drawImage(sprite, obj.x, obj.y)\n}", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.y);\n }" ]
[ "0.7170279", "0.7157409", "0.7115168", "0.6986985", "0.6884575", "0.6859903", "0.68532044", "0.68512654", "0.6772024", "0.6772024", "0.6748956", "0.674499", "0.6683687", "0.6683687", "0.66590476", "0.66555816", "0.66442746", "0.66420686", "0.66361123", "0.6627111", "0.6618065", "0.6613014", "0.6613014", "0.6592984", "0.65649855", "0.652616", "0.65249383", "0.65120584", "0.6505313", "0.6481018", "0.6466283", "0.6455463", "0.6455463", "0.6443853", "0.6440464", "0.6400305", "0.6398439", "0.63968736", "0.63946503", "0.63882613", "0.6387097", "0.6375481", "0.6373161", "0.6339442", "0.633444", "0.632972", "0.632972", "0.6326227", "0.6315582", "0.6315582", "0.6315582", "0.6313962", "0.63040763", "0.6302855", "0.6294722", "0.6293296", "0.6293296", "0.6292492", "0.6285774", "0.6274416", "0.6274416", "0.6264662", "0.6264662", "0.6264662", "0.6264662", "0.626023", "0.62529194", "0.6252689", "0.6252689", "0.6252689", "0.6247946", "0.6246045", "0.62437314", "0.62383074", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594", "0.623594" ]
0.70307994
3
using 'millis()' to get the time and the time from the last animation frame switch
getTime(){ this.time = millis(); this.timeFromLast = this.time - this.timeUntilLast; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "function calcAnimationLength() {\r\n return data[data.length - 1].time / 1000 + \"s\"\r\n}", "function getDeltaTime()\r\n{\r\n\tendFrameMillis = startFrameMillis;\r\n\tstartFrameMillis = Date.now();\r\n\r\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\r\n\t\t// We need to modify the delta time to something we can use.\r\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\r\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \r\n\t\t// animations appear at the right speed, though we may need to use\r\n\t\t// some large values to get objects movement and rotation correct\r\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\r\n\t\r\n\t\t// validate that the delta is within range\r\n\tif(deltaTime > 1)\r\n\t\tdeltaTime = 1;\r\n\t\t\r\n\treturn deltaTime;\r\n}", "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this.currentFrameNum > this.maxFrame) this.stationaryState();\n\n //resetting the animation after the ninth frame\n if (this.currentFrameNum > this.maxFrame){ \n this.currentFrameX = 0;\n this.currentFrameNum = 0;\n\n //changed to stationary if the user has let go of a movement key\n if (this.willStop === true) this.stationaryState();\n\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n\n }\n\n \n \n\n }", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime()\n{\n\tendFrameMillis = startFrameMillis;\n\tstartFrameMillis = Date.now();\n\n\t\t// Find the delta time (dt) - the change in time since the last drawFrame\n\t\t// We need to modify the delta time to something we can use.\n\t\t// We want 1 to represent 1 second, so if the delta is in milliseconds\n\t\t// we divide it by 1000 (or multiply by 0.001). This will make our \n\t\t// animations appear at the right speed, though we may need to use\n\t\t// some large values to get objects movement and rotation correct\n\tvar deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\t\n\t\t// validate that the delta is within range\n\tif(deltaTime > 1)\n\t\tdeltaTime = 1;\n\t\t\n\treturn deltaTime;\n}", "function getDeltaTime() {\n endFrameMillis = startFrameMillis;\n startFrameMillis = Date.now();\n\n // Find the delta time (dt) - the change in time since the last drawFrame\n // We need to modify the delta time to something we can use.\n // We want 1 to represent 1 second, so if the delta is in milliseconds\n // we divide it by 1000 (or multiply by 0.001). This will make our\n // animations appear at the right speed, though we may need to use\n // some large values to get objects movement and rotation correct\n var deltaTime = (startFrameMillis - endFrameMillis) * 0.001;\n\n // validate that the delta is within range\n if (deltaTime > 1)\n deltaTime = 1;\n\n return deltaTime;\n}", "function frame1eyeAppear(waitTime){\n var time = waitTime;\n console.log(time);\n\n tl = new TimelineMax({delay: time});\n tl\n .from(frame1_eye, 0.3, {opacity:0})\n}", "get animateTime() {\n\t\treturn this._animateTime;\n\t}", "function lastFrameTimeUpdate(theKeyAnimationsLength,theKeyFrameAnimations,theLastFrameCurrentTime) {\n var i;\n for (i = 0; i < theKeyAnimationsLength; i+=1) {\n theLastFrameCurrentTime[i] = theKeyFrameAnimations[i].currentTime;\n }\n}", "update( time ) {\r\n let animation = this.animationList[this.current];\r\n if( !animation ) return;\r\n this.progress += time * animation.fps;\r\n while( this.progress >= 1.0 ) {\r\n this.progress -= 1.0;\r\n this.frame++;\r\n if( this.frame >= animation.startFrame + animation.numFrames ) {\r\n this.frame = animation.startFrame;\r\n }\r\n }\r\n }", "function updateAnimationState(time){\n\t\t// console.log(lastUpdate);\n\t\tfor(var i = 0; i < characters.length;i++){\n\t\t\tc = characters[i];\n\t\t\tc.updateAnimationState(time);\n\t\t}\n\t\t// lastUpdate = time;\n\t}", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "function frame1eye1Appear(waitTime){\n var time = waitTime;\n console.log(time);\n\n tl = new TimelineMax({delay: time});\n tl\n .from(frame1_eye1, 1, {opacity:0} , '+=0.5')\n .to(frame1, 1, {opacity:0})\n}", "nextFrame() {\n this.updateParticles();\n this.displayMeasurementTexts(this.stepNo);\n this.stepNo++;\n\n if (this.stepNo < this.history.length - 1) {\n // Set timeout only if playing\n if (this.playing) {\n this.currentTimeout = window.setTimeout(\n this.nextFrame.bind(this),\n this.animationStepDuration\n );\n }\n } else {\n this.finish();\n }\n }", "calcTime () {\n this.time = Math.max(0.1, Math.min(Math.abs(this.scrollY - this.scrollTargetY) / this.speed, 0.8))\n }", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "function startTimeAnimation() {\n\n\t// reset the time slider\n\t$('#time_slider').slider('value', 0);\n\t\n\t// update the map\n\tupdateMapTimePeriod(0);\n\t\n\t// update the time marker\n\tcurrentTimeInterval = 1;\n\t\n\t// set a timeout for the continue time animation\n\tnextTimeout = setTimeout('continueTimeAnimation()', 3000);\n\t\n\t// update the message\n\t$('#animation_message').empty().append('Animation running…');\n\n}", "function updateAnimation() {\n drawCanvas();\n puckCollision();\n if (goalScored()) {\n resetPuck();\n resetStrikers();\n }\n moveCPUStriker();\n seconds = seconds - (16 / 1000);\n // as long as there is time remaining, don't stop\n if (seconds > 0) {\n document.getElementById(\"time\").innerHTML = Math.round(seconds, 2);\n } else {\n // if less than 3 periods have elapsed, do the following\n if (periodNum < 3) {\n nextPeriod();\n } else {\n stopAnimation();\n }\n }\n }", "get animatePrevTime() {\n\t\treturn this._animatePrevTime;\n\t}", "function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();}// Generate parameters to create a standard animation", "animate(animation, animationDelay = 0, loopFrame = 0, loopAmount = -1) { //higher animationDelay is slower, every x frame\r\n var isLastFrame = 0;\r\n\t\t//console.log(\"BEFORE currentframe\", this.currentFrame, \"spritenumber\", this.spriteNumber, \"animation length\", animation.length);\r\n\t\t//console.log(\"isLastFrame\", isLastFrame, \"loopcounter\", this.loopCounter, \"loopamount\", loopAmount);\r\n\t\tif(this.animationDelayCounter >= animationDelay) {\r\n\t\t\tthis.currentFrame += 1;\r\n\t\t\tif((this.currentFrame === animation.length)) {// && ((loopAmount === -1) || (this.loopCounter < loopAmount))){\r\n\t\t\t\tthis.currentFrame = loopFrame;\r\n\t\t\t\tthis.loopCounter += 1;\r\n\t\t\t\tisLastFrame += 1;\r\n\t\t\t\t//console.log(\"First If\");\r\n\t\t\t}\r\n if((loopAmount > -1) && (this.loopCounter > loopAmount)) {\r\n isLastFrame += 1;\r\n\t\t\t\tthis.currentFrame = animation.length-1;\r\n\t\t\t\t//console.log(\"Second If\");\r\n }\r\n\t\t\tthis.animationDelayCounter = 0;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.animationDelayCounter += 1;\r\n\t\t}\r\n this.spriteNumber = animation[this.currentFrame];\r\n //console.log(\"AFTER currentframe\", this.currentFrame, \"spritenumber\", this.spriteNumber, \"animation length\", animation.length);\r\n\t\t//console.log(\"isLastFrame\", isLastFrame, \"loopcounter\", this.loopCounter, \"loopamount\", loopAmount);\r\n return isLastFrame;\r\n\t}", "function updateTime(){\n const { time } = _DotGameGlobal;\n const curr = Date.now();\n time.deltaTime = (curr - time.currTime) / 1000;\n time.currTime = curr;\n}", "function timerCallBack(timestamp) {\n var drawStart = (timestamp < 1e12 ? // New HTML5 high resolution timer\n (drawStart = performance.now ?\n (performance.now() + performance.timing.navigationStart) : Date.now()) :\n // Integer milliseconds since unix epoch\n timestamp || new Date().getTime());\n if (drawStart - animationStartTime >= 1000) {\n plugin._updateTargets();\n animationStartTime = drawStart;\n }\n requestAnimationFrame(timerCallBack);\n }", "function animate(timestamp) {\n oneStep();\n animationId = requestAnimationFrame(animate);\n}", "function updateAnimation(anim) {\r\n\t\t\tif (Date.now() - anim.frameTimer > anim.frameDuration) {\r\n\t\t\t\tif (anim.currentFrame < anim.frames.length - 1) anim.currentFrame ++;\r\n\t\t\t\telse anim.currentFrame = 0;\r\n\t\t\t\tanim.frameTimer = Date.now();\r\n\t\t\t}\r\n\t\t}", "getTime() {\n\t\tlet progressWidth = this.progressBar.clientWidth / 100;\n\t\tthis.currentPosition.innerHTML =\n\t\t\tMath.floor(this.audio.currentTime.toFixed(0) / 60) +\n\t\t\t\":\" +\n\t\t\t(this.audio.currentTime.toFixed(0) < 10\n\t\t\t\t? `0${this.audio.currentTime.toFixed(0)}`\n\t\t\t\t: this.audio.currentTime.toFixed(0) % 60 < 10\n\t\t\t\t? `0${this.audio.currentTime.toFixed(0) % 60}`\n\t\t\t\t: this.audio.currentTime.toFixed(0) % 60\n\t\t\t\t? this.audio.currentTime.toFixed(0) % 60\n\t\t\t\t: \"00\");\n\t\tthis.getDuration();\n\t\tthis.progressBar.value =\n\t\t\t(this.audio.currentTime / this.audio.duration) * 100;\n\t\tthis.progressButton.style.left = `${\n\t\t\tthis.progressBar.value * progressWidth - 4\n\t\t}px`;\n\t}", "function onAnimationEnd() {\n // stop the last frame from being missed..\n rec.stop();\n }", "function requestAnimFrame() {\n if (!lastCalledTime) {\n lastCalledTime = Date.now();\n fps2 = 0;\n return fps;\n }\n delta = (Date.now() - lastCalledTime) / 1000;\n lastCalledTime = Date.now();\n fps2 = 1 / delta;\n // console.clear();\n console.log('\\n'.repeat('100'));\n return parseInt(fps2);\n}", "function animationLoop(gl, Date, startTime, setTimeout) {\n setTimeout(animationLoop, 16, gl, Date, startTime, setTimeout);\n currentTime = (new Date()).getTime() * 0.001; // calculate current time for frame\n currentTime -= startTime;\n enterFrameHandler && enterFrameHandler(); // Call onEnterFrame callback if running application has defined one\n gl.clear(gl.COLOR_BUFFER_BIT); // Clear drawing surface with backgroundColor (glColor)\n screen.__draw(gl, gl.mvMatrix); // Start scene-graph render walk\n \n \n //framerate.snapshot();\n }", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();} // Generate parameters to create a standard animation", "function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();} // Generate parameters to create a standard animation", "function animationLost() {\n\t\tconsole.log(\"he perdido\");\t\n\tposX2=hasta;\t\nhasta=hasta-60;\nposX=posX-60;\n\t\t// Start the animation.\n\t\trequestID2 = requestAnimationFrame(animate2);\n\t}", "animatedMotion(time) {\n const newTime = this.audioPlayer.getTime();\n this.translatePointToCenter(this.createPoint(newTime, 0));\n this.timeoutId = setTimeout(() => this.animatedMotion(time), 10);\n this.toolBoxRef.current.moveSliderFromCanvas();\n }", "setTimeLimit() {\nvar lastframe;\n//-----------\nif (this.fCount === 0) {\nreturn this.tLimit = 0;\n} else {\nlastframe = this.frameAt(this.fCount - 1);\nreturn this.tLimit = (lastframe.getTime()) + (lastframe.getDuration());\n}\n}", "get current_animation() { return (this.is_playing() ? this.playback.assigned : '') }", "updateTime() {\r\n if (this.state == STATES.play) {\r\n if (this.remain === 0) {\r\n return this.winner();\r\n }\r\n this.time += 0.1; \r\n this.htmlScore.innerHTML = (this.mines-this.flags) +\r\n \" / \" + this.mines + \" \" + this.time.toFixed(1);\r\n }\r\n }", "updateTime() {\n var ideal = Date.now() - this.startTime;\n this.setState({timeElapsed: ideal + this.state.stoppedAt});\n \n // adjust the timeout to account for delays due to setTimeout\n var realTime = this.state.timeElapsed - this.state.stoppedAt;\n var diff = ideal - realTime;\n this.timer = setTimeout(this.updateTime, 10 - diff);\n }", "tick() {\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::tick\");\t\n var timeNow = new Date().getTime();\n\n if (this.lastTime != 0)\n \tthis.elapsed = timeNow - this.lastTime;\n\n this.lastTime = timeNow;\n }", "get animateDeltaTime() {\n\t\treturn this._animateDeltaTime;\n\t}", "function updateAnimation(anim) {\n if (Date.now() - anim.frameTimer > anim.frameDuration) {\n if (anim.currentFrame < anim.frames.length - 1) anim.currentFrame ++;\n else anim.currentFrame = 0;\n anim.frameTimer = Date.now();\n }\n}", "onAnimFrame() {\n const now = Date.now();\n const delta = now - this.previousFrameTime;\n const interval = 1000 / this.props.fps;\n\n this.requestId = window.requestAnimationFrame(this.onAnimFrame);\n\n if (delta > interval) {\n this.previousFrameTime = now - (delta % interval);\n this.drawCurrentFrame();\n\n // Clamp playback between start & end frame range, looping\n // whenever we run past the end frame.\n if (this.frame < this.startFrame || this.frame > this.endFrame) {\n this.frame = this.startFrame;\n }\n }\n }", "function startAnimation() {\n waited += new Date().getTime() - stopTime\n stopAnim = false;\n Animation();\n}", "function repeat(time) {\n // timestamps.push(time);\n updatePositions();\n redraw();\n window.requestAnimationFrame(repeat);\n // var n = timestamps.length -1;\n // console.log(1000/ (timestamps[n] - timestamps[n-1]));\n}", "function timeKeep(num,timer){\n setTimeout(function(){\n lightUp(seq[num]);\n }, timer);\n}", "animate(time){\n const timeDelta = time - this.lastTime;\n\n //step is for constant moving obj (bullets)\n this.game.step(timeDelta);\n\n this.game.draw(this.ctx);\n this.lastTime = time; \n\n //check if the game is over!\n this.gameOver();\n requestAnimationFrame(this.animate.bind(this));\n }", "getGameTime() {\n return this.time / 1200;\n }", "tick() {\n if (this.isRunning) {\n const now = Date.now();\n this.elapsedTime = this.elapsedTime + (now - this.previousTime);\n this.previousTime = now; \n }\n this.display.updateTime(this.elapsedTime);\n this.display.updateDisplay();\n }", "function timerCallBack(timestamp) {\n\t\tvar drawStart = (timestamp < 1e12 ? // New HTML5 high resolution timer\n\t\t\t(drawStart = performance.now ?\n\t\t\t(performance.now() + performance.timing.navigationStart) : Date.now()) :\n\t\t\t// Integer milliseconds since unix epoch\n\t\t\ttimestamp || new Date().getTime());\n\t\tif (drawStart - animationStartTime >= 1000) {\n\t\t\tplugin._updateTargets();\n\t\t\tanimationStartTime = drawStart;\n\t\t}\n\t\trequestAnimationFrame(timerCallBack);\n\t}", "function timerCallBack(timestamp) {\n\t\tvar drawStart = (timestamp < 1e12 ? // New HTML5 high resolution timer\n\t\t\t(drawStart = performance.now ?\n\t\t\t(performance.now() + performance.timing.navigationStart) : Date.now()) :\n\t\t\t// Integer milliseconds since unix epoch\n\t\t\ttimestamp || new Date().getTime());\n\t\tif (drawStart - animationStartTime >= 1000) {\n\t\t\tplugin._updateTargets();\n\t\t\tanimationStartTime = drawStart;\n\t\t}\n\t\trequestAnimationFrame(timerCallBack);\n\t}", "async wait() {\n this.waitingAnimationFinish = true;\n await Utils.delay(1000);\n this.waitingAnimationFinish = false;\n }", "wait_GM_1st_AnimationEnd(){\n if(this.check_Reset())\n return;\n if (this.numberOfTries > this.maxNumberOfTries) {\n this.numberOfTries = -1;\n\n if (this.currentPlayer == 2)\n {\n this.scene.update_CameraRotation();\n this.state = 'WAIT_GM_CAMERA_ANIMATION_END';\n }\n else\n this.state = 'GAME_MOVIE';\n\n }\n this.numberOfTries++;\n }", "updateTime() {\n\t\tlet now = new Date().getTime();\n\t\tlet x = now - this.startTime;\n\t\tlet time = moment.duration(x);\n\t\tthis.elapsedTime = clc.xterm(242)(time.hours() + 'h ') + clc.xterm(242)(time.minutes() + 'm ') + clc.xterm(242)(time.seconds() + 's');\n\t}", "animate() {\n if (this.animationFrames.length > 1) {\n this.animationTimer += 1;\n const quotient = Math.floor(this.animationTimer / this.animationFrameDuration)\n const frame = quotient % this.animationFrames.length;\n this.srcImage = this.animationFrames[frame];\n if (this.animationTimer === this.animationFrameDuration * this.animationFrames.length) {\n this.animationTimer = 0;\n }\n }\n }", "function step(startTime) {\n\n// console.log(\"working\");\n // 'startTime' is provided by requestAnimationName function, and we can consider it as current time\n // first of all we calculate how much time has passed from the last time when frame was update\n if (!timeWhenLastUpdate) timeWhenLastUpdate = startTime;\n timeFromLastUpdate = startTime - timeWhenLastUpdate;\n\n // then we check if it is time to update the frame\n if (timeFromLastUpdate > timePerFrame) {\n // and update it accordingly\n $element.attr('src', imagePath + '/cup-' + frameNumber + '.png');\n // $element.attr('src', imagePath + `/cup-${frameNumber}.png`);\n // reset the last update time\n timeWhenLastUpdate = startTime;\n\n // then increase the frame number or reset it if it is the last frame\n if (frameNumber >= totalFrames) {\n frameNumber = 1;\n } else {\n frameNumber = frameNumber + 1;\n }\n }\n\n requestAnimationFrame(step);\n}", "update() {\n this.setState(prevState => {\n let remaining = prevState.endTime - Date.now();\n if (remaining > 0) {\n let offset = remaining % 1000;\n this.timeout = setTimeout(() => this.update(), offset);\n let totalSecs = Math.ceil(remaining / 1000);\n let hours = Math.floor(totalSecs / 60 / 60);\n let minutes = Math.floor(totalSecs / 60) % 60;\n let seconds = totalSecs % 60;\n return {\n display: this._formatTime(hours, minutes, seconds),\n lastOffset: (remaining % 1000) - 1000\n };\n } else {\n return {\n ended: true,\n display: this._formatTime(0, 0, 0)\n };\n }\n });\n }", "function createFxNow(){setTimeout(function(){fxNow = undefined;});return fxNow = jQuery.now();} // Generate parameters to create a standard animation", "getFrame(t) {\nvar NF, f, frame, resolved, was_complete;\n//-------\n// Allow for the possibility that the frame seqeuence is extended\n// while we are scanning it. In the case where our search apparently\n// hits the sequence limit this means (a) that we should check\n// whether new frames have been added, and (b) that we shouldn''t\n// terminate the animation until we know that it is complete.\n// If I knew more about modern browsers' scheduling, I might realise\n// that this is unnecessarily complicated, or perhaps alternatively\n// that it is not complicated enough to be safe.\nresolved = false;\nwhile (!resolved) {\nwas_complete = this.isComplete;\nNF = this.fCount;\nf = this.getFrameIndex(t, NF);\nresolved = f !== NF || was_complete || NF === this.fCount;\nif (--this.traceMax > 0) {\nif (typeof lggr.trace === \"function\") {\nlggr.trace(`Resolved: ${resolved} f=${f} NF=${NF} fCount=${this.fCount}`);\n}\n}\n}\n// Find result frame\n// Rather than terminate the animation, stick at the last available\n// frame, pending the arrival of possible successors -- via\n// @extendSigns() -- or the indication that there will never be\n// any successors -- via @setCompleted.\nreturn frame = f !== NF ? (this.fIncomplete = 0, this.setFrameAt(f)) : this.isComplete ? null : (this.fIncomplete++, this.fIncomplete < 5 ? typeof lggr.debug === \"function\" ? lggr.debug(\"getFrame: at end of incomplete animation\") : void 0 : void 0, this.setFrameAt(NF - 1));\n}", "slowGameTime()\n {\n this.clockTick = this.clockTick / 6;\n if (this.timeIsSlowed)\n {\n this.specialEffects.prepareCanvasLayersForEffects();\n console.log(\"Slowing\");\n this.specialEffects.performSlowTimeSpecialEffects();\n }\n }", "function displayTimer(){\n push();\n textFont(`Blenny`);\n fill(breadFill.r, breadFill.g, breadFill.b);\n textSize(24);\n text(`${timer} seconds left`, 1050, 190);\n if (frameCount % 60 == 0 && timer > 0) {\n timer --;\n }\n // if (timer == 0) {\n // text(\"GAME OVER\", width, height);\n // }\n pop();\n }", "function animate_time (n, text, colon) {\n\t\tvar i = parseInt(text[0].textContent.split(\":\")[0]) - 1;\n\t\tvar inc = 500 / n;\n\n\t\tvar step = function () {\n\t\t\tif (i == n) return;\n\n\t\t\tvar ni = i + 1;\n\t\t\tif (ni <= 9) si = \"0\" + ni;\n\t\t\telse si = ni;\n\t\t\t\n\t\t\ttext[0].textContent = si;\n\t\t\tif (colon) text[0].textContent += \":\";\n\n\t\t\ti ++;\n\t\t\tsetTimeout(step, inc);\n\t\t};\n\n\t\tsetTimeout(step, 1);\n\t}", "set_time( t ){ this.current_time = t; this.draw_fg(); return this; }", "function timeFrame() {\n return Math.round(Math.random() * (MAX - MIN) + MIN)\n }", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n\n this.lifeTime = this.time - this.startTime;\n \n \n }", "function firstFrame(){\n\t$(\".mainMenuAnimation\").hide();\n\t$(\"#frame2\").show();\n\tif(blinkTime < 1){\n\t\tsetTimeout(secondFrame, 530)\n\t\t++blinkTime;\n\t}\n\telse{\n\t\tsetTimeout(thirdFrame, 400)\n\t}\n\t\n}", "frame2ms(frame) {\n\n }", "function animate()\n{\n\tvar time = new Date().getTime();\n\tvar draw = 0;\n\tplayback(time);\n\tif( time - lastTime >= 2 )\n\t{\n\t\tdraw = 1;\n\t\tlastTime = time;\n\t\tclearCanvas();\n\t\tstaticCircles.drawStatic(time);\n\t}\n\telse\n\t{\n\t\tdraw = 0;\n\t}\n\tnew_song.play(time, draw);\n\tdisplayMetronome();\n}", "function updateTime(ti) {\n\tvar curDuration = bg.getCurDuration();\n\tvar progress = ti / 400;\n\n\tbg.setTime(progress * curDuration);\n}", "function animate(){\n var T;\n var ease;\n var time = (new Date).getTime();\n \n T = limit_3(time-animation.starttime, 0, animation.duration);\n \n if (T >= animation.duration){\n clearInterval (animation.timer);\n animation.timer = null;\n animation.now = animation.to;\n \n }else{\n ease = 0.5 - (0.5 * Math.cos(Math.PI * T / animation.duration));\n animation.now = computeNextFloat (animation.from, animation.to, ease);\n }\n \n animation.firstElement.style.opacity = animation.now;\n}", "function Update()\n{\n timeleft -= Time.deltaTime;\n accum += Time.timeScale/Time.deltaTime;\n ++frames;\n if( timeleft <= 0.0 )\n {\n guiText.text = \"\" + (accum/frames).ToString(\"f2\");\n timeleft = updateInterval;\n accum = 0.0;\n frames = 0;\n }\n}", "function onAnimationDone() {\n sourceFrameIndex = currentFrameIndex;\n if (playing) {\n waitTimeout();\n }\n }", "function updateStartTime(){\n if(mode == \"play\"){\n startTime = millis();\n }\n}", "function main(){\r\n\tvar TL=fl.getDocumentDOM().getTimeline()\r\n\tvar curL=TL.currentLayer;\r\n\tvar curF=TL.currentFrame;\r\n\tvar frame=TL.layers[curL].frames[curF];\r\n\tif(curF>frame.startFrame){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t}else if(curF==frame.startFrame && curF>0){\r\n\t\tTL.currentFrame=frame.startFrame;\r\n\t\tvar prevFrame=TL.layers[curL].frames[frame.startFrame-1];\r\n\t\tTL.currentFrame=frame.startFrame-(prevFrame.duration);\r\n\t}\r\n}", "@autobind\n updateTime(event) {\n this.material.uniforms[ 'time' ].value = this.tweenContainer.time;\n }", "_tick() {\n if (this.startAttr === false) return;\n this.timeAttr = this.timeAttr + (TimerFunction._now() - this.startAttr);\n this.stop();\n this.callbackAttr(this.time());\n this.start();\n }", "doFrame(moves, currTime, totalTime) {\n if (currTime < totalTime) {\n // Draw animation\n setTimeout(() => {\n this.doFrame(moves, currTime + 1 / FRAME_PER_SECOND, totalTime);\n }, 1 / FRAME_PER_SECOND * 1000);\n\n for (let move of moves) {\n // moves -> [[start[i, j], end[i, j]], ...]\n // move -> [start[i, j], end[i, j]]\n let block = this.blocks[move[0][0]][move[0][1]];\n\n let origin = this.gridToPosition(move[0][0], move[0][1]);\n let destination = this.gridToPosition(move[1][0], move[1][1]);\n let currPosition = [\n origin[0] + currTime / totalTime * (destination[0] - origin[0]),\n origin[1] + currTime / totalTime * (destination[1] - origin[1])\n ]\n\n block.style.top = currPosition[0];\n block.style.left = currPosition[1];\n }\n } else {\n view.drawGame();\n }\n }", "function stepTime() {\n currentHourSetting += 1;\n if (currentHourSetting > 83)\n currentHourSetting -= 83;\n drawTimeSlide();\n let promises = updateTime();\n\t$.when.apply($, promises).then(function() {\n\t\tif (animationPlaying)\n\t\t\tanimationTimeout = setTimeout(stepTime, 200);\n\t});\n}", "function tick() {\r\n now = window.performance.now();\r\n delta = (now-last); // in milliseconds\r\n if(t_cooldown>0) {\r\n t_cooldown -= delta*dcd;\r\n } else {\r\n t -= delta*dt;\r\n }\r\n t = t<0 ? 0 : t;\r\n last = now;\r\n\r\n // Update fps counter\r\n fhStart = (fhStart+1)%100;\r\n fhEnd = (fhEnd+1)%100;\r\n frameHistory[fhEnd] = now;\r\n fpsElement.textContent = Math.ceil( 1000.0*frameHistory.length/(now-frameHistory[fhStart]) )\r\n }", "function timerCallBack(timestamp) {\r\n\t\t\t\tvar drawStart = (timestamp < 1e12 ? // New HTML5 high resolution timer\r\n\t\t\t\t\t(perfAvail ? (window.performance.now() + window.performance.timing.navigationStart) : now()) :\r\n\t\t\t\t\t// Integer milliseconds since unix epoch\r\n\t\t\t\t\ttimestamp || now());\r\n\t\t\t\tif (drawStart - animationStartTime >= 1000) {\r\n\t\t\t\t\tself._updateElems();\r\n\t\t\t\t\tanimationStartTime = drawStart;\r\n\t\t\t\t}\r\n\t\t\t\trequestAnimationFrame(timerCallBack);\r\n\t\t\t}", "function msecUntilNextGame()\n {\n var now = new Date().getTime();\n var timePrevGameOver = Math.floor(now / MSECS_IN_COMPLETE_CYCLE) * MSECS_IN_COMPLETE_CYCLE;\n return (timePrevGameOver + MSECS_IN_COMPLETE_CYCLE) - now;\n }", "hadouken(){\n this.state = \"hadouken\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 2348;\n this.frameHeight = 109;\n this.frameWidth = 125;\n this.maxFrame = 8;\n hadouken1.startTime = millis();\n }", "function animate() {\n var timeNow = new Date().getTime();\n\n if (animate.timeLast) {\n var elapsed = timeNow - animate.timeLast;\n\n\n for (var i = 0; i < items.length; i++) {\n items[i].animate();\n }\n }\n animate.timeLast = timeNow;\n}", "function Animate() {\n\n //stop animating if requested\n if (stop_animating) return;\n \n // request another frame\n requestAnimationFrame(Animate);\n\n // calc elapsed time since last loop\n time.now = performance.now();\n time.elapsed = time.now - time.then;\n\n // if enough time has elapsed and all objects finished rendering, draw the next frame\n if ( (time.elapsed > fps_interval) && (UpdateFinished()) ) {\n\n //add this frame duration to the frame array\n fps_array.push( parseInt(1000/ (time.now - time.then) ) );\n\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fps_interval not being a multiple of user screen RAF's interval\n //(16.7ms for 60fps for example).\n time.then = time.now - (time.elapsed % fps_interval);\n\n //Draw the frame\n UpdateTimeDisplay();\n DrawFrame();\n }\n}", "function tick(){\n // Save the current time\n g_seconds = performance.now()/1000.0-g_startTime;\n //console.log(g_seconds);\n\n //Update animation angles:\n updateAnimationAngles();\n\n // Draw Everything: \n renderAllShapes();\n\n // Tell the browser to update again when it has time \n requestAnimationFrame(tick);\n}", "function setTimer() {\n // get the shortRest\n // get the largeRest\n }", "function animation(time) {\n if (prev) {\n const totalTime = time - prev;\n const speed = 0.008; // fly speed\n const activeSegment = stack[stack.length - 1];\n const prevLayer = stack[stack.length - 2];\n const boxShouldMove =\n !end &&\n (!computer ||\n (computer &&\n activeSegment.threejs.position[activeSegment.direction] <\n prevLayer.threejs.position[activeSegment.direction] +\n difficulty));\n if (boxShouldMove) {\n activeSegment.threejs.position[activeSegment.direction] += speed * totalTime;\n activeSegment.cannonjs.position[activeSegment.direction] += speed * totalTime;\n if (activeSegment.threejs.position[activeSegment.direction] > 10) {\n miss();\n }\n } else {\n if (computer) {\n split();\n setdifficulty();\n }\n }\n\n if (camera.position.y < boxHeight * (stack.length - 2) + 4) {\n camera.position.y += speed * totalTime;\n }\n physics(totalTime);\n renderer.render(scene, camera);\n }\n prev = time;\n}", "getAnimationDuration() {\n let min = Streak.durations.min,\n max = Streak.durations.max;\n \n return Number.parseFloat((min + (max - min) * Math.random()).toFixed(2));\n }", "function wait()\n{\n\tsetTimeout(() => \n\t{\n\t\tif (activeAnimations < maximumAnimations)\n\t\t{\n\t\t\tsetTimeout(() => {\n\t\t\t\tanimateNext();\n\t\t\t}, 100);\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsetTimeout(() => {\n\t\t\t\twait();\n\t\t\t}, 100);\n\t\t}\n\t}, 100);\n}", "function checkTime() {\n self.time--;\n $('.time .value').html(self.time);\n if (self.time<=0) {\n console.log(self.intervalID);\n self.progress+=10;\n self.lives--;\n $('canvas').css('background-color','rgba(233, 72, 88, 0.1)');\n setTimeout(function() { self.nextTurn(); }, 300);\n }\n }", "slowDown() {\n this.mag -= 1;\n }", "function animate(time){\n requestAnimationFrame(animate);\n TWEEN.update(time);\n }", "animationLoop() {\n // increment animateUnit by a fraction each loop\n let delta = this.endUnit - this.startUnit;\n if (delta < 0) {\n delta = this.totalUnits + delta;\n }\n\n this.animateUnit += delta / this.framesPerSec;\n\n if (this.animateUnit >= this.totalUnits) {\n // wrap around from max to 0\n this.animateUnit = 0;\n }\n\n if (Math.floor(this.animateUnit) === this.endUnit) {\n // target reached, disable timer\n clearInterval(this.animationTimer);\n this.animationTimer = null;\n this.animateUnit = this.endUnit;\n this.startUnit = this.endUnit;\n }\n\n // redraw on each animation loop\n this.draw();\n }", "function startTime2() {\n if (t == 0) {\n //h, m and s are assigned to the real time\n var today = new Date();\n h = today.getHours();\n m = today.getMinutes();\n s = today.getSeconds();\n }\n if (t == 1) { \n //h, m and s are assigned to the set time\n h = hSetTime;\n m = mSetTime;\n s = sSetTime; \n }\n\n\t\t\tseconds.animate({transform: [ 'r',((s*6) + 180),200,200]}); //secondhand animation\n\t\t\tminutes.animate({transform: ['r',((m*6) + 180),200,200]}); //minute hand animation\n\t\t\thours.animate({transform: ['r',((h*30) + 180),200,200]}); //hours hand animation\t\t\n\t\t\t\n\t\t\tsetTimeout(function(){startTime2()}, 250); //funtion refreshes at 1/4 second intervals\n\n //Changes the AM/PM text depending on the time\n\t\t\tif (h < 12){\n ampmtxt.attr({text: \"AM\", \"font-size\": 15, fill: outline1 });\n\t\t\t} else {\n ampmtxt.attr({text: \"PM\" , \"font-size\": 15, fill: outline1});\n\t\t\t}\t\n\t\t}", "run() {\n\t\tif(this.element.style.webkitAnimationPlayState !== 'running'){\n\t\t\tthis.element.style.webkitAnimationPlayState = 'running';\n\t\t\tthis.startTime = (new Date()).getTime();\n\t\t}\n\t}", "function animateFrame()\n{\n // Update the current camera and scene\n if (currentCamera !== undefined) currentCamera.updateProjectionMatrix();\n if (currentScene !== undefined) currentScene.traverse(runScripts);\n\n // Update previous mouse state here because animateFrame\n // out of sync with mouse listeners (onMouseMove, onMouseWheel)\n mousePrevX = mouseX;\n mousePrevY = mouseY;\n mousePrevScroll = mouseScroll;\n\n var t = getElapsedTime();\n frameDuration = t - frameStartTime;\n frameStartTime = t;\n frameNum++;\n}", "function CalculateTime(){\n now = Date.now();\n deltaTime = (now - lastUpdate) / 1000;\n lastUpdate = now;\n}" ]
[ "0.6868393", "0.6667374", "0.64613104", "0.6407692", "0.63257295", "0.63257295", "0.63257295", "0.63257295", "0.63257295", "0.6235029", "0.6197615", "0.6124715", "0.60761446", "0.60631233", "0.60245687", "0.60226065", "0.6019981", "0.59993863", "0.59953475", "0.5978372", "0.5969672", "0.5957546", "0.5942468", "0.5928945", "0.5926651", "0.58858985", "0.5878139", "0.58727187", "0.586837", "0.5849907", "0.5847868", "0.58468616", "0.584597", "0.5837576", "0.58231264", "0.58231264", "0.58227414", "0.58156043", "0.5815073", "0.58149827", "0.5813085", "0.58052295", "0.5803031", "0.57981336", "0.5797587", "0.5791538", "0.5790412", "0.5778125", "0.577039", "0.57660574", "0.5759145", "0.5746715", "0.5721054", "0.5721054", "0.5719365", "0.570936", "0.5706015", "0.57052916", "0.57045436", "0.57035935", "0.5693167", "0.5691826", "0.5688196", "0.5681255", "0.5678431", "0.5678201", "0.5674347", "0.56730366", "0.566215", "0.5656973", "0.56564516", "0.5656182", "0.5643587", "0.5641517", "0.56312233", "0.56289816", "0.562591", "0.5622577", "0.5622155", "0.5616928", "0.5613514", "0.5606117", "0.56042", "0.56026155", "0.55989426", "0.55963486", "0.5590369", "0.55868953", "0.5584368", "0.55835813", "0.55832714", "0.5581986", "0.5578758", "0.5577842", "0.5569334", "0.5565248", "0.5554923", "0.5554606", "0.55536395", "0.5552539" ]
0.59194434
25
changing animation frames every 55 milliseconds
animate(){ if (this.timeFromLast > this.animationTime){ this.currentFrameNum++; this.currentFrameX += this.frameWidth; this.timeFromLast = 0; this.timeUntilLast = millis(); } //change to stationary after hadouken is used if (this.state === "hadouken" && this.currentFrameNum > this.maxFrame) this.stationaryState(); //resetting the animation after the ninth frame if (this.currentFrameNum > this.maxFrame){ this.currentFrameX = 0; this.currentFrameNum = 0; //changed to stationary if the user has let go of a movement key if (this.willStop === true) this.stationaryState(); this.timeFromLast = 0; this.timeUntilLast = millis(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.currentFrameX = 22;\n }\n \n }", "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "animate(framesCounter) {\n\n if (framesCounter % 8 == 0) {\n this.fireImage.framesIndex++;\n }\n \n if (this.fireImage.framesIndex > this.fireImage.frames - 1) {\n this.fireImage.framesIndex = 0;\n\n }\n }", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime; \n rotAngle= (rotAngle+1.0) % 360;\n }\n var elapsed=timeNow-lastTime;\n lastTime = timeNow;\n \n //when framecount is less than 120, the effect is just rotation\n //when framecount is between 120 to 240, the effect is shaking from left to right\n //when framecount is between 240 to 360, the effect is enlarging from left to right\n //when framecount is between 360 to 480, the effect is shaking hands\n //when framecount is between 480 to 600, the effect is enlargeing from top to bottom\n //then repeat\n days=days+0.01;\n if(framecount>=120 && framecount <240){\n updateBuffers();\n \n } \n if(framecount>=240 && framecount <360) {\n updateBuffers1();\n updatecolor();\n\n }\n if(framecount>=360 && framecount <480){\n updateBuffers2();\n }\n if (framecount >=480 && framecount < 600) {\n \n updateBuffers3();\n updatecolor();\n \n }\n \n \n \n}", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "function animationLoop(timeStamp){\n //7. Clears everything in canvas\n ctx.clearRect(0,0,canvas.width,canvas.height);\n drawBackground();\n walkingAnimation();\n changePositionX();\n changePositionY();\n changeTime();\n changeJump();\n //1-. Cal this function again (Repeat from step 6)\n requestId = requestAnimationFrame(animationLoop);\n\n // 9. Move Image\n}", "animate() {\n if (this.animationFrames.length > 1) {\n this.animationTimer += 1;\n const quotient = Math.floor(this.animationTimer / this.animationFrameDuration)\n const frame = quotient % this.animationFrames.length;\n this.srcImage = this.animationFrames[frame];\n if (this.animationTimer === this.animationFrameDuration * this.animationFrames.length) {\n this.animationTimer = 0;\n }\n }\n }", "function anim() {\r\n Loop();\r\n requestAnimFrame(anim);\r\n }", "function startAnimation() {\n timerId = setInterval(updateAnimation, 16);\n }", "function changeFrames() {\n enemies.map(enemy => enemy.frame = (++enemy.frame) % numberOfFrames);\n }", "startAnimating(fps){\n this.fpsInterval = 1000 / fps;\n this.then = Date.now();\n this.animate();\n }", "function animate_ff() {\n console.log(\"1\");\n document.animation.src = images[frame].src;\n //$('#animation').attr('src', images[frame].src);\n frame = (frame + 1) % MAX_FRAMES;\n if (frame == 0) {\n if (timeout_id) clearTimeout(timeout_id);\n timeout_id = setTimeout(\"animate_ff()\", 3000);\n }\n else {\n if (timeout_id) clearTimeout(timeout_id);\n timeout_id = setTimeout(\"animate_ff()\", 150);\n }\n }", "slideLoop() {\n\t\tthis.animation = setTimeout( () => {\n\t\t\tif (this.i < this.indexSlide) {\n \tthis.i++;\n }\n else {\n \tthis.i = 0;\n };\n this.changeSlide();\n this.slideLoop();\n this.launchprogressbar();\n }, this.timeout); // toutes les 5 secondes\n }", "function animateN(n) {\n var cur_frame = 0\n function animate() {\n if (cur_frame < n) {\n Runner.tick(runner, engine, 10)\n cur_frame += 1\n setTimeout(animate, 10)\n } else {\n }\n }\n animate()\n}", "function updateAnimationFrames() {\n\tdragon1 = document.getElementById('dragon1');\n\tdragon2 = document.getElementById('dragon2');\n\tdragon1.innerHTML = \"<img src='img/d1\" + state1 + x + \".svg'/>\";\n\tdragon2.innerHTML = \"<img src='img/d2\" + state2 + x + \".svg'/>\";\n\tif (r == false && x < 9) {\n\t\tx++;\n\t}\n\tif (r == true && x >= 0) {\n\t\tx--;\n\t}\n\tif (x == 9 ) {\n\t\tr = true;\n\t}\n\tif (x == 0) {\n\t\tr = false;\n\t}\n}", "function start(){\n\tsetInterval(animationLoop, 33);\n}", "_frame () {\n this._drawFrame()\n if (!this.paused) {\n if (this.frameCount % 4 === 0) {\n this._updateGeneration()\n this.matrix = this.nextMatrix\n this.nextMatrix = this._createMatrix()\n this.counter.innerText = 'Generation: ' + this.generationNumber\n }\n }\n this.frameCount++\n requestAnimationFrame(this._frame)\n }", "nextFrame(){\n this.currentFrame++;\n \n if(this.currentFrame >= 5){\n this.currentFrame = 0;\n }\n \n this.setFrame(this.currentFrame);\n }", "animate() {\n if (this.tick % 10 != 0)\n return;\n this.tick = 0;\n if (this.index < this.images.length - 1) \n this.index += 1;\n else\n this.index = 0;\n }", "function startAnimation() {\n var lastFrame = +new Date;\n function loop(now) {\n animationID = requestAnimationFrame(loop);\n var deltaT = now - lastFrame;\n // Do not render frame when deltaT is too high\n if (Math.abs(deltaT) < 160) {\n renderFrame(deltaT);\n }\n lastFrame = now;\n }\n loop(lastFrame);\n}", "set interval(interval) {\n this.interval_ = interval < 17 ? 17 : interval; // 17 ~ 60fps\n }", "animate() {\n clearTimeout(this.timeout);\n\n this.drawCurrentFrame();\n\n if (this.props.play && (this.props.frame + 1) < this.props.replay.turns.length) {\n this.props.incrementFrame();\n\n // if playing, render again\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => requestAnimationFrame(this.animate), TICK_SPEED);\n }\n }", "function playSequence(computerTurn)\r\n{\r\n computerTurn.forEach((color,index)=>{\r\n setTimeout(() => {\r\n animate(color);\r\n }, (index+1)*600);\r\n });\r\n}", "function animate() {\n\t//get the horizontal offset from the array\n\tvar h_offset = fr_num * (63);\n\tvar v_offset = direction * (63);\n\t//get the image and reslice it\n\timg_element.style.backgroundPosition = `-${h_offset}px -${v_offset}px`; \n\t//update frame counter, 0->1->2->3->0->...\n\tfr_num = ++fr_num % 4;\n}", "function runAnimation(frameFunc){\n let lastTime = null;\n function frame(time){\n if(lastTime!=null){\n let timeStep = Math.min(time - lastTime,100)/1000;\n if(frameFunc(timeStep)==false)return;\n }\n lastTime = time;\n requestAnimationFrame(frame);\n }\n requestAnimationFrame(frame);\n }", "function animationLoop(gl, Date, startTime, setTimeout) {\n setTimeout(animationLoop, 16, gl, Date, startTime, setTimeout);\n currentTime = (new Date()).getTime() * 0.001; // calculate current time for frame\n currentTime -= startTime;\n enterFrameHandler && enterFrameHandler(); // Call onEnterFrame callback if running application has defined one\n gl.clear(gl.COLOR_BUFFER_BIT); // Clear drawing surface with backgroundColor (glColor)\n screen.__draw(gl, gl.mvMatrix); // Start scene-graph render walk\n \n \n //framerate.snapshot();\n }", "#startHeaderAnimation() {\n this.intervalId = setInterval(() => {\n this.timeTickCounter++;\n if (this.timeTickCounter <= Object.keys(this.headerAnimation.frames).length) {\n this.pixels.togglePixels(this.headerAnimation.frames[this.timeTickCounter], 'snake1');\n }\n }, this.timeTick);\n }", "function step(startTime) {\n\n// console.log(\"working\");\n // 'startTime' is provided by requestAnimationName function, and we can consider it as current time\n // first of all we calculate how much time has passed from the last time when frame was update\n if (!timeWhenLastUpdate) timeWhenLastUpdate = startTime;\n timeFromLastUpdate = startTime - timeWhenLastUpdate;\n\n // then we check if it is time to update the frame\n if (timeFromLastUpdate > timePerFrame) {\n // and update it accordingly\n $element.attr('src', imagePath + '/cup-' + frameNumber + '.png');\n // $element.attr('src', imagePath + `/cup-${frameNumber}.png`);\n // reset the last update time\n timeWhenLastUpdate = startTime;\n\n // then increase the frame number or reset it if it is the last frame\n if (frameNumber >= totalFrames) {\n frameNumber = 1;\n } else {\n frameNumber = frameNumber + 1;\n }\n }\n\n requestAnimationFrame(step);\n}", "_incrementFrame() {\n this._elapsedFrameCount += 1;\n }", "function updateAnimation(anim) {\r\n\t\t\tif (Date.now() - anim.frameTimer > anim.frameDuration) {\r\n\t\t\t\tif (anim.currentFrame < anim.frames.length - 1) anim.currentFrame ++;\r\n\t\t\t\telse anim.currentFrame = 0;\r\n\t\t\t\tanim.frameTimer = Date.now();\r\n\t\t\t}\r\n\t\t}", "function girb_interval(){\n\t\t//\n\t\tclearInterval(girb_int);\n\t\t//\n\t\tif(Math.random()*100 > 50){\n\t\t\tmove_girb();\n\t\t}else{\n\t\t\treset_interval();\n\t\t\tset_animation(return_randImg(arr_img_idle));\n\t\t}\n\t}", "function animate(timestamp) {\n oneStep();\n animationId = requestAnimationFrame(animate);\n}", "grow() {\n this.r = sin(frameCount * .01) * 100;\n }", "playSpinningAnimations() {\n this.reels.forEach((reel, i) => {\n reel.play(`reel${i + 1}Animation`);\n });\n }", "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "function startAnimation () {\n on = true; // Animation angeschaltet\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\n t0 = new Date(); // Neuer Anfangszeitpunkt \n }", "update( time ) {\r\n let animation = this.animationList[this.current];\r\n if( !animation ) return;\r\n this.progress += time * animation.fps;\r\n while( this.progress >= 1.0 ) {\r\n this.progress -= 1.0;\r\n this.frame++;\r\n if( this.frame >= animation.startFrame + animation.numFrames ) {\r\n this.frame = animation.startFrame;\r\n }\r\n }\r\n }", "function updateAnimation(anim) {\n if (Date.now() - anim.frameTimer > anim.frameDuration) {\n if (anim.currentFrame < anim.frames.length - 1) anim.currentFrame ++;\n else anim.currentFrame = 0;\n anim.frameTimer = Date.now();\n }\n}", "function animloop(){\n\tdraw();\n\trequestAnimFrame(animloop);\n}", "function animateFrames2(id,fps,reps,direction) {\n\n //Get all children of the frame-container\n var children = $(\"#\"+id).children();\n\n //Get the number of max. frames, count starts at 0!\n var max_frame = children.length;\n console.log(\"max frames: \"+max_frame);\n\n //Calculate duration per frame\n var duration = 1000/fps;\n\n //Just iterating the child array downwards\n if(direction===\"reverse\"){\n //Counter\n var frame = max_frame -1;\n //Set interval with defined fps\n var pid = setInterval(function () {\n //decrement frame\n frame--;\n //check if last frame was reached\n if (frame === -1) {\n //Start again at first frame\n if (reps === \"infinite\") {\n frame = max_frame -1; //already decremented!\n } else {\n //for now: Stop animation after one cycle\n clearInterval(pid);\n //save last shown frame in hash map\n threadHashMap[\"_\"+pid] = max_frame;\n return;\n }\n }\n\n //Hide last frame\n if (frame < max_frame -1 ) {\n children.eq(frame + 1).css(\"display\", \"none\");\n } else {\n //in case of a anterior cycle the first frame has to be hidden (no effect if first cycle)\n children.eq(0).css(\"display\", \"none\");\n }\n //Show current frame\n children.eq(frame).css(\"display\", \"block\");\n //save last shown frame in hash\n threadHashMap[\"_\"+pid] = frame;\n }, duration);\n }else {\n\n /* TODO WATCH OUT: HERE THE first frame is still pulled! fix ;)*/\n //Counter\n var frame = 0;\n\n //Set interval with defined fps\n var pid = setInterval(function () {\n\n //increment frame\n frame++;\n\n //check if last frame is reached\n if (frame >= max_frame) {\n //Start again at first frame\n if (reps === \"infinite\") {\n frame = 1; //already incremented!\n } else {\n //save last shown frame in hash\n threadHashMap[\"_\"+pid] = 1; // TODO should be 0 ...\n //for now: Stop animation after one cycle\n clearInterval(pid);\n return;\n }\n }\n\n //Hide last frame\n if (frame > 1) {\n children.eq(frame - 1).css(\"display\", \"none\");\n } else {\n //in case of a anterior cycle the last frame has to be hidden (no effect if first cycle)\n children.eq(max_frame - 1).css(\"display\", \"none\");\n }\n //Show current frame\n children.eq(frame).css(\"display\", \"block\");\n //save last shown frame in hash\n threadHashMap[\"_\"+pid] = frame;\n\n }, duration);\n }\n //Storing the pid of the last started frame thread thread under 'special' key '_0' in hash <_0,pid>, all other entries _n are <pid,frame>\n threadStack.push(pid);\n console.log(\"hash: \"+threadHashMap._0);\n console.log(\"hash-length-control: \"+ Object.keys(threadHashMap).length);\n}", "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n animate();\n }", "function loop() {\n draw();\n requestAnimFrame(loop);\n}", "function tick() {\r\n requestAnimFrame(tick);\r\n draw();\r\n animate();\r\n}", "function startAnimation () {\r\n on = true; // Animation angeschaltet\r\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\r\n t0 = new Date(); // Neuer Bezugszeitpunkt \r\n }", "function frame() {\n\n frameCount++;\n increment = 22 - frameCount; // move faster every frame\n\n if (increment < 2) increment = 2;\n\n deltaX += increment;\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n if (deltaX >= 100) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n\n // end animation\n if (deltaX >= 215) {\n clearInterval(animation);\n menuToggleBar.style.width = (220 - 40) + 'px';\n menu.style.right = 0 + 'px';\n deltaX = 220;\n isMenuAnimating = false;\n\n }\n }", "function init() {\n //little man animation\n\n setInterval(update, 5000); // <------\n}", "walk(framesCounter) {\n this.ctx.drawImage(\n this.imageInstance,\n this.imageInstance.framesIndex * Math.floor(this.imageInstance.width / this.imageInstance.frames),\n 0,\n Math.floor(this.imageInstance.width / this.imageInstance.frames),\n this.imageInstance.height,\n this.shinobiPos.x,\n this.shinobiPos.y,\n this.shinobiSize.w,\n this.shinobiSize.h\n )\n this.animateSprite(framesCounter)\n }", "play() {\n this.frame = window.requestAnimationFrame(()=>this.firstFrame());\n }", "function startAnimating() {\n fpsInterval = 1000 / fps;\n then = Date.now();\n startTime = then;\n animate();\n}", "function animloop() \n{\n\tdraw();\n\trequestAnimFrame(animloop);\n}", "function megamanRunLoop(){\n if (frameCount % 15 === 0) {// every 15 frames\n animationFrameCounter += 1;\n }\n if (animationFrameCounter >= 4){//resets the counter every 4 cycles\n animationFrameCounter = 0;\n }\n if (megamanDirection === 1){// if facing right\n //draw the next right-facing image in the animation\n image(rightRunLoop[animationFrameCounter], megamanXPos, megamanYPos, megamanWidth, megamanHeight);\n }\n else{//If facing left\n //draw the next left-facing image in the animation\n image(leftRunLoop[animationFrameCounter], megamanXPos, megamanYPos, megamanWidth, megamanHeight);\n }\n \n }", "function playAnimWithInterval() {\n let animTag = document.getElementById(\"animTag\");\n let animationLength = animArray.length;\n let animPlayCounter = 0;\n playAnimationInterval = setInterval(() => {\n if (animationLength > 0 && animPlayCounter < animationLength) {\n animTag.innerHTML = animArray[animPlayCounter];\n animPlayCounter++;\n } else {\n animPlayCounter = 0;\n }\n }, 200);\n }", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "function animationLoop() {\n for(let i=0; i<10; i++){\n selectSegments(10).segments[i].style.animation = `moveToUp 5s ease .0${i}s infinite`;\n selectSegments(10).secondSegments[i].style.animation = `moveToDown 5s ease .0${i}s infinite`;\n \n \n }\n for(let i=10; i<20; i++){\n selectSegments(20).segments[i].style.animation = `moveToUp 5s ease .${i}s infinite`;\n selectSegments(20).secondSegments[i].style.animation = `moveToDown 5s ease .${i}s infinite`;\n \n }\n}", "function tick() {\n requestAnimFrame(tick);\n draw();\n animate();\n}", "function runAnimation() {\n\t // Draw a straight line\n\t bsBackground.draw({\n\t points: [0, height / 2 - 40, width, height / 3]\n\t });\n\n\t // Draw a straight line\n\t bsBackground.draw({\n\t points: [50, height / 3 - 40, width, height / 3]\n\t });\n\n\n\t // Draw another straight line\n\t bsBackground.draw({\n\t points: [width, height / 2, 0, height / 1.5 - 40]\n\t });\n\n\t // Draw a curve generated using 20 random points\n\t bsBackground.draw({\n\t inkAmount: 3,\n\t frames: 100,\n\t size: 200,\n\t splashing: true,\n\t points: 20\n\t });\n\t}", "function newRound() {\n //Animate color pattern for computer sequence\n\n playPattern();\n update();\n}", "illuminateSequence(){\r\n for (let i = 0; i < this.level; i++) {\r\n const color=this.numberToColor(this.sequence[i])\r\n setTimeout(()=>this.illuminateColor(color),1000*i)\r\n }\r\n}", "hadouken(){\n this.state = \"hadouken\";\n this.animationTime = 55;\n this.currentFrameNum = 0;\n this.willStop = false;\n this.currentFrameX = 0;\n this.currentFrameY = 2348;\n this.frameHeight = 109;\n this.frameWidth = 125;\n this.maxFrame = 8;\n hadouken1.startTime = millis();\n }", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "onAnimFrame() {\n const now = Date.now();\n const delta = now - this.previousFrameTime;\n const interval = 1000 / this.props.fps;\n\n this.requestId = window.requestAnimationFrame(this.onAnimFrame);\n\n if (delta > interval) {\n this.previousFrameTime = now - (delta % interval);\n this.drawCurrentFrame();\n\n // Clamp playback between start & end frame range, looping\n // whenever we run past the end frame.\n if (this.frame < this.startFrame || this.frame > this.endFrame) {\n this.frame = this.startFrame;\n }\n }\n }", "function animationLoop(){\n // Clear screen for re-draw\n context.fillStyle = backgroundColor;\n context.fillRect(0,0,canvas[0].width,canvas[0].height);\n // ** UPDATE AND RENDER ** //\n\n // prepare for next frame\n if(!visualization.meta.isActive){\n return;\n }\n Utility.setDelta();\n window.requestAnimationFrame(animationLoop);\n }", "function step() {\r\n\t\tvar j;\r\n\t\tif(timeout_id) {\r\n\t\t clearTimeout(timeout_id);\r\n\t\t timeout_id = null;\r\n\t\t}\r\n\t\tframe = (frame + dir + imageSum) % imageSum;\r\n\t\tj = frame + 1;\r\n\t\t\r\n\t\tif(images[frame].complete) {\r\n\t\t $('div#animation').html('<img src=\"'+images[frame].src+'\" />');\r\n\t\t $('.label #playlabel').html('step: ');\r\n\t\t $('.label #playstatus').html(j+' of '+imageSum);\r\n\t\t \r\n\t\t if(swingon && (j == imageSum || frame == 0)) {\r\n\t\t\treverse();\r\n\t\t }\r\n\t\t \r\n\t\t playing = 0;\r\n\t\t}\r\n\t }", "updateAnimation() {\n if (this.isMoving()) {\n if (this.dirX == -1)\n this.animator.changeFrameSet(this.frameSets[\"swim-left\"],\n \"loop\", 5);\n else\n this.animator.changeFrameSet(this.frameSets[\"swim-right\"],\n \"loop\", 5);\n } else {\n if (this.dirX == -1)\n this.animator.changeFrameSet(this.frameSets[\"idle-left\"],\n \"pause\");\n else\n this.animator.changeFrameSet(this.frameSets[\"idle-right\"],\n \"pause\");\n }\n \n this.animator.animate();\n }", "function animateFrame()\n{\n // Update the current camera and scene\n if (currentCamera !== undefined) currentCamera.updateProjectionMatrix();\n if (currentScene !== undefined) currentScene.traverse(runScripts);\n\n // Update previous mouse state here because animateFrame\n // out of sync with mouse listeners (onMouseMove, onMouseWheel)\n mousePrevX = mouseX;\n mousePrevY = mouseY;\n mousePrevScroll = mouseScroll;\n\n var t = getElapsedTime();\n frameDuration = t - frameStartTime;\n frameStartTime = t;\n frameNum++;\n}", "function myLoop() {\n setTimeout(function () {\n if (actionButton) {\n // // $(actionButton).css('opacity', '');\n // // $(actionButton).css('animation-play-state', 'paused');\n $(actionButton).removeClass('lightsOn');\n }\n actionButton = '#simonActionBtn' + (sequence[index]);\n // $(actionButton).css('animation-play-state', 'running');\n // $(actionButton).css('animation', '');\n $(actionButton).addClass('lightsOn');\n console.log('Sequence', index, sequence[index], actionButton);\n playSound(sequence[index]);\n index++;\n // TODO: I use an extra 'lap' to return opacity to standard value\n // after all values have been displayed. There's gotta be a more\n // elegant solution to this.\n if (index <= sequence.length) {\n\n myLoop();\n }\n }, 900);\n }", "updateSprite(timer) {\n timer % this.animTime === 0 ? this.currentFrame++ : null\n this.currentFrame === this.numberOfFrames ? this.currentFrame = 0 : null\n }", "function animateButtons() {\n for (var i = 0; i < game.sequence.length; i++) {\n delayedAnimation(game.sequence[i], i * game.delayBetweenAnimations);\n console.log('here', game.sequence);\n }\n}", "function runAnimay(){\n ropAnimation();\n headAnimation();\n bodyAnimation();\n larmAnimation();\n rarmAnimation();\n llegAnimation();\n rlegAnimation();\n}", "function animloop() {\n\tinit = requestAnimFrame(animloop);\n\tdraw();\n}", "function loop0() {\r\n\r\n\t $('.superhero').animate({\r\n\t \t'right': 100+'%',\r\n\t \t'top': 25+'%'\r\n\t // Animation time in seconds\r\n\t }, 30000, function() {\r\n \t\t\t$(this).animate({\r\n\t\t\t\t'right': 15+'%',\r\n\t\t\t\t'top': '-'+width0\r\n \t\t\t}, 0, 'linear', function() {\r\n \t\t\t\tloop0();\r\n \t\t\t}, 0);\r\n \t\t});\r\n\t}", "function gameSlow() {\n setInterval(oneFrame, 300);\n setInterval(buff6s, 12000);\n}", "function Animate(currentTimeInMs) {\n\n //update all sprites whose state can change over time\n Update(currentTimeInMs);\n\n //draw all sprite\n Draw(currentTimeInMs);\n\n //request the next frame to repeat the update/draw cycle\n window.requestAnimationFrame(Animate);\n}", "function updateFrame() {\n // TODO: INSERT CODE TO UPDATE ANY OTHER DATA USED IN DRAWING A FRAME\n y += 0.3;\n if (y > 60) {\n y = -50;\n }\n frameNumber++;\n}", "updateFrame() {\n let newFrameIndex;\n if(this.isInReverse) {\n newFrameIndex = this.currFrame - 1;\n if(newFrameIndex < 0) {\n if (this.loops) {\n this.isInReverse = false;\n newFrameIndex = this.currFrame + 1;\n } else {\n this.isAnimating = false;\n this.isFinished = true;\n newFrameIndex = 0;\n } \n } \n } else {\n newFrameIndex = this.currFrame + 1;\n if(newFrameIndex >= this.frames.length) {\n if(this.reverses) {\n newFrameIndex = this.currFrame - 1;\n this.isInReverse = true;\n } else if(this.loops) {\n newFrameIndex = 0;\n } else if (this.holds) { \n newFrameIndex = this.frames.length - 1;\n } else {\n this.isAnimating = false;\n this.isFinished = true;\n newFrameIndex = 0;\n }\n }\n }\n\n this.currFrame = newFrameIndex;\n }", "animate_start(frame) {\r\n this.sprite.animate = true;\r\n }", "runAnimation() {\n const animate = () => {\n const duration = this.getAnimationDuration();\n setStyle(this.slider, 'transform', 'translateX(0%)');\n setStyle(this.slider, 'transition', `transform ${duration}ms linear`);\n setStyle(this.slider, 'transform', 'translateX(-100%)');\n\n this.animationTimer = setTimeout(() => {\n this.stopAnimation();\n requestAnimationFrame(() => animate());\n }, duration / 2);\n };\n\n animate();\n }", "function animate(){\n\t\trunProgram();\n\t\t t=setTimeout(function(){animate();}, 90);\n\t\t\n\t}", "function playAnimation(sequenceArray) {\n\n //Reset any possible previous animations\n reset();\n\n //Figure out how many frames there are in the range\n if (!sequenceArray) {\n startFrame = 0;\n endFrame = sprite.totalFrames - 1;\n } else {\n startFrame = sequenceArray[0];\n endFrame = sequenceArray[1];\n }\n\n //Calculate the number of frames\n numberOfFrames = endFrame - startFrame;\n\n //Compensate for two edge cases:\n //1. If the `startFrame` happens to be `0`\n /*\n if (startFrame === 0) {\n numberOfFrames += 1;\n frameCounter += 1;\n }\n */\n\n //2. If only a two-frame sequence was provided\n /*\n if(numberOfFrames === 1) {\n numberOfFrames = 2;\n frameCounter += 1;\n } \n */\n\n //Calculate the frame rate. Set the default fps to 12\n if (!sprite.fps) sprite.fps = 12;\n let frameRate = 1000 / sprite.fps;\n\n //Set the sprite to the starting frame\n sprite.gotoAndStop(startFrame);\n\n //Set the `frameCounter` to the first frame \n frameCounter = 1;\n\n //If the state isn't already `playing`, start it\n if (!sprite.animating) {\n timerInterval = setInterval(advanceFrame.bind(this), frameRate);\n sprite.animating = true;\n }\n }", "function tick() {\r\n\trequestAnimFrame(tick);\r\n\tdraw();\r\n\tanimate();\r\n}", "function animate()\n{\n frameCount++;\n // movement update\n update();\n // render update\n render();\n // trigger next frame\n requestAnimationFrame(animate);\n}", "function animate() {\n // request another frame\n requestAnimationFrame(animate);\n\n // calc elapsed time since last loop\n now = Date.now();\n elapsed = now - then;\n\n // if enough time has elapsed, draw the next frame\n if (elapsed > fpsInterval) {\n then = now - (elapsed % fpsInterval);\n\n // Put your drawing code here\n buildBoard();\n headSnake();\n drawPlayer();\n //checkPoint();\n drawPoints();\n }\n}", "function animateFrames(id,fps,reps) {\n //Get the number of max. frames, count starts at 1\n var max_frame=1;\n while ($(\"#\"+id+max_frame).length > 0){\n max_frame++;\n }\n max_frame--;\n //Calculate duration per frame\n var duration = (60/fps)*1000;\n var frame = 1;\n\n //not very intuitive: anonymous function and function vars have the same scope -> see frame-var\n var interval = setInterval(function() {\n if(frame > max_frame) {\n //Start with first frame\n if (reps === \"infinite\") {\n frame = 1;\n }else{\n //Stop with animation after one cycle\n clearInterval(interval);\n return;\n }\n }\n setFrame(id,frame++,max_frame);\n }, duration);\n}", "function animloop() {\n init = requestAnimFrame(animloop);\n draw();\n}", "function play() {\n let i = 0;\n let interval = setInterval(function() {\n playColor(gameArr[i]);\n i++;\n if (i >= gameArr.length) {\n clearInterval(interval);\n }\n }, 500);\n}", "function animateBoyWalk() {\n if (boyWalkFrame > 10) boyWalkFrame = 1;\n\n var fileName = boywalk + \"frame\" + boyWalkFrame + \".gif\";\n\n boyImage.src = fileName;\n ctx.drawImage(boyImage, boy.x, boy.y, boy.height, boy.width);\n\n //console.log(fileName);\n boyWalkFrame++;\n\n //requestAnimationFrame(animateBoyWalk, 100);\n}", "function frame1()\n\t{\n\n\t\tTweenLite.to(over, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(eight, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.1, ease: Expo.easeOut});\t\t\n\t\tTweenLite.to(million, 0.3, {opacity:1, scaleX:1, scaleY:1, delay: 0.2, ease: Expo.easeOut});\t\t\n\n\t\tTweenLite.delayedCall(0.8, frame2);\n\t}", "function advanceFrame() {\n\n //Advance the frame if `frameCounter` is less than \n //the state's total frames\n if (frameCounter < numberOfFrames + 1) {\n\n //Advance the frame\n sprite.gotoAndStop(sprite.currentFrame + 1);\n\n //Update the frame counter\n frameCounter += 1;\n\n //If we've reached the last frame and `loop`\n //is `true`, then start from the first frame again\n } else {\n if (sprite.loop) {\n sprite.gotoAndStop(startFrame);\n frameCounter = 1;\n }\n }\n }", "function animate(nowMs) {\n\t// update\n\t//var time = (new Date()).getTime();\n\t//var timeDiff = time - lastTime;\n\t//var angleChange = angularSpeed * timeDiff * 2 * Math.PI / 1000;\n\t//plane.rotation.z += angleChange;\n\t//lastTime = time\n\t\n\tlastTimeMs = lastTimeMs || nowMs-1000/60;\n\tvar deltaMs = Math.min(200, nowMs - lastTimeMs);\n\tlastTimeMs = nowMs;\n\t\n\tmaster.forEach(function(gear) {\n\t\tgear(deltaMs/1000, nowMs/1000);\n\t});\n\n\t// request new frame\n\trequestAnimationFrame(animate);\n}", "function nextFrame() {\n _timeController.proposeNextFrame();\n }", "function updateAnimation() {\n drawCanvas();\n puckCollision();\n if (goalScored()) {\n resetPuck();\n resetStrikers();\n }\n moveCPUStriker();\n seconds = seconds - (16 / 1000);\n // as long as there is time remaining, don't stop\n if (seconds > 0) {\n document.getElementById(\"time\").innerHTML = Math.round(seconds, 2);\n } else {\n // if less than 3 periods have elapsed, do the following\n if (periodNum < 3) {\n nextPeriod();\n } else {\n stopAnimation();\n }\n }\n }", "function loop(){\r\n update(); \r\n draw();\r\n frames++;\r\n requestAnimationFrame(loop);\r\n}", "function frame() {\n rAF = requestAnimationFrame(frame);\n\n now = performance.now();\n dt = now - last;\n last = now;\n\n // prevent updating the game with a very large dt if the game were to lose focus\n // and then regain focus later\n if (dt > 1E3) {\n return;\n }\n\n emit('tick');\n accumulator += dt;\n\n while (accumulator >= delta) {\n loop.update(step);\n\n accumulator -= delta;\n }\n\n clearFn(context);\n loop.render();\n }", "async function myAnimantion() {\n clearInterval(timerId);\n const resp = await fetch(\"http://mumstudents.org/api/animation\", {\n method: \"GET\",\n headers: { \"Authorization\": `Bearer ${token}` }\n })\n const respBody = await resp.text();\n //console.log(respBody);\n frame = respBody.split('=====\\n');\n //console.log(frame);\n\n let count = 0;\n timerId = setInterval(function () {\n document.getElementById(\"animation\").innerHTML = frame[count];\n count++;\n if (count === frame.length) {\n count = 0;\n }\n }, 200);\n }", "function animate() {\n window.requestAnimationFrame(function (now) {\n rotationDif = (now - lastFrame) * .001;\n settings.rotate += rotationDif * 2 * Math.PI * rotationSpeed;\n app.draw(settings);\n lastFrame = now;\n animate();\n });\n }", "function frame() {\n\n frameCount++;\n deltaX += -frameCount; // move faster every frame\n\n menu.style.right = -(220 - deltaX) + 'px';\n\n // move top nav bar if needed\n if (deltaX >= 110) {\n menuToggleBar.style.width = (deltaX - 40) + 'px';\n }\n // end menu bar animation\n else if (deltaX > 90 && deltaX < 110) {\n menuToggleBar.style.width = 60 + 'px';\n }\n // end slide menu animation\n else if (deltaX <= -5) {\n clearInterval(animation);\n menu.style.right = -220 + 'px';\n deltaX = 0;\n frameCount = 0;\n isMenuAnimating = false;\n }\n }", "addAnimation(anims,timeBetween = 1, loop = true){\n var animArr = []\n for (var i = 0; i < anims.length; i++){\n animArr[i] = new Image(this.width, this.height)\n animArr[i].src = anims[i]\n animArr[i].width = this.width\n animArr[i].height = this.height\n }\n\n this.animIndex = 0\n this.animsArray[this.numberOfAnimations] = animArr\n this.numberOfAnimations++;\n if (this.animsArray.length === 1){\n this.anims = animArr;\n this.timeBetweenAnim = timeBetween\n setInterval(function(){\n this.image = this.anims[this.animIndex];\n this.animIndex++;\n if (this.animIndex >=this.anims.length){\n this.animIndex =0\n }\n }.bind(this), this.timeBetweenAnim)\n }\n }", "function frame() {\n if (width >= 100) {\n clearInterval(id);\n i = 0;\n move2();\n } else {\n width = width + 5.8;\n elem.style.width = width + \"%\";\n }\n }", "function introAnimation () {\n let x = 0\n let flash = setInterval(() => {\n flashButtons()\n x++\n if (x >= 3) {\n clearInterval(flash)\n }\n }, 500)\n}" ]
[ "0.7329447", "0.7280513", "0.70089525", "0.6969101", "0.69429106", "0.68552095", "0.68387365", "0.682925", "0.6801606", "0.67762524", "0.67652965", "0.67377716", "0.6661474", "0.66526407", "0.6652522", "0.66121095", "0.6601998", "0.65852386", "0.6569535", "0.6539542", "0.65383196", "0.6530025", "0.6500086", "0.6498786", "0.6492626", "0.64886403", "0.648016", "0.6467595", "0.6458675", "0.6452222", "0.6444046", "0.6406954", "0.6405965", "0.63937056", "0.6392375", "0.6392375", "0.6392375", "0.6376167", "0.63493925", "0.6345513", "0.6343568", "0.63123286", "0.63123095", "0.6306746", "0.6294472", "0.629215", "0.62911105", "0.6285837", "0.6281658", "0.62816334", "0.62733793", "0.6272266", "0.6272177", "0.62696403", "0.6264999", "0.625345", "0.6246462", "0.62403244", "0.62360847", "0.62340915", "0.6225776", "0.62192005", "0.6214715", "0.62140113", "0.62117124", "0.6205284", "0.6199414", "0.61933213", "0.6189495", "0.61886984", "0.6188395", "0.6182581", "0.61824024", "0.61761504", "0.61681044", "0.61660856", "0.6155249", "0.61542445", "0.6153555", "0.6150395", "0.6144323", "0.61435324", "0.61405647", "0.6137228", "0.61363274", "0.6135041", "0.6132517", "0.61295986", "0.6128911", "0.6128355", "0.6127455", "0.6125413", "0.6116961", "0.6114279", "0.61093044", "0.61045563", "0.6104533", "0.6097531", "0.60927993", "0.60847753" ]
0.6775994
10
moving the character based on its state
move(){ this.charY = windowHeight - 200; if (this.state === "right") this.charX += 4; if (this.state === "left") this.charX -= 4; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move(){\n switch(this.direction){\n case \"n\":\n this.col-=1;\n this.direction=\"n\";\n break;\n case \"e\":\n this.row += 1;\n this.direction=\"e\"; \n break;\n case \"s\":\n this.col+=1;\n this.direction = \"s\";\n break;\n case \"w\":\n this. row -=1;\n this.direction=\"w\";\n }\n }", "function moveCharacter(characterWrap){\n\t\t\tvar sizeY = characterWrap.outerHeight() / 2;\n\t\t\tvar sizeX = characterWrap.outerWidth() / 2;\n\t\t\tvar character = characterWrap.find('.active');\n\n\t\t\tif(supportTransitions()){\n\t\t\t\tif(character.hasClass('moveRight')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('left', '-' + sizeX + 'px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('left', '0px');\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveLeft')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('left', '0px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('left', '-' + sizeX + 'px');\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveUp')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('top', '0px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('top', '-' + sizeY + 'px');\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveDown')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('top', '-' + sizeY + 'px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('top', '0px');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//jquery fallback \n\t\t\telse{\n\t\t\t\tif(character.hasClass('moveRight')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left': '-' + sizeX + 'px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left': '0px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveLeft')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left': '0px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left' : '-' + sizeX + 'px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveUp')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'top': '0px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'top': '-' + sizeY + 'px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveDown')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'bottom' : sizeY + 'px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'bottom':'0px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharacterWrap.toggleClass('moved');\n\t\t}", "function moveCharacter(char, index) {\n if (game.data.go_back[index]) {\n game.data.go_back[index] = false;\n char.pos.x = game.data.back_x;\n char.pos.y = game.data.back_y;\n game.data.location_x[index] = game.data.back_x;\n game.data.location_y[index] = game.data.back_y;\n return true;\n } else if (game.data.show_menu || game.data.waited[index]) {\n return true;\n } else if (game.data.moving[index] && me.input.keyStatus(\"click\")) {\n\n var x = (Math.floor(me.input.mouse.pos.x / 32));\n var y = (Math.floor(me.input.mouse.pos.y / 32));\n var tot_x = x + char.off_x - char.pos.x/32;\n var tot_y = y + char.off_y - char.pos.y/32;\n\n if (Math.abs(tot_x)+Math.abs(tot_y) <= game.data.movement[index]) {\n\n var x1 = game.data.location_x.slice(0,0);\n var x2 = game.data.location_x.slice(1);\n var y1 = game.data.location_y.slice(0,0);\n var y2 = game.data.location_y.slice(1);\n var x_removed = x1.concat(x2);\n var y_removed = y1.concat(y2);\n if ((x_removed.indexOf(x*32) < 0) || (y_removed.indexOf(y*32) < 0)) {\n game.data.location_x[index] = x*32;\n game.data.location_y[index] = y*32;\n char.pos.x = x*32;\n char.pos.y = y*32;\n char.off_x = tot_x;\n char.off_y = tot_y;\n }\n }\n return true;\n\n } \n\n else if (game.data.update_plz[index]) {\n game.data.update_plz[index] = false;\n return true;\n } \n\n else if (!game.data.moving[index]) {\n char.off_x = 0;\n char.off_y = 0;\n }\n\n return false;\n}", "move() {\n this._offset = (this._offset + 1) % plainAlphabet.length\n }", "function movementChar () {\n player.movement();\n enemy.movement();\n }", "move() {\n let nextStateName = this.currentState.transitions[this.possibleMove];\n\n this.currentState = fa.states[nextStateName];\n\n let nomalizedTransition = this.possibleMove.replace('[', '').replace(']', '').trim().split(',');\n\n let readChar = nomalizedTransition[0].trim();\n let popChar = nomalizedTransition[1].trim();\n let pushChar = nomalizedTransition[2].trim();\n\n if (popChar !== '' && popChar !== 'λ') {\n this.stack.pop();\n }\n\n if (pushChar !== '' && pushChar !== 'λ' && ((pushChar !== '$' && pushChar[pushChar.length - 1] !== '$') || this.stack[this.stack.length - 1] !== '$')) {\n if (pushChar.length < 2) {\n this.stack.push(pushChar);\n } else {\n for (let i = pushChar.length - 1; i >=0; i--) {\n const char = pushChar[i];\n this.stack.push(char);\n }\n }\n }\n\n if (readChar !== '' && readChar !== 'λ') this.currentCharacterIndex++;\n }", "moveCharacter(character, direction) {\n \n var candidateTile;\n var currTileX = character.getCurrentTile().getTileX();\n var currTileY = character.getCurrentTile().getTileY();\n var charState;\n var result = true;\n\n switch (direction) {\n case 'up':\n candidateTile = this.gameBoard[currTileX][currTileY - 1]; \n break;\n case 'left':\n candidateTile = this.gameBoard[currTileX - 1][currTileY]; \n charState = 'idleLeft';\n break;\n case 'down':\n candidateTile = this.gameBoard[currTileX][currTileY + 1]; \n break;\n case 'right':\n candidateTile = this.gameBoard[currTileX + 1][currTileY]; \n charState = 'idleRight';\n break;\n default:\n console.log(\"Debug method: moveCharacter\");\n break;\n }\n\n //If the candidate tile contains the survivor, it cannot be moved into.\n if (this.Survivor.getCurrentTile() == candidateTile) {\n result = false;\n }\n\n //If the candidate tile contains is not passable, it cannot be moved into.\n if (candidateTile.canBePassed() == false) {\n result = false;\n }\n\n //If the candidate tile contains an active, alive zombie, it cannot be moved into.\n for (const z of this.activeZombies) {\n if (z.getCurrentTile() == candidateTile && z.isZombieAlive()) {\n result = false;\n }\n }\n\n //If the tile can be moved into, move the entity and change animation state.\n if (result) {\n character.moveChar(candidateTile);\n\n }\n\n if (charState != null) {\n character.setState(charState);\n }\n return result;\n }", "applyTo(state) {\n let nextState = new State(state)\n\n //put the letter on the board\n nextState.board[this.movePosition] = state.turn\n\n if (state.turn === 'O') nextState.oMovesCount++\n\n nextState.advanceTurn()\n\n return nextState\n }", "function moveLeg(e, distance) {\n if ((\n e.keyCode == 65 &&\n e.keyCode !== storedKeyPress &&\n character.attr(\"dataMoving\") == 1\n )\n || (\n e.keyCode == 68 &&\n e.keyCode !== storedKeyPress &&\n character.attr(\"dataMoving\") == 1\n )\n ) {\n $(\"#playerProfile\").animate({left: distance}, 0, function () {\n storedKeyPress = e.keyCode\n })\n }\n}", "function getCharacterMove(dir){\n character_face[dir] = getCharacterImg(moveInd[dir])\n moveInd[dir] += 1\n \n}", "moveCharacter(data) {\n this.currentEnd = data;\n this._duration = this.getCharacterDuration(data);\n this.addNewPosition(this.currentEnd);\n\n }", "move(){\n this.x = this.x + this.s;\n if (this.x > width){\n this.x = 0;\n }\n }", "function moveChar(thisChar, type){\r\n\t\t\r\n\tswitch(type){\r\n\t\tcase 1:\r\n\t\t//random\r\n\t\tif(!thisChar.canMove){\r\n\t\t\tthisChar.dirX = thisChar.dirX*-1;\r\n\t\t\tthisChar.dirY = thisChar.dirY*-1;\r\n\t\t}\r\n\t\tif(timer == 0){\r\n\t\t\ttimer = Math.floor(Math.random() * (300-200+1) + 200);\r\n\t\t\tif(isMoving){\r\n\t\t\t\tnewDirX = randomDir();\r\n\t\t\t\tnewDirY = randomDir();\r\n\t\t\t\twhile(newDirX == 0 && newDirY == 0){\r\n\t\t\t\t\tnewDirX = randomDir();\r\n\t\t\t\t\tnewDirY = randomDir();\r\n\t\t\t\t}\r\n\t\t\t\tthisChar.dirX = newDirX;\r\n\t\t\t\tthisChar.dirY = newDirY;\r\n\t\t\t\tisMoving = !isMoving;\r\n\t\t\t}else{\r\n\t\t\t\tthisChar.dirX = 0;\r\n\t\t\t\tthisChar.dirY = 0;\r\n\t\t\t\tisMoving = !isMoving;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\ttimer--;\r\n\t\t}\t\t\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tcase 2:\r\n\t\t//Follow\r\n\t\tnewDirX = (player.x + (player.w/2)) - (thisChar.x + (thisChar.w/2));\r\n\t\tnewDirY = (player.y + (player.h/2)) - (thisChar.y + (thisChar.h/2));\r\n\t\t//There should be an easier way to do this. Preferable in previous 2 lines. But, whatever.\r\n\t\tif(newDirX > 50 || newDirX < -50){\r\n\t\t\tif(newDirX < 0){\r\n\t\t\t\tnewDirX = -1;\r\n\t\t\t}else if(newDirX > 0){\r\n\t\t\t\tnewDirX = 1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirX = newDirX;\r\n\t\t}else{\r\n\t\t\tthisChar.dirX = 0;\r\n\t\t}\r\n\t\t\r\n\t\tif(newDirY > 50 || newDirY < -50){\r\n\t\t\tif(newDirY < 0){\r\n\t\t\t\tnewDirY = -1;\r\n\t\t\t}else if(newDirY > 0){\r\n\t\t\t\tnewDirY = 1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirY = newDirY;\r\n\t\t}else{\r\n\t\t\tthisChar.dirY = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tcase 3:\r\n\t\t//flee\r\n\t\tnewDirX = (player.x + (player.w/2)) - (thisChar.x + (thisChar.w/2));\r\n\t\tnewDirY = (player.y + (player.h/2)) - (thisChar.y + (thisChar.h/2));\r\n\t\t//There should be an easier way to do this. Preferable in previous 2 lines. But, whatever.\r\n\t\tif(newDirX < 75 && newDirX > -75){\r\n\t\t\tif(newDirX < 0){\r\n\t\t\t\tnewDirX = 1;\r\n\t\t\t}else if(newDirX > 0){\r\n\t\t\t\tnewDirX = -1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirX = newDirX;\r\n\t\t}else{\r\n\t\t\tthisChar.dirX = 0;\r\n\t\t}\r\n\t\t\r\n\t\tif(newDirY < 75 && newDirY > -75){\r\n\t\t\tif(newDirY < 0){\r\n\t\t\t\tnewDirY = 1;\r\n\t\t\t}else if(newDirY > 0){\r\n\t\t\t\tnewDirY = -1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirY = newDirY;\r\n\t\t}else{\r\n\t\t\tthisChar.dirY = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tdefault:\r\n\t\t//still\r\n\t\tthisChar.dirX = 0;\r\n\t\tthisChar.dirY = 0;\r\n\t}\r\n}", "move() {\n let counter = 0;\n do {\n if (this.instructionsArray.charAt(counter)=== 'F') {\n this.moveForward();\n }\n else {\n this.turn(this.instructionsArray.charAt(counter));\n }\n counter++;\n } while (counter < this.instructionsArray.length && !this.lost)\n }", "move() {\n // figure out which key was pressed\n if (keyIsDown(LEFT_ARROW)) {\n this.xPos -= 5;\n this.myGraphic = user_left;\n }\n if (keyIsDown(RIGHT_ARROW)) {\n this.xPos += 5;\n this.myGraphic = user_right;\n }\n if (keyIsDown(UP_ARROW)) {\n this.yPos -= 5;\n }\n if (keyIsDown(DOWN_ARROW)) {\n this.yPos += 5;\n }\n }", "function move(dir)\n{\n //airconsole.message(AirConsole.SCREEN, { move: amount })\n airconsole.message(AirConsole.SCREEN, { direction: dir });\n $(\".arrow\").removeClass(\"active\");\n if (dir != 'S') {\n $(\".arrow\" + dir).addClass(\"active\");\n }\n}", "moveForward () {\n let posAux = Object.assign({}, this.position);\n switch (this.position.orientation) {\n case 'N':\n this.position.column++;\n break;\n case 'S':\n this.position.column--;\n break;\n case 'E':\n this.position.row--;\n break;\n case 'W':\n this.position.row++;\n break;\n default:\n break;\n }\n this.isLost(posAux);\n }", "function Update() \n{\n\t// Save the state in playing now.\n stateInfo = chrAnimator.GetCurrentAnimatorStateInfo(0);\n\n\t// character moves\n\tvar h : float = Input.GetAxis(\"Horizontal\");\n\tvar v : float = Input.GetAxis(\"Vertical\");\n\tvar axisInput : Vector3 = Vector3(h, 0, v);\n\n\tvar moveSpeed : float = (h*h+v*v) * 0.25;\n\tif(Input.GetButton(\"Fire2\"))\tmoveSpeed += 0.75;\t// for Run\n\n\tchrAnimator.SetFloat(\"Speed\", moveSpeed);\n\n\t// character rotate\n\tif(h + v != 0){\n\t\tif(stateInfo.IsTag(\"InMove\") || stateInfo.IsTag(\"InJump\")){\n\t\t\taxisInput = Camera.main.transform.rotation * axisInput;\n\t\t\taxisInput.y = 0;\n\t\t\ttransform.forward = axisInput;\n\t\t}\n\t}\n\t//transform.Rotate(0, h * rotateSpeed, 0);\n\t\n\t// Bool parameter reset to false. \n\tif(!stateInfo.IsTag(\"InIdle\")){\n\t\tchrAnimator.SetBool(\"LookAround\", false);\n\t\tchrAnimator.SetBool(\"Attack\", false);\n\t\tchrAnimator.SetBool(\"Jiggle\", false);\n\t\tchrAnimator.SetBool(\"Dead\", false);\n\t}\n\n\t// reaction of key input.\n\t// for Attack\n\tif(Input.GetButtonDown(\"Fire1\"))\tchrAnimator.SetBool(\"Attack\", true);\n \n\t// LookAround\n\tif(Input.GetKeyDown(\"z\"))\tchrAnimator.SetBool(\"LookAround\", true);\n\t// Jiggle\n\tif(Input.GetKeyDown(\"x\"))\tchrAnimator.SetBool(\"Jiggle\", true);\n\n\t// Happy!!\n\tif(Input.GetKeyDown(\"c\"))\n\t{\n\t\tchrAnimator.SetBool(\"Happy\", !chrAnimator.GetBool(\"Happy\"));\n\t\tif(chrAnimator.GetBool(\"Happy\") == true)\tchrAnimator.SetBool(\"Sad\", false);\n\t}\n\t// Sad\n\tif(Input.GetKeyDown(\"v\"))\n\t{\n\t\tchrAnimator.SetBool(\"Sad\", !chrAnimator.GetBool(\"Sad\"));\n\t\tif(chrAnimator.GetBool(\"Sad\") == true)\tchrAnimator.SetBool(\"Happy\", false);\n\t}\n\t\n\t// for Dead\n\tif(Input.GetKeyDown(\"b\"))\tchrAnimator.SetBool(\"Dead\", true );\n\n\t// for Jump\n\t// while in jump, I am using Character Controller instead Root Motion, to move the Character.\n\t// in ground.\n\tif(chrController.isGrounded){\n // jump parameter set to false.\n\t\tchrAnimator.SetInteger(\"Jump\", 0);\n // moveDirection set 0, to prevent to move by Character controller.\n\t\tmoveDirection = Vector3.zero;\n // press Jump button. make jump\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n\t}\n // While in Air\n else if(!chrController.isGrounded){\n // press Jump button. can jump once more.\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n // It is moved with Character Controller while in the air,\n // moveDirection is use Axis Input.\n\t\tmoveDirection = Vector3(axisInput.x * 4, moveDirection.y, axisInput.z * 4);\n\t\tmoveDirection.y -= gravity * Time.deltaTime;\n\t}\n\n // character is move by moveDirection.\n\tchrController.Move(moveDirection * Time.deltaTime);\n}", "function moveCharacter(event) {\n event.stopPropagation();\n if (selectedCharacter && this.classList.contains(\"movable\")) {\n const currentCell = this;\n const currentIndex = Array.from(cells).indexOf(currentCell);\n const characterImg = selectedCharacter.querySelector(\"img\");\n\n // If the clicked cell contains a character, swap their positions\n if (currentCell.dataset.char) {\n const tempChar = currentCell.querySelector(\"img\");\n currentCell.appendChild(characterImg);\n selectedCharacter.appendChild(tempChar);\n } else {\n currentCell.appendChild(characterImg);\n }\n\n // Update last position and movable cells after moving\n lastCharacterPosition = Array.from(cells).indexOf(selectedCharacter);\n updateMovableCells(lastCharacterPosition);\n // Deselect the character after moving\n deselectCharacter();\n // Reset movable characters after moving\n resetMovableCharacters();\n }\n }", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }", "moveToPreviousCharacter() {\n this.handleLeftKey();\n }", "move() {\n\t\tthis.lastPosition = [ this.x, this.y ];\n\n\t\tthis.x += this.nextMove[0];\n\t\tthis.y += this.nextMove[1];\n\t}", "changeChar(){\n // if the player is set to the index of 4, the sprite will go back to index of 0\n if(this.sprite !== 4){\n this.sprite += 1;\n }else{\n this.sprite = 0;\n }\n }", "function move_car(e)\n{\n switch(e.keyCode)\n {\n case 37:\n //left key pressed\n blueone.next_pos();\n break;\n\n case 39:\n //right key is presed\n redone.next_pos(); \n break;\n\n }\n}", "function move() {\r\n\t\r\n}", "move_player(graphics_state,dt)\r\n {\r\n let temp = Mat4.inverse( graphics_state.camera_transform);\r\n this.battle = temp;\r\n this.battle = this.battle.times(Mat4.translation([0,0,-3]));\r\n //let origin = Vec.of(0,0,0,1);\r\n //temp = temp.times(origin);\r\n \r\n let origin = Vec.of(0,0,0,1);\r\n let char_pos = temp.times(origin);\r\n //console.log(char_pos);\r\n \r\n if(this.rotate_right == true)\r\n {\r\n temp = temp.times(Mat4.rotation( -0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation + 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_right = false;\r\n }\r\n if(this.rotate_left == true)\r\n {\r\n temp = temp.times(Mat4.rotation( 0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation - 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_left = false;\r\n }\r\n\r\n if(this.move_forward == true)\r\n {\r\n \r\n this.velocity = this.velocity.plus(Vec.of(0,0,-0.2*dt));\r\n \r\n /*else\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n }*/\r\n }\r\n if(this.move_backward == true)\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0,0,0.2*dt));\r\n \r\n //else\r\n //{\r\n //this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n //}\r\n }\r\n let old_temp = temp;\r\n temp = temp.times(Mat4.translation(this.velocity));\r\n char_pos = temp.times(origin);\r\n if(this.out_of_bounds(char_pos) == true || this.finished == false)\r\n {\r\n temp = old_temp;\r\n }\r\n if(this.check_door(char_pos) == true)\r\n {\r\n this.touching_door = true;\r\n }\r\n if(this.check_enemy(char_pos) == true && this.touching_door == false)\r\n {\r\n this.touching_enemy = true;\r\n this.enemy = this.map[this.player_room[0]][this.player_room[1]].enemy_type;\r\n this.finished = false;\r\n }\r\n if(this.check_key(char_pos) == true)\r\n {\r\n this.touching_obj = true;\r\n }\r\n temp = Mat4.inverse(temp);\r\n \r\n return temp;\r\n }", "function move()\n{\n\tif (player.direction == MOVE_NONE)\n\t{\n \tplayer.moving = false;\n\t\t//console.log(\"y: \" + ((player.y-20)/40));\n\t\t//console.log(\"x: \" + ((player.x-20)/40));\n \treturn;\n \t}\n \tplayer.moving = true;\n \t//console.log(\"move\");\n \n\tif (player.direction == MOVE_LEFT)\n\t{\n \tif(player.angle != -90)\n\t\t{\n\t\t\tplayer.angle = -90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y-1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y -=1;\n\t\t\tvar newX = player.position.x - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n \t}\n\tif (player.direction == MOVE_RIGHT)\n\t{\n \tif(player.angle != 90)\n\t\t{\n\t\t\tplayer.angle = 90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y+1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newX = player.position.x + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_UP)\n\t{\n\t if(player.angle != 0)\n\t\t{\n\t\t\tplayer.angle = 0;\n\t\t}\n\t\tif(map[playerPos.x-1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x-=1;\n\t\t\tvar newy = player.position.y - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({y: newy}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_DOWN)\n\t{\n\t if(player.angle != 180)\n\t\t{\n\t\t\tplayer.angle = 180;\n\t\t}\n\t\tif(map[playerPos.x+1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newy = player.position.y + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: player.position.x, y: newy}, 250).call(move);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n}", "moveBackwardOneChar() {\n this.simulateKeyPress_(SAConstants.KeyCode.LEFT_ARROW, {});\n }", "move() {\n this.x = this.x - 7\n }", "function stateAnimation(delta) {\n [koiText, endText].forEach(el => {\n if (el.visible === true && !textRunFinished) {\n if (el.x < 120) {\n el.x += el.speed * delta;\n } else {\n el.speed = 0;\n el.x = 120;\n textRunFinished = true;\n }\n }\n });\n}", "function keyPressed() {\n\tif(keyCode == UP_ARROW && (this.last_moving_direction!==DOWN_ARROW) ) {\n\t\t\ts.dir(0, -1);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.y += s.yspeed*diffLevel;\n\t} else if(keyCode == DOWN_ARROW && (this.last_moving_direction!==UP_ARROW)) {\n\t\t\ts.dir(0, 1);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.y += s.yspeed*diffLevel;\n\t}else if(keyCode == RIGHT_ARROW && (this.last_moving_direction!==LEFT_ARROW)) {\n\t\t\ts.dir(1, 0);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.x += s.xspeed*diffLevel;\n\t}else if(keyCode == LEFT_ARROW && (this.last_moving_direction!==RIGHT_ARROW)) {\n\t\t\ts.dir(-1, 0);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.x += s.xspeed*diffLevel;\n\t}\n}", "move () {\n }", "function move() {\n\t\tmovePiece(this);\n\t}", "function moveBear() {\n if (key == 'w') {\n bearY--;\n } else if (key == 'a') {\n bearX--;\n } else if (key == 's') {\n bearY++;\n } else if (key == 'd') {\n bearX++;\n }\n}", "move() {\n\n }", "function character_movement(e){\n keyCode_right:\n if(e.keyCode === 68){ //keyCode_D Move_right \n //\n //keyCode_right original location\n //\n //keyCode_D find current container with red_background class.\n var find_location = document.getElementsByClassName(\"red_background\");\n var original_placement = find_location[0].id;\n console.log(\"Find originating character placement: \" + original_placement);//Display 2\n \n var split_original_placement = original_placement.split(\"_\");\n //Assign each part of the original placement id to separate parts.\n //Grid is unnecessary\n var sop_row = split_original_placement[1];//1, 2, 3, or 4...\n var sop_column = split_original_placement[2];//1, 2, 3, or 4...\n var sop_letter = split_original_placement[3];//A, B, C, or D\n //No_inner\n var original_character_placement_id = sop_row + sop_column + sop_letter;\n console.log(\"Original placement split: \" + split_original_placement);//Display 3\n console.log(\"Original placement reformed: \" + original_character_placement_id);\n //Original placement is now in impassable location form and ready to compare. Access original_placement for resetting character position.\n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[0]){//Move Right A ===> B no column change \n //\n //keyCode_right impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[1];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[A] right movement to B\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n else if(sop_letter === letter_indeces[1]){//Move Right B ===> A column change \n //\n //keyCode_right impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n impassable_loop:\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n \n var string_current_impassable_location = impassable_locations_array[l];\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse + 1;\n var new_sop_letter = letter_indeces[0];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n \n change_new_classes = change_new.classList;\n console.log(\"The list of all classes in the supposed new placement: \" + change_new_classes);\n console.log(change_new_classes[0]);\n console.log(change_new_classes[1]);\n console.log(change_new_classes.length);\n \n console.log(\"Comparing. String_new_placement = \" + string_new_placement + \"String_current_impassable_location = \" + string_current_impassable_location);\n console.log(typeof(string_new_placement) + \" \" + typeof(string_current_impassable_location));\n var string_comparison = string_current_impassable_location.localeCompare(string_new_placement);\n console.log(string_comparison);\n\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n\n /*\n * If new location has more than one class find out what those classes are and then set new location to those classes\n * \n * change_new_classes = change_new.classList;\n * console.log(change_new_classes);\n * console.log(change_new_classes.length);\n * \n * change_new.className = change_new_classes;\n * \n * \n */\n //Instead of hard coding the new class we need the program to decide to keep this coordinate's class how it oringially was\n\n \n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n //Instead of hard coding the new class we need the program to decide to keep this coordinate's class how it oringially was\n change_original.className = \"character_placement\";\n \n change_new.className = \"character_placement red_background\"; \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n\n \n }//End letter_indeces[B] right movement to A\n \n \n else if(sop_letter === letter_indeces[3]){//Move Right D ===> C column change \n //\n //keyCode_right impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n impassable_loop:\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n \n var string_current_impassable_location = impassable_locations_array[l];\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse + 1;\n var new_sop_letter = letter_indeces[2];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n \n console.log(\"Comparing. String_new_placement = \" + string_new_placement + \"String_current_impassable_location = \" + string_current_impassable_location);\n console.log(typeof(string_new_placement) + \" \" + typeof(string_current_impassable_location));\n var string_comparison = string_current_impassable_location.localeCompare(string_new_placement);\n console.log(string_comparison);\n\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n\n \n }//End letter_indeces[D] right movement to C\n \n \n \n if(sop_letter === letter_indeces[2]){//Move Right C ===> D no column change \n //\n //keyCode_right impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[3];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[C] right movement to D\n \n }//End keyCode D right movement\n \n \n \n \n keyCode_left:\n if(e.keyCode === 65){ //keyCode_D Move_left \n //\n //keyCode_left original location\n //\n //keyCode_A find current container with red_background class.\n var find_location = document.getElementsByClassName(\"red_background\");\n var original_placement = find_location[0].id;\n console.log(\"Find originating character placement: \" + original_placement);//Display 2\n \n var split_original_placement = original_placement.split(\"_\");\n //Assign each part of the original placement id to separate parts.\n //Grid is unnecessary\n var sop_row = split_original_placement[1];//1, 2, 3, or 4\n var sop_column = split_original_placement[2];//1, 2, 3, or 4\n var sop_letter = split_original_placement[3];//A, B, C, or D\n //No_inner\n var original_character_placement_id = sop_row + sop_column + sop_letter;\n console.log(\"Original placement split: \" + split_original_placement);//Display 3\n console.log(\"Original placement reformed: \" + original_character_placement_id);\n //Original placement is now in impassable location form and ready to compare. Access original_placement for resetting character position.\n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[0]){//Move Left A ===> B column change \n //\n //keyCode_left impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse - 1;\n var new_sop_letter = letter_indeces[1];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[A] left movement to B\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n else if(sop_letter === letter_indeces[1]){//Move Left B ===> A no column change \n //\n //keyCode_right impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n impassable_loop:\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n \n var string_current_impassable_location = impassable_locations_array[l];\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[0];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n \n console.log(\"Comparing. String_new_placement = \" + string_new_placement + \"String_current_impassable_location = \" + string_current_impassable_location);\n console.log(typeof(string_new_placement) + \" \" + typeof(string_current_impassable_location));\n var string_comparison = string_current_impassable_location.localeCompare(string_new_placement);\n console.log(string_comparison);\n\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n\n \n }//End letter_indeces[B] right movement to A\n \n \n else if(sop_letter === letter_indeces[3]){//Move Left D ===> C no column change \n //\n //keyCode_right impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n impassable_loop:\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n \n var string_current_impassable_location = impassable_locations_array[l];\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[2];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n \n console.log(\"Comparing. String_new_placement = \" + string_new_placement + \"String_current_impassable_location = \" + string_current_impassable_location);\n console.log(typeof(string_new_placement) + \" \" + typeof(string_current_impassable_location));\n var string_comparison = string_current_impassable_location.localeCompare(string_new_placement);\n console.log(string_comparison);\n\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n\n \n }//End letter_indeces[D] left movement to C\n \n \n \n if(sop_letter === letter_indeces[2]){//Move Left C ===> D column change \n //\n //keyCode_left impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse - 1;\n var new_sop_letter = letter_indeces[3];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[C] left movement to D\n \n }//End keyCode A left movement\n \n \n keyCode_down:\n if(e.keyCode === 83){ //keyCode_S Move_down\n //if(e.keyCode === 83)\n //keyCode_down original location\n //\n //keyCode_A find current container with red_background class.\n var find_location = document.getElementsByClassName(\"red_background\");\n var original_placement = find_location[0].id;\n console.log(\"Find originating character placement: \" + original_placement);//Display 2\n \n var split_original_placement = original_placement.split(\"_\");\n //Assign each part of the original placement id to separate parts.\n //Grid is unnecessary\n var sop_row = split_original_placement[1];//1, 2, 3, or 4\n var sop_column = split_original_placement[2];//1, 2, 3, or 4\n var sop_letter = split_original_placement[3];//A, B, C, or D\n //No_inner\n var original_character_placement_id = sop_row + sop_column + sop_letter;\n console.log(\"Original placement split: \" + split_original_placement);//Display 3\n console.log(\"Original placement reformed: \" + original_character_placement_id);\n //Original placement is now in impassable location form and ready to compare. Access original_placement for resetting character position.\n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[0]){//Move Down A ===> C no row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[2];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[A] down movement to C\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[2]){//Move Down C ===> A row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse + 1;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[0];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[C] down movement to A\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n if(sop_letter === letter_indeces[1]){//Move Down B ===> D no row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[3];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[B] down movement to D\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[3]){//Move Down D ===> B row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse + 1;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[1];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[D] down movement to B\n \n }//End keyCode S down movement\n keyCode_up:\n if(e.keyCode === 87){ //keyCode_W Move_up\n //\n //keyCode_up original location\n //\n //keyCode_A find current container with red_background class.\n var find_location = document.getElementsByClassName(\"red_background\");\n var original_placement = find_location[0].id;\n console.log(\"Find originating character placement: \" + original_placement);//Display 2\n\n var split_original_placement = original_placement.split(\"_\");\n //Assign each part of the original placement id to separate parts.\n //Grid is unnecessary\n var sop_row = split_original_placement[1];//1, 2, 3, or 4\n var sop_column = split_original_placement[2];//1, 2, 3, or 4\n var sop_letter = split_original_placement[3];//A, B, C, or D\n //No_inner\n var original_character_placement_id = sop_row + sop_column + sop_letter;\n console.log(\"Original placement split: \" + split_original_placement);//Display 3\n console.log(\"Original placement reformed: \" + original_character_placement_id);\n //Original placement is now in impassable location form and ready to compare. Access original_placement for resetting character position.\n\n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n \n \n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[0]){//Move Up A ===> C row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse - 1;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[2];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[A] up movement to C\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n \n \n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[2]){//Move Up C ===> A no row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[0];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[C] up movement to A\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[3]){//Move Up D ===> B no row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[1];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[D] up movement to B\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n \n ///////////////////////////////////////////////////////////////////////////\n ///////////////////////////////////////////////////////////////////////////\n if(sop_letter === letter_indeces[1]){//Move Up B ===> D row change \n //\n //keyCode_down impassable\n //\n var impassable_locations_array = [];\n var find_impassable = document.getElementsByClassName(\"impassable\");//This id will never equal that of character_placement id simply because of _inner\n \n var k;\n var l;\n var pseudo_array_length_01 = 17;\n for(k = 0, l = 0;k < find_impassable.length, l < pseudo_array_length_01; k++, l++){\n// console.log(find_impassable[k].id);\n var find_impassable_id = find_impassable[k].id;\n var stringify_find_impassable_id = find_impassable_id.toString();\n var sfi_id = stringify_find_impassable_id.split(\"_\");\n\n\n var impassable_row_initial = sfi_id[1];\n var impassable_cell_initial = sfi_id[2];\n var impassable_subset_array = sfi_id[3];\n \n var impassable_locations = impassable_row_initial + impassable_cell_initial + impassable_subset_array;\n var string_impassable_locations = impassable_locations.toString();//Ensure impassable locations typing is set to string\n impassable_locations_array.push(string_impassable_locations);\n console.log(\"Impassable location array \" + impassable_locations_array[l]);//Display 4\n //All impassable locations have been pulled successfully from this script. End for loop impassable\n //Format for impassable locations array = 14C, 14D, 24A, 24B, etc...\n \n var sop_row_parse = parseInt(sop_row); \n var sop_column_parse = parseInt(sop_column);\n \n var new_sop_row = sop_row_parse - 1;\n var new_sop_column = sop_column_parse;\n var new_sop_letter = letter_indeces[3];\n \n var new_sop_row_string = new_sop_row.toString();\n var new_sop_column_string = new_sop_column.toString();\n \n var new_placement = new_sop_row_string + new_sop_column_string + new_sop_letter;\n var string_new_placement = new_placement.toString();\n \n var go_to_new_location = \"grid_\" + new_sop_row + \"_\" + new_sop_column + \"_\" + new_sop_letter;//ID for new location if permitted.\n var change_original = document.getElementById(original_placement);\n var change_new = document.getElementById(go_to_new_location);\n if(impassable_locations_array.indexOf(string_new_placement) > -1){\n \n change_original.className = \"character_placement red_background\";\n if(change_new === null){\n\n }\n else{\n change_new.className = \"character_placement\";\n }\n console.log(\"The conditional on D to C is stating that the impassable array has the value of the next coordinate somewhere.\");\n }\n else{\n \n if(change_new === null){\n \n change_new = change_original;\n change_original.className = \"character_placement red_background\";\n \n }else{\n change_original.className = \"character_placement\";\n change_new.className = \"character_placement red_background\";\n \n console.log(\"We are still waiting to see if impassable locations will be detected...\");\n }\n }\n \n }\n \n }//End letter_indeces[B] up movement to D\n \n /////////////////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////////////////\n \n }//End keyCode W up movement \n }//End function for input", "updateCoordinate() \n\t{\n\t\tif(this.counter>=this.constants[this.action].x.length)\n\t\t{\n\t\t\tthis.counter=0;\n\t\t\t//if action is anything other than 'STANDING' change the action back to 'STANDING'\n\t\t\tthis.action = 'STANDING';\n\t\t}\n\n\t\tif(this.action == 'WALK_LEFT')\n\t\t\tthis.ch_x = this.ch_x-10;\n\t\telse if(this.action == 'WALK_RIGHT')\n\t\t\tthis.ch_x = this.ch_x+10;\n\t}", "move() {\n switch (this.machineTable[this.state][this.lastRead].move) {\n case directions.UP:\n return this.moveUp();\n case directions.RIGHT:\n return this.moveRight();\n case directions.DOWN:\n return this.moveDown();\n case directions.LEFT:\n return this.moveLeft();\n default:\n }\n }", "function moveCar(e){\n e = e || window.event;\n if (e.keyCode == '37') {\n if(cPosition>1){\n cPosition= cPosition-1;\n }\n \n \n }\n else if (e.keyCode == '39') {\n if(cPosition<9){\n cPosition= cPosition+1;\n }\n }\n}", "function getCharacterMove(dir){\n character_image[dir] = getCharacterImg(dir, moveInd[dir])\n moveInd[dir] += 1\n if (moveInd[dir] >= maxImageInd){\n moveInd[dir] = 0\n } \n}", "moveForward() {\n switch (this.position.heading) {\n case \"N\":\n return (this.position = { ...this.position, y: this.position.y + 1 });\n case \"E\":\n return (this.position = { ...this.position, x: this.position.x + 1 });\n case \"S\":\n return (this.position = { ...this.position, y: this.position.y - 1 });\n case \"W\":\n return (this.position = { ...this.position, x: this.position.x - 1 });\n default:\n return this.position;\n }\n }", "function processWalk(dir) {\n \n //increment the charStep as we will want to use the next stance in the animation\n //if the character is at the end of the animation, go back to the beginning\n charStep++;\n if (charStep == 5) charStep = 1;\n \n //remove the current class\n $('#character').removeAttr('class');\n \n //add the new class\n switch(charStep) {\n case 1: $('#character').addClass(dir+'-stand'); break;\n case 2: $('#character').addClass(dir+'-right'); break;\n case 3: $('#character').addClass(dir+'-stand'); break;\n case 4: $('#character').addClass(dir+'-left'); break;\n }\n \n //move the char\n //we will only want to move the character 32px (which is 1 unit) in any direction\n switch(dir) {\n case'front':\n $('#character').animate({top: '+=32'}, charSpeed);\n break;\n case'back':\n //don't let the character move any further up if they are already at the top of the screen\n if ($('#character').position().top > 0) {\n $('#character').animate({top: '-=32'}, charSpeed);\n }\n break;\n case'left':\n //don't let the character move any further left if they are already at the left side of the screen \n if ($('#character').position().left > 0) {\n $('#character').animate({left: '-=32'}, charSpeed);\n }\n break;\n case'right':\n $('#character').animate({left: '+=32'}, charSpeed);\n break;\n }\n \n }", "function santaMoving(e) {\n if (e.code===\"ArrowLeft\") {state.santa.x-=5;\n } else if(e.code===\"ArrowRight\") {state.santa.x+=5;\n }\n\n drawSanta(ctx,image);\n }", "move() { }", "move() { }", "moveNorth(){\n this.move ( 'N' );\n }", "function moveCharacterUp(){\n gameModel.moveCharacter(0);\n}", "move(){\n if (keyIsDown (LEFT_ARROW) ) {\n this.pos.x -= this.speed;\n } \n if (keyIsDown(RIGHT_ARROW) ) {\n this.pos.x += this.speed;\n } \n if (keyIsDown (UP_ARROW) ) {\n this.pos.y -= this.speed;\n } \n if (keyIsDown (DOWN_ARROW) ) {\n this.pos.y += this.speed;\n }\n }", "move(){\r\n if(keyDown(UP_ARROW)){\r\n this.harry.y = this.harry.y - 10;\r\n }\r\n if(keyDown(DOWN_ARROW)){\r\n this.harry.y = this.harry.y + 10;\r\n }\r\n if(keyDown(RIGHT_ARROW)){\r\n this.harry.x = this.harry.x + 10;\r\n }\r\n if(keyDown(LEFT_ARROW)){\r\n this.harry.x = this.harry.x - 10;\r\n }\r\n \r\n }", "function moveGunner() {\n /* HOW IT WORKS\n 1) gunX is assigned to the x-coordinate (in px) of the gunner. \n 2) Depending on the value of charCode the gunX will be either incremented or decremented.\n 3) The position of the gunner is then set to the new value of gunX\n */\n gunX = gunner.offsetLeft\n gunStep = 0.01 * mainContainer.scrollWidth\n if (charCode === 39) {\n gunner.offsetLeft + gunStep > mainContainer.scrollWidth - gunner.offsetWidth ? clearInterval(gunMoveTimer) : gunX += gunStep\n } else if (charCode === 37) {\n gunner.offsetLeft - gunStep <= 0 ? clearInterval(gunMoveTimer) : gunX -= gunStep\n }\n gunner.style.left = `${gunX}px`\n }", "function playerMove( e, obj ) {\n var s = e.key.toLowerCase();\n //move left\n if( s == \"arrowleft\" ) {\n if( gridCellEmpty( obj.i-1, obj.j ) ) {\n putObjInCell( obj, obj.i-1, obj.j );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n //move right\n else if ( s == \"arrowright\" ) {\n if( gridCellEmpty( obj.i+1, obj.j ) ) {\n putObjInCell( obj, obj.i+1, obj.j );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n //move up\n else if ( s == \"arrowup\" ) {\n if( gridCellEmpty( obj.i, obj.j-1 ) ) {\n putObjInCell( obj, obj.i, obj.j-1 );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n //move down\n else if ( s == \"arrowdown\" ) {\n if( gridCellEmpty( obj.i, obj.j+1 ) ) {\n putObjInCell( obj, obj.i, obj.j+1 );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n else if ( s == \" \" ) {\n //pass your turn\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n}", "changeDirection (direction) {\n let newState = Object.assign({}, this.state);\n if(direction === 'w' || direction === 'up'){\n newState.snake.direction = 'w';\n } else if(direction === 's' || direction === 'down'){\n newState.snake.direction = 's';\n } else if(direction === 'a' || direction === 'left'){\n newState.snake.direction = 'a';\n } else if(direction === 'd' || direction === 'right'){\n newState.snake.direction = 'd';\n }\n this.setState(newState);\n this.canvasMoveSnake();\n }", "moveDirection(axis, direction){\n\t\tlet temp = this.state.pos.slice();\n\t\ttemp[axis] = temp[axis] + direction;\n\t\tthis.setState({pos: temp});\t\n\t}", "move()\n {\n //contain logic within borders\n if (this.xPos + this.sprite.width > width)\n {\n this.xSpeed = 0;\n this.collided = true;\n this.xPos = width - this.sprite.width\n }\n if (this.xPos < 0)\n {\n this.xSpeed = 0;\n this.collided = true;\n this.xPos = 0;\n }\n if (this.yPos > height-238-this.sprite.height)\n {\n this.ySpeed = 0;\n this.collided = true;\n this.yPos = height-238 - this.sprite.height;\n }\n if (this.yPos < 0)\n {\n this.ySpeed = 0;\n this.collided = true;\n this.yPos = 0;\n }\n //kapp notes helpful as always\n // move left?\n if (keyIsDown(LEFT_ARROW) || keyIsDown(65))\n {\n // subtract from character's xSpeed\n this.xSpeed -= this.accel;\n this.left = true;\n this.right = false;\n }\n // move right?\n if (keyIsDown(RIGHT_ARROW) || keyIsDown(68))\n {\n // add to character's xSpeed\n this.xSpeed += this.accel;\n this.right = true;\n this.left = false;\n }\n //reload, basic\n if (keyIsDown(82))\n {\n this.ammoCapacity = 8;\n }\n // fuel!!\n if (keyIsDown(32))\n {\n if (this.fuel > 0)\n {\n //if you still have fuel, then use it\n this.ySpeed -= this.accel;\n }\n if (this.fuel > -250)\n {\n //250 is the threshold under 0 to simulate a \"delay\" since idk how millis() works\n this.fuel -= 15;\n }\n }\n //look at this sad commented out failure of a feature... maybe one day\n /*\n if (keyCode == SHIFT)\n {\n if (cooldown)\n {\n let yDistance = this.yPos - this.jumpSize;\n this.yPos -= this.jumpSpeed * yDistance;\n jumping = true;\n }\n }*/\n //this I felt I wanted to do so that the left and right speeds\n //would naturally slow down over time. Felt unnatural otherwise.\n if (this.right)\n {\n this.xSpeed -= this.gravity;\n if (this.xSpeed < 0)\n {\n this.right = false;\n this.left = true;\n }\n }\n else if (this.left)\n {\n this.xSpeed += this.gravity;\n if (this.xSpeed > 0)\n {\n this.right = true;\n this.left = false;\n }\n }\n\n //the standard movement. Add gravity, speed to position\n this.ySpeed += this.gravity;\n this.xPos += this.xSpeed;\n this.yPos += this.ySpeed;\n\n //gradually grow your fuel overtime. A counter would've been great but I couldn't learn it in time...\n //no pun intended.\n if (this.fuel < this.fuelCapacity)\n {\n this.fuel += 5;\n }\n\n // speed limit! prevent the user from moving too fast\n this.xSpeed = constrain(this.xSpeed, -this.xLimit, this.xLimit);\n this.ySpeed = constrain(this.ySpeed, -25, 25);\n }", "function moveDown(){\n undraw()\n currentPosition += width\n // gameOver()\n draw()\n freeze()\n }", "function movePig() {\n\tdocument.onkeydown = function(evt) {\n\t\tpig.classList.remove('eat');\n\t\tswitch(evt.keyCode) {\n\t\t\t// Left\n\t\t\tcase 37:\n\t\t\t\t//console.log(\"left\")\n\t\t\t\tif(psX > 0) {\n\t\t\t\t\tpsX -= 100;\n\t\t\t\t\tpig.style.left = psX+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Up\n\t\t\tcase 38:\n\t\t\t\t//console.log(\"up\")\n\t\t\t\tif(psY > 0) {\n\t\t\t\t\tpsY -= 100;\n\t\t\t\t\tpig.style.top = psY+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\t\n\t\t\t// Right\n\t\t\tcase 39:\n\t\t\t\t//console.log(\"right\")\n\t\t\t\tif(psX < 500) {\n\t\t\t\t\tpsX += 100;\n\t\t\t\t\tpig.style.left = psX+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\t\n\t\t\t// Down\n\t\t\tcase 40:\n\t\t\t\t//console.log(\"down\")\n\t\t\t\tif(psY < 500) {\n\t\t\t\t\tpsY += 100;\n\t\t\t\t\tpig.style.top = psY+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\t\t\t\n\t\t}\n\t}\n}", "MoveKey() {}", "function moveLeft(){\n var left = parseInt(window.getComputedStyle(character).getPropertyValue(\"left\"));\n if(left>0){\n character.style.left = left - 2 + \"px\";\n }\n}", "function movement() {\r\n if (cursors.left.isDown) {\r\n player.body.velocity.x = -150;\r\n keyLeftPressed.animations.play(\"leftArrow\");\r\n }\r\n if (cursors.right.isDown) {\r\n player.body.velocity.x = 150;\r\n keyRightPressed.animations.play(\"rightArrow\");\r\n }\r\n\r\n if (player.body.velocity.x > 0) {\r\n player.animations.play(\"right\");\r\n } else if (player.body.velocity.x < 0) {\r\n player.animations.play(\"left\");\r\n } else {\r\n player.animations.play(\"turn\");\r\n }\r\n if (cursors.up.isDown && player.body.onFloor()) {\r\n player.body.velocity.y = -290;\r\n keyUpPressed.animations.play(\"upArrow\");\r\n jumpSound.play();\r\n jumpSound.volume = 0.15;\r\n }\r\n }", "function moveforward(direction) {\n // direction = queen.direction;\n switch (direction) {\n case \"S\":\n if (queen.position.ycor > 0 && queen.position.ycor < 8) {\n queen.position.ycor = queen.position.ycor - 1;\n\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"N\":\n if (queen.position.ycor >= 0 && queen.position.ycor < 7) {\n queen.position.ycor = queen.position.ycor + 1;\n\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"E\":\n if (queen.position.xcor >= 0 && queen.position.xcor < 7) {\n queen.position.xcor = queen.position.xcor + 1;\n\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"W\":\n if (queen.position.xcor > 0 && queen.position.xcor < 8) {\n queen.position.xcor = queen.position.xcor - 1;\n\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"SW\":\n if (queen.position.ycor > 0 && queen.position.ycor < 8) {\n if (queen.position.xcor > 0 && queen.position.xcor < 8) {\n let x = queen.position.xcor - 1;\n let y = queen.position.ycor - 1;\n updatePosition(x, y);\n }\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"SE\":\n if (queen.position.xcor >= 0 && queen.position.xcor < 7) {\n if (queen.position.ycor > 0 && queen.position.ycor <= 7) {\n let x = queen.position.xcor + 1;\n let y = queen.position.ycor - 1;\n updatePosition(x, y);\n }\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"NE\":\n if (queen.position.xcor >= 0 && queen.position.xcor < 7) {\n if (queen.position.ycor >= 0 && queen.position.ycor < 7) {\n let x = queen.position.xcor + 1;\n let y = queen.position.ycor + 1;\n updatePosition(x, y);\n }\n\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n\n case \"NW\":\n if (queen.position.xcor > 0 && queen.position.ycor < 7) {\n if (queen.position.xcor <= 7 && queen.position.ycor >= 0) {\n let x = queen.position.xcor - 1;\n let y = queen.position.ycor + 1;\n updatePosition(x, y);\n }\n } else {\n console.log(\"Out of order move.\");\n }\n break;\n }\n}", "function moveForward(rover) {\n\n switch (rover.direction) {\n\n case \"N\":\n rover.y++;\n break;\n\n case \"E\":\n rover.x++;\n break;\n\n case \"S\":\n rover.y--;\n break;\n\n case \"W\":\n rover.x--;\n break;\n }\n}", "function movePiece(oldPosition, newPosition){\n currentState2D[newPosition[1]][newPosition[0]] = currentState2D[oldPosition[1]][oldPosition[0]] \n currentState2D[oldPosition[1]][oldPosition[0]] = 0 \n drawPieces() ; \n}", "function goingUp() {\n yCharacter -= characterSpeed;\n}", "move () {\n this._updateGUI()\n\n if (this.isMoving()) {\n //console.log('sorry, im already moving')\n return\n }\n\n let dir = this._state.lastDir\n if (!this._canMove(dir)) return\n\n if (this._state.special) {\n this._slide(dir)\n } else {\n this._roll(dir)\n }\n\n this._updateGUI()\n }", "function movePlayer(e) {\n switch (e.key) {\n case \"a\":\n //If the bottom left of the player box = 0 it will stop moving to the left\n if (playerCurrentPosition[0] > 0) {\n //10 is subtracted from the xAxis when a is pressed\n playerCurrentPosition[0] -= 10;\n player.style.left = playerCurrentPosition[0] + \"px\";\n //draw the new position of the player\n drawPlayer();\n //break out of the switch and listen for more key presses\n }\n break;\n\n case \"d\":\n //if the bottom left + the player width is equal to the board width it will stop moving to the right\n if (playerCurrentPosition[0] < boardWidth - playerWidth) {\n //10 is added to the xAxis when d is pressed\n playerCurrentPosition[0] += 10;\n player.style.left = playerCurrentPosition[0] + \"px\";\n drawPlayer();\n }\n break;\n }\n}", "move(){\r\n this.x += this.dx;\r\n }", "move(character, newX, newY) {\n if (this.canMove(character, newX, newY)) {\n this.covered[character.x][character.y] = false;\n this.covered[newX][newY] = true;\n character.x = newX\n character.y = newY\n }\n }", "moveForwardOneChar() {\n this.simulateKeyPress_(SAConstants.KeyCode.RIGHT_ARROW, {});\n }", "function start_move() {\n\tlet coordinate = X;\t\t//defaults to x dimension\n\tlet modifier = 1;\t\t//defaults to positive \n\tlet no_collision = true;\n\t//starts animation if necessary\n\tif(animating == false) {\n\t\tanimating = true;\n\t\tanimate();\t\t\t//does first frame of animation immediately\n\t\ttID_animate = setInterval(animate.bind(null), 140);\n\t}\n\t\n\t//change to y dimension if needed\n\tif (direction == 0 || direction == 3) coordinate = Y;\n\t//change to positive direction\n\tif (direction == 1 || direction == 3) modifier = -1;\n\t\n\n\t\n\t//check for collisions\n\tif(coordinate == X) {\n\t\tif(betterCollisionDetection(pos[0]+modifier*32, pos[1]) == true)\n\t\t\tno_collision = false;\n\t}\n\telse if(coordinate == Y) {\n\t\tif(betterCollisionDetection(pos[0], pos[1]+modifier*32) == true)\n\t\t\tno_collision = false;\n\t}\n\t\t\t\t\n\t\t\t\n\t\n\tif(no_collision) {\n\t\t//check if move would leave the valid area\n\t\t//if it would, move the bacground instead\n\t\tlet test_value = pos[coordinate] + modifier;\n\t\t// console.log(spots)\n\t\tif (test_value < MIN_POS[coordinate] || test_value > MAX_POS[coordinate]) {\n\n\t\t\tfor(let i = 0; i < index; i++){\n\t\t\t\tlet element = document.getElementById(`field${i}`);\n\t\t\t\tdelete spots[`${element.dataset.x},${element.dataset.y}`];\n\t\t\t}\n\t\t\tdo_move_background(coordinate, modifier*-1, 1, 0);\n\t\t}\n\t\telse {\n\t\t\t//do the move for the character\n\t\t\tdelete spots[`${pos[0]},${pos[1]}`];\n\t\t\tdo_move(coordinate, modifier, 0);\n\t\t}\n\t}\n\telse{\n\t\t\n\t\tclearInterval(tID_animate);\t\t\n\t\tanimating = false;\n\t\tmoving = false;\n\t\t\n\t\t//reset frame to 0, draw the frame so character stops on his feet\n\t\tfr_num = 0;\n\t\tanimate();\n\t}\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "function keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength();\n\n // Nothing to transpose if there aren't two characters.\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n }\n\n // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n // After the removal, the insertion target is one character back.\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}", "moveCharacter(character) {\n // ensure call shouldMove method shouldMove()\n if (character.shouldMove()) {\n const { nextMovePos, direction } = character.getNextMove(\n this.objectExist\n );\n const { classesToRemove, classesToAdd } = character.makeMove();\n \n // only for pacman\n if (character.rotation && nextMovePos !== character.pos) {\n this.rotateDiv(nextMovePos, character.dir.rotation);\n this.rotateDiv(character.pos, 0);\n }\n\n this.removeObject(character.pos, classesToRemove);\n this.addObject(nextMovePos, classesToAdd);\n\n character.setNewPos(nextMovePos, direction);\n }\n }", "move() {\n this.x += 3;\n this.y += 0;\n if (this.x > 50) {\n this.x += 0;\n this.y += 4;\n }\n if (this.x > 1200) {\n this.y = this.dy;\n this.x = this.dx;\n }\n }", "function processWalk(dir) {\n\n //increment the charStep as we will want to use the next stance in the animation\n //if the character is at the end of the animation, go back to the beginning\n charStep++;\n if (charStep == 5)\n charStep = 1;\n\n //clear current class\n me.removeAttr('class');\n\n //add the new class\n switch(charStep) {\n case 1:\n stepType = dir+'-stand';\n me.addClass(stepType);\n break;\n case 2:\n stepType = dir+'-right';\n me.addClass(stepType);\n break;\n case 3:\n stepType = dir+'-stand';\n me.addClass(stepType);\n break;\n case 4:\n stepType = dir+'-left';\n me.addClass(stepType);\n break;\n }\n\n Positions.update(characterPosition._id, {$set: {stepType: stepType}});\n\n\n //move the char\n switch(dir) {\n\n case'front':\n newX = me.position().left;\n newY = me.position().top + walkLength ;\n break;\n\n case'back':\n newX = me.position().left;\n newY = me.position().top - walkLength ;\n break;\n\n case'left':\n newX = me.position().left - walkLength;\n newY = me.position().top;\n break;\n\n case'right':\n newX = me.position().left + walkLength;\n newY = me.position().top;\n break;\n }\n\n // Animate moving character (it will also update your character position)\n if(canIwalk(newX, newY)){\n me.animate({left:newX, top: newY}, walkSpeed/2);\n inHouse(newX, newY);\n doorControl(newX, newY);\n\n }\n\n }", "move() {\n }", "function Character() {\n this.tileFrom = [1, 1];\n this.tileTo = [1, 1];\n this.timeMoved = 0;\n this.dimensions = [30, 30]\n this.position = [45, 45]\n this.delayMove = 700\n \n }", "function c0_fischer_cstl_move(c0_moving,c0_draw)\r\n{\r\nvar c0_king=\"\";\r\nvar c0_rook=\"\";\r\nvar c0_king2=\"\";\r\nvar c0_rook2=\"\";\r\n\r\nif(c0_moving.substr(0,4)==\"00**\")\r\n\t{\r\n\tif(c0_sidemoves>0)\r\n\t\t{\r\n\t\tc0_king=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{wK}\")+4,4 );\r\n\t\tc0_rook=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{wRR}\")+5,4 );\r\n\t\tc0_king2=\"wKg1\"; c0_rook2=\"wRf1\";\r\n\t\tc0_wKingmoved=true;c0_wLRockmoved=true;c0_wRRockmoved=true;c0_w00=true;\r\n\t\t}\r\n\telse\r\n\t\t{\r\n\t\tc0_king=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{bK}\")+4,4 );\r\n\t\tc0_rook=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{bRR}\")+5,4 );\t\r\n\t\tc0_king2=\"bKg8\"; c0_rook2=\"bRf8\";\r\n\t\tc0_bKingmoved=true;c0_bLRockmoved=true;c0_bRRockmoved=true;c0_b00=true;\r\n\t\t}\r\n\t}\r\nelse if(c0_moving.substr(0,4)==\"000*\")\r\n\t{\r\n\tif(c0_sidemoves>0)\r\n\t\t{\r\n\t\tc0_king=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{wK}\")+4,4 );\r\n\t\tc0_rook=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{wLR}\")+5,4 );\r\n\t\tc0_king2=\"wKc1\"; c0_rook2=\"wRd1\";\r\n\t\tc0_wKingmoved=true;c0_wLRockmoved=true;c0_wRRockmoved=true;c0_w00=true;\r\n\t\t}\r\n\telse\r\n\t\t{\r\n\t\tc0_king=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{bK}\")+4,4 );\r\n\t\tc0_rook=c0_fischer_cst.substr( c0_fischer_cst.indexOf(\"{bLR}\")+5,4 );\r\n\t\tc0_king2=\"bKc8\"; c0_rook2=\"bRd8\";\r\n\t\tc0_bKingmoved=true;c0_bLRockmoved=true;c0_bRRockmoved=true;c0_b00=true;\r\n\t\t}\r\n\t}\r\nelse\r\n\t{\r\n\tvar c0_from_at=c0_moving.substr(0,2);\r\n\tvar c0_to_at=c0_moving.substr(2,2);\r\n\tc0_moveto(c0_convH888(c0_from_at), c0_convH888(c0_to_at), c0_draw);\r\n\t}\r\n\r\nif(c0_king.length>0 && c0_rook.length>0)\r\n\t{\r\n\tif(c0_draw)\r\n\t\t{\r\n\t\tc0_clear_at(c0_king.substr(2,2));\r\n\t\tc0_clear_at(c0_rook.substr(2,2));\r\n\t\tc0_add_piece(c0_king2.substr(0,2)+c0_rook2.substr(2,2));\r\n\t\tc0_moveto(c0_convH888(c0_rook2.substr(2,2)), c0_convH888(c0_king2.substr(2,2)), c0_draw);\r\n\t\tc0_add_piece(c0_rook2);\r\n\t\t}\r\n\telse\r\n\t\t{\r\n\t\tif(!(c0_king==c0_king2)) c0_position=c0_ReplaceAll(c0_position,c0_king,c0_king2);\r\n\t\tif(!(c0_rook==c0_rook2)) c0_position=c0_ReplaceAll(c0_position,c0_rook,c0_rook2);\r\n\t\t}\r\n\t}\r\n}", "function move(){\n\tif(left){\n\t\tif(player1.x >= 450){\n\t\t\tdiff -= speed;\n\t\t}else{\n\t\t\tplayer1.x += speed;\n\t\t}\n\t\tlastKey = \"left\";\n\t}\t\n\tif(right){\n\t\tif(player1.x <= 10){\n\t\t\tdiff += speed;\n\t\t}else{\n\t\t\tplayer1.x -= speed;\n\t\t}\n\t\tlastKey = \"right\";\n\t}\n}", "genmove(state, cb) { /* {{{ */\n // Only relevent with persistent bots. Leave the setting on until we actually have requested a move.\n //\n this.firstmove = false;\n\n // Do this here so we only do it once, plus if there is a long delay between clock message and move message, we'll\n // subtract that missing time from what we tell the bot.\n //\n this.loadClock(state);\n\n this.command(\"genmove \" + this.game.my_color,\n (move) => {\n move = typeof(move) == \"string\" ? move.toLowerCase() : null;\n let resign = move == 'resign';\n let pass = move == 'pass';\n let x=-1, y=-1;\n if (!resign && !pass) {\n if (move && move[0]) {\n x = gtpchar2num(move[0]);\n y = state.width - parseInt(move.substr(1))\n } else {\n this.log(\"genmove failed, resigning\");\n resign = true;\n }\n }\n cb({'x': x, 'y': y, 'text': move, 'resign': resign, 'pass': pass});\n },\n null,\n true /* final command */\n )\n }", "movePlayer() {\r\n this.ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n this.drawText();\r\n this.posY = this.posY + this.speed * this.inputY;\r\n this.posX = this.posX + this.speed * this.inputX;\r\n this.renderPlayer();\r\n }", "transitionToRemap() {\n if (this.tick <= 50) {\n this.tutorial.alpha -= 0.02;\n this.fireToContinue.alpha -= 0.02;\n }\n else if (this.tick <= 100) {\n this.remapHeaderText.alpha += 0.02;\n this.remapKB.alpha += 0.02;\n this.remapButtonText.alpha += 0.02;\n }\n else {\n this.state = 4;\n this.tick = 0;\n this.remapPressText.alpha = 1;\n }\n }", "function moveLeft(){\r\n //defines the position in pixels of the character (parsing it to make it an int rather than a string)\r\n //we are defining position based on its left value but you could from right as well/instead\r\n let position = parseInt(window.getComputedStyle(character).getPropertyValue(\"left\"));\r\n //logging the position in the console\r\n console.log(position)\r\n //moving the character to the left by 5 pixels.\r\n character.style.left = position - 5 + \"px\";\r\n}", "function move(e){\n square[currentIndex].classList.remove('snake') // removing snake from the grid\n\n if(e.keyCode === 39){\n direction = 1// going right\n } else if(e.keyCode === 38){\n direction = -width// going up\n } else if(e.keyCode===37){\n direction = -1// going left\n } else if(e.keyCode===40){\n direction = +width// doing down\n }\n }", "function control(e) {\r\n squares[currentIndex].classList.remove(\"snake\") //REMOVES THE CLASS OF SNAKE\r\n\r\n if (e.keyCode === 39){\r\n direction = 1 // RIGHT ARROW MOVES SNAKE RIGHT 1 DIV\r\n } else if (e.keyCode === 38){\r\n direction = -width // UP ARROW MOVES SNAKE UP BY MAKING SNAKE GO BACK 10 DIVS\r\n } else if(e.keyCode === 37){\r\n direction = -1 // LEFT ARROW MOVES SNAKE LEFT 1 DIV\r\n } else if(e.keyCode === 40){\r\n direction = +width //DOWN MOVES SNAKE DOWN BY 10 DIVS FROM CURRENT POSITION \r\n }\r\n }", "move(direction) {\n if (direction === 'left') this.x -= 101; // Step left\n if (direction === 'up') this.y -= 85; // Step up\n if (direction === 'right') this.x += 101; // Step right\n if (direction === 'down') this.y += 85; // Step down\n }", "move () {\n let row = this.ant.position.row;\n let col = this.ant.position.col;\n\n // turn the ant.\n // if the current cell is white, then turn clockwise. Else anti-clockwise.\n this.ant.turn(this.isWhite(row, col));\n // flip the color the current cell\n this.flip(row, col);\n // move the ant one step\n this.ant.move(this.grid);\n // update the size of the grid so that it fits the ants position\n this.ensureFit(this.ant.position);\n }", "function move(e) {\n var keynum;\n\n if (window.event) { // IE \n keynum = e.keyCode;\n } else if (e.which) { // Netscape/Firefox/Opera \n keynum = e.which;\n }\n\n\n if (!win) {\n if (keynum == 68) {\n updatePosition(2, \"right\"); //Moving right\n\n }\n //left\n if (keynum == 65) {\n updatePosition(2, \"left\"); //Moving left\n\n }\n //up\n if (keynum == 87) {\n updatePosition(2, \"up\"); //Moving up\n\n }\n //down\n if (keynum == 83) {\n updatePosition(2, \"down\"); //Moving down\n\n }\n }\n\n checkWin(); //Check if the player has won\n requestAnimationFrame(drawCanvas);\n}", "function movePlayer() {\r\n if (terminalState == false) {\r\n player.speed = 4;\r\n if(keys[87] ){\r\n moveUp();\r\n movementKeyAnimation(1,1);\r\n }\r\n if(keys[65] ){\r\n moveLeft();\r\n movementKeyAnimation(2,1);\r\n }\r\n if(keys[83] ){\r\n moveDown();\r\n movementKeyAnimation(2,2);\r\n }\r\n if(keys[68] ){\r\n moveRight();\r\n movementKeyAnimation(2,3);\r\n }\r\n }else if(terminalState == true){\r\n player.speed = 0;\r\n }\r\n}", "function changeDirection(e) {\n if (e.keyCode === 39 || e.keyCode === 68) {\n if (gameState.direction === \"left\") {\n return;\n }\n gameState.direction = \"right\";\n }\n if (e.keyCode === 37 || e.keyCode === 65) {\n if (gameState.direction === \"right\") {\n return;\n }\n gameState.direction = \"left\";\n }\n if (e.keyCode === 38 || e.keyCode === 87) {\n if (gameState.direction === \"down\") {\n return;\n }\n gameState.direction = \"up\";\n }\n if (e.keyCode === 40 || e.keyCode === 83) {\n if (gameState.direction === \"up\") {\n return;\n }\n gameState.direction = \"down\";\n }\n if (e.keyCode === 82) {\n init();\n }\n}", "function onKeyPress(e) {\r\n if (e.charCode == 119) { // W\r\n camera.move(0);\r\n } else if (e.charCode == 115) { // S\r\n camera.move(1);\r\n }\r\n }", "function setMovement(keys) {\r\n switch (keys) {\r\n case \"ArrowUp\":\r\n\r\n inputDirection.x = 0;\r\n inputDirection.y = -1;\r\n break;\r\n case \"ArrowDown\":\r\n\r\n inputDirection.x = 0;\r\n inputDirection.y = 1;\r\n break;\r\n case \"ArrowLeft\":\r\n\r\n inputDirection.x = -1;\r\n inputDirection.y = 0;\r\n break;\r\n case \"ArrowRight\":\r\n\r\n inputDirection.x = 1;\r\n inputDirection.y = 0;\r\n break;\r\n case \"Enter\":\r\n inputDirection.x = 0;\r\n inputDirection.y = 0;\r\n break;\r\n }\r\n\r\n}", "move(movement) {\n this.position.add(movement);\n // if(this.a){\n this._render(this.running[this.x]);\n\n if(this.a){\n this.x++;\n if(this.x>5){\n this.x = 0;\n }\n }\n this.a =!this.a;\n // }\n // this.a = !this.a;\n }", "function keyCommandTransposeCharacters(editorState) {\n\t var selection = editorState.getSelection();\n\t if (!selection.isCollapsed()) {\n\t return editorState;\n\t }\n\n\t var offset = selection.getAnchorOffset();\n\t if (offset === 0) {\n\t return editorState;\n\t }\n\n\t var blockKey = selection.getAnchorKey();\n\t var content = editorState.getCurrentContent();\n\t var block = content.getBlockForKey(blockKey);\n\t var length = block.getLength();\n\n\t // Nothing to transpose if there aren't two characters.\n\t if (length <= 1) {\n\t return editorState;\n\t }\n\n\t var removalRange;\n\t var finalSelection;\n\n\t if (offset === length) {\n\t // The cursor is at the end of the block. Swap the last two characters.\n\t removalRange = selection.set('anchorOffset', offset - 1);\n\t finalSelection = selection;\n\t } else {\n\t removalRange = selection.set('focusOffset', offset + 1);\n\t finalSelection = removalRange.set('anchorOffset', offset + 1);\n\t }\n\n\t // Extract the character to move as a fragment. This preserves its\n\t // styling and entity, if any.\n\t var movedFragment = getContentStateFragment(content, removalRange);\n\t var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward');\n\n\t // After the removal, the insertion target is one character back.\n\t var selectionAfter = afterRemoval.getSelectionAfter();\n\t var targetOffset = selectionAfter.getAnchorOffset() - 1;\n\t var targetRange = selectionAfter.merge({\n\t anchorOffset: targetOffset,\n\t focusOffset: targetOffset\n\t });\n\n\t var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n\n\t var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n\n\t return EditorState.acceptSelection(newEditorState, finalSelection);\n\t}" ]
[ "0.69844955", "0.67858887", "0.67705536", "0.67487365", "0.66506577", "0.66484547", "0.654065", "0.6479425", "0.6444482", "0.6443363", "0.64170367", "0.64132804", "0.63788944", "0.6371097", "0.63512313", "0.63495356", "0.6326806", "0.6315239", "0.6291548", "0.6288259", "0.62805265", "0.62760293", "0.62632143", "0.62578684", "0.62509257", "0.6250473", "0.62440354", "0.6202785", "0.61933714", "0.61909455", "0.61897784", "0.6189471", "0.616712", "0.616403", "0.6161575", "0.6160662", "0.61585027", "0.6142592", "0.61214644", "0.6120975", "0.61207473", "0.6114888", "0.61146975", "0.6105683", "0.6105683", "0.6104852", "0.610154", "0.6099849", "0.60978067", "0.60950834", "0.6092321", "0.60903645", "0.6088848", "0.6076496", "0.60754156", "0.6072724", "0.6061621", "0.6057726", "0.60570467", "0.6047947", "0.60472095", "0.6047115", "0.60436237", "0.6037665", "0.60356295", "0.6025403", "0.60068333", "0.6005746", "0.6002233", "0.59999436", "0.59999436", "0.59999436", "0.59999436", "0.59999436", "0.59999436", "0.59999436", "0.59999436", "0.59999436", "0.5998316", "0.5996353", "0.5993991", "0.59922767", "0.5988784", "0.598585", "0.59792435", "0.597896", "0.5978268", "0.59713507", "0.5966253", "0.59637904", "0.5954707", "0.59469914", "0.5941522", "0.59366816", "0.59354675", "0.59334886", "0.5928718", "0.59281796", "0.5927187", "0.5927045" ]
0.7941872
0
calling directional functions and changing the character state based on key presses (of the character isnt already that state)
function keyPressed(){ if (keyCode === RIGHT_ARROW){ char1.willStop = false; if (char1.state !== "right") char1.rightState(); } if (keyCode === LEFT_ARROW){ char1.willStop = false; if (char1.state !== "left") char1.leftState(); } if (keyCode === DOWN_ARROW){ char1.willStop = false; if (hadouken1.alive === false){ hadouken1.setStart(char1.charX, char1.charY); hadouken1.startTime = 0; hadouken1.lifeTime = 0; hadouken1.alive = true; //playing the sound effect char1.sound.play(); } if (char1.state !== "hadouken") char1.hadouken(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "keyPressed(){\n if(keyCode === 66) {\n this.b = !this.b;\n }\n if(keyCode === 68) {\n this.d = !this.d;\n }\n if(keyCode === 71) {\n this.g = !this.g;\n }\n if(keyCode === 80) {\n this.p = !this.p;\n }\n if(keyCode === 83) {\n this.s = !this.s;\n }\n if(keyCode === 82) {\n this.r = !this.r;\n }\n\n }", "function changeDirection(e) {\n if (e.keyCode === 39 || e.keyCode === 68) {\n if (gameState.direction === \"left\") {\n return;\n }\n gameState.direction = \"right\";\n }\n if (e.keyCode === 37 || e.keyCode === 65) {\n if (gameState.direction === \"right\") {\n return;\n }\n gameState.direction = \"left\";\n }\n if (e.keyCode === 38 || e.keyCode === 87) {\n if (gameState.direction === \"down\") {\n return;\n }\n gameState.direction = \"up\";\n }\n if (e.keyCode === 40 || e.keyCode === 83) {\n if (gameState.direction === \"up\") {\n return;\n }\n gameState.direction = \"down\";\n }\n if (e.keyCode === 82) {\n init();\n }\n}", "function keyPressed(){\n if(key == '1'){\n state = coitstate;\n }\n \n\n else if(key == '2'){\n state = bridgestate;\n }\n \n else if(key == '3') {\n state = cliffstate;\n }\n \n else if(key == '4'){\n state = pagotastate;\n }\n \n else if(key == '5'){\n state = deyoungstate;\n }\n \n else if(key == '6'){\n state = flowerstate;\n }\n \n}", "function onKeyDown(event){\n \n //keyboard events\n switch(event.keyCode){\n case 48:\n case 96:\n lookUp = true;\n break;\n case 38: //up\n case 87: //w\n console.log('w');\n moveForward = true;\n break;\n case 37: //left\n case 65: //a\n moveLeft = true;\n break;\n case 40: //down \n case 83: //s\n moveBackward = true;\n break;\n case 39: //right\n case 68: //d\n moveRight = true;\n break;\n }//end switch\n}", "function keyPressed() {\n\n // LEFT_ARROW, makes gameChar turn left\n if ( keyCode == 37 ) {\n isLeft = true;\n \n // RIGHT_ARROW, makes gameChar turn right\n } else if ( keyCode == 39 ) {\n isRight = true;\n \n // BACKSPACE, makes a new game start when gameChar is dead or level is complete\n } else if ( keyCode == 32 && ( isGameOver || isLevelComplete ) ) {\n isNewGame = true;\n loop();\n \n // BACKSPACE, makes gameChar jump when gameChar is on the floor and flagpole hasn't been reached\n } else if ( keyCode == 32 && !isFalling && !isLevelComplete ) {\n hasJumped = true;\n }\n \n // Logs values to the console if `DEBUG` and `DEBUG_KEY_PRESSES` are set to `true`\n debug_KeyPresses();\n}", "function onKeyDown(event) {\n if (event.keyCode == 90) { // z\n controls.resetSensor();\n }\n if (event.keyCode == 87) {\n walking = true;\n }\n}", "function direction(event)\r\n{\r\n const LEFT_KEY = 37;\r\n const RIGHT_KEY = 39;\r\n const UP_KEY = 38;\r\n const DOWN_KEY = 40;\r\n //const PAUSE_KEY = 37;\r\n if(changing_direction)\r\n return;\r\n changing_direction = true;\r\n const key_pressed = event.keyCode;\r\n const goingUp = dy === -10;\r\n const goingDown = dy === 10;\r\n const goingRight = dx === 10;\r\n const goingLeft = dx === -10;\r\n\r\n if(key_pressed === LEFT_KEY && !goingRight)\r\n {\r\n dx = -10;\r\n dy = 0;\r\n }\r\n if(key_pressed === UP_KEY && !goingDown)\r\n {\r\n dx = 0;\r\n dy = -10;\r\n }\r\n\r\n if(key_pressed === RIGHT_KEY && !goingLeft)\r\n {\r\n dx = 10;\r\n dy = 0;\r\n }\r\n if(key_pressed === DOWN_KEY && !goingUp)\r\n {\r\n dx = 0;\r\n dy = 10;\r\n }\r\n}", "function keyPressed() {\n\tif(keyCode == UP_ARROW && (this.last_moving_direction!==DOWN_ARROW) ) {\n\t\t\ts.dir(0, -1);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.y += s.yspeed*diffLevel;\n\t} else if(keyCode == DOWN_ARROW && (this.last_moving_direction!==UP_ARROW)) {\n\t\t\ts.dir(0, 1);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.y += s.yspeed*diffLevel;\n\t}else if(keyCode == RIGHT_ARROW && (this.last_moving_direction!==LEFT_ARROW)) {\n\t\t\ts.dir(1, 0);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.x += s.xspeed*diffLevel;\n\t}else if(keyCode == LEFT_ARROW && (this.last_moving_direction!==RIGHT_ARROW)) {\n\t\t\ts.dir(-1, 0);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.x += s.xspeed*diffLevel;\n\t}\n}", "function keyUp(code, char) {\r\n\t//debugOut(\"key up, code=\"+code+\" char=\"+char);\r\n\tif (code == 87) {\t\t// If the user releases the 'W' key...\r\n\t\tmoveUp = false;\r\n\t\tyInc = 0;\r\n\t}\r\n\tif (code == 83) {\t\t// If the user releases the 'S' key...\r\n\t\tmoveDown = false;\r\n\t\tyInc = 0;\r\n\t}\r\n\tif (code == 68) {\t\t// If the user releases the 'D' key...\r\n\t\tmoveRight = false;\r\n\t\txInc = 0;\r\n\t}\r\n\tif (code == 65) {\t\t// If the user releases the 'A' key...\r\n\t\tmoveLeft = false;\r\n\t\txInc = 0;\r\n\t}\r\n}", "handleKeys() {\n this.xMove = 0;\n\t\tthis.yMove = 0;\n if (keyIsDown(65)) this.xMove += -this.speed;\n if (keyIsDown(68)) this.xMove += this.speed;\n //s\n if (keyIsDown(83)) this.yMove += this.speed;\n //w\n if (keyIsDown(87)) this.yMove += -this.speed;\n\n if (keyIsDown(32)) {\n this.placeBomb();\n }\n\n }", "function onKeyUp(event){\n \n //keyboard events\n switch(event.keyCode){\n case 48:\n case 96:\n lookUp = false;\n break;\n case 38: //up\n case 87: //w\n console.log('w');\n moveForward = false;\n break;\n case 37: //left\n case 65: //a\n moveLeft = false;\n break;\n case 40: //down \n case 83: //s\n moveBackward = false;\n break;\n case 39: //right\n case 68: //d\n moveRight = false;\n break;\n }//end switch\n}//end onKeyUp", "function keyPressed() {\n if (keyCode === UP_ARROW){\n s.dir(0,-1);\n } else if (keyCode === DOWN_ARROW) {\n s.dir(0,1);\n } else if (keyCode === RIGHT_ARROW) {\n s.dir(1,0);\n } else if (keyCode === LEFT_ARROW) {\n s.dir(-1,0)\n }\n}", "function keyPressed() {\n if (keyCode === RIGHT_ARROW && snakeDiraction != 'l') {\n snakeDiraction = 'r';\n }\n\n if (keyCode === LEFT_ARROW && snakeDiraction != 'r') {\n snakeDiraction = 'l';\n\n }\n\n if (keyCode === DOWN_ARROW && snakeDiraction != 'u') {\n snakeDiraction = 'd';\n }\n\n if (keyCode === UP_ARROW && snakeDiraction != 'd') {\n snakeDiraction = 'u';\n }\n}", "function changeDirection(keycode) {\n\tif(keycode == 37 && direction != 'right') { directionQueue = 'left'; }\n\telse if(keycode == 38 && direction != 'down') { directionQueue = 'up'; }\n\telse if(keycode == 39 && direction != 'left') { directionQueue = 'right'; }\n\telse if(keycode == 40 && direction != 'up') { directionQueue = 'down' }\n}", "function Update() \n{\n\t// Save the state in playing now.\n stateInfo = chrAnimator.GetCurrentAnimatorStateInfo(0);\n\n\t// character moves\n\tvar h : float = Input.GetAxis(\"Horizontal\");\n\tvar v : float = Input.GetAxis(\"Vertical\");\n\tvar axisInput : Vector3 = Vector3(h, 0, v);\n\n\tvar moveSpeed : float = (h*h+v*v) * 0.25;\n\tif(Input.GetButton(\"Fire2\"))\tmoveSpeed += 0.75;\t// for Run\n\n\tchrAnimator.SetFloat(\"Speed\", moveSpeed);\n\n\t// character rotate\n\tif(h + v != 0){\n\t\tif(stateInfo.IsTag(\"InMove\") || stateInfo.IsTag(\"InJump\")){\n\t\t\taxisInput = Camera.main.transform.rotation * axisInput;\n\t\t\taxisInput.y = 0;\n\t\t\ttransform.forward = axisInput;\n\t\t}\n\t}\n\t//transform.Rotate(0, h * rotateSpeed, 0);\n\t\n\t// Bool parameter reset to false. \n\tif(!stateInfo.IsTag(\"InIdle\")){\n\t\tchrAnimator.SetBool(\"LookAround\", false);\n\t\tchrAnimator.SetBool(\"Attack\", false);\n\t\tchrAnimator.SetBool(\"Jiggle\", false);\n\t\tchrAnimator.SetBool(\"Dead\", false);\n\t}\n\n\t// reaction of key input.\n\t// for Attack\n\tif(Input.GetButtonDown(\"Fire1\"))\tchrAnimator.SetBool(\"Attack\", true);\n \n\t// LookAround\n\tif(Input.GetKeyDown(\"z\"))\tchrAnimator.SetBool(\"LookAround\", true);\n\t// Jiggle\n\tif(Input.GetKeyDown(\"x\"))\tchrAnimator.SetBool(\"Jiggle\", true);\n\n\t// Happy!!\n\tif(Input.GetKeyDown(\"c\"))\n\t{\n\t\tchrAnimator.SetBool(\"Happy\", !chrAnimator.GetBool(\"Happy\"));\n\t\tif(chrAnimator.GetBool(\"Happy\") == true)\tchrAnimator.SetBool(\"Sad\", false);\n\t}\n\t// Sad\n\tif(Input.GetKeyDown(\"v\"))\n\t{\n\t\tchrAnimator.SetBool(\"Sad\", !chrAnimator.GetBool(\"Sad\"));\n\t\tif(chrAnimator.GetBool(\"Sad\") == true)\tchrAnimator.SetBool(\"Happy\", false);\n\t}\n\t\n\t// for Dead\n\tif(Input.GetKeyDown(\"b\"))\tchrAnimator.SetBool(\"Dead\", true );\n\n\t// for Jump\n\t// while in jump, I am using Character Controller instead Root Motion, to move the Character.\n\t// in ground.\n\tif(chrController.isGrounded){\n // jump parameter set to false.\n\t\tchrAnimator.SetInteger(\"Jump\", 0);\n // moveDirection set 0, to prevent to move by Character controller.\n\t\tmoveDirection = Vector3.zero;\n // press Jump button. make jump\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n\t}\n // While in Air\n else if(!chrController.isGrounded){\n // press Jump button. can jump once more.\n\t\tif(Input.GetButtonDown(\"Jump\")){\n\t\t\tSetJump();\n\t\t}\n // It is moved with Character Controller while in the air,\n // moveDirection is use Axis Input.\n\t\tmoveDirection = Vector3(axisInput.x * 4, moveDirection.y, axisInput.z * 4);\n\t\tmoveDirection.y -= gravity * Time.deltaTime;\n\t}\n\n // character is move by moveDirection.\n\tchrController.Move(moveDirection * Time.deltaTime);\n}", "function updateDirection() {\n document.addEventListener('keydown', function(event) {\n\n if (event.keyCode == 38 && !down) { \n up = true;\n down = false;\n left = false;\n right = false;\n } // up\n else if (event.keyCode == 40 && !up) { \n up = false;\n down = true;\n left = false;\n right = false;\n } // down\n else if (event.keyCode == 37 && !right) { \n up = false;\n down = false;\n left = true;\n right = false;\n } // left\n else if (event.keyCode == 39 && !left) {\n up = false;\n down = false;\n left = false;\n right = true;\n } // right\n \n }); // snake's current direction\n}", "function setMovement(keys) {\r\n switch (keys) {\r\n case \"ArrowUp\":\r\n\r\n inputDirection.x = 0;\r\n inputDirection.y = -1;\r\n break;\r\n case \"ArrowDown\":\r\n\r\n inputDirection.x = 0;\r\n inputDirection.y = 1;\r\n break;\r\n case \"ArrowLeft\":\r\n\r\n inputDirection.x = -1;\r\n inputDirection.y = 0;\r\n break;\r\n case \"ArrowRight\":\r\n\r\n inputDirection.x = 1;\r\n inputDirection.y = 0;\r\n break;\r\n case \"Enter\":\r\n inputDirection.x = 0;\r\n inputDirection.y = 0;\r\n break;\r\n }\r\n\r\n}", "handleMovement(keycode){\n\t\t\tif (this.currDirection === \"up\" && keycode === \"down\") {\n\t \t\t return;\n\t \t} \n\t \telse if (this.currDirection === \"right\" && keycode === \"left\") {\n\t \t\treturn;\n\t \t} \n\t \telse if (this.currDirection === \"down\" && keycode === \"up\") {\n\t \t\treturn;\n\t \t\t } \n\t \telse if (this.currDirection === \"left\" && keycode === \"right\") {\n\t \t\treturn;\n\t \t}\n\t \telse if(keycode === \"space\"){\n\t \t\tif(!gameStarted){\n\t \t\t\tupdate();\n\t \t\t}\n\t \t\treturn;\t\n\t \t}\n\t \t\tthis.nextDirection = keycode;\n\n\t\t}", "function initKeyboardControls() {\n //detect when key is pressed\n window.addEventListener('keydown', function (e) {\n //get the key the user pressed\n //and convert it to lowercase\n //in case if the users keyboard\n //has capsLock on\n let keyPressed = e.key.toLowerCase();\n //we only save the state of key press\n //actually update of positions happens in movebird\n if(keyPressed === \"a\" || keyPressed === \"arrowleft\") mvL = true;\n if(keyPressed === \"d\" || keyPressed === \"arrowright\") mvR = true;\n if (keyPressed === \" \" || keyPressed === \"w\") mvU = true;\n\n });\n\n //detect when key is no longer pressed\n window.addEventListener('keyup', function (e) {\n let keyPressed = e.key.toLowerCase();\n\n if(keyPressed === \"a\" || keyPressed === \"arrowleft\") mvL = false;\n if(keyPressed === \"d\" || keyPressed === \"arrowright\") mvR = false;\n if (keyPressed === \" \" || keyPressed === \"w\") mvU = false;\n\n });\n}", "function keyup(evt) {\r\n // Get the key code\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\r\n break;\r\n }\r\n}", "function keyup(evt) {\r\n // Get the key code\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\r\n break;\r\n }\r\n}", "function getKey(event){\n\n var char = event.which || event.keyCode;\n var letter = String.fromCharCode(char);\n\n if(letter == \"w\"){\n up(squid[player]);\n movement = \"up\";\n }\n if (letter == \"s\"){\n down(squid[player]);\n movement = \"down\";\n }\n if (letter == \"a\"){\n left(squid[player]);\n movement = \"left\"\n }\n if (letter == \"d\"){\n right(squid[player]);\n movement = \"right\"\n }\n\n // Manually Switch which object is the \"player\"\n /* if (letter == \"n\"){\n player += 1;\n if (player >= squid.length){\n player = 0;\n }\n }*/\n\n }", "keyPressed(keyChar) {\n // go through each row, look for a match to the current state\n for (let i = 0; i < this.interactionTable.getRowCount(); i++) {\n\n // the .name property of a function will convert function to string for comparison\n if(this.currentStateName === this.interactionTable.getString(i, 'CurrentState') ) {\n // now, look for a match with the key typed, converting it to a string\n if( this.interactionTable.getString(i, 'KeyTyped') === String(keyChar) ) {\n // if a match, set the drawFunction to the next state, eval() converts\n // string to function\n this.changeState(this.interactionTable.getString(i, 'NextState') );\n break;\n }\n }\n }\n }", "function addDirectionalKeyCode(which) {\r\n DirectionalKeyCodes[which] = 1;\r\n}", "function addDirectionalKeyCode(which) {\r\n DirectionalKeyCodes[which] = 1;\r\n}", "function move_car(e)\n{\n switch(e.keyCode)\n {\n case 37:\n //left key pressed\n blueone.next_pos();\n break;\n\n case 39:\n //right key is presed\n redone.next_pos(); \n break;\n\n }\n}", "function keyup(evt) {\n // Get the key code\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"A\".charCodeAt(0):\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\n break;\n\n case \"D\".charCodeAt(0):\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\n break;\n }\n}", "function keyPressed() {\n if(keyCode === UP_ARROW && snake.xspeed !== 0) {\n snake.dir(0, -1);\n }\n else if(keyCode === DOWN_ARROW && snake.xspeed !== 0){\n snake.dir(0, 1);\n }\n else if(keyCode === RIGHT_ARROW && snake.yspeed !== 0){\n snake.dir(1, 0);\n }\n else if(keyCode === LEFT_ARROW && snake.yspeed !== 0){\n snake.dir(-1, 0);\n }\n}", "function keyPressed(){\n if (key == ' '){\n gridActive = !gridActive;\n }\n if (key == 'w' || key == 'W'){\n yVelocity -= 1;\n }\n if (key == 's' || key == 'S'){\n yVelocity += 1;\n }\n if (key == 'a' || key == 'A'){\n xVelocity -= 1;\n }\n if (key == 'd' || key == 'D'){\n xVelocity += 1;\n }\n}", "function keyPressed() {\n if (keyCode === UP_ARROW) {\n s.dir(0, -1);\n } else if (keyCode === DOWN_ARROW) {\n s.dir(0, 1);\n } else if (keyCode === RIGHT_ARROW) {\n s.dir(1, 0);\n } else if (keyCode === LEFT_ARROW) {\n s.dir(-1, 0);\n }\n}", "function addDirectionalKeyCode(which) {\n DirectionalKeyCodes[which] = 1;\n}", "function addDirectionalKeyCode(which) {\n DirectionalKeyCodes[which] = 1;\n}", "function addDirectionalKeyCode(which) {\n DirectionalKeyCodes[which] = 1;\n}", "function addDirectionalKeyCode(which) {\n DirectionalKeyCodes[which] = 1;\n}", "function addDirectionalKeyCode(which) {\n DirectionalKeyCodes[which] = 1;\n}", "function keyDown(code, char) {\r\n\t//debugOut(\"key press, code=\"+code+\" char=\"+char);\r\n\tif (code == 32) {\t\t\t// If the user presses spacebar...\r\n\t\tif (startCount == 1) {\t\t// And startCount is set to 1 (as in the game has started but meteors aren't hurdling)...\r\n\t\t\tgameStart = false;\t\t\t// End the game's starting menu.\r\n\t\t\tgamePlay = true;\t\t\t// Initialize the game itself.\r\n\t\t\tstartCount = 2;\t\t\t\t// Set the startCount to 2, starting the game properly.\r\n\t\t}\r\n\t}\r\n\tif (code == 87) {\t\t\t// If the user presses the 'W' key...\r\n\t\tmoveUp = true;\r\n\t\tmoveDown = false;\r\n\t} else if (code == 83) {\t// If the user presses the 'S' key...\r\n\t\tmoveUp = false;\r\n\t\tmoveDown = true;\r\n\t}\r\n\tif (code == 68) {\t\t\t// If the user presses the 'D' key...\r\n\t\tmoveRight = true;\r\n\t\tmoveLeft = false;\r\n\t} else if (code == 65) {\t// If the user presses the 'A' key...\r\n\t\tmoveRight = false;\r\n\t\tmoveLeft = true;\r\n\t}\r\n}", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n player.facing = facingDir.LEFT;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n\t\t\tplayer.facing = facingDir.RIGHT;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (player.isOnPlatform()||cheating) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n\r\n\t\tcase \"C\".charCodeAt(0):\r\n\t\t\tif (!cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 0.5, null);\r\n\t\t\t\tcheating = true;\r\n\t\t\t\tOLD_BCOUNT = BULLET_COUNT;\r\n\t\t\t\tBULLET_COUNT = Number.POSITIVE_INFINITY;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"V\".charCodeAt(0):\r\n\t\tif (cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 1, null);\r\n\t\t\t\tcheating = false;\r\n\t\t\t\tBULLET_COUNT = OLD_BCOUNT;\r\n\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"Q\".charCodeAt(0):\r\n\t\t\talert( player.position.x+ \", \"+ (player.position.y - 5) );\r\n\t\t\tbreak;\r\n\r\n\r\n\t\tcase 32:\r\n if (canShoot) shootBullet();\r\n break;\r\n }\r\n}", "function changeDirection(key){\n if(key == \"ArrowUp\" && (snakeDirection.x != 0 && snakeDirection != 1)){\n snakeDirection.x = 0;\n snakeDirection.y = -1;\n }else if(key == \"ArrowDown\" && (snakeDirection.x != 0 && snakeDirection != -1)){\n snakeDirection.x = 0;\n snakeDirection.y = 1;\n }else if(key == \"ArrowLeft\" && (snakeDirection.x != 1 && snakeDirection != 0)){\n snakeDirection.x = -1;\n snakeDirection.y = 0;\n }else if(key == \"ArrowRight\" && (snakeDirection.x != -1 && snakeDirection != 0)){\n snakeDirection.x = 1;\n snakeDirection.y = 0;\n }\n}", "onKeyPress(event) {\n let newDirection = directions.find(c => c.keyCode === event.keyCode);\n if (!newDirection) {\n return;\n }\n if (Math.abs(newDirection.keyCode - this.direction.keyCode) !== 2) {\n this.direction = newDirection;\n }\n }", "function userinput()\n{\n\twindow.addEventListener(\"keydown\", function (event) {\n\t\tif (event.defaultPrevented) {\n\t\t\treturn; // Do nothing if the event was already processed\n\t\t}\n\n\t\tswitch (event.key) {\n\t\t\tcase \"b\":\n\t\t\t\t// code for \" \" key press.\n\t\t\t\tif(baw==0)\n\t\t\t\t{\n\t\t\t\t\tbaw=1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbaw=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"l\":\n\t\t\t\t// code for \" \" key press.\n\t\t\t\tif(lighton==0)\n\t\t\t\t{\n\t\t\t\t\tlighton=1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlighton=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \" \":\n\t\t\t\t// code for \" \" key press.\n\t\t\t\tconsole.log(hoverbonus);\n\t\t\t\tif(hoverbonus>0)\n\t\t\t\t{\n\t\t\t\t\tend-=1;\n\t\t\t\t\thoverbonus-=1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowDown\":\n\t\t\t\t// code for \"down arrow\" key press.\n\t\t\t\tcharacter.tick(\"d\",ontrain);\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowLeft\":\n\t\t\t\t// code for \"left arrow\" key press.\n\t\t\t\tpol.tick(\"l\");\n\t\t\t\td.tick(\"l\");\n\t\t\t\tcharacter.tick(\"l\",ontrain);\n\t\t\t\tif(character.getpos()[0]==-6)\n\t\t\t\t{\n\t\t\t\t\tdead=1;\n\t\t\t\t\tend+=1;\n\t\t\t\t\tpol.tick(\"r\");\n\t\t\t\t\td.tick(\"r\");\n\t\t\t\t\tcharacter.tick(\"r\",ontrain);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowRight\":\n\t\t\t\t// code for \"right arrow\" key press.\n\t\t\t\tpol.tick(\"r\");\n\t\t\t\td.tick(\"r\");\n\t\t\t\tcharacter.tick(\"r\",ontrain);\n\t\t\t\tif(character.getpos()[0]==6)\n\t\t\t\t{\n\t\t\t\t\tdead=1;\n\t\t\t\t\tend+=1;\n\t\t\t\t\tpol.tick(\"l\");\n\t\t\t\t\td.tick(\"l\");\n\t\t\t\t\tcharacter.tick(\"l\",ontrain);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn; // Quit when this doesn't handle the key event.\n\t\t}\n\n\t\t// Cancel the default action to avoid it being handled twice\n\t\tevent.preventDefault();\n\t}, true);\n\t// the last option dispatches the event to the listener first,\n\t// then dispatches event to window\n}", "onKeyPressed(keyCode, event) {\n switch (keyCode) {\n case cc.KEY.a:\n case cc.KEY.left:\n self.accLeft = true;\n self.accRight = false;\n break;\n case cc.KEY.d:\n case cc.KEY.right:\n self.accLeft = false;\n self.accRight = true;\n break;\n }\n }", "function keyPressed() {\n\tswitch (keyCode){\n\t\tcase LEFT_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\t\n\t\t\tsnake.setDir(-1, 0);\n\t\t\tbreak;\n\t\t\t\n\n\t\tcase RIGHT_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\t\n\t\t\tsnake.setDir(1, 0);\n\t\t\tbreak;\n\t\t\t\n\n\t\tcase DOWN_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\n\t\t\t\n\t\t\tsnake.setDir(0, 1)\n\t\t\tbreak;\n\t\t\t\n\t\tcase UP_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\t\n\t\t\tsnake.setDir(0, -1)\n\t\t\tbreak;\n\t\t\t\n\t\tdefault:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\tbreak;\n\t}\n}", "function keyPressed () {\n // restart the game if space is pressed on either overlay\n if (keyCode === 32 && !isGameRunning) {\n lives = maxLives;\n startGame();\n return; // prevent the character from jumping when we restart the game\n }\n\n if (!isGameRunning) {\n return; // don't handle any other input\n }\n\n // 37 -> left arrow\n if (keyCode === 37) {\n character.isLeft = true;\n }\n\n // 39 -> right arrow\n if (keyCode === 39) {\n character.isRight = true;\n }\n\n // 32 -> space, 38 -> up arrow\n // character can only jump when they're on the ground!\n if ([32, 38].includes(keyCode) && character.y === world.floor) {\n jump(character);\n playSound('jump', 0.8);\n }\n\n // 16 -> shift\n // toggle debug mode on and off\n if (keyCode === 16) {\n debug = !debug;\n }\n}", "function keyPressed(){\n\tif(keyCode === UP_ARROW){\n\t\ts.dir(0, -1);\n\t}else if(keyCode === DOWN_ARROW){\n\t\ts.dir(0, 1);\n\t}else if(keyCode === RIGHT_ARROW){\n\t\ts.dir(1, 0);\n\t}else if(keyCode === LEFT_ARROW){\n\t\ts.dir(-1, 0);\n\t}\n}", "function onKeyDown(key_pressed) {\n if (key_pressed === ARROW_DOWN && snake.direction !== UP) {\n snake.direction = DOWN;\n }\n if (key_pressed === ARROW_UP && snake.direction !== DOWN) {\n snake.direction = UP;\n } \n if (key_pressed === ARROW_RIGHT && snake.direction !== LEFT) { \n snake.direction = RIGHT;\n }\n if (key_pressed === ARROW_LEFT && snake.direction !== RIGHT) { \n snake.direction = LEFT;\n } \n}", "function keyPressed(e){\n\t\tif(e.key==\"ArrowRight\"){\n\t\t\tsnake.direction=\"right\";\n\t\t}\n\t\telse if(e.key==\"ArrowLeft\"){\n\t\t\tsnake.direction=\"left\";\n\t\t}\n\t\telse if(e.key==\"ArrowDown\"){\n\t\t\tsnake.direction=\"down\";\n\t\t}\n\t\telse if(e.key==\"ArrowUp\"){\n\t\t\tsnake.direction=\"up\" ;\n\t\t}\n\t\tconsole.log(snake.direction);\n\t}", "function keyPressed() {\n // if players are in gameplay or game over screen\n if (state === \"PLAY\" || state === \"END\") {\n // if the message is updating\n if (textBox.update) {\n // textBox.fullText();\n // skip text animation for the developer :)\n // could be a feature but sometimes player will miss the message entirely if the message is too short\n } else {\n // if there's a second message\n if (textBox.bufferText != null) {\n // show the second message\n textBox.insertBuffer();\n return;\n // if no, hide the message when the animation is finished\n } else {\n if (textBox.showing) {\n textBox.hide();\n return;\n }\n }\n // if in gameplay and not examining a close object\n if (state === \"PLAY\" && !closeObjShowing) {\n // pressing arrowkeys will change background\n currentDir = gameBackground.dir; // store current facing direction\n // UP\n if (keyCode === UP_ARROW) {\n // if player is facing down, go to the last direction\n if (currentDir === 4) {\n currentDir = gameBackground.lastDir;\n gameBackground.changeDirTo(currentDir);\n } else {\n // if player isn't facing up, go face up\n if (currentDir != 5) {\n currentDir = 5;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers(); // update object trigger areas\n // DOWN\n } else if (keyCode === DOWN_ARROW) {\n // if player is facing up, go to the last dir\n if (currentDir === 5) {\n currentDir = gameBackground.lastDir;\n gameBackground.changeDirTo(currentDir);\n } else {\n // if not facing down, go face down\n if (currentDir != 4) {\n currentDir = 4;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n // LEFT\n } else if (keyCode === LEFT_ARROW) {\n // if player is facing up or down, don't change\n if (currentDir != 4 && currentDir != 5) {\n // change direction from 0 to 3 and then back to 0\n if (currentDir < 3) {\n currentDir++;\n gameBackground.changeDirTo(currentDir);\n } else if (currentDir === 3) {\n currentDir = 0;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n // RIGHT\n } else if (keyCode === RIGHT_ARROW) {\n if (currentDir != 4 && currentDir != 5) {\n // change direction from 3 to 0 and then back to 3\n if (currentDir > 0) {\n currentDir--;\n gameBackground.changeDirTo(currentDir);\n } else if (currentDir === 0) {\n currentDir = 3;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n }\n }\n }\n }\n}", "function keyPressed() {\n\n // Move player one to the left if letter A is pressed\n if (key == 'A' || key == 'a') {\n playerOne.move(-1);\n }\n \n // And so on...\n if (key == 'D' || key == 'd') {\n playerOne.move(1);\n } \n\n if (key == 'J' || key == 'j') {\n playerTwo.move(-1);\n }\n \n if (key == 'L' || key == 'l') {\n playerTwo.move(1);\n }\n\n // if (key == 'W' || key == 'w') {\n // this.gameState = \"FIRED\";\n // console.log (\"playOne Fired\");\n // console.log (\"Move to FIRED state\")\n // } else {\n // this.gameState = \"PACE\"\n // }\n \n // if (key == 'I' || key == 'i') {\n // this.gameState = \"FIRED\"\n // console.log (\"playerTwo Fired\");\n // console.log (\"Move to FIRED state\")\n // } else {\n // this.gameState = \"PACE\"\n // }\n\n // When you press the letter R, the game resets back to the play state\n if (key == 'R' || key == 'r') {\n controller.gameState = \"PACE\";\n }\n }", "function changeDirection(e) {\n if (e.keyCode == 37) {\n direction = 0;\n console.log(\"direction is left:\" + direction);\n updateSnakeList();\n } else if (e.keyCode == 38) {\n direction = 1;\n console.log(\"direction is up:\" + direction)\n } else if (e.keyCode == 39) {\n direction = 2;\n console.log(\"direction is right :\" + direction)\n } else if (e.keyCode == 40) {\n direction = 3;\n console.log(\"direction is down :\" + direction)\n }\n }", "function initKeys() {\n document.addEventListener(\"keydown\", function(e) {\n if (e.keyCode === 39)\n //arrow right, move right\n baseBlock.dir = 1;\n else if (e.keyCode === 37)\n //arrow left, move left\n baseBlock.dir = -1;\n else if (e.keyCode === 72)\n //h button to show directions\n window.alert(\"Need help? Here's how to play- space bar to start, right arrow to move bar right, left arrow to\" +\n \" move bar left, up arrow to make it speedy, and down arrow to slow it back down\");\n else if (e.keyCode === 38)\n //arrow up, speed up, make it harder\n ball.velocity.x += 100;\n else if (e.keyCode === 40)\n //arrow down\n ball.velocity.x = 10;\n else if (e.keyCode === 32 && game.state === \"ready\") {\n //space bar\n ball.velocity.x += baseBlock.dir * 25;\n if (ball.velocity.x > width)\n ball.velocity.x = width;\n game.state = \"running\";\n }\n\n if (game.state === \"over\") {\n var doneMessage = document.getElementById(\"message\");\n doneMessage.parentNode.removeChild(doneMessage);\n game.state = \"ready\";\n }\n }, false);\n \n document.addEventListener(\"keyup\", function(e) {\n //stop motion when key is 'let go'\n\tif ((e.keyCode === 39 && baseBlock.dir === 1) ||\n\t (e.keyCode === 37 && baseBlock.dir === -1))\n \t baseBlock.dir = 0;\n }, false);\n}", "move(){\n\n this.charY = windowHeight - 200;\n if (this.state === \"right\") this.charX += 4;\n if (this.state === \"left\") this.charX -= 4;\n \n }", "function keyPressed() {\n if(keyCode === UP_ARROW) {\n \tsnake.direction(0,-1);\n }\n if(keyCode === DOWN_ARROW) {\n \tsnake.direction(0,1);\n }\n if(keyCode === LEFT_ARROW) {\n \tsnake.direction(-1,0);\n }\n if(keyCode === RIGHT_ARROW) {\n \tsnake.direction(1,0);\n }\n \n}", "function direction(event) {\r\n if (event.keyCode == 37 && dir != \"RIGHT\") {\r\n dir = \"LEFT\";\r\n } else if (event.keyCode == 38 && dir != \"DOWN\") {\r\n dir = \"UP\";\r\n } else if (event.keyCode == 39 && dir != \"LEFT\") {\r\n dir = \"RIGHT\";\r\n } else if (event.keyCode == 40 && dir != \"UP\") {\r\n dir = \"DOWN\";\r\n }\r\n }", "function keyPressed() {\n if (keyCode === UP_ARROW) {\n snake.dir(\"UP\");\n } else if (keyCode === DOWN_ARROW) {\n snake.dir(\"DOWN\");\n } else if (keyCode === LEFT_ARROW) {\n snake.dir(\"LEFT\");\n } else if (keyCode === RIGHT_ARROW) {\n snake.dir(\"RIGHT\");\n }\n}", "_onKeyDown(event) {\n switch (event.keyCode) {\n case 87: // w\n case 38: // up\n this.keys.forward = true;\n break;\n case 65: // a\n case 37: //left\n this.keys.left = true;\n break;\n case 83: // s\n case 40: //down\n this.keys.backward = true;\n break;\n case 68: // d\n case 39: //right\n this.keys.right = true;\n break;\n case 32: // SPACE\n this.keys.space = true;\n break;\n case 16: // SHIFT\n this.keys.run = true;\n break;\n }\n }", "function update(event) {\n if (event.keyCode == 37 && direcao != \"right\") direcao = \"left\";\n if (event.keyCode == 65 && direcao != \"right\") direcao = \"left\";\n if (event.keyCode == 38 && direcao != \"down\") direcao = \"up\";\n if (event.keyCode == 87 && direcao != \"down\") direcao = \"up\";\n if (event.keyCode == 39 && direcao != \"left\") direcao = \"right\";\n if (event.keyCode == 68 && direcao != \"left\") direcao = \"right\";\n if (event.keyCode == 40 && direcao != \"up\") direcao = \"down\";\n if (event.keyCode == 83 && direcao != \"up\") direcao = \"down\";\n}", "function whenKeyDown(k) {\r\n switch (k) {\r\n case \"2\":\r\n case \"x\": \r\n case \"s\":\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n moveDown();\r\n break;\r\n case \"8\":\r\n case \"w\": \r\n case \"Up\":\r\n case \"ArrowUp\":\r\n moveUp();\r\n break;\r\n case \"4\":\r\n case \"a\": \r\n case \"Left\":\r\n case \"ArrowLeft\":\r\n moveLeft();\r\n break;\r\n case \"6\":\r\n case \"d\": \r\n case \"Right\":\r\n case \"ArrowRight\":\r\n moveRight();\r\n break;\r\n case \"7\":\r\n case \"q\":\r\n moveUpLeft();\r\n break; \r\n case \"9\":\r\n case \"e\":\r\n moveUpRight();\r\n break; \r\n case \"1\":\r\n case \"z\":\r\n moveDownLeft();\r\n break; \r\n case \"3\":\r\n case \"c\":\r\n moveDownRight();\r\n break; \r\n case \" \":\r\n // pickup\r\n break;\r\n }\r\n}", "handleKeyPress(e) {\n\t\tconsole.log(e.keyCode);\n\n\t\tlet axis; // 0: x-axis, 1: y-axis, 2: z-axis\n\t\tlet direction; // Direction depends if number is positive or negative (ex: left or right, up or down, in or out)\n\n\t\t//This will ensure that one of the viewpoint releated to keyboard navigation is active, when a key is pressed \n\t\tif(document.getElementById('x3d_context').runtime.viewpoint()._DEF == \"over\"){\n\n\t\t}else if (e.keyCode === 87 || e.keyCode === 83 || e.keyCode === 65 ||\n\t\t\te.keyCode === 68 || e.keyCode === 81 || e.keyCode === 69) {\n\t\t\t\n\t\t\tlet currentIndex = this.state.rotationIndex-1;\n\t\t\tif(currentIndex==0){\n\t\t\t\tcurrentIndex = 4;\n\t\t\t}\n\t\t\tlet currentViewpoint = \"on\" + currentIndex;\n\t\t\t\n\t\t\tdocument.getElementById(currentViewpoint).setAttribute('set_bind','true');\n\t\t//This will reset the camera to the starting point\n\t\t}else if(e.keyCode === 82){\n\t\t\tlet initialPos = [-50.00000, -310.00000, -100.00000];\n\t\t\tthis.setState({pos: initialPos, rotationIndex: 2, in: 87, out: 83, left: 65, right: 68});\n\t\t\tdocument.getElementById(\"on1\").setAttribute('set_bind','true');\n\t\t}\n \t\n\t\t//Move in towards the screen\n\t\tif (e.keyCode === this.state.in) {\n\t\t\taxis = 1;\n\t\t\tdirection = 10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t//Move out from the screen\n\t\t} else if (e.keyCode === this.state.out) {\n\t\t\taxis = 1;\n\t\t\tdirection = -10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Left\n\t\t} else if (e.keyCode === this.state.left) {\n\t\t\taxis = 0;\n\t\t\tdirection = -10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Right\n\t\t} else if (e.keyCode === this.state.right) {\n\t\t\taxis = 0;\n\t\t\tdirection = 10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Down\n\t\t} else if (e.keyCode === 81) {\n\t\t\taxis = 2;\n\t\t\tdirection = -10;\n\t\t\tthis.moveDirection(axis, direction);\n\t\t\n\t\t// Move Up\n\t\t} else if (e.keyCode === 69) {\n\t\t\taxis = 2;\n\t\t\tdirection = 10;\n\t\t\tthis.moveDirection(axis, direction);\n\n\t\t// Rotate camera 90 degree around y-axis\n\t\t} else if ((e.keyCode === 16) && !(this.state.isButtonDisabled)) {\n\t\t\tthis.rotateCamera();\n\t\t\tthis.setState({ isButtonDisabled: true, });\n\t\t\tsetTimeout(() => this.setState({ isButtonDisabled: false }), 1200);\t\n\t\t}\n\t}", "function onKeyPressMove(event) {\r\n\tif (settings.isPlaying) {\r\n\t\tvar newDirection = directions[event.keyCode];\r\n\t\tvar newDirection2 = directions2[event.keyCode];\r\n\t\tif (newDirection !== undefined) {\r\n\t\t\tsnake.setDirection(newDirection);\r\n\t\t}\r\n\t\tif (newDirection2 !== undefined) {\r\n\t\t\tsnake2.setDirection(newDirection2);\r\n\t\t}\r\n\t}\r\n}", "function keyControl(event) {\n if (event.keyCode == 37 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveLeft();\n } else if (event.keyCode == 38 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.rotate();\n rotateSound.play();\n } else if (event.keyCode == 39 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveRight();\n } else if (event.keyCode == 40 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveDown();\n }\n }", "function onKeyDown(evt) {\n if (evt.keyCode == 81) Up1Pressed = true; //q\n else if (evt.keyCode == 65) Down1Pressed = true; //a\n // else if (evt.keyCode == 80) Up2Pressed = true; //p\n // else if (evt.keyCode == 76) Down2Pressed = true; //l\n}", "function keyPressed() {\n\n // If up arrow is pressed (player two)\n if (keyCode === UP_ARROW) {\n playerTwo.direction(0, -5);\n\n // if down arrow is pressed (player two)\n } else if (keyCode === DOWN_ARROW) {\n playerTwo.direction(0, 5);\n\n // if \"W\" is pressed (player one)\n } else if (keyCode === 87) {\n\n playerOne.direction(0, -5);\n\n // if \"S\" is pressed (player two)\n } else if (keyCode === 83) {\n\n playerOne.direction(0, 5);\n }\n}", "function checkKey(e) {\n\n e = e || window.event;\n\n if (e.keyCode == '38') {\n\tdirection = 1;\n\tmove();\n }\n else if (e.keyCode == '40') {\n\tdirection = 2;\n\tmove();\n }\n else if (e.keyCode == '37') {\n\tdirection = 3;\n\tmove();\n }\n else if (e.keyCode == '39') {\n\tdirection = 4\n\tmove();\n }\n\n}", "function keyPressed (){\n //KeyCode is built in variavle\n if(keyCode === UP_ARROW){\n snake.dir(0,-1);\n }else if (keyCode === DOWN_ARROW){\n snake.dir(0,1);\n }else if (keyCode === RIGHT_ARROW){\n snake.dir(1,0);\n }else if (keyCode === LEFT_ARROW){\n snake.dir(-1,0);\n }\n}", "function checkKeyPressUp(e)\r\n{\r\n\tcheckPlayer();\r\n\tif (e.which == 65 || e.keyCode == 65 || e.which == 68 || e.keyCode == 68 || e.which == 83 || e.keyCode == 83 || e.which == 32 || e.keyCode == 32)\r\n\t{\r\n\t\tif(PlayerFace == WALKING_RIGHT)\r\n\t\t{\r\n\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\trightKey = false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(PlayerFace == WALKING_LEFT)\r\n\t\t\t{\r\n\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\tleftKey = false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(PlayerFace == BLOCKING_LEFT)\r\n\t\t\t\t{\r\n\t\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\t\tblockKey = false;\r\n\t\t\t\t\t//positionY += 1;\r\n\t\t\t\t\tpositionX -= 1;\r\n\t\t\t\t\tplayerPos();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(PlayerFace == BLOCKING_RIGHT)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\t\t\t\tblockKey = false;\r\n\t\t\t\t\t\t//positionY += 1;\r\n\t\t\t\t\t\tpositionX += 5;\r\n\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(PlayerFace == ATTACKING_LEFT)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\t\t\t\tpositionX += 41;\r\n\t\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(PlayerFace == ATTACKING_RIGHT)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\t\t\t\t\t\tpositionX += 41;\r\n\t\t\t\t\t\t\t\tplayerPos();\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 control (e){\r\n if(e.keyCode ===37){\r\n moveLeft()\r\n \r\n }else if (e.keyCode === 38){\r\n rotate()\r\n }else if(e.keyCode=== 39){\r\n moveRight()\r\n }else if(e.keyCode===40){\r\n moveDown()\r\n }\r\n}", "function KeyDownFunc(e) {\r\n if (e.keyCode == 39) {\r\n right_pressed = true;\r\n } else if (e.keyCode == 37) {\r\n left_pressed = true;\r\n } else if (e.keyCode == 38) {\r\n up_pressed = true;\r\n } else if (e.keyCode == 40) {\r\n down_pressed = true;\r\n } else if (e.keyCode == 32) {\r\n space_pressed = true;\r\n }\r\n}", "function keyPressed(e) {\n if (e.keyCode == 90) {\n controlBlock.ascend = true;\n } else if (e.keyCode == 83) {\n controlBlock.descend = true;\n }\n\n if (e.keyCode == 38) {\n opponentBlock.ascend = true;\n } else if (e.keyCode == 40) {\n opponentBlock.descend = true;\n }\n}", "function activeKeyboard () {\n\t\t$(document).keydown(function(e) {\n\n\t\tvar key = e.which;\n\t\tif(key == \"38\" && direction!= \"down\") {\n\t\t\tif(press_acs == 1) {\n\t\t\t\tdirection = \"up\";\n\t\t\t\tpress_acs = 0; \n\t\t\t}\t\n\t\t} \n\t\telse if(key == \"39\" && direction!= \"left\") {\n\t\t\tif(press_acs == 1) {\n\t\t\t\tdirection = \"right\";\n\t\t\t\tpress_acs = 0; \n\t\t\t}\t\n\t\t}\n\t\telse if(key == \"40\" && direction!= \"up\") {\n\t\t\tif(press_acs == 1) {\n\t\t\t\tdirection = \"down\";\n\t\t\t\tpress_acs = 0; \n\t\t\t}\t\n\t\t}\n\t\telse if(key == \"37\" && direction!= \"right\") {\n\t\t\tif(press_acs == 1) {\n\t\t\t\tdirection = \"left\";\n\t\t\t\tpress_acs = 0; \n\t\t\t}\t\n\t\t}\t\n\t\t});\n\t}", "function setDirection(evt){\n\tvar charCode = (evt.which) ? evt.which : event.keyCode\n\tif (direction_lock) return;\n\telse if (charCode==37) direction( 0,-1);\n\telse if (charCode==39) direction( 0, 1);\n\telse if (charCode==38) direction(-1, 0);\n\telse if (charCode==40) direction( 1, 0);\n\tdirection_lock = true;\n}", "checkKey(e) {\n if (e.keyCode == '87') { //up\n console.log(\"UP key pressed.\")\n this.moveFrog(0, -10);\n }\n else if (e.keyCode == '83') { //down\n console.log(\"DOWN key pressed.\")\n this.moveFrog(0, 10);\n }\n else if (e.keyCode == '65') { //left\n console.log(\"LEFT key pressed.\")\n this.moveFrog(-10, 0)\n }\n else if (e.keyCode == '68') { //right\n console.log(\"RIGHT key pressed.\")\n this.moveFrog(10, 0);\n }\n }", "function onKeyUp(event) {\n\n switch (event.key) {\n\n case \"ArrowLeft\":\n moveLeft = false;\n break;\n case \"ArrowRight\":\n moveRight = false;\n break;\n \n default:\n break;\n\n } \n\n}", "initKeysPressed() {\n this.keysPressed[LEFT] = false;\n this.keysPressed[UP] = false;\n this.keysPressed[RIGHT] = false;\n this.keysPressed[DOWN] = false;\n }", "function keyUpHandler(e) {\n // If right arrow key is pressed\n if (e.keyCode === 39) {\n gameClass.rightPressed = false;\n // If left arrow key is pressed\n } else if (e.keyCode === 37) {\n gameClass.leftPressed = false;\n }\n\n // If 'a' key is pressed\n if (e.keyCode === 65) {\n gameClass.aPressed = false;\n // If 'd key is pressed\n } else if (e.keyCode === 68) {\n gameClass.dPressed = false;\n }\n}", "function setUpControl(){\n $(document).keydown( (e) => {\n switch (e.which) {\n case 27:\n if (gameStarted)\n togglePause()\n break\n case 37:\n case 65:\n if (!gameStarted || next.dir != RIGHT){\n next = { dir: LEFT, x: -1, y: 0 }\n startGame()\n }\n break\n case 38:\n case 87:\n if (!gameStarted || next.dir != DOWN){\n next = { dir: UP, x: 0, y: -1 }\n startGame()\n }\n break\n case 39:\n case 68:\n if (!gameStarted || next.dir != LEFT){\n next = { dir: RIGHT, x: 1, y: 0 }\n startGame()\n }\n break\n case 40:\n case 83:\n if (!gameStarted || next.dir != UP){\n next = { dir: DOWN, x: 0, y: 1 }\n startGame()\n }\n break\n }\n })\n}", "function keyPressed(e){\n\t\t//conditional statements\n\t\tif(e.key == \"ArrowRight\" && snake.direction != \"left\"){\n\t\t\tright.play();\n\t\t\tsnake.direction = \"right\";\n\t\t}\n\t\telse if(e.key == \"ArrowLeft\" && snake.direction != \"right\"){\n\t\t\tleft.play();\n\t\t\tsnake.direction = \"left\";\n\t\t}\n\t\telse if(e.key == \"ArrowDown\" && snake.direction != \"up\"){\n\t\t\tdown.play();\n\t\t\tsnake.direction = \"down\";\n\t\t}\n\t\telse if(e.key == \"ArrowUp\" && snake.direction != \"down\"){\n\t\t\tup.play();\n\t\t\tsnake.direction = \"up\";\n\t\t}\n\t\tconsole.log(snake.direction);\n\t}", "function keyPressed() {\n if (keyCode === UP_ARROW) {\n upPressed = true;\n } else if (keyCode === DOWN_ARROW) {\n downPressed = true;\n } else if (keyCode === LEFT_ARROW) {\n leftPressed = true;\n } else if (keyCode === RIGHT_ARROW) {\n rightPressed = true;\n } else if (keyCode === 32){\n spacePressed = true;\n fired = true\n }\n}", "function handleKeyDown(event) { \n switch (event.keyCode) { \n case 90 /* z */: \n fly.pitchIncUpdate=true;\n break; \n case 83 /* s */: \n fly.pitchDecUpdate=true;\n break; \n case 81 /* q */: \n fly.rollIncUpdate=true;\n break; \n case 68 /* d */: \n fly.rollDecUpdate=true;\n break; \n case 65 /* a */: \n fly.velocityDecUpdate=true;\n break; \n case 69 /* e */: \n fly.velocityIncUpdate=true;\n break; \n } \n}", "handleInput(pressedKey) {\n if ((pressedKey === 'left' && this.x > 0) ||\n (pressedKey === 'up' && this.y > -25) ||\n (pressedKey === 'right' && this.x < 404) ||\n (pressedKey === 'down' && this.y < 400)) {\n this.wantsToMove = true;\n this.direction = pressedKey;\n }\n }", "function keysPressed(e){\n //store an entry for every key pressed\n keys[e.keyCode] = true;\n //left key pressed\n if ((keys[37]) && canMove(player.x-1, player.y)){\n player.x--;\n }\n //right key pressed\n if ((keys[39]) && canMove(player.x+1, player.y)){\n player.x++;\n }\n //up key pressed\n if ((keys[38]) && canMove(player.x, player.y-1)){\n player.y--;\n }\n // down key pressed\n if ((keys[40]) && canMove(player.x, player.y+1)){\n player.y++;\n }\n\n //Stop the page from using the default input of keyboard inputs\n e.preventDefault();\n // calls the draw function to draw the movement\n draw();\n }", "handleKey(event) {\n const keyvalue = event.keyCode;\n console.log('keyvalue' + keyvalue);\n if (keyvalue === 37) {\n appState.player.direction = 'left';\n }\n if (keyvalue === 38) {\n appState.player.direction = 'up';\n }\n if (keyvalue === 39) {\n appState.player.direction = 'right';\n }\n if (keyvalue === 40) {\n //console.log('appstate' + appState.player.direction);\n\n appState.player.direction = 'down';\n console.log('appstate down' + appState.player.direction);\n }\n this.setState({ appState: appState });\n this.Player(appState.player);\n }", "onWindowKeyDown(event) {\n switch (event.key) {\n case 'w':\n if (!this.wasd.w && !this.movingBackward) {\n this.wasd.w = true;\n if (!this.movingForward) {\n this.moveForward();\n }\n }\n break;\n case 's':\n if (!this.wasd.s && !this.movingForward) {\n this.wasd.s = true;\n if (!this.movingBackward) {\n this.moveBackward();\n }\n }\n break;\n case 'a':\n if (!this.wasd.a && !this.rotatingRight) {\n this.wasd.a = true;\n if (!this.rotatingLeft) {\n this.rotateLeft();\n }\n }\n break;\n case 'd':\n if (!this.wasd.d && !this.rotatingLeft) {\n this.wasd.d = true;\n if (!this.rotatingRight) {\n this.rotateRight();\n }\n }\n break;\n }\n }", "function switchF(key){\r\n\tvar keyUni = retUni(key);\r\n\tswitch(keyUni){\r\n\t\tcase 87: // W\r\n\t\t\tkeyBool[0] = false;\r\n\t\t\tbreak;\r\n\t\tcase 65: // A\r\n\t\t\tkeyBool[1] = false;\r\n\t\t\tbreak;\r\n\t\tcase 68: // D\r\n\t\t\tkeyBool[2] = false;\r\n\t\t\tbreak;\r\n\t\tcase 83: // S\r\n\t\t\tkeyBool[3] = false;\r\n\t\t\tbreak;\r\n\t\tcase 32: // Space Bar\r\n\t\t\tkeyBool[4] = false;\r\n\t\t\tbreak;\r\n\t}\r\n}", "function keydown(e) {\r\n if (e.keyCode == \"38\") {\r\n // called the function according to the requirement\r\n moveup();\r\n } else if (e.keyCode == \"40\") {\r\n movedown();\r\n } else if (e.keyCode == \"37\") {\r\n moveleft();\r\n } else if (e.keyCode == \"39\") {\r\n moveright();\r\n }\r\n}", "function keyPressed(){\n //check right arrow is pressed \n //ASCII\n if(keyCode===RIGHT_ARROW){\n Matter.Body.applyForce(ball,{x:0,y:0},{x:0.05,y:0});\n }\n if(keyCode===LEFT_ARROW){\n Matter.Body.applyForce(ball1,{x:0,y:0},{x:-0.05,y:0})\n }\n}", "function keyPressed(){\n if (state === `simulation`) {\n ant.keyPressed();\n ant.move();\n }\n}", "function keyPressed() {\r\n\t//if the right arrow is pressed, Mario will move to the right\r\n\tif (keyCode == RIGHT_ARROW) {\r\n\t\tposX += 25;\r\n\t}\r\n\t//if the left arrow is pressed, Mario will move to the left\r\n\telse if (keyCode == LEFT_ARROW) {\r\n\t\tposX -= 25;\r\n\t}\r\n\t//if the up arrow is pressed, Mario will move up \r\n\telse if (keyCode == UP_ARROW) {\r\n\t\t//when the up button is pressed he will jump\r\n\t\tposY -= 75;\r\n\t}\r\n\t//if the down arrow is pressed, Mario will move down\r\n\telse if (keyCode == DOWN_ARROW) {\r\n\t\tposY += 25;\r\n\t}\r\n}", "function keyPressed() {\n //RIGHT\n if (keyCode == '39') {\n right_gesture();\n }\n //LEFT\n else if (keyCode == '37') {\n left_gesture();\n }\n\n //UP - PLUCK\n else if (keyCode == '38') {\n pluck_gesture();\n }\n\n //DOWN -- poke\n else if (keyCode == '40') {\n poke_gesture();\n }\n\n //A -- TWIRL\n else if (keyCode == '65') {\n twirl_gesture();\n }\n}", "function keyUp (event) {\r\n if (event.keyCode == 65) {\r\n rightPressed = false;\r\n } else if (event.keyCode == 68) {\r\n leftPressed = false; \r\n } else if (event.keyCode == 87) {\r\n upPressed = false;\r\n } else if (event.keyCode == 83) {\r\n downPressed = false;\r\n }\r\n}", "function handleKeyDown(event) {\n switch (event.code) {\n case \"ArrowUp\": \n if (snakes[0].direction[0] == \"left\" || snakes[0].direction[0] == \"right\" )\n snakes[0].direction[1] = \"up\";\n break;\n case \"ArrowDown\":\n if (snakes[0].direction[0] == \"left\" || snakes[0].direction[0] == \"right\" )\n snakes[0].direction[1] = \"down\";\n break;\n case \"ArrowRight\": \n if (snakes[0].direction[0] == \"up\" || snakes[0].direction[0] == \"down\" )\n snakes[0].direction[1] = \"right\";\n break;\n case \"ArrowLeft\": \n if (snakes[0].direction[0] == \"up\" || snakes[0].direction[0] == \"down\" )\n snakes[0].direction[1] = \"left\";\n break; \n } // end switch\n} // end handleKeyDown", "function handleKey(code,isDown){\n switch(code){\n case 32: keyShoot = isDown; break;\n case 37: keyLeft = isDown; break;\n case 38:\n keyUp = isDown;\n document.getElementById(\"instructions\").classList.add(\"hidden\");\n break;\n case 39: keyRight = isDown; break;\n }\n }", "function handleKey(e) {\n e = e || window.event;\n let play = false;\n let prev_state=state;\n speed=speed_normal;\n //key P to pause and un-pause the game\n if(e.keyCode == '80')\n isPaused();\n if(!paused && !dead)\n {\n //change direction\n // 0->right, 1->down, 2- left, 3 is up;\n //38 -> up arrow, 40 -> down arrow, 37 -> left arraw, 39 -> right arrow;\n if (e.keyCode == '38' && state!=1 && state!=3) {\n // up arrow\n state = 3;\n play = true;\n update();\n reload();\n }\n else if (e.keyCode == '40' && state!=1 && state!=3) {\n // down arrow\n state = 1;\n play = true;\n update();\n reload();\n }\n else if (e.keyCode == '37' && state!=0 && state!=2) {\n // left arrow\n state = 2;\n play = true;\n update();\n reload();\n }\n else if (e.keyCode == '39' && state!=0 && state!=2) {\n // right arrow\n state = 0;\n play = true;\n update();\n reload();\n }\n //increase speed\n // 0->right, 1->down, 2- left, 3 is up;\n //38 -> up arrow, 40 -> down arrow, 37 -> left arraw, 39 -> right arrow;\n else if(e.keyCode == '38' && state==prev_state && state==3)\n {\n inc_speed();\n reload();\n }\n else if(e.keyCode == '40' && state==prev_state && state==1)\n {\n inc_speed();\n reload();\n }\n else if(e.keyCode == '37' && state==prev_state && state==2)\n {\n inc_speed();\n reload();\n }\n else if(e.keyCode == '39' && state==prev_state && state==0)\n {\n inc_speed();\n reload();\n }\n //decrease speed\n // 0->right, 1->down, 2- left, 3 is up;\n //38 -> up arrow, 40 -> down arrow, 37 -> left arraw, 39 -> right arrow;\n else if(e.keyCode == '38' && state==1)\n {\n dec_speed();\n reload();\n }\n else if(e.keyCode == '40' && state==3)\n {\n dec_speed();\n reload();\n }\n else if(e.keyCode == '37' && state==0)\n {\n dec_speed();\n reload();\n }\n else if(e.keyCode == '39' && state==2)\n {\n dec_speed();\n reload();\n }\n if(play)\n playAudio();\n }\n}", "function keyDown (event) {\r\n // console.log(event.keyCode);\r\n if (event.keyCode == 65) {\r\n rightPressed = true;\r\n } else if (event.keyCode == 68) {\r\n leftPressed = true;\r\n } else if (event.keyCode == 87) {\r\n upPressed = true;\r\n } else if (event.keyCode == 83) {\r\n downPressed = true;\r\n }\r\n}", "function onkey(event) {\n\n if (!(event.metaKey || event.altKey || event.ctrlKey)) {\n event.preventDefault();\n }\n\n if (event.charCode == 'z'.charCodeAt(0)) { // z\n controls.zeroSensor();\n } else if (event.charCode == 'f'.charCodeAt(0)) { // f\n effect.setFullScreen( true );\n } else if (event.charCode == 'w'.charCodeAt(0)) { // w - move a row up\n animator.changeRow( -1 );\n currentRow -= 1;\n } else if (event.charCode == 's'.charCodeAt(0)) { // s - move a row down\n animator.changeRow( 1 );\n currentRow += 1;\n } else if (event.charCode == 'a'.charCodeAt(0)) { // a - spin row left\n animator.spinRow( -1 );\n } else if (event.charCode == 'd'.charCodeAt(0)) { // d - spin row right\n animator.spinRow( 1 );\n }\n}", "function moveCharacter(char, index) {\n if (game.data.go_back[index]) {\n game.data.go_back[index] = false;\n char.pos.x = game.data.back_x;\n char.pos.y = game.data.back_y;\n game.data.location_x[index] = game.data.back_x;\n game.data.location_y[index] = game.data.back_y;\n return true;\n } else if (game.data.show_menu || game.data.waited[index]) {\n return true;\n } else if (game.data.moving[index] && me.input.keyStatus(\"click\")) {\n\n var x = (Math.floor(me.input.mouse.pos.x / 32));\n var y = (Math.floor(me.input.mouse.pos.y / 32));\n var tot_x = x + char.off_x - char.pos.x/32;\n var tot_y = y + char.off_y - char.pos.y/32;\n\n if (Math.abs(tot_x)+Math.abs(tot_y) <= game.data.movement[index]) {\n\n var x1 = game.data.location_x.slice(0,0);\n var x2 = game.data.location_x.slice(1);\n var y1 = game.data.location_y.slice(0,0);\n var y2 = game.data.location_y.slice(1);\n var x_removed = x1.concat(x2);\n var y_removed = y1.concat(y2);\n if ((x_removed.indexOf(x*32) < 0) || (y_removed.indexOf(y*32) < 0)) {\n game.data.location_x[index] = x*32;\n game.data.location_y[index] = y*32;\n char.pos.x = x*32;\n char.pos.y = y*32;\n char.off_x = tot_x;\n char.off_y = tot_y;\n }\n }\n return true;\n\n } \n\n else if (game.data.update_plz[index]) {\n game.data.update_plz[index] = false;\n return true;\n } \n\n else if (!game.data.moving[index]) {\n char.off_x = 0;\n char.off_y = 0;\n }\n\n return false;\n}", "function handleKeyUp(event) { \n switch (event.keyCode) { \n case 90 /* z */: \n fly.pitchIncUpdate=false;\n break; \n case 83 /* s */: \n fly.pitchDecUpdate=false;\n break; \n case 81 /* q */: \n fly.rollIncUpdate=false;\n break; \n case 68 /* d */: \n fly.rollDecUpdate=false;\n break; \n case 65 /* a */: \n fly.velocityDecUpdate=false;\n break; \n case 69 /* e */: \n fly.velocityIncUpdate=false;\n break; \n } \n \n}", "function checkKey(e) {\n var event = e.which || e.keyCode;\n switch (event) {\n case 37: //left;\n monster1.move(-monsterSpeed);\n break;\n case 38: //up;\n break;\n case 39: //right;\n monster1.move(monsterSpeed);\n break;\n case 40: //down;\n break;\n }\n}", "function keyLifted() {\n down = false;\n\n return down;\n}", "function handleKeyUp(event) {\n if (event.keyCode === 38) {\n // set direction to UP\n snake.updateDirection(0,-1);\n } else if (event.keyCode === 40) {\n // set direction to DOWN\n snake.updateDirection(0,1);\n } else if (event.keyCode === 37) {\n // set direction to LEFT\n snake.updateDirection(-1,0);\n } else if (event.keyCode === 39) {\n // set direction to RIGHT\n snake.updateDirection(1,0);\n }\n // REFERENCE FOR DIRECTIONS:\n // UP: xDirection: 0, yDirection: -1\n // DOWN: xDirection: 0, yDirection: 1\n // LEFT: xDirection: -1, yDirection: 0\n // RIGHT: xDirection: 1, yDirection: 0\n}", "function keydown(evt) {\r\n if (isGameOver) return false\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n var SPACE = 32;\r\n\r\n switch (keyCode) {\r\n case \"N\".charCodeAt(0):\r\n if (player.motion!=motionType.LEFT) flipPlayer = motionType.LEFT\r\n player.motion = motionType.LEFT;\r\n break;\r\n\r\n case \"M\".charCodeAt(0):\r\n if (player.motion!=motionType.RIGHT) flipPlayer = motionType.RIGHT\r\n player.motion = motionType.RIGHT;\r\n break;\r\n case \"Z\".charCodeAt(0):\r\n if (player.isOnPlatform() || player.isOnVerticalPlatform){\r\n player.verticalSpeed = JUMP_SPEED\r\n }\r\n break;\r\n case \"C\".charCodeAt(0):\r\n cheatMode = true\r\n console.log(\"cheat mode enabled\")\r\n break;\r\n case \"V\".charCodeAt(0):\r\n cheatMode = false\r\n console.log(\"cheat mode disabled\")\r\n break;\r\n case SPACE:\r\n if (bullet_count > 0 || cheatMode) shoot()\r\n evt.preventDefault()\r\n break;\r\n return false\r\n }\r\n}" ]
[ "0.7302839", "0.72026944", "0.7122367", "0.70631295", "0.701217", "0.69186395", "0.688831", "0.6866995", "0.6831692", "0.68246555", "0.67790097", "0.67708826", "0.67642766", "0.6757925", "0.6756514", "0.67531675", "0.6748992", "0.6746513", "0.6742833", "0.6739954", "0.6739954", "0.67194396", "0.66920984", "0.66795605", "0.66795605", "0.66767174", "0.66747963", "0.6674418", "0.6649275", "0.664286", "0.6634455", "0.6634455", "0.6634455", "0.6634455", "0.6634455", "0.6633613", "0.66320974", "0.6623893", "0.66213596", "0.66193306", "0.6613753", "0.6611739", "0.6611049", "0.6610932", "0.6605671", "0.6605653", "0.660445", "0.6601493", "0.6601312", "0.6599444", "0.65992916", "0.6593811", "0.6588044", "0.658791", "0.6586142", "0.6579348", "0.65781224", "0.65680695", "0.6565031", "0.656454", "0.65616196", "0.65591514", "0.6554804", "0.655125", "0.65477", "0.65394956", "0.6536464", "0.65354526", "0.6533485", "0.6532093", "0.65316457", "0.65136683", "0.6507986", "0.65058386", "0.6502309", "0.64993143", "0.64977777", "0.64976245", "0.6497117", "0.6484591", "0.64767706", "0.64739716", "0.6462165", "0.64549786", "0.6452952", "0.64511377", "0.64486736", "0.64453846", "0.6442707", "0.6442107", "0.6438528", "0.6433836", "0.64322084", "0.6431466", "0.64289725", "0.64272285", "0.6427097", "0.6426817", "0.6425044", "0.6415112" ]
0.7120514
3
making character stationary if directional keys are released
function keyReleased(){ if (keyCode === RIGHT_ARROW){ char1.willStop = true; } if (keyCode === LEFT_ARROW){ char1.willStop = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onKeyDown(event) {\n if (event.keyCode == 90) { // z\n controls.resetSensor();\n }\n if (event.keyCode == 87) {\n walking = true;\n }\n}", "function keyLifted() {\n down = false;\n\n return down;\n}", "function keyPressed(){\n if (keyCode === RIGHT_ARROW){\n char1.willStop = false;\n if (char1.state !== \"right\") char1.rightState();\n\n }\n\n if (keyCode === LEFT_ARROW){\n char1.willStop = false;\n if (char1.state !== \"left\") char1.leftState();\n\n }\n\n if (keyCode === DOWN_ARROW){\n char1.willStop = false;\n if (hadouken1.alive === false){\n hadouken1.setStart(char1.charX, char1.charY);\n hadouken1.startTime = 0;\n hadouken1.lifeTime = 0;\n hadouken1.alive = true;\n\n //playing the sound effect\n char1.sound.play();\n }\n if (char1.state !== \"hadouken\") char1.hadouken();\n\n }\n}", "function keyPressed(){\n if (key == ' '){\n gridActive = !gridActive;\n }\n if (key == 'w' || key == 'W'){\n yVelocity -= 1;\n }\n if (key == 's' || key == 'S'){\n yVelocity += 1;\n }\n if (key == 'a' || key == 'A'){\n xVelocity -= 1;\n }\n if (key == 'd' || key == 'D'){\n xVelocity += 1;\n }\n}", "function keyReleased() {\n if (key != ' ') {\n granny.setDir(0);\n }\n}", "function keyControls(){\n \n if(keyWentDown (RIGHT_ARROW)){\n chrono.velocityX=10 \n }\n if(keyWentUp(RIGHT_ARROW)){\n chrono.velocityX=0\n }\n if(chrono.y >-100){\n if(keyDown(\"space\")){\n chrono.velocityY=-4\n }\n }\n \n \n}", "function onkey(event) {\n event.preventDefault();\n\n if (event.keyCode == 90) { // z\n controls.resetSensor(); //zero rotation\n } else if (event.keyCode == 70 || event.keyCode == 13) { //f or enter\n effect.setFullScreen(true) //fullscreen\n effect.setVRMode(true);\n }\n}", "function keyReleased() {\n\n}", "function keyup(e) {\r\n player.dx = 0;\r\n player.dy = 0;\r\n}", "function keyup(evt) {\r\n // Get the key code\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\r\n break;\r\n }\r\n}", "function keyup(evt) {\r\n // Get the key code\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\r\n break;\r\n }\r\n}", "function handleKeyUp(event) { \n switch (event.keyCode) { \n case 90 /* z */: \n fly.pitchIncUpdate=false;\n break; \n case 83 /* s */: \n fly.pitchDecUpdate=false;\n break; \n case 81 /* q */: \n fly.rollIncUpdate=false;\n break; \n case 68 /* d */: \n fly.rollDecUpdate=false;\n break; \n case 65 /* a */: \n fly.velocityDecUpdate=false;\n break; \n case 69 /* e */: \n fly.velocityIncUpdate=false;\n break; \n } \n \n}", "function initKeys() {\n document.addEventListener(\"keydown\", function(e) {\n if (e.keyCode === 39)\n //arrow right, move right\n baseBlock.dir = 1;\n else if (e.keyCode === 37)\n //arrow left, move left\n baseBlock.dir = -1;\n else if (e.keyCode === 72)\n //h button to show directions\n window.alert(\"Need help? Here's how to play- space bar to start, right arrow to move bar right, left arrow to\" +\n \" move bar left, up arrow to make it speedy, and down arrow to slow it back down\");\n else if (e.keyCode === 38)\n //arrow up, speed up, make it harder\n ball.velocity.x += 100;\n else if (e.keyCode === 40)\n //arrow down\n ball.velocity.x = 10;\n else if (e.keyCode === 32 && game.state === \"ready\") {\n //space bar\n ball.velocity.x += baseBlock.dir * 25;\n if (ball.velocity.x > width)\n ball.velocity.x = width;\n game.state = \"running\";\n }\n\n if (game.state === \"over\") {\n var doneMessage = document.getElementById(\"message\");\n doneMessage.parentNode.removeChild(doneMessage);\n game.state = \"ready\";\n }\n }, false);\n \n document.addEventListener(\"keyup\", function(e) {\n //stop motion when key is 'let go'\n\tif ((e.keyCode === 39 && baseBlock.dir === 1) ||\n\t (e.keyCode === 37 && baseBlock.dir === -1))\n \t baseBlock.dir = 0;\n }, false);\n}", "function onkey(event) {\n event.preventDefault();\n\n if (event.keyCode == 90) { // z\n controls.resetSensor(); //zero rotation\n } else if (event.keyCode == 70 || event.keyCode == 13) { //f or enter\n effect.setFullScreen(true) //fullscreen\n }\n}", "keyPressed(){\n if(keyCode === 66) {\n this.b = !this.b;\n }\n if(keyCode === 68) {\n this.d = !this.d;\n }\n if(keyCode === 71) {\n this.g = !this.g;\n }\n if(keyCode === 80) {\n this.p = !this.p;\n }\n if(keyCode === 83) {\n this.s = !this.s;\n }\n if(keyCode === 82) {\n this.r = !this.r;\n }\n\n }", "function animate_win()\n{\nrenderer.render(scene3);\nrequestAnimationFrame(animate_win);\n\n}//function that looks to see if the movement key has been released", "function keyup(evt) {\n // Get the key code\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"A\".charCodeAt(0):\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\n break;\n\n case \"D\".charCodeAt(0):\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\n break;\n }\n}", "function onKey(event) {\n if (event.keyCode == 90) { // z\n controls.resetSensor();\n }\n }", "function handleKeys() {\n\n if (currentlyPressedKeys[37])//left\n yawRate = 0.1;\n else if (currentlyPressedKeys[39]) //right\n yawRate = -0.1;\n else\n yawRate = 0;\n\n if (currentlyPressedKeys[38]) //up\n speed = -0.03;\n else if (currentlyPressedKeys[40]) //down\n speed = 0.03;\n else\n speed = 0;\n\n if(currentlyPressedKeys[87]){ // w key\n if(chosenSpeed == 0)\n chosenSpeed = 1;\n else\n chosenSpeed = 0;\n }\n\n if(currentlyPressedKeys[89]){ // y key\n rotateY = angle;\n console.log(\"Hello\");\n }\n else{\n rotateY = rotateY;\n }\n}", "function initKeyboardControls() {\n //detect when key is pressed\n window.addEventListener('keydown', function (e) {\n //get the key the user pressed\n //and convert it to lowercase\n //in case if the users keyboard\n //has capsLock on\n let keyPressed = e.key.toLowerCase();\n //we only save the state of key press\n //actually update of positions happens in movebird\n if(keyPressed === \"a\" || keyPressed === \"arrowleft\") mvL = true;\n if(keyPressed === \"d\" || keyPressed === \"arrowright\") mvR = true;\n if (keyPressed === \" \" || keyPressed === \"w\") mvU = true;\n\n });\n\n //detect when key is no longer pressed\n window.addEventListener('keyup', function (e) {\n let keyPressed = e.key.toLowerCase();\n\n if(keyPressed === \"a\" || keyPressed === \"arrowleft\") mvL = false;\n if(keyPressed === \"d\" || keyPressed === \"arrowright\") mvR = false;\n if (keyPressed === \" \" || keyPressed === \"w\") mvU = false;\n\n });\n}", "function keyPressed() {\n\tif(keyCode == UP_ARROW && (this.last_moving_direction!==DOWN_ARROW) ) {\n\t\t\ts.dir(0, -1);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.y += s.yspeed*diffLevel;\n\t} else if(keyCode == DOWN_ARROW && (this.last_moving_direction!==UP_ARROW)) {\n\t\t\ts.dir(0, 1);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.y += s.yspeed*diffLevel;\n\t}else if(keyCode == RIGHT_ARROW && (this.last_moving_direction!==LEFT_ARROW)) {\n\t\t\ts.dir(1, 0);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.x += s.xspeed*diffLevel;\n\t}else if(keyCode == LEFT_ARROW && (this.last_moving_direction!==RIGHT_ARROW)) {\n\t\t\ts.dir(-1, 0);\n\t\t\tthis.last_moving_direction = keyCode;\n\t\t\ts.x += s.xspeed*diffLevel;\n\t}\n}", "function onKeyUp(event){\n \n //keyboard events\n switch(event.keyCode){\n case 48:\n case 96:\n lookUp = false;\n break;\n case 38: //up\n case 87: //w\n console.log('w');\n moveForward = false;\n break;\n case 37: //left\n case 65: //a\n moveLeft = false;\n break;\n case 40: //down \n case 83: //s\n moveBackward = false;\n break;\n case 39: //right\n case 68: //d\n moveRight = false;\n break;\n }//end switch\n}//end onKeyUp", "onWindowKeyDown(event) {\n switch (event.key) {\n case 'w':\n if (!this.wasd.w && !this.movingBackward) {\n this.wasd.w = true;\n if (!this.movingForward) {\n this.moveForward();\n }\n }\n break;\n case 's':\n if (!this.wasd.s && !this.movingForward) {\n this.wasd.s = true;\n if (!this.movingBackward) {\n this.moveBackward();\n }\n }\n break;\n case 'a':\n if (!this.wasd.a && !this.rotatingRight) {\n this.wasd.a = true;\n if (!this.rotatingLeft) {\n this.rotateLeft();\n }\n }\n break;\n case 'd':\n if (!this.wasd.d && !this.rotatingLeft) {\n this.wasd.d = true;\n if (!this.rotatingRight) {\n this.rotateRight();\n }\n }\n break;\n }\n }", "function keyupEventHandler(e) {\n if (e.keyCode == 87) { // W key\n playerUp = false;\n }\n if (e.keyCode == 83) { // S key\n playerDown = false;\n }\n if (e.keyCode == 65) { // A key\n playerLeft = false;\n }\n if (e.keyCode == 68) { // D key\n playerRight = false;\n }\n}", "handleKeys() {\n this.xMove = 0;\n\t\tthis.yMove = 0;\n if (keyIsDown(65)) this.xMove += -this.speed;\n if (keyIsDown(68)) this.xMove += this.speed;\n //s\n if (keyIsDown(83)) this.yMove += this.speed;\n //w\n if (keyIsDown(87)) this.yMove += -this.speed;\n\n if (keyIsDown(32)) {\n this.placeBomb();\n }\n\n }", "function keyPressed(){\n if (state === `simulation`) {\n ant.keyPressed();\n ant.move();\n }\n}", "function handleKeys() {\r\n\r\n if (currentlyPressedKeys[90]) { //make camera roll to left\r\n // Left cursor key or A\r\n\t teapot_turn += 0.05;\r\n }\r\n else if (currentlyPressedKeys[88]) {\r\n // Up cursor key or W\r\n background_turn += 0.05;\r\n }\r\n\r\n\r\n}", "registerPlayerEvent() {\n document.addEventListener('keydown', (event) => {\n const keyCode = event.keyCode;\n switch (keyCode) {\n case UP: //z\n this.moveUp = true;\n this.orientation['Y'] = 'up';\n break;\n case DOWN: //s\n this.orientation['Y'] = 'down';\n this.moveDown = true;\n break;\n case RIGHT: //d\n this.orientation['X'] = 'right';\n this.moveRight = true;\n break;\n case LEFT: //q\n this.orientation['X'] = 'left';\n this.moveLeft = true;\n break;\n case SPACE: //spaceBar\n // this.isShooting = true;\n this.inventory.currentGun.isShooting = true;\n break;\n case 69: //spaceBar\n }\n this.keypressed[keyCode] = true;\n }\n );\n\n\n document.addEventListener('keyup', (event) => {\n const keyCode = event.keyCode;\n\n switch (keyCode) {\n case UP: //z\n this.lastKeyPressed = keyCode;\n this.moveUp = false;\n break;\n case DOWN: //s\n this.lastKeyPressed = keyCode;\n this.moveDown = false;\n break;\n case RIGHT: //d\n this.lastKeyPressed = keyCode;\n this.moveRight = false;\n break;\n case LEFT: //q\n this.lastKeyPressed = keyCode;\n this.moveLeft = false;\n break;\n case SPACE: //spaceBar\n // this.isShooting = false;\n this.inventory.currentGun.isShooting = false;\n this.keypressed[keyCode] = false; //Wtf ?\n break;\n }\n this.keypressed[keyCode] = false;\n }\n )\n }", "function keyPressed(){\n if(key = \" \"){\n if(dead){\n dead = false;\n } else {\n flappy.up(height);\n }\n }\n}", "function onKeyDown(event){\n \n //keyboard events\n switch(event.keyCode){\n case 48:\n case 96:\n lookUp = true;\n break;\n case 38: //up\n case 87: //w\n console.log('w');\n moveForward = true;\n break;\n case 37: //left\n case 65: //a\n moveLeft = true;\n break;\n case 40: //down \n case 83: //s\n moveBackward = true;\n break;\n case 39: //right\n case 68: //d\n moveRight = true;\n break;\n }//end switch\n}", "function setKeyUp() {\n game.keyPress=false;\n }", "function onKey(event) {\n if (event.keyCode == 90) { // z\n controls.zeroSensor();\n }\n}", "onKeyPress(event) {\n let newDirection = directions.find(c => c.keyCode === event.keyCode);\n if (!newDirection) {\n return;\n }\n if (Math.abs(newDirection.keyCode - this.direction.keyCode) !== 2) {\n this.direction = newDirection;\n }\n }", "function keyControl(event) {\n if (event.keyCode == 37 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveLeft();\n } else if (event.keyCode == 38 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.rotate();\n rotateSound.play();\n } else if (event.keyCode == 39 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveRight();\n } else if (event.keyCode == 40 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveDown();\n }\n }", "onKeyReleased(keyCode, event) {\n switch (keyCode) {\n case cc.KEY.a:\n case cc.KEY.left:\n self.accLeft = false;\n break;\n case cc.KEY.d:\n case cc.KEY.right:\n self.accRight = false;\n break;\n }\n }", "function keyUpHandler(e) {\n if (e.keyCode == 39) {\n rightPressed = false;\n } else if (e.keyCode == 37) {\n leftPressed = false;\n } else if (e.keyCode == 83) {\n sPressed = false;\n } else if (e.keyCode == 89) {\n drawBackstory();\n } else if (e.keyCode == 77){\n mutePressed = false;\n }\n }", "function keyPressed() {\n if (keyCode === UP_ARROW){\n s.dir(0,-1);\n } else if (keyCode === DOWN_ARROW) {\n s.dir(0,1);\n } else if (keyCode === RIGHT_ARROW) {\n s.dir(1,0);\n } else if (keyCode === LEFT_ARROW) {\n s.dir(-1,0)\n }\n}", "function keyPressed() {\n if (keyCode === RIGHT_ARROW && snakeDiraction != 'l') {\n snakeDiraction = 'r';\n }\n\n if (keyCode === LEFT_ARROW && snakeDiraction != 'r') {\n snakeDiraction = 'l';\n\n }\n\n if (keyCode === DOWN_ARROW && snakeDiraction != 'u') {\n snakeDiraction = 'd';\n }\n\n if (keyCode === UP_ARROW && snakeDiraction != 'd') {\n snakeDiraction = 'u';\n }\n}", "function keyEvent(event) {\n console.log(\"KEY: \" + event.name + \"=\" + event.isPressed);\n if (event.name == 'UP'){\n\t\tactivesensor = 'T';\n\t\tled.sync.showMessage(activesensor);\n\t} else if (event.name == 'LEFT'){\n\t\tactivesensor = 'P';\n\t\tled.sync.showMessage(activesensor);\n\t} else if (event.name == 'RIGHT'){\n\t\tactivesensor = 'H';\n\t\tled.sync.showMessage(activesensor);\n\t}\n}", "function checkKeyPressUp(e)\r\n{\r\n\tcheckPlayer();\r\n\tif (e.which == 65 || e.keyCode == 65 || e.which == 68 || e.keyCode == 68 || e.which == 83 || e.keyCode == 83 || e.which == 32 || e.keyCode == 32)\r\n\t{\r\n\t\tif(PlayerFace == WALKING_RIGHT)\r\n\t\t{\r\n\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\trightKey = false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(PlayerFace == WALKING_LEFT)\r\n\t\t\t{\r\n\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\tleftKey = false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(PlayerFace == BLOCKING_LEFT)\r\n\t\t\t\t{\r\n\t\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\t\tblockKey = false;\r\n\t\t\t\t\t//positionY += 1;\r\n\t\t\t\t\tpositionX -= 1;\r\n\t\t\t\t\tplayerPos();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(PlayerFace == BLOCKING_RIGHT)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\t\t\t\tblockKey = false;\r\n\t\t\t\t\t\t//positionY += 1;\r\n\t\t\t\t\t\tpositionX += 5;\r\n\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(PlayerFace == ATTACKING_LEFT)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\t\t\t\tpositionX += 41;\r\n\t\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(PlayerFace == ATTACKING_RIGHT)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\t\t\t\t\t\tpositionX += 41;\r\n\t\t\t\t\t\t\t\tplayerPos();\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 keyPressed() {\n // if players are in gameplay or game over screen\n if (state === \"PLAY\" || state === \"END\") {\n // if the message is updating\n if (textBox.update) {\n // textBox.fullText();\n // skip text animation for the developer :)\n // could be a feature but sometimes player will miss the message entirely if the message is too short\n } else {\n // if there's a second message\n if (textBox.bufferText != null) {\n // show the second message\n textBox.insertBuffer();\n return;\n // if no, hide the message when the animation is finished\n } else {\n if (textBox.showing) {\n textBox.hide();\n return;\n }\n }\n // if in gameplay and not examining a close object\n if (state === \"PLAY\" && !closeObjShowing) {\n // pressing arrowkeys will change background\n currentDir = gameBackground.dir; // store current facing direction\n // UP\n if (keyCode === UP_ARROW) {\n // if player is facing down, go to the last direction\n if (currentDir === 4) {\n currentDir = gameBackground.lastDir;\n gameBackground.changeDirTo(currentDir);\n } else {\n // if player isn't facing up, go face up\n if (currentDir != 5) {\n currentDir = 5;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers(); // update object trigger areas\n // DOWN\n } else if (keyCode === DOWN_ARROW) {\n // if player is facing up, go to the last dir\n if (currentDir === 5) {\n currentDir = gameBackground.lastDir;\n gameBackground.changeDirTo(currentDir);\n } else {\n // if not facing down, go face down\n if (currentDir != 4) {\n currentDir = 4;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n // LEFT\n } else if (keyCode === LEFT_ARROW) {\n // if player is facing up or down, don't change\n if (currentDir != 4 && currentDir != 5) {\n // change direction from 0 to 3 and then back to 0\n if (currentDir < 3) {\n currentDir++;\n gameBackground.changeDirTo(currentDir);\n } else if (currentDir === 3) {\n currentDir = 0;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n // RIGHT\n } else if (keyCode === RIGHT_ARROW) {\n if (currentDir != 4 && currentDir != 5) {\n // change direction from 3 to 0 and then back to 3\n if (currentDir > 0) {\n currentDir--;\n gameBackground.changeDirTo(currentDir);\n } else if (currentDir === 0) {\n currentDir = 3;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n }\n }\n }\n }\n}", "function keyReleased() {\n ship.setRotation(0);\n ship.boosting(false);\n}", "function canvas_on_keydown(e) {\r\n if(playing && e.code == \"Space\") {\r\n plane.accellerate(-4);\r\n } \r\n \r\n if (!playing && e.code == \"Enter\") {\r\n start_playing();\r\n }\r\n}", "function keyReleased() {\n if (keyCode == RIGHT_ARROW) {\n ship.setRotation(0);\n } else if (keyCode == LEFT_ARROW && keyCode == UP_ARROW == false) {\n ship.setRotation(0);\n } else if (keyCode == UP_ARROW) {\n ship.Boosting(false);\n }\n}", "function onkey(event) {\r\n event.preventDefault();\r\n\r\n if (vr) {\r\n if (event.keyCode == 90) // z\r\n controls.resetSensor(); //zero rotation\r\n else if (event.keyCode == 70 ) //f or enter\r\n effect.setFullScreen(true) //fullscreen\r\n else if (event.key == 'Enter') {\r\n\r\n console.log('ugh');\r\n onMouseDown();\r\n }\r\n }\r\n\r\n // some controls\r\n if(event.keyCode == 87) // w\r\n camera.position.z -= 0.8;\r\n else if(event.keyCode == 83) // s\r\n camera.position.z += 0.8;\r\n else if(event.keyCode == 65) // a\r\n camera.position.x -= 0.8;\r\n else if(event.keyCode == 68) // d\r\n camera.position.x += 0.8;\r\n}", "function keyReleased() {\n if (keyCode === RIGHT_ARROW || keyCode == LEFT_ARROW) {\n gun.setDirX(0);\n }\n}", "function keyPressed() {\n if (handler.active === handler.nameplate) {\n doorbell.keyPressed();\n }\n}", "function keyPressed(){\n //check right arrow is pressed \n //ASCII\n if(keyCode===RIGHT_ARROW){\n Matter.Body.applyForce(ball,{x:0,y:0},{x:0.05,y:0});\n }\n if(keyCode===LEFT_ARROW){\n Matter.Body.applyForce(ball1,{x:0,y:0},{x:-0.05,y:0})\n }\n}", "function keyPressed() {\n if (!timerSet) {\n timerSet = true;\ntimer = setTimeout(bugTimer, 30000 );\n }\n if(keyCode === UP_ARROW) {\nhungry.dir(0, -1);\n } else if (keyCode=== DOWN_ARROW){\n hungry.dir(0, 1);\n } else if (keyCode=== RIGHT_ARROW) {\n hungry.dir(1, 0);\n } else if (keyCode=== LEFT_ARROW){\n hungry.dir(-1, 0);\n }\n}", "handleKeys(elapsed, currentlyPressedKeys) {\n if (currentlyPressedKeys[89]) { // Y\n\n }\n }", "function keyPressed(){\n start = \"false\"\n if(keyCode === 38){\n snake.vel = createVector(0, -20)\n }\n if(keyCode === 40){\n snake.vel = createVector(0, 20)\n }\n if(keyCode === 39){\n snake.vel = createVector(20, 0)\n }\n if(keyCode === 37){\n snake.vel = createVector(-20, 0)\n }\n}", "press(dir) {\n if (dir) {\n this._game._right = true;\n this._game._rightAccelStep = 0;\n } else {\n this._game._left = true;\n this._game._leftAccelStep = 0;\n }\n }", "function keyPressed() {\n if(keyCode === UP_ARROW && snake.xspeed !== 0) {\n snake.dir(0, -1);\n }\n else if(keyCode === DOWN_ARROW && snake.xspeed !== 0){\n snake.dir(0, 1);\n }\n else if(keyCode === RIGHT_ARROW && snake.yspeed !== 0){\n snake.dir(1, 0);\n }\n else if(keyCode === LEFT_ARROW && snake.yspeed !== 0){\n snake.dir(-1, 0);\n }\n}", "function handleKeyDown(event) {\n if (!paused) {\n switch (event.code) {\n // switching between space stations\n case \"ArrowUp\":\n if (base_limit != -1) {\n current_center++;\n changeStation();\n }\n break;\n case \"ArrowDown\":\n if (base_limit != -1) {\n current_center--;\n changeStation();\n }\n break;\n // view change\n case \"KeyA\": // rotate left across earth\n var axis = vec3.fromValues(viewMatrix[2], viewMatrix[6], viewMatrix[10]);\n var right = vec3.create();\n vec3.cross(right, Up, Center);\n vec3.cross(axis, right, Up); \n mat4.multiply(viewMatrix, mat4.fromRotation(mat4.create(), 0.1, axis), viewMatrix);\n break;\n case \"KeyD\": // rotate right across earth\n var axis = vec3.fromValues(viewMatrix[2], viewMatrix[6], viewMatrix[10]);\n var right = vec3.create();\n vec3.cross(right, Up, Center);\n vec3.cross(axis, right, Up);\n mat4.multiply(viewMatrix, mat4.fromRotation(mat4.create(), -0.1, axis), viewMatrix);\n break;\n case \"KeyS\": // rotate back around earth\n var axis = vec3.create();\n vec3.cross(axis, Up, Center);\n mat4.multiply(viewMatrix, mat4.fromRotation(mat4.create(), 0.1, axis), viewMatrix);\n break;\n case \"KeyW\": // rotate forward around earth\n var axis = vec3.create();\n vec3.cross(axis, Up, Center);\n mat4.multiply(viewMatrix, mat4.fromRotation(mat4.create(), -0.1, axis), viewMatrix);\n break;\n case \"KeyQ\": // turn left above earth\n mat4.multiply(viewMatrix, mat4.fromRotation(mat4.create(), -0.1, Up), viewMatrix);\n break;\n case \"KeyE\": // turn right above earth\n mat4.multiply(viewMatrix, mat4.fromRotation(mat4.create(), 0.1, Up), viewMatrix);\n break;\n case \"KeyB\": // toggle lighting and blending modes\n blendMode += 1.0;\n if (blendMode > 3.0) {\n blendMode = 0;\n }\n break;\n case \"KeyG\":\n finishLoadingTextures();\n break;\n case \"Space\":\n if (station_centers[current_center][5]) {\n station_centers[current_center][4] = 0;\n var snd = new Audio(TEXTURES_URL + \"Missile_Launching.mp3\");\n snd.play();\n generateShot();\n station_centers[current_center][5] = false;\n if (station_centers[current_center][3] == 'Alpha') {\n document.getElementById(\"station1charge\").innerHTML = \"Recharging!\";\n } else if (station_centers[current_center][3] == 'Bravo') {\n document.getElementById(\"station2charge\").innerHTML = \"Recharging!\";\n } else if (station_centers[current_center][3] == 'Charlie') {\n document.getElementById(\"station3charge\").innerHTML = \"Recharging!\";\n }\n }\n break;\n case \"KeyP\":\n if (loaded >= textures.length) {\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\n imageContext.clearRect(0,0,1100,650);\n renderModelsSorted();\n var snd = new Audio(TEXTURES_URL + \"Game_Start.mp3\");\n snd.play();\n document.getElementById(\"loading\").innerHTML = \"\";\n finishLoadingTextures();\n }\n break;\n } // end switch\n }\n switch (event.code) {\n case \"KeyR\":\n restart();\n document.getElementById(\"loading\").innerHTML = \"\";\n break;\n }\n} // end handleKeyDown", "function startRace() {\n $(window).on('keydown', function moveRight(event) {\n if (event.keyCode === pinkPlayer.keyButton) {\n pinkPlayer.drive();\n } else if(event.keyCode === greenPlayer.keyButton){\n greenPlayer.drive();\n }\n });\n }", "function keyup(evt) {\n // Get the key code\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"N\".charCodeAt(0):\n if (player.motion == motionType.LEFT) player.motion = motionType.NONE;\n break;\n\n case \"M\".charCodeAt(0):\n if (player.motion == motionType.RIGHT) player.motion = motionType.NONE;\n break;\n }\n}", "function onKeyUp(event) {\n var key = event.keyCode ? event.keyCode : event.which;\n switch (key) {\n case KEY_LEFT:\n if (paddle.direction[0] == -1.0) {\n paddle.direction = [0.0, 0.0];\n }\n break;\n case KEY_RIGHT:\n if (paddle.direction[0] == 1.0) {\n paddle.direction = [0.0, 0.0];\n }\n break;\n }\n }", "function userinput()\n{\n\twindow.addEventListener(\"keydown\", function (event) {\n\t\tif (event.defaultPrevented) {\n\t\t\treturn; // Do nothing if the event was already processed\n\t\t}\n\n\t\tswitch (event.key) {\n\t\t\tcase \"b\":\n\t\t\t\t// code for \" \" key press.\n\t\t\t\tif(baw==0)\n\t\t\t\t{\n\t\t\t\t\tbaw=1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbaw=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"l\":\n\t\t\t\t// code for \" \" key press.\n\t\t\t\tif(lighton==0)\n\t\t\t\t{\n\t\t\t\t\tlighton=1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlighton=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \" \":\n\t\t\t\t// code for \" \" key press.\n\t\t\t\tconsole.log(hoverbonus);\n\t\t\t\tif(hoverbonus>0)\n\t\t\t\t{\n\t\t\t\t\tend-=1;\n\t\t\t\t\thoverbonus-=1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowDown\":\n\t\t\t\t// code for \"down arrow\" key press.\n\t\t\t\tcharacter.tick(\"d\",ontrain);\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowLeft\":\n\t\t\t\t// code for \"left arrow\" key press.\n\t\t\t\tpol.tick(\"l\");\n\t\t\t\td.tick(\"l\");\n\t\t\t\tcharacter.tick(\"l\",ontrain);\n\t\t\t\tif(character.getpos()[0]==-6)\n\t\t\t\t{\n\t\t\t\t\tdead=1;\n\t\t\t\t\tend+=1;\n\t\t\t\t\tpol.tick(\"r\");\n\t\t\t\t\td.tick(\"r\");\n\t\t\t\t\tcharacter.tick(\"r\",ontrain);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"ArrowRight\":\n\t\t\t\t// code for \"right arrow\" key press.\n\t\t\t\tpol.tick(\"r\");\n\t\t\t\td.tick(\"r\");\n\t\t\t\tcharacter.tick(\"r\",ontrain);\n\t\t\t\tif(character.getpos()[0]==6)\n\t\t\t\t{\n\t\t\t\t\tdead=1;\n\t\t\t\t\tend+=1;\n\t\t\t\t\tpol.tick(\"l\");\n\t\t\t\t\td.tick(\"l\");\n\t\t\t\t\tcharacter.tick(\"l\",ontrain);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn; // Quit when this doesn't handle the key event.\n\t\t}\n\n\t\t// Cancel the default action to avoid it being handled twice\n\t\tevent.preventDefault();\n\t}, true);\n\t// the last option dispatches the event to the listener first,\n\t// then dispatches event to window\n}", "function handleKeyDown(event) { \n switch (event.keyCode) { \n case 90 /* z */: \n fly.pitchIncUpdate=true;\n break; \n case 83 /* s */: \n fly.pitchDecUpdate=true;\n break; \n case 81 /* q */: \n fly.rollIncUpdate=true;\n break; \n case 68 /* d */: \n fly.rollDecUpdate=true;\n break; \n case 65 /* a */: \n fly.velocityDecUpdate=true;\n break; \n case 69 /* e */: \n fly.velocityIncUpdate=true;\n break; \n } \n}", "function keyDown(evt) {\n var c = (evt.keyCode) ? evt.keyCode : evt.charCode;\n switch(c) {\n case 37: // left\n case 63234:\n dx = 1; break;\n case 39: // right\n case 63235:\n dx = -1; break;\n case 40: // down\n case 63233:\n dy = -1; break;\n case 38: // up\n case 63232:\n dy = 1; break;\n case 32: // fire\n if (Torpedo.x) {\n playSound('notAvail');\n message('Not loaded new torpedo yet!');\n mainPanel(\"#779\");\n } else Torpedo.fire();\n break;\n case 16: // shift\n withShift = 1; break;\n case 27: // esc\n gameRunning = score = 0;\n IntroOutro.endAnimDest(0 , 1, 1);\n }\n}", "function keyPressed(e) {\n if (e.keyCode == 90) {\n controlBlock.ascend = true;\n } else if (e.keyCode == 83) {\n controlBlock.descend = true;\n }\n\n if (e.keyCode == 38) {\n opponentBlock.ascend = true;\n } else if (e.keyCode == 40) {\n opponentBlock.descend = true;\n }\n}", "updatePlayerPosition(keySpace, keyEnter, cursors){\n\n var running = [false,false];\n\n\n if(keySpace.isDown && this.recievedBomb){ // WHEN SPACE IS PRESSED FOR BOMB TO USE\n\n this.recievedBomb = false;\n\n }else if(keyEnter.isDown && (this.amountOfPowerUps > 0) && (this.spinning === false)){ // WHEN ENTER IS PRESSED FOR POWERUP TO USE\n\n this.removePowerUpFromBar();\n\n this.anims.stop('run', true);\n this.anims.play('spin', true);\n this.spinning = true;\n this.invincibleSound.play();\n\n // player emitter\n this.emitter = this.playerParticles.createEmitter({\n speed: { min: 100, max: 200 },\n angle: { min: -85, max: -95 },\n scale: { start: 0, end: 1, ease: 'Back.easeOut' },\n alpha: { start: 1, end: 0, ease: 'Quart.easeOut' },\n blendMode: 'SCREEN',\n lifespan: 1000\n });\n // this.emitter.reserve(1000);\n this.emitter.startFollow(this);\n this.speedup = config.ENERGY_SPEEDUP_VELOCITY;\n\n this.timer = this.scene.time.addEvent({ delay: config.CAN_INVINCIBILITY, callback: this.stopSpinning, callbackScope: this, repeat: false });\n\n }else if(cursors.left.isDown){ // WHEN LEFT IS PRESSED\n\n this.body.rotation = this.body.rotation - 5 ;\n\n if(cursors.up.isDown){\n\n running[0] = true;\n running[1] = false;\n\n\n }\n\n if(cursors.down.isDown){\n\n running[1] = true;\n running[0] = false;\n\n\n }\n // ######################################\n\n }else if(cursors.right.isDown){ // WHEN RIGHT IS PRESSED\n\n this.body.rotation = this.body.rotation + 5 ;\n\n if(cursors.up.isDown){\n\n running[0] = true;\n running[1] = false;\n\n\n }\n if(cursors.down.isDown){\n\n running[1] = true;\n running[0] = false;\n\n\n }\n // ######################################\n\n }else if(cursors.up.isDown){ // WHEN UP IS PRESSED\n\n running[0] = true;\n\n if(this.turnedAround === true){\n\n this.body.rotation = this.body.rotation + 180;\n this.turnedAround = false;\n\n }\n\n if(!this.spinning){\n this.anims.play('run', true);\n }\n\n // ######################################\n\n }else if(cursors.down.isDown){ // WHEN DOWN IS PRESSED\n\n running[1] = true;\n\n if(this.turnedAround === false){\n\n this.body.rotation = this.body.rotation + 180;\n this.turnedAround = true;\n\n }\n\n if(!this.spinning){\n this.anims.play('run', true);\n }\n\n }else{\n\n if(!this.spinning){\n this.anims.stop('run', true);\n }\n\n this.body.setVelocityX(0);\n this.body.setVelocityY(0);\n\n running[0] = false;\n running[1] = false;\n\n }\n\n return running;\n\n }", "function keysPressed(e){\n //store an entry for every key pressed\n keys[e.keyCode] = true;\n //left key pressed\n if ((keys[37]) && canMove(player.x-1, player.y)){\n player.x--;\n }\n //right key pressed\n if ((keys[39]) && canMove(player.x+1, player.y)){\n player.x++;\n }\n //up key pressed\n if ((keys[38]) && canMove(player.x, player.y-1)){\n player.y--;\n }\n // down key pressed\n if ((keys[40]) && canMove(player.x, player.y+1)){\n player.y++;\n }\n\n //Stop the page from using the default input of keyboard inputs\n e.preventDefault();\n // calls the draw function to draw the movement\n draw();\n }", "function key_up(){\n\n\tdrag_manager.active_key=null;\n\n}", "function keyReleased() {\n left.move(0);\n right.move(0);\n}", "initKeysPressed() {\n this.keysPressed[LEFT] = false;\n this.keysPressed[UP] = false;\n this.keysPressed[RIGHT] = false;\n this.keysPressed[DOWN] = false;\n }", "function onkey(event) {\n\n if (!(event.metaKey || event.altKey || event.ctrlKey)) {\n event.preventDefault();\n }\n\n if (event.charCode == 'z'.charCodeAt(0)) { // z\n controls.zeroSensor();\n } else if (event.charCode == 'f'.charCodeAt(0)) { // f\n effect.setFullScreen( true );\n } else if (event.charCode == 'w'.charCodeAt(0)) { // w - move a row up\n animator.changeRow( -1 );\n currentRow -= 1;\n } else if (event.charCode == 's'.charCodeAt(0)) { // s - move a row down\n animator.changeRow( 1 );\n currentRow += 1;\n } else if (event.charCode == 'a'.charCodeAt(0)) { // a - spin row left\n animator.spinRow( -1 );\n } else if (event.charCode == 'd'.charCodeAt(0)) { // d - spin row right\n animator.spinRow( 1 );\n }\n}", "keyHandler(scene){\n const { keys } = scene;\n // If this is the first frame it will just take the keys pressed and return.\n if (!this.prevKeys){\n this.savePreviousKeyInput(keys);\n return;\n }\n // If no key pressed, return\n if (!(keys.left.isDown || keys.right.isDown || keys.crouch.isDown || this.prevKeys.left || this.prevKeys.right || this.prevKeys.crouch)){\n return;\n }\n \n // ON PRESS LEFT\n if(keys.left.isDown && !this.prevKeys.left){\n scene.player.flipX = true;\n if(!keys.crouch.isDown){\n scene.player.play(\"move\");\n } \n }\n // ON HOLD LEFT\n if(keys.left.isDown && !keys.left.isUp && this.prevKeys.left){\n if(!keys.crouch.isDown){\n this.move(scene,this.speed,\"left\");\n } else {\n this.move(scene,this.speed/2,\"left\");\n }\n }\n // ON RELEASE LEFT\n if(!keys.left.isDown && this.prevKeys.left ){\n this.stop(scene);\n if (!keys.crouch.isDown){\n scene.player.play(\"idle\");\n }\n\n }\n // ON PRESS RIGHT\n if(keys.right.isDown && !this.prevKeys.right){\n scene.player.flipX = false;\n if(!keys.crouch.isDown){\n scene.player.play(\"move\");\n }\n }\n // ON HOLD RIGHT\n if(keys.right.isDown && !keys.right.isUp && this.prevKeys.right){\n if(!keys.crouch.isDown){\n this.move(scene,this.speed,\"right\");\n\n } else {\n this.move(scene,this.speed/2,\"right\");\n\n }\n }\n // ON RELEASE RIGHT\n if(!keys.right.isDown && this.prevKeys.right ){\n this.stop(scene);\n if (!keys.crouch.isDown){\n scene.player.play(\"idle\");\n }\n }\n // ON PRESS DOWN\n if(keys.crouch.isDown && !this.prevKeys.crouch){\n scene.player.play(\"crouch\"); \n \n this.body.setSize(16,10,true);\n this.body.setOffset(8,13);\n\n }\n // ON RELEASE DOWN\n if(!keys.crouch.isDown && this.prevKeys.crouch){\n this.jump(scene);\n\n //this.body.\n if (keys.left.isDown){\n scene.player.play(\"move\");\n } else if (keys.right.isDown){\n scene.player.play(\"move\");\n } else {\n scene.player.play(\"idle\");\n }\n\n this.body.setSize(16,17,true)\n this.body.setOffset(8,5);\n }\n\n // The last thing we do is storing keys pressed on this frame.\n this.savePreviousKeyInput(keys);\n }", "MoveKey() {}", "function keyPressed() {\n if (keyCode === UP_ARROW) {\n s.dir(0, -1);\n } else if (keyCode === DOWN_ARROW) {\n s.dir(0, 1);\n } else if (keyCode === RIGHT_ARROW) {\n s.dir(1, 0);\n } else if (keyCode === LEFT_ARROW) {\n s.dir(-1, 0);\n }\n}", "function moveDown(){\n if(keyEnabled == true){\n undraw();\n currentPosition = currentPosition + width;\n draw();\n freeze();\n }\n }", "function keyReleased () {\n\t\tframes = 0\n\t\tlinkMov = 0\n\t}", "function getKey(event){\n\n var char = event.which || event.keyCode;\n var letter = String.fromCharCode(char);\n\n if(letter == \"w\"){\n up(squid[player]);\n movement = \"up\";\n }\n if (letter == \"s\"){\n down(squid[player]);\n movement = \"down\";\n }\n if (letter == \"a\"){\n left(squid[player]);\n movement = \"left\"\n }\n if (letter == \"d\"){\n right(squid[player]);\n movement = \"right\"\n }\n\n // Manually Switch which object is the \"player\"\n /* if (letter == \"n\"){\n player += 1;\n if (player >= squid.length){\n player = 0;\n }\n }*/\n\n }", "handleMovement(keycode){\n\t\t\tif (this.currDirection === \"up\" && keycode === \"down\") {\n\t \t\t return;\n\t \t} \n\t \telse if (this.currDirection === \"right\" && keycode === \"left\") {\n\t \t\treturn;\n\t \t} \n\t \telse if (this.currDirection === \"down\" && keycode === \"up\") {\n\t \t\treturn;\n\t \t\t } \n\t \telse if (this.currDirection === \"left\" && keycode === \"right\") {\n\t \t\treturn;\n\t \t}\n\t \telse if(keycode === \"space\"){\n\t \t\tif(!gameStarted){\n\t \t\t\tupdate();\n\t \t\t}\n\t \t\treturn;\t\n\t \t}\n\t \t\tthis.nextDirection = keycode;\n\n\t\t}", "function keyPressed() {\n\t//DOWN ARROW key makes the package fall to the ground\n if (keyCode === DOWN_ARROW) {\n Matter.Body.setStatic(packageBody, false);\n }\n //movement of the helicopter using RIGHT and LEFT ARROW keys\n if (keyCode === RIGHT_ARROW) {\n\thelicopterSprite.x += 10;\n }\n if (keyCode === LEFT_ARROW) {\n\thelicopterSprite.x -= 10;\n }\n}", "handleInput(key) {\n //factor to move in x = 100\n //factor to move in y = 85\n if(this.live){ \n switch(key) {\n case 'left':\n (this.x - 100 >= 0) ? this.x -=100 : false;\n break;\n case 'right':\n (this.x + 100 < 500) ? this.x +=100 : false;\n break;\n case 'up':\n (this.y - 85 >= -15) ? this.y -=85 : false;\n break;\n case 'down':\n (this.y + 85 <= 410) ? this.y +=85 : false;\n break;\n default:\n false;\n }\n } else if(key == 'esc'){\n this.reset();\n }\n }", "function keyReleased() {\n\t// get the current loudness value:\n\tvar loudness = osc.amp().value;\n\t// if the user hits the spacebar:\n\tif (key == ' ') {\n\t\t// if the loudness is > 0, turn it off:\n\t\tif (loudness > 0) {\n\t\t\tosc.amp(0);\n\t\t} else {\n\t\t\t// if the loudness is 0, turn it on:\n\t\t\tosc.amp(0.5);\n\t\t}\n\t}\n}", "keyPressed({keyPressed, keyCode}){\n console.log('keypressed, keycode', keyPressed, keyCode);\n if(keyCode === 70){ //f\n requestFullScreen();\n return;\n }\n if(keyCode === 80){ //p\n requestPointerLock();\n return;\n }\n let key = keyCode + '';\n this.keysCurrentlyPressed[key] = {keyPressed, keyCode, clock:new Clock()};\n }", "function setKeyEventHandler() {\r\n window.onkeydown = function (e) {\r\n var c = String.fromCharCode(e.keyCode);\r\n //camera.keyAction(c);\r\n // document.getElementById(\"keypress\").innerHTML = \"<b>Key pressed:</b> \" + c + \"<br>\";\r\n if (c === \"w\" || c === \"W\") {\r\n forW = true;\r\n //console.log(\"forW true\");\r\n } else if (c === \"s\" || c === \"S\") {\r\n bacS = true;\r\n //console.log(\"bacS true\");\r\n } else if (c === \"a\" || c === \"A\") {\r\n lefA = true;\r\n //console.log(\"lefA true\");\r\n } else if (c === \"d\" || c === \"D\") {\r\n rigD = true;\r\n //console.log(\"rigD true\");\r\n } else if (e.keyCode === 16) {\r\n shifRun = true;\r\n //console.log(\"running!\");\r\n }\r\n };\r\n\r\n window.onkeyup = function (e) {\r\n var c = String.fromCharCode(e.keyCode);\r\n //camera.keyAction(c);\r\n // document.getElementById(\"keypress\").innerHTML = \"<b>Key pressed:</b> \" + c + \"<br>\";\r\n if (c === \"w\" || c === \"W\") {\r\n forW = false;\r\n //console.log(\"forW false\");\r\n } else if (c === \"s\" || c === \"S\") {\r\n bacS = false;\r\n //console.log(\"bacS false\");\r\n } else if (c === \"a\" || c === \"A\") {\r\n lefA = false;\r\n //console.log(\"lefA false\");\r\n } else if (c === \"d\" || c === \"D\") {\r\n rigD = false;\r\n //console.log(\"rigD false\");\r\n } else if (e.keyCode === 16) {\r\n shifRun = false;\r\n //console.log(\"walking?\");\r\n }\r\n };\r\n\r\n}", "function keyPressed(){\n\tif(keyCode === UP_ARROW){\n\t\ts.dir(0, -1);\n\t}else if(keyCode === DOWN_ARROW){\n\t\ts.dir(0, 1);\n\t}else if(keyCode === RIGHT_ARROW){\n\t\ts.dir(1, 0);\n\t}else if(keyCode === LEFT_ARROW){\n\t\ts.dir(-1, 0);\n\t}\n}", "function dealWithKeyboard(e) {\n var dr = 0.005;\n switch (e.keyCode) {\n case 37: // left arrow Sweep Left\n {yaw += dr * 20;}\n break;\n case 39: // right arrow Sweep right\n {yaw -= dr * 20;}\n break;\n case 38: // up arrow Sweep Up\n {pitch -= dr * 20;}\n break;\n case 40: // down arrow Sweep Down\n {pitch += dr * 20;}\n break;\n }\n}", "function keydown(ev){\n\tswitch(ev.keyCode){\n\t\tcase 87: // 'w' key\n\t\t\tcamera_z -= 0.5;\n\t\t\tbreak;\n\t\tcase 65: // 'a' key\n\t\t\tcamera_x -= 0.5;\n\t\t\tbreak;\n\t\tcase 83: // 's' key\n\t\t\tcamera_z += 0.5;\n\t\t\tbreak;\n\t\tcase 68: // 'd' key\n\t\t\tcamera_x += 0.5;\n\t\t\tbreak;\n\t\tcase 37: // left arrow key\n\t\t\tcamera_rotate -= 0.01;\n\t\t\tbreak;\n\t\tcase 39: // right arrow key\n\t\t\tcamera_rotate += 0.01;\n\t\t\tbreak;\n\t\tcase 82: // 'r' key (reset camera)\n\t\t\tcamera_x = 0.0;\n\t\t\tcamera_y = 2.5;\n\t\t\tcamera_z = 25.0;\n\t\t\tcamera_rotate = 4.71239;\n\t\t\tchairs_moving = false;\n\t\t\tchair_move_amount = 0;\n\t\t\ttable_rotate = 0;\n\t\t\tsky_channel = true;\n\t\t\tbreak;\n\t\tcase 32: // space key\n\t\t\tsky_channel = !sky_channel\n\t\t\tbreak;\n\t\tcase 74: // 'j' key\n\t\t\ttable_rotate -= 0.4;\n\t\t\tbreak;\n\t\tcase 76: // 'l' key\n\t\t\ttable_rotate += 0.4;\n\t\t\tbreak;\n\t\tcase 17: // Left control\n\t\t\tchairs_moving = !chairs_moving;\n\t\t\tif(!chairs_moving){\n\t\t\t\tchair_move_amount = 0;\n\t\t\t}\n\t\t\tbreak;\n\t}\n}", "function onKeyPressMove(event) {\r\n\tif (settings.isPlaying) {\r\n\t\tvar newDirection = directions[event.keyCode];\r\n\t\tvar newDirection2 = directions2[event.keyCode];\r\n\t\tif (newDirection !== undefined) {\r\n\t\t\tsnake.setDirection(newDirection);\r\n\t\t}\r\n\t\tif (newDirection2 !== undefined) {\r\n\t\t\tsnake2.setDirection(newDirection2);\r\n\t\t}\r\n\t}\r\n}", "function direction(event)\r\n{\r\n const LEFT_KEY = 37;\r\n const RIGHT_KEY = 39;\r\n const UP_KEY = 38;\r\n const DOWN_KEY = 40;\r\n //const PAUSE_KEY = 37;\r\n if(changing_direction)\r\n return;\r\n changing_direction = true;\r\n const key_pressed = event.keyCode;\r\n const goingUp = dy === -10;\r\n const goingDown = dy === 10;\r\n const goingRight = dx === 10;\r\n const goingLeft = dx === -10;\r\n\r\n if(key_pressed === LEFT_KEY && !goingRight)\r\n {\r\n dx = -10;\r\n dy = 0;\r\n }\r\n if(key_pressed === UP_KEY && !goingDown)\r\n {\r\n dx = 0;\r\n dy = -10;\r\n }\r\n\r\n if(key_pressed === RIGHT_KEY && !goingLeft)\r\n {\r\n dx = 10;\r\n dy = 0;\r\n }\r\n if(key_pressed === DOWN_KEY && !goingUp)\r\n {\r\n dx = 0;\r\n dy = 10;\r\n }\r\n}", "function movement() {\r\n if (cursors.left.isDown) {\r\n player.body.velocity.x = -150;\r\n keyLeftPressed.animations.play(\"leftArrow\");\r\n }\r\n if (cursors.right.isDown) {\r\n player.body.velocity.x = 150;\r\n keyRightPressed.animations.play(\"rightArrow\");\r\n }\r\n\r\n if (player.body.velocity.x > 0) {\r\n player.animations.play(\"right\");\r\n } else if (player.body.velocity.x < 0) {\r\n player.animations.play(\"left\");\r\n } else {\r\n player.animations.play(\"turn\");\r\n }\r\n if (cursors.up.isDown && player.body.onFloor()) {\r\n player.body.velocity.y = -290;\r\n keyUpPressed.animations.play(\"upArrow\");\r\n jumpSound.play();\r\n jumpSound.volume = 0.15;\r\n }\r\n }", "function keyPressed() {\r\n\r\n //giving condition when key pressed down arrow key\r\n if (keyDown(DOWN_ARROW)) {\r\n\t \r\n\t Matter.Body.setStatic(packageBody, false);\r\n\t \r\n }\r\n\r\n}", "function keyUpHandler(e) {\n if(e.keyCode == 32) {\n keyPressed = false;\n if(!lost){\n game_interval = setInterval(gameLoop, 16);\n }\n }\n}", "function inputrelease(e){\n\tlet code = e.keyCode;\n\tif(code == 38) // Up arrow\n\t{\n\t\tplayer.vel = 0;\n\t}\n\telse if(code == 40) // Down arrow\n\t{\n\t\tplayer.vel = 0;\n\t}\n}", "function detectKeyInput() {\n if (upKey.isDown) {\n dY = -1;\n } else if (downKey.isDown) {\n dY = 1;\n } else {\n dY = 0;\n }\n if (rightKey.isDown) {\n dX = 1;\n if (dY == 0) {\n facing = 'east';\n } else if (dY == 1) {\n facing = 'southeast';\n dX = dY = 0.5;\n } else {\n facing = 'northeast';\n dX = 0.5;\n dY = -0.5;\n }\n } else if (leftKey.isDown) {\n dX = -1;\n if (dY == 0) {\n facing = 'west';\n } else if (dY == 1) {\n facing = 'southwest';\n dY = 0.5;\n dX = -0.5;\n } else {\n facing = 'northwest';\n dX = dY = -0.5;\n }\n } else {\n dX = 0;\n if (dY == 0) {\n //facing=\"west\";\n } else if (dY == 1) {\n facing = 'south';\n } else {\n facing = 'north';\n }\n }\n}", "Wmotion(desloc) \n\t{\n\t\t// If the key A is pressed then moves the vehicle foward and turn left\n\t\tif (this.keysdirectionPress[0]){\n\t\t\tthis.angleDirection += desloc/5;\t\t// angleDirection = displacement/ radius of trajectory\n\t\t\tthis.position[2] += desloc*Math.cos(this.angleDirection);\n\t\t\tthis.position[0] -= desloc*Math.sin(this.angleDirection);\n\n\t\t\t// If the next position is out of limits or has altimetry other than 0 then revert the movement\n\t\t\tif ( ! this.checkNextPosition(this.position[0],this.position[2])){\n\t\t\t\tthis.angleDirection -= desloc/5;\n\t\t\t\tthis.position[2] -= desloc*Math.cos(this.angleDirection);\n\t\t\t\tthis.position[0] += desloc*Math.sin(this.angleDirection);\n\t\t\t}\n\t\t\tthis.frontLeftWheel.update(-desloc,5);\n\t\t\tthis.frontRightWheel.update(desloc,5);\n\t\t\tthis.backLeftWheel.update(-desloc,0);\n\t\t\tthis.backRightWheel.update(desloc,0);\n\t\t} else\n\t\t\t// If the key D is pressed then moves the vehicle foward and turn rigth\n\t\t\tif (this.keysdirectionPress[1]){\n\t\t\t\tthis.angleDirection -= desloc/5;\n\t\t\t\tthis.position[2] += desloc*Math.cos(this.angleDirection);\n\t\t\t\tthis.position[0] -= desloc*Math.sin(this.angleDirection);\n\n\t\t\t\t// If the next position is out of limits or has altimetry other than 0 then revert the movement\n\t\t\t\tif ( ! this.checkNextPosition(this.position[0],this.position[2])){\n\t\t\t\t\tthis.angleDirection += desloc/5;\n\t\t\t\t\tthis.position[2] -= desloc*Math.cos(this.angleDirection);\n\t\t\t\t\tthis.position[0] += desloc*Math.sin(this.angleDirection);\n\t\t\t\t}\n\t\t\t\tthis.frontLeftWheel.update(-desloc,-5);\n\t\t\t\tthis.frontRightWheel.update(desloc,-5);\n\t\t\t\tthis.backLeftWheel.update(-desloc,0);\n\t\t\t\tthis.backRightWheel.update(desloc,0);\n\t\t\t}\n\t\t\n\t\t// If only key W is pressed then moves the vehicle foward straight\n\t\tif ( !(this.keysdirectionPress[0] || this.keysdirectionPress[1]) ) {\n\t\t\tthis.position[2] += desloc*Math.cos(this.angleDirection);\n\t\t\tthis.position[0] -= desloc*Math.sin(this.angleDirection);\n\n\t\t\t// If the next position is out of limits or has altimetry other than 0 then revert the movement\n\t\t\tif ( ! this.checkNextPosition(this.position[0],this.position[2])){\n\t\t\t\tthis.position[2] -= desloc*Math.cos(this.angleDirection);\n\t\t\t\tthis.position[0] += desloc*Math.sin(this.angleDirection);\n\t\t\t}\n\t\t\tthis.frontLeftWheel.update(-desloc,0);\n\t\t\tthis.frontRightWheel.update(desloc,0);\n\t\t\tthis.backLeftWheel.update(-desloc,0);\n\t\t\tthis.backRightWheel.update(desloc,0);\n\t\t}\n\t}", "function keyDownhandler(event) {\n if ( event.keyCode == 39 ) {\n //NOTE keyCode MUST!!! have Capitcal C in key C ode\n //keycode 39 = right arrow button\n rightPressed = true;\n } else if ( event.keyCode == 37 ){\n //keycode 37 = left arrow button\n leftPressed = true;\n }\n}", "function control(e) {\n //Remove snake from current squares\n squares[currentIndex].classList.remove(\"snake\");\n\n //Check which key is pressed\n if(e.keyCode === 39) {\n direction = 1;\n } else if(e.keyCode === 38) {\n direction = -width;\n } else if(e.keyCode === 37) {\n direction = -1;\n } else if(e.keyCode === 40) {\n direction = +width;\n }\n}", "function keyReleased() {\n if (keyCode === RIGHT_ARROW || keyCode === LEFT_ARROW) {\n ship.setDirection(0);\n }\n}", "function keyReleased() {\n \n // LEFT_ARROW, makes gameChar stop advancing left\n if ( keyCode == 37 ) {\n isLeft = false;\n \n // RIGHT_ARROW, makes gameChar stop advancing right\n } else if ( keyCode == 39 ) {\n isRight = false;\n }\n \n // Logs values to the console if `DEBUG` and `DEBUG_KEY_RELEASES` are set to `true`\n debug_KeyReleases();\n}", "function keyPressed (){\n noLoop();\n}", "function key_press_observer() {\n var key_pressed_flag = false; //if key was pressed\n document.onkeydown = function(e){\n if(!key_pressed_flag) {\n if(e.which == \"37\" || e.which == \"65\") {\n if(s[0].d != 'x') {\n s[0].d = '-x';\n }\n }\n\n if(e.which == \"39\" || e.which == \"68\") {\n if(s[0].d != '-x') {\n s[0].d = 'x';\n }\n }\n\n if(e.which == \"38\" || e.which == \"87\") {\n if(s[0].d != 'y') {\n s[0].d = '-y';\n }\n }\n\n if(e.which == \"40\" || e.which == \"83\") {\n if(s[0].d != '-y') {\n s[0].d = 'y';\n }\n }\n key_pressed_flag = true;\n }\n //alert(e.which);\n\n }\n document.onkeyup = function(e){\n key_pressed_flag = false;\n } \n}", "function onKeyDown(key_pressed) {\n if (key_pressed === ARROW_DOWN && snake.direction !== UP) {\n snake.direction = DOWN;\n }\n if (key_pressed === ARROW_UP && snake.direction !== DOWN) {\n snake.direction = UP;\n } \n if (key_pressed === ARROW_RIGHT && snake.direction !== LEFT) { \n snake.direction = RIGHT;\n }\n if (key_pressed === ARROW_LEFT && snake.direction !== RIGHT) { \n snake.direction = LEFT;\n } \n}", "function keyUp (e) {\n\n\tswitch (e.keyCode) {\n\t\t//Space Bar\t\n\t\tcase 32:\n\t\t\tship.canShoot = true;\n\t\t\tbreak;\n\t\t// Left arrow\n\t\tcase 37:\n\t\t\tship.rotation = 0;\n\t\t\tbreak;\n\t\t// Up arrow\n\t\tcase 38:\n\t\t\tship.thrusting = false;\n\t\t\tbreak;\n\t\t// Right arrow\n\t\tcase 39:\n\t\t\tship.rotation = 0;\n\t\t\tbreak;\n\t}\n}", "function startEventListenerOnKeyPads(selectors) {\n function shuffle(array) {\n array.sort(() => Math.random() - 0.5);\n}\n\nlet a = 'up';\nlet b = 'down';\nlet c = 'left';\nlet d = 'right';\n\n\nlet KeyDirection = [a, b, c, d];\n\nshuffle(KeyDirection);\nconsole.log(KeyDirection);\n\nvar up = KeyDirection[0];\nvar down = KeyDirection[1];\nvar left = KeyDirection[2];\nvar right = KeyDirection[3];\n\nconsole.log(up, down, left, right);\n\n\n oxo.inputs.listenKey(\"right\", function () {\n console.log(\"right\");\n oxo.animation.move(selectors.astronaute, right, stepAstronauteMove);\n });\n\n oxo.inputs.listenKey(\"left\", function () {\n console.log(\"left\");\n oxo.animation.move(selectors.astronaute, left, stepAstronauteMove);\n });\n oxo.inputs.listenKey(\"up\", function () {\n console.log(\"up\");\n oxo.animation.move(selectors.astronaute, up, stepAstronauteMove);\n\n });\n\n oxo.inputs.listenKey(\"down\", function () {\n console.log(\"down\");\n oxo.animation.move(selectors.astronaute, down, stepAstronauteMove);\n });\n\n}", "function move_car(e)\n{\n switch(e.keyCode)\n {\n case 37:\n //left key pressed\n blueone.next_pos();\n break;\n\n case 39:\n //right key is presed\n redone.next_pos(); \n break;\n\n }\n}" ]
[ "0.74877346", "0.7171018", "0.711841", "0.702407", "0.7021228", "0.694932", "0.69156545", "0.6880561", "0.6880433", "0.6867722", "0.6867722", "0.6866141", "0.68632156", "0.68593454", "0.68265134", "0.682073", "0.6814232", "0.6809712", "0.67907214", "0.6784257", "0.67515874", "0.67497176", "0.67427015", "0.67260003", "0.6716874", "0.6715523", "0.6706077", "0.6701124", "0.66789", "0.6670936", "0.6669958", "0.6667438", "0.66623753", "0.66552395", "0.6653298", "0.66464823", "0.66420233", "0.6640645", "0.6627787", "0.6622869", "0.6622512", "0.66184175", "0.66177326", "0.66170007", "0.66165984", "0.6616208", "0.66052943", "0.660434", "0.6599782", "0.6598097", "0.6592894", "0.6589666", "0.658674", "0.65839165", "0.6583738", "0.65760404", "0.6560985", "0.6557848", "0.6557777", "0.65435374", "0.6540822", "0.6538825", "0.6530793", "0.652645", "0.65206164", "0.65174556", "0.65159255", "0.6513068", "0.65095407", "0.65029716", "0.6497806", "0.6494825", "0.648907", "0.64864373", "0.6485801", "0.64835244", "0.6481234", "0.64790374", "0.6478428", "0.64736366", "0.64717263", "0.6470661", "0.6470255", "0.64613634", "0.646046", "0.645761", "0.6457198", "0.6455107", "0.64550143", "0.6452857", "0.6452771", "0.64519906", "0.64511657", "0.64510334", "0.6448761", "0.6439783", "0.6434597", "0.64336175", "0.64321125", "0.64305496" ]
0.69584334
5
preloading the sound effect
function preload() { char1.sound = loadSound("assets/hadouken.mp3"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function preload(){\n\t sound = loadSound('sound.mp3');\n}", "function preload() {\n soundFormats('wav'); \n mySound = loadSound('assets/00-kick_acoustic.wav');\n}", "function preload() {\n song = loadSound('Sound-of-water-running.mp3');\n}", "function preload() {\n //bling = loadSound('images/sound.mp3');\n}", "function preload() {\n soundFile = loadSound('../../music/tiesto_zero_76.mp3');\n}", "function preload() {\n soundFile = loadSound('../../music/tiesto_zero_76.mp3');\n}", "function preload() {\n turnOffSound = loadSound(\"sound/offSound.mov\");\n}", "function preload() {\n //change song file name here\n song = loadSound('song.mpeg');\n}", "function preload() {\n //change song file name here\n song = loadSound('song.mpeg');\n}", "function preload() {\r\n // Preload function - only used to insert bellRing.mp3\r\n\r\n}", "function preload(){\n soundtrack = loadSound(\"soundtrack.mp3\");\n pointSound = loadSound(\"pointSound.mp3\");\n racketSound = loadSound(\"racketSound.mp3\");\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n sound = loadSound('./audio/sound4.mp3');\n}", "function preload() {\n wave = loadSound('wave.mp3');\n gulls = loadSound('seagulls.mp3');\n\n\n}", "function preload() {\n // load your sound files here\n}", "function preload(){\n sound1 = loadSound(\"SNARE2_HIPHOP2.wav\");}", "function preload() {\n song = loadSound('MUJI.mp3');\n}", "function preload() {\n song1 = loadSound('assets/DaydreamBlissSYBS.mp3');\n song1.loop();\n song1.stop();\n}", "function preload(){\n\tif(localDebug){\n\t\tconsole.log(\"samp loaded\");\n\t}\n\t\tsilencesamp = loadSound('silence.wav', loopSilence);\n}", "function preload() {\n song = loadSound('R.mp3')\n}", "function preload(){\n soundFile = loadSound(\"assets/CowMoo.mp3\");\n}", "function preload(){\n music = loadSound(\"assets/bkgrndmusic.mp3\");\n}", "function preload(){\n song = loadSound(\"jinglebell.mp3\");\n}", "function preload(){\n soundFormats('wav','mp3','ogg');\n\n //load our sounds into the soundArray\n soundFile = '/assets/roland.wav'\n sound1 = loadSound(soundFile);\n}", "function preload() {\n song = loadSound('../assets/music/song5.mp3');\n }", "function preload() {\r\n\tmySound = loadSound ('MarioMusic.mp3');\r\n\t//this sound was found from this websitehttps://downloads.khinsider.com/mario\r\n\t\r\n}", "function preload(){\n song = loadSound ('run_boy.mp3');// loads song\n}", "function preload() {\n sound = {\n hitWall: loadSound(\"./sounds/hit-wall.wav\"),\n hitPaddle: loadSound(\"./sounds/hit-paddle.wav\"),\n increasePlayerScore: loadSound(\"./sounds/increase-score.wav\"),\n };\n}", "function preload() {\n xyl = loadSound('sounds/xyl.mp3');\n xylFBow = loadSound('sounds/xylFBow.mp3');\n xylABow = loadSound('sounds/xylABow.mp3');\n xylC = loadSound('sounds/xylC.mp3');\n xylD = loadSound('sounds/xylD.mp3');\n xylE = loadSound('sounds/xylE.mp3');\n xylF = loadSound('sounds/xylF.mp3');\n xylG = loadSound('sounds/xylG.mp3');\n xylA = loadSound('sounds/xylA.mp3');\n xylB = loadSound('sounds/xylB.mp3');\n xylGHi = loadSound('sounds/xylGHi.mp3');\n xylAHi = loadSound('sounds/xylAHi.mp3');\n}", "function preload() {\n beepSFX = new Audio(\"assets/sounds/beep.wav\");\n restartSound = new Audio(\"assets/sounds/winner.wav\");\n}", "function preload() {\n music = loadSound(\"assets/snakemenu.mp3\");\n eatSound = loadSound(\"assets/eatfoodsound.mp3\");\n}", "function preload() {\r\n song1 = loadSound('assets/mind.m4a');\r\n song2 = loadSound('assets/alone.m4a');\r\n}", "function preload() {\n main_bgm = loadSound('./libraries/snowy.mp3');\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n click = loadSound('https://travisfeldman.github.io/FILES/drum');\n beatbox = loadSound('https://travisfeldman.github.io/FILES/beatbox');\n\n}", "function preload() {\n\taudio = loadSound(\"audio/DancinWithTheDevil-LindsayPerry.mp3\");\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n mySound = loadSound('Goodbye Mix by Spheriá.mp3');\n}", "function preload() {\n hhc = loadSound('assets/closed.wav');\n hho = loadSound('assets/oh01.wav');\n snr = loadSound('assets/snare.wav');\n kck = loadSound('assets/kick.wav');\n lt = loadSound('assets/lt02.wav');\n ht = loadSound('assets/mt02.wav');\n clp = loadSound('assets/cp02.wav');\n}", "function preload() {\n\tsoundFormats('ogg', 'mp3');\n\tiBowls.globalReverbCarrier = createConvolver('assets/HaleHolisticYogaStudio');\n}", "function preload()\n{\n tile_sound = loadSound(\"Sounds/CodingPower.mp3\");\n light_sound = loadSound(\"Sounds/SciFi.mp3\");\n //\"Sounds/Input-02.mp3\");\n}", "function preload() {\n\n\n slice = loadSound(\"sound/slice.mp3\");\n death = loadSound(\"sound/death.mp3\");\n\n\n}", "function playStartSound() {\n\tg_resourceLoader.soundEffects[7].currentTime = 0;\n\tg_resourceLoader.soundEffects[7].play();\n}", "function preload(){ //My media\n thud = loadSound(\"thud.mp3\"); //noise when you hit the \"a\" key\n song = loadSound(\"halloween.mp3\"); //background music\n img = loadImage(\"ghost.png\"); //ghost icon\n}", "function preload() {\n //suono\n backgroundSound = loadSound(\"./assets/sounds/background_sound.mp3\");\n\n}", "function preload() {\n backgroundMusic = loadSound(\"assets/mlg.mp3\");\n spellSound = loadSound(\"assets/hitmaker.mp3\");\n cat = loadImage(\"assets/cat.png\");\n}", "function preload() {\n song = loadSound('hit.mp3');\n reimu = loadImage('reimu.png');\n stage = loadImage(\"stage3.gif\");\n //stagel = createImg(\"stage3.gif\");\n song2 = loadSound(\"bgm.mp3\");\n song3 = loadSound(\"deathbgm.mp3\");\n}", "function preload() {\n song = loadSound(`assets/sounds/song.mp3`);\n}", "function preload() {\n h1 = loadSound('hea1.mp3')\n}", "function preload() {\n\n bark = new Audio('assets/sounds/bark.wav');\n\n}", "function preload() {\n beepSFX = new Audio(\"assets/sounds/beep.wav\");\n}", "function preload()\n{\n voiceOverA = loadSound('assets/voiceover_a.mp3');\n voiceOverB = loadSound('assets/voiceover_b.mp3');\n voiceOverC = loadSound('assets/voiceover_c.mp3');\n voiceOverD = loadSound('assets/voiceover_d.mp3');\n voiceOverE = loadSound('assets/voiceover_e.mp3');\n voiceOverF = loadSound('assets/voiceover_f.mp3');\n voiceOverG = loadSound('assets/voiceover_g.mp3');\n}", "function preload(){\n happy = loadFont(' KGHAPPY.ttf');\n song1 = loadSound('POP.WAV');\n song2 = loadSound('morning.mp3');\n}", "function preload(){\n font = loadFont('data/NewRocker-Regular.ttf');\n song = loadSound ('data/creepySound.mp3');\n}", "function preload() {\n popSFX = loadSound(`assets/sounds/pop.wav`);\n}", "function preload() {\n boom = loadSound('assets/boom.mp3');\n tss = loadSound('assets/tss.mp3');\n myFont = loadFont('assets/Gulim.ttf');\n gradientLoop = loadSound('assets/gradientloop.mp3'); \n drumLoad(128);\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n blop = loadSound('blop.mp3'); // requires p5.sound.js in HTML file\n}", "function preload(){\n pathImg = loadImage(\"depositphotos_211414398-stock-video-halloween-shortcut-road-forest-scary.jpg\");\n playerImg = loadAnimation(\"boy running 1.png\",\"boy running 2.png\",\"boy running 3.png\",\"boy running 4.png\");\n forestSound = loadSound(\"dark-forest.mp3\");\n wolfHowl = loadSound(\"mixkit-lone-wolf-howling-1729.wav\");\n fireImg = loadImage(\"fire.png\");\n coinImg = loadImage(\"—Pngtree—coin golden 3d digital_5879622.png\")\n //coinSound = loadSound(\"mixkit-space-coin-win-notification-271.wav\")\n cactusImg = loadImage(\"kisspng-cactus-clip-art-portable-network-graphics-image-fr-cactus-png-transparent-images-pictures-photos-pn-5c9d2a4d7ac150.5892471815538038535028.png\")\n \n \n}", "function preload() {\n print(\"Butthole!\")\n soundFormats('wav', 'mp3', 'ogg');\n //here's all the sfx we can use! you can even see the secret 17th sound... >:3c\n sfx = [loadSound('ass/puff.mp3'), loadSound('ass/BUP.mp3'), loadSound('ass/HEY.mp3'), loadSound('ass/vsas.mp3'), loadSound('ass/mikal.mp3'), loadSound('ass/jon.mp3'), loadSound('ass/hank.mp3'), loadSound('ass/tau.mp3'), loadSound('ass/euler.mp3'), loadSound('ass/bum.mp3'), loadSound('ass/work.mp3'), loadSound('ass/bl.mp3'), loadSound('ass/net.mp3'), loadSound('ass/memes.mp3'), loadSound('ass/game.mp3'), loadSound('ass/theory.mp3'), loadSound('ass/sega.mp3')];\n}", "function preloadPopSound(){\n \tvar audio = new Audio('sound/gunshot.wav');\n\n \taudio.preload = \"auto\";\n \t\n \t$(audio).on(\"loadeddata\", start);\n \t\n \treturn audio;\n}", "function preload() {\n mySong = loadSound(\"./assets/equilibrium.mp3\");\n myImage = loadImage(\"./assets/relax.png\");\n}", "function preload() {\n cat = \"cat\"; // Spawn the cat!\n noteC = loadSound('sound/C.mp3');\n noteD = loadSound('sound/D.mp3');\n noteE = loadSound('sound/E.mp3');\n noteF = loadSound('sound/F.mp3');\n noteG = loadSound('sound/G.mp3');\n noteA = loadSound('sound/A.mp3');\n meow = loadSound('sound/meow.mp3');\n}", "function preload() { \n \nimg = loadImage('assets/wwlogo.png'); \nimg2 = loadImage('assets/batman.png'); \nsoundFormats('mp3'); \ncrashSE = loadSound('assets/sf_laser_explosion.mp3'); \nspaceSound = loadSound('assets/Wonder Woman Theme (Batman v Superman) on Guitar + TAB'); \nbatSound = loadSound('assets/batman'); \n \n}", "function preload() {\n font = loadFont('data/MaisonNeueMono-Regular.otf');\n song = loadSound('data/gpsjammeroutput.mp3');\n}", "function preload() {\n screamImage = loadImage(\"assets/images/scream.jpg\");\n emojiImage = loadImage(\"assets/images/emojiscream.png\");\n soundFormats(\"mp3\", \"ogg\");\n screamSound = loadSound(\"assets/sounds/willhelmscream.mp3\");\n}", "function preload() {\n img[0] = loadImage(\"TSL/SL0.png\");\n img[1] = loadImage(\"TSL/SL1.png\");\n img[2] = loadImage(\"TSL/SL2.png\");\n img[3] = loadImage(\"TSL/SL3.png\");\n img[4] = loadImage(\"TSL/SL4.png\");\n img[5] = loadImage(\"TSL/SL5.png\");\n img[6] = loadImage(\"TSL/SL6.png\");\n img[7] = loadImage(\"TSL/SL7.png\");\n img[8] = loadImage(\"TSL/SL8.png\");\n img[9] = loadImage(\"TSL/SL9.png\");\n img[10] = loadImage(\"TSL/SL10.png\");\n img[11] = loadImage(\"TSL/SL11.png\");\n img[12] = loadImage(\"TSL/SL12.png\");\n myFont = loadFont('RobotoMono-Bold.ttf');\n\n soundFormats('mp3', 'ogg');\n mySound[0] = loadSound('Sound/Answer_Y.mp3');\n mySound[1] = loadSound('Sound/Answer_N.mp3');\n}", "function preload() {\n cat = loadAnimation('img/cat-0.png', 'img/cat-1.png', 'img/cat-2.png', 'img/cat-3.png', 'img/cat-4.png');\n catf = loadAnimation('img/cat-f0.png', 'img/cat-f1.png', 'img/cat-f2.png', 'img/cat-f3.png', 'img/cat-f4.png');\n catSt = loadAnimation('img/cat-sit.png');\n catStF = loadAnimation('img/cat-sit-f.png');\n catFud = loadImage('img/crouton.png');\n noteC = loadSound('sound/C.mp3');\n noteE = loadSound('sound/E.mp3');\n noteG = loadSound('sound/G.mp3');\n meow = loadSound('sound/meow.mp3');\n}", "preload() {\n // we gaan nu muziek afspelen\n this.load.audio('test', ['assets/avemaria.mp3']);\n }", "function preload() {\n\n\n //LoadSounds();\n //LoadAssets();\n \n\n}", "function preload()\n{\n // load media:\n tednose = loadImage('./data/tednose.png');\n for(var i = 0 ;i<substance.length;i++) {\n substance[i] = loadSound('./data/substance.mp3');\n }\n}", "function preload() {\n sound01 = loadSound(\"assets/son1.wav\") //A \n sound02 = loadSound(\"assets/son2.wav\") //Z \n sound03 = loadSound(\"assets/son3.wav\") //E \n sound04 = loadSound(\"assets/son4.wav\") //R\n sound05 = loadSound(\"assets/son5.wav\") //T\n sound06 = loadSound(\"assets/son6.wav\") //Y \n sound07 = loadSound(\"assets/son7.wav\") //U \n sound08 = loadSound(\"assets/son8.wav\") //I \n sound09 = loadSound(\"assets/son9.wav\") //O \n sound10 = loadSound(\"assets/son10.wav\") //P \n sound11 = loadSound(\"assets/son11.wav\") //Q \n sound12 = loadSound(\"assets/son12.wav\") //S \n sound13 = loadSound(\"assets/son13.wav\") //D \n sound14 = loadSound(\"assets/son14.wav\") //F \n sound15 = loadSound(\"assets/son15.wav\") //G \n sound16 = loadSound(\"assets/son16.wav\") //H \n sound17 = loadSound(\"assets/son17.wav\") //J \n sound18 = loadSound(\"assets/son18.wav\") //K\n sound19 = loadSound(\"assets/son19.wav\") //L \n sound20 = loadSound(\"assets/son20.wav\") //M \n sound21 = loadSound(\"assets/son21.wav\") //W \n sound22 = loadSound(\"assets/son22.wav\") //X \n sound23 = loadSound(\"assets/son23.wav\") //C\n sound24 = loadSound(\"assets/son24.wav\") //V \n sound25 = loadSound(\"assets/son25.wav\") //B \n sound26 = loadSound(\"assets/son26.wav\") //N \n\n}", "function preload(){\n // frogSound = loadSound('assets/frog.m4a');\n // flySound = loadSound('assets/fly.m4a');\n console.log(\"sounds loaded\");\n img = loadImage(\"assets/frog.png\");\n for(var i = 0; i < flyNumber; i++){flies[i] = loadImage(\"assets/fly\" + floor(random(0,3)) + \".png\");}\n}", "function preload() {\n //imgcover = loadImage(\"best-of-british-cover.jpg\")\n //imgqueen = loadImage(\"Queen-Bohemian-Rhapsody.jpg\");\n //imgbetty = loadImage(\"bouncing-betty.svg\");\n song1 = loadSound(\"voice1.mp3\");\n}", "function preload()\n {\n img = loadImage('images/invader.png');\n img2 = loadImage('images/huawei.png')\n sound = loadSound('Sounds/Theme.mp3');\n diesound = loadSound('Sounds/Die.mp3');\n shootsound = loadSound('Sounds/shoot.wav');\n }", "function preload() {\n song = loadSound(`assets/sounds/song.mp3`);\n dragon = loadImage(`assets/images/Li/inkart1.png`);\n cherryblossom1 = loadImage(`assets/images/Li/inkart2.png`);\n cherryblossom2 = loadImage(`assets/images/Li/inkart3.png`);\n}", "function preload() {\n dog.image = loadImage(\"assets/images/dog.png\");\n dog.sound = loadSound(\"assets/sounds/bark.wav\");\n}", "function preload() {\n dog.image = loadImage(\"assets/images/dog.png\");\n dog.sound = loadSound(\"assets/sounds/bark.wav\");\n}", "function preload() {\n\tneve = loadImage('essa_aqui.jpg');//Carrega a imagem de fundo\n\tolaf = loadImage('boneco.png');//Carrega a imagem do boneco de neve\n\tcadente = loadImage('estrela.png');//Carrega a imagem da estrela\n\tpinheiro = loadImage('arvore-normal.png');//Carrega a imagem da arvore\n\trosaClaro = loadImage('floco1.png');//Carrega a imagem do floco 1\n\trosa = loadImage('floco2.png');//Carrega a imagem do floco 2\n\tlilas = loadImage('floco3.png');//Carreg a imagem do floco 3\n\tvermelho = loadImage('floco4.png');//Carrega a imagem do floco 4\n\tsoundFormats('wav');//Define o formato do som\n\tmerry = loadSound('merry-christmas.wav');//Carrega a musica que vai tocar\n}", "function preload() {\n\tbubble = loadImage(\"bubble.png\");\n\tbg = loadImage(\"ws_Classique_-_Wooden_Floor_1920x1200.jpg\");\n\tshower_sfx = loadSound(\"shower_sfx.mp3\");\n\tPop_sfx = loadSound(\"Pop-sfx.mp3\");\n\n}", "preload() {\n // this.load.audio('start', './assets/start.wav');\n // this.load.audio('siren', './assets/siren.wav');\n this.load.path = \"./assets/\"\n this.load.image('logo', 'Title.png');\n this.load.image('htp', 'HTP.png');\n this.load.image('play', 'Play.png');\n this.load.image('credits', 'Credits.png');\n this.load.image('scroll1', 'Scroll1.png');\n this.load.image('scroll2', 'Scroll2.png');\n this.load.image('scroll3', 'Scroll3.png');\n this.load.audio('bugD', \"bugDeath.wav\");\n\n\n }", "function preload() {\r\n theme = loadSound('music/Forget.mp3')\r\n font = loadFont('music/vanilla-extract.regular.ttf')\r\n crasyPer = loadImage('music/crazy-faceejfnaiugjkarngow2.png')\r\n crasyPer2 = loadImage('music/crazy-facefejrgniuagoiw3.png')\r\n crasyPer3 = loadImage('music/crazy-facegjnsurgaegsuiehg4.png')\r\n crasyPer4 = loadImage('music/crazy-facejnsfjhw1.png')\r\n perPer1 = loadImage('music/crybabe.png')\r\n perPer4 = loadImage('music/iogueig.png')\r\n perPer2 = loadImage('music/sifjoefu.png')\r\n perPer3 = loadImage('music/softbayru.png')\r\n perPer5 = loadImage('music/krjgoeg.png')\r\n perPer6 = loadImage('music/oerguhg.png')\r\n perPer7 = loadImage('music/oiewjgiugb.png')\r\n dreamPer3 = loadImage('music/iurjgu.png')\r\n dreamPer1 = loadImage('music/pojihg.png')\r\n dreamPer2 = loadImage('music/rugjo.png')\r\n}", "function preload() {\n soundFormats('mp3');\n mySound = loadSound('https://cdn.glitch.com/73c64642-2052-4508-910d-79d70ac9139f%2Fmelodyloops-preview-this-night-is-for-us-2m30s.mp3?v=1596137367776');\n playerImage = loadImage(\n \"https://cdn.glitch.com/73c64642-2052-4508-910d-79d70ac9139f%2Fpixil-frame-0.png?v=1595963330214\"\n );\n backgroundImage = loadImage(\n \"https://cdn.glitch.com/73c64642-2052-4508-910d-79d70ac9139f%2Fpixil-frame-0%20(2).png?v=1596047893389\"\n );\n backgroundImage2 = loadImage(\n \"https://cdn.glitch.com/73c64642-2052-4508-910d-79d70ac9139f%2Fpixil-frame-0%20(2).png?v=1596047893389\"\n );\n}", "function Preload() {\n assets = new createjs.LoadQueue;\n assets.installPlugin(createjs.Sound);\n assets.on(\"complete\", Start);\n assets.loadManifest(manifest);\n }", "function preload() {\n thunderSound = loadSound(\"assets/thunder.wav\");\n lightRain = loadSound(\"assets/lightRain.wav\");\n heavyRain = loadSound(\"assets/heavyRain.wav\");\n sunnyBirds = loadSound(\"assets/birds.mp3\");\n christmasMusic = loadSound(\"assets/winterMusic.wav\");\n\n rainImage = loadImage(\"assets/rainImage.JPG\");\n snowImage = loadImage(\"assets/snowImage.JPG\");\n sunImage = loadImage(\"assets/sunImage.JPG\");\n thunderImage = loadImage(\"assets/thunderImage.jpg\");\n\n // cloud = loadImage(\"assets/cloud.jpg\");\n}", "function preload() {\n appleEatSound = loadSound('../Sound/appleEat.mp3');\n introSound = loadSound('../Sound/Intro.mp3');\n humbleSound = loadSound('../Sound/Humble Match.mp3');\n gameOverSound = loadSound('../Sound/GameOverM.mp3');\n lifeSound = loadSound('../Sound/1Life.mp3');\n deadSound = loadSound('../Sound/deadSound.mp3');\n gameOverVSound = loadSound('../Sound/GameOverV.mp3');\n clockSound = loadSound('../Sound/clockSound.mp3');\n slowDownSound = loadSound('../Sound/slowDownEffect.mp3');\n speedUpSound = loadSound('../Sound/speedUp.mp3')\n\n appleImg = loadImage('../PNG/apple.png');\n clockImg = loadImage('../PNG/clock.png');\n blockImg = loadImage('../PNG/block.png');\n}", "function preload() {\n hornS = loadSound('music/horn.mp3');\n growlS = loadSound('music/growl.mp3');\n waveS = loadSound('music/wave.mp3');\n woof = loadSound('music/woof.mp3');\n creak = loadSound('music/creak.wav');\n rainS = loadSound('music/rain.mp3');\n seaS = loadSound('music/sea.mp3');\n pianoS = loadSound('music/piano.mp3');\n catGif = loadImage(\"images/cat.gif\");\n mapPng = loadImage(\"images/map.png\");\n cloudPng = loadImage(\"images/cloud.png\");\n moonPng = loadImage(\"images/moon.png\");\n lightBeam = loadImage(\"images/lightbeam.png\");\n shipPng = loadImage(\"images/ship.png\");\n dogPng = loadImage(\"images/dog.gif\");\n fishCatPng = loadImage(\"images/fishingCat.gif\");\n danceCatPng = loadImage(\"images/danceCat.gif\");\n tentacles = loadImage(\"images/tentacles.gif\");\n catKren = loadImage(\"images/catken.gif\");\n miracleFont = loadFont(\"fonts/miracle.ttf\");\n}", "function preload() {\n motivationFont = loadFont('assets/fonts/AllertaStencil-Regular.ttf');\n prey = loadImage('assets/images/skull.png');\n player = loadImage('assets/images/heart.png');\n backgroundImage = loadImage('assets/images/background.jpg');\n introSound = new Audio('assets/sounds/Wadanohara_OST_GameOver.mp3');\n gameOverSound = new Audio('assets/sounds/Ib_OST_Goofball_Extended.mp3');\n gameWinSound = new Audio('assets/sounds/Wadanohara_OST_WadanoharasOcarina.mp3');\n eatSound = new Audio('assets/sounds/MonsterGrunt.mp3');\n clockSound = new Audio('assets/sounds/clock.mp3');\n}", "function startSound(name) {\n var sound = 'RESOURCES/Sound/' + name + '.mp3'\n if (noSoundEffect == false) {\n var free = getFreeChannel()\n reviveOne(free, sound)\n killTheOthers(free)\n }\n}", "function preload () {\n //game.load.image('hand', 'assets/hand.png');\n game.load.image('knife', 'assets/knife.png');\n //game.load.image('heart', 'assets/heart.png');\n game.load.image('lung', 'assets/lung.png');\n //game.load.image('eye', 'assets/eye.png');\n //game.load.image('Body', 'assets/body.png');\n\n //Make a sound here for cutting and one for squishing\n game.load.audio('cut', 'assets/cut.mp3');\n //game.load.audio('squish', 'assets/squish.mp3');\n }", "function preload() {\n //Intro images\n imgIntro1 = loadImage('assets/images/intro1_final.png');\n imgIntro2 = loadImage('assets/images/intro2_final.png');\n imgIntro3 = loadImage('assets/images/intro3_final.png');\n imgIntro4 = loadImage('assets/images/intro4_final.gif');\n\n //AUDIO\n //Load all audio files\n bgMusic = loadSound('assets/sounds/ANT_v2.mp3');\n cherrySFX = loadSound('assets/sounds/cherry.mp3');\n breadSFX = loadSound('assets/sounds/bread.mp3');\n rockSFX = loadSound('assets/sounds/rock.mp3');\n}", "preload() {\n this.load.audio('confirm',['../../assets/fx/selection1.mp3', '../../assets/fx/selection1.ogg'])\n this.load.image('Background', '../../assets/images/background_menu.png')\n this.load.image('ButtonFactor', '../../assets/images/button_factor.png')\n this.load.image('ButtonMult', '../../assets/images/button_multiply.png')\n this.load.image('ButtonDiv', '../../assets/images/button_divide.png')\n }", "function preload() {\n soundFile = loadSound('assets/ChildishGambinoCalifornia_01.mp3');\n //soundFile = loadSound('assets/DREAMDIVISION.mp3');\n\n lrcStrings = loadStrings('assets/ChildishGambinoCalifornia_01.lrc');\n\t\n\tbassBlob = loadImage('assets/bassBlob.svg');\n\t\n\n\tmorakas = loadImage('assets/morakas.svg');\n\n\nfuturaBold = loadFont(\"assets/Futura_Bold.ttf\");\n\t\n}", "function preload() {\n\n snd1 = loadSound(\"sound/Correct_AnswerIdea_Sound_Effects.mp3\");\n snd2 = loadSound(\"sound/Mouse_Click_-_Sound_Effect_HD.mp3\");\n snd3 = loadSound(\"sound/Party_Horn_Sound_Effect.mp3\");\n \n \n \n \n img1 = loadImage('assets/StartScene.png');\n img2 = loadImage('assets/Scene1.png');\n img3 = loadImage('assets/Scene2.png');\n img4 = loadImage('assets/Scene3.png');\n img5 = loadImage('assets/Scene4.png');\n img6 = loadImage('assets/EndScene.png');\n img7 = loadImage('assets/HelpScene.png');\n img8 = loadImage('assets/Scene1_1.png');\n img9 = loadImage('assets/Scene2_1.png');\n img10 = loadImage('assets/Scene3_1.png');\n img11 = loadImage('assets/Scene4_1.png');\n\n\n}", "function loadPopSound(){\n var audio = new Audio('sounds/balloon-pop.mp3');\n audio.preload = \"auto\";\n $(audio).on(\"loadeddata\",start);\n return audio;\n}", "function preload () {\n player = new Tone.Players({\n witch: 'witch.wav',\n melting: 'melting.wav',\n // // add these later\n // brain: \"brain.wav\",\n // curtain: \"curtain.wav\",\n }).toMaster();\n}", "function preload() {\n audioguide = loadSound(\"audio/audioguide.mp3\");\n\n sounds = Object();\n for (var i = 0; i < instruments.length; i++) {\n sounds[instruments[i]] = Object();\n sounds[instruments[i]][\"sustain\"] = Object();\n sounds[instruments[i]][\"regular\"] = Object();\n for (var j = 0; j < 7; j++) {\n sounds[instruments[i]][\"sustain\"][j] = loadSound(`../audio/${instruments[i]}/sustain/${notes[j]}.mp3`);\n sounds[instruments[i]][\"regular\"][j] = loadSound(`../audio/${instruments[i]}/regular/${notes[j]}.mp3`);\n }\n }\n}", "function preload() {\r\n bg = loadImage('assets/bg.png');\r\n bg1 = loadImage('assets/bg1.jpg');\r\n bg2 = loadImage('assets/bg2.jpg');\r\n\r\n snd1 = loadSound(\"sound/chime.mp3\");\r\n snd2 = loadSound(\"sound/magic.mp3\");\r\n snd3 = loadSound(\"sound/piano.mp3\");\r\n}", "function plyanimsound(soundeffect){\n const soundplay = new Audio(`/static/frontend/sounds/cards/${soundeffect}.wav`);\n soundplay.loop = false;\n soundplay.play();\n}", "function preload() {\n\n //trex images\n trexAssets[0] = loadImage('assets/trex.png');\n //roar\n roar = loadSound('assets/roar.mp3');\n\n}", "stopSound() { if (this.myAudio) this.myAudio.load(); }", "function preload() {\n //load BG image of the main menu\n bgIntro = loadImage('assets/images/bgIntro.jpg');\n\n //load images of the tutorial\n tut[0] = loadImage('assets/images/bgTut01.jpg');\n tut[1] = loadImage('assets/images/bgTut02.jpg');\n\n //load fonts\n globalFont = 'Dancing Script';\n titleFont = 'Kaushan Script';\n\n //load sounds\n soundFormats('mp3', 'wav');\n bgSong = loadSound('assets/sounds/Ib_Puppet.mp3');\n twinkle = loadSound('assets/sounds/twinkle.mp3'); //effect when the snake eats a bait\n}", "function preload() {\n bgImage = loadImage(\"images/background.png\");\n overSound = loadSound(\"sounds/GameLost.wav\");\n}", "function preload() {}" ]
[ "0.8098017", "0.79172784", "0.785401", "0.7842114", "0.7827337", "0.7827337", "0.7825268", "0.7808181", "0.7808181", "0.77804434", "0.77799255", "0.7766321", "0.77567863", "0.7752618", "0.773052", "0.77179396", "0.77134436", "0.7708638", "0.7708341", "0.7698495", "0.76982063", "0.76880646", "0.7687929", "0.76866335", "0.76857156", "0.7685654", "0.7683584", "0.7644548", "0.7632581", "0.76323897", "0.7625163", "0.76228315", "0.76181376", "0.7616166", "0.761262", "0.75947887", "0.7568248", "0.7535147", "0.75272685", "0.75107205", "0.75031036", "0.7496017", "0.7481564", "0.7447529", "0.74460787", "0.74438596", "0.7442584", "0.74345595", "0.7433229", "0.7408231", "0.74025404", "0.7382136", "0.73710585", "0.7363519", "0.7351442", "0.73168087", "0.73129964", "0.7299974", "0.72739863", "0.72504854", "0.72168463", "0.7170817", "0.7167557", "0.7165537", "0.7163625", "0.71489626", "0.71393317", "0.71256655", "0.71224254", "0.71125704", "0.71092707", "0.70782065", "0.70586026", "0.70586026", "0.7053083", "0.70521545", "0.7047825", "0.7038998", "0.702418", "0.70177215", "0.70124626", "0.7003397", "0.6970741", "0.6964545", "0.6964181", "0.69580317", "0.6940562", "0.6922424", "0.6911781", "0.6910852", "0.6907999", "0.69058335", "0.6893086", "0.68853813", "0.6877709", "0.6871886", "0.68277705", "0.68241674", "0.6811665", "0.68107766" ]
0.7492857
42
b.fsGp fsToGPol... for each of my fxs, turn them into gP's and then aggregate them all by unioning each reductively so it gets bigger and bigger..
function _pre(){ b2d.divPoints = b2d.divPts = b2d.vs = function () { var g = G(arguments) //all this does is to 'scale down' a series of points //can pass in pts naked OR in an array return _.m( g.s ? g : //passed in verts ([],[],[]) g.f, b2d.div ) //passed an array [[],[],[]] //b2d.div <- function div(v){return V(v).div()} }}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mul(f, g) {\r\n const f0 = BigInt(f.data[0]);\r\n const f1 = BigInt(f.data[1]);\r\n const f2 = BigInt(f.data[2]);\r\n const f3 = BigInt(f.data[3]);\r\n const f4 = BigInt(f.data[4]);\r\n const f5 = BigInt(f.data[5]);\r\n const f6 = BigInt(f.data[6]);\r\n const f7 = BigInt(f.data[7]);\r\n const f8 = BigInt(f.data[8]);\r\n const f9 = BigInt(f.data[9]);\r\n const f12 = BigInt(2 * f.data[1]);\r\n const f32 = BigInt(2 * f.data[3]);\r\n const f52 = BigInt(2 * f.data[5]);\r\n const f72 = BigInt(2 * f.data[7]);\r\n const f92 = BigInt(2 * f.data[9]);\r\n const g0 = BigInt(g.data[0]);\r\n const g1 = BigInt(g.data[1]);\r\n const g2 = BigInt(g.data[2]);\r\n const g3 = BigInt(g.data[3]);\r\n const g4 = BigInt(g.data[4]);\r\n const g5 = BigInt(g.data[5]);\r\n const g6 = BigInt(g.data[6]);\r\n const g7 = BigInt(g.data[7]);\r\n const g8 = BigInt(g.data[8]);\r\n const g9 = BigInt(g.data[9]);\r\n const g119 = BigInt(19 * g.data[1]); /* 1.4*2^29 */\r\n const g219 = BigInt(19 * g.data[2]); /* 1.4*2^30; still ok */\r\n const g319 = BigInt(19 * g.data[3]);\r\n const g419 = BigInt(19 * g.data[4]);\r\n const g519 = BigInt(19 * g.data[5]);\r\n const g619 = BigInt(19 * g.data[6]);\r\n const g719 = BigInt(19 * g.data[7]);\r\n const g819 = BigInt(19 * g.data[8]);\r\n const g919 = BigInt(19 * g.data[9]);\r\n const h0 = (f0 * g0) + (f12 * g919) + (f2 * g819) + (f32 * g719) +\r\n (f4 * g619) + (f52 * g519) + (f6 * g419) + (f72 * g319) + (f8 * g219) + (f92 * g119);\r\n const h1 = (f0 * g1) + (f1 * g0) + (f2 * g919) + (f3 * g819) + (f4 * g719) +\r\n (f5 * g619) + (f6 * g519) + (f7 * g419) + (f8 * g319) + (f9 * g219);\r\n const h2 = (f0 * g2) + (f12 * g1) + (f2 * g0) + (f32 * g919) + (f4 * g819) +\r\n (f52 * g719) + (f6 * g619) + (f72 * g519) + (f8 * g419) + (f92 * g319);\r\n const h3 = (f0 * g3) + (f1 * g2) + (f2 * g1) + (f3 * g0) + (f4 * g919) +\r\n (f5 * g819) + (f6 * g719) + (f7 * g619) + (f8 * g519) + (f9 * g419);\r\n const h4 = (f0 * g4) + (f12 * g3) + (f2 * g2) + (f32 * g1) + (f4 * g0) +\r\n (f52 * g919) + (f6 * g819) + (f72 * g719) + (f8 * g619) + (f92 * g519);\r\n const h5 = (f0 * g5) + (f1 * g4) + (f2 * g3) + (f3 * g2) + (f4 * g1) +\r\n (f5 * g0) + (f6 * g919) + (f7 * g819) + (f8 * g719) + (f9 * g619);\r\n const h6 = (f0 * g6) + (f12 * g5) + (f2 * g4) + (f32 * g3) + (f4 * g2) +\r\n (f52 * g1) + (f6 * g0) + (f72 * g919) + (f8 * g819) + (f92 * g719);\r\n const h7 = (f0 * g7) + (f1 * g6) + (f2 * g5) + (f3 * g4) + (f4 * g3) +\r\n (f5 * g2) + (f6 * g1) + (f7 * g0) + (f8 * g919) + (f9 * g819);\r\n const h8 = (f0 * g8) + (f12 * g7) + (f2 * g6) + (f32 * g5) + (f4 * g4) +\r\n (f52 * g3) + (f6 * g2) + (f72 * g1) + (f8 * g0) + (f92 * g919);\r\n const h9 = (f0 * g9) + (f1 * g8) + (f2 * g7) + (f3 * g6) + (f4 * g5) +\r\n (f5 * g4) + (f6 * g3) + (f7 * g2) + (f8 * g1) + (f9 * g0);\r\n this.combine(h0, h1, h2, h3, h4, h5, h6, h7, h8, h9);\r\n }", "function normalizeFPs(fingerprints, avgs) {\n var l = fingerprints.length;\n var newFP = new Array(l);\n\n for (var i = 0; i < l; i++) {\n newFP[i] = fingerprints[i] - avgs[i];\n }\n\n return newFP;\n}", "function fpb(angka1, angka2) \n{\n console.log('\\n', 'case for - FPB', angka1, angka2, '\\n ------------------------------------');\n\n var factorAngkaSatu = []\n var factorAngkaDua = []\n\n\n for (var x = 1; x<=angka1; x++)\n {\n if( angka1 % x === 0)\n {\n factorAngkaSatu.push(x)\n }\n }\n \n for (var x = 1; x<=angka2; x++)\n {\n if( angka2 % x === 0)\n {\n factorAngkaDua.push(x)\n }\n }\n \n // console.log(factorAngkaSatu)\n // console.log(factorAngkaDua)\n\n var commonFactor = []\n\n for (var x = 0; x < factorAngkaSatu.length; x++)\n {\n for (var y =0; y < factorAngkaDua.length; y++)\n {\n if( factorAngkaSatu[x] === factorAngkaDua[y])\n {\n commonFactor.push(factorAngkaSatu[x])\n }\n\n }\n\n }\n\n // console.log(commonFactor)\n \n var fpb = commonFactor[0]\n // console.log(fpb)\n \n if ( commonFactor.length === 1)\n {\n return fpb\n }\n else\n {\n\n for( var x = 1; x <= commonFactor.length-1; x++)\n {\n if( commonFactor[x] > fpb)\n {\n fpb = commonFactor[x]\n }\n }\n\n return fpb\n }\n\n}", "function gen_op_vfp_cmps()\n{\n gen_opc_ptr.push({func:op_vfp_cmps});\n}", "function gen_vfp_cmp(/* int */ dp) { if (dp) gen_op_vfp_cmpd(); else gen_op_vfp_cmps(); }", "function greedyPoo(items) {\n var resultsGreed = [];\n let currentSize = 0;\n let currentValue = 0;\n \n sortedStuff(greedItems).forEach(item => {\n if(currentSize + item.size <= capacity) {\n resultsGreed.push(item.index);\n currentSize += item.size;\n currentValue += item.value;\n } \n })\n return {resultsGreed, currentSize, currentValue};\n }", "function Ff(a,b,c,d,f,g){qf.call(this,f,g);this.Mj=a;this.Qg=[];this.pj=!!b;this.Nl=!!c;this.ql=!!d;for(b=0;b<a.length;b++)vf(a[b],B(this.xj,this,b,j),B(this.xj,this,b,n));0==a.length&&!this.pj&&this.A(this.Qg)}", "function FPTAlgo(points) {\n let all_x=[],all_y=[];\n for(let pt of points) {all_x.push(pt.x); all_y.push(pt.y);}\n if(new Set(all_x).size<new Set(all_y).size) return FPTAlgo_x(points);\n // swap x and y\n let points_rev=[];\n for(let pt of points) points_rev.push(new Point(pt.y,pt.x,Point.ADDED));\n let result_rev=FPTAlgo_x(points_rev),result=[];\n for(let pt of result_rev) result.push(new Point(pt.y,pt.x,Point.ADDED));\n return result;\n}", "function gsum(x, m) {\n let rslt = 0.0;\n for (let n = 0; n <= m; n++) {\n rslt += g(x, n);\n }\n return rslt;\n}", "coin_conversion(grams_of_silver){\n let output = [];\n let coins_big_to_little = this.coins.ranged_items.sort((a,b) => {\n return b.value_in_grams_of_silver - a.value_in_grams_of_silver; \n })\n // console.log('number_of_coins',coins_big_to_little.length);\n \n\n coins_big_to_little.forEach((coin,index) => {\n let coin_val = coin.value_in_grams_of_silver;\n // check to see if it's the last coin\n // express the value in last coin\n if(index == (coins_big_to_little.length-1)){\n if(grams_of_silver > 0){\n output.push({\n coin: coin, \n number: (grams_of_silver/coin_val)\n });\n \n }\n } else if (grams_of_silver >= coin_val){\n output.push({\n coin: coin, \n number: (Math.floor(grams_of_silver/coin_val))\n });\n grams_of_silver = grams_of_silver % coin_val;\n }\n });\n return output;\n }", "function combineBlockStatistics(reverseSortedAnalyzationInfo) {\n var result = reverseSortedAnalyzationInfo.reduce(function(acc, feeInfo) {\n acc.block.heightRange[0]=feeInfo.block.height\n acc.block.timeRange[0]=feeInfo.block.time\n acc.cpfpCount += feeInfo.cpfpCount\n acc.sortedSegwitFeeRates = acc.sortedSegwitFeeRates.concat(feeInfo.segwitFeeRates)\n acc.sortedLegacyFeeRates = acc.sortedLegacyFeeRates.concat(feeInfo.legacyFeeRates)\n\n function findBatchInfo(transactions) {\n var batchOutputsSum = 0, batchedTxs = 0, batchTxFeeSum = 0, batchTxSizeSum = 0\n transactions.forEach(function(t) {\n if(t.outputCount > 2* t.groupTxCount) {\n batchOutputsSum += t.outputCount - 2*t.groupTxCount\n batchedTxs++\n batchTxFeeSum += t.feePerByte*t.groupSize\n batchTxSizeSum += t.groupSize\n }\n })\n\n return {\n batchedTxs:batchedTxs, batchOutputsSum:batchOutputsSum,\n batchTxFeeSum:batchTxFeeSum, batchTxSizeSum:batchTxSizeSum\n }\n }\n\n var segwitBatchInfo = findBatchInfo(feeInfo.segwitFeeRates)\n var legacyBatchInfo = findBatchInfo(feeInfo.legacyFeeRates)\n\n acc.segwitBatchedTxs += segwitBatchInfo.batchedTxs\n acc.legacyBatchedTxs += legacyBatchInfo.batchedTxs\n acc.segwitBatchOutputsSum += segwitBatchInfo.batchOutputsSum\n acc.legacyBatchOutputsSum += legacyBatchInfo.batchOutputsSum\n\n acc.segwitBatchTxFeeSum += segwitBatchInfo.batchTxFeeSum\n acc.legacyBatchTxFeeSum += legacyBatchInfo.batchTxFeeSum\n acc.segwitBatchTxSizeSum += segwitBatchInfo.batchTxSizeSum\n acc.legacyBatchTxSizeSum += legacyBatchInfo.batchTxSizeSum\n\n if(feeInfo.outputCount > 2) {\n acc.batchedTxs++\n acc.batchOutputsSum += feeInfo.outputCount-1\n }\n\n return acc\n }, {\n block: {\n heightRange: [0, reverseSortedAnalyzationInfo[0].block.height],\n timeRange: [0, reverseSortedAnalyzationInfo[0].block.time]\n },\n cpfpCount: 0,\n sortedSegwitFeeRates: [],\n sortedLegacyFeeRates: [],\n segwitBatchedTxs: 0, legacyBatchedTxs: 0,\n segwitBatchOutputsSum:0, legacyBatchOutputsSum:0,\n segwitBatchTxFeeSum:0, legacyBatchTxFeeSum:0,\n segwitBatchTxSizeSum:0, legacyBatchTxSizeSum:0\n\n })\n\n result.sortedSegwitFeeRates.sort(function(a,b) {return a.feePerByte-b.feePerByte})\n result.sortedLegacyFeeRates.sort(function(a,b) {return a.feePerByte-b.feePerByte})\n return result\n}", "function getGVF(featureSet,attribute,numClass){\n\t//The Goodness of Variance Fit (GVF) is found by taking the \n //difference between the squared deviations\n //from the array mean (SDAM) and the squared deviations from the \n //class means (SDCM), and dividing by the SDAM\n\t//numClass = number of classes - keep it low (<7)\n\t//add the numeric data to analyze to the dataList from the featureSet:\n\tvar dataList = []\n\tfor(n=0,nl=featureSet.features.length;n<nl;n++){\n\t\tdataList.push(featureSet.features[n].attributes[attribute])\n\t}\n\t\n\t//get the breaks:\n //THIS IS WHAT IS USED TO RENDER THE MAP:\n\tvar breaks = getJenksBreaks(dataList, numClass)\n\n\t//the rest of this will calculate the fit:\n\t//Use for statistical analysis of the fit - don't really need to render the map\n\tdataList.sort()\n\t\n\t//this gets the squared deviations from the array mean (listmean) = SDAM\n\t\t//add up the values in the dataList then divide by the length:\n\tvar listMean = sum(dataList)/dataList.length\n\n\tvar SDAM = 0.0\n\t//now iterate through all the values and add up the sqDev to get the SDAM:\n\tfor(var i=0,il=dataList.length; i<il; i++){\n\t\t//this gets the sqDev: Math.pow,2 = square the (value - listMean) for each value in the list:\n\t\tvar sqDev = Math.pow((dataList[i] - listMean),2)\n SDAM += sqDev\n\t}\n \n\t//this gets the squared deviation of the class means - for each of the classes (should only use up to 7)\n\tvar SDCM = 0.0\n\tfor(var x=0,xl=numClass;x<xl;x++){\n\t\tif(breaks[x] == 0){\n\t\t\tvar classStart = 0\n }else{\n\t\t\tvar classStart = dataList.findIndex(breaks[x])\n\t\t\tclassStart += 1\n\t\t}\n var classEnd = dataList.findIndex(breaks[x+1])\n\n\t\t//need to put the range of values into this array:\n //var classList = dataList[classStart:classEnd+1]\n\t\tvar classList = dataList.slice(classStart,classEnd+1)\n var classMean = sum(classList)/classList.length\n\t\t\n\t\tvar preSDCM = 0.0\n\t\t//now iterate through the classList and add up the sqDev to get the SDCM:\n\t\tfor(var j=0,jl=classList.length;j<jl;j++){\n\t var sqDev2 = Math.pow((classList[j] - classMean),2)\n preSDCM += sqDev2\n\t\t}\n\t\tSDCM += preSDCM\n\t}\n\n\t//gets the fit:\n\tvar varFit = (SDAM - SDCM)/SDAM\n\tconsole.log(\"varianceFit:\",varFit)\n\n\t//only return the breaks for the map:\n\treturn breaks;\n}", "function fz(a,b){this.cf=[];this.Wg=a;this.Og=b||null;this.sd=this.Pc=!1;this.Yb=void 0;this.Wf=this.ph=this.of=!1;this.hf=0;this.ub=null;this.pf=0}", "function computeProbs(prob_table){\n p_fbg_given_kg = prob_table[idx_fbg_given_kg];\n p_fbi_given_kg = prob_table[idx_fbi_given_kg];\n p_fbg_given_ki = prob_table[idx_fbg_given_ki];\n p_fbi_given_ki = prob_table[idx_fbi_given_ki];\n p_kbg_given_kg = prob_table[idx_kbg_given_kg];\n p_kbi_given_kg = prob_table[idx_kbi_given_kg];\n p_kbg_given_ki = prob_table[idx_kbg_given_ki];\n p_kbi_given_ki = prob_table[idx_kbi_given_ki];\n p_ftc_given_fbg = prob_table[idx_ftc_given_fbg];\n p_fnt_given_fbg = prob_table[idx_fnt_given_fbg];\n p_ftc_given_fbi = prob_table[idx_ftc_given_fbi];\n p_fnt_given_fbi = prob_table[idx_fnt_given_fbi];\n p_kta_given_kbg = prob_table[idx_kta_given_kbg];\n p_ktc_given_kbg = prob_table[idx_ktc_given_kbg];\n p_kta_given_kbi = prob_table[idx_kta_given_kbi];\n p_ktc_given_kbi = prob_table[idx_ktc_given_kbi];\n p_kg = prob_table[idx_kg];\n\t//console.log(\"p_kg: \" + p_kg)\n p_ki = prob_table[idx_ki];\n\n p_fbg = p_fbg_given_kg * p_kg + p_fbg_given_ki * p_ki\n p_fbi = p_fbi_given_kg * p_kg + p_fbi_given_ki * p_ki\n\n p_kbg = p_kbg_given_kg * p_kg + p_kbg_given_ki * p_ki\n p_kbi = p_kbi_given_kg * p_kg + p_kbi_given_ki * p_ki\n\n p_ftc = p_ftc_given_fbg * p_fbg + p_ftc_given_fbi * p_fbi\n p_ftc_given_kg = p_ftc_given_fbg * p_fbg_given_kg + p_ftc_given_fbi * p_fbi_given_kg\n p_ftc_given_ki = p_ftc_given_fbg * p_fbg_given_ki + p_ftc_given_fbi * p_fbi_given_ki\n\n p_fnt = p_fnt_given_fbg * p_fbg + p_fnt_given_fbi * p_fbi\n p_fnt_given_kg = p_fnt_given_fbg * p_fbg_given_kg + p_fnt_given_fbi * p_fbi_given_kg\n p_fnt_given_ki = p_fnt_given_fbg * p_fbg_given_ki + p_fnt_given_fbi * p_fbi_given_ki\n \n p_kta = p_kta_given_kbg * p_kbg + p_kta_given_kbi * p_kbi\n p_kta_given_kg = p_kta_given_kbg * p_kbg_given_kg + p_kta_given_kbi * p_kbi_given_kg\n p_kta_given_ki = p_kta_given_kbg * p_kbg_given_ki + p_kta_given_kbi * p_kbi_given_ki\n \n p_ktc = p_ktc_given_kbg * p_kbg + p_ktc_given_kbi * p_kbi\n p_ktc_given_kg = p_ktc_given_kbg * p_kbg_given_kg + p_ktc_given_kbi * p_kbi_given_kg\n p_ktc_given_ki = p_ktc_given_kbg * p_kbg_given_ki + p_ktc_given_kbi * p_kbi_given_ki\n\n\tp_ftc = Math.max(p_ftc, .0000001)\n\tp_kta = Math.max(p_kta, .0000001)\n\tp_ktc = Math.max(p_ktc, .0000001)\n p_kg_given_ftc = p_ftc_given_kg * p_kg / p_ftc\n p_ki_given_ftc = p_ftc_given_ki * p_ki / p_ftc\n p_kg_given_kta = p_kta_given_kg * p_kg / p_kta\n p_ki_given_kta = p_kta_given_ki * p_ki / p_kta\n p_kg_given_ktc = p_ktc_given_kg * p_kg / p_ktc\n p_ki_given_ktc = p_ktc_given_ki * p_ki / p_ktc\n\n p_ftc_and_kta_given_kg = p_ftc_given_kg * p_kta_given_kg\n p_ftc_and_kta_given_ki = p_ftc_given_ki * p_kta_given_ki\n p_ftc_and_ktc_given_kg = p_ftc_given_kg * p_ktc_given_kg\n p_ftc_and_ktc_given_ki = p_ftc_given_ki * p_ktc_given_ki\n\n p_ftc_and_kta = p_ftc_given_kg * p_kta_given_kg * p_kg + p_ftc_given_ki * p_kta_given_ki * p_ki\n p_ftc_and_ktc = p_ftc_given_kg * p_ktc_given_kg * p_kg + p_ftc_given_ki * p_ktc_given_ki * p_ki\n p_fnt_and_kta = p_fnt_given_kg * p_kta_given_kg * p_kg + p_fnt_given_ki * p_kta_given_ki * p_ki\n p_fnt_and_ktc = p_fnt_given_kg * p_ktc_given_kg * p_kg + p_fnt_given_ki * p_ktc_given_ki * p_ki\n\n\tp_ftc_and_kta = Math.max(p_ftc_and_kta, .0000001)\n\tp_ftc_and_ktc = Math.max(p_ftc_and_ktc, .0000001)\n p_kg_given_ftc_and_kta = p_ftc_and_kta_given_kg * p_kg / p_ftc_and_kta\n p_ki_given_ftc_and_kta = p_ftc_and_kta_given_ki * p_ki / p_ftc_and_kta\n p_kg_given_ftc_and_ktc = p_ftc_and_ktc_given_kg * p_kg / p_ftc_and_ktc\n p_ki_given_ftc_and_ktc = p_ftc_and_ktc_given_ki * p_ki / p_ftc_and_ktc\n\n p_ftc_and_kta_given_kg = p_ftc_given_kg * p_kta_given_kg\n p_ftc_and_ktc_given_kg = p_ftc_given_kg * p_ktc_given_kg\n p_fnt_and_kta_given_kg = p_fnt_given_kg * p_kta_given_kg\n p_fnt_and_ktc_given_kg = p_fnt_given_kg * p_ktc_given_kg\n\n p_ftc_and_kta_given_ki = p_ftc_given_ki * p_kta_given_ki\n p_ftc_and_ktc_given_ki = p_ftc_given_ki * p_ktc_given_ki\n p_fnt_and_kta_given_ki = p_fnt_given_ki * p_kta_given_ki\n p_fnt_and_ktc_given_ki = p_fnt_given_ki * p_ktc_given_ki\n\n\tprob_table[idx_fbg] = p_fbg;\n\tprob_table[idx_fbi] = p_fbi;\n\tprob_table[idx_kbg] = p_kbg;\n\tprob_table[idx_kbi] = p_kbi;\n\tprob_table[idx_ftc] = p_ftc;\n\tprob_table[idx_ftc_given_kg] = p_ftc_given_kg;\n\tprob_table[idx_ftc_given_ki] = p_ftc_given_ki;\n\tprob_table[idx_fnt] = p_fnt;\n\tprob_table[idx_fnt_given_kg] = p_fnt_given_kg;\n\tprob_table[idx_fnt_given_ki] = p_fnt_given_ki;\n\n\tprob_table[idx_kta] = p_kta;\n\tprob_table[idx_kta_given_kg] = p_kta_given_kg;\n\tprob_table[idx_kta_given_ki] = p_kta_given_ki;\n\n\tprob_table[idx_ktc] = p_ktc;\n\tprob_table[idx_ktc_given_kg] = p_ktc_given_kg;\n\tprob_table[idx_ktc_given_ki] = p_ktc_given_ki;\n\n\tprob_table[idx_kg_given_ftc] = p_kg_given_ftc;\n\tprob_table[idx_ki_given_ftc] = p_ki_given_ftc;\n\tprob_table[idx_kg_given_kta] = p_kg_given_kta;\n\tprob_table[idx_ki_given_kta] = p_ki_given_kta;\n\tprob_table[idx_kg_given_ktc] = p_kg_given_ktc;\n\tprob_table[idx_ki_given_ktc] = p_ki_given_ktc;\n\n\tprob_table[idx_ftc_and_kta_given_kg] = p_ftc_and_kta_given_kg;\n\tprob_table[idx_ftc_and_kta_given_ki] = p_ftc_and_kta_given_ki;\n\tprob_table[idx_ftc_and_ktc_given_kg] = p_ftc_and_ktc_given_kg;\n\tprob_table[idx_ftc_and_ktc_given_ki] = p_ftc_and_ktc_given_ki;\n\n\tprob_table[idx_ftc_and_kta] = p_ftc_and_kta;\n\tprob_table[idx_ftc_and_ktc] = p_ftc_and_ktc;\n\tprob_table[idx_fnt_and_kta] = p_fnt_and_kta;\n\tprob_table[idx_fnt_and_ktc] = p_fnt_and_ktc;\n\n\tprob_table[idx_kg_given_ftc_and_kta] = p_kg_given_ftc_and_kta;\n\tprob_table[idx_kg_given_ftc_and_kta_vert] = p_kg_given_ftc_and_kta; //show vert slider as well\n\tprob_table[idx_ki_given_ftc_and_kta] = p_ki_given_ftc_and_kta;\n\tprob_table[idx_kg_given_ftc_and_ktc] = p_kg_given_ftc_and_ktc;\n\tprob_table[idx_ki_given_ftc_and_ktc] = p_ki_given_ftc_and_ktc;\n\n\tprob_table[idx_ftc_and_kta_given_kg] = p_ftc_and_kta_given_kg;\n\tprob_table[idx_ftc_and_ktc_given_kg] = p_ftc_and_ktc_given_kg;\n\tprob_table[idx_fnt_and_kta_given_kg] = p_fnt_and_kta_given_kg;\n\tprob_table[idx_fnt_and_ktc_given_kg] = p_fnt_and_ktc_given_kg;\n\n\tprob_table[idx_ftc_and_kta_given_ki] = p_ftc_and_kta_given_ki;\n\tprob_table[idx_ftc_and_ktc_given_ki] = p_ftc_and_ktc_given_ki;\n\tprob_table[idx_fnt_and_kta_given_ki] = p_fnt_and_kta_given_ki;\n\tprob_table[idx_fnt_and_ktc_given_ki] = p_fnt_and_ktc_given_ki;\n\n\t//console.log(\"prob kg_given_ftc_and_kta: \" + p_kg_given_ftc_and_kta);\n}", "function gen_op_vfp_muls()\n{\n gen_opc_ptr.push({func:op_vfp_muls});\n}", "function rescalePgs(pgs) {\n /**\n * PGS <35 excellent glycemic status (non-diabetic)\n * PGS 35-100 good glycemic status (diabetic)\n * PGS 100-150 poor glycemic status (diabetic)\n * PGS >150 very poor glycemic status (diabetic)\n */\n if (pgs <= 35) {\n return (pgs / 35) * (1 / 3)\n }\n if (pgs <= 100) {\n return (pgs / 100) * (2 / 3)\n }\n if (pgs <= 150) {\n return (pgs / 150) * (3 / 3)\n }\n return 1\n}", "function pa(a,b){\n// put higher-pressure first\n// put segments that are closer to initial edge first (and favor ones with no coords yet)\n// do normal sorting...\nreturn b.forwardPressure-a.forwardPressure||(a.backwardCoord||0)-(b.backwardCoord||0)||qa(a,b)}", "function thiefsKnapsack1 (x, items) {\n const sorted = items.sort((a, b) => a.val > b.val ? -1 : 1);\n //console.log(sorted);\n let groupVals = [];\n\n let n = items.length;\n let i = 0;\n\n while (i < items.length) {\n while (n > i) {\n let sumWeight = items.slice(i, n).reduce((acc, cur) => acc + cur.weight, 0);\n if (sumWeight <= x) {\n let sumVal = items.slice(i, n).reduce((acc, cur) => acc + cur.val, 0);\n groupVals.push(sumVal);\n }\n n --;\n }\n n = items.length;\n i ++;\n }\n\n groupVals = groupVals.sort((a, b) => a > b ? -1 : 1);\n //console.log(groupVals);\n return groupVals[0];\n}", "calPopulationFitness() {\n this.#fitsum = 0;\n for (let i = 0; i < this.parentPop.length; i++) {\n let song = this.parentPop[i];\n song.calFitness(fitnessChoice);\n this.#fitsum += song.fitness;\n }\n \n // parentPop Invariant\n if (minFitness) this.parentPop.sort(compareFitnessDec);\n else this.parentPop.sort(compareFitnessInc);\n }", "function gen_vfp_abs(/* int */ dp) { if (dp) gen_op_vfp_absd(); else gen_op_vfp_abss(); }", "function gen_vfp_touiz(/* int */ dp) { if (dp) gen_op_vfp_touizd(); else gen_op_vfp_touizs(); }", "function gen_vfp_sub(/* int */ dp) { if (dp) gen_op_vfp_subd(); else gen_op_vfp_subs(); }", "function processGroups () {\n groups.forEach((group) => {\n const sumOfWeights = group.variants.reduce((currValue, variant) =>\n currValue + (variant.weight || 1),\n 0\n );\n\n let upperBound = 0;\n group.variants.forEach((variant) => {\n upperBound += (variant.weight || 1) / sumOfWeights;\n variant.upperBound = upperBound;\n });\n });\n}", "function gen_op_vfp_touizs()\n{\n gen_opc_ptr.push({func:op_vfp_touizs});\n}", "function thiefsKnapsack2 (x, items) {\n items = items.sort((a, b) => a.val < b.val ? -1 : 1);\n\n let totalWeight = getWeight(items);\n let totalVal = getVal(items);\n let groupVals = [];\n\n while (totalWeight > x) {\n //console.log(items);\n for (let i = 0; i < items.length; i ++) {\n let tempItems = items.slice(0, i).concat(items.slice(i + 1));\n if (getWeight(tempItems) <= x) {\n groupVals.push(getVal(tempItems));\n }\n }\n totalWeight -= items[0].weight;\n totalVal -= items[0].val;\n items = items.slice(1);\n }\n\n groupVals = groupVals.sort((a, b) => a > b ? -1 : 1);\n //console.log(groupVals);\n return groupVals[0];\n}", "function gen_op_vfp_abss()\n{\n gen_opc_ptr.push({func:op_vfp_abss});\n}", "getDistribution(bucketSize,maximumBucket,numOfBuckets)\n {\n var priceArray = [];\n Data.map(function(content,index)\n {\n\n priceArray[index] = parseInt((content.price).substring(1));\n });\n\n var upperBucket;\n var bucket = Array(numOfBuckets);\n var upperArray = Array(numOfBuckets);\n var temp;\n var y=0;\n\n for(var i=1; i <= numOfBuckets;i++)\n {\n upperBucket =i*bucketSize;\n upperArray[i-1] = upperBucket;\n\n bucket[i-1]=0;\n y=0;\n\n while(priceArray[y+1]!=null)\n {\n //temp price float variable.\n temp = parseFloat(priceArray[y]);\n\n //Seeing if fits in bucket\n if((temp < upperBucket)&&(temp>=(upperBucket-bucketSize)))\n {\n //Increasing bucket counter if so\n bucket[i-1]++;\n }\n y++;\n }\n }\n\n //VERY USEFUL ALGORITHM FOR PAIRING ARRAYS TOGETHER.\n var distribution = upperArray.map(function(e, i)\n {\n return [e, bucket[i]];\n });\n\n return distribution;\n}", "function compose(f,g){\n var n = f.length;\n var out = (new Array(n)).fill(0).map(()=>new Array(n).fill(0));\n for(var x = 0; x < n; x++){\n let h = f[x];\n for(var y = 0; y < n; y++){\n let i = g[y];\n for(var k = 0; k < n;k++){ //rescale i by h[y] and add to out[x]\n out[x][k] += h[y]*i[k];\n }\n }\n }\n return out;\n}", "function branchingProcess() {\n var implicantsPowerSet = powerSet(remainingImplicants);\n validSolutions = filterPowerSet(implicantsPowerSet); //array contains valid cominations\n var currentValidSolutions = validSolutions.slice();\n minimalSolutions = filterPossibleSolutions(currentValidSolutions); //array contains valid combainations with least cost\n}", "function gen_op_vfp_sqrts()\n{\n gen_opc_ptr.push({func:op_vfp_sqrts});\n}", "function gen_vfp_cmpe(/* int */ dp) { if (dp) gen_op_vfp_cmped(); else gen_op_vfp_cmpes(); }", "function calculateFitnessChrom()\n{\n var gaps = new Array(); // to keep the amount of gaps in the layout\n\n var filledCols= new Array (theLayout.numCols); //to keep how filled is each column\n for (var i = 0 ; i < theLayout.numCols ; i++)\n filledCols[i] = 0;\n\n for ( var i = 0; i < this.adn.length; i++ ) {\n\n // select the column to place the layer. If the layer spans in more than\n // one column, the selected column will be the first column the layers uses\n\n var selCol = 0; // column to allocate the layer\n var selMean = 0; // used capacity mean\n var selStd = 0; // used capacity standard deviation\n for (var k=0 ; k < theLayout.widths[this.adn[i]] ; k++) {\n selMean += filledCols[k];\n }\n selMean /= theLayout.widths[this.adn[i]];\n\n for (var k=0 ; k < theLayout.widths[this.adn[i]] ; k++) {\n selStd += Math.abs(filledCols[k]-selMean);\n }\n selStd /= theLayout.widths[this.adn[i]];\n \n var limit = theLayout.numCols - theLayout.widths[this.adn[i]]+1;\n for ( var j = 1 ; j < limit ; j++) {\n\n var mean = 0;\n var std = 0;\n\n if (theLayout.widths[this.adn[i]] > 1) {\n for (var k=j ; k < j+theLayout.widths[this.adn[i]] ; k++) {\n mean += filledCols[k];\n }\n mean /= theLayout.widths[this.adn[i]];\n\n for (var k=j ; k < j+theLayout.widths[this.adn[i]] ; k++) {\n std += Math.abs(filledCols[k]-mean);\n }\n std /= theLayout.widths[this.adn[i]];\n }\n else {\n mean = filledCols[j];\n }\n\n if (std < selStd || (std == selStd && mean < selMean)) {\n selCol = j;\n selMean = mean;\n selStd = std;\n }\n }\n\n // once the column is chosen, if the layer spans more than one column,\n // the maximum used capacity is used\n var max = filledCols[selCol];\n if (theLayout.widths[this.adn[i]] > 1) {\n for (var k=selCol ; k < selCol+theLayout.widths[this.adn[i]] ; k++) {\n if ( filledCols[k] > filledCols[selCol] ) {\n max = filledCols[k];\n }\n }\n\n // detect gaps\n for (var k=selCol ; k < selCol+theLayout.widths[this.adn[i]] ; k++) {\n if (max > filledCols[k])\n gaps.push (max - filledCols[k]);\n }\n }\n\n // fill the column selected with the height of the layer\n for (var k=selCol ; k < selCol+theLayout.widths[this.adn[i]] ; k++) {\n filledCols[k] = max + $(theLayout.layers[this.adn[i]]).height() +\n theLayout.pixelsGap;\n }\n }\n\n // this part calculates the gaps at the bottom\n var max = filledCols[0];\n for ( var j = 1 ; j < theLayout.numCols ; j++) {\n if (filledCols[j] > max)\n max = filledCols[j];\n }\n\n for ( var j = 0 ; j < theLayout.numCols ; j++) {\n if (filledCols[j] < max)\n gaps.push (max - filledCols[j]);\n }\n\n\n // this part tries to minimize the gaps\n\n // If there were only one gap, the standard deviation would be 0,\n // so I insert a fictitious gap to avoid this problem\n gaps.push (0);\n\n var gapsMean = 0; // gap size mean\n if (gaps.length>0) {\n for (var k=0 ; k < gaps.length ; k++) {\n gapsMean += gaps[k];\n }\n gapsMean /= gaps.length;\n\n }\n\n this.fitness = gapsMean;\n\n return this.fitness;\n}", "function msfix1(gfc) {\n for (var sb = 0; sb < Encoder.SBMAX_l; sb++) {\n /* use this fix if L & R masking differs by 2db or less */\n /* if db = 10*log10(x2/x1) < 2 */\n /* if (x2 < 1.58*x1) { */\n if (gfc.thm[0].l[sb] > 1.58 * gfc.thm[1].l[sb]\n || gfc.thm[1].l[sb] > 1.58 * gfc.thm[0].l[sb])\n continue;\n var mld = gfc.mld_l[sb] * gfc.en[3].l[sb];\n var rmid = Math.max(gfc.thm[2].l[sb],\n Math.min(gfc.thm[3].l[sb], mld));\n\n mld = gfc.mld_l[sb] * gfc.en[2].l[sb];\n var rside = Math.max(gfc.thm[3].l[sb],\n Math.min(gfc.thm[2].l[sb], mld));\n gfc.thm[2].l[sb] = rmid;\n gfc.thm[3].l[sb] = rside;\n }\n\n for (var sb = 0; sb < Encoder.SBMAX_s; sb++) {\n for (var sblock = 0; sblock < 3; sblock++) {\n if (gfc.thm[0].s[sb][sblock] > 1.58 * gfc.thm[1].s[sb][sblock]\n || gfc.thm[1].s[sb][sblock] > 1.58 * gfc.thm[0].s[sb][sblock])\n continue;\n var mld = gfc.mld_s[sb] * gfc.en[3].s[sb][sblock];\n var rmid = Math.max(gfc.thm[2].s[sb][sblock],\n Math.min(gfc.thm[3].s[sb][sblock], mld));\n\n mld = gfc.mld_s[sb] * gfc.en[2].s[sb][sblock];\n var rside = Math.max(gfc.thm[3].s[sb][sblock],\n Math.min(gfc.thm[2].s[sb][sblock], mld));\n\n gfc.thm[2].s[sb][sblock] = rmid;\n gfc.thm[3].s[sb][sblock] = rside;\n }\n }\n }", "function msfix1(gfc) {\n for (var sb = 0; sb < Encoder.SBMAX_l; sb++) {\n /* use this fix if L & R masking differs by 2db or less */\n /* if db = 10*log10(x2/x1) < 2 */\n /* if (x2 < 1.58*x1) { */\n if (gfc.thm[0].l[sb] > 1.58 * gfc.thm[1].l[sb]\n || gfc.thm[1].l[sb] > 1.58 * gfc.thm[0].l[sb])\n continue;\n var mld = gfc.mld_l[sb] * gfc.en[3].l[sb];\n var rmid = Math.max(gfc.thm[2].l[sb],\n Math.min(gfc.thm[3].l[sb], mld));\n\n mld = gfc.mld_l[sb] * gfc.en[2].l[sb];\n var rside = Math.max(gfc.thm[3].l[sb],\n Math.min(gfc.thm[2].l[sb], mld));\n gfc.thm[2].l[sb] = rmid;\n gfc.thm[3].l[sb] = rside;\n }\n\n for (var sb = 0; sb < Encoder.SBMAX_s; sb++) {\n for (var sblock = 0; sblock < 3; sblock++) {\n if (gfc.thm[0].s[sb][sblock] > 1.58 * gfc.thm[1].s[sb][sblock]\n || gfc.thm[1].s[sb][sblock] > 1.58 * gfc.thm[0].s[sb][sblock])\n continue;\n var mld = gfc.mld_s[sb] * gfc.en[3].s[sb][sblock];\n var rmid = Math.max(gfc.thm[2].s[sb][sblock],\n Math.min(gfc.thm[3].s[sb][sblock], mld));\n\n mld = gfc.mld_s[sb] * gfc.en[2].s[sb][sblock];\n var rside = Math.max(gfc.thm[3].s[sb][sblock],\n Math.min(gfc.thm[2].s[sb][sblock], mld));\n\n gfc.thm[2].s[sb][sblock] = rmid;\n gfc.thm[3].s[sb][sblock] = rside;\n }\n }\n }", "function gen_op_vfp_divs()\n{\n gen_opc_ptr.push({func:op_vfp_divs});\n}", "function recalcFpr(n) {\n var pbgna=parseFloat($('#fpr'+n).val());\n var pbga=parseFloat($('#pbga'+n).val());\n var pa=parseFloat($('#pagb'+(n-1)).val());\n var pb = pbga*pa + pbgna*(1-pa);\n $('#pb'+n).val(pb);\n recalcBayes(n); \n}", "getAboveGPA(num = 0) {\n let st = new Set()\n for (let s of this.stumap.values())\n if (s.gpa > num) st.add(s);\n return st\n }", "function fusion(liste)\r\n{\r\n var tempArray = liste.slice(); // Copie temporaire du tableau (liste)\r\n for(var k=0; k<size; k++)\r\n {\r\n if(tempArray[k] != null)\r\n {\r\n var l = k+1;\r\n\r\n while(tempArray[l]==null && l<=size)\r\n {\r\n l++;\r\n }\r\n\r\n if(tempArray[l] == tempArray[k])\r\n {\r\n tempArray[k] = tempArray[k]*2;\r\n tempArray[l] = null;\r\n moved = true;\r\n caseBoitesRemplies--;\r\n }\r\n\r\n k = l-1;\r\n }\r\n }\r\n\r\n var l = 0;\r\n\r\n for(var k=0; k<size; k++)\r\n {\r\n if(tempArray[k] != null)\r\n {\r\n if(l == k)\r\n l++;\r\n else\r\n {\r\n tempArray[l] = tempArray[k];\r\n tempArray[k] = null;\r\n l++;\r\n moved = true;\r\n }\r\n }\r\n }\r\n return tempArray;\r\n}", "function sol15(floors = 6, eggs = 2) {\n const dp = [];\n for (let i = 0; i <= eggs; i++) {\n const row = [];\n for (let j = 0; j <= floors; j++) {\n row.push(Infinity);\n }\n dp.push(row);\n }\n for (let i = 0; i < dp[0].length; i++) {\n dp[0][i] = i;\n dp[1][i] = i;\n }\n\n for (let i = 2; i <= eggs; i++) {\n for (let j = 1; j <= floors; j++) {\n for (let k = 1; k <= j; k++) {\n let res = 1 + Math.max(dp[i - 1][j - 1], dp[i][j - k]);\n dp[i][j] = Math.max(dp[i][j], res);\n }\n }\n }\n\n return dp;\n}", "function Gn(e,t){var a=e[t];e.sort(function(e,t){return P(e.from(),t.from())}),t=d(e,a);for(var n=1;n<e.length;n++){var r=e[n],f=e[n-1];if(P(f.to(),r.from())>=0){var o=G(f.from(),r.from()),i=U(f.to(),r.to()),s=f.empty()?r.from()==r.head:f.from()==f.head;n<=t&&--t,e.splice(--n,2,new Di(s?i:o,s?o:i))}}return new Oi(e,t)}", "function convert12PointToGPA(universityIndex, marks, creditWeights){\n var GPAtotal=0;\n var creditTotal=0;\n var PointTotal=0; //for calculating the 12-point grade\n var pointTotal9=0; //used for calculating the 9-point grade \n\n var referenceLetterGradeIndex=universities[universityIndex][2]; //the index of which letter grades to use from the GPA list\n\n for (var i=0; i<maxCourses; i++){ //checks every input for a valid entry\n\n for (var j=0; j<sizeOfGPAList; j++){\n\n var mark=parseFloat(marks[i]);\n\n //tries to match the letter to one in the GPAlist\n if (mark>=GPAlist[j][8] && !isNaN(mark) && mark<=12 && mark >=0){ //if input is valid and if it finds the input in the list\n \n var creditWeight=Number(creditWeights[i]);\n PointTotal+=mark*creditWeight;\n pointTotal9+=GPAlist[j][10]*creditWeight;\n GPAtotal+=GPAlist[j][0]*creditWeight; //adds the GPA to the total\n creditTotal+=creditWeight;\n break;\n }\n }\n }\n\n var GPA=GPAtotal/creditTotal;\n var points=PointTotal/creditTotal;\n var points9=pointTotal9/creditTotal;\n\n if (isNaN(GPA) || isNaN(points)){//Checks to make sure that the fields were filled in\n GPA=0;\n points=0;\n points9=0;\n }\n\n //calculates the letter grade based on the GPA\n var i;\n for (i = 0; i <sizeOfGPAList; i++) {\n if (Math.round(GPA*10)/10>=GPAlist[i][0]){ //rounds GPA to 1 decimal place before converting to letter grade. So a 3.95 is same as a 4.0\n break;\n }\n }\n\n var grades=new Array(GPA,GPAlist[i][referenceLetterGradeIndex],points,points9);\n\n return grades;\n \n}", "gauss(index_in, index_out) {\n\t\tvar chisl = this.numerator[index_out][index_in];\n\t\tvar znamen = this.denominator[index_out][index_in];\n\t\tvar tmp_n = new Array(this.n);\n\t\tvar tmp_d = new Array(this.n);\n\n\t\tif (chisl < 0) {\n\t\t\ttmp_n[index_out] = -znamen;\n\t\t\ttmp_d[index_out] = -chisl;\n\t\t} else {\n\t\t\ttmp_n[index_out] = znamen;\n\t\t\ttmp_d[index_out] = chisl;\n\t\t}\n\n\t\tvar x, y, z;\n\t\tfor (let i=0; i<this.m; i++) {\n\t\t\tif (this.numerator[index_out][i] === 0) continue;\n\t\t\tx = this.numerator[index_out][i] * znamen;\n\t\t\ty = this.denominator[index_out][i] * chisl;\n\t\t\tif (y < 0) {\n\t\t\t\ty = -y;\n\t\t\t\tx = -x;\n\t\t\t}\n\t\t\tz = nod(x, y);\n\t\t\tthis.numerator[index_out][i] = x / z;\n\t\t\tthis.denominator[index_out][i] = y / z;\n\t\t}\n\t\tx = this.b_numerator[index_out] * znamen;\n\t\ty = this.b_denominator[index_out] * chisl;\n\t\tif (y < 0) {\n\t\t\ty = -y;\n\t\t\tx = -x;\n\t\t}\n\t\tif(x===0) {\n\t\t\tthis.b_numerator[index_out] = 0;\n\t\t\tthis.b_denominator[index_out] = 1;\n\t\t} else {\n\t\t\tz = nod(x, y);\n\t\t\tthis.b_numerator[index_out] = x / z;\n\t\t\tthis.b_denominator[index_out] = y / z;\n\t\t}\n\n\t\tvar a, b, c;\n\t\tfor (let i=0; i<this.n; i++) {\n\t\t\tif (i == index_out) continue;\n\t\t\ta = this.numerator[i][index_in];\n\t\t\tb = this.denominator[i][index_in];\n\t\t\tif (a === 0) {\n\t\t\t\ttmp_n[i] = 0;\n\t\t\t\ttmp_d[i] = 1;\n\t\t\t} else {\n\t\t\t\tc = nod(a*znamen, b*chisl);\n\t\t\t\tif (b*chisl > 0) {\n\t\t\t\t\ttmp_n[i] = -a*znamen / c;\n\t\t\t\t\ttmp_d[i] = b*chisl / c;\n\t\t\t\t} else {\n\t\t\t\t\ttmp_n[i] = a*znamen / c;\n\t\t\t\t\ttmp_d[i] = -b*chisl / c;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let j=0; j<this.m; j++) {\nx = this.numerator[i][j] * this.denominator[index_out][j]*b - \n\tthis.denominator[i][j] * this.numerator[index_out][j]*a;\ny = this.denominator[i][j] * this.denominator[index_out][j]*b;\n\t\t\t\tif (x===0) {\n\t\t\t\t\tthis.numerator[i][j] = 0;\n\t\t\t\t\tthis.denominator[i][j] = 1;\n\t\t\t\t} else {\n\t\t z = nod(x,y);\n\t\t\t\t\tthis.numerator[i][j] = x / z;\n\t\t\t\t\tthis.denominator[i][j] = y / z;\n\t\t\t\t}\n\t\t\t}\n\nx = this.b_numerator[i] * this.b_denominator[index_out]*b - \n\tthis.b_denominator[i] * this.b_numerator[index_out]*a;\ny = this.b_denominator[i] * this.b_denominator[index_out]*b;\n\t\t\tif (x===0) {\n\t\t\t\tthis.b_numerator[i] = 0;\n\t\t\t\tthis.b_denominator[i] = 1;\n\t\t\t} else {\n\t\t\t\tvar z = nod(x,y);\n\t\t\t\tthis.b_numerator[i] = x / z;\n\t\t\t\tthis.b_denominator[i] = y / z;\n\t\t\t}\n\n\t\t}\n\n\t\ta = this.f_numerator[index_in];\n\t\tb = this.f_denominator[index_in];\n\t\tfor (let j=0; j<this.m; j++) {\n\t\t\tx = this.f_numerator[j] * this.denominator[index_out][j]*b - \n\t\t\t\tthis.f_denominator[j] * this.numerator[index_out][j]*a;\n\t\t\ty = this.f_denominator[j] * this.denominator[index_out][j]*b;\n\t\t\tif (x===0) {\n\t\t\t\tthis.f_numerator[j] = 0;\n\t\t\t\tthis.f_denominator[j] = 1;\n\t\t\t} else {\n\t z = nod(x,y);\n\t\t\t\tthis.f_numerator[j] = x / z;\n\t\t\t\tthis.f_denominator[j] = y / z;\n\t\t\t}\n\t\t}\n\t\tc = nod(a*znamen, b*chisl);\n\t\tif (b*chisl > 0) {\n\t\t\tthis.f_numerator[index_in] = -a*znamen / c;\n\t\t\tthis.f_denominator[index_in] = b*chisl / c;\n\t\t} else {\n\t\t\tthis.f_numerator[index_in] = a*znamen / c;\n\t\t\tthis.f_denominator[index_in] = -b*chisl / c;\n\t\t}\n\n\t\tlet tmp_index = this.basis[index_out];\n\t this.basis[index_out] = this.free[index_in];\n\t this.free[index_in] = tmp_index;\n\n\t\tfor (let i=0; i<this.n; i++) {\n\t\t\tthis.numerator[i][index_in] = tmp_n[i];\n\t\t\tthis.denominator[i][index_in] = tmp_d[i];\n\t\t}\n\t}", "function calcGP(grade) {\n\tswitch (grade) {\n \t\tcase \"A+\":GP += 4.3;\n \t\tbreak;\n \t\tcase \"A\":GP += 4;\n \t\tbreak;\n \t\tcase \"A-\":GP += 3.7;\n \t\tbreak;\n \t\tcase \"B+\":GP += 3.3;\n \t\tbreak;\n \t\tcase \"B\":GP += 3;\n \t\tbreak;\n \t\tcase \"B-\":GP += 2.7;\n \t\tbreak;\n \t\tcase \"C+\":GP += 2.3;\n \t\tbreak;\n \tcase \"C\":GP += 2;\n \t\tbreak;\n \tcase \"C-\":GP += 1.7;\n \t\tbreak;\n \tcase \"D+\":GP += 1.3;\n \t\tbreak;\n \tcase \"D\":GP += 1;\n \t\tbreak;\n \tcase \"D-\":GP += 0.7;\n \t\tbreak;\n \tdefault: break;\n \t\n\t}\n}", "function formula_cnf_distribute(frm) {\n var op,res,i,j,k,el,tmp,simp,comp;\n tmp=typeof frm;\n if (tmp===\"number\" || tmp===\"string\") { \n // frm is a variable\n return frm; \n } else { \n // frm is a term\n op=frm[0];\n if (op===\"-\") return frm; // frm is a negative literal\n // here op is either & or V\n if (op===\"&\") {\n // conjunction\n res=[\"&\"];\n for(j=1;j<frm.length;j++) {\n el=formula_cnf_distribute(frm[j]);\n tmp=typeof el;\n if (tmp===\"number\" || tmp===\"string\" || \n el[0]===\"-\" || el[0]===\"V\") {\n res.push(el);\n } else {\n // flatten nested &-s\n for (k=1;k<el.length;k++) {\n res.push(el[k]);\n }\n } \n }\n return res; \n } else if (op===\"V\"){\n // disjunction\n simp=[\"V\"]; // non-conjunctions only\n comp=[]; // list of conjunctions\n for(j=1;j<frm.length;j++) {\n el=formula_cnf_distribute(frm[j]);\n tmp=typeof el;\n if (tmp===\"number\" || tmp===\"string\" || el[0]===\"-\") {\n simp.push(el);\n } else if (el[0]===\"&\") {\n comp.push(el);\n } else { \n for (k=1;k<el.length;k++) {\n simp.push(el[k]);\n } \n } \n }\n if (comp.length===0) return simp; \n tmp=combinations(simp,comp);\n res=[\"&\"];\n for(j=0;j<tmp.length;j++) {\n res.push(formula_cnf_distribute(tmp[j]));\n } \n return res;\n } else {\n return [\"error\",\"op not allowed\"];\n } \n } \n}", "simplex2max() {\n\t\tvar ind_in = this.simplex_max_in();\n\t\twhile (ind_in >= 0) {\n\t\t\tvar ind_out = this.simplex_out(ind_in);\n\t\t\tif (ind_out == -1) return false;\n\t\t\tthis.gauss(ind_in, ind_out);\n\t\t\tind_in = this.simplex_max_in();\n\t\t}\n\t}", "function solution2(S, P, Q) {\n // Take two. After some research, realizing I was prefix summing the wrong thing: we don't\n // care about the sum of impact values (all that matters for those is relative min),\n // but we DO care about the counts of each nucleotide (starting with the lowest impact ones)\n\n // Init result array and 2d prefix count array\n const pCounts = [[0],[0],[0]]; // tracks sums of A, C, G nucleotides (don't need highest T)\n const result = [];\n\n // Create prefix counts array, one set of nucleotide counts for each step along the sequence\n for (let i = 0; i < S.length; i++){\n\n // Copy the previous counts for this set of counts - only one will change, done below\n pCounts[0].push(pCounts[0][i]);\n pCounts[1].push(pCounts[1][i]);\n pCounts[2].push(pCounts[2][i]);\n\n // Increment the corresponding nucleotide counter\n switch (S[i]){\n case \"A\":\n pCounts[0][i+1] += 1;\n break;\n case \"C\":\n pCounts[1][i+1] += 1;\n break;\n case \"G\":\n pCounts[2][i+1] += 1;\n break;\n }\n }\n\n // Now that prefix counts are created, for each query,\n // check for differences of each type in the P-Q range,\n // starting from lowest impact value\n for(let i = 0; i < Q.length; i++){\n // Check for A's (impact 1) - any increases in the A counts in range P-Q\n if(pCounts[0][Q[i]+1] - pCounts[0][P[i]] > 0){\n result.push(1);\n } else if(pCounts[1][Q[i]+1] - pCounts[1][P[i]] > 0){\n result.push(2);\n } else if(pCounts[2][Q[i]+1] - pCounts[2][P[i]] > 0){\n result.push(3);\n } else result.push(4)\n }\n return result;\n}", "function gen_vfp_add(/* int */ dp) { if (dp) gen_op_vfp_addd(); else gen_op_vfp_adds(); }", "function Fp(a,b){this.g=[];this.F=a;this.D=b||null;this.f=this.a=!1;this.c=void 0;this.w=this.H=this.l=!1;this.h=0;this.b=null;this.o=0}", "function getGPSCoords(arr) {\n for (var j = 0; j < arr.length; j++) {\n var ob = arr[j] ;\n var a1 = ob.facGPSCoords.split(\"' \").join(\",\").split(\"'\").join(\"\").split(\",\");\n // [[\"-30 27.382\", \"30 22.319\"], [\"-30 81.385\", \"30 32.574\"]]\n for(var i = 0; i< a1.length;i++){\n var a2 = a1[i].split(\" \");\n var val1 = parseFloat(a2[0]);\n var sign = Math.sign(val1);\n val1 = Math.abs(val1);\n var val2 = parseFloat(a2[1]);\n val2 /= 60;\n a1[i] = (val1+val2) *sign;\n }\n a1[2] = arr[j].orgID;\n a1[3] = arr[j].facName;\n a1[4] = arr[j].flags;\n myObjToArray.push(a1);\n }; \n return myObjToArray;\n }", "function distribute(gifts,socks){\n let result = [];\n if(socks.length == gifts.length){\n return gifts.sort((a,b) => b-a)\n }else if(socks.length > gifts.length){\n gifts.sort((a,b) => b-a).splice(gifts.indexOf(gifts.length-1), 0, 0)\n return gifts\n }else{\n let temp = []\n \n while(socks.length > 0){\n if(socks.length == 1) temp.push(Math.max(...gifts));\n if(socks.length > 1){\n temp.push(Math.min(...gifts))\n gifts.splice(gifts.indexOf(Math.min(...gifts)), 1)\n temp.push(Math.max(...gifts))\n gifts.splice(gifts.indexOf(Math.max(...gifts)), 1)\n socks.splice(0, 2)\n }\n \n }\n return temp.sort((a,b) => b-a)\n }\n }", "function gen_op_vfp_subs()\n{\n gen_opc_ptr.push({func:op_vfp_subs});\n}", "function grnampt_getF2(f1, c1, ks, ts)\n//\n// Input: f1 = old infiltration volume (ft)\n// c1 = head * moisture deficit (ft)\n// ks = sat. hyd. conductivity (ft/sec)\n// ts = time step (sec)\n// Output: returns infiltration volume at end of time step (ft)\n// Purpose: computes new infiltration volume over a time step\n// using Green-Ampt formula for saturated upper soil zone.\n//\n{\n let i;\n let f2 = f1;\n let f2min;\n let df2;\n let c2;\n\n // --- find min. infil. volume\n f2min = f1 + ks * ts;\n\n // --- use min. infil. volume for 0 moisture deficit\n if ( c1 == 0.0 ) return f2min;\n\n // --- use direct form of G-A equation for small time steps\n // and c1/f1 < 100\n if ( ts < 10.0 && f1 > 0.01 * c1 )\n {\n f2 = f1 + ks * (1.0 + c1/f1) * ts;\n return MAX(f2, f2min);\n }\n\n // --- use Newton-Raphson method to solve integrated G-A equation\n // (convergence limit reduced from that used in previous releases)\n c2 = c1 * Math.log(f1 + c1) - ks * ts;\n for ( i = 1; i <= 20; i++ )\n {\n df2 = (f2 - f1 - c1 * Math.log(f2 + c1) + c2) / (1.0 - c1 / (f2 + c1) );\n if ( Math.abs(df2) < 0.00001 )\n {\n return MAX(f2, f2min);\n }\n f2 -= df2;\n }\n return f2min;\n}", "function maximumBy(f, xs) {\n return xs.reduce(function (a, x) {\n return a === undefined ? x : (\n f(x, a) > 0 ? x : a\n );\n }, undefined);\n }", "function convertAdUnitFpd(arr) {\n var convert = [];\n arr.forEach(function (adunit) {\n if (adunit.fpd) {\n adunit['ortb2Imp'] ? utils.mergeDeep(adunit['ortb2Imp'], convertImpFpd(adunit.fpd)) : adunit['ortb2Imp'] = convertImpFpd(adunit.fpd);\n convert.push(function (_ref) {\n var fpd = _ref.fpd,\n duplicate = _objectWithoutProperties(_ref, [\"fpd\"]);\n\n return duplicate;\n }(adunit));\n } else {\n convert.push(adunit);\n }\n });\n return convert;\n }", "function bc(){for(var a=B.Za(),b=[],c=[],d=0;d<a.length;d++){var e=a[d].Hf;e&&(e=e.call(a[d]))&&(e[2]?b.push(e):c.push(e))}c.sort(cc);b.sort(cc);return[c,b]}", "function gen_vfp_mul(/* int */ dp) { if (dp) gen_op_vfp_muld(); else gen_op_vfp_muls(); }", "aggregateUpLeft(uncombined) {\r\n let zeroToAdd = uncombined.filter((i) => i === 0)\r\n let withoutZero = uncombined.filter(i => i);\r\n let shifted = withoutZero.concat(zeroToAdd);\r\n for (let i = 0; i < this.size - 1; i++) {\r\n if (shifted[i] === shifted[i + 1]) {\r\n shifted[i] = shifted[i] + shifted[i + 1]; \r\n this.gameState.score += shifted[i]; \r\n shifted[i + 1] = 0;\r\n }\r\n }\r\n zeroToAdd = shifted.filter((i) => i === 0)\r\n withoutZero = shifted.filter(i => i);\r\n shifted = withoutZero.concat(zeroToAdd);\r\n return shifted;\r\n }", "function g_merge(left, right, on_field, order)\r\n{\r\n var result = [];\r\n var val, val_r, obj, obj_r;\r\n\r\n\r\n while((left.length > 0) && (right.length > 0))\r\n {\r\n obj = left[0];\r\n obj_r = right[0];\r\n\r\n val = obj.computed[on_field] === undefined ?\r\n obj[on_field] : obj.computed[on_field];\r\n val_r = obj_r.computed[on_field] === undefined ?\r\n obj_r[on_field] : obj_r.computed[on_field];\r\n\r\n if(order ? val < val_r : val > val_r)\r\n result.push(left.shift());\r\n else\r\n result.push(right.shift());\r\n }\r\n while(left.length > 0)\r\n result.push(left.shift());\r\n while(right.length > 0)\r\n result.push(right.shift());\r\n return result;\r\n}", "function solution(S, P, Q) {\n // This one stumped me to provide an efficient solution... surely there's a better way\n // than having to re-loop over sections already queried, but I'm not sure how to store that\n // data in any way that's more efficient than reviewing the slice.. you could make a map\n // of already queried ranges and set all of their min values to that amount... but as range\n // sizes differ, so will the relative smallest impact. Boo.\n\n // Init result array and pSums array\n const result = [];\n // const pSums = [0];\n // const pDifs = [0];\n\n // Define function that converts nucleotide string to impact factor\n function getImpactVal(nucleotide){\n switch (nucleotide){\n case \"A\":\n return 1;\n case \"C\":\n return 2;\n case \"G\":\n return 3;\n case \"T\":\n return 4;\n }\n }\n\n // // Create psums array\n // for (let i = 1; i < S.length +1; i++){\n // // each element beyond the first is the difference\n // pDifs[i] = getImpactVal(S[i-1]) - pDifs[i-1];\n // // Each element in the array beyond the first is the impact value at S[i] + the prior total\n // pSums[i] = getImpactVal(S[i-1]) + pSums[i-1];\n // }\n\n // Iterate query arrays\n for(let i = 0; i < P.length; i++){\n // Get slice for query\n let sSlice = S.slice(P[i], Q[i]+1)\n let minImpact = undefined;\n\n for(let nucleotide of sSlice){\n let currImpact = getImpactVal(nucleotide);\n if(typeof minImpact == 'undefined' || minImpact > currImpact){\n minImpact = currImpact;\n }\n }\n // add total to result array\n result.push(minImpact);\n\n }\n return result;\n\n}", "function GEMSWithProbability() {\n\n const probabilityArray = [];\n\n GEMS.forEach( gem => {\n\n for (let i = 0; i < gem.probability; i++) {\n probabilityArray.push(gem);\n }\n\n });\n\n return probabilityArray;\n}", "function getEffectiveWpfs(pd, archery_wpf, melee_wpf, encumberance) {\n\tpd = parseInt(pd);\n\tarchery_wpf = parseInt(archery_wpf);\n\tmelee_wpf = parseInt(melee_wpf);\n\t\n\tencumberance = parseFloat(encumberance);\t\t\t\t\t\n\t\n\tvar nerfed_wpf = archery_wpf - (pd * 14);\n\n\tif (nerfed_wpf < 1) \n\t\tnerfed_wpf = 1;\t\t\t\t\t\n\n\tnerfed_wpf = Math.floor( Math.pow(nerfed_wpf, 1.16));\n\n\tvar encumbered_archery_wpf = nerfed_wpf - (encumberance * 2.5);\n\n\tvar pd_malus = 0;\n\n\tif (encumbered_archery_wpf < 0) {\n\t\tencumbered_archery_wpf = 1;\n\t\tpd_malus = Math.abs(encumbered_archery_wpf);\n\t\tpd_malus = Math.floor(pd_malus / 25) + 1;\n\t} else if (encumbered_archery_wpf < 1) {\n\t\tencumbered_archery_wpf = 1;\n\t}\n\n\tvar effective_pd = pd - pd_malus;\n\n\tvar encumbered_melee_wpf = melee_wpf - encumberance;\n\n\tif (encumbered_melee_wpf < 1) \n\t\tencumbered_melee_wpf = 1\n\t\n\treturn [encumbered_archery_wpf, effective_pd, encumbered_melee_wpf];\n}", "function fn(n, src, got, all, subsets_total) \n{\t\n\tif (n == 0) \n\t{\n\t\tif (got.length > 0) \n\t\t{\n\t\t\tall[all.length] = got;\n\t\t}\n\t\treturn;\n\t}\n\t\n\tfor (var j = 0; j < src.length; j++) \n\t{\t\n\t\tvar curr_price = Number(src[j][\"price\"].replace(\"$\", \"\"));\n\t\tsubsets_total += curr_price;\t\n\t\tif(subsets_total <= total){\n\t\t\tfn(n - 1, src.slice(j + 1), got.concat([src[j]]), all, subsets_total);\t\t//different products with lesser difference is cost are considered\n\t\t} else {\n\t\t\tsubsets_total = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn;\n}", "function convertPercentToGPA(universityIndex, marks, creditWeights){\n var GPAtotal=0;\n var creditTotal=0;\n var pointTotal=0; //for calculating the 12-point grade\n var pointTotal9=0; //used for calculating the 9-point grade\n\n var referencePercentageIndex=universities[universityIndex][1]; //the index of which percentage ranges to use from the GPA list\n var referenceLetterGradeIndex=universities[universityIndex][2]; //the index of which letter grades to use from the GPA list\n\n for (var i=0; i<maxCourses; i++){ //checks every input for a valid entry\n\n //finds the range at which the mark fits in\n for (var j=0; j<sizeOfGPAList; j++){ \n\n var mark=parseFloat(marks[i]);\n\n //checks to make sure an input is valid\n if (mark>=0 && mark<=100 &&!isNaN(mark) && mark>=GPAlist[j][referencePercentageIndex]){\n\n var creditWeight=Number(creditWeights[i]);\n GPAtotal+=GPAlist[j][0]*creditWeight; //adds the GPA to the total\n creditTotal+=creditWeight;\n pointTotal+=GPAlist[j][8]*creditWeight;\n pointTotal9+=GPAlist[j][10]*creditWeight;\n break;\n }\n }\n }\n\n var GPA=GPAtotal/creditTotal;\n var points=pointTotal/creditTotal;\n var points9=pointTotal9/creditTotal;\n\n if (isNaN(GPA) || isNaN(points)){//Checks to make sure that the fields were filled in\n GPA=0;\n points=0;\n points9=0;\n }\n\n //calculates the letter grade based on final GPA\n var i;\n for (i = 0; i <sizeOfGPAList; i++) {\n if (Math.round(GPA*10)/10>=GPAlist[i][0]){ //rounds GPA to 1 decimal place before converting to letter grade. So a 3.95 is same as a 4.0\n break;\n }\n }\n\n var grades=new Array(GPA,GPAlist[i][referenceLetterGradeIndex],points,points9);\n\n return grades;\n}", "function bfs(self, i, j, comparator, comparator2) {\n let visited = [];\n let priorityQueue = [{pos:{x:i,y:j},dist:0}];\n let myMap = self.map;\n \n let initialTime = new Date();\n \n while (priorityQueue.length > 0) {\n let currentTime = new Date();\n //self.log(`Time: ${(currentTime - initialTime)}`);\n let check = priorityQueue.shift();\n \n //e.g if that check position is a fuel place\n if (comparator(self, check.pos.x, check.pos.y) === true){\n return [check.pos.x, check.pos.y];\n }\n else {\n visited.push(check);\n let neighbors = getNeighbors(check.pos.x, check.pos.y);\n for (let k = 0; k < neighbors.length; k++) {\n \n let nx = neighbors[k][0];\n let ny = neighbors[k][1];\n let neighbor = {pos:{x:nx,y:ny},dist:qmath.dist(i,j,nx,ny)}\n \n //check if neighbor position is valid . eg if its passable terrain\n if (inArr(nx,ny,myMap) && comparator2(self, nx, ny) === true) {\n //check if previously unvisited\n let visitedThis = false;\n //maybe run from length to 0, may be faster\n for (let p = 0; p < visited.length; p++) {\n if (visited[p].pos.x === nx && visited[p].pos.y === ny){\n visitedThis = true;\n break;\n }\n }\n //if previously unvisted, add to queue, then sort entire queue\n if (visitedThis === false) {\n priorityQueue.push(neighbor);\n }\n }\n }\n \n //re sort queue by least distance\n /*\n priorityQueue.sort(function(a,b){\n return a.dist - b.dist;\n });\n */\n }\n }\n}", "function _calculateProbs (data, features, target) {\n debug('* _calculateProbs #data:', data.length, 'features:', features);\n\n //init\n var probs = {};\n\n data.map(function (doc) {\n features.map(function (key) {\n if (!doc[key]) return;\n\n var v = doc[key];\n var t = doc[target];\n if (v && t) {\n if (!probs[key]) probs[key] = { };\n if (!probs[key][v]) probs[key][v] = { __all: 0 };\n if (!probs[key][v][t]) probs[key][v][t] = 0;\n probs[key][v][t] += 1;\n probs[key][v].__all += 1;\n }\n });\n });\n\n return probs;\n}", "function gv(a,b){this.oq=[];this.W3=a;this.TY=b||null;this.Uz=this.lh=!1;this.Ng=void 0;this.TU=this.J$=this.kL=!1;this.ZJ=0;this.Fb=null;this.bE=0}", "function criaXisEfs(fun, rest, qtdRes) {\r\n\t\t\r\n\t\t//adiciono no primeiro elemento a BASE\r\n\t\t_xisEfs.push(\"BASE\");\r\n\r\n\t\t//for vai percorrer todos elementos do meu array de funcao mais os fs que são qtdRestricoes\r\n\t\tfor(var i = 0; i < fun.length + rest.length ; i++) {\r\n\r\n\t\t\t//se o i for maior que numero de elementos na funcao ele grava os Fs\r\n\t\t\tif(i < fun.length){\r\n\t\t\t\t//aqui o i ainda nao é maior entao grava o nome do xis da funcao\r\n\t\t\t\t_xisEfs.push(fun[i].xis);\r\n\t\t\t}else{\r\n\t\t\t\t//aqui o i ja é maior entao quer dizer que ja acabou toda minha funcao grava os Fs\r\n\t\t\t\t//Fs são sempre o i menos a total da funcao para comesar com 1,2,3...\r\n\t\t\t\t//verifico se operador é > para gravar E de excesso e A de artificial\r\n\t\t\t\tconsole.log(i - fun.length)\r\n\t\t\t\tif(rest[i - fun.length][rest[i- fun.length].length -1].operador == \">\"){\r\n\t\t\t\t\t_xisEfs.push(\"E\"+ ((1+i) - fun.length));\r\n\t\t\t\t\t_xisEfs.push(\"A\"+ ((1+i) - fun.length));\r\n\t\t\t\t}else{\r\n\t\t\t\t\tif(rest[i - fun.length][rest[i - fun.length].length -1].operador == \"=\"){\r\n\t\t\t\t\t\t_xisEfs.push(\"A\"+ ((1+i) - fun.length));\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t_xisEfs.push(\"F\"+ ((1+i) - fun.length));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//adiciona o bzinho no final \r\n\t\t_xisEfs.push(\"b\");\r\n\t}// fim de criaXisEfs", "function ff(a, b, c, d, x, s, t) {\n return collect((b & c) | ((~b) & d), a, b, x, s, t);\n}", "function sum(elen, e, flen, f, h) {\n let Q, Qnew, hh, bvirt;\n let enow = e[0];\n let fnow = f[0];\n let eindex = 0;\n let findex = 0;\n if ((fnow > enow) === (fnow > -enow)) {\n Q = enow;\n enow = e[++eindex];\n } else {\n Q = fnow;\n fnow = f[++findex];\n }\n let hindex = 0;\n if (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = enow + Q;\n hh = Q - (Qnew - enow);\n enow = e[++eindex];\n } else {\n Qnew = fnow + Q;\n hh = Q - (Qnew - fnow);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n while (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n } else {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n }\n while (eindex < elen) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n while (findex < flen) {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n }", "function tgsf(){\t\n\tvar k = false;\n\tvar inp = false;\t\n\tvar prev = false;\n\tvar group = $(\"[data-tgsf-group]\");\n\t$(\".tgsf .inpn,.tgsf .inp,.tgsf p,.tgsf .p,.tgsf .area__img1-c2\").click(function(event){\n\t\tevent.stopPropagation();\n\t\tk = $(this).closest(\".tgsf\");\n\t\tinp = k.find(\".inp\");\t\n\t\tif(inp.attr(\"type\") === \"radio\"){\n\t\t\tprev = $(\"html\").find(\".tgsf.act .inp[name = \" + inp.attr('name') + \"]\");\n\t\t\tif(inp.get(0) !== prev.get(0)){\t\t\t\t\t\n\t\t\t\tprev.closest(\".tgsf\").toggleClass(\"act\");\t\t\t\t\n\t\t\t\tprev.removeAttr(\"checked\");\t\n\t\t\t\tprev.prop(\"checked\",false);\t\n\t\t\t\tk.toggleClass(\"act\");\n\t\t\t\tinp.attr(\"checked\",\"checked\");\n\t\t\t\tinp.prop(\"checked\",true).change();\n\t\t\t}\n\t\t}\n\t\telse if(inp.attr(\"type\") === \"checkbox\"){\t\t\t\n\t\t\tk.toggleClass(\"act\");\n\t\t\tif(inp.attr(\"checked\") === \"checked\"){\n\t\t\t\tinp.removeAttr(\"checked\");\t\n\t\t\t\tinp.prop(\"checked\",false);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tinp.attr(\"checked\",\"checked\");\n\t\t\t\tinp.prop(\"checked\",true);\n\t\t\t}\n\t\t\tinp.change();\n\t\t}\t\t\n\t\t\n\t\tif(k.hasClass(\"sw\")){\n\t\t\tk.click();\t\t\t\t\t\n\t\t}\n\n\t\tif(k.closest(\".et\").length){\n\t\t\tk.closest(\".et\").click();\n\t\t}\t\t\n\t\t\n\t\tif($(this).closest(\"[data-tgsf-group]\").length){\n\t\t\tvar all_act = false;\n\t\t\t$(this).closest(\"[data-tgsf-group]\").find(\".tgsf\").each(function(){\n\t\t\t\tif(!$(this).hasClass(\"act\")){\n\t\t\t\t\tall_act = false;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tall_act = true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(all_act){\n\t\t\t\t$(\".order__btn-complete\").removeClass(\"dse\");\n\t\t\t\t$(this).closest(\"[data-tgsf-group]\").find(\"[data-tgsf-btn]\").removeClass(\"dse\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$(\".order__btn-complete\").addClass(\"dse\");\n\t\t\t\t$(this).closest(\"[data-tgsf-group]\").find(\"[data-tgsf-btn]\").addClass(\"dse\");\n\t\t\t}\n\t\t}\n\t});\t\n}", "function sequencenotestofreqs(basefreq,sq){ \r\n\tvar sq2 = [];\r\n\tfor(var i=0; i < sq.length; i++){ \r\n\t\tsq2.push([ sq[i][0], sq[i][1], notetofreq(basefreq,sq[i][2]) ]); \r\n\t}\r\n\treturn sq2;\r\n}", "function getFrontendGroupFoS(frontendStats, group_name, fos_tag_top, fos_tag_one) {\n factories=new Array();\n\n if(group_name==\"total\") {\n for (var i=0; i<frontendStats.childNodes.length; i++) {\n var el=frontendStats.childNodes[i];\n if ((el.nodeType==1) && (el.nodeName==fos_tag_top)) {\n for (var j=0; j<el.childNodes.length; j++) {\n \t var group=el.childNodes[j];\n if ((group.nodeType==1)&&(group.nodeName==fos_tag_one)) {\n var group_name=group.attributes.getNamedItem(\"name\");\n\t factories.push(group_name.value);\n\t }\n }\n }\n } \n return factories;\n }\n\n for (var i=0; i<frontendStats.childNodes.length; i++) {\n var el=frontendStats.childNodes[i];\n if ((el.nodeType==1) && (el.nodeName==\"groups\")) {\n for (var j=0; j<el.childNodes.length; j++) {\n\tvar group=el.childNodes[j];\n\tif ((group.nodeType==1)&&(group.nodeName==\"group\")) {\n\t var group_name1=group.attributes.getNamedItem(\"name\").value;\n if(group_name1==group_name) {\n for(var k=0; k<group.childNodes.length; k++) { \n var el2 = group.childNodes[k];\n if (el2.nodeName==fos_tag_top) {\n for(var m=0; m<el2.childNodes.length; m++) { \n var factory = el2.childNodes[m];\n if(factory.nodeName==fos_tag_one) {\n factory_name=factory.attributes.getNamedItem(\"name\");\n\t factories.push(factory_name.value);\n }\n }\n } \n }\n }\n\t}\n }\n }\n }\n return factories;\n}", "function getSatelliteFP(FP, refFPs) {\n var bits = new Array(refFPs.length);\n for (var i = 0; i < refFPs.length; i++) {\n var d = getCBDDistances(FP, refFPs[i]);\n\n d = 4328.0 / (d + 4328.0);\n bits[i] = d.toFixed(4);\n }\n\n return bits;\n}", "function leastExpensive(items) {\n var current2 = groceries[0].cost;\n for(var i = 0; i < groceries.length; i++){\n if(groceries[i].cost < current2) {\n current2 = groceries[i].cost;\n }\n }\n return current2;\n}", "function gen_op_vfp_touis()\n{\n gen_opc_ptr.push({func:op_vfp_touis});\n}", "function sortedSqu (arr) {\n return arr.map(x => Math.pow(x,2)).sort((a,b) => a - b)\n}", "function collect(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n /// The right shift is to make it a circular shift\n return add32((a << s) | (a >>> (32 - s)), b);\n}", "function gen_vfp_div(/* int */ dp) { if (dp) gen_op_vfp_divd(); else gen_op_vfp_divs(); }", "function turnToDictFIPS(data,keyColumn){\n var overallMax = 0\n\n var newDict = {}\n var maxPriority = 0\n var keys = Object.keys(data[0])\n\n for(var i in data){\n var key = String(data[i][keyColumn])\n if(key.length==4){\n key= String(\"0\"+key)\n }\n var min= 9999\n var max= 0 \n var minKey = null\n var maxKey = \"test\"\n \n var newKeys = []\n newDict[key]=data[i]\n // var values = data[i]\n for(var j in measureSet){\n var k1 = (\"Proportional_allocation_to_\"+measureSet[j])\n var v1 = Math.ceil(parseFloat(data[i][k1]))\n \n if(v1>max){max = v1; maxKey = k1;}\n if(v1<min){min = v1; minKey = k1;}\n \n newDict[key][k1]=v1\n for(var k in measureSet){\n var k2 =(\"Proportional_allocation_to_\"+measureSet[k])\n var v2 = Math.ceil(parseFloat(data[i][k2]))\n var index1 = j\n var index2 = k\n if(index1!=index2){\n if(index1<index2){\n var compareKey = \"compare_\"+k1.replace(\"Proportional_allocation_to_\",\"\")+\"XXX\"+k2.replace(\"Proportional_allocation_to_\",\"\")\n \n newDict[key][compareKey]=v1-v2\n \n if(newKeys.indexOf(compareKey)==-1){\n newKeys.push(compareKey) \n }\n }else{\n var compareKey = \"compare_\"+k2.replace(\"Proportional_allocation_to_\",\"\")+\"XXX\"+k1.replace(\"Proportional_allocation_to_\",\"\")\n newDict[key][compareKey]=v2-v1\n if(newKeys.indexOf(compareKey)==-1){\n newKeys.push(compareKey) \n }\n }\n }\n }\n }\n if(max>overallMax){\n overallMax = max\n // overallMaxId = data[i]\n }\n var range = max-min\n newDict[key][\"range\"]=range\n newDict[key][\"max\"]=max\n newDict[key][\"min\"]=min\n newDict[key][\"maxKey\"]=maxKey\n newDict[key][\"minKey\"]=minKey\n }\n pub.overallMaxFluctuation = overallMax\n var comparisonsSet = newKeys \n // console.log(newDict)\n return [newDict,comparisonsSet]\n}", "function compareP(a, b) {\n if (a.Points > b.Points)\n return -1;\n if (a.Points < b.Points)\n return 1;\n\n if (a.GD < b.GD)\n return -1;\n if (a.GD > b.GD)\n return 1;\n if (a.GF > b.GF)\n return -1;\n if (a.GF < b.GF)\n return 1;\n return 0;\n }", "function recalcBinom(n) {\n var cnt=parseFloat($('#n'+n).val());\n var p=parseFloat($('#p'+n).val());\n var v=parseFloat($('#bv'+n).val());\n if (isNaN(cnt) || isNaN(p) || isNaN(v)) return;\n var e = cnt*p;\n if (v<e) {\n\tvar p2 = jStat.binomial.cdf(v,cnt,p);\n } else if (v>e) {\n\tvar p2 = 1-jStat.binomial.cdf(v-1,cnt,1-p);\n } else {\n\tvar p2 = 1;\n }\n $('#fpr'+n).val(p2);\n recalcFpr(n);\n}", "function mix_buffers(gran = 100) {\n ret_buf = [];\n wt.forEach((weight, index) => {\n for(var i = 0; i < Math.round(weight*gran)/100; i++) {\n ret_buf.push(...buffer_picker[index]); //jesus christ\n }\n });\n return ret_buf; //I hope you like arrays with 50k+ elements\n}", "function core(Px, s, k, Gx) {\n var dx = createUnpackedArray();\n var t1 = createUnpackedArray();\n var t2 = createUnpackedArray();\n var t3 = createUnpackedArray();\n var t4 = createUnpackedArray();\n var x = [createUnpackedArray(), createUnpackedArray()];\n var z = [createUnpackedArray(), createUnpackedArray()];\n var i, j;\n /* unpack the base */\n if (Gx !== null)\n unpack(dx, Gx);\n else\n set(dx, 9);\n /* 0G = point-at-infinity */\n set(x[0], 1);\n set(z[0], 0);\n /* 1G = G */\n cpy(x[1], dx);\n set(z[1], 1);\n for (i = 32; i-- !== 0;) {\n for (j = 8; j-- !== 0;) {\n /* swap arguments depending on bit */\n var bit1 = ((k[i] & 0xff) >> j) & 1;\n var bit0 = (~(k[i] & 0xff) >> j) & 1;\n var ax = x[bit0];\n var az = z[bit0];\n var bx = x[bit1];\n var bz = z[bit1];\n /* a' = a + b\t*/\n /* b' = 2 b\t*/\n mont_prep(t1, t2, ax, az);\n mont_prep(t3, t4, bx, bz);\n mont_add(t1, t2, t3, t4, ax, az, dx);\n mont_dbl(t1, t2, t3, t4, bx, bz);\n }\n }\n recip(t1, z[0], 0);\n mul(dx, x[0], t1);\n pack(dx, Px);\n /* calculate s such that s abs(P) = G .. assumes G is std base point */\n if (s !== null) {\n x_to_y2(t2, t1, dx); /* t1 = Py^2 */\n recip(t3, z[1], 0); /* where Q=P+G ... */\n mul(t2, x[1], t3); /* t2 = Qx */\n add(t2, t2, dx); /* t2 = Qx + Px */\n add(t2, t2, C486671); /* t2 = Qx + Px + Gx + 486662 */\n sub(dx, dx, C9); /* dx = Px - Gx */\n sqr(t3, dx); /* t3 = (Px - Gx)^2 */\n mul(dx, t2, t3); /* dx = t2 (Px - Gx)^2 */\n sub(dx, dx, t1); /* dx = t2 (Px - Gx)^2 - Py^2 */\n sub(dx, dx, C39420360); /* dx = t2 (Px - Gx)^2 - Py^2 - Gy^2 */\n mul(t1, dx, BASE_R2Y); /* t1 = -Py */\n if (is_negative(t1) !== 0)\n /* sign is 1, so just copy */\n cpy32(s, k);\n /* sign is -1, so negate */ else\n mula_small(s, ORDER_TIMES_8, 0, k, 32, -1);\n /* reduce s mod q\n * (is this needed? do it just in case, it's fast anyway) */\n //divmod((dstptr) t1, s, 32, order25519, 32);\n /* take reciprocal of s mod q */\n var temp1 = new Array(32);\n var temp2 = new Array(64);\n var temp3 = new Array(64);\n cpy32(temp1, ORDER);\n cpy32(s, egcd32(temp2, temp3, s, temp1));\n if ((s[31] & 0x80) !== 0)\n mula_small(s, s, 0, ORDER, 32, 1);\n }\n }", "function CalcFromStartToCurrent_gg(){ //2. Step 2 // LeavesActiveInScene = name & LeafAllWeights = weights\n\t\tfor (var a : int = 0; a < LeavesActiveInSceneInt.Length; a++ ){ \n\t\t\tWeighTheLeaves(LeavesActiveInSceneInt[a], FromStartToCurrentWeight_gg[a]);} \n\t}", "gf_exp7(b, m) {\n let x;\n if (b === 0)\n return 0;\n x = this.gf_mult(b, b, m);\n x = this.gf_mult(b, x, m);\n x = this.gf_mult(x, x, m);\n return this.gf_mult(b, x, m);\n }", "function bfs(n, m, edges, s) {\n let results = []; // save the calculated [Total Length] from [start node] to each of others node.\n for (let i = 1; i <= n; i++)\n results[i] = -1;\n\n let node2Level = new Map(), queue = [s], visited = [];\n results[s] = 0;\n visited[s] = true;\n node2Level.set(s, 0);\n\n while (queue.length > 0) {\n let node = queue.shift(), children = edges.filter(e => e[0] === node || e[1] === node);\n for (let i = 0; i < children.length; i++) {\n let edge = children[i], theOtherNode = (edge[0] === node ? edge[1] : edge[0]);\n let theOtherNodeIndex = theOtherNode;\n if (visited[theOtherNodeIndex] === true)\n continue;\n\n let nodeLevel = node2Level.get(node);\n results[theOtherNodeIndex] = (nodeLevel + 1) * 6;\n node2Level.set(theOtherNodeIndex, nodeLevel + 1);\n\n queue.push(theOtherNode);\n visited[theOtherNodeIndex] = true;\n }\n }\n\n results.shift();\n results = results.filter(s => s !== 0)\n\n return results;\n}", "function mergeAll(zero, f) {\n return as => mergeAll_(as, zero, f);\n}", "function convertRatingstoSizes(rats, blah) {\n\tvar sizes_checked = [];\n\tif (checkNone(rats) == false && checkAll(rats) == false) {\n\t\tfor (var i = 0; i < rats.length; i++) {\n\t\t\tsizes_checked.push(blah.order[rats[i]-1]);\n\t\t\t}\n\t} else if (checkNone(rats) == true && rats.length > 1){\n\t\tfor (var i = 0; i < rats.length-1; i++) {\n\t\t\tsizes_checked.push(blah.order[rats[i]-1]);\n\t\t\t}\n\t\tsizes_checked.push(9);\n\t} else if (checkNone(rats) == true) {\n\t\tsizes_checked.push(9);\n\t} else if (checkAll(rats) == true) {\n\t\tsizes_checked.push([1, 2, 3, 4, 5, 6, 7]);\n\t}\n\tvar sizes_sort = sizes_checked.sort(compareNumbers);\n\treturn sizes_sort;\n}", "function grpRanges(g,d,lte){\n\treturn function(f){\n\t\tfor(var i=0;i<g.length;i++){\n\t\t\tif( f<g[i] && (lte && f===g[i]) ){\n\t\t\t\treturn ++i;\n\t\t\t}\n\t\t}\n\t\treturn d || i+1; //no not found - assume greater than last\n\t}\n}", "function gen_op_vfp_cmped()\n{\n gen_opc_ptr.push({func:op_vfp_cmped});\n}", "function computeSlotSegPressures(seg) {\n var forwardSegs = seg.forwardSegs;\n var forwardPressure = 0;\n var i;\n var forwardSeg;\n\n if (seg.forwardPressure == null) {\n // not already computed\n for (i = 0; i < forwardSegs.length; i++) {\n forwardSeg = forwardSegs[i]; // figure out the child's maximum forward path\n\n computeSlotSegPressures(forwardSeg); // either use the existing maximum, or use the child's forward pressure\n // plus one (for the forwardSeg itself)\n\n forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);\n }\n\n seg.forwardPressure = forwardPressure;\n }\n } // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range", "function polygonDecompose(points) {\n var pts;\n if (points.length < 3)\n pts[0][0];\n var table;\n for (var gap = 0; gap < points.length; gap++) {\n var j = gap;\n for (var i = 0; j < points.length; i++, j++) {\n if (j < i + 2)\n table[i][j] = 0.0;\n else {\n table[i][j] = Infinity;\n for (var k = i + 1; k < j; k++) {\n var val = table[i][k] + table[k][j] + cost(points[i], points[j], points[k]);\n if (table[i][j] > val) {\n table[i][j] = val;\n var sequence = pts[i][k].concat(pts[k][j]).concat([points[i], points[j], points[k]]);\n pts[i][j] = sequence;\n }\n }\n }\n }\n }\n return pts[0][points.length - 1];\n}", "function realFft(input, output) {\n\n var n = input.length,\n x = output, \n TWO_PI = 2*Math.PI,\n sqrt = Math.sqrt,\n n2, n4, n8, nn, \n t1, t2, t3, t4, \n i1, i2, i3, i4, i5, i6, i7, i8, \n st1, cc1, ss1, cc3, ss3,\n e, \n a,\n rval, ival, mag; \n\n _reverseBinPermute(output, input);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0+1];\n x[i0] += x[i0+1];\n x[i0+1] = st1;\n } \n ix = 2*(id-1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if(n4 !== 1) {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n \n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n \n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n \n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n \n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1; \n x[i3] = t1 - st1;\n \n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4]; \n x[i4] -= x[i3];\n \n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n }\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n \n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4*cc1*(cc1*cc1-0.75);\n ss3 = 4*ss1*(0.75-ss1*ss1);\n \n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n \n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7]*cc1 - x[i3]*ss1; \n t1 = x[i7]*ss1 + x[i3]*cc1;\n \n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8]*cc3 - x[i4]*ss3; \n t3 = x[i8]*ss3 + x[i4]*cc3;\n \n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n \n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6]; \n x[i3] = t2 - x[i6];\n \n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n \n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2]; \n x[i7] = t3 - x[i2];\n \n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1; \n x[i1] += t1;\n \n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5]; \n x[i5] -= t4;\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n \n } while (ix < n);\n }\n }\n \n /* Scale output to have same norm as input. */\n var f = 1 / sqrt(n);\n for (var i = 0; i < n; i++)\n\t x[i] *= f;\n\n}", "function mergeFprsAndFqcs (\n fprs,\n fqcs,\n includeRunInfo,\n filterByQcStatus = false\n) {\n // first, remove run info if necessary\n fprs = fprs.map((fpr) => maybeRemoveRunInfo(includeRunInfo, fpr));\n // merge the FileQCs with FPRs first...\n const fileids = fqcs.map((fqc) => fqc.fileid);\n const mergedFqcs = fqcs.map((fqc) => {\n const filteredFprs = fprs.filter((fpr) => fpr.fileid == fqc.fileid);\n return maybeMergeResult(filteredFprs, [fqc], fqc.fileid);\n });\n if (['PASS', 'FAIL'].includes(filterByQcStatus)) {\n // we only want records that are QCed\n return mergedFqcs;\n }\n // ...then the requested FPRs with no associated FileQCs...\n const bareFprs = fprs\n .filter((fpr) => !fileids.includes(fpr.fileid))\n .map((fpr) => yesFprNoFqc(fpr));\n if ('PENDING' == filterByQcStatus) {\n // we only want records that are not QCed\n return bareFprs;\n }\n const all = mergedFqcs.concat(bareFprs);\n //...then order them all by date\n all.sort(sortByDate);\n return all;\n}", "function fundamental_from_8pairs(pts_left, pts_rght) {\n\tvar P = mtx_make(8,8);\n\tvar I = vec_make(8);\n\tfor (var i=0; i<8; i++) {\n\t\tP[i][0] = pts_left[i][0] * pts_rght[i][0];\n\t\tP[i][1] = pts_left[i][0] * pts_rght[i][1];\n\t\tP[i][2] = pts_left[i][0];\n\t\tP[i][3] = pts_left[i][1] * pts_rght[i][0];\n\t\tP[i][4] = pts_left[i][1] * pts_rght[i][1];\n\t\tP[i][5] = pts_left[i][1];\n\t\tP[i][6] = pts_rght[i][0];\n\t\tP[i][7] = pts_rght[i][1];\n\t\tI[i] = -1.;\n\t}\n\tvar f = mtx_vec_prod(mtx_inv(P), I);\n\tvar F = [\n\t\t[ f[0], f[1], f[2] ],\n\t\t[ f[3], f[4], f[5] ],\n\t\t[ f[6], f[7], 1.0 ] ];\n\treturn F;\n}", "function gen_op_vfp_absd()\n{\n gen_opc_ptr.push({func:op_vfp_absd});\n}", "function gen_op_vfp_subd()\n{\n gen_opc_ptr.push({func:op_vfp_subd});\n}", "function getAggFunc(a,b){if(void 0===a&&(a=\"sum\"),void 0===b&&(b=null),\"count\"===a)return function(a){return a.length};var c;return c=a in percentiles?function(c,d){var e;return e=b?c.sort(function(a,c){return d3array.ascending(b(a),b(c))}):c.sort(d3array.ascending),d3array.quantile(e,percentiles[a],d)}:d3array[a],b?function(a){return c(a.map(b))}:function(a){return c(a)}}", "function mostExpensive(items) {\n var current = groceries[0].cost;\n for(var i = 0; i < groceries.length; i++){\n if(groceries[i].cost > current) {\n current = groceries[i].cost;\n }\n }\n return current;\n}", "function normalizeFitness(players) {\n //All fitness values need to add up to one\n for (let p of players) {\n p.score = Math.pow(p.score, 2)\n }\n let sum = players.reduce((sum, val) => sum + val.score, 0)\n for (let p of players) {\n p.fitness = p.score / sum\n }\n\n}", "function gF(t,e){var n=wi()(t);if(bi.a){var r=bi()(t);e&&(r=vi()(r).call(r,(function(e){return mi()(t,e).enumerable}))),n.push.apply(n,r)}return n}" ]
[ "0.52820486", "0.517149", "0.5119514", "0.50312907", "0.49870434", "0.49559712", "0.49406353", "0.49193355", "0.48954755", "0.48953038", "0.48771963", "0.48440468", "0.48396826", "0.48280913", "0.48101825", "0.4805804", "0.47903848", "0.47861093", "0.47793156", "0.47790134", "0.47711438", "0.4770963", "0.47691834", "0.4761564", "0.47575554", "0.47532448", "0.47512534", "0.4747378", "0.4744679", "0.47375986", "0.47336414", "0.47227734", "0.47160175", "0.47160175", "0.4710028", "0.4708054", "0.4706627", "0.4705462", "0.47032535", "0.47020724", "0.46842188", "0.46809593", "0.46699625", "0.46692714", "0.4665917", "0.46644902", "0.46632913", "0.46601728", "0.4660078", "0.46541935", "0.4647012", "0.46310645", "0.46213773", "0.46205637", "0.46184236", "0.4608596", "0.46032393", "0.4599901", "0.4594855", "0.4588315", "0.45821723", "0.45778313", "0.45713308", "0.4570182", "0.4567084", "0.45657492", "0.4563532", "0.45541492", "0.45495516", "0.45466235", "0.45442957", "0.4539494", "0.4524621", "0.45215163", "0.4512688", "0.45051348", "0.45049974", "0.45005423", "0.44999027", "0.449811", "0.44903013", "0.44897512", "0.44714135", "0.44705725", "0.44681242", "0.4467621", "0.44675666", "0.4466862", "0.4466201", "0.44592822", "0.44579896", "0.4454806", "0.44517094", "0.44501853", "0.44458282", "0.4444033", "0.44424558", "0.44402567", "0.44397837", "0.4439425", "0.44350073" ]
0.0
-1
Added by salim dt:17/10/2018..
constructor(props) { super(props); if (props.user) { autoRefreshToken(); /* const checkToken = auth.isAuthenticated(); if(!checkToken) { redirectToLogin(); } */ } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient protected internal function m189() {}", "transient final protected internal function m174() {}", "transient final private protected internal function m167() {}", "static transient final private internal function m43() {}", "static private internal function m121() {}", "static transient final protected internal function m47() {}", "transient final private internal function m170() {}", "transient private public function m183() {}", "transient private protected public internal function m181() {}", "static transient final protected public internal function m46() {}", "static transient final private protected internal function m40() {}", "static transient private protected internal function m55() {}", "static final private internal function m106() {}", "static private protected internal function m118() {}", "static transient private protected public internal function m54() {}", "transient final private protected public internal function m166() {}", "static final private protected internal function m103() {}", "__previnit(){}", "static transient private internal function m58() {}", "static transient final private public function m41() {}", "static transient private public function m56() {}", "static protected internal function m125() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "static transient final protected function m44() {}", "transient final private public function m168() {}", "static private protected public internal function m117() {}", "static transient final private protected public internal function m39() {}", "constructor () {\r\n\t\t\r\n\t}", "function comportement (){\n\t }", "static transient final private protected public function m38() {}", "static final private protected public internal function m102() {}", "added() {}", "updated() {}", "obtain(){}", "static final private public function m104() {}", "function _____SHARED_functions_____(){}", "function _construct()\n\t\t{;\n\t\t}", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "function TMP() {\n return;\n }", "constructor() {\n\n\t}", "function ea(){}" ]
[ "0.6913885", "0.68436104", "0.6648685", "0.65081716", "0.6436301", "0.6368377", "0.6335471", "0.61588955", "0.6085396", "0.60841024", "0.60019535", "0.5970945", "0.59071696", "0.5870283", "0.58647156", "0.58637774", "0.5851704", "0.5845241", "0.58328706", "0.5747419", "0.5689479", "0.5580448", "0.55451375", "0.55121696", "0.5502272", "0.5495605", "0.5478353", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.5429201", "0.53976417", "0.53905505", "0.53784764", "0.5350572", "0.53429717", "0.5330485", "0.52849627", "0.52820444", "0.5258003", "0.52402097", "0.5229751", "0.52075964", "0.51499814", "0.5142947", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50911516", "0.50889903", "0.50692827", "0.50684875" ]
0.0
-1
used to valid the form inputs
function validationFields(numberOfPeople, billAmount, tipPercentage) { console.log(isNaN(billAmount)); console.log(billAmount); var noErrors = true; //Check Bill Amount Validation if (billAmount === "" || numberOfPeople === "" || tipPercentage === "") { alert("All field must be filled"); } else { if (isNaN(billAmount) || billAmount === "") { document.getElementById("billAmountError").style.display = "block"; document.getElementById("billAmountError").innerHTML = "bill amount must be a number"; noErrors = false; } else { document.getElementById("billAmountError").style.display = "none"; } //Checks if the number of people is a number if (isNaN(numberOfPeople)) { document.getElementById("numOfPeopleError").style.display = "block"; document.getElementById("numOfPeopleError").innerHTML = "number of people must be an interger"; noErrors = false; } else if (numberOfPeople <= 0) { document.getElementById("numOfPeopleError").style.display = "block"; document.getElementById("numOfPeopleError").innerHTML = "number of people greater than zero"; noErrors = false; } else { document.getElementById("numOfPeopleError").style.display = "none"; } //Checks if the percentage is a number if (isNaN(tipPercentage)) { document.getElementById("tipPercentError").style.display = "block"; document.getElementById("tipPercentError").innerHTML = "bill amount must be a number"; noErrors = false; } else { document.getElementById("tipPercentError").style.display = "none"; } return noErrors; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate(){\n\n\t\t//TODO: make this work\n\n\n\t}", "function validation() {\r\n\t\t\r\n\t}", "validateInputs(){\r\n if(this.state.brand === \"\" || this.state.plates === \"\" || (this.state.year===\"\" || isNaN(this.state.year)) || this.state.currentState===\"\" || this.state.model===\"\" || this.state.type===\"\" || this.state.color===\"\" || this.state.niv===\"\" || this.state.gasoline===\"\" || this.state.circulation===\"\"){\r\n return false;\r\n\r\n }\r\n else{\r\n return true;\r\n }\r\n }", "function validate (input) {\n \t//ver dps..\n \treturn true;\n }", "function validateForm() {\n return name.length > 0 && phone.length > 0;\n }", "function formIsValid() {\n if (total_loan_box.value === \"\" || isNaN(total_loan_box.value)) {\n speakToUser(\"You must enter a valid decimal number for the <strong>Total Loan Amount</strong>.\");\n focusOnBox(\"total_loan\");\n return false;\n }\n\n if (interest_rate_box.value === \"\" || isNaN(interest_rate_box.value)) {\n speakToUser(\"You must enter a valid decimal number for the <strong>Yearly Interest Rate</strong>.\");\n focusOnBox(\"interest_rate\");\n return false;\n }\n\n if (loan_term_box.value === \"\" || isNaN(loan_term_box.value)) {\n speakToUser(\"You must enter a valid number of years for the <strong>Loan Term</strong>.\");\n focusOnBox(\"loan_term\");\n return false;\n }\n\n return true;\n}", "function validateInput() {\n\t\tif (!name) {\n\t\t\talert('Please input a name');\n\t\t\treturn false;\n\t\t}\n\t\tif (!description) {\n\t\t\talert('Please give a small description');\n\t\t\treturn false;\n\t\t}\n\t\tif (!value) {\n\t\t\talert('Please describe the sentimental value');\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "function validateFields() {\n var validated = false;\n for (var i = 0; i < input_list.length; i++) {\n //loop through array of inputs in input_list defined at top of page.\n if (input_list[i].value.toString().trim() != \"\") {\n validated = true;\n }\n }\n return validated;\n }", "validateForm() {\r\n if(this.getInputVal(this.inputBill) !== \"\" && \r\n this.getInputVal(this.inputPeople) !== \"\" &&\r\n (this.getInputVal(this.inputCustom) !== \"\" || \r\n this.percentageBtns.some(btn => btn.classList.contains(\"active\")))) \r\n {\r\n this.disableReset(false);\r\n return true;\r\n }\r\n else {\r\n this.disableReset(true);\r\n this.displayResult(\"__.__\", \"__.__\");\r\n return false;\r\n }\r\n }", "validate() {\n // Als NIET (!) valide, dan error weergeven\n if (!this.isValid()) {\n this.showError();\n console.log(\"niet valide\");\n }\n else\n this.hideError();\n }", "function validate() {\n\t\t\t var valid = true;\n\n\t\t\t //Validation for first two name/img inputs\n\t\t\t $('.form-control').each(function() {\n\t\t\t if ( $(this).val() === '' )\n\t\t\t valid = false;\n\t\t\t });\n\n\t\t\t //Validation for <select> inputs.\n\t\t\t $('.btn-group').each(function() {\n\t\t\t \tif( $(this).val() === \"\")\n\t\t\t \t\tvalid = false\n\t\t\t })\n\t\t\t return valid;\n\t\t\t}", "function verify_inputs(){\n if(document.getElementById(\"Split_By\").value == ''){\n return false;\n }\n if(document.getElementById(\"Strength\").value == ''){\n return false;\n }\n if(document.getElementById(\"Venue\").value == ''){\n return false;\n }\n if(document.getElementById(\"season_type\").value == ''){\n return false;\n }\n if(document.getElementById(\"adjustmentButton\").value == ''){\n return false;\n }\n\n return true\n }", "function validateForm() {\n validateFirstName();\n validateLastName();\n validateStreet();\n validateCity();\n validateZipCode();\n}", "function ValidaForm() {\n if ($('#txtTitulo').val() == '') {\n showErrorMessage('El Título es obligatorio');\n return false;\n }\n if ($('#dpFechaEvento').val() == '') {\n showErrorMessage('La Fecha de publicación es obligatoria');\n return false;\n }\n if ($('#txtEstablecimiento').val() == '') {\n showErrorMessage('El Establecimiento es obligatorio');\n return false;\n }\n if ($('#txtDireccion').val() == '') {\n showErrorMessage('La Dirección es obligatoria');\n return false;\n }\n if ($('#txtPrecio').val() == '') {\n showErrorMessage('El Precio es obligatorio');\n return false;\n }\n return true;\n}", "function validForm() \n{\n\tvar allGood = true;\n\tvar allTags = document.getElementsByTagName(\"*\");\t\n\tfor (var i=0; i<allTags.length; i++){\t\n\t\t\t\t\t\n\t\t\tif (!validTag(allTags[i])) {\n\t\t\t\tallGood = false;\n\t\t\t}\n\t\t\n\t}\n\treturn allGood;\n\n\tfunction validTag(thisTag) \n\t{\n\t\tvar outClass = \"\";\n\t\tvar allClasses = thisTag.className.split(\" \");\n\t\t\t\n\t\tfor (var j=0; j<allClasses.length; j++) \n\t\t{\tif(j==allClasses.length-1)\n\t\t\t\toutClass += validBasedOnClass(allClasses[j]) + \"\";\n\t\t\telse\n\t\t\t\toutClass += validBasedOnClass(allClasses[j]) + \" \";\n\t\t}\n\t\n\t\tthisTag.className = outClass;\n\t\t//alert(outClass.indexOf(\"invalid\"));\n\t\t\t\t\t\n\t\tif (outClass.indexOf(\"invalid\") > -1) \n\t\t{\n\t\t\t//thisTag.focus();\n\t\t\t//if (thisTag.nodeName == \"INPUT\") \n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t\t\n\t\tfunction validBasedOnClass(movida) \n\t\t{\n\t\t\tvar classBack = \"\";\n\t\t\t\n\t\t\t//if (thisTag.nodeName == \"INPUT\") \n\t\t\t//alert(movida);\n\t\t\n\t\t\tswitch(movida) \n\t\t\t{\n\t\t\t\tcase \"\":\n\t\t\t\t\n\t\t\t\tcase \"invalid\":\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reqd\":\n\t\t\t\t\tif (thisTag.value == \"\") \n\t\t\t\t\t{\n\t\t\t\t\t\tclassBack = \"invalid \";\n\t\t\t\t\t}\n\t\t\t\t\tclassBack += movida;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"isNum\":\n\t\t\t\t\tif (!isNum (thisTag.value)) \n\t\t\t\t\t\tclassBack = \"invalid \";\n\t\t\t\t\tclassBack += movida;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"box\":\n\t\t\t\t\tif(!checkBox(thisTag))\n\t\t\t\t\t\tclassBack = \"invalid \";\n\t\t\t\t\tclassBack += movida;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"email\":\n if (!validEmail (thisTag.value)) \n\t\t\t\t\t\tclassBack = \"invalid \";\n\t\t\t\t\tclassBack += movida;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tclassBack = movida;\n\t\t\t}\n\t\t\treturn classBack;\n\t\t}\n\t}\n}", "validateForm() {\n return this.state.serviceName.length > 0 && this.state.description.length > 0 && this.state.location.length > 0 && this.state.category.length > 0 && this.state.url.length > 0\n }", "function validate(){\n \n if(name===null){\n alert(\"Enter the name please\")\n return false\n }\n if(className===null){\n alert(\"Enter class name please\")\n return false\n }\n if(location===null){\n alert(\"Enter location please\")\n return false\n }\n if(edu===null){\n alert(\"Enter the Education Buddy please\")\n return false\n }\n if(pd===null){\n alert(\"Enter the personal development buddy\")\n return false\n }\n if(gitHub===null){\n alert(\"Enter github id please\")\n return false\n }\n \n return true;\n }", "function ValidarFields() {\r\n\r\n\tif(document.getElementById('codigo').value == \"\"){\r\n\t\talert(' ¡ ERROR ! Debes ingresar el código del producto.');\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(document.getElementById('nombre').value == \"\"){\r\n\t\talert(' ¡ ERROR ! Debes ingresar el nombre del producto.');\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif(document.getElementById('precio').value == \"\"){\r\n\t\talert(' ¡ ERROR ! Debes ingresar el precio del producto.');\r\n\t\treturn false;\r\n\t}\r\n\r\n}", "function validateInput(){\n\n}", "function validate() {\n\t\t\tvar allOk = true;\n\t\t\tvar ok = $userFullName.val().match(/[\\w -]{3,}/) !== null;\n\t\t\ttooltip.set($userFullName, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = $userEmail.val().match(/^[\\w\\.\\-_]{1,}@([\\w\\-_]+.){1,}\\w{3,5}$/) !== null;\n\t\t\ttooltip.set($userEmail, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = $userPhone.val().match(/^[\\d+\\s\\-]{5,}$/) !== null;\n\t\t\ttooltip.set($userPhone, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = $userCitizenship.val().match(/^[\\w\\s]{2,}$/) !== null;\n\t\t\ttooltip.set($userCitizenship, !ok);\n\t\t\tallOk = allOk && ok;\n\n\t\t\tok = datepicker.isValid();\n\t\t\tallOk = allOk && ok;\n\n\t\t\ttooltip.set($submitBookingButton, !allOk);\n\t\t\treturn allOk;\n\t\t}", "validateForm() {\n\n const singer = this.shadowRoot.getElementById('singer');\n const song = this.shadowRoot.getElementById('song');\n const artist = this.shadowRoot.getElementById('artist');\n const link = this.shadowRoot.getElementById('link');\n\n if(singer && song && artist) {\n return (singer.value != '' && song.value != '' && artist.value != '');\n };\n\n return false;\n }", "function validateForm() {\r\n let regex = /^\\d*\\.?\\d*$/;\r\n if (\r\n regex.test(people.value) === false ||\r\n regex.test(priceB4Tip.value) === false ||\r\n regex.test(tipChoice.value) === false\r\n ) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "function processForm() {\n // validate elevation\n if ($('#mtnElevation').val() < 4003 || $('#mtnElevation').val() > 6288) {\n $('#alertMsg').html('Elevation must be between 4,003 and 6,288 feet.');\n $('#mtnElevation').focus();\n $('#alertMsg').show();\n return false;\n }\n\n // validate effort\n if ($('#mtnEffort').val() === '') {\n $('#alertMsg').html('Please select an effort.');\n $('#mtnEffort').focus();\n $('#alertMsg').show();\n return false;\n }\n\n // validate image\n if ($('#mtnImage').val() === '') {\n $('#alertMsg').html('Please enter an image name.');\n $('#mtnImage').focus();\n $('#alertMsg').show();\n return false;\n }\n\n // validate lat / lng\n // Note: Can break into Lat and Lgn checks, and place cursor as needed\n var regex = /^([-+]?)([\\d]{1,2})(((\\.)(\\d+)(,)))(\\s*)(([-+]?)([\\d]{1,3})((\\.)(\\d+))?)$/;\n var latLng = `${$('#mtnLat').val()},${$('#mtnLng').val()}`;\n if (! regex.test(latLng)) {\n $('#alertMsg').html('Latitude and Longitude must be numeric.');\n $('#alertMsg').show();\n return false;\n }\n\n // Form is valid\n $('#alertMsg').html('');\n $('#alertMsg').hide();\n\n return true;\n }", "canSubmit() {\n return (\n this.validateOnlyLetterInput(this.state.name)==='' &&\n this.validateTelephone(this.state.telephone)==='' &&\n this.validateAddress(this.state.address)==='' &&\n this.validatePostalCode(this.state.postalCode)==='' &&\n this.validateOnlyLetterInput(this.state.city)===''\n );\n }", "validateInput()\n {\n return this.refs.date.isValid()\n && this.refs.amount.isValid()\n && this.refs.account.isValid()\n }", "validateForm() {\n if (!this.event.title) {\n this.formWarning = 'Please enter a title';\n }\n if (!this.event.startTime) {\n this.formWarning = 'Please enter a start time';\n return false;\n }\n if (!this.event.endTime) {\n this.formWarning = 'Please enter an end time';\n return false;\n }\n return true;\n }", "function formValidator() {\n //create object that will save user's input (empty value)\n let feedback = [];\n //create an array that will save error messages (empty)\n let errors = [];\n //check if full name has a value\n if (fn.value !== ``){\n //if it does, save it\n feedback.fname = fn.value; \n }else {\n //if it doesn't, crete the error message and save it\n errors.push(`<p>Invalid Full Name</p>`);\n }\n \n //for email\n if (em.value !== ``){\n feedback.email = em.value;\n //expression.test(String('[email protected]').toLowerCase()); \n }else {\n errors.push(`<p>Invalid Email</p>`);\n }\n\n //for message\n if (mes.value !== ``){\n feedback.message = mes.value;\n }else {\n errors.push(`<p>Write a comment</p>`)\n }\n \n //create either feedback or display all errors\n if (errors.length === 0) {\n console.log(feedback);\n }else {\n console.log(errors);\n }\n //close event handler\n}", "function validateInputs() {\n\n let isValid = true;\n\n if (workoutType === \"resistance\") {\n if (nameInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (weightInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (setsInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (repsInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (resistanceDurationInput.value.trim() === \"\") {\n isValid = false;\n }\n } else if (workoutType === \"cardio\") {\n if (cardioNameInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (durationInput.value.trim() === \"\") {\n isValid = false;\n }\n\n if (distanceInput.value.trim() === \"\") {\n isValid = false;\n }\n }\n\n if (isValid) {\n completeButton.removeAttribute(\"disabled\");\n addButton.removeAttribute(\"disabled\");\n } else {\n completeButton.setAttribute(\"disabled\", true);\n addButton.setAttribute(\"disabled\", true);\n }\n }", "function formValidation() {\n\t\t// Check for empty fields\n\t\tif ( contactName.val() == \"\" || contactEmail.val() == \"\" || validateEmail(contactEmail.val()) != true || contactMessage.val() == \"\" ) {\n\t\t\t// Check for ever field if empty -> apply border\n\t\t\tif ( contactName.val() == \"\" ) { contactName.addClass(\"form__invalid__border\"); } else { contactName.removeClass(\"form__invalid__border\"); }\n\t\t\tif ( contactEmail.val() == \"\" ) { contactEmail.addClass(\"form__invalid__border\"); } else { \n\t\t\t\tif ( validateEmail(contactEmail.val()) ) {\n\t\t\t\t\tcontactEmail.removeClass(\"form__invalid__border\"); \n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( contactMessage.val() == \"\" ) { contactMessage.addClass(\"form__invalid__border\"); } else { contactMessage.removeClass(\"form__invalid__border\"); } \n\t\t} \n\t\t// If fields aren't empty and email valid\n\t\telse {\n\t\t\t// Remove all validation borders\n\t\t\tcontactName.add(contactEmail).add(contactMessage).removeClass(\"form__invalid__border\");\n\t\t\n\t\t\treturn true;\n\t\t}\n\t}", "function validateInputs() {\n let invalidEmail = false;\n let invalidPassword = false;\n let invalidFirstName = false;\n let invalidLastName = false;\n\n if (\n !/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(\n email.toLowerCase()\n )\n ) {\n invalidEmail = true;\n }\n\n if (password.length <= 0) {\n invalidPassword = true;\n }\n\n if (firstName.length <= 0) {\n invalidFirstName = true;\n }\n\n if (lastName.length <= 0) {\n invalidLastName = true;\n }\n\n setInvalidInputs({\n password: invalidPassword,\n email: invalidEmail,\n firstName: invalidFirstName,\n lastName: invalidLastName,\n });\n\n if (\n invalidEmail ||\n invalidFirstName ||\n invalidLastName ||\n invalidPassword\n ) {\n return false;\n }\n\n return true;\n }", "function validateForm() {\n\t\tvar fieldsWithIllegalValues = $('.illegalValue');\n\t\tif (fieldsWithIllegalValues.length > 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tkenyaui.clearFormErrors('htmlform');\n\n\t\tvar ary = $(\".autoCompleteHidden\");\n\t\t$.each(ary, function(index, value) {\n\t\t\tif (value.value == \"ERROR\"){\n\t\t\t\tvar id = value.id;\n\t\t\t\tid = id.substring(0, id.length - 4);\n\t\t\t\t$(\"#\" + id).focus();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\n\t\tvar hasBeforeSubmitErrors = false;\n\n\t\tfor (var i = 0; i < beforeSubmit.length; i++){\n\t\t\tif (beforeSubmit[i]() === false) {\n\t\t\t\thasBeforeSubmitErrors = true;\n\t\t\t}\n\t\t}\n\n\t\treturn !hasBeforeSubmitErrors;\n\t}", "function validate(form){\r\n\t\t//check if values are empty\r\n\t\tif(valid)\r\n\t\t{\r\n\t\t\talert(\"This note will be archived!\");\r\n\t\t}\r\n\t}", "function validarFormulario(){\n var txtNombre = document.getElementById('provNombre').value;\n var txtRut = document.getElementById('provRut').value;\n //Test campo obligatorio\n if(txtNombre == null || txtNombre.length == 0 || /^\\s+$/.test(txtNombre)){\n alert('ERROR: El campo nombre no debe ir vacío o con espacios en blanco');\n document.getElementById('provNombre').focus();\n return false;\n }\n if(txtRut == null || txtRut.length == 0 || /^\\s+$/.test(txtRut)){\n alert('ERROR: El campo Rut no debe ir vacío o con espacios en blanco');\n document.getElementById('provRut').focus();\n return false;\n } \n return true;\n }", "function valid_application_form(){\n\t// Verifies that the name is filled\n\tif(document.getElementById('name').value == \"\"){\n\t\talert('Veuillez saisir le nom.');\n\t\treturn false;\n\t}\n\t// Verifies that the description is filled\n\tif(document.getElementById('description').value == \"\"){\n\t\talert('Veuillez saisir la description.');\n\t\treturn false;\n\t}\n\treturn true;\n}", "function validateAddOpForm() {\n // Check inputs\n return pageDialog.amount.value.length > 0 && pageDialog.desc.value.length > 0\n }", "function isAddFormValid(){\r\n return( FNameField.isValid() && LNameField.isValid() && TitleField.isValid()&& AddField.isValid() && MailField.isValid() && TelephoneField.isValid() && MobileField.isValid());\r\n }", "function validarInputs (){\n for (var i = 0; i < elementos.length; i++) {\n // Identificamos si el elemento es de tipo texto, email, password, radio o checkbox\n if (elementos[i].type == \"text\" || elementos[i].type == \"email\" || elementos[i].type == \"password\") {\n // Si es tipo texto, email o password vamos a comprobar que esten completados los input\n if (elementos[i].value.length == 0) {\n console.log('El campo ' + elementos[i].name + ' esta incompleto');\n elementos[i].className = elementos[i].className + \" error\";\n return false;\n } else {\n elementos[i].className = elementos[i].className.replace(\" error\", \"\");\n }\n }\n }\n return true;\n }", "function validate(){\n let isErrors = false;\n let firstName = formReserve['firstName'];\n let lastName = formReserve['lastName'];\n let phone = formReserve['phone'];\n let email = formReserve['email'];\n let age = formReserve['birthdate'];\n let quantity = formReserve['quantity'];\n let location = formReserve['location'];\n let cgv = formReserve['cgv'];\n document.querySelectorAll('.error').forEach(error => error.remove());\n document.querySelectorAll('.error--bg').forEach(error => error.classList.remove('error--bg'));\n if(!nameCheked(firstName.value)){\n isErrors = true;\n firstName.classList.add('error--bg');\n firstName.insertAdjacentElement('afterend', createErrorSpan('Veuillez entrer 2 caractères ou plus pour le prénom.'));\n }\n if(!nameCheked(lastName.value)){\n isErrors = true;\n lastName.classList.add('error--bg');\n lastName.insertAdjacentElement('afterend', createErrorSpan('Veuillez entrer 2 caractères ou plus pour le nom.'));\n }\n if(!isPhone(phone.value)){\n isErrors = true;\n phone.classList.add('error--bg');\n phone.insertAdjacentElement('afterend', createErrorSpan('Veuillez entrer un numéro de téléphone valide.'));\n }\n if(!isEmail(email.value)){\n isErrors = true;\n email.classList.add('error--bg');\n email.insertAdjacentElement('afterend', createErrorSpan('Veuillez entrer une adresse mail valide.'));\n }\n if(!checkAge(age.value)){\n isErrors = true;\n age.classList.add('error--bg');\n age.insertAdjacentElement('afterend', createErrorSpan('Vous devez avoir au moins 18 ans.'));\n }\n if(!isNumeric(quantity.value)){\n isErrors = true;\n quantity.classList.add('error--bg');\n quantity.insertAdjacentElement('afterend', createErrorSpan('Veuillez entrer une valeur comprise entre 0 et 99.'));\n }\n if(!atLeastOneCheck(location)){\n isErrors = true;\n location[0].parentNode.classList.add('error--bg');\n document.getElementsByClassName(\"formData\")[6].insertAdjacentElement('afterend', createErrorSpan('Vous devez choisir au moins une ville.'));\n }\n if(!checkboxChecked(cgv)){\n isErrors = true;\n document.getElementsByClassName(\"checkbox2-label\")[0].children[0].classList.add('error--bg');\n document.getElementsByClassName(\"checkbox2-label\")[0].insertAdjacentElement('afterend', createErrorSpan('Vous devez accepter les termes et conditions.'));\n }\n if(isErrors == true){\n return false;\n } else {\n let participant = {\n firstname: firstName.value,\n lastname: lastName.value,\n phonenumber: phone.value,\n email: email.value,\n birthdate: age.value,\n previousparticipations : quantity.value,\n location: location.value\n };\n const bio = () => {\n this.firstName + this.lastname + 'né(e) le' + this.birthdate + 'tél : ' + this.phonenumber + this.email + 'A déjà participé : ' + this.previousparticipation + 'à' + this.location + '.';\n } \n formReserve.style.display = 'none';\n modalBody.classList.add('message-sended');\n valmessage.innerHTML='Merci, votre formulaire a bien été envoyé !';\n modalBody.append(valmessage);\n buttonClose.classList.add('button','button:hover','button-close');\n buttonClose.innerHTML = \"Fermer\";\n modalBody.appendChild(buttonClose);\n buttonClose.addEventListener (\"click\", closeModal);\n return false; \n }\n}", "function invalidFormInput() {\n return isNaN(modalInstance.form.purchaseCost) || (modalInstance.form.cusip === undefined);\n }", "function validateInputs() {\n if ($(\"input[type='radio']:checked\").val() && $age.val().length > 0 && $weight.val().length > 0 && ($heightInput.val().length > 0 || $heightInputIn.val().length > 0))\n return true;\n else\n return false;\n }", "function validateInput() {\n if (!keyCodeValid || !accountCodeValid || ($(\"#keyCodeCP\").val() == \"\" && isAcctAllEmpty()) ||\n $(\"#desc\").val() == \"\" || $(\"#instruct\").val() == \"\" || $(\"#instruct\").val().length > 65535) {\n $(\"#submitCP\").button(\"option\", \"disabled\", true);\n } else {\n $(\"#submitCP\").button(\"option\", \"disabled\", false);\n }\n }", "function isECourseFormValid(){\r\n return( CourseNameField.isValid() && CourseDaysField.isValid());\r\n }", "function validateForm(){\n\t\n\tvar boo1 = validateLabPerson();\n\tvar boo2 = validateBioPerson();\n\tvar boo3 = validatePI();\n\tvar boo4 = validateBillTo();\n\tvar boo5 = validateRunType();\n\n\tvar boo6 = validateAllTables();\n//\tvar boo6 = true;\n\n\tvar boo7 = validateDate();\n\tvar boo8 = validateIAccept();\n\n\tvar boo9 = validateConcentrationUnit();\n\tvar boo10 = validateTubesAndLanes();\n\t\n//\talert(\"boo1 = \" + boo1 + \" boo2 = \" + boo2 + \" boo3 = \" + boo3 + \" boo4 = \" + boo4 +\" boo5 = \" + boo5 +\" boo6 = \" + boo6 + \" boo7 = \" + boo7 + \" boo8 = \" + boo8 + \" boo9 = \" + boo9 + \" boo10 = \" + boo10);\n\tif (boo1 && boo2 && boo3 && boo4 && boo5 && boo6 && boo7 && boo8 && boo9 && boo10){\t\n//\tif(validateLabPerson() && validateBioPerson() && validatePI() && validateBillTo() && validateRunType() && validateTable()){\n\t\t//insert fields used to generate csv\n\t\tinsertTableSize();\t\t\t\t\t// insert size of all table - used when generating csv file\n\t\tgenerateOrderNoteID();\t\t\t\t// insert orderNoteID\n\t\taddPI2TubeTag();\t\t\t\t\t// indsæt \"de tre tegn\" (fra PI) i tubetaggen.\n\t\tsetVersion();\t\t\t\t\t\t// insert the version number in the hidden field.\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n\t\n\treturn false;\n}", "function campsOk(){\n if(event.target.value != \"\"){\n event.target.classList.remove(\"invalid\");\n return true;\n }\n }", "checkForm() {\n this.elements.resetHint();\n\n const title = this.elements.form.querySelector('.field-title').value;\n const price = this.elements.form.querySelector('.field-price').value;\n\n if (!title || /^\\W/.test(title)) {\n this.elements.showHint('title', 'Нужно заполнить поле');\n return true;\n }\n\n if (!price) {\n this.elements.showHint('price', 'Нужно заполнить поле');\n return true;\n }\n\n if (/\\D/.test(price)) {\n this.elements.showHint('price', 'некорректное значение');\n return true;\n }\n }", "function validate() {\n if (!$scope.id.length || !$scope.pass.length || !$scope.name.length || !$scope.group.length ||\n !$scope.email.length || !$scope.phone.length || !$scope.workplace.length || !($scope.informed.email.length || \n $scope.informed.facebook.length || $scope.informed.webSite.length || $scope.informed.colleague.length || \n $scope.informed.other.length) || !($scope.population.elementary.length || \n $scope.population.highSchool.length || $scope.population.higherEducation.length || $scope.population.other.length)) {\n $scope.emptyData = true;\n } else { // Habilita\n $scope.emptyData = false;\n }\n }", "function validateForm() {\n\n\tvar valid = true;\n\n\tif (!validateField(\"firstname\"))\n\t\tvalid = false;\n\n\tif (!validateField(\"lastname\"))\n\t\tvalid = false;\n\n\tif (!checkPasswords())\n\t\tvalid = false;\n\n\tif (!checkEmail())\n\t\tvalid = false;\n\n\tif (valid)\n\t\tsubmitForm();\n\n\t// Return false to make sure the HTML doesn't try submitting anything.\n\t// Submission should happen via javascript.\n\treturn false;\n}", "function sjb_is_valid_input(event, input_type, input_class) {\n var jobpost_form_inputs = $(\".\" + input_class).serializeArray();\n var error_free = true;\n\n for (var i in jobpost_form_inputs) {\n var element = $(\"#\" + jobpost_form_inputs[i]['name']);\n var valid = element.hasClass(\"valid\");\n var is_required_class = element.hasClass(\"sjb-not-required\");\n if (!(is_required_class && \"\" === jobpost_form_inputs[i]['value'])) {\n if (\"email\" === input_type) {\n var error_element = $(\"span\", element.parent());\n } else if (\"phone\" === input_type) {\n var error_element = $(\"#\" + jobpost_form_inputs[i]['name'] + \"-invalid-phone\");\n }\n\n // Set Error Indicator on Invalid Input\n if (!valid) {\n error_element.show();\n error_free = false;\n }\n else {\n error_element.hide();\n }\n\n // Stop Form Submission\n if (!error_free) {\n event.preventDefault();\n }\n }\n }\n return error_free;\n }", "function isValidForm(){\n\n if(newCatNameField.value.length > 0 && checkDuplicateName(newCatNameField.value) &&\n newCatLimitField.validity.valid && newCatLimitField.value.length > 0){\n createButton.classList.remove('mdl-button--disabled');\n }\n else {\n createButton.classList.add('mdl-button--disabled');\n }\n }", "function validForm() {\n // si el nombre es igual a vacio\n // entonces muestrame que es invalido\n if ($('#titulo').val() == \"\") {\n $('#titulo').removeClass(\"is-valid\")\n $('#titulo').addClass(\"is-invalid\")\n } else {\n $('#titulo').removeClass(\"is-invalid\")\n $('#titulo').addClass(\"is-valid\")\n }\n if ($('#descripcion').val() == \"\") {\n $('#descripcion').removeClass(\"is-valid\")\n $('#descripcion').addClass(\"is-invalid\")\n } else {\n $('#descripcion').removeClass(\"is-invalid\")\n $('#descripcion').addClass(\"is-valid\")\n } \n if ($('#categorias').val() == \"\") {\n $('#categorias').removeClass(\"is-valid\")\n $('#categorias').addClass(\"is-invalid\")\n } else {\n $('#categorias').removeClass(\"is-invalid\")\n $('#categorias').addClass(\"is-valid\")\n }\n if ($('#contenido').val() == \"\") {\n $('#contenido').removeClass(\"is-valid\")\n $('#contenido').addClass(\"is-invalid\")\n } else {\n $('#contenido').removeClass(\"is-invalid\")\n $('#contenido').addClass(\"is-valid\")\n }\n if ($('#fecha_publ').val() == \"\") {\n $('#fecha_publ').removeClass(\"is-valid\")\n $('#fecha_publ').addClass(\"is-invalid\")\n } else {\n $('#fecha_publ').removeClass(\"is-invalid\")\n $('#fecha_publ').addClass(\"is-valid\")\n }\n if ($('#fecha_fin').val() == \"\") {\n $('#fecha_fin').removeClass(\"is-valid\")\n $('#fecha_fin').addClass(\"is-invalid\")\n } else {\n $('#fecha_fin').removeClass(\"is-invalid\")\n $('#fecha_fin').addClass(\"is-valid\")\n }\n if ($('#titulo').val() != \"\" && $('#categoria').val() != 0 && $('#descripcion').val() != \"\" && $('#contenido').val() != \"\" && $('#fecha_publ').val() != \"\" && $('#fecha_fin').val() >= \"\") {\n CrearOActualizar()\n }\n}", "function IsvalidForm() {\n ///Apply Bootstrap validation with Requird Controls in Input Form\n var result = jQuery('#InputForm').validationEngine('validate', { promptPosition: 'topRight: -20', validateNonVisibleFields: true, autoPositionUpdate: true });\n ///If all requird Information is Given\n if (result) {\n ///If all requird Information is Given then return true\n return true;\n }\n ///If all requird Information is Given then return false\n return false;\n}", "function validate_form() {\n valid = true;\n\n if (document.form.age.value == \"\") {\n alert(\"Please fill in the Age field.\");\n valid = false;\n }\n\n if (document.form.heightFeet.selectedIndex == 0) {\n alert(\"Please fill in the Height field.\");\n valid = false;\n }\n\n if (document.form.heightInches.selectedIndex == 0) {\n alert(\"Please fill in the Height field.\");\n valid = false;\n }\n\n if (document.form.weight.value == \"\") {\n alert(\"Please fill in the Weight field.\");\n valid = false;\n }\n\n if (document.form.position.selectedIndex == 0) {\n alert(\"Please fill in the Position field.\");\n valid = false;\n }\n\n if (document.form.playingStyle.selectedIndex == 0) {\n alert(\"Please fill in the Playing Style field.\");\n valid = false;\n }\n\n if (document.form.heightInches.selectedIndex == 0) {\n alert(\"Please fill in the Maximum Price field.\");\n valid = false;\n }\n\n return valid;\n}", "function validateInputs() {\n var valid = true;\n\n var displayNameValid = /^([a-zA-Z]+[a-zA-Z0-9]*)$/.test(displayNameInput.val());\n if (displayNameInput.val() && !displayNameValid) {\n displayNameAlert.show();\n valid = false;\n }\n\n var emailValid = /^([a-zA-Z0-9]+[a-zA-Z0-9\\.\\_]*\\@[a-zA-Z]+\\.[a-zA-Z]+)$/.test(emailInput.val());\n if (emailInput.val() && !emailValid) {\n emailAlert.show();\n valid = false;\n }\n\n var phoneValid = /^(\\d{3}-\\d{3}-\\d{4})$/.test(phoneInput.val());\n if (phoneInput.val() && !phoneValid) {\n phoneAlert.show();\n valid = false;\n }\n\n var zipcodeValid = /^(\\d{5}(-\\d{4})?)$/.test(zipcodeInput.val());\n if (zipcodeInput.val() && !zipcodeValid) {\n zipcodeAlert.show();\n valid = false;\n }\n\n var passwordValid = passwordInput.val() == passwordConfirmationInput.val();\n if ((passwordInput.val() || passwordConfirmationInput.val()) \n && !passwordValid) {\n passwordAlert.show();\n valid = false;\n }\n\n return valid;\n }", "function valid() {\n if (fname.value != \"\") {\n fname.style.border = \"1px solid green\";\n errfname.innerHTML = \"\";\n }\n if (lname.value != \"\") {\n lname.style.border = \"1px solid green\";\n errlname.innerHTML = \"\";\n }\n if (email.value != \"\") {\n email.style.border = \"1px solid green\";\n erremail.innerHTML = \"\";\n }\n if (password.value != \"\") {\n password.style.border = \"1px solid green\";\n errpassword.innerHTML = \"\";\n }\n if (repassword.value != \"\") {\n repassword.style.border = \"1px solid green\";\n errrepassword.innerHTML = \"\";\n }\n}", "function validate_form(){\n if (is_form_valid(form)) {\n sendForm()\n }else {\n let $el = form.find(\".input:invalid\").first().parent()\n focus_step($el)\n }\n }", "function validateEdit(){\n\t\n\t//check to see if the user left the name field blank\n\tif (document.getElementById(\"e_name\").value == null || document.getElementById(\"e_name\").value == \"\"){\n\t\t\n\t\t//finding the error element to insert a warning message to screen\n\t\tdocument.getElementById(\"e_nameerror\").innerHTML= \"*name not filled in\";\n\t\t\n\t\t//changes to the fields properties to highlight the incorrect field\n\t\tformAtt(\"e_name\");\n\t\t\n\t\t//telling the event handler not to execute the onSubmit command\n return false;\n }\n\t\n\t//check to see if the user left the surname field blank\n\tif (document.getElementById(\"e_surname\").value == null || document.getElementById(\"e_surname\").value == \"\"){\n\t\t\n\t\t//finding the error element to insert a warning message to screen\n\t\tdocument.getElementById(\"e_snameerror\").innerHTML= \"*surname not filled in\";\n\t\t\n\t\t//changes to the fields properties to highlight the incorrect field\n\t\tformAtt(\"e_surname\");\n\t\t\n\t\t//telling the event handler not to execute the onSubmit command\n return false;\n }\n\t//if the users submission returns no false checks, then tell the even handler to execute the onSubmit command\n\treturn true;\n}", "function validateStudentFields() {\n var bloggerName = $('#blogger_name').val();\n var bloggerUrl = $('#blogger_feed_url').val();\n var bloggerTwitterHandle = $('#blogger_twitter_handle').val();\n if(bloggerName == '' || bloggerName == null) {\n $('#blogger_name').addClass('form-error');\n $('#blogger_name').val('name can\\'t be blank');\n return true;\n };\n\n if(bloggerUrl.indexOf(\"http://\") != 0) {\n $('#blogger_feed_url').addClass('form-error');\n $('#blogger_feed_url').val('must start with http://');\n return true;\n }\n\n if(bloggerTwitterHandle != '' && bloggerTwitterHandle != null) {\n if(bloggerTwitterHandle.indexOf('@') == -1) {\n $('#blogger_twitter_handle').addClass('form-error');\n $('#blogger_twitter_handle').val('must start with @');\n return true;\n }\n }\n }", "function checkFormInfo(objData) {\n\tfor (var i = 0; i < objData.length; i++) {\n\t\tif (objData[i].value == \"\") {\n\t\t\talert(\"Please input value: \" + objData[i].name);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "function isValidForm() {\n var mainTextValid = isValidRequiredTextAreaField(\"main_text\");\n var articleKeywordCategoryValid = isValidRequiredField(\"article_keyword_category\");\n var articleKeywordsValid = isValidRequiredKeywordsField(\"article_keywords\");\n var originalSourceURLValid = isValidUrlField(\"original_source_url\");\n return isValidPartialForm() && mainTextValid && articleKeywordCategoryValid && articleKeywordsValid && originalSourceURLValid;\n}", "function validate() {\n\n // clear all previous errors\n $(\"input\").removeClass(\"error\");\n var errors = false;\n\n // check all except author, which is special cased\n $(\"input[@name!='author']\").each(function(){\n\n if(! $(this).val()) {\n\n errors = true;\n $(this).addClass(\"error\");\n\n } \n });\n\n // check author\n var seen_author = false;\n $(\"input[@name='author']\").each(function(){\n if ($(this).val()) seen_author = true;\n });\n\n if (!seen_author) {\n $(\"//input[@name='author']:first\").addClass(\"error\");\n errors = true;\n }\n\n // submit if no errors\n return !(errors);\n\n} // validate", "function validateForm() {\n\tvar flag = true;\n\t\n\t// Get the values from the text fields\n\tvar songName = songNameTextField.value;\n\tvar artist = artistTextField.value;\n\tvar composer = composerTextField.value;\n\t\n\t// A regular expression used to test against the values above\n\tvar regExp = /^[A-Za-z0-9\\?\\$'&!\\(\\)\\.\\-\\s]*$/;\n\t\n\t// Make sure the song name is valid\n\tif (songName == \"\" || !regExp.test(songName)) {\n\t\tflag = false;\n\t\talert(\"Please enter a song name. Name can include letters, numbers, and the special characters ?!$&'().-\");\n\t}\n\t// Make sure the artist is valid\n\telse if (artist == \"\" || !regExp.test(artist)) {\n\t\tflag = false;\n\t\talert(\"Please enter an artist. Artist can include letters, numbers, and the special characters ?!$&'().-\");\n\t}\n\t// Make sure the composer is valid\n\telse if (composer == \"\" || !regExp.test(composer)) {\n\t\tflag = false;\n\t\talert(\"Please enter a composer. Composer can include letters, numbers, and the special characters ?!$&'().-\");\n\t}\n\t\n\treturn flag;\n}", "validateForm() {\n return (\n // this.state.title.length > 0 &&\n this.state.email.length > 0 &&\n this.state.first_name.length > 0 &&\n this.state.last_name.length > 0 &&\n this.state.other_name.length > 0 &&\n // this.state.rank.length > 0 &&\n // this.state.department.length > 0 &&\n this.state.password.length > 0 &&\n this.state.password === this.state.confirmPassword\n );\n }", "function validateEditFormInput(){\n //1 collecting data from the updateForm\n const title = document.getElementById('updateTitle');\n const description = document.getElementById('updateDescription');\n const imageUrl = document.getElementById('updateImageUrl');\n \n //2 check input data / display err msg - validation for user\n validateFormTextInput(title, \"title\");\n validateFormTextInput(imageUrl, \"imageUrl\");\n validateFormTextInput(description, \"description\");\n \n inputArr = [title.value, imageUrl.value, description.value]\n return inputArr;\n }", "function specialsValidate(specialsForm){\n\nvar validationVerified=true;\nvar errorMessage=\"\";\n\nif (specialsForm.name.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền tên!\\n\";\nvalidationVerified=false;\n}\nif (specialsForm.description.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền miêu tả!\\n\";\nvalidationVerified=false;\n}\nif (specialsForm.price.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền giá!\\n\";\nvalidationVerified=false;\n}\nif(specialsForm.start_date.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền ngày bắt đầu!\\n\";\nvalidationVerified=false;\n}\nif(specialsForm.end_date.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền ngày kết thúc!\\n\";\nvalidationVerified=false;\n}\nif (specialsForm.photo.value==\"\")\n{\nerrorMessage+=\"Bạn chưa chọn ảnh!\\n\";\nvalidationVerified=false;\n}\nif(!validationVerified)\n{\nalert(errorMessage);\n}\nreturn validationVerified;\n}", "function getFormIsValid() {\n return interactedWith && !getFieldErrorsString()\n }", "function valid(campo1, campo2, campo3, campo4, campo5, campo6, campo7, campo8, campo9, campo10, campo11, campo12, campo13, campo14){\nerro = false;\n\tif (campo1 != null){\n\t\tif (campo1.value == \"\"){\n\t\t\terro = true;\n\t\t\tcampo1.focus();\n\t\t}\n\t\telse if (campo2 != null){\n\t\t\tif (campo2.value == \"\"){\n\t\t\t\terro = true;\n\t\t\t\tcampo2.focus();\n\t\t\t}\n\t\t\telse if (campo3 != null){\n\t\t\t\tif (campo3.value == \"\"){\t\t\n\t\t\t\t\terro = true;\n\t\t\t\tcampo3.focus();\n\t\t\t\t}\n\t\t\t\telse if (campo4 != null){\n\t\t\t\t\tif (campo4.value == \"\"){\t\t\n\t\t\t\t\t\terro = true;\n\t\t\t\t\t\tcampo4.focus();\n\t\t\t\t\t}\n\t\t\t\t\telse if (campo5 != null){\n\t\t\t\t\t\tif (campo5.value == \"\"){\t\t\n\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\tcampo5.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (campo6 != null){\n\t\t\t\t\t\t\tif (campo6.value == \"\"){\t\t\n\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\tcampo6.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (campo7 != null){\n\t\t\t\t\t\t\t\tif (campo7.value == \"\"){\t\t\n\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\tcampo7.focus();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (campo8 != null){\n\t\t\t\t\t\t\t\t\tif (campo8.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\tcampo8.focus();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (campo9 != null){\n\t\t\t\t\t\t\t\t\t\tif (campo9.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\tcampo9.focus();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (campo10 != null){\n\t\t\t\t\t\t\t\t\t\t\tif (campo10.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\tcampo10.focus();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\telse if (campo11 != null){\n\t\t\t\t\t\t\t\t\t\t\t\tif (campo11.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\tcampo11.focus();\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\telse if (campo12 != null){\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (campo12.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\tcampo12.focus();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\telse if (campo13 != null){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (campo13.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcampo13.focus();\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\telse if (campo14 != null){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (campo14.value == \"\"){\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\terro = true;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcampo14.focus();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\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}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\tif (erro==false){\n\t\treturn salvar();\n\t}\n\telse{\n\t\talert(\"Favor preencher todos os campos requeridos. \\n Vou indica-lo!\");\n\t\treturn false;\n\t}\n}", "function onSubmitValidation(event) {\r\n var valid \t\t\t = true;\r\n var firstInvalidField = -1;\r\n var input \t\t\t = document.querySelectorAll(\"input\");\r\n\r\n for(var index = 0; index < input.length; index++) {\r\n\r\n var p = input[index].parentNode.parentNode.querySelector(\"p\");\r\n\r\n if (input[index].value.length == 0 && input[index].className == \"required\") {\r\n p.innerHTML = input[index].getAttribute(\"title\");\r\n input[index].style.backgroundColor = \"pink\";\r\n\r\n if (firstInvalidField == -1) {\r\n firstInvalidField = index;\r\n }\r\n }\r\n else {\r\n p.innerHTML = \"\";\r\n input[index].style.backgroundColor = \"white\";\r\n }\r\n }\r\n\r\n // Give focus to the first field in error\r\n if (firstInvalidField != -1) {\r\n input[firstInvalidField].focus();\r\n valid = false;\r\n }\r\n\r\n // Returning false cancels form submission\r\n return valid;\r\n}", "function validateForm() {\n return fields.email.length > 0 && fields.password.length > 0;\n }", "function validateForm () {\n const nameFieldDom = document.getElementById('name');\n const textFieldDom = document.getElementById('message');\n const checkboxDom = document.getElementById('isAttending');\n // console.log('Data within these fields is: ', nameFieldDom.value, textFieldDom.value);\n if (\n nameFieldDom.value.trim() == '' || \n textFieldDom.value.trim() == '' || \n textFieldDom.value.length <= 3 || \n nameFieldDom.value.length < 3\n ) return true;\n else return false;\n }", "validate() { }", "function validarGuardadoNuevoProveedor(){\n\n\tvar sw = 0; // variable para determinar si existen campos sin diligenciar\n\t\n\tif( $(\"#identificativo\").val().trim().length == 0 ){\n\t\t\n\t\t$(\"#label_identificativo\").addClass( \"active\" );\n\t\t$(\"#identificativo\").addClass( \"invalid\" );\n\t\tsw = 1;\n\t}\t\n\n\tif( $(\"#nombre\").val().trim().length == 0 ){\n\t\t\n\t\t$(\"#label_nombre\").addClass( \"active\" );\n\t\t$(\"#nombre\").addClass( \"invalid\" );\n\t\tsw = 1;\n\t}\t\n\t\n\tif( $(\"#email\").val().trim().length != 0 ){\n\t\t\n\t\tif($(\"#email\").val().indexOf('@', 0) == -1 || $(\"#email\").val().indexOf('.', 0) == -1) {\n $(\"#label_email\").addClass( \"active\" );\n\t\t\t$(\"#email\").addClass( \"invalid\" );\n\t\t\tsw = 1;\n }\t\n\t\t\n\t}\n\t\n\tif(sw == 1){\n\t\treturn false;\n\t}else{\n\t\t$(\"#form_nuevoProveedor\").submit();\n\t}\t\n\t\t\n}", "function validateInput() {\n $('.form-control').removeClass('is-invalid');\n\n const validator = new registerValidation();\n\n validator.checkName(formFields.name);\n validator.checkSurname(formFields.surname);\n validator.checkAddress(formFields.address);\n validator.checkZip(formFields.zip);\n validator.checkCity(formFields.city);\n validator.checkAge(formFields.age);\n validator.checkPhone(formFields.phone);\n validator.checkEmail(formFields.email);\n validator.checkAdults(formFields.adults);\n validator.checkUnderage(formFields.underage);\n validator.checkPets(formFields.pets);\n validator.checkVehicles(formFields.vehicles);\n\n return validator.isValid();\n}", "function valid(){return validated}", "function validar(){\n\tvar valNom = valNombre(); \n\tvar valApe = valApellido();\n\tvar valTel = valNumero();\n\tvar valMayor = valEdad();\n\tvar email = valEmail();\n\tvar ident = identificador();\n}", "function validateForm() {\n return username.length > 0 && password.length > 0;\n }", "function allValid(inputs, ignoreInvalid){\n\tconsole.log('Ignore invalid set to: ' + ignoreInvalid);\n\tif(ignoreInvalid) {\n\t\tconsole.log('allValid: returning [ true ]');\n\t\treturn true;\n\t}\n\tconsole.log('AllValid: Performing Checks');\n let valid = true;\n\tinputs.map(e => {\n\t\t/*\n\t\t* Sweeps the array, if any field is empty, the form is set to invalid.\n\t\t* Also, sets all inputs to valid.\n\t\t*/\n\t\te.invalid = false;\n\t\tif(e.value == \"\"){\n\t\t\te.invalid = true;\n\t\t\tvalid = false;\n\t\t}\n\t});\n \n\t/*\n\t* Name must be: only letters.\n\t*/\n\tlet nameInput = getInput(inputs, \"Name\");\n\tif(nameInput.value.length > 20 || !/^[a-zA-Z-,]+(\\s{0,1}[a-zA-Z-, ])*$/.test(nameInput.value)){\n\t\t//If the name is a string with only characters, and size smaller than 20.\n\n\t\tconsole.log('Invalid Name');\n\t\tnameInput.invalid = true;\n\t\tvalid = false;\n\t}\n \n\t/*\n\t* Age: only numbers ranging from 0 to 60.\n\t*/\n\tlet ageInput = getInput(inputs, \"Age\");\n\tif(ageInput.value <= 0 || ageInput.value >= 60){\n\t\t//If age is a natural integer smaller than 60\n\n\t\tconsole.log('Invalid Age');\n\t\tageInput.invalid = true;\n\t\tvalid = false;\n\t}\n\n\t/*\n\t* Phone: only numbers. String must be 11 chars long.\n\t*/\n\tlet phoneInput = getInput(inputs, \"Phone\");\n\tif(phoneInput.value.length != 11){\n\t\t//If phone number's length is not 11.\n\n\t\tphoneInput.invalid = true;\n\t\tconsole.log('Invalid Phone');\n\t\tvalid = false;\n\t}\n\n\t/*\n\t* Password: Password and Validade Password must be equals.\n\t*/\n\tlet passInput = getInput(inputs, \"Password\");\n\tlet validPassInput = getInput(inputs, \"ValidatePassword\");\n\tif(!passInput.invalid){\n\t\t//If password is not empty\n\n\t\tif(passInput.value != validPassInput.value ){\n\t\t\t//If password and validPassword are not the same.\n\n\t\t\tvalidPassInput.invalid = true;\n\t\t\tconsole.log('Unmatching Passwords');\n\t\t\tvalid = false;\n\t\t}\n\t} else {\n\t\tvalidPassInput.invalid = false;\n\t}\n\tconsole.log('allValid: returning [ '+ valid +' ]');\n\treturn valid;\n}", "function checkInputs() {\n $('input, textarea').blur(function() {\n if ($(this).val().length < 1) {\n $(this).addClass('error');\n } else {\n $(this).removeClass('error');\n }\n });\n }", "validateForm() {\r\n\t\treturn this.state.email.length > 0 && this.state.password.length > 0;\r\n\t}", "function validate_input() {\n\tvar err = 0; // pocet chyb\n\tfor(let i = 0; i < 9; i++) {\n\t\tif(user_order[i] !== order[i])\n\t\t\terr++;\n\t}\n\t$('#errcount').val(err);// ukaz tlacitko odeslani a zvaliduj napred\n\t$('#dialogform1').toggleClass(\"disappear\"); // ukaz odesilaci formular\n}", "function validateForm(){\n let errors = {};\n\n if (!formValue.firstName.trim()) {\n errors.firstName = 'First Name is required';\n }\n \n if (!formValue.lastName.trim()) {\n errors.lastName = 'Last Name is required';\n }\n \n if (!formValue.email) {\n errors.email = 'Email is required';\n } else if (!/^[\\w-.]+@([\\w-]+.)+[\\w-]{2,4}$/.test(formValue.email)) {\n errors.email = 'Email address is invalid';\n }\n setErrors(errors); \n }", "function validateForm() {\n return email.length > 0 && password.length > 0;\n }", "function checkForm()\n {\n var valid = true;\n $('#yolo input[type=\"text\"]').each(function(){\n // If it's empty, or not a number.\n if (this.value == \"\" || this.value == null || isNaN(this.value)) // regular expression for numbers only.\n {\n $(this).css(\"border\", \"1px solid red\");\n $(this).attr(\"placeholder\", \"Please enter a number\");\n valid = false;\n }\n });\n return valid;\n }", "function Validacion_Create(e){\n //Esta linea detiene el envio al POST para validarlo\n e.preventDefault();\n try{\n console.log('Validando formulario Insumos!');\n if(this.querySelector('[name=Descripcion]').value == '') { \n console.log('La Descripcion esta vacía');\n ejecutaAlertaError(\"Descripcion\");\n // alert(\"Error! La Descripcion esta vacía, por favor complete el campo\")\n return;\n }\n if(this.querySelector('[name=DescripcionAbre]').value == '') { \n console.log('La DescripcionAbre esta vacía');\n ejecutaAlertaError(\"Descripcion Abreviada\");\n return;\n }\n\n this.submit();\n\n }\n catch{\n ejecutaAlertaError();\n }\n\n \n }", "validateForm() {\n let fields = this.state.fields\n let errors = {}\n let formIsValid = true\n\n if (!fields[\"UsersFName\"]) {\n formIsValid = false\n errors[\"UsersFName\"] = \"Enter your first name.\"\n }\n\n if (typeof fields[\"UsersFName\"] !== \"undefined\") {\n if (!fields[\"UsersFName\"].match(/^[a-zA-Z ]*$/)) {\n formIsValid = false\n errors[\"UsersFName\"] = \"Enter Name that contains alphabet\"\n }\n }\n\n if (!fields[\"UsersLName\"]) {\n formIsValid = false\n errors[\"UsersLName\"] = \"Enter your last name.\"\n }\n\n if (typeof fields[\"UsersLName\"] !== \"undefined\") {\n if (!fields[\"UsersLName\"].match(/^[a-zA-Z ]*$/)) {\n formIsValid = false\n errors[\"UsersLName\"] = \"*Please enter alphabet characters only.\"\n }\n }\n\n if (!fields[\"UsersEmail\"]) {\n formIsValid = false\n errors[\"UsersEmail\"] = \"*Please enter your UsersEmail address.\"\n }\n\n if (typeof fields[\"UsersEmail\"] !== \"undefined\") {\n var emailPattern = new RegExp(/^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i)\n if (!emailPattern.test(fields[\"UsersEmail\"])) {\n formIsValid = false\n errors[\"UsersEmail\"] = \"Enter a valid UsersEmail address\"\n }\n }\n\n if (!fields[\"UsersPhone\"]) {\n formIsValid = false\n errors[\"UsersPhone\"] = \"Enter valid your UsersPhone number.\"\n }\n\n if (!fields[\"UsersPassword\"]) {\n formIsValid = false\n errors[\"UsersPassword\"] = \"Enter the UsersPassword.\"\n }\n\n if (typeof fields[\"UsersPassword\"] !== \"undefined\") {\n if (!fields[\"UsersPassword\"].length >= 6) {\n formIsValid = false\n errors[\"UsersPassword\"] = \"Enter a strong and a secured UsersPassword.\"\n }\n }\n\n this.setState({\n errors: errors\n })\n return formIsValid\n }", "function validation(form) {\n function isEmail(email) {\n return /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(\n email\n );\n }\n\n function isPostCode(postal) {\n if (\n /^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d$/i.test(\n postal\n ) ||\n /^\\d{5}$|^\\d{5}-\\d{4}$/.test(postal)\n )\n return true;\n else return false;\n }\n\n function isPhone(phone) {\n if (/^\\d{10}$/.test(phone)) return true;\n else return false;\n }\n\n function isPassword(password) {\n // Input Password and Submit [7 to 15 characters which contain only characters, numeric digits, underscore and first character must be a letter]</h2\n if (/^[A-Za-z]\\w{7,14}$/.test(password)) {\n return true;\n } else {\n return false;\n }\n }\n\n let isError = false;\n let password = '';\n\n validationFields.forEach((field) => {\n const isRequired =\n [\n 'firstName',\n 'LastName',\n 'email',\n 'address',\n 'postalCode',\n 'password',\n 'conPassword',\n ].indexOf(field) != -1;\n\n if (isRequired) {\n const item = document.querySelector('#' + field);\n\n if (item) {\n const value = item.value.trim();\n if (value === '') {\n setErrorFor(item, field + ' cannot be blank!');\n isError = true;\n } else if (field === 'email' && !isEmail(value)) {\n setErrorFor(item, 'Invalid Email Address!');\n isError = true;\n } else if (field === 'postalCode' && !isPostCode(value)) {\n setErrorFor(item, 'Invalid Postal Code!');\n isError = true;\n } else if (field === 'phone' && !isPhone(value)) {\n setErrorFor(item, 'Invalid Phone Number!');\n isError = true;\n } else if (field === 'password' && isPassword(value)) {\n setSuccessFor(item);\n password = value;\n } else if (field === 'password' && !isPassword(value)) {\n setErrorFor(\n item,\n ' Minimum 7 and Maximum 15 characters, numeric digits, underscore and first character must be a letter!'\n );\n isError = true;\n password = '';\n } else if (field === 'conPassword' && password !== value) {\n setErrorFor(item, 'Confirmation Password Not Match!');\n isError = true;\n } else {\n setSuccessFor(item);\n }\n }\n }\n });\n\n return isError === false;\n}", "function validateForm() {\n\t\n\tvar error = 0;\n\t$('input').each(function(x,y) {\n\t\tvar val = $(y).val();\n\t\tif(!validate(y.name, val)) {\n\t\t\t$(y).css('border', 'solid 1px red')\n\t\t\terror = 1;\n\t\t} else {\n\t\t\t$(y).css('border', 'solid 1px 888');\n\t\t}\n\t});\n\t\n\t$('textarea').each(function(x,y) {\n\t\tvar val = $(y).val();\n\t\tif(!validate(y.name, val)) {\n\t\t\t$(y).css('border', 'solid 1px red')\n\t\t\terror = 1;\n\t\t} else {\n\t\t\t$(y).css('border', 'solid 1px 888');\n\t\t}\n\t});\n\t\n\tif(error === 1) {\n\t\treturn false;\n\t}\n}", "function validate() {\n\t\t\n\t\tvar fname = $(\"#fname\").val();\n\t\tvar lname = $(\"#lname\").val();\n\t\t\n\t\tvar question = $(\"#resizable\").val();\n\t\tvar date = $(\"#datepicker\").val();\n\t\t\n\t\tif(fname == \"\") {\n\t\t\talert(\"Please enter first name\");\n\t\t}\n\t\t\n\t\telse if(lname == \"\") {\n\t\t\talert(\"Please enter last name\");\n\t\t}\n\t\t\n\t\telse if(question == \"\") {\n\t\t\talert(\"Please enter a question\");\n\t\t}\n\t\t\n\t\telse if(date == \"\") {\n\t\t\t\talert(\"Please select a date\");\n\t\t}\n\t\t\n\t\telse {\n\t\t\talert(\"Submitted\");\n\t\t}\n\t}", "_onSubmitValidateInputs() {\n\t\tthis.setState({ inputDirty: true });\n\t\tlet validationValue = this._validateInputFeild(this.state.inputStateKey);\n\t\tthis.setState({ isValidInput: validationValue.test, invalidMessage: validationValue.test ? '' : validationValue.message })\n\t\tif (this.props.inputChanged) {\n\t\t\tthis.props.inputChanged(this.props.inputStateKey, this.state.inputStateKey, this.state.isValidInput)\n\t\t}\n\t}", "function validar() {\n var i = 0;\n\n if ($(\"#txtNombre\").val().length < 1) {\n i++;\n }\n if ($(\"#txtSemestre\").val().length < 1) {\n i++;\n }\n if ($(\"#txtCarrera\").val().length < 1) {\n i++;\n }\n if ($(\"#txtSerie\").val().length < 1) {\n i++;\n }\n if ($(\"#txtHPracticas\").val().length < 1) {\n i++;\n }\n\n\n if (i == 5) {\n alert(\"Por favor llene todos los campos.\");\n return false;\n }\n\n\n if ($(\"#txtNombre\").val().length < 1) {\n alert(\"El nombre es obligatorio.\");\n }\n if ($(\"#txtSemestre\").val().length < 1) {\n alert(\"El semestre designado es obligatorio.\");\n }\n if ($(\"#txtCarrera\").val().length < 1) {\n alert(\"La carrera es obligatorio.\");\n }\n if ($(\"#txtSerie\").val().length < 1) {\n alert(\"La serie es obligatorio.\");\n }\n if ($(\"#txtHPracticas\").val().length < 1) {\n alert(\"El campo de horas practicas es obligatorio.\");\n }\n\n if (i == 0) {\n saveMtr(); \n $('#txtSerie').val('');\n $('#txtNombre').val('');\n $('#txtSemestre').val('');\n $('#txtCarrera').val('');\n $('#txtHPracticas').val('');\n return false;\n }\n\n}", "_validate(items) {\n\t\t\titems.forEach(item => item.classList.remove('js-error'));\n\n\t\t\t// include filter function\n\t\t\titems.filter = Array.prototype.filter;\n\n\t\t\t// grab empty fields\n\t\t\tconst errors = items.filter(el => el.value == '');\n\n\t\t\tif (!errors.length)\n\t\t\t\treturn true;\n\n\t\t\terrors.forEach(item => item.classList.add('js-error'));\n\t\t\treturn false;\n\t\t}", "function validateForm() {\r\n var newTitle = document.forms[\"validForm\"][\"btitle\"].value;\r\n var newOwner = document.forms[\"validForm\"][\"bowner\"].value;\r\n var newContent = document.forms[\"validForm\"][\"bcontent\"].value;\r\n var newPublisher = document.forms[\"validForm\"][\"bpublisher\"].value;\r\n if (newTitle == \"\") {\r\n alert(\"Title must be filled out\");\r\n return false;\r\n } else if (newOwner == \"\") {\r\n alert(\"Name Must be filled out\");\r\n return false;\r\n } else if (newContent == \"\") {\r\n alert(\"Content Must be filled out\");\r\n return false;\r\n } else if (newPublisher == \"\") {\r\n alert(\"Publisher Name Must be filled out\");\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n}", "function validateInputFields() {\n var msg = \"\";\n if ($(\"#txtTaskName\").val() === \"\") {\n msg += \"O campo 'Nome' é obrigatório.\";\n }\n if ($(\"#txtTaskDescription\").val() === \"\") {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Descrição' é obrigatório.\";\n }\n if ($(\"#txtTaskOrder\").val() === \"\") {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Ordem' é obrigatório.\";\n }\n if ($(\"#ddlTaskStatus option:selected\").val() === undefined) {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Estado' é obrigatório.\";\n }\n if (msg.length > 0) {\n MessageBox.info(msg, { Div: \"#divTaskModalMessage\" });\n return false;\n }\n MessageBox.clear({ Div: \"#divTaskModalMessage\" });\n return true;\n }", "validateForm() {\n return (this.validatePrices()\n && this.validateName() === 'success'\n && this.state.hash !== \"\"\n && this.state.ipfsLocation !== \"\"\n && this.state.fileState === FileStates.ENCRYPTED)\n }", "function validateForm() {\n\t\tvar $fields = $(\".form-control:visible\");\n\t\tvar $thisStep = $('.formPaso-stepper:visible');\n\t\tvar $nextStep = $thisStep.attr('data-nextStep');\n\t\tvar $filledFields = $fields.find('input[value!=\"\"]');\n\t\tvar $emptyFields = $fields.filter(function() {\n\t \treturn $.trim(this.value) === \"\";\n\t });\n \tfunction continueForm() {\n\t \t// apaga stepper\n\t \t// $('#stepper_portabilidad li').removeClass('active');\n\t \t// prende stepper correcto\n\t \t$('#stepper_portabilidad li.stepperLED-' + $nextStep).addClass('active');\n\t \t// deshabilita este boton\n\t \t$($thisStep).find('.nextStep').addClass('disabled');\n\t \t// oculta este paso\n\t \t$($thisStep).slideUp('1200');\n\t \t// muestra el paso siguiente\n\t \t$('#portateForm-' + $nextStep).slideDown('1200');\n\t \t// habilita el boton a paso siguiente\n\t \t$('#portateForm-' + $nextStep).find('.nextStep').removeClass('disabled');\n\t \t// anima el DOM hasta el stepper\n\t \t$('html, body').animate({scrollTop: $(\"#stepper_portabilidad\").offset().top - 30}, 500);\n\t\t // cancela form button\n\t \treturn false;\n\t }\n\t\tif (!$emptyFields.length) {\n\t\t\t// if form is ok...\n\t\t\t$('#camposvacios').slideUp();\n\t\t\tcontinueForm();\n\t\t} else {\n\t\t console.log($emptyFields);\n\t\t $emptyFields.parents('.form-group').addClass('invalidInput').removeClass('input-effect');\n\t\t $filledFields.addClass('totallyValidInput');\n\t\t console.log($filledFields);\n\t\t $('#camposvacios').slideToggle();\n\t\t $('html, body').animate({scrollTop: $(\"#camposvacios\").offset().top}, 200);\n\t\t}\n\t}", "function formValidation() {\n //* If validation of email fails, add the warning class to email input and set the display of warning message to inline.\n if (!validation.isEmailValid(email.value)) {\n email.classList.add(\"warning\");\n email.nextElementSibling.style.display = \"inline\";\n }\n //* If validation of name fails, add the warning class to name input and set the display of warning message to inline.\n if (!validation.isNameValid(name.value)) {\n name.classList.add(\"warning\");\n name.nextElementSibling.style.display = \"inline\";\n }\n /*\n * If validation of message fails, add the warning class to message text area and set the display of warning\n * message to inline\n */\n if (!validation.isMessageValid(message.value)) {\n message.classList.add(\"warning\");\n message.nextElementSibling.style.display = \"inline\";\n }\n /*\n *If validation of title fails, add the warning class to title input and set the display of warning\n *message to inline\n */\n\n if (!validation.isTitleValid(title.value)) {\n title.classList.add(\"warning\");\n title.nextElementSibling.style.display = \"inline\";\n }\n if (\n validation.isEmailValid(email.value) &&\n validation.isNameValid(name.value) &&\n validation.isTitleValid(title.valid) &&\n validation.isMessageValid(message.value)\n ) {\n return true;\n } else return false;\n}", "function validateForm(inputName, description, assignedTo, dueDate, status) {\r\n let allValid = false;\r\n\r\n if (inputName.length >= 3 && (description.length >= 10) && (assignedTo.length >= 3) && (dueDate) && (status != 'Select status')) {\r\n allValid = true;\r\n }\r\n return allValid;\r\n}", "function validarFormulario(){\n var flagValidar = true;\n var flagValidarRequisito = true;\n\n if(txtCrben_num_doc_identific.getValue() == null || txtCrben_num_doc_identific.getValue().trim().length ==0){\n txtCrben_num_doc_identific.markInvalid('Establezca el numero de documento, por favor.');\n flagValidar = false;\n return flagValidar;\n }\n\n if(txtCrben_nombres.getValue() == null || txtCrben_nombres.getValue().trim().length ==0){\n txtCrben_nombres.markInvalid('Establezca el nombre, por favor.');\n flagValidar = false;\n return flagValidar;\n }\n\n if(cbxCrecv_codigo.getValue() == null || cbxCrecv_codigo.getValue().trim().length ==0){\n cbxCrecv_codigo.markInvalid('Establezca el estado civil, por favor.');\n flagValidar = false;\n return flagValidar;\n }\n\n if(txtCrben_apellido_paterno.getValue() == null || txtCrben_apellido_paterno.getValue().trim().length ==0){\n txtCrben_apellido_paterno.markInvalid('Establezca el apellido, por favor.');\n flagValidar = false;\n return flagValidar;\n }\n\n if(cbxCpais_nombre_nacimiento.getValue() == null || cbxCpais_nombre_nacimiento.getValue().trim().length ==0){\n cbxCpais_nombre_nacimiento.markInvalid('Establezca el pais de nacimiento, por favor.');\n flagValidar = false;\n return flagValidar;\n }\n\n if(dtCrper_fecha_nacimiento.isValid()==false){\n dtCrper_fecha_nacimiento.markInvalid('Establezca la fecha de nacimiento, por favor.');\n flagValidar = false;\n return flagValidar;\n }\n\n for (var i = 0; i < gsCgg_res_solicitud_requisito.getCount(); i++) {\n var rRequisito = gsCgg_res_solicitud_requisito.getAt(i);\n if (rRequisito.get('CRSRQ_REQUERIDO') == true) {\n if (rRequisito.get('CRRQT_CUMPLE') == false) {\n flagValidarRequisito = false;\n }\n }\n }\n\n if (flagValidarRequisito == false) {\n Ext.Msg.show({\n title: tituloCgg_res_beneficiario,\n msg: 'Uno de los requisitos necesita cumplirse, por favor verifiquelos.',\n buttons: Ext.Msg.OK,\n icon: Ext.MessageBox.WARNING\n }); \n grdCgg_res_solicitud_requisito.focus();\n flagValidar = false;\n }\n return flagValidar;\n }", "function validInput(obj) {\n if(obj.hasClass('i-user')) {\n if(obj.val() == '' || /^[ ]+$/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else if(!/[a-zA-Zа-яА-Я- ]+/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else {\n obj.removeClass('error').addClass('ok');\n }\n\n } else if(obj.hasClass('i-phone')) {\n if(obj.val() == '' ) {\n //if(obj.val() == '' || /[ ]+/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else if(/[_]+/.test(obj.val())) {\n obj.removeClass('ok').addClass('error');\n\n } else {\n obj.removeClass('error').addClass('ok');\n }\n }\n}", "function validateForm(){\n // Set error catcher\n var error = 0;\n // Check name\n if(!validateName('reg_name')){\n document.getElementById('nameError').style.display = \"block\";\n error++;\n }\n // Validate email\n var x =document.getElementById('reg_email').value;\n if(!validateEmail(x)){\n document.getElementById('emailError').style.display = \"block\";\n error++;\n }\n // Validate animal dropdown box\n if(!validateSelect('Occupation')){\n document.getElementById('animalError').style.display = \"block\";\n error++;\n }\n if(!validatePassword('reg_pass')){\n document.getElementById('pass_Error').style.display = \"block\";\n error++;\n }\n // Don't submit form if there are errors\n if(error > 0){\n return false;\n }\n else if(error == 0){\n regfun();\n }\n }", "function required(object){/*///El valor '' es para input que requieran que se ingrese texto, el valor 0 puede ser para selects2 (dropdowns)*/ var valor = object.val(); if (valor=='' || valor==0) {object.addClass('errorform'); return false; /*///Valor vacio (invalido)*/ } else {return true; /*///Valor valido*/ } }", "function validateInputFields() {\n var msg = \"\";\n if ($(\"#txtAlertName\").val() === \"\") {\n msg += \"O campo 'Nome' é obrigatório.\";\n }\n if ($(\"#txtAlertDescription\").val() === \"\") {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Descrição' é obrigatório.\";\n }\n if ($(\"#txtAlertDueDate\").data(\"DateTimePicker\").date() === null) {\n if (msg.length > 0) { msg += \"<br>\"; }\n msg += \"O campo 'Data' é obrigatório.\";\n }\n if (msg.length > 0) {\n MessageBox.info(msg, { Div: \"#divAlertModalMessage\" });\n return false;\n }\n MessageBox.clear({ Div: \"#divAlertModalMessage\" });\n return true;\n }" ]
[ "0.73166907", "0.7295985", "0.71020275", "0.70454836", "0.701639", "0.70110303", "0.6992709", "0.6991851", "0.6973798", "0.6970252", "0.6967508", "0.6955684", "0.69477284", "0.69455993", "0.6930452", "0.6929004", "0.6920506", "0.68955076", "0.68725926", "0.6872013", "0.68513566", "0.68394154", "0.6822356", "0.6814002", "0.6812568", "0.6809881", "0.6794348", "0.6794045", "0.67853576", "0.67848724", "0.67829436", "0.67813885", "0.67663515", "0.6765891", "0.676559", "0.67580956", "0.67519945", "0.6750382", "0.67468876", "0.6736771", "0.673623", "0.67344546", "0.6723734", "0.67216486", "0.67192125", "0.6716924", "0.6716238", "0.67150724", "0.67104393", "0.67098916", "0.67083675", "0.6707239", "0.6696169", "0.6696062", "0.6693161", "0.66903836", "0.6689833", "0.6689542", "0.66893", "0.66890633", "0.6688373", "0.66883236", "0.66823995", "0.6677426", "0.66771734", "0.6672846", "0.6669112", "0.66579753", "0.66553324", "0.6655329", "0.66545355", "0.6653057", "0.6649853", "0.6646161", "0.66453934", "0.66439337", "0.6641856", "0.66358656", "0.66322345", "0.66292274", "0.66271913", "0.6627135", "0.6624652", "0.66218", "0.66205376", "0.6618426", "0.66160595", "0.6615272", "0.6612762", "0.66117734", "0.6608416", "0.6607487", "0.6605826", "0.66054356", "0.66053104", "0.6604815", "0.6603021", "0.6602969", "0.6602476", "0.659974", "0.65997183" ]
0.0
-1
you can only write your code here!
function balikAngka(angka){ var terbalik = 0 while(angka > 0){ let kanan = Math.floor(angka%10) terbalik = terbalik * 10 + kanan angka = Math.floor(angka/10) } return terbalik }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "function _____SHARED_functions_____(){}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "hacky(){\n return\n }", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "function wa(){}", "function Scdr() {\r\n}", "function Expt() {\r\n}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "function ea(){}", "function kp() {\n $log.debug(\"TODO\");\n }", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function __func(){}", "function comportement (){\n\t }", "function jessica() {\n $log.debug(\"TODO\");\n }", "static transient private protected internal function m55() {}", "function priv () {\n\t\t\t\n\t\t}", "function lalalala() {\n\n}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "static final private internal function m106() {}", "static transient final protected internal function m47() {}", "function Xuice() {\r\n}", "static private protected internal function m118() {}", "static private protected public internal function m117() {}", "function fn() {\n\t\t }", "static transient final private internal function m43() {}", "myBestMethod(){\n\n }", "function generateCode(){\n\n}", "function main(){\n\n\n}", "function Macex() {\r\n}", "transient final private protected internal function m167() {}", "static protected internal function m125() {}", "function oi(){}", "function doCoolStuff(){\n // do cool stuff\n }", "function fm(){}", "function ba(){}", "function ba(){}", "function ba(){}", "function ba(){}", "static transient private protected public internal function m54() {}", "function miFuncion (){}", "function StupidBug() {}", "obtain(){}", "function Ha(){}", "static final private protected internal function m103() {}", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "static transient final private protected internal function m40() {}", "function doOtherStuff() {}", "function run() {\n\n }", "function TMP() {\n return;\n }" ]
[ "0.6697473", "0.64510566", "0.6395561", "0.62958", "0.61033803", "0.6083399", "0.6074526", "0.60422486", "0.60295534", "0.602307", "0.599555", "0.59687126", "0.59435284", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.5893866", "0.586554", "0.58428746", "0.58428746", "0.58428746", "0.5839795", "0.58193946", "0.58178043", "0.58122283", "0.58080673", "0.58067757", "0.5801512", "0.5801512", "0.5801512", "0.5799746", "0.579734", "0.5780172", "0.5773405", "0.5751613", "0.57505685", "0.57419735", "0.574186", "0.5733708", "0.5729202", "0.57271266", "0.5723936", "0.57061845", "0.5694881", "0.56850773", "0.5683193", "0.56696475", "0.56696475", "0.56696475", "0.56696475", "0.5661268", "0.565765", "0.5630789", "0.56230426", "0.56105804", "0.56091577", "0.55901736", "0.55901736", "0.55901736", "0.55901736", "0.55901736", "0.55901736", "0.55901736", "0.5584193", "0.5579785", "0.5572771", "0.5572478" ]
0.0
-1
try to JSONParse the given variable if it is a string return: object or false on error
function safeJSONParse(variable) { try { if (typeof variable == "string") variable=JSON.parse(variable); return variable; } catch { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isJson( string, )\n{\n\ttry\n\t{\n\t\treturn JSON.parse( string, ()=> true, );\n\t}\n\tcatch( e )\n\t{\n\t\treturn false;\n\t}\n}", "IsJsonString(str) {\n try {\n return JSON.parse(str);\n } catch (e) {\n return str;\n }\n }", "function parseJson (jsonString) {\n try {\n var o = JSON.parse(jsonString);\n // Handle non-exception-throwing cases:\n // Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking\n // so we must check for that, too.\n if (o && typeof o === 'object') {\n return o;\n }\n } catch (e) {}\n\n return false;\n}", "function parseJson (jsonString) {\n try {\n var o = JSON.parse(jsonString);\n // Handle non-exception-throwing cases:\n // Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking\n // so we must check for that, too.\n if (o && typeof o === 'object') {\n return o;\n }\n } catch (e) {}\n\n return false;\n}", "function checkisJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJSON(str) {\n if (typeof str == 'string') {\n try {\n JSON.parse(str);\n return true;\n } catch(e) {\n console.log(e);\n return false;\n }\n }\n console.log('It is not a string!') \n}", "is_json(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "function isJSON(s) { try { JSON.parse(s); } catch (e) { return false; } return true; }", "function isJSON(str) { \n try { \n return (JSON.parse(str) && !!str); \n } catch (e) { \n return false; \n } \n }", "function isJson(str) {\n try {JSON.parse(str);}\n catch (e) {return false;}\n return true;\n}", "function parseJson (jsonString) {\n try {\n var o = JSON.parse(jsonString);\n if (o && typeof o === 'object') {\n return o;\n }\n } catch (e) {}\n\n return false;\n}", "function isJSON(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "function isJson(str) {\r\n try {\r\n JSON.parse(str);\r\n } catch (e) {\r\n return false;\r\n }\r\n return true;\r\n}", "static isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "function IsJsonString(str) {\n\t try {\n\t JSON.parse(str);\n\t } catch (e) {\n\t return false;\n\t }\n\t return true;\n\t}", "function isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "function isJSON(str) {\n try {\n JSON.parse(str);\n }\n catch(e) {\n return false;\n }\n return true;\n}", "function isJSONString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "function isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function isJsonString(str) {\n try {\n if (typeof JSON.parse(str) == \"object\") {\n return true;\n }\n } catch(e) {\n }\n return false;\n}", "function isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }", "function IsJsonString (varStr) {\n try {\n JSON.parse(varStr);\n } catch (e) {\n return false;\n }\n return true;\n }", "function returnParsedIfJson(str, field) {\n var rtn = \"\";\n try {\n if (str != undefined) {\n rtn = JSON.parse(str);\n }\n } catch (e) {\n alert(\"The field \" + field + \" is not a JSON string.\")\n return str;\n }\n return rtn;\n}", "function isJson(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function IsJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function IsJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function IsJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}", "function parse (data) {\n try { return JSON.parse(data) }\n catch (e) { return false }\n}", "isJson(value) {\n try {\n return typeof JSON.parse(value) === \"object\";\n } catch (e) {\n return false;\n }\n }", "function isJSON(input) {\n try {\n JSON.parse(input);\n return true;\n } catch (e) {\n return false;\n }\n\n return true;\n}", "function isValidJSON(str) {\n try { JSON.parse(str); } catch (e) { return false; }\n return true;\n}", "function isJSON(jsonString) {\n // Do we even need this test?\n if (jsonString === null)\n return false;\n\n try {\n var a = JSON.parse(jsonString);\n return true;\n } catch (e) {\n return false;\n }\n}", "function jsonParse(str) {\r\n try {\r\n return JSON.parse(str);\r\n }\r\n catch (error) {\r\n return undefined;\r\n }\r\n}", "function parseJson(text) {\n try {\n var json = JSON.parse(text);\n } catch(e) {\n return false;\n }\n return json;\n}", "parseJsonToObject(str) {\n try {\n return JSON.parse(str);\n }\n catch(e) {\n return {};\n }\n }", "function isJSON(str, server) {\n try {\n JSON.parse(str);\n } catch (e) {\n console.error(e);\n console.error('...while parsing the following data:', str);\n console.error('...from ' + SERVERS[server]['data_url'] + ' (' + server + ')');\n return false;\n }\n return true;\n}", "function maybeParse(str) {\n try {\n return JSON.parse(str);\n } catch (err) {\n return null;\n }\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n var obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n let obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function jsonParse(str) {\n let obj;\n try {\n obj = JSON.parse(str);\n } catch (e) {\n return e;\n }\n return obj;\n}", "function rule_json(value, fields, name)\n {\n if(empty_string(value)) {\n return true;\n }\n try {\n JSON.parse(value);\n } catch (e) {\n return false;\n }\n return true;\n }", "function isJSON(data) {\n try {\n JSON.parse(data);\n }catch(e) {\n return false;\n }\n return true;\n}", "function _toObjectIfJSONString(str) {\n try {\n str = JSON.parse(str);\n } catch (err) {\n // ignore error\n }\n\n return str;\n}", "function isJson(data) {\n\ttry {\n\t\tJSON.parse(data);\n\t} catch (e) {\n\t\t//alert(\"Not a Valid JSON String\");\n\t\treturn false;\n\t}\n //alert(\"Valid Json\")\n return true;\n}", "function tryToJSONParse(text) {\n let obj;\n try {\n obj = JSON.parse(text);\n } catch (e) {\n //never mind...\n obj = text;\n }\n return obj;\n}", "function isJsonObject(str) {\n try {\n var parsed = JSON.parse(str);\n if (parsed instanceof Array || parsed !== Object(parsed)) {\n throw new Error;\n }\n } catch (e) {\n return false;\n }\n return true;\n}", "function jsonToObj(str) {\n\t\tif (!$.isString(str)) { return str; }\n\t\t// Fix. Complete these checks.\n\t\tvar obj = JSON.parse(str);\n\t\treturn $.isPlainObject(obj) ? obj : str;\n\t}", "function parseJson(data)\n {\n try {\n var parsedData = JSON.parse(data);\n // if came to here, then valid\n return parsedData;\n } catch(e) {\n // failed to parse\n return false;\n }\n }", "function isJSON (obj) {\n if (typeof obj != 'string')\n obj = JSON.stringify(obj);\n\n try {\n JSON.parse(obj);\n return true;\n } catch (e) {\n return false;\n }\n}", "function parse(value) {\n return typeof value === 'string' ? JSON.parse(value) : undefined;\n}", "function validateJSON(rawdata) {\n try {\n let validJSONObj = JSON.parse(rawdata);\n if(validJSONObj && typeof validJSONObj === 'object') {\n return validJSONObj;\n }\n } catch(err) {\n console.log(err);\n return false;\n }\n}", "function tryParse(text) {\n try {\n return JSON.parse(text);\n } catch {\n return undefined;\n }\n}", "static parseJSON(jstr) {\nif (typeof lggr.trace === \"function\") {\nlggr.trace(`JSON.parse for \\\"${jstr}\\\"`);\n}\nif ((jstr != null) && jstr.length > 0) {\nreturn JSON.parse(jstr);\n} else {\nlggr.warn(`JSON.parse failed for \\\"${jstr}\\\"`);\nreturn null;\n}\n}", "function parseJSON ()\n {\n skipWhiteSpace();\n\n var c = current();\n\n if (c === 123) // '{'\n return parseObject();\n else if (c === 91) // '['\n return parseArray();\n else if (c === 34) // '\"'\n return parseString();\n else if (c === 110) // 'n'\n return parseNull();\n else if (c === 116) // 't'\n return parseTrue();\n else if (c === 102) // 'f'\n return parseFalse();\n else if ((c >= 48 && c <= 57) || c === 45) // 0-9 | '-'\n return parseNumber();\n else\n // FIXME: throw SyntaxError\n return undefined;\n }", "function valuify(string) {\n if (JSON_STRING.test(string)) {\n return JSON.parse(string);\n }\n return string;\n }", "function tryParse(data) {\n var json;\n try {\n json = JSON.parse(data);\n } catch (ex) { debug('tryParse exception %s for data %s', ex, data); }\n\n return json || data;\n}", "function parseJSON(str){\n try{\n return Right.of(JSON.parse(str))\n }\n catch(e){\n // \n return Left.of({error:e.message})\n }\n}", "isJSON(obj) {\r\n if (typeof (obj) == \"object\") {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }", "function checkJSON(json) {\n var data;\n try {\n data = JSON.parse(json)\n } catch (e) {\n // console.log(e);\n }\n // console.log(data);\n return data;\n}", "function isValidJSON(string) {\n if (/^[\\],:{}\\s]*$/.test(string.replace(/\\\\[\"\\\\\\/bfnrtu]/g, '@')\n .replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g, ']')\n .replace(/(?:^|:|,)(?:\\s*\\[)+/g, '')))\n return true;\n else\n return false;\n}", "function safeParseJson(json) {\n\n\tif (json instanceof String) {\n\t\tjson = $.parseJSON(json);\n\t}\n\n\treturn json\n\n}", "function isJson(item) {\n item = typeof item !== \"string\"\n ? JSON.stringify(item)\n : item;\n try {\n item = JSON.parse(item);\n } catch (e) {\n return false;\n }\n if (typeof item === \"object\" && item !== null) {\n return true;\n }\n return false;\n}", "function isJson(item) {\n item = typeof item !== \"string\"\n ? JSON.stringify(item)\n : item;\n\n try {\n item = JSON.parse(item);\n } catch (e) {\n return false;\n }\n\n if (typeof item === \"object\" && item !== null) {\n return true;\n }\n\n return false;\n}", "function parseJSON(string) {\n try {\n return JSON.parse(string);\n } catch (_) {\n throw new Error(`Failed to parse JSON from data starting with \"${Object(_binary_utils_get_first_characters__WEBPACK_IMPORTED_MODULE_0__[\"getFirstCharacters\"])(string)}\"`);\n }\n}", "function jsParseJSON(str) {\n try {\n var js = JSON.parse(str);\n var hs = toHS(js);\n } catch(_) {\n return __Z;\n }\n return {_:1,a:hs};\n}", "function jsParseJSON(str) {\n try {\n var js = JSON.parse(str);\n var hs = toHS(js);\n } catch(_) {\n return __Z;\n }\n return {_:1,a:hs};\n}", "function isJSON(val){\r\n\t\tvar str = val.replace(/\\\\./g, '@').replace(/\"[^\"\\\\\\n\\r]*\"/g, '');\r\n\t\treturn (/^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$/).test(str);\r\n\t}", "function isJSON(val){\r\n\t\tvar str = val.replace(/\\\\./g, '@').replace(/\"[^\"\\\\\\n\\r]*\"/g, '');\r\n\t\treturn (/^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$/).test(str);\r\n\t}", "function jsonObjectOrNull(s) {\n var obj;\n try {\n obj = JSON.parse(s);\n }\n catch (e) {\n return null;\n }\n if (__WEBPACK_IMPORTED_MODULE_0__type__[\"e\" /* isNonArrayObject */](obj)) {\n return obj;\n }\n else {\n return null;\n }\n}", "function jsonObjectOrNull(s) {\n var obj;\n try {\n obj = JSON.parse(s);\n }\n catch (e) {\n return null;\n }\n if (__WEBPACK_IMPORTED_MODULE_0__type__[\"e\" /* isNonArrayObject */](obj)) {\n return obj;\n }\n else {\n return null;\n }\n}", "function isJSON(val){\n\t\tvar str = val.replace(/\\\\./g, '@').replace(/\"[^\"\\\\\\n\\r]*\"/g, '');\n\t\treturn (/^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$/).test(str);\n\t}", "function isValidJson(json) {\n try {\n JSON.parse(json)\n return true\n } catch(e) {\n return false\n }\n}", "function jsonObjectOrNull(s) {\n var obj;\n try {\n obj = JSON.parse(s);\n }\n catch (e) {\n return null;\n }\n if (__WEBPACK_IMPORTED_MODULE_0__type__[\"f\" /* isNonArrayObject */](obj)) {\n return obj;\n }\n else {\n return null;\n }\n}", "function jsonObjectOrNull(s) {\n var obj;\n try {\n obj = JSON.parse(s);\n }\n catch (e) {\n return null;\n }\n if (__WEBPACK_IMPORTED_MODULE_0__type__[\"f\" /* isNonArrayObject */](obj)) {\n return obj;\n }\n else {\n return null;\n }\n}", "function parseJSON (jsonString) {\n try {\n return JSON.parse(jsonString)\n } catch (err) {\n return null\n }\n}", "function toType(str) {\n var type = typeof str;\n if (type !== 'string') {\n return str;\n }\n var nb = parseFloat(str);\n if (!isNaN(nb) && isFinite(str)) {\n return nb;\n }\n if (str === 'false') {\n return false;\n }\n if (str === 'true') {\n return true;\n }\n\n try {\n str = JSON.parse(str);\n } catch (e) {}\n\n return str;\n }", "function jsonDecodeForceObject(str) {\n var ret = {};\n try {\n ret = JSON.parse(str);\n } catch (e) {\n //not json\n }\n if (typeof ret !== 'object') {\n var obj = {value: ret};\n ret = obj;\n } else if (ret === null) {\n ret = {};\n }\n\n return ret;\n}", "function isValidJson(code)\n{\n try {\n JSON.parse(code);\n\t\treturn true;\n } catch (e) {\n return false;\n }\n}", "function handleJSON(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return str;\n }\n return JSON.stringify(str);\n}", "function jsonParse( valueToParse )\n{\n\tif ( typeof JSON.parse !== \"undefined\" )\n\t{\n\t\treturn JSON.parse( valueToParse );\n\t}\n\telse\n\t{\n\t\treturn JSON.decode( valueToParse );\n\t}\n}", "function coerce (str) {\n try {\n return JSON.parse(str)\n } catch (e) {\n return str\n }\n}" ]
[ "0.7793528", "0.7639939", "0.7635331", "0.7635331", "0.763151", "0.75653297", "0.756432", "0.7550463", "0.75309414", "0.75213104", "0.74761117", "0.7467963", "0.7457585", "0.7445528", "0.7421885", "0.74177", "0.7408275", "0.74075574", "0.73891443", "0.73891443", "0.73891443", "0.73831624", "0.73831624", "0.73831624", "0.7382382", "0.738084", "0.73805606", "0.73739475", "0.7362583", "0.7335495", "0.7335495", "0.7335495", "0.72155863", "0.7200682", "0.7102151", "0.71002483", "0.7093765", "0.70698124", "0.7017855", "0.70087117", "0.6959308", "0.6947287", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.69409007", "0.68545425", "0.68545425", "0.6843222", "0.684027", "0.68375885", "0.6762824", "0.6739081", "0.6732134", "0.6716887", "0.66893256", "0.66878325", "0.6614425", "0.66141075", "0.6597296", "0.65961623", "0.6588967", "0.6581761", "0.6576135", "0.6573887", "0.65272784", "0.6508511", "0.6487216", "0.6471631", "0.64616024", "0.64482826", "0.64393896", "0.6430777", "0.6430777", "0.64284337", "0.64284337", "0.6417345", "0.6417345", "0.6407166", "0.6390012", "0.63838893", "0.63838893", "0.637818", "0.63730663", "0.6371574", "0.6336351", "0.63266236", "0.6255704", "0.6251768" ]
0.7683708
1
must be called first to initialize all parameters curStep is typically set to 0
function globalInit(curStep) { var methodName = "globalInit"; adapter.log.debug("in: " + methodName + " v0.02"); // All states changes inside the adapter's namespace are subscribed adapter.subscribeStates('*'); var zoe_username = adapter.config.username; var zoe_password = adapter.config.password; var zoe_locale = adapter.config.locale; var zoe_vin = adapter.config.vin; var ignoreApiError = adapter.config.ignoreApiError; var kamereonapikey = adapter.config.kamereonApiKey; var localeParts=zoe_locale.split("_"); var country="FR"; if (localeParts.length>=2) country=localeParts[1]; adapter.log.info("Username:"+zoe_username); //adapter.log.info("Password:"+zoe_password); adapter.log.info("Locale:" +zoe_locale ); adapter.log.info("VIN:" +zoe_vin ); adapter.log.info("Country:" +country ); adapter.log.info("ignoreApiError:"+(ignoreApiError?'true':'false')); var requestClient = axios.create(); var defaultTimeout = adapter.config.timeout; var params={ url:"https://renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com/configuration/android/config_"+zoe_locale+".json", method:"get", timeout: defaultTimeout, validateStatus: function (status) { return true; } }; adapter.log.info("URL: "+params.url); requestClient(params).catch(function (error) { adapter.log.error('No valid response1 from Renault server'); adapter.log.error(safeJSONParse(error)); return processingFailed({}, 0, ZOEERROR_UNCORRECT_RESPONSE); }).then(function (response) { var statusCode = response.status; var body = response.data; var gigyarooturl = null; var gigyaapikey = null; var kamereonrooturl = null; if (statusCode != 200) { adapter.log.error('No valid response2 from Renault server, using default values'); // Working default values gigyarooturl = 'https://accounts.eu1.gigya.com'; gigyaapikey = '3_7PLksOyBRkHv126x5WhHb-5pqC1qFR8pQjxSeLB6nhAnPERTUlwnYoznHSxwX668'; kamereonrooturl = 'https://api-wired-prod-1-euw1.wrd-aws.com'; // return processingFailed({}, 0, ZOEERROR_UNCORRECT_RESPONSE); } else { adapter.log.debug('Data received from Renault server'); var data = safeJSONParse(body); if (data===false) return processingFailed({}, 0, ZOEERROR_UNPARSABLE_JSON); gigyarooturl = data.servers.gigyaProd.target; gigyaapikey = data.servers.gigyaProd.apikey; kamereonrooturl = data.servers.wiredProd.target; // var kamereonapikey = data.servers.wiredProd.apikey; } adapter.log.info("gigyarooturl:"+gigyarooturl); adapter.log.info("gigyaapikey:"+gigyaapikey); adapter.log.info("kamereonrooturl:"+kamereonrooturl); adapter.log.info("kamereonapikey:"+kamereonapikey); var globalParams = { zoe_username:zoe_username, zoe_password:zoe_password, zoe_locale:zoe_locale, zoe_vin:zoe_vin, gigyarooturl:gigyarooturl, gigyaapikey:gigyaapikey, kamereonrooturl:kamereonrooturl, kamereonapikey:kamereonapikey, country:country, ignoreApiError:ignoreApiError, useLocationApi:adapter.config.useLocationApi, useHVACApi:adapter.config.useHVACApi, stopChargeWorkaroundHour:adapter.config.stopChargeWorkaroundHour, requestClient:requestClient, defaultTimeout:defaultTimeout }; // create root config element adapter.setObjectNotExists(zoe_vin, { type : 'device', common : { name : zoe_vin, type : 'string', role : 'sensor', ack : true }, native : {} }); processNextStep(globalParams, curStep); }); adapter.log.debug("out: " + methodName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset() {\n this.steps = 0;\n }", "constructor(el, steps, stepType) {\n super();\n this.intervalTime = 100;\n this.increment = 1000;\n this.el = el;\n this.steps = steps;\n this.stepType = stepType;\n this.countDown = true;\n //this.steps.map((step, index) => {\n // step[\"time\"] = 5;\n // step[\"starttime\"] = 5 * index;\n // step[\"endtime\"] = 5 * (index + 1);\n // return step;\n //});\n this.reset();\n }", "reset() {\r\n this.initial=this.begin;\r\n this.rsteps=[];\r\n this.usteps=[];\r\n\r\n }", "function Step(realNum) {\n this.realNum = realNum;\n this.stepUnits = new Array();\n}", "calculateSteps() { \n for (var key in this.rgb_values) {\n if (this.rgb_values.hasOwnProperty(key)) {\n for (var i = 0; i < 3; i++) {\n this.rgb_values[key][i] = this.settings.gradients[this.currentIndex][key][i];\n this.rgb_steps[key][i] = this.calculateStepSize(this.settings.gradients[this.nextIndex][key][i], this.rgb_values[key][i]);\n }\n }\n } \n }", "function goToStep(step){//because steps starts with zero\nthis._currentStep=step-2;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "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 initStepCounter() {\n currentStep = 0;\n var totSteps = document.getElementById(\"totalSteps\");\n var counter = document.getElementById(\"currentStep\");\n\n counter.innerHTML = currentStep;\n totSteps.innerHTML = changes.length;\n \n\n}", "nextstep(step) {}", "constructor(props){\n super(props);\n this.state = {passed : 0};\n this.step = this.step.bind(this);\n }", "function firstTimeUserSteps(){\n dataObj.steps = 4500;\n dataObj.totalSteps = 4500;\n if (fitbitSteps) {\n dataObj.priorSteps = fitbitSteps;\n } else {\n dataObj.priorSteps = 0;\n }\n \n stepCount = dataObj.steps;\n console.log(\"Data Object\");\n console.log(dataObj);\n}", "previousstep(step) {}", "setStep(index) {\n this.step = index;\n }", "static resetStepArray() {\n steps.length = 0;\n count = 0;\n }", "constructor() {\n this.label = document.getElementById(\"sclabel\");\n this.field = document.getElementById(\"stepcount\");\n this.steps = 0;\n }", "__nextStep() {\n this.openNextStep();\n }", "_stepChanged() {\n // Cant have a step less than 0\n if(this.step < 0) {\n console.warn(\"Improper configuration: step cannot be negative. Falling back to absolute value\");\n this.set('step', Math.abs(this.step));\n return;\n }\n\n // Cant have a step of 0\n if(this.step === 0) {\n console.warn(\"Improper configuration: step cannot be negative. Falling back to 1\");\n this.set('step', 1);\n return;\n }\n }", "function initPara(){\n iterations = Number(document.querySelector('#iterations').value);\n calIteration = 0;\n timeSum = [];\n\n testInfo.innerHTML = '';\n modelLoad.innerHTML = '';\n showModel.innerHTML = '';\n modelProgress.value = 0;\n modelProgress.style.visibility = 'hidden';\n iterationProgress.style.visibility = 'hidden';\n showIterations.innerHTML = '';\n\n if(initFlag){\n loadLables();\n initFlag = false;\n };\n}", "setCurrentStep() {\n scope.currentStepIndex = this.index;\n scope.currentStep().currentPageIndex = 0;\n scope.showReviewAndSubmitPage = false;\n }", "function NzDisplayedStep() { }", "step() { }", "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 processNextStep(globalParams, curStep) {\n\tadapter.log.debug(\"in: processNextStep, curStep: \"+ curStep);\n var nextStep = curStep + 1;\n\n // only one shot if curStep = -1 (for debugging or testing)\n if (curStep==-1) return;\n \n switch(nextStep) {\n case 1: return globalInit (nextStep);\n case 2: return loginToGigya (globalParams, nextStep);\n case 3: return gigyaGetJWT (globalParams, nextStep);\n case 4: return gigyaGetAccount (globalParams, nextStep);\n case 5: return getKamereonAccount (globalParams, nextStep);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n case 6: return getKamereonCars (globalParams, nextStep);\n case 7: return getBatteryStatus (globalParams, nextStep);\n case 8: return getCockpit (globalParams, nextStep);\n case 9: return getLocation (globalParams, nextStep);\n case 10: return getHVACStatus (globalParams, nextStep);\n case 11: return initCheckPreconAndCharge (globalParams, nextStep);\n case 12: return checkPreconNow (globalParams, nextStep);\n case 13: return checkChargeCancel (globalParams, nextStep);\n case 14: return checkChargeEnable (globalParams, nextStep);\n \n case 15: return processingFinished (globalParams, nextStep);\n\n default: return processingFailed(globalParams, curStep, ZOEERROR_NONEXTSTEP);\n }\n}", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\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 }", "reset() {\n this.x=200;\n this.y=400;\n this.steps=0;\n }", "step() {\n }", "function GetStep()\n{\n\treturn m_step;\n}", "function init() {\n currentTime = 0;\n interval = setInterval(scrollStep, configs.intervalTime);\n addListeners();\n }", "step(){\n \n if(this.path.length === 0){\n this.updatePath();\n }\n \n this.move();\n \n }", "setStep (stepIn) {\n this.step = stepIn\n }", "function initProgressBar(){\n var stepSize = (frameCount / 100);\n var step = 0;\n while(step < 100){\n steps.push(step);\n step += stepSize;\n }\n }", "startup()\n\t{\n\t\tthis.angle = 1;\n\t\tthis.rows(5, 11, 1);\n\t\tthis.action(0);\n\t}", "function setupsteps() {\n\t\tsteps = [];\n\t\tfor (var i = 0; i < imgarray.length; i++) {\n\t\t\tsteps.push(new zoom_img(imgarray[i]));\n\t\t}\n\t}", "function goToStepNumber(step){this._currentStepNumber=step;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "start() {\n this.curPage = 0;\n this.mmmPagesDetected = false;\n }", "function Step() {\n\n // Set the states of trees in the next time step\n SetNextStates();\n\n // Advance the model by swapping in each tree's next state for the current\n // state\n Advance();\n\n} // end function Step()", "constructor(config) {\r\n this.initial = config.initial;\r\n this.states = config.states;\r\n this.currentState = this.initial;\r\n this.history = [this.initial];\r\n this.step = 0;\r\n }", "setSteps(steps) {\n this.steps = steps;\n }", "set _step(value) {\n Helper.UpdateInputAttribute(this, \"step\", value);\n }", "start() {\n this.count = 0;\n this.pattern = [];\n this.userPattern = [];\n this.state = \"present\";\n var randomColor = Math.floor(Math.random() * 4);\n this.addStep(this.colors[randomColor]);\n this.present();\n }", "prevStep() {\n\n if (this.currStep > -1) {\n\n this.goTo(this.currSlide, this.currStep - 1);\n\n }\n\n }", "function changeStep(percent){\n\n var newStepPercent = percent;\n var prevStep = currentStep;\n stepStyles[prevStep] = targetStyles;\n stepValues[prevStep] = [\n $(\"#presetRotate\").val(),\n $(\"#presetScale\").val(),\n $(\"#presetTransX\").val(),\n $(\"#presetTransY\").val(),\n $(\"#presetSkewX\").val(),\n $(\"#presetSkewY\").val(),\n $(\"#presetTransOrigin\").val(),\n $(\"#presetBG\").val(),\n $(\"#presetOpacity\").val(),\n $(\"#presetColor\").val(),\n $(\"#presetFontSize\").val(),\n $(\"#presetFontWeight\").val(),\n $(\"#presetWidth\").val(),\n $(\"#presetHeight\").val(),\n $(\"#presetMargin\").val(),\n $(\"#presetPadding\").val(),\n $(\"#presetBorder\").val(),\n $(\"#presetShadow\").val(),\n $(\"#presetOutline\").val()\n ];\n\n\n if(!stepStyles[newStepPercent]){\n stepStyles[newStepPercent] = targetStyles;\n stepValues[prevStep] = [\n $(\"#presetRotate\").val(),\n $(\"#presetScale\").val(),\n $(\"#presetTransX\").val(),\n $(\"#presetTransY\").val(),\n $(\"#presetSkewX\").val(),\n $(\"#presetSkewY\").val(),\n $(\"#presetTransOrigin\").val(),\n $(\"#presetBG\").val(),\n $(\"#presetOpacity\").val(),\n $(\"#presetColor\").val(),\n $(\"#presetFontSize\").val(),\n $(\"#presetFontWeight\").val(),\n $(\"#presetWidth\").val(),\n $(\"#presetHeight\").val(),\n $(\"#presetMargin\").val(),\n $(\"#presetPadding\").val(),\n $(\"#presetBorder\").val(),\n $(\"#presetShadow\").val(),\n $(\"#presetOutline\").val()\n ];\n }else{\n // Set target element styles form existing step\n targetStyles = stepStyles[newStepPercent];\n\n // Set input vals\n $(\"#presetRotate\").val(stepValues[newStepPercent][0] || \"xx\"),\n $(\"#presetScale\").val(stepValues[newStepPercent][1]),\n $(\"#presetTransX\").val(stepValues[newStepPercent][2]),\n $(\"#presetTransY\").val(stepValues[newStepPercent][3]),\n $(\"#presetSkewX\").val(stepValues[newStepPercent][4]),\n $(\"#presetSkewY\").val(stepValues[newStepPercent][5]),\n $(\"#presetTransOrigin\").val(stepValues[newStepPercent][6]),\n $(\"#presetBG\").val(stepValues[newStepPercent][7]),\n $(\"#presetOpacity\").val(stepValues[newStepPercent][8]),\n $(\"#presetColor\").val(stepValues[newStepPercent][9]),\n $(\"#presetFontSize\").val(stepValues[newStepPercent][10]),\n $(\"#presetFontWeight\").val(stepValues[newStepPercent][11]),\n $(\"#presetWidth\").val(stepValues[newStepPercent][12]),\n $(\"#presetHeight\").val(stepValues[newStepPercent][13]),\n $(\"#presetMargin\").val(stepValues[newStepPercent][14]),\n $(\"#presetPadding\").val(stepValues[newStepPercent][15]),\n $(\"#presetBorder\").val(stepValues[newStepPercent][16]),\n $(\"#presetShadow\").val(stepValues[newStepPercent][17]),\n $(\"#presetOutline\").val(stepValues[newStepPercent][18])\n\n updateTargetStyles();\n }\n\n // Clear timeline before adding again\n $(\"#kfTimelineBody\").empty();\n $(\"#kfTimelineBody\").append(\"<div id='timelineTracker'></div>\");\n $(\"#kfTimelineBody\").append(\"<div id='timelineMarker'><b></b></div>\");\n\n $.each(stepStyles, function (key, val) {\n $(\"#kfTimelineBody\").append(\"<div class='timeline-step' id='timelineStep\" + key + \"' data-step='\" + key + \"' style='left: \" + key + \"%;'><label>\" + key + \"</label></div>\");\n });\n\n currentStep = newStepPercent;\n // Set active class for current timeline step;\n $(\".timeline-step\").removeClass(\"active\");\n $(\"#timelineStep\" + newStepPercent).addClass(\"active\");\n\n updatePageData();\n }", "constructor(props) {\n super(props);\n this.state = {\n history: [{squares: Array(9).fill(null)}],\n stepNumber: 0,\n xIsNext: true\n };\n }", "completeStep() {\n for (let step of this.requiredInSteps) {\n step.stepsLeft--;\n if (step.stepsLeft === 0) {\n availableSteps.push(step);\n }\n }\n }", "function StepCounter() {\n\tthis.STATE = 'DOWN';\n\tthis.steps = 0;\n\tthis.UPPER = [];\n}", "start(){\n if(this.points.length<3){\n this.drawFinishIfLessThan3Points();\n return;\n }\n let intervallID = setInterval(() => {\n this.drawCurrentState();\n this.calculateNextStep(intervallID); \n }, 100); \n }", "constructor(callback)\n {\n this.classNames = {\"arts\": [\"Geography\", \"English\", \"Social Studies\", \"French\", \"Drawing\"],\n \"sciences\": [\"Math\", \"Science\", \"API Trig\", \"Chemistry\", \"Physics\"]};\n \n this.testData = [{type: \"arts\", userId: 3}, \n {type: \"sciences\", userId: 2}, \n {type: \"sciences\", userId: 1}]\n\n this.stepCounter = 0;\n this.mainObject = []; \n this.stepCallBack = callback;\n \n }", "tick() {\n let nextStep = this.check(1);\n if (nextStep === null) {\n nextStep = this.check(-1);\n if (nextStep === null) {\n return;\n }\n }\n\n this._currentStep = nextStep;\n }", "constructor(props){\n super(props);\n this.state = {\n history: [{\n squares: Array(9).fill(null),\n }],\n stepNumber: 0,\n xIsNext: true,\n };\n }", "function previousSteps() {\n\tcurrent_step = current_step - 1;\n\tnext_step = next_step - 1;\n}", "_fetchCurrentStepConfig() {\n const oThis = this;\n\n oThis.currentStepConfig = btStakeAndMintStepsConfig[oThis.stepKind];\n }", "function nextStep() {\n var next = [];\n init(next);\n for (var row = 0; row < height; row++) {\n for (var col = 0; col < width; col++) {\n next[row][col] = nextState(row, col);\n }\n }\n field = next;\n }", "function init() {\n startIndex = 0;\n vm.data = [];\n }", "constructor(props)\n {\n super(props)\n this.state =\n {\n currentStep: 1,\n dataList :'',\n errorStatus:'',\n show:false,\n }\n this.previousButton = this.previousButton.bind(this);\n this.nextButton = this.nextButton.bind(this);\n }", "function goToNextStep() {\n\tnextSteps();\n\tupdateStepsText();\n\tconsole.log(\"hi\");\n}", "move(steps) {\n this.stepchange = steps;\n }", "function step()\n {\n //Saving the current states and the previous state to use them in recoloring\n //their view on the graph in the nest step.\n $old_current_state = $current_state;\n $old_previous_state = $previous_state;\n $old_tape_index = $current_tape_index;\n $old_tape_head_value = at_index($current_tape_index);\n \n //If any object is undefined return error because it means that the there is no transition\n //for the current input char.\n $previous_state = $current_state;\n if($graph_table[$current_state] === undefined || $graph_table[$current_state] === null) { $error = true; return -1; }\n $trans = $graph_table[$current_state][at_index($current_tape_index)];\n if($graph_table[$current_state][at_index($current_tape_index)] === undefined || $graph_table[$current_state][at_index($current_tape_index)] === null) { $error = true; return -1; }\n at_index($current_tape_index, $trans.output);\n \n //Moving the tape head depending on the direction of the actual transition retrieved from the graph table.\n if($trans.direction == 'R') $current_tape_index++;\n if($trans.direction == 'L') $current_tape_index--;\n if($trans.direction == 'S') /* do nothing */;\n \n //Updating the current state.\n $current_state = $trans.target;\n \n //If the state is an end state, return seccess, or accept.\n if($end_states[$current_state]) return 2;\n \n return 1; //ok { Meaning that it is a normal step no errors and no accept. }\n \n }", "constructor() {\n this._start = 0;\n this._current = 0;\n this._last = 0;\n }", "navigateToNextStep() {\n if (this.state.currentStepIndex >= this.steps.length - 1) {\n return;\n }\n this.setState(prevState => ({\n currentStepIndex: prevState.currentStepIndex + 1,\n }));\n }", "constructor(props) {\n super(props);\n this.state = {\n history: [\n {\n squares: Array(9).fill(null),\n },\n ],\n stepNumber: 0,\n xIsNext: true,\n };\n }", "function goToNextStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId+=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "nextStep() {\n const {step} = this.state;\n this.setState ({\n step: step + 1\n });\n }", "update() {\n this.steps += 1;\n }", "constructor(prev, cur) {\n this.prev = prev;\n this.cur = cur;\n this.clear();\n //reasons as soon as we want our calculator i.e reload everything should be cleared and set to their default values\n }", "_next(value) {\n //console.log(\"hii\", value);\n let currentStep = this.state.currentStep;\n //let indexStep= this.state.index;\n // If the current step is 1 or 2, then add one on \"next\" button click\n currentStep = currentStep >= 2 ? 3 : currentStep + 1;\n this.setState({\n currentStep: currentStep\n });\n }", "function _goToStepNumber(step) {\n this._currentStepNumber = step;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "step() {\n let i;\n for (i = 0; i < this.cols * this.rows; ++i) {\n this.buff[i] = this.nextState(i);\n }\n let temp = this.buff;\n this.buff = this.cells;\n this.cells = temp;\n }", "constructor(props) {\n super(props);\n this.state = {\n history: [{\n squares: Array(9).fill(null),\n i: -1,\n }],\n stepNumber: 0,\n xIsNext: true,\n }\n }", "prev() {\n\n if (this.currStep > -1) {\n\n this.prevStep();\n\n } else {\n\n this.prevSlide();\n\n }\n\n }", "begin() {\n //for (let [, arr] of this.arrangements.filter(a => a.at === this.iterations && a.when === \"start\")) arr.exe();\n this.engine.phases.current = this;\n this.engine.events.emit(this.name, this);\n }", "runOneStepForwards() {\n this.stateHistory.nextState();\n }", "function calc_steps() {\n\t\t for (var key in rgb_values) {\n\t\t if (rgb_values.hasOwnProperty(key)) {\n\t\t for(var i = 0; i < 4; i++) {\n\t\t rgb_values[key][i] = gradients[currentIndex][key][i];\n\t\t rgb_steps[key][i] = calc_step_size(gradients[nextIndex][key][i],rgb_values[key][i]);\n\t\t }\n\t\t }\n\t\t }\n\t\t}", "previousStep(stepNumber){\n if(this.stepCounter == 1){\n\n }else{\n this.stepCounter--;\n this.stepValue ='step'+this.stepCounter;\n console.log('previousStep ->',this.stepValue);\n console.log('nextStep ->',this.stepValue);\n switch (this.stepCounter) {\n case 1:\n this.template.querySelector('.step1').classList.remove('slds-hide');\n this.template.querySelector('.step2').classList.add('slds-hide');\n this.template.querySelector('.step3').classList.add('slds-hide');\n break;\n case 2:\n this.template.querySelector('.step1').classList.add('slds-hide');\n this.template.querySelector('.step2').classList.remove('slds-hide');\n this.template.querySelector('.step3').classList.add('slds-hide');\n break;\n case 3:\n this.template.querySelector('.step1').classList.add('slds-hide');\n this.template.querySelector('.step2').classList.add('slds-hide');\n this.template.querySelector('.step3').classList.remove('slds-hide');\n break;\n default:\n break;\n }\n }\n }", "next() {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);\n }", "constructor() {\n this.gridNumber = settings.canvasSize / settings.step;\n this.reset();\n }", "beginProcess() {\n this.index.start = this.history.length;\n }", "setStep(step) {\n this.state.step = step;\n }", "reset() {\n this._updateSelectedItemIndex(0);\n this.steps.forEach(step => step.reset());\n this._stateChanged();\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 }", "reset() {\n this._setIsResetting(true);\n this._setFinish(false);\n this.activeStep = undefined;\n this.nextStep = undefined;\n for (let i = 0; i < this._steps.length; i++) {\n const step = this.getStepById(i);\n step.reset(this.openFirstStepOnStartup);\n }\n this._setIsResetting(false);\n }", "constructor() {\n this.stepCount = 0;\n this.objects = {};\n this.playerCount = 0;\n this.idCount = 0;\n this.groups = new Map();\n }", "async run() {\n this.currentStep = 0;\n while (this.currentStep < this.length) {\n await this.runNextStep();\n }\n }", "function start() {\r\n\tgenerateLastStep();\r\n\ttimeout = setTimeout(showSteps, 2000);\r\n}", "getSteps() {\n return this.steps;\n }", "__previnit(){}", "function doStep()\n\t\t\t\t{\n\t\t\t\t\tstep(returnable());\n\t\t\t\t\tdata = [];\n\t\t\t\t\terrors = [];\n\t\t\t\t}", "function changeNoStep() {\n noStep = parseInt(document.getElementById(\"noStep\").value);\n stepSize = 1. / noStep;\n\n runGrid();\n surface[\"vPos\"] = surfaceVertexPos;\n surface[\"tPos\"] = surfaceTextPos;\n surface[\"index\"] = currentShader === \"wireframe\" ? surfaceWireframeIndex : surfaceIndex;\n surface[\"normal\"] = surfaceNormal;\n initializeObject(surface);\n requestAnimationFrame(render);\n}", "instantCompute(){\n if(this.points.length<3){\n this.drawFinishIfLessThan3Points();\n return;\n }\n this.sucess=false\n while(!this.sucess){\n this.calculateNextStep();\n }\n this.drawFinish();\n }", "function doStep() {\n step(returnable());\n data = [];\n errors = [];\n }", "updateWizardSteps(wizardSteps) {\n // the wizard is currently not in the initialization phase\n if (this.wizardSteps.length > 0 && this.currentStepIndex > -1) {\n this.currentStepIndex = wizardSteps.indexOf(this.wizardSteps[this.currentStepIndex]);\n }\n this._wizardSteps = wizardSteps;\n }", "__init3() {this._numProcessing = 0;}", "__init3() {this._numProcessing = 0;}", "__init3() {this._numProcessing = 0;}", "initialPage() {\n this.ltClicked({'page': 1});\n this.currentPage = 1;\n this.leftPage = 1;\n this.atFirstPage = true;\n this.setPageGroups(this.currentPage);\n }", "jumpTo(step) {\r\n\r\n this.setState({\r\n\r\n stepNumber: step,\r\n\r\n xIsNext: (step % 2) === 0,\r\n\r\n });// end setState()\r\n\r\n }", "function init() {\r\n nextQuestion();\r\n }" ]
[ "0.6810469", "0.6426847", "0.6373974", "0.63318944", "0.6224623", "0.61836684", "0.61595196", "0.6155686", "0.6134686", "0.6134271", "0.6114381", "0.6094011", "0.609038", "0.6082072", "0.6075736", "0.60755587", "0.60662836", "0.60606503", "0.60580635", "0.60491234", "0.6042299", "0.6031834", "0.6029213", "0.6008841", "0.5984027", "0.5984027", "0.5984027", "0.5984027", "0.5984027", "0.5976207", "0.5963056", "0.59584045", "0.59507334", "0.5946899", "0.59354323", "0.5927086", "0.5893283", "0.5882951", "0.5870169", "0.58614", "0.5860645", "0.5855685", "0.5853315", "0.5848251", "0.58474886", "0.5793242", "0.5791822", "0.5788996", "0.57607186", "0.57588714", "0.5758738", "0.5753046", "0.57337916", "0.5712472", "0.5695048", "0.5693015", "0.5690443", "0.5689884", "0.56855655", "0.5680162", "0.5670262", "0.56640106", "0.56600934", "0.56580293", "0.5642379", "0.5640039", "0.5636038", "0.56271255", "0.5626114", "0.561437", "0.56093353", "0.56075865", "0.56075317", "0.5605313", "0.5602072", "0.55968904", "0.55898917", "0.55787766", "0.5571132", "0.5559017", "0.55517995", "0.5551287", "0.5534828", "0.55309", "0.55255353", "0.5522073", "0.55206984", "0.5517337", "0.55142045", "0.55083", "0.5506332", "0.550405", "0.5496428", "0.5493295", "0.54753536", "0.5475077", "0.5475077", "0.5475077", "0.5462556", "0.5461055", "0.54598355" ]
0.0
-1
called on success, start next step
function processNextStep(globalParams, curStep) { adapter.log.debug("in: processNextStep, curStep: "+ curStep); var nextStep = curStep + 1; // only one shot if curStep = -1 (for debugging or testing) if (curStep==-1) return; switch(nextStep) { case 1: return globalInit (nextStep); case 2: return loginToGigya (globalParams, nextStep); case 3: return gigyaGetJWT (globalParams, nextStep); case 4: return gigyaGetAccount (globalParams, nextStep); case 5: return getKamereonAccount (globalParams, nextStep); case 6: return getKamereonCars (globalParams, nextStep); case 7: return getBatteryStatus (globalParams, nextStep); case 8: return getCockpit (globalParams, nextStep); case 9: return getLocation (globalParams, nextStep); case 10: return getHVACStatus (globalParams, nextStep); case 11: return initCheckPreconAndCharge (globalParams, nextStep); case 12: return checkPreconNow (globalParams, nextStep); case 13: return checkChargeCancel (globalParams, nextStep); case 14: return checkChargeEnable (globalParams, nextStep); case 15: return processingFinished (globalParams, nextStep); default: return processingFailed(globalParams, curStep, ZOEERROR_NONEXTSTEP); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__nextStep() {\n this.openNextStep();\n }", "function step() {\n\n // if there's more to do\n if (!result.done) {\n result = task.next();\n step();\n }\n }", "function step() {\n paused = true;\n executeNext(true);\n }", "nextstep(step) {}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [], errors = [];\n\t\t\t}", "function next() {\n\t\n\tif (currentTransformStep === transformSteps.length) {\n\t\tconsole.log('all transformations performed')\n\t}\n\telse\n\t\ttransformSteps[currentTransformStep++]()\n\t\t\n}", "function doStep()\n\t\t\t\t{\n\t\t\t\t\tstep(returnable());\n\t\t\t\t\tdata = [];\n\t\t\t\t\terrors = [];\n\t\t\t\t}", "function step() {\n\n // if there's more to do\n if (!result.done) {\n if (typeof result.value === \"function\") {\n result.value(function(err, data) {\n if (err) {\n result = task.throw(err);\n return;\n }\n\n result = task.next(data);\n step();\n });\n } else {\n result = task.next(result.value);\n step();\n }\n\n }\n }", "function doStep() {\n step(returnable());\n data = [];\n errors = [];\n }", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function next() {\n\t\tvar nextStep = steps.next();\n\t\tsetSteps(steps);\n\t\tsetCurrent(nextStep);\n\t}", "start() {\n this.executeNextTask();\n }", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "function goToNextStep() {\n\tnextSteps();\n\tupdateStepsText();\n\tconsole.log(\"hi\");\n}", "step() { }", "runOneStepForwards() {\n this.stateHistory.nextState();\n }", "function doStep() {\n step(returnable(undefined, true));\n data = [];\n errors = [];\n }", "function endWithSuccess() {\n step1Callback({\n message: {\n text: 'thumbor is deployed and available as ' + data[CONTAINER_NAME] +\n '. Go to YOUR_APP_URL/unsafe/200x50/i.imgur.com/bvjzPct.jpg to test thumbor!',\n type: SUCCESS\n },\n next: null // this can be similar to step1next, in that case the flow continues...\n });\n }", "step() {\n }", "function start(state) { \n service.goNext(state);\n }", "function nextStep() {\n $scope.$evalAsync(() =>{\n $scope.$emit('menu_update_needed');\n $route.reload();\n });\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 start() {\r\n\tgenerateLastStep();\r\n\ttimeout = setTimeout(showSteps, 2000);\r\n}", "startJourney() {\n this.running = true;\n this.previousTime = false;\n this.ui.notify('The journey through the wasteland begins', 'positive');\n this.step();\n }", "async run() {\n this.currentStep = 0;\n while (this.currentStep < this.length) {\n await this.runNextStep();\n }\n }", "function next() {\n\t\t\t\tif (committableReports.length) {\n\t\t\t\t\tsetTimeout(process, 1000);\n\t\t\t\t}\n\t\t\t}", "function endWithSuccess() {\n\n step1Callback({\n message: {\n text: 'Adminer is deployed and available as http://srv-captain--' + data[CONTAINER_NAME]\n + ' to other apps.',\n type: SUCCESS\n },\n next: null // this can be similar to step1next, in that case the flow continues...\n });\n }", "function beginProcess() {\n checkArrays((checkArraysErr) => {\n if (checkArraysErr) {\n course.error(checkArraysErr);\n callback(null, course, item);\n return;\n }\n\n checkPages();\n callback(null, course, item);\n });\n }", "function startUpload() {\n totalUploaded = filesUploaded = 0;\n uploadNext();\n }", "started () {}", "function next() {\n phases.execute(self.field).then(function() {\n Sockets.send.player(self);\n });\n }", "function runNext(previousResult) {\n hello(true);\n clearTimeout(shutdownTimeout);\n var sendResults = false;\n if (typeof previousResult === 'undefined') {\n if (firstLaunch === true) {\n firstLaunch = false;\n consoleLog('[INFO] tests started at ' + new Date());\n } else if (waiting === true) {\n consoleLog('[INFO] tests resumed at ' + new Date());\n }\n } else {\n stopMonitoring();\n try {\n fs.unlinkSync(path.join(config.reportsBasePath, 'current.json'));\n } catch (e) {\n // Doesn't matter\n }\n runLog.push({\n name: previousResult.testName,\n start: previousResult.start,\n end: previousResult.end,\n duration: previousResult.duration,\n status: previousResult.status,\n dir: previousResult.resultDir\n });\n if (typeof config.dashboard !== \"undefined\" && typeof config.dashboard.address !== \"undefined\" && typeof config.dashboard.connect !== \"undefined\" && typeof config.dashboard.id !== \"undefined\" && config.dashboard.connect === true) {\n try {\n var report = JSON.parse(fs.readFileSync(path.join(previousResult.resultDir, 'report.json')).toString());\n } catch (e) {\n var report = {\n name: previousResult.testName,\n changelist: config.CHANGELIST,\n start: previousResult.start,\n duration: previousResult.duration,\n abstract: {\n passed: 0,\n total: 0,\n failures: 0,\n skipped: 0\n },\n status: previousResult.status\n };\n }\n sendResults = true;\n }\n state.done.push(previousResult.testName);\n doNotOverwriteState = false;\n try {\n fs.writeFileSync(path.join(config.reportsBasePath, 'state.json'), JSON.stringify(state));\n\n } catch (e) {\n consoleLog('[WARN] cannot write current state (1)', e);\n }\n try {\n fs.writeFileSync(path.join(previousResult.resultDir, 'runlog.json'), JSON.stringify(previousResult));\n } catch (e) {\n consoleLog('[WARN] cannot write job runlog (1)', e);\n }\n if (typeof previousResult.pom !== 'undefined' && previousResult.pom) {\n try {\n fs.writeFileSync(path.join(previousResult.resultDir, 'pom.json'), JSON.stringify(previousResult.pom));\n } catch (e) {\n consoleLog('[WARN] cannot write job pom (1)', e);\n }\n }\n try {\n fs.unlinkSync(path.join(previousResult.resultDir, '.manual'));\n } catch (e) {\n // Doesn't matter\n }\n try {\n fs.writeFileSync(path.join(previousResult.resultDir, '.auto'), 'true');\n } catch (e) {\n consoleLog('[WARN] cannot write job .auto flag (1)', e);\n }\n var status = 'UNKNOWN'.grey;\n if (previousResult.status === null) {\n status = 'FAILURE'.red;\n } else if (previousResult.status === false) {\n status = 'UNSTABLE'.yellow;\n } else if (previousResult.status === true) {\n status = 'SUCCESS'.green;\n }\n consoleLog('[INFO] ' + previousResult.testName.white.bold + ' --> '.grey + status.bold);\n var cleanup = temp.cleanup();\n if (typeof previousResult.tmpDir !== 'undefined') {\n try {\n rmdir(previousResult.tmpDir);\n } catch (e) {\n // Doesn't matter\n }\n }\n state.currentJob++;\n }\n if (shutDown === false) {\n waiting = false;\n killMainProcesses();\n exterminate(function() {\n if (shutDown === false) {\n if (typeof previousResult !== 'undefined') {\n getCrashlocationContentAfter();\n }\n getProcessListDiffAfter(function(diff) {\n if (typeof previousResult !== 'undefined' && diff !== null && (diff.less.length > 0 || diff.more.length > 0)) {\n var diffLog = '';\n if (diff.less.length > 0) {\n diffLog += '-- Lost Processes (killed during the test):\\n';\n diff.less.forEach(function(proc) {\n diffLog += '\\t' + proc.pid + '\\t' + proc.cmd + '\\n';\n });\n diffLog += ' \\n\\n';\n }\n if (diff.more.length > 0) {\n diffLog += '++ Additional Processes (spawned during the test):\\n';\n diff.more.forEach(function(proc) {\n diffLog += '\\t' + proc.pid + '\\t' + proc.cmd + '\\n';\n });\n diffLog += ' \\n\\n';\n }\n try {\n fs.writeFileSync(path.join(previousResult.resultDir, 'procdiff.txt'), diffLog);\n } catch (e) {\n consoleLog('[WARN] cannot archive process diff (1)', e);\n }\n }\n if (typeof previousResult !== 'undefined' && crashes.length > 0) {\n consoleLog('[WARN] test ' + previousResult.testName + ' produced ' + crashes.length + ' crash(es)');\n for (var i = 0; i < crashes.length; i++) {\n if (/server/i.test(crashes[i])) {\n var crashName = 'server_crash_' + (i + 1) + path.extname(crashes[i]);\n } else if (/studio/i.test(crashes[i])) {\n var crashName = 'studio_crash_' + (i + 1) + path.extname(crashes[i]);\n } else if (/4d/i.test(crashes[i])) {\n var crashName = '4d_crash_' + (i + 1) + path.extname(crashes[i]);\n } else {\n var crashName = 'other_crash_' + (i + 1) + path.extname(crashes[i]);\n }\n try {\n copyFileSync(crashes[i], path.join(previousResult.resultDir, crashName));\n } catch (e) {\n consoleLog('[WARN] cannot archive crash log', e);\n }\n }\n }\n if (typeof previousResult !== 'undefined' && sendResults === true) {\n if (typeof config.dashboard !== \"undefined\" && typeof config.dashboard.connect !== \"undefined\" && typeof config.dashboard.id !== \"undefined\" && config.dashboard.connect === true) {\n try {\n var results = JSON.parse(fs.readFileSync(path.join(previousResult.resultDir, 'report.json')).toString());\n } catch (e) {\n var results = {\n name: previousResult.testName,\n start: previousResult.start,\n end: previousResult.end,\n duration: previousResult.duration,\n abstract: {\n passed: 0,\n total: 0,\n failures: 0,\n skipped: 0\n },\n status: previousResult.status\n };\n }\n var msg = {\n id: config.dashboard.id,\n changelist: config.CHANGELIST,\n productBranch: config.WAKANDA_BRANCH,\n results: {\n name: results.name,\n start: results.start,\n end: results.end,\n duration: results.duration,\n abstract: {\n passed: results.abstract.passed,\n total: results.abstract.total,\n failures: results.abstract.failures,\n skipped: results.abstract.skipped\n },\n status: results.status,\n crashes: crashes.length\n }\n };\n var pom = getPomForTest(results.name);\n if (isMac()) {\n msg.os = 'mac';\n } else if (isLinux()) {\n msg.os = 'linux';\n } else if (isWindows()) {\n msg.os = 'windows';\n }\n if (pom && typeof pom.tester !== 'undefined' && pom.tester && pom.tester != '') {\n msg.results.tester = pom.tester;\n }\n if (pom && typeof pom.developer !== 'undefined' && pom.developer && pom.developer != '') {\n msg.results.developer = pom.developer;\n }\n if (pom && typeof pom.uuid !== 'undefined') {\n msg.results.uuid = pom.uuid;\n }\n if (pom && typeof pom.bench !== 'undefined' && (pom.bench === true || pom.bench === 'true')) {\n msg.results.isbench = true;\n var CSVFilePath = path.join(previousResult.resultDir, 'result.csv');\n try {\n var CSVStat = fs.statSync(CSVFilePath);\n } catch (e) {\n var CSVStat = false;\n }\n if (CSVStat && CSVStat.isFile()) {\n msg.results.benchdata = fs.readFileSync(CSVFilePath).toString();\n } else {\n msg.results.benchdata = null;\n }\n }\n if (typeof config.subversion === 'string') {\n msg.subVersion = config.subversion.toLowerCase();\n } else {\n msg.subVersion = '';\n }\n try {\n socket.emit('results', JSON.stringify(msg));\n consoleLog('[INFO] just sent \"results\" to the Hub (1)...');\n } catch (e) {\n consoleLog('[ERROR] could not send \"results\" to the Hub (1): ' + e);\n }\n }\n }\n if (state.currentJob > -1 && state.queue.length > 0 && state.currentJob < state.queue.length) {\n clearTimeout(shutdownTimeout);\n consoleLog('[INFO] next (' + (state.currentJob + 1) + '/' + state.queue.length + ')');\n setTimeout(function() {\n runTest(state.queue[state.currentJob], runNext, true);\n }, 125);\n } else if (downloadingNewWakandaBuildDone === false && downloadingNewWakandaInstallerDone === true) {\n clearTimeout(shutdownTimeout);\n consoleLog('[INFO] tests related to the new Wakanda Installers completed at ' + new Date() + ', now waiting 6 hours max. for the new Wakanda Builds (>' + previousChangelist + ')...');\n waiting = true;\n shutdownTimeout = setTimeout(function() {\n shutdown(true);\n }, 6 * 60 * 60 * 1000); // 6h\n } else if (downloadingNewWakandaInstallerDone === false && downloadingNewWakandaBuildDone === true) {\n clearTimeout(shutdownTimeout);\n consoleLog('[WARN] tests related to the new Wakanda Builds completed at ' + new Date() + ', but the new Wakanda Installers are not available (>' + previousChangelist + '): waiting 3 hours max. then shutting down!');\n waiting = true;\n shutdownTimeout = setTimeout(function() {\n shutdown(true);\n }, 4 * 60 * 60 * 1000); // 4h\n } else if (isLinux() === false && downloadingNew4DBuildDone === false && downloadingNewWakandaBuildDone === true) {\n clearTimeout(shutdownTimeout);\n consoleLog('[WARN] tests related to the new Wakanda Builds completed at ' + new Date() + ', but the new 4D Server is not available: will use an old one!');\n if (isMac()) {\n var wakApps = findFiles(config.BUILD_TEST_DIR, /^4d.*server$/i);\n wakApps.forEach(function(wakApp) {\n current4DServerPath = wakApp;\n });\n } else if (isWindows()) {\n var wakApps = findFiles(config.BUILD_TEST_DIR, /^4d.*\\.exe$/i);\n wakApps.forEach(function(wakApp) {\n current4DServerPath = wakApp;\n });\n }\n consoleLog('[INFO] old 4D build (' + current4DServerPath + ') will be used');\n downloadingNew4DBuild = true;\n downloadingNew4DBuildDone = true;\n downloadingNew4DBuildExpect = 0;\n state.queue = state.queue.concat(getAvailableJobs(function(item) {\n if (/(4d(?!p))/i.test(item)) {\n return true;\n } else {\n return false;\n }\n }));\n shutdownTimeout = setTimeout(function() {\n runNext();\n }, 125);\n } else {\n consoleLog('[INFO] finishing tests, please wait...');\n clearTimeout(shutdownTimeout);\n if (runFromWeb === true || (process.argv.length > 2 && (process.argv[2] === 'run' || process.argv[2] === 'resume'))) {\n shutdown(true);\n } else {\n waiting = true;\n shutdownTimeout = setTimeout(function() {\n shutdown(true);\n }, 125);\n }\n }\n });\n }\n });\n }\n}", "step(action){\r\n\r\n }", "function introNextStep() {\n\tsetTimeout(function() {\n\t\tintro.nextStep();\n\t},800);\n}", "__finishStep() {\n if (this.activeStep._nestedValidate() && this.activeStep.validate()) {\n this.openNextStep();\n this._setFinish(true);\n this.dispatchEvent(new CustomEvent('stepper-finished', {\n bubbles: true,\n composed: true,\n }));\n // console.log(\"caribou-stepper finished.\");\n } else {\n this.activeStep.fireInvalidStep();\n }\n }", "function _nextStep() {\n\t\t\tvar $step = wizard.settings.steps[currentStep];\n\n\t\t\t_clearFutureSteps($step);\n\n\t\t\tif($step.isDependent) {\n\t\t\t\t$step = _getDependentStep($step);\n\t\t\t}\n\n\t\t\t// Updating the data regarding current step.\n\t\t\tif(!_recordStepData($step)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Checking if this is the last scene of the wizard.\n\t\t\tif(++currentStep >= wizard.settings.steps.length) {\n\t\t\t\tcurrentStep--;\n\t\t\t\t_finalStep(wizard);\n\t\t\t} else {\n\t\t\t\t// There is no problem, passing to the next step.\n\t\t\t\tif(currentStep > passedStepTracker)\n\t\t\t\t\tpassedStepTracker++;\n\t\t\t\t_syncStep(wizard);\n\t\t\t\twizard.settings.onNextStep();\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "finish(){\n model.stat.timer.stop();\n alert(model.algorithm.getCurrStep().description+' '+model.algorithm.getCurrStep().help);\n\t\tdocument.getElementById('nextBtn').disabled=true;\n\t\tdocument.getElementById('autoRunBtn').disabled=true;\n }", "function nextStep() {\n\t\t\t\t\t\t$('#give-stuff-progress').addClass('step'+(++$scope.currentStep)+'-done');\n\t\t\t\t\t\t$('#give-step' + ($scope.currentStep - 1)).addClass('completed').removeClass('active');\n\t\t\t\t\t\t$('#give-step' + $scope.currentStep).addClass('active');\n\t\t\t\t\t\tif($('#give-step4').hasClass('active')){\n\t\t\t\t\t\t\tconsole.log('$scope.giveItem.outside :'+ $scope.giveItem.outside);\n\t\t\t\t\t\t\t$scope.giveItem.outside? $('#give-step4 .dibs-attended-message').hide(): $('#give-step4 .dibs-attended-message').show()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$scope['initStep' + $scope.currentStep]();\n\t\t\t\t\t}", "function advanceNextStep(){\n\t\t\t\t\n\t\tvar timeNow = jQuery.now();\n\t\tvar timeDiff = timeNow - g_temp.playTimeLastStep;\n\t\tg_temp.playTimePassed += timeDiff;\n\t\tg_temp.playTimeLastStep = timeNow;\n\t\t\n\t\t//set the progress\n\t\tif(g_temp.objProgress){\n\t\t\tvar percent = g_temp.playTimePassed / g_options.gallery_play_interval;\n\t\t\tg_temp.objProgress.setProgress(percent);\n\t\t}\n\t\t\n\t\t//if interval passed - proceed to next item\n\t\tif(g_temp.playTimePassed >= g_options.gallery_play_interval){\n\t\t\t\n\t\t\tt.nextItem();\n\t\t\tg_temp.playTimePassed = 0;\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}", "function onNext() {\n\n\t\tif (step < 3) {\n\t\t\tdispatch(INCREMENT_STEP());\n\t\t}\n\n\t\t// update button state\n\t\tsetBackButtonDisabled(false);\n\t}", "function next()\n {\n var params = queue[0];\n\n // Replace or add the handler\n if(params.hasOwnProperty(\"success\")) callback = params.success;\n else callback = null;\n\n params.success = success;\n\n // Manage request timeout\n timeoutId = setTimeout(timeoutHandler, TIMEOUT);\n\n // Now we can perform the request\n $.ajax(params);\n }", "function executeStep() {\r\n processStep();\r\n prepareScreen5();\r\n}", "function next(){\n\n // if in the last page, then go to the new page needs http request\n if(scope.model.currentIndex === (scope.model.results.length - 1))\n {\n angular.element('button.searchbtnbox').toggleClass('changed');\n angular.element('div.section-refresh-overlay').css('visibility','visible');\n var promise = scope.model.next();\n promise.then(function(response){\n\n scope.model.currentStart += scope.model.results[scope.model.currentIndex - 1].length;\n angular.element('button.searchbtnbox').toggleClass('changed');\n angular.element('div.section-refresh-overlay').css('visibility','hidden');\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n\n },function(error){\n console.log(error);\n });\n }\n else {\n scope.model.currentIndex++;\n scope.model.data = scope.model.results[scope.model.currentIndex];\n scope.model.currentStart += scope.model.results[scope.model.currentIndex - 1].length;\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n }\n }", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "function nextStep() {\n\n target.hide().addClass(\"done\").removeClass(\"open\").delay(100).show('slide', 200);\n target.find(\"#calculate\").hide();\n target.find(input).attr('contenteditable', 'false');\n targetnext.find(input).attr('contenteditable', 'true');\n targetnext.hide().removeClass(\"done not-started\").addClass(\"open visited\").delay(100).show('fade', 200);\n showNext();\n step.find(\".h3\").removeClass(\"active edit-progress\");\n stnext.find(\".h3\").addClass(\"active\");\n\n\n\n //specific pages\n if (target.hasClass(\"cust-info\")) {\n $(\".taxed\").show();\n }\n if (target.hasClass(\"cust-payment\")) {\n $(\".editable-subscribe\").addClass(\"review\");\n $(\"#step-buy\").show();\n $(\".next\").hide();\n }\n\n\n }", "function next() {\n\t\t\tcounter = pending = 0;\n\t\t\t\n\t\t\t// Check if there are no steps left\n\t\t\tif (steps.length === 0) {\n\t\t\t\t// Throw uncaught errors\n\t\t\t\tif (arguments[0]) {\n\t\t\t\t\tthrow arguments[0];\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// Get the next step to execute\n\t\t\tvar fn = steps.shift(), result;\n\t\t\tresults = [];\n\t\t\t\n\t\t\t// Run the step in a try..catch block so exceptions don't get out of hand.\n\t\t\ttry {\n\t\t\t\tlock = TRUE;\n\t\t\t\tresult = fn.apply(next, arguments);\n\t\t\t} catch (e) {\n\t\t\t\t// Pass any exceptions on through the next callback\n\t\t\t\tnext(e);\n\t\t\t}\n\t\t\t\n\t\t\tif (counter > 0 && pending == 0) {\n\t\t\t\t// If parallel() was called, and all parallel branches executed\n\t\t\t\t// synchronously, go on to the next step immediately.\n\t\t\t\tnext.apply(NULL, results);\n\t\t\t} else if (result !== undefined) {\n\t\t\t\t// If a synchronous return is used, pass it to the callback\n\t\t\t\tnext(undefined, result);\n\t\t\t}\n\t\t\tlock = FALSE;\n\t\t}", "started() {\r\n\r\n\t}", "function step()\n {\n //Saving the current states and the previous state to use them in recoloring\n //their view on the graph in the nest step.\n $old_current_state = $current_state;\n $old_previous_state = $previous_state;\n $old_tape_index = $current_tape_index;\n $old_tape_head_value = at_index($current_tape_index);\n \n //If any object is undefined return error because it means that the there is no transition\n //for the current input char.\n $previous_state = $current_state;\n if($graph_table[$current_state] === undefined || $graph_table[$current_state] === null) { $error = true; return -1; }\n $trans = $graph_table[$current_state][at_index($current_tape_index)];\n if($graph_table[$current_state][at_index($current_tape_index)] === undefined || $graph_table[$current_state][at_index($current_tape_index)] === null) { $error = true; return -1; }\n at_index($current_tape_index, $trans.output);\n \n //Moving the tape head depending on the direction of the actual transition retrieved from the graph table.\n if($trans.direction == 'R') $current_tape_index++;\n if($trans.direction == 'L') $current_tape_index--;\n if($trans.direction == 'S') /* do nothing */;\n \n //Updating the current state.\n $current_state = $trans.target;\n \n //If the state is an end state, return seccess, or accept.\n if($end_states[$current_state]) return 2;\n \n return 1; //ok { Meaning that it is a normal step no errors and no accept. }\n \n }", "function next_step() {\n\t//just to prevent submission\n\tevent.preventDefault();\n\t//true means it comes as next step\n\tpopup(true);\n}", "run() {\n // Add one to the start address for Thumb mode\n return this._client.go(this._start + 1);\n }", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n gw_com_module.startPage();\n\n //processRetrieve({});\n\n }", "function nextWorkout(){\n var next = response.workout.shift();\n if (next) {\n return next\n } \n //if no more workouts, count log completions and redirect to menu page\n else {\n $.post(\"/logCompletion\", {routineUsed: location.pathname.slice(1)})\n .done(function(res){\n // send data <- hint\n res.send(res)\n // var log = {location.pathname.slice(1)}\n // console.log(log, \"log\");\n //window.location.pathway\n\n });\n window.location.href = redirect;\n }\n}", "function _step() {\n for (var uid in entities) {\n var entity = entities[uid];\n entity.step();\n }\n }", "function next(err, result) {\n console.log('**Run in next:' + typeof(result));\n// throw exception if task encounters an error.\n if (err) throw err;\n\n// Next task comes from array of task.\n var currentTask = tasks.shift();\n\n if (currentTask) {\n// Execute current task.\n currentTask(result);\n }\n}", "function runSequence() {\n\n pagePositions = [];\n setTargeting();\n setPagePositions();\n defineSlotsForPagePositions();\n\n }", "function next() {\n state.index += 1;\n if (state.index >= state.quiz.questions.length) {\n state.stage = stages.FINISHED;\n }\n}", "function goToNextStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId+=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "function onProcessFinal() {\n chai_1.expect(loopResult, 'LoopResult should contain 10').to.contain(10);\n chai_1.expect(loopResult, 'LoopResult should contain 5').to.contain(5);\n chai_1.expect(loopResult, 'LoopResult should contain 1').to.contain(1);\n done();\n }", "function nextStep(id) {\n //first we need to get the new item from the list of instructions\n var instruction = getItem(instructions, id);\n\n //then we need to update the screen with the main description\n updateElement('title', instruction.title);\n updateElement('description', instruction.description);\n\n //then get the items for choice1 and 2 from the list\n var choice1 = getItem(instructions, instruction.choices.first);\n var choice2 = getItem(instructions, instruction.choices.second);\n\n //check to see if they are endpoints\n\n //if endpoints then end the game\n\n\n //if not update those sections on the screen with the choiceText\n updateElement('choiceOne', choice1.choiceText);\n updateElement('choiceTwo', choice2.choiceText);\n updateButton('buttonOne', choice1.id);\n updateButton('buttonTwo', choice2.id);\n //check to see if the story is at the end\n end(instruction);\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 next()\n {\n if(execute_index<execute_1by1.length)\n {\n execute_1by1[execute_index++].call(null, req, res, next);\n //execute_index+1 shouldn't do after call, because it's recursive call\n }\n }", "function goToStep(step){//because steps starts with zero\nthis._currentStep=step-2;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "function checkSucess() {\n setTimeout(function() {\n var lastOperation = readerOperations.pop();\n\n if (answered && authenticated && lastOperation === 'next') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "function callNext() {\n var nextEx = flip();\n\n $currentExercise.text('Do ' + nextEx + '!');\n\n runExProgressBar(($exerciseLength.val() * 1000) - 15);\n }", "step( dt ) {\n this.beakerProxyNode.step( dt );\n }", "function _nextStep() {\n if(this._currentStep == undefined) {\n this._currentStep = 0;\n } else {\n ++this._currentStep;\n }\n if((this._introItems.length) <= this._currentStep) {\n //end of the intro\n //check if any callback is defined\n if (this._introCompleteCallback != undefined){\n this._introCompleteCallback();\n }\n _exitIntro(this._targetElement);\n return;\n }\n _showElement.call(this, this._introItems[this._currentStep].element);\n\n }", "get next() { return this.nextStep; }", "openNextStep() {\n if (this.activeStep._nestedValidate() && this.activeStep.validate()) {\n this.activeStep.saveStep();\n // set the value to and from the the transition effect.\n this.__fromStep = this.activeStep;\n this.__toStep = this.nextStep;\n // toggle the step\n this.activeStep.toggleStep();\n this.removeActiveStep();\n if (this.nextStep !== null) this.nextStep.toggleStep();\n } else {\n this.activeStep.fireInvalidStep();\n }\n }", "run () {\n\n this.readAndUpdate();\n this.start(this._state);\n this.doAction(\"PADDLE\", this._current_action);\n this.sendAction();\n\n while (true) {\n\n this.readAndUpdate();\n\n if (!this._next_command)\n return;\n\n if (this._promise_succeeded) {\n this._next_command.resolve(this._state);\n } else {\n this._next_command.reject(this._promise_failure_reason);\n }\n\n this.doAction(\"PADDLE\", this._current_action);\n this.sendAction();\n\n // reset current action\n this._current_action = [0, 0, false];\n\n // reset promise results\n this._promise_succeeded = undefined;\n this._promise_failure_reason = undefined;\n }\n }", "started() { }", "beginProcess() {\n this.index.start = this.history.length;\n }", "function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n gw_com_module.startPage();\n //----------\n processRetrieve({});\n\n }", "resume() {\r\n if(this._endScript) {\r\n this._resetStates();\r\n } else {\r\n this._wait = false;\r\n }\r\n this._next();\r\n }", "function setNextStep(request, stepId){\n\trequest.act = defaultAct.setRequestData;\n\trequest.stepId = stepId;\n\tsendRequest(request);\n}", "renderNext() {\n\n if (this.finished) {\n return this.tallyResults();\n }\n const problem = this.problemSet[this.progress];\n console.log(this.progress)\n if (this.progress === 9) {\n this.finished = true;\n //this.renderNext()\n //this.tallyResults();\n }\n this.progress++;\n return problem;\n }", "function mainLoop()\n {\n\t\tmainLoopCounter++;\n if (Graph.instance.nodes.get(state.sourceId).b == 0) {\n state.current_step = STEP_FINISHED; //so that we display finished, not mainloop when done\n that.stopFastForward();\n \n logger.log(\"Finished with a min cost of \"+ minCost);\n\n }\n else\n {\n logger.log(\"Not finished, starting search for augmentation cycle \");\n state.show_residual_graph = true;\n state.current_step = STEP_FINDSHORTESTPATH; \n\t\t\n }\n }", "function beginWizard() {\n vm.showTorneoInfo = true;\n vm.paso = 2;\n obtenerEquiposParticipantes();\n }", "function reachedNextWaypoint() {\n\tif (curStep + 1 < gRouteLeg.steps.length) {\n\t\tcurStep++;\n\t\tvar coords = new Object();\n\t\tcoords.str = gRouteLeg.steps[curStep].html_instructions;\n\t\tcoords.latitude = gRouteLeg.steps[curStep].end_location.lat;\n\t\tcoords.longitude = gRouteLeg.steps[curStep].end_location.lng;\n\t\tsetNextWaypoint(coords);\n\t\t\n\t\t// TODO: haptic feedback if goal / nextwaypoint is reached\n\t}\n}", "async next() {\n this._executing = false;\n await this._execute();\n }", "function next() {\n counter = pending = 0;\n\n // Check if there are no steps left\n if (steps.length === 0) {\n // Throw uncaught errors\n if (arguments[0]) {\n throw arguments[0];\n }\n return;\n }\n\n // Get the next step to execute\n var fn = steps.shift();\n results = [];\n\n // Run the step in a try..catch block so exceptions don't get out of hand.\n try {\n lock = true;\n var result = fn.apply(next, arguments);\n } catch (e) {\n // Pass any exceptions on through the next callback\n next(e);\n }\n\n if (counter > 0 && pending == 0) {\n // If parallel() was called, and all parallel branches executed\n // synchronously, go on to the next step immediately.\n next.apply(null, results);\n } else if (result !== undefined) {\n // If a synchronous return is used, pass it to the callback\n next(undefined, result);\n }\n lock = false;\n }", "started() {\n\n\t}" ]
[ "0.709895", "0.7038313", "0.6856321", "0.6854222", "0.68436325", "0.68436325", "0.68436325", "0.68436325", "0.68246377", "0.6816382", "0.67627627", "0.67562646", "0.6735613", "0.6735613", "0.6735613", "0.67294556", "0.66476667", "0.662761", "0.6595572", "0.647254", "0.6469834", "0.6461526", "0.6379322", "0.63251776", "0.6320025", "0.6235656", "0.61912495", "0.6160747", "0.6063295", "0.6061995", "0.59992015", "0.59934103", "0.5972129", "0.595343", "0.59425354", "0.5930718", "0.5916407", "0.58964264", "0.58862036", "0.58815414", "0.58746916", "0.5873548", "0.5867258", "0.5865456", "0.58612233", "0.585394", "0.5852129", "0.5849643", "0.5848442", "0.5848442", "0.5848442", "0.5848442", "0.5848442", "0.5846935", "0.5839724", "0.5837035", "0.5832631", "0.579573", "0.5795518", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5787374", "0.5784138", "0.57809806", "0.5780371", "0.5773702", "0.57735926", "0.57672584", "0.57585937", "0.57479817", "0.5744655", "0.5735058", "0.57213026", "0.57201743", "0.57106584", "0.5702767", "0.56938225", "0.5693597", "0.56878334", "0.5683509", "0.5681401", "0.5675661", "0.5671594", "0.56637275", "0.5661654", "0.5657249", "0.565514", "0.5651062", "0.56505525", "0.56474066", "0.5647161", "0.5638854", "0.5636688" ]
0.6076435
28
called on error, exiting with error code
function processingFailed(globalParams, curStep, errorCode) { // check if failing in step is ok if (errorCode==ZOEERROR_UNCORRECT_RESPONSE && globalParams.ignoreApiError) { switch(curStep) { case 7: return processNextStep(globalParams, curStep); case 8: return processNextStep(globalParams, curStep); case 9: return processNextStep(globalParams, curStep); case 10: return processNextStep(globalParams, curStep); default: break; } } adapter.log.debug("in: processingFailed, curStep: "+ curStep); adapter.log.error('Error in step '+curStep+', errorCode: '+errorCode); adapter.terminate ? adapter.terminate(1) :process.exit(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exitError() {\n process.exit(1);\n }", "onerror() {}", "onerror() {}", "function endOnError(err) {\n console.log(err);\n process.exit(1);\n}", "handleFailure (error_)\n\t{\n\t\tthrow error_;\n\t}", "function e_error(code) {\n pj_ctx_set_errno(code);\n fatal();\n}", "function error (err) {\n if(error.err) return;\n callback(error.err = err);\n }", "error(error) {}", "function error(err) {\n if (error.err) return;\n callback((error.err = err));\n }", "function error(err) {\n if (error.err) return;\n callback((error.err = err));\n }", "function error(err) {\n if (error.err) return;\n callback((error.err = err));\n }", "handleFailure (error_)\n\t{\n\t\t// todo: Undo all actions\n\t\tthis.cleanup ();\n\t\tthrow error_;\n\t}", "function endIfErr (err) {\n if (err) {\n console.error(err)\n process.exit(1)\n }\n}", "onerror(err) {\n debug(\"error\", err);\n super.emit(\"error\", err);\n }", "function connectionError(err) {\n // Record failure in statsd\n statsClient.increment('opentsdb.failure');\n\n log.fatal('OpenTSDB connection error: ' + err);\n process.exit(1);\n }", "run() {\n\t\tthrow new Error;\n\t}", "function endIfErr (err) {\n if (err) {\n console.error(err);\n process.exit(1);\n }\n}", "function handleErr(err) {\n if (err) {\n console.dir(err);\n process.exit(1);\n return;\n }\n}", "function processError(err) {\n if (err) {\n console.error(err);\n }\n process.exit(1);\n}", "function errorExit () {\n var msg = _.toArray(arguments).join(' ') + '\\n'\n process.stderr.write(msg)\n process.exit(1)\n}", "function statusError()\n\t{\n\t\tcallback();\n\t}", "onerror(err) {\n debug(\"error\", err);\n super.emit(\"error\", err);\n }", "onerror(err) {\n debug(\"error\", err);\n super.emit(\"error\", err);\n }", "function handleError(err) {\n\t\t\t\t\t\t// Log\n\t\t\t\t\t\tme.log('warn', 'Feedr === fetching [' + feed.url + '] to [' + feed.path + '], failed', err.stack);\n\n\t\t\t\t\t\t// Exit\n\t\t\t\t\t\tif (feed.cache) {\n\t\t\t\t\t\t\tviaCache(next);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tviaRequestComplete(err, opts.data, requestOptions.headers);\n\t\t\t\t\t}", "onError() {}", "function handleError(err) {\n console.log('ERROR:', err);\n quit();\n return err;\n}", "function handleError(err) {\n console.log('ERROR:', err);\n quit();\n return err;\n}", "function handleError(error) {\n if (error && error.name === 'SheetrockError') {\n if (request && request.update) {\n request.update({ failed: true });\n }\n }\n\n if (userOptions.callback) {\n userOptions.callback(error, options, response);\n return;\n }\n\n if (error) {\n throw error;\n }\n }", "function processError(){\n\t\tconsole.log('Error connecting to twitter API!');\t\n\t}", "onerror(err) {\n debug(\"error\", err);\n this.emitReserved(\"error\", err);\n }", "function errorExit( err ) {\n\tconsole.log( err.message );\n\tprocess.exit( 1 );\n}", "function error(err) {\n console.warn(`ERROR(${err.code}): ${err.message}`);\n requestPhotos(fallBackLocation)\n \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}", "error() {}", "onerror(err) {\n debug(\"error\", err);\n this.emitReserved(\"error\", err);\n }", "function commonErrorHandler (err) {\n console.log(err); \n resetToLibraryIndexPage();\n }", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function exit(err) {\n printErr(err);\n process.exit(1);\n}", "function errback(err) {\n rdbAdmin.showErrorMessage('<pre>' + err[0] + ':' + err[1] + '</pre>');\n }", "error(error) {\n this.__processEvent('error', error);\n }", "function processErrors(data){\n \n}", "function handleError(err) {\n console.error('ERROR:', err);\n quit();\n return err;\n}", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)errorOrDestroy(dest,er);}// Make sure our error handler is attached before userland ones.", "function handleError(err, scope, msg, context, stdout) {\t\n\tcontext._stdout = stdout;\n\tcontext._exception = {\n\t\tscope: scope,\n\t\tlineNumber: err.lineNumber,\n\t\tmessage: err.message,\n\t\tstack: err.stack\n\t};\n\tprocess.send(clean(context, msg));\n\tprocess.exit(1);\t\n}", "function forwardError (err) {\n\t clientRequest.emit('error', err);\n\t }", "function errorExit(e) {\n console.error(e);\n process.exit(1);\n}", "function exit(errorCode) {\r\n console.log(\"Exiting with return code: \" + errorCode);\r\n console.log(\"EOF\");\r\n phantom.exit(errorCode);\r\n}", "function error(error) {\n host.active--;\n if (++load.attempt < maxAttempts) {\n host.queued.push(load);\n } else {\n callback(null);\n }\n process(host);\n }", "function handleError(err) {\n if (err) {\n console.log('\\nError Creating File');\n console.log(err.stack);\n process.exit(1);\n }\n}", "function loading_error(error, filename, lineno) {\n console.log(\"Error when loading files: \" + error);\n res.send(error);\n }", "function handlerErroe(error){\r\n console.error(error.toString())\r\n this.emit('end');\r\n}", "function checkError() {\n if (err && !err.message.match(/response code/)) {\n return when().delay(1000); // chill for a second\n }\n }", "function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}", "function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}", "function devolverError(err) {\n res.header('Connection', 'close');\n res.status = 500;\n res.writeHead(500, { \"Content-Type\": \"application/json\" });\n res.write(JSON.stringify({ status: err.codError, descStatus: err.message }));\n res.end();\n }", "function err(strm,errorCode){strm.msg=msg[errorCode];return errorCode;}", "async catch(err) {\n try {\n // real errors will bubble\n await super.catch(err);\n } catch (err) {\n // oclif exit method actually throws an error, let it continue\n if (err.oclif && err.code === 'EEXIT') throw err; // log all other errors and exit\n\n this.log.error(err);\n this.exit(1);\n }\n }", "function node_error(err) {\r\n node.error(err, err);\r\n }", "function bailOut(err) {\n if (err instanceof httplease.errors.UnexpectedHttpResponseCodeError) {\n console.log(err.response.statusCode);\n console.log(err.response.headers);\n console.log(err.response.body);\n } else {\n console.log(err.message)\n }\n process.exit(1);\n}", "onerror(err) {\n this.emitReserved(\"error\", err);\n }", "_onSerialError(err) {\n // not really sure how to handle this in a more elegant way\n\n this.emit('error', err);\n }", "function handleError(code, message) {\n // Process your code here\n // Genramos un mensaje\n throw new Error(message + \". Code: \" + code);\n}", "function handleError(error) {\n console.log(\"failed!\".red);\n return callback(error);\n }", "_sendErrors() {\n if (this.errors.length) {\n process.stderr.write(this.errors.join('\\n'));\n process.exit(1);\n }\n }", "function criticalError(error) {\n console.error(error);\n process.exit(1);\n}", "function loaderErrback(error, url) {\n//console.error(\"in loaderErrback\", error);\n\t\t\tLoader._error(\"Error loading url '\"+url+\"'\");\n\t\t\tif (errback) {\n\t\t\t\terrback(error, url);\n\t\t\t\tloadNext();\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}", "function OnErr() {\r\n}", "error_handler(err) {\n console.log(`Problem encountered. Detail:${err.message}`);\n }", "function handleError(err) {\n\t\t\toptions.lastError = err;\n\t\t\tif (options.onError) {\n\t\t\t\tif (options.onError.length > 1)\n\t\t\t\t\toptions.onError(err, runAgain);\n\t\t\t\telse {\n\t\t\t\t\toptions.onError(err);\n\t\t\t\t\trunAgain(true);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\trunAgain(true);\n\t\t}", "function onError(error) {\n\t\tif(error.syscall !== 'listen') {\n\t\t\tthrow error;\n\t\t}\n \t\tvar bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port;\n\t\tswitch (error.code) {\n\t\t\tcase 'EACCES':\n\t\t\t\tconsole.error(bind + ' requires elevated privileges');\n \t\t\tprocess.exit(1);\n \t\t\tbreak;\n\t\t\tcase 'EADDRINUSE':\n\t\t\t\tconsole.error(bind + ' is already in use');\n\t\t\t\tprocess.exit(1);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow error;\n\t\t}\n\t}", "function onerror(error) {\n cleanup();\n if (!hasListeners(this, 'error'))\n throw error; // Unhandled stream error in pipe.\n }", "function unresumableError(err) {\n if (!callback) {\n changeStream.emit('error', err);\n changeStream.emit('close');\n }\n processResumeQueue(changeStream, err);\n changeStream.closed = true;\n }", "function errorCB(err) {\n //alert(\"Error processing SQL: \"+err.code);\n \n }", "function handleError(err)\n {\n defer.reject(err);\n }", "function onError(error) {\n throw error;\n}", "function onFileSystemFail(err) {\n console.log('deleteFileFromPersistentStorage file system fail: ' + fileName);\n console.log('error code = ' + err.code);\n }", "function reportErrors (err) {\n console.error(err.stack)\n process.exit(1)\n}", "function finished(err){\n }", "function OnErrorCallMaladie(jqXHR, status) {\n\t\t}", "function error(err) {\n if (err !== 'cancelled') { //We don't care about cancelled.\n //TODO: It may be useful in some cases to display the error. Which cases?\n console.error(err);\n }\n }", "function errorHandling(err) {\r\n if (err) console.log(err);\r\n else console.log(`Done`)\r\n\r\n}", "function errorCB(err) {\n console.log(\"Error processing SQL: \"+err.code);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}" ]
[ "0.708033", "0.69563377", "0.69563377", "0.6875588", "0.6785166", "0.6778355", "0.6717557", "0.6685013", "0.66156256", "0.66156256", "0.66156256", "0.66131437", "0.6585356", "0.6564009", "0.6552909", "0.6548624", "0.654608", "0.64903915", "0.64833313", "0.646155", "0.6452815", "0.6446406", "0.6446406", "0.64404804", "0.64009154", "0.6393572", "0.6393572", "0.63671243", "0.63454986", "0.6333386", "0.6331726", "0.6316669", "0.6313194", "0.62857485", "0.6282578", "0.6279642", "0.62545717", "0.62545717", "0.62545717", "0.6239904", "0.62369347", "0.62296736", "0.61900985", "0.6184303", "0.61842877", "0.61730903", "0.61720866", "0.6167532", "0.61668587", "0.6165771", "0.61653024", "0.61479473", "0.61415744", "0.6129297", "0.61205167", "0.61205167", "0.61138964", "0.61106485", "0.61034316", "0.6086245", "0.60853773", "0.6080514", "0.6076553", "0.6068296", "0.60617334", "0.6059206", "0.6042589", "0.60420907", "0.60400504", "0.60359454", "0.60331774", "0.6030637", "0.60264045", "0.60195726", "0.6019289", "0.6010009", "0.60065466", "0.60046977", "0.59989953", "0.599624", "0.5995338", "0.59942657", "0.5988736", "0.5987146", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227", "0.5986227" ]
0.6226109
42
New packet error, extends default error class.
function PacketError(message, extra) { if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } this.name = this.constructor.name; this.level = 'Critical'; this.message = message; this.extra = extra; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CustomError() {}", "function CustomError(type,message){\n\t\t\tthis.type=type;\n\t\t\tthis.message=message;\n\t\t}", "function extendError(constructor, error_name, default_message, status_code, safe_message) {\n /*jshint validthis:true */\n \n // check for optional constructor\n if(typeof constructor !== 'function'){\n safe_message = status_code;\n status_code = default_message;\n default_message = error_name;\n error_name = constructor;\n constructor = undefined;\n }\n \n if(!constructor){\n constructor = function CustomError(message, error, additional, field, base_error) {\n // call init (only thing required for a constructor). Only passing \"this\" is required.\n // but everything else should probably be handled\n return constructor._init(this, message, error, additional, field, base_error);\n };\n }\n \n var parent = (this !== errorsBase ? this : Error);\n \n // do we have inheritance handling?\n if(errorsBase.inherits){\n errorsBase.inherits(constructor, parent);\n }\n \n // add an _init function for the constructor\n Object.defineProperty(constructor, '_init', {\n value: function errorInit(inst, message, error, additional, field, generic_error) {\n // HACK: We don't want to need the \"new\" operator but we need the error to be an instanceof\n // the constructor. So, if called without the new operator, we create a new instance and \n // and pass something very unlikely to be passed (constructor as message) to flag that we \n // just want it to return\n if (message === constructor) return;\n // make sure we have an instanceof this constructor\n if (!(inst instanceof constructor)) inst = new constructor(constructor);\n \n // do we call super's constructor?\n if(errorsBase.inheritsSuper){\n parent.call(inst);\n }\n \n // set the message\n inst.message = message || default_message;\n \n // are messages passed safe?\n if (safe_message){\n inst.safe_message = inst.message;\n }\n \n // store the original error (used to mutate errors)\n if (error){\n inst.error = error;\n }\n \n // additional is optional and should be an object. If string, we assume it's a field\n if(typeof additional === 'string' && typeof field !== 'string'){\n generic_error = field;\n field = additional;\n additional = undefined;\n }\n \n // additional information passed?\n if (additional) {\n var addl = {};\n inst.additional = addl;\n for (var i in additional){\n addl[i] = additional[i];\n }\n }\n \n // field is optional\n if(typeof field !== 'string'){\n generic_error = field;\n field = undefined;\n } else {\n inst.field = field;\n }\n \n // generic_error?\n if(generic_error){\n inst.generic = true;\n }\n \n // do we have something for capturing stack traces?\n if(errorsBase.captureStackTrace){\n errorsBase.captureStackTrace(inst, constructor);\n }\n \n // return this error\n return inst;\n },\n enumerable: false\n });\n \n // add default toString method\n Object.defineProperty(constructor.prototype, 'toString', {\n value: function errorToString() { \n return this.name + ': ' + this.message; \n },\n enumerable: false,\n configurable: true\n });\n \n // set default values\n constructor.prototype.name = error_name;\n constructor.prototype.status_code = status_code || 500;\n constructor.prototype.safe_message = default_message;\n \n // want to be able to extend this error\n constructor.extend = extendError;\n \n // return the constructor\n return constructor;\n }", "function CustomError(message) {\n this.message = message;\n this.name = \"CustomError\";\n }", "function RPCError(code, message) {\n this.code = code;\n this.message = message;\n}", "defineCustomErrors() {\n this.restifyErrors.InvalidTokenError = this.restifyErrors.makeConstructor('InvalidTokenError', {\n statusCode: 404,\n failureType: 'motion'\n });\n\n this.restifyErrors.BusinessError = this.restifyErrors.makeConstructor('BusinessError', {\n statusCode: 500,\n failureType: 'motion'\n });\n\n // this.restifyErrors.InvalidIdendifierError = this.restifyErrors.makeConstructor('InvalidIdendifierError', {\n // statusCode: 400,\n // failureType: 'motion'\n // });\n //\n // Ex.: ErrorHandler.throw('Your CPF is not valid', 'InvalidIdendifierError')\n }", "constructor (err,data) {\n \n // Calling parent constructor of base Error class.\n super(err);\n \n // Saving class name in the property of our custom error as a shortcut.\n this.data = data || {};\n\n // Capturing stack trace, excluding constructor call from it.\n Error.captureStackTrace(this, this.constructor);\n \n // You can use any additional properties you want.\n // I'm going to use preferred HTTP status for this error types.\n // `500` is the default value if not specified.\n }", "function ParserError(e,t){this.message=e,this.error=t}", "function CustomError(message) {\n this.name = \"CustomError\";\n this.message = message || \"Default Custom Error Message\";\n Error.captureStackTrace(this, CustomError);\n}", "function createHttpErrorConstructor(){function HttpError(){throw new TypeError('cannot construct abstract class');}inherits(HttpError,Error);return HttpError;}", "constructor(message, errorCode) { \n super(message); // Super to call Error, then add a \"message\" property\n this.code = errorCode; // Adds a \"code\" property\n }", "constructor(error, item) {\n super();\n this.raw = error;\n this.item = item;\n this.name = this.constructor.name;\n this.message = this.messageFrom(error);\n Error.captureStackTrace(this, this.constructor);\n }", "constructor (errObj,status,data) {\n \n // Calling parent constructor of base Error class.\n super();\n \n // Saving class name in the property of our custom error as a shortcut.\n this.name = errObj.name;\n this.code = errObj.code;\n this.message = errObj.message;\n this.data = data || {};\n \n // Capturing stack trace, excluding constructor call from it.\n Error.captureStackTrace(this, this.constructor);\n \n // You can use any additional properties you want.\n // I'm going to use preferred HTTP status for this error types.\n // `500` is the default value if not specified.\n this.status = status || 500;\n }", "constructor (errObj,status,data) {\n \n // Calling parent constructor of base Error class.\n super();\n \n // Saving class name in the property of our custom error as a shortcut.\n this.name = errObj.name;\n this.code = errObj.code;\n this.message = errObj.message;\n this.data = data || {};\n \n // Capturing stack trace, excluding constructor call from it.\n Error.captureStackTrace(this, this.constructor);\n \n // You can use any additional properties you want.\n // I'm going to use preferred HTTP status for this error types.\n // `500` is the default value if not specified.\n this.status = status || 400;\n }", "function CustomError(message) {\n\tthis.message = message;\n\tthis.stack = (new Error()).stack; // `Error` provides stack trace\n}", "HTTPNetworkException (msg) {\n let error = new Error(msg);\n error.name = \"HTTPNetworkException\";\n //error.snappMessage = \"something?\";\n throw error;\n }", "function buildCustomError(...args) {\r\n return Reflect.construct(Error, args, buildCustomError);// 指定new.target为buildCustomError,这样prototype就不是Error.prototype了\r\n}", "function createStackForSend() {\n try {\n throw Error(error);\n }\n catch (ex) {\n error = ex;\n\n // note we generated this stack for later\n error.generatedStack = true;\n\n // set the time when it was created\n error.timestamp = error.timestamp || now;\n\n impl.addError(error, via, source);\n }\n }", "error(error) {}", "function myError(msg) {\n\t\tthis.msg = msg;\n\t}", "function createServerErrorConstructor(HttpError,name,code){var className=name.match(/Error$/)?name:name+'Error';function ServerError(message){// create the error object\nvar msg=message!=null?message:statuses[code];var err=new Error(msg);// capture a stack trace to the construction point\nError.captureStackTrace(err,ServerError);// adjust the [[Prototype]]\nsetPrototypeOf(err,ServerError.prototype);// redefine the error message\nObject.defineProperty(err,'message',{enumerable:true,configurable:true,value:msg,writable:true});// redefine the error name\nObject.defineProperty(err,'name',{enumerable:false,configurable:true,value:className,writable:true});return err;}inherits(ServerError,HttpError);ServerError.prototype.status=code;ServerError.prototype.statusCode=code;ServerError.prototype.expose=false;return ServerError;}", "function exportFn(){\n // if set, if this module is called as a function, the arguments will just be\n // passed along to this function\n var fn;\n \n // what we will export\n function errorsBase(){\n // if there is a base fn, call it\n if(typeof fn === 'function'){\n return fn.apply(this, arguments); // jshint ignore:line\n }\n \n // otherwise, we're done here\n }\n \n // need to be able to set the fn from plugins\n errorsBase.setFn = function setErrorsBaseFn(error_fn){\n fn = error_fn;\n };\n \n // used to create a new error type\n function extendError(constructor, error_name, default_message, status_code, safe_message) {\n /*jshint validthis:true */\n \n // check for optional constructor\n if(typeof constructor !== 'function'){\n safe_message = status_code;\n status_code = default_message;\n default_message = error_name;\n error_name = constructor;\n constructor = undefined;\n }\n \n if(!constructor){\n constructor = function CustomError(message, error, additional, field, base_error) {\n // call init (only thing required for a constructor). Only passing \"this\" is required.\n // but everything else should probably be handled\n return constructor._init(this, message, error, additional, field, base_error);\n };\n }\n \n var parent = (this !== errorsBase ? this : Error);\n \n // do we have inheritance handling?\n if(errorsBase.inherits){\n errorsBase.inherits(constructor, parent);\n }\n \n // add an _init function for the constructor\n Object.defineProperty(constructor, '_init', {\n value: function errorInit(inst, message, error, additional, field, generic_error) {\n // HACK: We don't want to need the \"new\" operator but we need the error to be an instanceof\n // the constructor. So, if called without the new operator, we create a new instance and \n // and pass something very unlikely to be passed (constructor as message) to flag that we \n // just want it to return\n if (message === constructor) return;\n // make sure we have an instanceof this constructor\n if (!(inst instanceof constructor)) inst = new constructor(constructor);\n \n // do we call super's constructor?\n if(errorsBase.inheritsSuper){\n parent.call(inst);\n }\n \n // set the message\n inst.message = message || default_message;\n \n // are messages passed safe?\n if (safe_message){\n inst.safe_message = inst.message;\n }\n \n // store the original error (used to mutate errors)\n if (error){\n inst.error = error;\n }\n \n // additional is optional and should be an object. If string, we assume it's a field\n if(typeof additional === 'string' && typeof field !== 'string'){\n generic_error = field;\n field = additional;\n additional = undefined;\n }\n \n // additional information passed?\n if (additional) {\n var addl = {};\n inst.additional = addl;\n for (var i in additional){\n addl[i] = additional[i];\n }\n }\n \n // field is optional\n if(typeof field !== 'string'){\n generic_error = field;\n field = undefined;\n } else {\n inst.field = field;\n }\n \n // generic_error?\n if(generic_error){\n inst.generic = true;\n }\n \n // do we have something for capturing stack traces?\n if(errorsBase.captureStackTrace){\n errorsBase.captureStackTrace(inst, constructor);\n }\n \n // return this error\n return inst;\n },\n enumerable: false\n });\n \n // add default toString method\n Object.defineProperty(constructor.prototype, 'toString', {\n value: function errorToString() { \n return this.name + ': ' + this.message; \n },\n enumerable: false,\n configurable: true\n });\n \n // set default values\n constructor.prototype.name = error_name;\n constructor.prototype.status_code = status_code || 500;\n constructor.prototype.safe_message = default_message;\n \n // want to be able to extend this error\n constructor.extend = extendError;\n \n // return the constructor\n return constructor;\n }\n \n \n // by default, should be able to add, extend, and rebase errors\n errorsBase.add = addError;\n errorsBase.extend = extendError;\n errorsBase.rebase = rebaseError;\n \n // return our errorsBase\n return errorsBase;\n}", "function createClientErrorConstructor(HttpError,name,code){var className=name.match(/Error$/)?name:name+'Error';function ClientError(message){// create the error object\nvar msg=message!=null?message:statuses[code];var err=new Error(msg);// capture a stack trace to the construction point\nError.captureStackTrace(err,ClientError);// adjust the [[Prototype]]\nsetPrototypeOf(err,ClientError.prototype);// redefine the error message\nObject.defineProperty(err,'message',{enumerable:true,configurable:true,value:msg,writable:true});// redefine the error name\nObject.defineProperty(err,'name',{enumerable:false,configurable:true,value:className,writable:true});return err;}inherits(ClientError,HttpError);ClientError.prototype.status=code;ClientError.prototype.statusCode=code;ClientError.prototype.expose=true;return ClientError;}", "function CustomError (message, code) {\n Error.captureStackTrace(this, this.constructor);\n this.code = code;\n this.message = `${message} (${code})`;\n}", "function NetworkError(message) {\n this.name = 'NetworkError';\n this.code = 19;\n this.message = message;\n }", "function NetworkError(message) {\n this.name = 'NetworkError';\n this.code = 19;\n this.message = message;\n }", "function DevError(message, error, additional, field, base_error){\n return DevError._init(this, message, error, additional, field, base_error);\n}", "static get Unknown() {\n// Return new error...\n return new Error(\n 'MountingError: There was an unknown error during the mounting process.'\n )\n }", "_error(msg) {\n msg += ` (${this._errorPostfix})`;\n const e = new Error(msg);\n return e;\n }", "function createHttpErrorConstructor () {\n\t function HttpError () {\n\t throw new TypeError('cannot construct abstract class')\n\t }\n\n\t inherits(HttpError, Error)\n\n\t return HttpError\n\t}", "constructor(message, statusCode) {\n // now with the super keyWord we force to use also the constructor of the parent class\n // In our case bellow, The Error class only acepts the message parameter\n // By setting this, our messagem propertie gets the messa itself\n super(message);\n\n\n this.statusCode = statusCode;\n this.status = `${statusCode}`.startsWith(\"4\") ? \"fail\" : \"error\";\n this.isOperational = true; // I use this option to chose if I wanna give it back to the client. True means yes in this case\n\n /// in order to avoid polution of the return of an error\n\n Error.captureStackTrace(this, this.constructor);\n }", "function UserError(message, error, additional, field, base_error){\n return UserError._init(this, message, error, additional, field, base_error);\n}", "function __extra_code__() {\n if (typeof Object.setPrototypeOf === 'function') {\n Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype);\n } else {\n JisonLexerError.prototype = Object.create(Error.prototype);\n }\n JisonLexerError.prototype.constructor = JisonLexerError;\n JisonLexerError.prototype.name = 'JisonLexerError';\n }", "function ErrorNodeImpl(token) {\n\tTerminalNodeImpl.call(this, token);\n\treturn this;\n}", "function ErrorNodeImpl(token) {\n\tTerminalNodeImpl.call(this, token);\n\treturn this;\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function VError()\n{\n\tvar args, obj, parsed, cause, ctor, message, k;\n\n\targs = Array.prototype.slice.call(arguments, 0);\n\n\t/*\n\t * This is a regrettable pattern, but JavaScript's built-in Error class\n\t * is defined to work this way, so we allow the constructor to be called\n\t * without \"new\".\n\t */\n\tif (!(this instanceof VError)) {\n\t\tobj = Object.create(VError.prototype);\n\t\tVError.apply(obj, arguments);\n\t\treturn (obj);\n\t}\n\n\t/*\n\t * For convenience and backwards compatibility, we support several\n\t * different calling forms. Normalize them here.\n\t */\n\tparsed = parseConstructorArguments({\n\t 'argv': args,\n\t 'strict': false\n\t});\n\n\t/*\n\t * If we've been given a name, apply it now.\n\t */\n\tif (parsed.options.name) {\n\t\tmod_assertplus.string(parsed.options.name,\n\t\t 'error\\'s \"name\" must be a string');\n\t\tthis.name = parsed.options.name;\n\t}\n\n\t/*\n\t * For debugging, we keep track of the original short message (attached\n\t * this Error particularly) separately from the complete message (which\n\t * includes the messages of our cause chain).\n\t */\n\tthis.jse_shortmsg = parsed.shortmessage;\n\tmessage = parsed.shortmessage;\n\n\t/*\n\t * If we've been given a cause, record a reference to it and update our\n\t * message appropriately.\n\t */\n\tcause = parsed.options.cause;\n\tif (cause) {\n\t\tmod_assertplus.ok(mod_isError(cause), 'cause is not an Error');\n\t\tthis.jse_cause = cause;\n\n\t\tif (!parsed.options.skipCauseMessage) {\n\t\t\tmessage += ': ' + cause.message;\n\t\t}\n\t}\n\n\t/*\n\t * If we've been given an object with properties, shallow-copy that\n\t * here. We don't want to use a deep copy in case there are non-plain\n\t * objects here, but we don't want to use the original object in case\n\t * the caller modifies it later.\n\t */\n\tthis.jse_info = {};\n\tif (parsed.options.info) {\n\t\tfor (k in parsed.options.info) {\n\t\t\tthis.jse_info[k] = parsed.options.info[k];\n\t\t}\n\t}\n\n\tthis.message = message;\n\tError.call(this, message);\n\n\tif (Error.captureStackTrace) {\n\t\tctor = parsed.options.constructorOpt || this.constructor;\n\t\tError.captureStackTrace(this, ctor);\n\t}\n\n\treturn (this);\n}", "function AVError(code, message) {\n\t var error = new Error(message);\n\t error.code = code;\n\t return error;\n\t}", "function ParseError(res) {\n\tthis.message = 'Unexpected characters \"' + res[0] + '\":\\n' +\n\t\tres.input.replace(/\\t|\\n/g, '.') + '\\n' + (new Array(res.index + 1).join('-')) + '^';\n\tthis.name = 'ParseError';\n}", "function MyError() {}", "function MyError() {}", "function _extendError(err) {\n\tif (!err) return err;\n\tif (err.statusCode === 404) err.noSuchContainer = true;\n\treturn err;\n}", "function BaseErrorHandler() {\n\n }", "setError(state, newError) {\n state.error = newError;\n }", "function makeNodeError(type, code) {\n const e = new type();\n e.code = code;\n return e;\n }", "function cbtError (/*String|Error*/ type,/*String?*/ method,/*String?*/ message) {\n\t\t\t// summary:\n\t\t\t//\t\tConstructor, create a new instance of the custom error type.\n\t\t\t// type:\n\t\t\t//\t\tIf a string it identifies the message type, otherwise an instance\n\t\t\t//\t\tor Error.\n\t\t\t// method:\n\t\t\t//\t\tMethod or function name used a the second part, module being the\n\t\t\t//\t\tfirst, of the prefix applied to the message. The general format\n\t\t\t//\t\tof any error messages looks like: <module><method><message>\n\t\t\t// message:\n\t\t\t//\t\tOptional message text. If specified overrides the text assigned to\n\t\t\t//\t\tthe message type or, in case type is an Error, the Error message.\n\t\t\t// tag:\n\t\t\t//\t\tPrivate\n\t\t\tvar path = module + (method ? (prefix + method + \"()\") : \"\");\n\t\t\tvar msgObj;\n\n\t\t\t// If 'type' is an instance of 'Error' copy its properties\n\t\t\tif (type instanceof Error) {\n\t\t\t\tfor(var prop in type){\n\t\t\t\t\tif(type.hasOwnProperty(prop)){\n\t\t\t\t\t\tthis[prop] = type[prop];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmsgObj = {type: type.name, code: (type.code || 0), text: (message || type.message)};\n\t\t\t} else {\n\t\t\t\tmsgObj = getMessage(type, message);\n\t\t\t}\n\n\t\t\t// In case additional arguments are specified (e.g. beyond message) see if\n\t\t\t// we need to inject them into the message. Placeholders for the arguments\n\t\t\t// are formatted as '%{n}' where n is a zero based argument index relative\n\t\t\t// to the 'message' argument.\n\n\t\t\tif (arguments.length > 2) {\n\t\t\t\tvar args = Array.prototype.slice.call(arguments, 3);\n\t\t\t\tmsgObj.text = msgObj.text.replace( /\\%\\{(\\d+)\\}/g, function ( token, argIdx ) {\n\t\t\t\t\treturn (args[argIdx] != undefined ? args[argIdx] : token);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.message = (path.length ? path + \": \" : \"\") + msgObj.text;;\n\t\t\tthis.code = msgObj.code;\t\t\t\t// deprecated but provided for backward compatability.\n\t\t\tthis.name = msgObj.type;\n\t\t}", "function ParseError(msg, type, value, context)\n{\n this.msg = msg;\n this.type = type;\n this.value = value;\n this.context = context;\n return this;\n}", "static error () {\n\t // TODO\n\t const relevantRealm = { settingsObject: {} };\n\n\t // The static error() method steps are to return the result of creating a\n\t // Response object, given a new network error, \"immutable\", and this’s\n\t // relevant Realm.\n\t const responseObject = new Response();\n\t responseObject[kState] = makeNetworkError();\n\t responseObject[kRealm] = relevantRealm;\n\t responseObject[kHeaders][kHeadersList] = responseObject[kState].headersList;\n\t responseObject[kHeaders][kGuard] = 'immutable';\n\t responseObject[kHeaders][kRealm] = relevantRealm;\n\t return responseObject\n\t }", "function PositionError() {\n\tthis.code = null;\n\tthis.message = \"\";\n}", "function PositionError() {\n\tthis.code = null;\n\tthis.message = \"\";\n}", "function TL_Error(t,e){this.name=\"TL.Error\",this.message=t||\"error\",this.message_key=this.message,this.detail=e||\"\";var i=new Error;i.hasOwnProperty(\"stack\")&&(this.stack=i.stack)}", "error() {}", "error (key, info) {\n\t\tif (!this.errors[key]) {\n\t\t\treturn {\n\t\t\t\tcode: 'UNKNOWN',\n\t\t\t\tmessage: 'Unknown error'\n\t\t\t}; // don't let this happen\n\t\t}\n\t\t// make a copy of the error object, we don't want to alter the original!\n\t\treturn Object.assign({}, this.errors[key], info);\n\t}", "function VeryBadError() {}", "function PositionError() {\n this.code = null;\n this.message = \"\";\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function createHttpErrorConstructor () {\n function HttpError () {\n throw new TypeError('cannot construct abstract class')\n }\n\n inherits(HttpError, Error)\n\n return HttpError\n}", "function makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode) ? `MODULE_NOT_FOUND` : pnpCode;\n return Object.assign(new Error(message), {\n code,\n pnpCode,\n data\n });\n}", "constructor(error) {\n /** `Err` is always [`Variant.Err`](../enums/_result_.variant#err). */\n this.variant = Variant.Err;\n if (isVoid(error)) {\n throw new Error('Tried to construct `Err` with `null` or `undefined`. Maybe you want `Maybe.Nothing`?');\n }\n this.error = error;\n }", "constructor(message, statusCode) {\n // error class has access to message in it's constructor, so call super on that\n // instead of `this.message = message`\n super(message);\n\n // create a custom class property called `statusCode`\n // which is whatever param was passed in\n this.statusCode = statusCode;\n }", "function ImplementationError(message) {\n this.message = message;\n}", "isError() { return this.type==Token.ERROR }", "isError() { return this.type==Token.ERROR }", "function $HjyR$var$createHttpErrorConstructor() {\n function HttpError() {\n throw new TypeError('cannot construct abstract class');\n }\n\n $HjyR$var$inherits(HttpError, Error);\n return HttpError;\n}", "function addError(base, field, err){\n // field is optional\n if(arguments.length === 2){\n err = field;\n field = err.field;\n }\n \n if(base === err){\n return base;\n }\n \n if(!base || typeof base !== 'object'){\n var throwing = new Error('Cannot add error to non object');\n throwing.errors = [err];\n throw throwing;\n }\n \n var f;\n \n if(field === undefined){\n if(!err.generic){\n if(base.generic){\n return rebaseError(base, err);\n } else {\n if(!base.errors){\n base.errors = [err];\n } else {\n if(!~base.errors.indexOf(err)){\n base.errors.push(err);\n }\n }\n }\n }\n \n if(err.errors){\n for(f = 0; f < err.errors.length; f++){\n base = addError(base, err.errors[f]);\n }\n }\n \n if(err.fields){\n for(f in err.fields){\n base = addError(base, f, err.fields[f]);\n }\n }\n } else {\n if(!base.fields){\n base.fields = {};\n }\n \n if(base.fields[field]){\n if(!err.generic && base.fields[field].generic){\n base.fields[field] = rebaseError(base.fields[field], err);\n } else {\n base.fields[field] = addError(base.fields[field], err);\n }\n } else {\n base.fields[field] = err;\n }\n \n if(err.fields){\n for(f in err.fields){\n base = addError(base, field + '.' + f, err.fields[f]);\n }\n }\n }\n \n return base;\n}", "constructor(\n message: string,\n meta?: Object,\n ) {\n super();\n this.name = 'ChatError';\n this.message = message;\n if (meta) {\n this.extraData = meta;\n }\n }" ]
[ "0.7020092", "0.635068", "0.63197356", "0.63026273", "0.62938434", "0.62360144", "0.62108105", "0.6192444", "0.61341524", "0.6121295", "0.6079457", "0.6031701", "0.6028829", "0.60282385", "0.60117376", "0.6008815", "0.59550375", "0.5922795", "0.59172416", "0.59131163", "0.59065324", "0.5899264", "0.58912545", "0.587754", "0.58417135", "0.58417135", "0.5840263", "0.5832262", "0.58260345", "0.5809683", "0.5798739", "0.579644", "0.5796329", "0.579315", "0.579315", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.57919496", "0.578298", "0.5778375", "0.576917", "0.576917", "0.5758691", "0.57397014", "0.57336867", "0.5719239", "0.5712303", "0.57091254", "0.56981", "0.563873", "0.563873", "0.5626637", "0.5605212", "0.558954", "0.55838954", "0.5583263", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.558302", "0.5576337", "0.5574892", "0.5573661", "0.5573297", "0.5554782", "0.5554782", "0.5554424", "0.5546058", "0.5525607" ]
0.7008456
1
only use after constructing.
setXY(x,y) { this.x = x; this.y = y; this.drawx = x; this.drawy = y; this.vis = { dx : 0, dy : 0, x : this.x, y : this.y }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _construct()\n\t\t{;\n\t\t}", "__previnit(){}", "constructor() {\r\n // ohne Inhalt\r\n }", "constructor() {\n\t\t// ...\n\t}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {\n //\n }", "consructor() {\n }", "constructur() {}", "init() {\n }", "configure () {\n // this can be extended in children classes to avoid using the constructor\n }", "constructor() {\n super();\n this._init();\n }", "constructor() {\n\n\t}", "constructor () { super() }", "function init() {\n\t \t\n\t }", "constructor () {\r\n\t\t\r\n\t}", "constructor() {\n super()\n self = this\n self.init()\n }", "onConstructed() {}", "onConstructed() {}", "constructor() {\n this._initialize();\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "initialize()\n {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "initialize() {\n // Needs to be implemented by derived classes.\n }", "constructor() {\n\t}", "constructor() {\n\t}", "constructor() {\n }", "init () {\n\t\treturn null;\n\t}", "init () {}", "init () {}", "constructor() {\n this.init();\n }", "constructor() {\n super();\n }", "constructor() { super() }", "constructor()\n {\n this.init();\n }", "constructor() {\n super();\n }", "constructor() {\n super();\n }", "constructor() {\n super();\n }", "constructor() {\n\n\t\tsuper();\n\n\t}", "constructor(){\r\n\t}", "init () {\n }", "function construct() { }", "function init() {\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor () {\n super();\n }", "function init () {\n // Here below all inits you need\n }", "transient private protected internal function m182() {}", "constructor (){}", "_initialize() {\n\n }", "init() {\n }", "init() {\n }", "init() {\n }", "function _ctor() {\n\t}", "function init() {\n\n }", "function init() {\n\n }", "function _init() {\n }", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "constructor() {\n super()\n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }" ]
[ "0.7161022", "0.6976652", "0.68866026", "0.67762905", "0.6746007", "0.6746007", "0.6746007", "0.6746007", "0.6746007", "0.6746007", "0.671666", "0.6706376", "0.6671625", "0.66642827", "0.66343075", "0.6632068", "0.66071916", "0.65947217", "0.65764874", "0.6542642", "0.65342003", "0.6530334", "0.6530334", "0.65052146", "0.6480177", "0.6480177", "0.6480177", "0.6480177", "0.6480177", "0.64796805", "0.64765507", "0.64585644", "0.6453862", "0.6453862", "0.6451868", "0.64232147", "0.64131373", "0.64131373", "0.6402897", "0.639946", "0.639001", "0.6379567", "0.63338715", "0.63338715", "0.63338715", "0.63228345", "0.6322818", "0.62954354", "0.6291771", "0.6258211", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.62461054", "0.6240569", "0.6230653", "0.6229863", "0.6225968", "0.6222862", "0.6219814", "0.6219814", "0.6219814", "0.6212847", "0.6205542", "0.6205542", "0.6201878", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.6199637", "0.61983544", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674", "0.6196674" ]
0.0
-1
TODO weapon ranks and stuff
canUseWeapon(w) { // if eqWeap == -1 then this.weapons[eqWeap] -> undefined let r = true; if (w === undefined) return false else if (this.hasSkill("noncombatant")) r = false; else if (w !== null && w.pref !== null && this.name != w.pref) r = false; return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomWeapon() {\r\n let array = [\r\n { weapon: \"Sword\", type: \"physical\", ability: \"randomInt(4, 12)\", deathNote: \"was sliced in half by a sword!\" },\r\n { weapon: \"Shovel\", type: \"physical\", ability:\"randomInt(3, 10)\", deathNote: \"got dugged by a shovel!\" },\r\n { weapon: \"Pistol\", type: \"ranged\", ability: \"randomInt(7, 20)\", deathNote: \"was shot by a pistol!\" },\r\n { weapon: \"Knife\", type: \"physical\", ability: \"randomInt(6, 9)\", deathNote: \"was stabbed in the throat!\" },\r\n { weapon: \"Shotgun\", type: \"ranged\", ability: \"randomInt(4, 12)\", deathNote: \"was blasted to rubble!\" },\r\n { weapon: \"Spear\", type: \"ranged\", ability: \"randomInt(1, 20) + randomInt(1, 10)\", deathNote: \"got pierced by a spear!\" },\r\n { weapon: \"Molotov\", type: \"ranged\", ability: \"randomInt(4, 7) + randomInt(4, 7)\", deathNote: \"screamed as fire from a broken molotov seared thy skin.\" },\r\n { weapon: \"Machine Gun\", type: \"ranged\", ability: \"randomInt(4, 5) + randomInt(6, 7) + randomInt(7, 8)\", deathNote: \"was ripped apart by bullets!\" },\r\n { weapon: \"Frying Pan\", type: \"magic\", ability: \"randomInt(10, 12)\", deathNote: \"was fried by a frying pan!\" },\r\n { weapon: \"Blood Magic\", type: \"magic\", ability: \"randomInt(0, 22)\", deathNote: \"was destroyed inside-out by inner blood turmoil!\" },\r\n { weapon: \"Laser Sword\", type: \"magic\", ability: \"randomInt(11, 13)\", deathNote: \"was cut in half by pure plasma!\" },\r\n { weapon: \"Grenade\", type: \"ranged\", ability: \"10\", deathNote: \"was blew up by a grenade!\" },\r\n { weapon: \"Shield\", type: \"physical\", ability: \"randomInt(7, 10) - 5\", deathNote: \"neck broke by getting bashed by a shield!\" },\r\n { weapon: \"Rocket Launcher\", type: \"physical\", ability: \"randomInt(20, 50) - 30\", deathNote: \"torn apart by a missle!\" },\r\n { weapon: \"Holy Cross\", type: \"magic\", ability: \"randomInt(1, 12) + 10\", deathNote: \"was smited by a holy might!\" },\r\n { weapon: \"Railgun\", type: \"ranged\", ability: \"randomInt(1, 100) - 40\", deathNote: \"was fried by a plasma beam!\" }\r\n ];\r\n\r\n let random = randomInt(0, array.length);\r\n return array[random];\r\n}", "function weaponExec(type, level)\n{\n switch(type)\n {\n case \"missili\":\n {\n switch(level)\n {\n case \"1\":\n {\n return fireMissile(1); \n }\n case \"2\":\n {\n var shoot = [];\n for (var i = 0; i < 3; i++){\n shoot[i] = fireMissile(2);\n };\n\n return (shoot[0] || shoot[1] || shoot[2]); \n }\n case \"3\":\n {\n var shoot = [];\n for (var i = 0; i < 7; i++){\n shoot[i] = fireMissile(3);\n };\n\n return (shoot[0] || shoot[1] || shoot[2] || shoot[3] || shoot[4] || shoot[5] || shoot[6]); \n }\n }\n }\n break;\n\n case \"scudo\":\n {\n raiseShield(level);\n return true;\n }\n break;\n\n\n case \"bomba\":\n {\n if(bombExplosion(level))\n {\n weaponCooldown = level*level*100;\n fireCooldown = level*level*50;\n \n return true;\n }\n else\n return false;\n }\n break;\n\n default:\n console.log(\"Arma non riconosciuta!\");\n return false;\n }\n}", "TakeWeapon() {\n super.TakeWeapon()\n return Weapons.GetRandomWeapon()\n }", "equipWeapon(name) {\n const weapon = name || \"fists\"\n this.equippedWeapon = Item.create(weapon)\n\n if (this.stored.weapon && this.stored.weapon !== \"fists\") {\n this.loot(this.stored.weapon)\n }\n\n this.stored.weapon = weapon\n }", "function equipWeapon(selection){\n\tplayer.weapon = armory[wList[selection]].weapon;\n}", "function addWeapon(w){\n\n\tif (w.name in armory){\n \tarmory[w.name].weapon.wquantity += 1;\n\t}\n\telse {\n\t\tw.wquantity = 1; //Make sure quantity is 1\n\t\tarmory[w.name] = { weapon: w }\n\t}\n}", "attackWith() {\r\n const randomWeaponIndex = Math.floor(Math.random() * 8);\r\n return this.weapons[randomWeaponIndex];\r\n }", "function equipWeapon(person) {\n /* ... */\n person.weapon = person.innElement[0];\n displaystats('weapon')\n return person;\n}", "function removeWeapon(w){\n\n\tif (w.name in armory){\n \tarmory[w.name].weapon.wquantity -= 1;\n\t}\n\n}", "function pickUpItem(person,weapon){\n person.inventory[person.inventory.length] = weapon;\n hero.inventory[hero.inventory.length] = weapon;\n return person;\n}", "function equipItem() {\r\n\tfor(var i = 0; i < playerBag.length; i++) {\r\n\t\tif(currItemCode == playerBag[i]) {\r\n\t\t\tcheckEquip();\r\n\t\t\tclosedVBox();\r\n\t\t\tgetArmorBonus();\r\n\t\t\t//getWeaponBonus(); <-- might use for magical weapons\r\n\t\t\tgetWeaponDmgBonus();\r\n\r\n\t\t}\r\n\t}\r\n}", "function weaponAssignments() {\n\trandomizeRoomsList();\n\troomsList.forEach(function(e){\n\t\troomWeaponsList.push([e, \"q-w34095-340958-sdf0983f\"]);\n\t});\n\trandomizeWeaponList();\n\tfor (let i=0; i<weaponsList.length; i++){\n\t\troomWeaponsList[i][1] = weaponsList[i];\n\t}\n\n}", "function generateRandomItem(){\n var itemChance = Math.floor(Math.random() * 4)\n // var currentItem\n if (itemChance === 0){\n player.hp += 200\n console.log('you got a bullet proof vest')\n console.log(`player hp: ${player.hp}`)\n } else if (itemChance === 1){\n player.hp += 50\n console.log('you got a first aid kit')\n console.log(`player hp: ${player.hp}`)\n } else if (itemChance === 2){\n player.weapons.push(items[2])\n console.log('you got a gun')\n } else if (itemChance === 3){\n player.weapons.push(items[3])\n console.log('you got a knife')\n } else if (itemChance === 4){\n player.hp += 50\n console.log('you got some scratch')\n }\n // return currentEnemy\n}", "function userWeapon(user, weapon) {\n // code here\n \n let listWeapon = [\n {name : 'redKnife', type : 'knife', attack : 100},\n {name : 'blackKnife', type : 'knife', attack : 300},\n {name : 'crimsonSword', type : 'katana', attack : 800},\n {name : 'moonLightSword', type : 'katana', attack : 400},\n {name : 'starKunai', type : 'kunai', attack : 80},\n {name : 'huumaShuriken', type : 'kunai', attack : 340},\n {name : 'emptyBracer', type : 'knuckle', attack : 20},\n {name : 'brokenArms', type : 'knuckle', attack : 40} \n ]\n \n let heroes = [\n {job : 'swordman', weapontype: 'knife, katana'},\n {job : 'ninja', weapontype: 'knife, kunai, katana'},\n {job : 'samurai', weapontype: 'knife, katana'},\n {job : 'monk', weapontype: 'knuckle'},\n ]\n\n\n for (let i = 0; i < listWeapon.length; i++) {\n for (let j = 0; j < heroes.length; j++) {\n if (weapon == listWeapon[i].name) {\n if (heroes[j].weapontype = listWeapon[i].type)\n return 'invalid weapon'\n }\n }\n }\n\n let weaponLama = 0\n let weaponBaru = 0 \n for (let i = 0; i < listWeapon.length; i++) {\n if (user.weapon == listWeapon[i].name) {\n weaponLama += listWeapon[i].attack\n }\n else if (weapon === listWeapon[i].name) {\n weaponBaru += listWeapon[i].attack\n }\n }\n\n let hasil = user.attack - weaponLama + weaponBaru\n return user.name + ' menggunakan senjata ' + weapon + ' attack menjadi ' + hasil\n}", "function weapon(){\n document.getElementById('weapon');\n pickUpItem(hero,{ type: 'banana skin', damage: 500});\n console.log(`Your weapon of choice is a ${hero.weapon.type}. Damage value = ${hero.weapon.damage}.`);\n//this is calling what is written in the original object. AHHHHHHHHH.\n}", "handleOnGoingSkills() {\n let gameInstance = this;\n for (let key in this.onGoingSkills) {\n let skill = gameInstance.onGoingSkills[key];\n let invoker = skill.invoker;\n\n if (skill.isSelfBuff) {\n gameInstance.toSend.push(invoker.name);\n invoker.KEYS.push('status')\n invoker.KEYS.push('tempBuff')\n }\n\n skill.duration -= 1 / server.tick_rate;\n if (skill.duration < 0) {\n if (skill.endEffect !== null) {\n skill.endEffect(gameInstance, invoker);\n }\n delete gameInstance.onGoingSkills[key];\n } else {\n skill.effect(gameInstance, invoker);\n }\n }\n\n // The reason we do it here is that we don't know who has been buffed\n // by aoe\n this.survivors.forEach(function (survivor) {\n gameInstance.calculatePlayerStatus(survivor.name);\n })\n }", "function weapon(person, enemy){\n\tif (person.weapon === true){\n\t\tif (enemy.pos === person.pos){\n\t\t\tenemy.health -= person.damage.special;\n\t\t} else {\n\t\t\tperson.health -= 1;\n\t\t}\n\t} else {\n\t\t// Alert that there is no weapon equipped\n\t\tconsole.log(\"You have no weapon equipped.\")\n\t}\n}", "function generateItems(){\n \n /////////////////////////////////////////ARMAS/////////////////////////////////\n for(var i = 0; i < 5; i++){\n switch(Math.floor(Math.random()*2)){\n case 0:\n var w = new WeaponItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200), 'pistol', 1, 500, 10, 'pistola');\n break;\n case 1:\n var w = new WeaponItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200),'ak-47', 0.25, 200, 30, 'metralleta');\n break;\n }\n while(map.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(w.sprite.x, w.sprite.y, 32, 32, map.layers[5]) !== null){\n w.sprite.x = Math.floor(Math.random()*2800 + 200);\n w.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(w.sprite);\n weaponItems.push(w);\n }\n \n //////////////////////////////////////////FIN ARMAS//////////////////////////////////\n \n ////////////////////////////////////////MUNICION/////////////////////////////////////\n for(var i = 0; i < 6; i++){\n switch(Math.floor(Math.random()*2)){\n case 0:\n var a = new AmmoItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200), 'pistol_ammo',10, 'pistola');\n break;\n case 1:\n var a = new AmmoItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200),'ak47_ammo',30, 'metralleta');\n break;\n }\n while(map.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(a.sprite.x, a.sprite.y, 32, 32, map.layers[5]) !== null){\n a.sprite.x = Math.floor(Math.random()*2800 + 200);\n a.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(a.sprite);\n ammoItems.push(a);\n }\n \n \n //////////////////////////////////////FIN MUNICION///////////////////////////////////////\n \n /////////////////////////////////////ESCUDO//////////////////////////////////////////////\n for(var i = 0; i < 4; i ++){\n var s = new ShieldItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200));\n while(map.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(s.sprite.x, s.sprite.y, 32, 32, map.layers[5]) !== null){\n s.sprite.x = Math.floor(Math.random()*2800 + 200);\n s.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(s.sprite);\n shieldItems.push(s);\n }\n //Comida\n for(var i = 0; i < 8; i++){\n var f = new FoodItem(Math.floor(Math.random()*2800 + 200), Math.floor(Math.random()*2800 + 200),'food');\n while(map.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[0]) === null ||\n \t\tmap.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[3]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[4]) !== null ||\n \t\tmap.tileMap.getTileWorldXY(f.sprite.x, f.sprite.y, 32, 32, map.layers[5]) !== null){\n f.sprite.x = Math.floor(Math.random()*2800 + 200);\n f.sprite.y = Math.floor(Math.random()*2800 + 200);\n }\n itemsGroup.add(f.sprite);\n foodItems.push(f);\n }\n \n //Por último, mandamos la info de los items al servidor\n //Para weapon y ammo se manda u array para el tipo y otro para las posiciones. Para el resto de los items solo se mandan las posiciones\n var weaponPos = new Array();\n var weaponType = new Array();\n var ammoPos = new Array();\n var ammoType = new Array();\n var foodPos = new Array();\n var shieldPos = new Array();\n \n for (var i = 0; i < 5; i++){\n \tweaponPos[i] = new Array();\n }\n for (var i = 0; i < 6; i++){\n ammoPos[i] = new Array();\n }\n \n for (var i = 0; i < 4; i++){\n\n shieldPos[i] = new Array();\n }\n for (var i = 0; i < 8; i++){\n foodPos[i] = new Array();\n }\n for (var i = 0; i < 5; i++){\n \tweaponType[i] =weaponItems[i].type;\n \tweaponPos[i][0] = weaponItems[i].sprite.x;\n \tweaponPos[i][1] = weaponItems[i].sprite.y;\n }\n \n for(var i = 0; i < 6; i++){\n \tammoType[i] = ammoItems[i].type;\n \tammoPos[i][0] = ammoItems[i].sprite.x;\n \tammoPos[i][1] = ammoItems[i].sprite.y;\n }\n \n for(var i = 0; i < 4; i++){\n \tshieldPos[i][0] = shieldItems[i].sprite.x;\n \tshieldPos[i][1] = shieldItems[i].sprite.y;\n }\n \n for(var i = 0; i < 8; i++){\n \tfoodPos[i][0] = foodItems[i].sprite.x;\n \tfoodPos[i][1] = foodItems[i].sprite.y;\n }\n sendItemsWS(weaponType, weaponPos, ammoType, ammoPos, shieldPos, foodPos);\n\n clearItems();\n}", "_prepareWeaponData(itemData, actorData) {\n const data = itemData.data;\n\n // Attack\n if (data.attackDice.length > 0) {\n let attacksplit = splitStatsAndBonus(data.attackDice);\n data.attackStats = attacksplit[0];\n data.attackArray = (attacksplit[1].length > 0 ? findTotalDice(attacksplit[1]) : null);\n data.canAttack = true;\n }\n else {\n data.attackStats = null;\n data.attackArray = null;\n data.canAttack = false;\n }\n // Defense\n if (data.defenseDice.length > 0) {\n let defensesplit = splitStatsAndBonus(data.defenseDice);\n data.defenseStats = defensesplit[0];\n data.defenseArray = (defensesplit[1].length > 0 ? findTotalDice(defensesplit[1]) : null);\n data.canDefend = true;\n }\n else {\n data.defenseStats = null;\n data.defenseArray = null;\n data.canDefend = false;\n }\n // Counter\n if (data.counterDice.length > 0) {\n let countersplit = splitStatsAndBonus(data.counterDice);\n data.counterStats = countersplit[0];\n data.counterArray = (countersplit[1].length > 0 ? findTotalDice(countersplit[1]) : null);\n data.canCounter = true;\n }\n else {\n data.counterStats = null;\n data.counterArray = null;\n data.canCounter = false;\n }\n // Spark\n if (data.useSpark && data.sparkDie.length > 0) {\n data.sparkArray = findTotalDice(data.sparkDie);\n data.canSpark = true;\n }\n else {\n data.sparkArray = null;\n data.canSpark = false;\n }\n // Effects\n if (data.effect.length > 0) {\n data.effectsSplit = splitStatString(data.effect);\n const foo = data.effectsSplit.findIndex(element => element.includes(\"damage\"));\n if (foo >= 0) {\n const bar = data.effectsSplit.splice(foo, 1);\n if (bar.length > 0) {\n const damage = parseInt(bar[0].slice(-1));\n data.damageEffect = isNaN(damage) ? 0 : damage;\n }\n }\n if (data.hasResist) {\n data.resistStats = splitStatString(data.specialResist);\n }\n }\n }", "function getItem() {\n if (player.hp > 0 && enemyIs === enemy[0]) {\n player.inventory.push(enemy[0].inventory++);\n console.log(\"That monster must have dropped this Blue Saphire Chain Linked Armor, it's yours now!\");\n walking();\n } else if (player.hp > 0 && enemyIs === enemy[1]) {\n player.inventory.push(enemy[1].inventory++);\n console.log(\"That monster must have dropped this Red Diamond Machete, it's yours now!\");\n walking();\n } else if (player.hp > 0 && enemyIs === enemy[2]) {\n player.inventory.push(enemy[2].inventory++);\n console.log(\"That monster must have dropped this Glowing Gold Sheild, it's yours now!\")\n walking();\n } else {\n walking();\n }\n }", "TakeWeapon() {\n this._on_cooldown = true\n this._PaintSpawn()\n this._last_use = Date.now()\n }", "function equipWeapon(hero){\n if (hero.inventory.length > 0){\n hero.weapon = hero.inventory[0];\n return hero;\n }\n}", "function equipWeapon(newWeapon){\n player.attack.base -= items.weapons[equipped.weapon].attack.base;\n player.attack.multiplier -= items.weapons[equipped.weapon].attack.multiplier;\n player.attack.plusser -= items.weapons[equipped.weapon].attack.plusser;\n\n equipped.weapon = newWeapon;\n\n player.attack.base += items.weapons[newWeapon].attack.base;\n player.attack.multiplier += items.weapons[newWeapon].attack.multiplier;\n player.attack.plusser += items.weapons[newWeapon].attack.plusser;\n\n updateAttack();\n}", "function checkWeapon(num) {\n let cell = $('.box[data-index=\"' + num + '\"]');\n if (cell.hasClass('weapon')) {\n if (cell.hasClass('wp-1')) {\n currentWeapon = 1;\n replaceWeaponOnMap(gun1.value, 'wp-1', num); // Weapon.js (39) Replace the weapon on the Grid\n replaceWeaponOnBoard(gun1.value); // Info.js (38) Replace the weapon information on the player's div\n return;\n }\n if (cell.hasClass('wp-2')) {\n currentWeapon = 2;\n replaceWeaponOnMap(sword1.value, 'wp-2', num);\n replaceWeaponOnBoard(sword1.value);\n return;\n }\n if (cell.hasClass('wp-3')) {\n currentWeapon = 3;\n replaceWeaponOnMap(sword2.value,'wp-3',num);\n replaceWeaponOnBoard(sword2.value); \n return;\n }\n if (cell.hasClass('wp-4')) {\n currentWeapon = 4;\n replaceWeaponOnMap(cupcake.value, 'wp-4', num);\n replaceWeaponOnBoard(cupcake.value);\n return;\n }\n if (cell.hasClass('wp-5')) {\n currentWeapon = 5;\n replaceWeaponOnMap(cake.value,'wp-5', num);\n replaceWeaponOnBoard(cake.value);\n return;\n }\n if (cell.hasClass('wp-6')) {\n currentWeapon = 6;\n replaceWeaponOnMap(gun2.value, 'wp-6', num);\n replaceWeaponOnBoard(gun2.value);\n return;\n }\n \n }\n if (cell.hasClass('quiz-1')) {\n cell.removeClass('quiz-1');\n initQuiz();\n return;\n }\n\n}", "function itemStats(items, champion) {\n for (let i = 0; i < items.length; i++) {\n let itemWanted = itemSearch(items[i]);\n if (itemWanted != undefined) {\n if (itemWanted.FlatHPPoolMod != null) {\n champion.health += itemWanted.FlatHPPoolMod;\n champion.bonushealth += itemWanted.FlatHPPoolMod;\n }\n if (itemWanted.FlatArmorMod != null) {\n champion.armor += itemWanted.FlatArmorMod;\n champion.bonusArmor += itemWanted.FlatArmorMod;\n } \n if (itemWanted.FlatSpellBlockMod != null) {\n champion.mr += itemWanted.FlatSpellBlockMod;\n champion.bonusMR += itemWanted.FlatSpellBlockMod;\n }\n if (itemWanted.PercentAttackSpeedMod != null && champion.bAtkSpeed != null) {\n champion.bAtkSpeed += itemWanted.PercentAttackSpeedMod;\n }\n if (itemWanted.FlatPhysicalDamageMod != null) {\n champion.bonusAD += itemWanted.FlatPhysicalDamageMod;\n }\n if (itemWanted.FlatMagicDamageMod != null) {\n champion.bonusAP += itemWanted.FlatMagicDamageMod;\n }\n if (itemWanted.FlatCritChanceMod != null && champion.crit != null) {\n champion.crit += itemWanted.FlatCritChanceMod;\n }\n if (itemWanted.FlatMPPoolMod != null) {\n champion.mana += itemWanted.FlatMPPoolMod;\n }\n }\n }\n}", "function computerWeapon(){\n let choices = ['ROCK','PAPER','SCISSOR'];\n return choices[Math.floor(Math.random() * choices.length)];\n}", "function randomizeRemainingWeapons(){\n\treturn roomWeaponsList[Math.floor(Math.random() * (roomWeaponsList.length))];\n}", "function Weapon(name, minDamage, maxDamage, criticalHit) {\n this.name = name;\n this.minDamage = minDamage;\n this.maxDamage = maxDamage;\n this.criticalHit = criticalHit;\n this.description = \"\";\n this.symbol = \"\";\n this.image = \"\";\n this.itemType = \"weapon\";\n}", "function weapon(type){\n\tthis.type = type;\n\tthis.weapons = [];\n\tthis.weapons = this.setWeapon()\n}", "function updateWeapon(char, i) {\n \tif (game.data.hovered_over === char.id) {\n \tvar index = $('input[name=equip]:checked').val();\n \tif (typeof index != 'undefined') {\n \tchar.equipped = char.weapons[index];\n \tgame.data.weap_range[i] = char.equipped.range;\n \t}\n \t}\n}", "function runGame() {\n var player = new Player(\"Joan\", 500, 30, 70);\n var zombie = new Zombie(40, 50, 20);\n var charger = new FastZombie(175, 25, 60);\n var tank = new StrongZombie(250, 100, 15);\n var spitter = new RangedZombie(150, 20, 20);\n var boomer = new ExplodingZombie(50, 15, 10);\n\n var shovel = new Weapon(\"shovel\", 15);\n var sandwich = new Food(\"sandwich\", 30);\n var chainsaw = new Weapon(\"chainsaw\", 25);\n\n player.takeItem(shovel);\n player.takeItem(sandwich);\n player.takeItem(chainsaw);\n player.discardItem(new Weapon(\"scythe\", 21));\n player.discardItem(shovel);\n player.checkPack();\n player.takeItem(shovel);\n player.checkPack();\n\n player.equippedWith();\n player.useItem(chainsaw);\n player.equippedWith();\n player.checkPack();\n\n player.useItem(shovel);\n player.equippedWith();\n player.checkPack();\n\n player.health = 487;\n console.log(\"Before health: \" + player.health);\n player.useItem(sandwich);\n console.log(\"After health: \" + player.health);\n player.checkPack();\n}", "function fight() {\n var rand = Math.random();\n //depending on item type, do different amounts of damage\n if (inventory.Items === \"Used Dagger\") {\n var dmg = (Math.floor(rand * 10) + 1);\n } else if (inventory.Items === \"Cool Mace\") {\n var dmg = (Math.floor(rand * 50) + 25);\n } else if (inventory.Items === \"AWESOME MAGIC SWORD OF SLAYING\") {\n var dmg = (Math.floor(rand * 50) + 75);\n }\n //subtract damage done from baddie\n baddie.hitPoints -= dmg;\n console.log(\"You attack the \" + baddie.type + \" with your \" + inventory.Items + \". You do \" + dmg + \" damage to the creature! It has \" + baddie.hitPoints + \" health left.\");\n //baddie death logic\n\n if (baddie.hitPoints > 0) {\n //if baddie is still alive, it attacks\n enemyAttack();\n } else {\n enemyDie();\n }\n}", "function checkEquip() {\r\n\tif(equippedWpn == true && currItemCategory == \"weapon\") {\r\n\t\tfor(var i = 0; i < playerBag.length; i++) {\r\n\t\t\tif(equippedWpnArr[0] == playerBag[i]) {\r\n\t\t\t\tget(\"item\" + i).style.color = \"white\";\r\n\t\t\t\tequippedWpnArr.splice(0, 1); //remove equipped wpn from array.\r\n\t\t\t\tequippedWpn = false;\r\n\t\t\t\tcheckEquip();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if(equippedArmor == true && currItemCategory == \"armor\") {\r\n\t\tfor(var i = 0; i < playerBag.length; i++) {\r\n\t\t\tif(equippedArmorArr[0] == playerBag[i]) {\r\n\t\t\t\tget(\"item\" + i).style.color = \"white\";\r\n\t\t\t\tequippedArmorArr.splice(0, 1); //remove equipped armor from array.\r\n\t\t\t\tequippedArmor = false;\r\n\t\t\t\tcheckEquip();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if(equippedWpn == false && currItemCategory == \"weapon\") {\r\n\t\tfor(var i = 0; i < playerBag.length; i++) {\r\n\t\t\tif(currItemCode == playerBag[i]) {\r\n\t\t\t\tget(\"item\" + i).style.color = \"#00ff55\";\r\n\t\t\t\tequippedWpnArr.push(currItemCode);\r\n\t\t\t\tequippedWpn = true;\r\n\t\t\t\tget(\"bottom-display\").innerHTML = \"You equip the \" + currItemName + \".\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if(equippedArmor == false && currItemCategory == \"armor\") {\r\n\t\tfor(var i = 0; i < playerBag.length; i++) {\r\n\t\t\tif(currItemCode == playerBag[i]) {\r\n\t\t\t\tget(\"item\" + i).style.color = \"#00ff55\";\r\n\t\t\t\tequippedArmorArr.push(currItemCode);\r\n\t\t\t\tequippedArmor = true;\r\n\t\t\t\tget(\"bottom-display\").innerHTML = \"You equip the \" + currItemName + \".\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function buyHandWeapon(weap){\n let weapon= handWeapons[weap]\n if(weapon.cost.length == 0){\n return '';\n }\n if(canPurchase(weapon.cost[0])){\n weapon.quantity += 1\n player.heldWeapon = weap\n weapon.cost.splice(0,1)\n\n }\n}", "function replaceWeaponOnMap(value, weapon, num) {\n let cell = $('.box[data-index=\"' + num + '\"]');\n whoIsActive();// Weapon.js (136) Check which player is active\n cell.removeClass(weapon).addClass(playerActive.weapon);\n playerActive.weapon = weapon; \n playerNotActive.power = value; \n}", "function pickUpWeapon(weapon, player) {\n // console.log(\"pickUpWeapon\");\n if (player.weapon != undefined) {\n weapons.push(player.weapon);\n player.weapon.currentPos = player.currentPos;\n player.weapon.isHidden = false;\n }\n player.weapon = weapon; //instance of the player and weapon object\n\n weapon.isHidden = true;\n}", "function weaponsCapUp(party) {\n const MAX_DMG_CAP_UP_BOOST = 20;\n const MAX_GAMMA_BOOST = 15; // Verification needed: is this a real limit?\n const MAX_NORMAL_SENTENCE_BOOST = 30; // Normal Sentence and Glory.\n const MAX_OMEGA_SENTENCE_BOOST = 30;\n const MAX_EXCELSIOR_BOOST = 30;\n const MAX_SHARED_SENTENCE_BOOST = 60; // Sentence, Glory, and Excelsior.\n let dmgCapUpBoost = 0;\n let gammaBoost = 0; // Boost from Ultima or Dark Opus gamma skills.\n let normalSentenceBoost = 0; // Normal Sentence and Glory.\n let omegaSentenceBoost = 0;\n let excelsiorBoost = 0;\n let sharedSentenceBoost = 0; // Sentence, Glory, and Excelsior.\n\n // Get the relevant summon auras and convert them from %s\n // to actual multipliers.\n let [normalMultiplier, omegaMultiplier] = summonAuras(party);\n normalMultiplier = 1 + normalMultiplier / 100;\n omegaMultiplier = 1 + omegaMultiplier / 100;\n\n for (let weapon of party.otherWeapons) {\n if (weapon.enabled) {\n switch (weapon.data.key) {\n case WeaponTypes.DMG_CAP_UP.key:\n dmgCapUpBoost += weapon.data.value;\n break;\n\n case WeaponTypes.ULTIMA_GAUPH_KEY_GAMMA.key:\n case WeaponTypes.DARK_OPUS_GAMMA_PENDULUM.key:\n // These skills do not stack. Use the max value instead.\n //\n // Note: since these skills' values are always 15%,\n // it is unknown whether they don't stack,\n // or whether they stack but are capped at 15% total,\n // or both.\n // This code implements both to match what's written on gbf.wiki.\n gammaBoost = Math.max(gammaBoost, weapon.data.value);\n break;\n\n case WeaponTypes.NORMAL_SENTENCE.key:\n case WeaponTypes.NORMAL_GLORY.key:\n normalSentenceBoost += weapon.data.value * normalMultiplier;\n break;\n\n case WeaponTypes.OMEGA_SENTENCE.key:\n omegaSentenceBoost += weapon.data.value * omegaMultiplier;\n break;\n\n case WeaponTypes.EXCELSIOR.key:\n excelsiorBoost += weapon.data.value;\n break;\n\n default:\n // Weapon does not affect charge attack damage cap. Do nothing.\n break;\n }\n }\n }\n\n dmgCapUpBoost = Math.min(dmgCapUpBoost, MAX_DMG_CAP_UP_BOOST);\n gammaBoost = Math.min(gammaBoost, MAX_GAMMA_BOOST);\n normalSentenceBoost = Math.min(normalSentenceBoost, MAX_NORMAL_SENTENCE_BOOST);\n omegaSentenceBoost = Math.min(omegaSentenceBoost, MAX_OMEGA_SENTENCE_BOOST);\n excelsiorBoost = Math.min(excelsiorBoost, MAX_EXCELSIOR_BOOST);\n sharedSentenceBoost = normalSentenceBoost + omegaSentenceBoost + excelsiorBoost;\n sharedSentenceBoost = Math.min(sharedSentenceBoost, MAX_SHARED_SENTENCE_BOOST);\n\n return dmgCapUpBoost + gammaBoost + sharedSentenceBoost;\n}", "function randomType() {\r\n let array = [\r\n { personality: \"Brawny\", bonus: \"if (players[attacker].wep.type == 'physical'){temp += 5}\", applied: 'offense' }, // if attacker's weapon is physical, damage + 5,\r\n { personality: \"Vampire\", bonus: \"if (players[attacker].wep.type == 'magic'){temp += 5}\", applied: 'offense' }, // if attacker's weapon is physical, damage + 5,\r\n { personality: \"Clown\", bonus: \"if (players[attacker].hp <= 10){temp += 8}\", applied: '' }, // If attacker is bellow ten hp, damage + 8\r\n { personality: \"Smart\", bonus: \"if (players[defender].type.personality == 'Dumb'){temp += 15}\", applied: 'offense' }, // if defender personality is dumb, damage + 15\r\n { personality: \"Dumb\", bonus: \"if (players[attacker].hp >= '10'){temp += 5}\", applied: 'offense' }, // if attacker is above ten HP, damage + 5\r\n { personality: \"Saiyan\", bonus: \"if (randomInt(1, 10) > 5){temp += 5}\", applied: 'offense' }, // If random number from 1-10 above 5, + 5 damage.\r\n { personality: \"Paladin\", bonus: \"if (players[defender].hp < 10){temp -= 5}\", applied: 'defence' }, // if defender bellow ten hp, + 5 shield\r\n { personality: \"Ailen\", bonus: \"if (players[defender].hp > 20){temp -= 3}\", applied: 'defence' }, // if defender above 20 HP, shield + 3\r\n { personality: \"Slave\", bonus: \"if (players[attacker].type.personality == 'Clown'){temp += 15}\", applied: 'offense' }, // If attacker personality is clown, + 15 damage\r\n { personality: \"Military\", bonus: \"if (players[attacker].wep.weapon == 'ranged'){temp += 5}\", applied: 'offense' }, // if weapon is ranged, + 5 damage\r\n { personality: \"Brain Dead\", bonus: \"if (randomInt(0, 10) < 5){temp -= 10}\", applied: 'offense' }, // if a number between 1 and 10 bellow 5, opponet shield += 10\r\n ]\r\n\r\n let random = randomInt(0, array.length);\r\n return array[random];\r\n}", "function addWeapon(matches, msg){\r\n //if nothing was selected and the player is the gm, quit\r\n if(msg.selected == undefined || msg.selected == []){\r\n if(playerIsGM(msg.playerid)){\r\n whisper('Please carefully select who we are giving this weapon to.', {speakingTo: msg.playerid});\r\n return;\r\n }\r\n }\r\n\r\n var name = matches[1];\r\n var ammoStr, quantity;\r\n if(matches[2]) ammoStr = matches[2];\r\n if(matches[3]) quantity = matches[3];\r\n var suggestion = '!addWeapon $';\r\n if(ammoStr) suggestion += '(' + ammoStr + ')';\r\n if(quantity) suggestion += '[x' + quantity + ']';\r\n var weapons = suggestCMD(suggestion, name, msg.playerid);\r\n if(!weapons) return;\r\n var weapon = weapons[0];\r\n var myPromise = new Promise(function(resolve){\r\n var inqweapon = new INQWeapon(weapon, function(){\r\n resolve(inqweapon);\r\n });\r\n });\r\n\r\n myPromise.catch(function(e){log(e)});\r\n myPromise.then(function(inqweapon){\r\n if(ammoStr){\r\n var ammoSuggestion = '!addWeapon ' + name + '($)';\r\n if(quantity) ammoSuggestion += '[x' + quantity + ']';\r\n var clips = suggestCMD(ammoSuggestion, ammoStr.split(','), msg.playerid);\r\n if(!clips) return;\r\n var ammoNames = [];\r\n for(var clip of clips){\r\n ammoNames.push(clip.get('name'));\r\n }\r\n }\r\n\r\n eachCharacter(msg, function(character, graphic){\r\n var characterPromise = new Promise(function(resolve){\r\n new INQCharacter(character, graphic, function(inqcharacter){\r\n resolve(inqcharacter);\r\n });\r\n });\r\n\r\n characterPromise.catch(function(e){log(e)});\r\n characterPromise.then(function(inqcharacter){\r\n if(inqweapon.Class != 'Gear'){\r\n insertWeaponAbility(inqweapon, character, quantity, ammoNames, inqcharacter);\r\n } else {\r\n whisper('Add Weapon is not prepared to create an Ability for Gear.', {speakingTo: msg.playerid, gmEcho: true});\r\n }\r\n\r\n whisper('*' + inqcharacter.toLink() + '* has been given a(n) *' + inqweapon.toLink() + '*', {speakingTo: msg.playerid, gmEcho: true});\r\n });\r\n });\r\n });\r\n}", "function Weapon() {\r\n this.name;\r\n this.type;\r\n}", "function collectWeapon(activePlayer, currentPlayerCell, newPlayerCell) {\n let dropWeapon = (cell) => {\n let currentWeaponType = activePlayer.weapon.type;\n activePlayer.weapon = defineWeapon($(`[cell = ${cell}]`).attr('type'));\n $(`[cell = ${cell}]`).removeAttr('type').attr('type', `${currentWeaponType}`);\n $(`#${activePlayer.character}Weapon`).attr('src', `images/${activePlayer.weapon.type}.png`);\n $(`#${activePlayer.character}WeaponDamage`).text(`Damage Point: ${activePlayer.weapon.damage}`);\n }\n\n if (newBoard.leftCells.includes(newPlayerCell)) {\n for (let i = 0; i < (currentPlayerCell - newPlayerCell); i++) {\n if ($(`[cell = ${newPlayerCell + i}]`).hasClass('weapon')) {\n dropWeapon(newPlayerCell + i);\n break;\n }\n }\n }\n\n else if (newBoard.rightCells.includes(newPlayerCell)) {\n for (let i = 0; i < (newPlayerCell - currentPlayerCell); i++) {\n if ($(`[cell = ${newPlayerCell - i}]`).hasClass('weapon')) {\n dropWeapon(newPlayerCell - i);\n break;\n }\n }\n }\n\n else if (newBoard.upperCells.includes(newPlayerCell)) {\n for (let i = 0; i < ((currentPlayerCell - newPlayerCell) / newBoard.columns); i++) {\n if ($(`[cell = ${newPlayerCell + (newBoard.columns * i)}]`).hasClass('weapon')) {\n dropWeapon(newPlayerCell + (newBoard.columns * i));\n break;\n }\n }\n }\n\n else if (newBoard.lowerCells.includes(newPlayerCell)) {\n for (let i = 0; i < ((newPlayerCell - currentPlayerCell) / newBoard.columns); i++) {\n if ($(`[cell = ${newPlayerCell - (newBoard.columns * i)}]`).hasClass('weapon')) {\n dropWeapon(newPlayerCell - (newBoard.columns * i));\n break;\n }\n }\n }\n }", "function equipWeapon(person){\n person.inventory.length === 0 ? null : person.weapon = person.inventory[0]\n}", "createPlayers() {\r\n var sword = new Weapon(\"sword\");\r\n var chakram = new Weapon(\"chakram\");\r\n var Axe = new Weapon(\"Axe\");\r\n var boStaff = new Weapon(\"boStaff\");\r\n var shotgun = new Weapon(\"Shotgun\");\r\n var glove = new Weapon(\"Infinity Gauntlet\");\r\n var grenade = new Weapon(\"Grenade\");\r\n var dreambow = new Weapon(\"Dream Bow\");\r\n\r\n var heWasNumberOne = new Player();\r\n var queen = new Player();\r\n var ironProf = new Player();\r\n var lightning = new Player();\r\n var bigLou = new Player();\r\n var Kurgan = new Player();\r\n /*populate cache and players arrays*/\r\n\r\n const weaponNames = [\"sword\", \"shotgun\", \"glove\", \"grenade\", \"dreambow\", \"Axe\", \r\n\"boStaff\", \"chakram\"];\r\n const weaponsCache = [];\r\n weaponNames.map(weaponName => weaponsCache.push(new Weapon(weaponName)));\r\n\r\n const playerNames = [\"Smitty Werbenjagermanjensen\", \"Ice Queen\", \"Iron Professor\", \"lightning bolt\", \"big Lou\", \"Wild Kurgan\"];\r\n playerNames.map(playerName => this.players.push(new Player(playerName, weaponsCache)));\r\n\r\n }", "attack() {\n return 'attacks with ' + this.weapon;\n }", "function inventory() { }", "handleLootDistribution (reactionInfo, battle) {\r\n let players = Util.getEffectiveCharacters(this.players).players;\r\n let empty = false;\r\n if (!battle.itemsToDistribute) {\r\n // Battle just finished, generate the listo\r\n battle.itemsToDistribute = [].concat(...battle.graveyard.filter(dead => !dead.controller).map(dead => dead.items));\r\n if (players.length === 1 && battle.itemsToDistribute.length > 0) {\r\n battle.itemsToDistribute.forEach(item => {\r\n item.equipped = false;\r\n item.owner = players[0];\r\n });\r\n players[0].items.push(...battle.itemsToDistribute);\r\n let lootList = Util.formattedList(Util.reduceList(battle.itemsToDistribute.map(item => Util.getDisplayName(item))));\r\n battle.itemsToDistribute = [];\r\n this.send('It looks like you\\'re the only person around, so you get all the loot (' + lootList + ')! Drop what you don\\'t need later.');\r\n empty = true;\r\n } else if (battle.itemsToDistribute.length > 0) {\r\n this.send('Welcome to ***Need or Greed***, the show where bodies are looted, RNG is rampant, and most importantly, the contribution to the previous fight *doesn\\'t matter.*');\r\n this.send('Let\\'s get started!');\r\n } else {\r\n empty = true;\r\n }\r\n } else {\r\n // Reaction comes in, let's see if we need to run the distribution\r\n let {messageReaction, react, user, reactions } = reactionInfo;\r\n if (react === '✅') {\r\n let options = Util.getSelectedOptions(reactions, ['🙆', '🤷', '🙅'], user.id);\r\n if (options.length === 0) {\r\n // No option provided!\r\n this.send(`Please select a roll ${Util.getMention(user.id)}!`);\r\n messageReaction.remove(user);\r\n return;\r\n } else if (options.length > 1) {\r\n // Too many options provided!\r\n this.send(`Too many roll choices ${Util.getMention(user.id)}! Only one pls!`);\r\n messageReaction.remove(user);\r\n return;\r\n } else {\r\n // Let us consume...\r\n const need = reactions.get('🙆').users.keyArray().filter(userId => this.playerIds.includes(userId));\r\n const greed = reactions.get('🤷').users.keyArray().filter(userId => this.playerIds.includes(userId));\r\n const pass = reactions.get('🙅').users.keyArray().filter(userId => this.playerIds.includes(userId));\r\n if (need.length + greed.length + pass.length < players.length) return;\r\n let checkArray = need.length > 0 ? need : greed;\r\n if (checkArray.length === 0) {\r\n this.send(`What? Nobody wants this? Well, I guess ravens can have it then.`);\r\n battle.itemsToDistribute.shift();\r\n } else {\r\n let winner = null;\r\n do {\r\n let chances = checkArray.map(id => Math.random());\r\n let maxChance = null;\r\n let maxChancePos = null;\r\n for (let i = 0; i < chances.length; i++) {\r\n if (maxChance < chances[i]) {\r\n maxChance = chances[i];\r\n maxChancePos = i;\r\n } else if (maxChance === chances[i]) {\r\n maxChancePos = null;\r\n break;\r\n }\r\n }\r\n winner = maxChancePos;\r\n } while (winner === null);\r\n // We have a winner!\r\n let winnerPlayer = players.find(player => player.controller === checkArray[winner]);\r\n this.send(Util.getDisplayName(winnerPlayer) + ' wins! Enjoy!');\r\n let item = battle.itemsToDistribute.shift();\r\n console.log(battle.itemsToDistribute);\r\n item.owner = winnerPlayer;\r\n item.equipped = false;\r\n winnerPlayer.items.push(item);\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n if (battle.itemsToDistribute.length > 0) {\r\n let itemToGive = battle.itemsToDistribute[0];\r\n this.send('Who wants a *' + Util.getDisplayName(itemToGive) + '?* ' + Util.getNeedOrGreedStartText() +\r\n '\\n\\n*Here\\'s the info:*\\n' + itemToGive.getItemDetails() + '\\n\\n' +\r\n 'Press 🙆 to roll Need, 🤷 to roll Greed, or 🙅 to pass.\\nWhen you\\'re ready, press ✅', ['🙆', '🤷', '🙅', '✅'], true);\r\n } else if (!empty) {\r\n this.send('Show\\'s over folks!');\r\n }\r\n }", "function computerPlay(){\r\n let weapon = ['rock','paper','scissors']\r\n let selection = Math.floor(Math.random() * (3 - 0) + 0)\r\n\r\n return weapon[selection]\r\n}", "addM16Weapon()\n {\n this.m16Weapon.available=true;\n }", "function getWeaponDmgBonus() {\r\n\tif(equippedWpn == true) {\r\n\t\tfor(var i = 0; i < itemStorageArray.length; i++) {\r\n\t\t\tif(equippedWpnArr[0] == itemStorageArray[i].code) {\r\n\t\t\t\tweaponDmgBonus = itemStorageArray[i].effect;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tweaponDmgBonus = 0;\r\n\t}\r\n}", "function applyWeaponMod(weapon, type, a) { // a = awesomeness\n\tvar pcs = { damage: 0, range: 0, energy: 0, rate: 0 }, afire = false, name = type\n\tswitch (type) {\n\t\tcase \"Smart\": afire = true ; break\n\t\tcase \"HighPowered\": pcs.damage = a ; name = \"High-Powered\" ; break\n\t\tcase \"Accurate\": pcs.range = a ; break\n\t\tcase \"Efficient\": pcs.energy = -a ; break\n\t\tcase \"SuperCooled\": pcs.rate = a ; break\n\t\tcase \"Overclocked\": pcs.damage = a ; pcs.energy = a ; name = \"Over-clocked\" ; break\n\t\tcase \"RapidFire\": pcs.rate = a ; pcs.damage = -a ; name = \"Rapid-fire\" ; break\n\t\tcase \"Scoped\": pcs.range = a ; pcs.rate = -Math.floor(a/2) ; break\n\t\tcase \"Assault\": pcs.damage = a ; pcs.energy = a ; pcs.range = -(5-Math.floor(a/2)) ; break\n\t\tcase \"Autofiring\": pcs.damage = a-5 ; afire = true ; name = \"Auto-firing\" ; break\n\t\tcase \"MasterCrafted\": pcs.energy = -a ; pcs.range = a ; break\n\t\tcase \"Holy\": pcs.damage = a*2 ; pcs.range = a ; break\n\t\tcase \"BOSS\": pcs.damage = (a+1)*(a+1) ; pcs.range = a*2 ; pcs.rate = a*2 ; pcs.energy = -3*a ; afire = true ; break\n\t}\n\tfor (var t in pcs) {\n\t\tif (pcs[t]) weapon.percentages[t] += (pcs[t] + UFX.random(-0.5, 0.5)) * 10\n\t}\n\tif (afire) {\n\t\tweapon.canAutofire = true\n\t\tweapon.mode = \"Autofire\"\n\t}\n\tweapon.modList.push([name, a])\n}", "if (!this.chosenBuffIndex) {\n // If Imperial Industry is chosen, we're just going to add it to the list of applicable\n // buffs for a unit\n // We have to make it hard to earn though so we'll need to roll to even add it to the list\n if (this.props.rewardImperialIndustryEarned) {\n // Just use a 50% chance, since the buff gets added to the group list which has to roll again\n // This is probably a really bad place to do this but I'll leave this refactor for a future\n // date\n if (roll(50)) {\n groupBuffList.push('imperialIndustry');\n }\n }\n this.chosenBuffIndex = random(0, groupBuffList.length - 1);\n }", "function C007_LunchBreak_Natalie_NatalieRelease() {\r\n ActorRemoveInventory(\"TapeGag\");\r\n if (ActorHasInventory(\"Ballgag\")) {\r\n ActorRemoveInventory(\"Ballgag\");\r\n PlayerAddInventory(\"Ballgag\", 1);\r\n }\r\n if (ActorHasInventory(\"ClothGag\")) {\r\n ActorRemoveInventory(\"ClothGag\");\r\n PlayerAddInventory(\"ClothGag\", 1);\r\n }\r\n C007_LunchBreak_Natalie_IsGagged = false;\r\n if (ActorHasInventory(\"Rope\")) {\r\n ActorRemoveInventory(\"Rope\");\r\n PlayerAddInventory(\"Rope\", 1);\r\n if (C007_LunchBreak_Natalie_TwoRopes) {\r\n PlayerAddInventory(\"Rope\", 1);\r\n C007_LunchBreak_Natalie_TwoRopes = false;\r\n }\r\n }\r\n C007_LunchBreak_Natalie_IsRoped = false;\r\n if (ActorHasInventory(\"Blindfold\")) {\r\n ActorRemoveInventory(\"Blindfold\");\r\n PlayerAddInventory(\"Blindfold\", 1);\r\n }\r\n C007_LunchBreak_Natalie_IsBlindfolded = false;\r\n}", "constructor(name, sprite, xm, actions,hp,atk,def,spd,luck,itemProb) {\n this.name = name\n this.sprite = sprite;\n this.acc = 0.85\n this.hp = hp\n this.atk = atk\n this.def = def\n this.spd = spd\n this.luck = luck\n this.actions = actions;\n this.xm = xm\n this.itemProb = itemProb\n }", "function setBuyableWeapon(weapon,x,y){\n\tthis.weapon = weapon\n\tthis.pos = [];\n\tthis.pos ={x:x,y:y}\n}", "function bsmRandomWeapon(){\n\tif(GC >= bsmRandomWeaponCost){\n\t\tspendCurrency(bsmRandomWeaponCost);\n\t\tvar weaponHold = randomWeapon();\n\t\taddLogText(\"The Blacksmith forged: <label class='rarity\" + weaponHold.rarity + \"'>\" + weaponHold.name + \"</label>!\");\n\t\texchangeWeapon(weaponHold);\n\t}\n\tupdateBlacksmith();\n}", "function enemizer_check(i) {\n\t\t//All possible required items to kill a boss\n\t\tif (melee() && items.hookshot && items.icerod && items.firerod) return 'available';\n\t\tif (!melee_bow() && !rod() && !cane() && items.boomerang === 0) return 'unavailable';\n\t\tif (i === 10) {\n\t\t\tif (flags.bossshuffle != 'N') return 'possible';//Don't know which bosses are in GT\n\t\t\treturn melee() ? 'available' : 'unavailable';\n\t\t}\n\t\tswitch (enemizer[i]) {\n\t\t\tcase 0:\n\t\t\tcase 11:\n\t\t\t\treturn (flags.bossshuffle != 'N' ? 'possible' : 'available');\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tif (items.sword > 0 || items.hammer || items.bow > 1 || items.boomerang > 0 || items.byrna || items.somaria || items.icerod || items.firerod) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif (melee_bow() || cane() || rod() || items.hammer) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tif (items.sword > 0 || items.hammer) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tif (items.sword > 0 || items.hammer || items.bow > 1) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tif (items.hookshot && (items.sword > 0 || items.hammer || (items.bow > 1 && (items.firerod || items.icerod))) || ((items.firerod || items.icerod) && items.bottle > 1 || (items.bottle > 0 && items.magic))) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tif (items.sword > 0 || items.hammer || items.firerod || items.byrna || items.somaria) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tif (items.sword > 0 || items.hammer || items.somaria || items.byrna) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tif (items.firerod || (items.bombos && (items.sword > 0 || (flags.swordmode === 'S' && items.hammer)))) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tif (melee_bow() || items.hammer) return 'available';\n\t\t\t\tbreak;\n\t\t\tcase 10:\n\t\t\t\tif (items.firerod && items.icerod && (items.hammer || items.sword > 0)) return 'available';\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t}\n\t\treturn 'unavailable';\n\t}", "function selectItem(num){\n if (inventstage.split(\"_\")[0] !== \"toolbelt\") {\n if (num == 0) { selected = slot1.textContent.split(\":\")[0] }\n if (num == 1) { selected = slot2.textContent.split(\":\")[0] }\n if (num == 2) { selected = slot3.textContent.split(\":\")[0] }\n console.log(\"Selected: \" + selected);\n updateInvent(null, null, true, true);\n }\n else if (!combatActive[0])\n {\n if (num == 0) {selected = slot1.textContent.split(\":\")[0]}\n if (num == 1) {selected = slot2.textContent.split(\":\")[0]}\n if (num == 2) {selected = slot3.textContent.split(\":\")[0]}\n for(itemlist in toolbelt){\n //console.log(itemlist);\n for(i = 0; i < toolbelt[itemlist].length; i++)\n {\n //console.log(item);\n if (selected === toolbelt[itemlist][i].name) {\n if (money >= toolbelt[itemlist][i].cost[0] && toolbelt[itemlist][i].level > 0) {\n if(toolbelt[itemlist][i].level < entities[\"player\"][\"xp\"][\"level\"]){\n money -= toolbelt[itemlist][i].cost[0];\n toolbelt[itemlist][i].cost[0] += toolbelt[itemlist][i].cost[1];\n if (inventstage.split(\"_\")[1] === \"weapons\") {\n //console.log(toolbelt[itemlist][i].speed[0]);\n //console.log(toolbelt[itemlist][i].speed[1]);\n //console.log(toolbelt[itemlist][i].speed[0] + toolbelt[itemlist][i].speed[1]);\n toolbelt[itemlist][i].speed[0] += toolbelt[itemlist][i].speed[1];\n //Now that's a lota daamage!!\n toolbelt[itemlist][i].damage[0] += toolbelt[itemlist][i].damage[1];\n if(i==1){\n toolbelt[itemlist][i].maCost[0] += toolbelt[itemlist][i].maCost[1];\n }\n }\n if (inventstage.split(\"_\")[1] === \"tools\") {\n toolbelt[itemlist][i].efficiency[0] += toolbelt[itemlist][i].efficiency[1];\n }\n if (inventstage.split(\"_\")[1] === \"apparel\") {\n toolbelt[itemlist][i].ac[0] += toolbelt[itemlist][i].ac[1];\n }\n toolbelt[itemlist][i].level += 1;\n console.log(\"Upgraded: \" + selected);\n\n equipped = [\"\", \"\"];\n updateInvent(null, null, true, true);\n } else{\n desc.textContent = \"You need to level up to upgrade \"+selected;\n }\n\n }\n else\n {\n desc.textContent = \"Not enough funds to upgrade \"+selected;\n }\n }\n\n }\n }\n }\n else\n {\n if (num == 0) {selected = slot1.textContent.split(\":\")[0]} if (num == 1) {selected = slot2.textContent.split(\":\")[0]} if (num == 2) {selected = slot3.textContent.split(\":\")[0]}\n if (inventstage.split(\"_\")[1] === \"weapons\") {\n for (i in toolbelt.weapons)\n {\n if (toolbelt.weapons[i].name === selected)\n {\n if (toolbelt.weapons[i].wc === \"w\" && toolbelt.weapons[i].level > 0) {\n let equip = toolbelt.weapons[i];\n toolbelt.weapons.splice(i, 1);\n toolbelt.weapons.splice(0, 0, equip);\n }\n if (toolbelt.weapons[i].wc === \"s\" && toolbelt.weapons[i].level > 0) {\n let equip = toolbelt.weapons[i];\n toolbelt.weapons.splice(i, 1);\n toolbelt.weapons.splice(1, 0, equip);\n }\n }\n }\n }\n if (inventstage.split(\"_\")[1] === \"apparel\") {\n for (i in toolbelt.apparel) {\n if (toolbelt.apparel[i].name === selected) {\n if (toolbelt.apparel[i].level > 0)\n {\n let equip = toolbelt.weapons[i];\n toolbelt.weapons.splice(i, 1);\n toolbelt.weapons.splice(0, 0, equip);\n }\n }\n }\n }\n entities.player.armor = toolbelt.apparel[0];\n entities.player.weapon = toolbelt.weapons[0];\n entities.player.spell = toolbelt.weapons[1];\n updateInvent(null);\n }\n}", "render () {\n const { willpower, willpowerMax, title, active } = this.props.weapon;\n return (\n <div className=\"weapon\">\n <div className=\"stats\">\n Willpower: {willpower} / {willpowerMax}\n <br />\n <br />\n Title: {title}\n <br />\n </div>\n <br />\n <div className=\"actions\">\n <Action action={active}/>\n </div>\n <div className=\"passives\">\n Passive?\n </div>\n <br />\n <div className=\"upgrades\">\n Skill Tree!\n </div>\n </div>\n )\n }", "function enemyAttack() {\n //depending on baddie type, deal different damage\n if (baddie.type === \"Ancient Dragon\") {\n var dmg = (Math.floor((Math.random() * 20)) + 30);\n } else if (baddie.type === \"Prowler\") {\n var dmg = (Math.floor((Math.random() * 20)) + 15);\n } else {\n var dmg = (Math.floor((Math.random() * 20)) + 5);\n }\n //subtract dmg from inventory.Health\n inventory.Health -= dmg;\n console.log(\"The \" + baddie.type + \" hits you for \" + dmg + \"! You now have \" + inventory.Health + \" health left!\")\n //player death logic\n if (inventory.Health > 0) {\n //if player is still alive, they can run or fight\n fightOrFlight();\n } else {\n die();\n }\n}", "function equipWeapon(hero) {\n // And reassigns the `weapon` property to the first element of the inventory array\n\n // alert(JSON.stringify(hero.inventory[0], null, 4)); // debugging objects with alart\n let currentWeapon = hero.weapon; // Get current weapon\n hero.inventory.push(currentWeapon); // Put current weapon in the inventory as last item\n\n let getFirstItemOfinventory = hero.inventory[0]; // Get the first weapon out of the inventory\n hero.weapon = getFirstItemOfinventory // Assign the weapon as the current / active weapon\n\n hero.inventory.shift(weapon); // Removed the assigned weapon from the inventory\n\n console.log(hero);\n\n}", "function Weapon(name, type){\n this.name = name;\n this.type = type;\n}", "function getWpnDmg() {\r\n\tvar wpn = equippedWpnArr[0]; //player wpn\r\n\tvar wpnDmg = 0;\r\n\tfor(var i = 0; i < itemStorageArray.length; i++) {\r\n\t\tif(wpn == itemStorageArray[i].code) {\r\n\t\t\twpnDmg = itemStorageArray[i].effect;\r\n\t\t\tif(wpnDmg == \"1-2\") {\r\n\t\t\t\twpnDmg = randomIntFromInterval(1, 2);\r\n\t\t\t}\r\n\t\t\telse if(wpnDmg == \"2-4\") {\r\n\t\t\t\twpnDmg = randomIntFromInterval(2, 4);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn wpnDmg;\r\n}", "handleSkill(name, skillParams) {\n const obj = this.objects[name];\n let { skillNum, position } = skillParams;\n let skill = Object.values(obj.skills)[skillNum];\n let skillSucceeed = false;\n\n if (!('maxCharge' in skill) && skill.curCoolDown > 0) { // not cooled down\n return;\n }\n if ('maxCharge' in skill && skill.curCharge == 0) {\n return;\n }\n\n obj.KEYS.push(\"skills\")\n this.toSend.push(name);\n switch (skill.type) {\n case SKILL_TYPE.SELF:\n skillSucceeed = skill.function(obj, skillParams);\n obj.KEYS.push(\"status\")\n break;\n\n case SKILL_TYPE.LOCATION:\n if (this.outOfWorld(position)) {\n return;\n }\n skillSucceeed = skill.function(this, obj, skillParams)\n break;\n \n case SKILL_TYPE.SHOOT:\n skillSucceeed = skill.function(this, obj, skillParams)\n break;\n\n case SKILL_TYPE.ONGOING:\n skillSucceeed = skill.function(this, obj, skillParams);\n break;\n\n default:\n console.log(\"THIS SKILL DOESN'T HAVE A TYPE!!!\")\n }\n\n if (skillSucceeed || skillSucceeed == undefined) {\n if (typeof skill.sound !== 'undefined') {\n this.sound.push(skill.sound);\n }\n if ('maxCharge' in skill) {\n skill.curCharge -= 1;\n } else {\n skill.curCoolDown = skill.coolDown;\n }\n }\n\n }", "useItem() {\n let horse = allUnlockables['layer0']['unlockable0'];\n if (horse['found']){\n alert(`You used: ${this.name}!`);\n this.found = false;\n horse.unlocked = true;\n } else {\n alert(`Cannot use ${this.name}!`)\n }\n }", "takeHit(weapon, player) {\n this.scene.sound.play(`${this.getData('type')}-hit`);\n this.stunned();\n this.flash();\n this.knockback(weapon.getData('knockback'), player);\n this.data.values.health -= weapon.getData('damage');\n }", "function computerPlay() {\n let weapons = [\"rock\", \"paper\", \"scissors\"]\n return weapons[Math.floor(Math.random() * weapons.length)];\n}", "function collectItems(player, items) {\n items.disableBody(true, true);\n\n score += 5;\n scoreString.setText('Marcador: ' + score + '\\nNivel: ' + (level + 1));\n\n if (level < 5) {\n let enemy = enemies.create(550, 380, 'enemy');\n enemy.setCollideWorldBounds(true);\n enemy.setVelocity(Phaser.Math.Between(20, 70)); \n enemy.setBounce(1, 0);\n }\n else if ( level < 9 ){\n let enemy = enemies.create(550, 380, 'enemy');\n enemy.setCollideWorldBounds(true);\n enemy.setVelocity(Phaser.Math.Between(70, 100)); \n enemy.setBounce(1, 0);\n }\n else if( level <= 14 ){\n let enemy = enemies.create(550, 380, 'enemy');\n enemy.setCollideWorldBounds(true);\n enemy.setVelocity(Phaser.Math.Between(100, 200)); \n enemy.setBounce(1, 0);\n }\n else if( level > 14 ){\n let enemy = enemies.create(Math.floor(Math.random() * (300 + 1)) + 150, 200, 'enemy');\n enemy.setCollideWorldBounds(true);\n enemy.setVelocity(Phaser.Math.Between(150, 250)); \n enemy.setBounce(1, 0);\n }\n}", "_prepareItems(data) {\n\n // Categorize Items as Features and Spells\n const features = {\n weapons: { label: game.i18n.localize(\"DND5E.AttackPl\"), items: [] , hasActions: true, dataset: {type: \"weapon\", \"weapon-type\": \"natural\"} },\n actions: { label: game.i18n.localize(\"DND5E.ActionPl\"), items: [] , hasActions: true, dataset: {type: \"feat\", \"activation.type\": \"action\"} },\n passive: { label: game.i18n.localize(\"DND5E.Features\"), items: [], dataset: {type: \"feat\"} },\n equipment: { label: game.i18n.localize(\"DND5E.Inventory\"), items: [], dataset: {type: \"loot\"}}\n };\n\n // Start by classifying items into groups for rendering\n let [spells, other] = data.items.reduce((arr, item) => {\n item.img = item.img || CONST.DEFAULT_TOKEN;\n item.isStack = Number.isNumeric(item.data.quantity) && (item.data.quantity !== 1);\n item.hasUses = item.data.uses && (item.data.uses.max > 0);\n item.isOnCooldown = item.data.recharge && !!item.data.recharge.value && (item.data.recharge.charged === false);\n item.isDepleted = item.isOnCooldown && (item.data.uses.per && (item.data.uses.value > 0));\n item.hasTarget = !!item.data.target && !([\"none\",\"\"].includes(item.data.target.type));\n if ( item.type === \"spell\" ) arr[0].push(item);\n else arr[1].push(item);\n return arr;\n }, [[], []]);\n\n // Apply item filters\n spells = this._filterItems(spells, this._filters.spellbook);\n other = this._filterItems(other, this._filters.features);\n\n // Organize Spellbook\n const spellbook = this._prepareSpellbook(data, spells);\n\n // Organize Features\n for ( let item of other ) {\n if ( item.type === \"weapon\" ) features.weapons.items.push(item);\n else if ( item.type === \"feat\" ) {\n if ( item.data.activation.type ) features.actions.items.push(item);\n else features.passive.items.push(item);\n }\n else features.equipment.items.push(item);\n }\n\n // Assign and return\n data.features = Object.values(features);\n data.spellbook = spellbook;\n }", "function healthIndicators() {\n var mobs = Entity.getAll();\n\n for(var i = 0; i < mobs.length; i++) {\n\n\n var xq = Entity.getX(mobs[i]) - getPlayerX();\n\n var yq = Entity.getY(mobs[i]) - getPlayerY();\n\n var zq = Entity.getZ(mobs[i]) - getPlayerZ();\n\n\n\n if(xq * xq + yq * yq + zq * zq <= 40 * 40 && mobs[i] != getPlayerEnt()) {\n\n if(Entity.getEntityTypeId(mobs[i]) == 10) {\n Entity.setNameTag(mobs[i], nameColor + \"Chicken \" + healthColor + Entity.getHealth(mobs[i]) + \"/4\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 11) {\n Entity.setNameTag(mobs[i], nameColor + \"Cow \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 12) {\n Entity.setNameTag(mobs[i], nameColor + \"Pig \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 13) {\n Entity.setNameTag(mobs[i], nameColor + \"Sheep \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 14) {\n Entity.setNameTag(mobs[i], nameColor + \"Wolf \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 15) {\n Entity.setNameTag(mobs[i], nameColor + \"Villager \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 16) {\n Entity.setNameTag(mobs[i], nameColor + \"Mooshroom \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 17) {\n Entity.setNameTag(mobs[i], nameColor + \"Squid \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\nif(Entity.getEntityTypeId(mobs[i]) == 18) {\n Entity.setNameTag(mobs[i], nameColor + \"Rabbit \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 19) {\n Entity.setNameTag(mobs[i], nameColor + \"Bat \" + healthColor + Entity.getHealth(mobs[i]) + \"/6\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 20) {\n Entity.setNameTag(mobs[i], nameColor + \"Iron Golem \" + healthColor + Entity.getHealth(mobs[i]) + \"/100\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 21) {\n Entity.setNameTag(mobs[i], nameColor + \"Snow Golem \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 22) {\n Entity.setNameTag(mobs[i], nameColor + \"Ocelot \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 32) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 33) {\n Entity.setNameTag(mobs[i], nameColor + \"Creeper \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 34) {\n Entity.setNameTag(mobs[i], nameColor + \"Skeleton \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 35) {\n Entity.setNameTag(mobs[i], nameColor + \"Spider \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 36) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie Pigman \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 37) {\n Entity.setNameTag(mobs[i], nameColor + \"Slime \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 38) {\n Entity.setNameTag(mobs[i], nameColor + \"Enderman \" + healthColor + Entity.getHealth(mobs[i]) + \"/40\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 39) {\n Entity.setNameTag(mobs[i], nameColor + \"Silverfish \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 40) {\n Entity.setNameTag(mobs[i], nameColor + \"Cave Spider \" + healthColor + Entity.getHealth(mobs[i]) + \"/12\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 41) {\n Entity.setNameTag(mobs[i], nameColor + \"Ghast \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 42) {\n Entity.setNameTag(mobs[i], nameColor + \"Magma Cube \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 43) {\n Entity.setNameTag(mobs[i], nameColor + \"Blaze \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\");\n }\nif(Entity.getEntityTypeId(mobs[i]) == 44) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie Villager \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\");\n }\nif(Entity.getEntityTypeId(mobs[i]) == 45) {\n Entity.setNameTag(mobs[i], nameColor + \"Witch \" + healthColor + Entity.getHealth(mobs[i]) + \"/26\");\n }\n }\n }\n}", "function pickUpItem(hero, weapon) {\n\n // Adds the weapon-like object as the last element of the inventory array of the hero-like object\n // let heroInventory = hero.inventory;\n hero.inventory.push(weapon);\n console.log(hero); // Just for debugging\n}", "function checkAndAddItem(item) {\n if (item in allWeapons) {\n player.weapon.push(item);\n } else {\n player.items.push(item);\n }\n}", "function pickUpItem(person, weapon){\n person.inventory.length === 0? null : person.inventory.push(weapon);\n}", "processFoundItems(itemName) {\r\n if (this.weaponLookup(itemName)) {\r\n this.equipWeapon(itemName);\r\n }\r\n else if (this.questItemLookup(itemName)) {\r\n this.processQuestItem(itemName);\r\n }\r\n }", "function processItem(item, baseItemList, baseScore, player, contentType, baseHPS) {\n let newItemList = [...baseItemList];\n newItemList.push(item);\n //console.log(player);\n const wepList = buildWepCombosUF(player, newItemList);\n const newTGSet = runTopGear(newItemList, wepList, player, contentType, baseHPS);\n\n const newScore = newTGSet.itemSet.hardScore;\n //const differential = Math.round(100*(newScore - baseScore))/100 // This is a raw int difference.\n const differential = Math.round((10000 * (newScore - baseScore)) / baseScore) / 100;\n\n return { item: item.id, level: item.level, score: differential };\n}", "get meleWeapon () { return this.hasMele ? this.meleWeapons[0] : null; }", "function battle() {\n\n let results = \"Battle Results\";\n let winner = \"\";\n\n if (player1.weapon === player2.weapon) {\n\n results = \"IT'S A DRAW!\"\n winner = \"tie\";\n\n } else {\n\n switch (player1.weapon) {\n case \"r\":\n if (player2.weapon === \"s\" || player2.weapon === \"l\") {\n\n winner = \"player1\";\n\n } else {\n\n winner = \"player2\";\n\n }\n break;\n case \"p\":\n if (player2.weapon === \"r\" || player2.weapon === \"v\") {\n\n winner = \"player1\";\n\n } else {\n\n winner = \"player2\";\n }\n break;\n case \"s\":\n if (player2.weapon === \"p\" || player2.weapon === \"l\") {\n\n winner = \"player1\";\n\n } else {\n\n winner = \"player2\";\n }\n break;\n case \"l\":\n if (player2.weapon === \"p\" || player2.weapon === \"v\") {\n\n winner = \"player1\";\n\n } else {\n\n winner = \"player2\";\n }\n break;\n case \"v\":\n if (player2.weapon === \"s\" || player2.weapon === \"r\") {\n\n winner = \"player1\";\n\n } else {\n\n winner = \"player2\";\n\n }\n }\n }\n\n switch (player1.weapon + player2.weapon) {\n case \"rp\":\n case \"pr\":\n results = \"Paper covers Rock\";\n break;\n case \"rs\":\n case \"sr\":\n results = \"Rock crushes Scissors\";\n break;\n case \"rl\":\n case \"lr\":\n results = \"Rock crushes Lizard\";\n break;\n case \"rv\":\n case \"vr\":\n results = \"Spock vaporizes Rock\";\n break;\n case \"ps\":\n case \"sp\":\n results = \"Scissors cut Paper\";\n break;\n case \"pl\":\n case \"lp\":\n results = \"Lizard eats Paper\";\n break;\n case \"pv\":\n case \"vp\":\n results = \"Paper disproves Spock\";\n break;\n case \"sl\":\n case \"ls\":\n results = \"Scissors decapitates Lizard\";\n break;\n case \"sv\":\n case \"vs\":\n results = \"Spock crushes Scissors\";\n break;\n case \"lv\":\n case \"vl\":\n results = \"Lizard poisons Spock\";\n break;\n }\n\n $(\"#player-img\").attr(\"src\", \"assets/images/\" + playerImage);\n if (winner === \"player1\") {\n results = results + \": \" + player1.name + \" WINS!\"\n } else if (winner === \"player2\") {\n results = results + \": \" + player2.name + \" WINS!\"\n }\n $resultsHeader.text(results);\n\n if (mode === \"1\") {\n\n $opponentImg.attr(\"src\", \"assets/images/\" + player2.image);\n\n if (winner === \"player1\") {\n\n $opponentImg.css(\"opacity\", \".1\");\n $playerImg.css(\"opacity\", \"1\");\n\n } else if (winner === \"player2\") {\n\n $opponentImg.css(\"opacity\", \"1\");\n $playerImg.css(\"opacity\", \".1\");\n\n } else {\n\n $opponentImg.css(\"opacity\", \"1\");\n $playerImg.css(\"opacity\", \"1\");\n\n }\n\n } else if (mode === \"2\") {\n\n // if (sessionStorage.getItem(\"player\") === \"1\") {\n if (browserPlayer === 1) {\n\n $opponentImg.attr(\"src\", \"assets/images/\" + player2.image);\n\n if (winner === \"player1\") {\n\n $opponentImg.css(\"opacity\", \".1\");\n $playerImg.css(\"opacity\", \"1\");\n\n } else if (winner === \"player2\") {\n\n $opponentImg.css(\"opacity\", \"1\");\n $playerImg.css(\"opacity\", \".1\");\n\n } else {\n\n $opponentImg.css(\"opacity\", \"1\");\n $playerImg.css(\"opacity\", \"1\");\n\n }\n\n } else {\n\n $(\"#opponent-img\").attr(\"src\", \"assets/images/\" + player1.image);\n\n if (winner === \"player1\") {\n\n $opponentImg.css(\"opacity\", \"1\");\n $playerImg.css(\"opacity\", \".1\");\n\n } else if (winner === \"player2\") {\n\n $opponentImg.css(\"opacity\", \".1\");\n $playerImg.css(\"opacity\", \"1\");\n\n } else {\n\n $opponentImg.css(\"opacity\", \"1\");\n $playerImg.css(\"opacity\", \"1\");\n\n }\n }\n }\n\n $(\"#results-modal\").modal(\"show\");\n $(\"#weapons-div\").removeClass(\"invisible\");\n\n update_score(winner);\n\n //Only one player needs to update score, so player 1 is selected for this purpose\n //if (sessionStorage.getItem(\"player\") === \"1\") {\n if (browserPlayer === 1) {\n\n $opponentLosses.text(\"LOSSES: \" + player2.losses);\n $opponentWins.text(\"WINS: \" + player2.wins);\n $playerLosses.text(\"LOSSES: \" + player1.losses);\n $playerWins.text(\"WINS: \" + player1.wins);\n\n } else {\n\n $opponentLosses.text(\"LOSSES: \" + player1.losses);\n $opponentWins.text(\"WINS: \" + player1.wins);\n $playerLosses.text(\"LOSSES: \" + player2.losses);\n $playerWins.text(\"WINS: \" + player2.wins);\n\n }\n}", "function power(my) {\n entities.forEach(function(element) {\n if (element.showpower) {\n let loc = returnRandomRingPoint(element.size * 2.2)\n //console.log(loc)\n var o = new Entity({\n x: element.x + loc.x,\n y: element.y + loc.y\n })\n o.define(Class['PowerEffect'])\n }\n if (element.powered && element.type == 'tank') {\n let loc = returnRandomRingPoint(element.size * 2.2)\n //console.log(loc)\n var o = new Entity({\n x: element.x + loc.x,\n y: element.y + loc.y\n })\n o.define(Class['PowerEffect'])\n \n if (!element.invuln) {\n element.health.amount -= element.health.max / (55 - element.powerLevel)\n element.shield.amount -= element.shield.max / (35 - element.powerLevel)\n }\n \n element.powerTime -= 1\n if (element.powerTime <= 0) element.powered = false\n \n if (element.health.amount <= 0 && element.poweredBy != undefined && element.poweredBy.skill != undefined) {\n element.poweredBy.skill.score += Math.ceil(util.getJackpot(element.poweredBy.skill.score));\n element.poweredBy.sendMessage('You killed ' + element.name + ' with a Power.');\n element.sendMessage('You have been killed by ' + element.poweredBy.name + ' with a Power.')\n }\n }\n }\n )}", "function UpdateArmory(){\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var servers = stripArray(ss.getRange(\"S4:S29\").getValues());\n var characters = stripArray(ss.getRange(\"B4:B29\").getValues());\n var rows = [4,5,7,8,9,10,12,13,14,15,16,17,19,20,21,22,23,24,26,27,28,29];\n var equip = [\"head\",\"neck\",\"shoulder\",\"back\",\"chest\",\"tabard\",\"wrist\",\"hands\",\"waist\",\"legs\",\"feet\",\"finger1\",\"finger2\",\"trinket1\",\"trinket2\",\"mainHand\"] \n\n for (var i = 0; i < characters.length; i++){\n var url = \"https://us.api.battle.net/wow/character/\"+ servers[i] + \"/\" + characters[i] +\"?fields=items&locale=en_US&apikey=x2qapsnqmsweaqftpcwzacs98vm6p2zx\";\n var playerJSON = UrlFetchApp.fetch(url);\n var player = JSON.parse(playerJSON.getContentText());\n var range = SpreadsheetApp.getActiveSpreadsheet().getRange(\"C\"+rows[i]+\":R\"+rows[i]);\n var ilvls = [[]];\n \n for(var j = 0; j < equip.length; j++){\n var slot = equip[j]; \n if(player.items[slot] == null){\n ilvls[0].push(1);\n }else{\n ilvls[0].push(player.items[slot].itemLevel);\n }\n } \n range.setValues(ilvls);\n\n }\n}", "function EquipBest() {\n// Preamble: save existing light data\n\tpreviousLightType = \"\";\n\tif(OPC.lightLoc == \"offHand\") {\n\t\tpreviousLightType = OPC.offHand;\n//\t\tpreviousLightLife = OPC.lightLife;\n\t}\n// Part 1: place all items in the backpack\n\tif(Array.isArray(OPC.mainHand)) {\n\t\tOPC.backpack.push(OPC.mainHand); // put current main hand weapon into pack\n\t\tOPC.mainHand = \"\"; // empty main hand\n\t}\n\tif(Array.isArray(OPC.offHand)) {\n\t\tOPC.backpack.push(OPC.offHand); // put current off hand item into pack\n\t\tOPC.offHand = \"\"; // empty off hand\n\t}\n\tif(Array.isArray(OPC.armor)) {\n\t\tOPC.backpack.push(OPC.armor); // put current armor into pack\n\t\tOPC.armor = \"\"; // remove armor\n\t}\n\tOPC.backpack.sort(); // reorganise the backpack\talphbetically based on item[0]\n// Part 2: find best option ignoring light requirements\n\tswitch(OPC.build) {\n\tcase \"footman\":\n\t// find the best shield\n\t\tshieldPosBP = -1;\n\t\tshieldValue = 0;\n\t\tfor(iEB = 0; iEB < OPC.backpack.length; iEB++) {\n\t\t\tif(OPC.backpack[iEB][0] == \"s\") { // only do for shields\n\t\t\t\tif(shieldPosBP == -1) { // haven't located a shield up to now\n\t\t\t\t\tshieldPosBP = iEB;\n\t\t\t\t\tshieldValue = OPC.backpack[iEB][2];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(shieldValue > OPC.backpack[iEB][2]) { // not a defense improvement\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(shieldValue == OPC.backpack[iEB][2] && // as good defensively\n\t\t\t\tOPC.backpack[shieldPosBP][3] <= OPC.backpack[iEB][3]) { // not a weight improvement\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse { // update best shield option\n\t\t\t\t\tshieldPosBP = iEB;\n\t\t\t\t\tshieldValue = OPC.backpack[iEB][2];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t// find the best weapon\n\t\tweaponPosBP = -1;\n\t\tweaponDamage = 0;\n\t\tfor(iEB = 0; iEB < OPC.backpack.length; iEB++) {\n\t\t\tstrMod = Math.floor(OPC.abilityScores[0] / 2) - 5;\n\t\t\tdexMod = Math.floor(OPC.abilityScores[1] / 2) - 5;\n\t\t\tif(OPC.backpack[iEB][0] == \"w\") { // only do for weapons\n\t\t\t\tif(shieldPosBP != -1) { // if a shield was found\n\t\t\t\t\tisTH = false; // set a variable to track two-handed weapon\n\t\t\t\t\tfor(iTH = 0; iTH < OPC.backpack[iEB][4].length; iTH ++){\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(OPC.backpack[iEB][4][iTH] == \"two-handed\") {\n\t\t\t\t\t\t\tisTH = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(isTH == true) { // skip two-handed weapons\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnewDiceAverage = ((OPC.backpack[iEB][2][0] * OPC.backpack[iEB][2][1]) + OPC.backpack[iEB][2][1]) / 2;\n\t\t\t\tnewDamage = (newDiceAverage + CalculateDamageBonus(OPC.backpack[iEB])) * (10 + CalculateAttackBonus(OPC.backpack[iEB]));\n\t\t\t\tif(weaponPosBP == -1){ // is this the first weapon found?\n\t\t\t\t\tweaponPosBP = iEB;\n\t\t\t\t\tweaponDamage = newDamage;\n\t\t\t\t}\n\t\t\t\telse if(weaponDamage > newDamage) { // current damage is better\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(weaponDamage == newDamage && // damage is equal\n\t\t\t\tOPC.backpack[weaponPosBP][5] <= OPC.backpack[iEB][5]) { // current weight is as good or better\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tweaponPosBP = iEB;\n\t\t\t\t\tweaponDamage = newDamage;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/////////////////////////////////////// UPDATE FOR OFF HAND LIGHT WEAPONS //////////////////////////////////////////////\n\n\t// find the best armor\n\t\tarmorClassE = CalculateAC();\n\t\tarmorPosBP = -1;\n\t\tfor(iEB = 0; iEB < OPC.backpack.length; iEB++) {\n\t\t\tif(OPC.backpack[iEB][0] == \"a\") { // only do for armor\n\t\t\t\tnewAC = CalculateAC(OPC.backpack[iEB]);\n\t\t\t\tif(OPC.abilityScores[0] < OPC.backpack[iEB][4]) { // check strength requirement\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(armorPosBP == -1){ // if this is the first viable armor, use it as a baseline\n\t\t\t\t\tarmorPosBP = iEB;\n\t\t\t\t\tarmorClassE = newAC;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(armorClassE > newAC) { // this armor is not better\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(armorClassE == newAC && // no change to AC\n\t\t\t\tOPC.backpack[armorPosBP][6] <= OPC.backpack[iEB][6]) { // current armor is lighter\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tarmorPosBP = iEB;\n\t\t\t\t\tarmorClassE = newAC;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n// Part 3: find best light source for each slot\n\tlightPosMH = -1;\n\tlightValMH = 0;\n\tlightPosOH = -1;\n\tlightValOH = 0;\n\tlightPosA = -1;\n\tlightValA = 0;\n\t// loop through all contents of the backpack\n\tfor(iLS = 0; iLS < OPC.backpack.length; iLS ++) {\n\t\tif(OPC.backpack[iLS][0] == \"l\") { // is a light source\n\t\t\tif(OPC.backpack[iLS][1] == \"lantern\" && // is a lantern\n\t\t\t\t!OPC.backpack.includes(oil)) { // backpack doesn't have oil\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(lightPosOH == -1) { // no light source assigned\n\t\t\t\t\tlightPosOH = iLS;\n\t\t\t\t\tlightValOH = OPC.backpack[iLS][2];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(lightValOH > OPC.backpack[iLS][2]) { // has a worse radius\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(OPC.backpack[iLS][2] == lightValOH && // equal radius\n\t\t\t\tOPC.backpack[lightPosOH][3] <= OPC.backpack[iLS][3]) { // not a weight improvement\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse { // use this light source\n\t\t\t\t\tlightPosOH = iLS;\n\t\t\t\t\tlightValOH = OPC.backpack[iLS][2];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(OPC.backpack[iLS][8] > 0) { // has a light radius\n\t\t\tswitch(OPC.backpack[iLS][0]) {\n\t\t\tcase \"a\":\n\t\t\t\tif(lightPosA == -1) { // no light source assigned\n\t\t\t\t\tlightPosA = iLS;\n\t\t\t\t\tlightValA = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(lightValA >= OPC.backpack[iLS][8]) { // new is not an improvement\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse { // \n\t\t\t\t\tlightPosA = iLS;\n\t\t\t\t\tlightValA = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"m\": // the miscelaneous category is here as a placeholder //\n\t\t\t\tbreak;\n\t\t\tcase \"s\":\n\t\t\t\tif(lightPosOH == -1) {\n\t\t\t\t\tlightPosOH = iLS;\n\t\t\t\t\tlightValOH = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(lightValOH >= OPC.backpack[iLS][8]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlightPosOH = iLS;\n\t\t\t\t\tlightValOH = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"w\":\n\t\t\t\tif(lightPosMH == -1) { // main hand\n\t\t\t\t\tlightPosMH = iLS;\n\t\t\t\t\tlightPosMH = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(lightPosMH >= OPC.backpack[iLS][8]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlightPosMH = iLS;\n\t\t\t\t\tlightPosMH = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tisL = false; // set a variable to track light weapon\n\t\t\t\tfor(iL = 0; iL < OPC.backpack[iEB][4].length; iL ++){\t\t\t\t\t\t\t\n\t\t\t\t\tif(OPC.backpack[iEB][4][iL] == \"light\") {\n\t\t\t\t\t\tisL = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(isL == false) { // skip weapons that aren't light\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(lightPosOH == -1) { // off hand\n\t\t\t\t\tlightPosOH = iLS;\n\t\t\t\t\tlightValOH = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(lightValOH >= OPC.backpack[iLS][8]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlightPosOH = iLS;\n\t\t\t\t\tlightValOH = OPC.backpack[iLS][8];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n// Part 4: see which light source offers the least reduction\n/*\nOrder matters here, armor before shield to better assess the impact of 2 additional AC\nBuild makes a big difference to off-hand equipment, especially since a torch is treated as a light weapon\nOrder priority needs to be laid out for each build, and then the function should be built to be flexible around that\n*/\n\t// armor\n\taACScore = 0;\n\tif(lightValA > 0) {\n\t\taAC = CalculateAC(OPC.backpack[armorPosBP]);\n\t\tlAC = CalculateAC(OPC.backpack[lightPosA]);\n\t\taACScore = lAC / aAC;\n\t}\n\t// off hand shield\n\tsACScore = 0;\n\tif(lightValOH > 0) {\n\t\tsACScore = aACScore / (aACScore + shieldValue);\n\t}\n\t// main hand\n\twMHScore = 0;\n\tif(lightValMH > 0) {\n\t\twMHDiceAverage = ((OPC.backpack[weaponPosBP][2][0] * OPC.backpack[weaponPosBP][2][1]) + OPC.backpack[weaponPosBP][2][1]) / 2;\n\t\twMHDamage = (wMHDiceAverage + CalculateDamageBonus(OPC.backpack[weaponPosBP])) * (10 + CalculateAttackBonus(OPC.backpack[weaponPosBP]));\n\t\tlMHDiceAverage = ((OPC.backpack[lightPosMH][2][0] * OPC.backpack[lightPosMH][2][1]) + OPC.backpack[lightPosMH][2][1]) / 2;\n\t\tlMHDamage = (lMHDiceAverage + CalculateDamageBonus(OPC.backpack[lightPosMH])) * (10 + CalculateAttackBonus(OPC.backpack[lightPosMH]));\n\t\twMHScore = lMHDamage / wMHDamage;\n\t}\n\t// off hand weaopn (there is currently nothing in place to equip an off-hand weapon)\n\t/*\n\tif(shieldValue == 0) {\n\t\twOHDiceAverage = ((OPC.backpack[shieldPosBP][2][0] * OPC.backpack[shieldPosBP][2][1]) + OPC.backpack[shieldPosBP][2][1]) / 2;\n\t\twOHDamage = (wOHDiceAverage + CalculateDamageBonus(OPC.backpack[shieldPosBP])) * (10 + CalculateAttackBonus(OPC.backpack[shieldPosBP]));\n\t\tlOHDiceAverage = ((OPC.backpack[lightPosOH][2][0] * OPC.backpack[lightPosOH][2][1]) + OPC.backpack[lightPosOH][2][1]) / 2;\n\t\tlOHDamage = (lOHDiceAverage + CalculateDamageBonus(OPC.backpack[lightPosOH])) * (10 + CalculateAttackBonus(OPC.backpack[lightPosOH]));\n\t\twOHScore = lMHDamage / wMHDamage;\n\t}\n\t*/\n\tif(aACScore > sACScore) { // compare lighted armor to lighted shield\n\t\tbestResult = \"a\"; // result = armor\n\t\tscoreResult = aACScore; // score = aACScore\n\t}\n\telse {\n\t\tbestResult = \"s\"; // result = shield\n\t\tscoreResult = sACScore; // score = sACScore\n\t}\n\tif(wMHScore > scoreResult) {\n\t\tbestResult = \"w\"; // result = weapon\n\t\tscoreResult = wMHScore; // score = wMHScore\n\t}\n\t// put the best light source in the proper equipment placeholder\n\tswitch(bestResult) {\n\t\tcase \"a\":\n\t\t\tarmorPosBP = lightPosA;\n\t\t\tOPC.light = OPC.backpack[armorPosBP][8]; // get new light setting from off hand item\n\t\t\tOPC.lightLoc = \"armor\";\n\t\t\tbreak;\n\t\tcase \"s\":\n\t\t\tshieldPosBP = lightPosOH;\n\t\t\tOPC.light = OPC.backpack[shieldPosBP][8]; // get new light setting from off hand item\n\t\t\tOPC.lightLoc = \"offHand\";\n\t\t\tbreak;\n\t\tcase \"w\":\n\t\t\tweaponPosBP = lightPosMH;\n\t\t\tOPC.light = OPC.backpack[weaponPosBP][8]; // get new light setting from off hand item\n\t\t\tOPC.lightLoc = \"mainHand\";\n\t\t\tbreak;\n\t}\n// Part 5: equip the best gear\n\t// the backpack has been sorted by item[0], so the order will be armor, lights, misc, shields, weapons\n\t// main hand weapon\n\tOPC.mainHand = OPC.backpack[weaponPosBP]; // put new weapon in main hand on\n\tOPC.backpack.splice(weaponPosBP, 1); // remove new weapon from pack\n\t// off hand shield\n\tOPC.offHand = OPC.backpack[shieldPosBP]; // put new light in off hand\n\tOPC.backpack.splice(shieldPosBP, 1); // remove new light from pack\n\tif(OPC.offHand !== previousLightType) { // it is a new type of light source\n\t\tif(OPC.offHand == torch) {\n\t\t\tOPC.lightLife = 600; // update torch life\n\t\t}\n\t\telse if(OPC.offHand == lantern) {\n\t\t\tOPC.backpack.splice(OPC.backpack.indexOf(oil),1); // remove the first instance of oil in the backpack\n\t\t\tOPC.lightLife = 3600; // increase the light life to 6 hours\n\t\t}\n\t}\n\t// armor\n\tOPC.armor = OPC.backpack[armorPosBP]; // put new armor on\n\tOPC.backpack.splice(armorPosBP, 1); // remove new armor from pack\n\t// backpack\n\tOPC.backpack.sort(); // reorganise the backpack\n\t// calculate character stats\n\tOPC.AC = CalculateAC();\n\tOPC.attackBonus = CalculateAttackBonus();\n\tOPC.damageDice = SetDamageDice();\n\tOPC.damageType = SetDamageType();\n\tOPC.damageBonus = CalculateDamageBonus();\n\tWriteOPC();\n}", "function displayWeapons(chest, options)\r\n{\r\n\t\r\n\t// establish types\r\n\tvar conf = {\r\n\t\t\"Melee Weapon\":{\r\n\t\t\tattrs:[\"name\", \"cat\", \"atk\", \"par\", \"dmg\", \"hands\", \"weight\", \"val\", \"desc\"],\r\n\t\t\talign:[\"left\", \"left\", \"right\", \"right\", \"right\", \"center\", \"right\", \"right\", \"left\"],\r\n\t\t\tid:\"MeleeWeaponsTable\",\r\n\t\t\ttooltips:[],\r\n\t\t\ttotalNumber:0, // of weapons of that type in the chest\r\n\t\t\ttotalVal:0,\r\n\t\t\ttotalWeight:0\r\n\t\t},\r\n\t\t\"Ranged Weapon\":{\r\n\t\t\tattrs:[\"name\", \"cat\", \"min\", \"max\", \"atk\", \"par\", \"dmg\", \"hands\", \"weight\", \"val\", \"desc\"],\r\n\t\t\talign:[\"left\", \"left\", \"right\", \"right\", \"right\", \"right\", \"right\", \"center\", \"right\", \"right\", \"left\"],\r\n\t\t\tid:\"RangedWeaponsTable\",\r\n\t\t\ttooltips:[],\r\n\t\t\ttotalNumber:0,\r\n\t\t\ttotalVal:0,\r\n\t\t\ttotalWeight:0\r\n\t\t},\r\n\t\t\"Armor\":{\r\n\t\t\tattrs:[\"name\", \"cat\", \"dexmod\", \"dmg\", \"weight\", \"val\", \"desc\"],\r\n\t\t\talign:[\"left\", \"left\", \"right\", \"right\", \"right\", \"right\", \"left\"],\r\n\t\t\tid:\"ArmorTable\",\r\n\t\t\ttooltips:[],\r\n\t\t\ttotalNumber:0,\r\n\t\t\ttotalVal:0,\r\n\t\t\ttotalWeight:0\r\n\t\t}\r\n\t}\r\n\tfor (var c in conf)\r\n\t{\r\n\t\tfor (var n in conf[c].attrs)\r\n\t\t\tconf[c].tooltips.push(getItemHelpText(conf[c].attrs[n]))\r\n\t}\r\n\tconf[\"Armor\"].tooltips.dmg = getItemHelpText(\"prot\")\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t// first pass\r\n\t\r\n\tvar wpCount = {}\r\n\tvar totalVal = 0\r\n\tvar totalWeight = 0\r\n\tvar nbOfType = {}\r\n\t\r\n\tvar i = 0\r\n\twhile (i<chest.length)\r\n\t{\r\n\t\ttotalVal+=chest[i].val\r\n\t\ttotalWeight+=chest[i].weight\r\n\t\tconf[chest[i].type].totalVal+=chest[i].val\r\n\t\tconf[chest[i].type].totalWeight+=chest[i].weight\r\n\t\tconf[chest[i].type].totalNumber++\r\n\t\t\r\n\t\t// deduplication\r\n\t\tif (typeof(wpCount[chest[i].name]) === \"undefined\")\r\n\t\t{\r\n\t\t\twpCount[chest[i].name] = 1\r\n\t\t\ti++\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\twpCount[chest[i].name]++\r\n\t\t\tchest.splice(i,1)\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar zebraIndexOfType = {}\r\n\tvar types = Object.keys(conf)\r\n\tfor (var ty in types)\r\n\t{\r\n\t\tif (conf[types[ty]].totalNumber == 0)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar t=document.getElementById(conf[types[ty]].id)\r\n\t\t\tvar tr=document.createElement(\"tr\")\r\n\t\t\tvar td = document.createElement(\"td\")\r\n\t\t\ttd.innerHTML=\"<i>No \"+types[ty].toLowerCase()+\"s</i>\"\r\n\t\t\ttd.colSpan=conf[types[ty]].attrs.length\r\n\t\t\ttr.appendChild(td)\r\n\t\t\ttr.className=\"gray\"\r\n\t\t\tt.appendChild(tr)\r\n\t\t}\r\n\t\telse\r\n\t\t\tzebraIndexOfType[types[ty]] = 0\r\n\t}\r\n\t\r\n\t// adding elements\r\n\t\r\n\tvar curCat = \"\"\r\n\tvar color = \"\"\r\n\tfor (var w in chest)\r\n\t{\r\n\t\tvar t=document.getElementById(conf[chest[w].type].id)\r\n\t\tvar tr=document.createElement(\"tr\")\r\n\t\ttr.className=\"weaponRow\"\r\n\t\t\r\n\t\t\r\n\t\tif (options && (options.perweapon || options.colors) && curCat != chest[w][\"cat\"].toString())\r\n\t\t{\r\n\t\t\tcurCat = chest[w][\"cat\"].toString()\r\n\t\t\tcolor = getLightRGBfromString(chest[w][\"cat\"].toString())\r\n\t\t\tif (options.perweapon)\r\n\t\t\t{\r\n\t\t\t\tvar sep = document.createElement(\"tr\")\r\n\t\t\t\tsep.style.height = \"1em\"\r\n\t\t\t\tt.appendChild(sep)\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (wpCount[chest[w].name] > 1)\r\n\t\t{\r\n\t\t\tchest[w].weight = \"<b style=\\\"color:#C00\\\">\"+wpCount[chest[w].name]*chest[w].weight +\"</b> <br>(\"+chest[w].weight+\")\"\r\n\t\t\tchest[w].val = \"<b style=\\\"color:#C00\\\">\"+wpCount[chest[w].name]*chest[w].val +\"</b> <br>(\"+chest[w].val+\")\"\r\n\t\t\tchest[w].name = \"<b style=\\\"color:#C00\\\">\"+wpCount[chest[w].name]+\"x</b> \"+chest[w].name\r\n\t\t}\r\n\t\t\r\n\t\tvar n = 0\r\n\t\twhile (n < conf[chest[w].type].attrs.length)\r\n\t\t{\r\n\t\t\tvar td = document.createElement(\"td\")\r\n\t\t\tif (options && options.perweapon && !chest[w].appliedModifier && conf[chest[w].type].attrs[n]==\"name\")\r\n\t\t\t{\r\n\t\t\t\tvar a = document.createElement(\"a\")\r\n\t\t\t\ta.href = window.location.pathname+\"#\"+chest[w][\"name\"].replace(/\\ /g, \"_\").toLowerCase()\r\n\t\t\t\ta.innerHTML=chest[w][\"name\"]\r\n\t\t\t\ta.id=chest[w][\"name\"].replace(/\\ /g, \"_\").toLowerCase()\r\n\t\t\t\ttd.appendChild(a)\r\n\t\t\t}\r\n\t\t\telse if (options && options.colors && conf[chest[w].type].attrs[n]==\"cat\")\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\ttd.style.backgroundColor=color\r\n\t\t\t\t\r\n\t\t\t\tif (chest[w][conf[chest[w].type].attrs[n]].length>1)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor (var ca in chest[w].cat)\r\n\t\t\t\t\t{\r\n\t\t\t\t\tvar sp = document.createElement(\"span\")\r\n\t\t\t\t\tsp.style.backgroundColor = getLightRGBfromString(chest[w].cat[ca])\r\n\t\t\t\t\tsp.innerHTML = chest[w].cat[ca]\r\n\t\t\t\t\ttd.appendChild(sp)\r\n\t\t\t\t\tif (ca < chest[w].cat.length-1)\r\n\t\t\t\t\t\ttd.innerHTML+=\", \"\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t\ttd.innerHTML=chest[w][conf[chest[w].type].attrs[n]]\r\n\t\t\t}\r\n\t\t\telse if (conf[chest[w].type].attrs[n]==\"dmg\")\r\n\t\t\t{\r\n\t\t\t\ttd.innerHTML=getWebDiceDisplay(chest[w][\"dmg\"])\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\ttd.innerHTML=chest[w][conf[chest[w].type].attrs[n]]\r\n\t\t\t\r\n\t\t\ttd.style.textAlign=conf[chest[w].type].align[n]\r\n\t\t\ttd.title=conf[chest[w].type].tooltips[n]\r\n\t\t\t\r\n\t\t\t// skip following absent values\r\n\t\t\twhile (typeof(chest[w][conf[chest[w].type].attrs[parseInt(n)+1]]) === \"undefined\" && parseInt(n)+1 < conf[chest[w].type].attrs.length)\r\n\t\t\t{\r\n\t\t\t\t//console.log(n, attrs[parseInt(n)], attrs[parseInt(n)+1])\r\n\t\t\t\t// yup, that parseint is required. Else n=0 => string\r\n\t\t\t\t// if using for (var n in attrs), that is\r\n\t\t\t\ttd.colSpan++\r\n\t\t\t\tn++\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\ttr.appendChild(td)\r\n\t\t\tn++\r\n\t\t}\r\n\t\t\r\n\t\tif (options && options.perweapon && !chest[w].appliedModifier)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tzebraIndexOfType[chest[w].type]=0\r\n\t\t\tvar color = getLightRGBfromString(chest[w][\"cat\"].toString())\r\n\t\t\t//tr.style.borderTop=\"1px solid black;\"\r\n\t\t\tt.appendChild(document.createElement(\"tr\"))\r\n\t\t\ttr.style.backgroundColor=color\r\n\t\t}\r\n\t\telse if (zebraIndexOfType[chest[w].type]%2 == 0)\r\n\t\t\ttr.className+=\" gray\"\r\n\t\tzebraIndexOfType[chest[w].type]++\r\n\t\tt.appendChild(tr)\r\n\t}\r\n\t\r\n\tif (options && options.total)\r\n\t{\r\n\t\tvar t=document.getElementById(conf[\"Armor\"].id)\r\n\t\tvar tr=document.createElement(\"tr\")\r\n\t\tvar tdt = document.createElement(\"td\")\r\n\t\ttdt.innerHTML=\"Total (weapons)\"\r\n\t\ttdt.colSpan=4\r\n\t\ttr.appendChild(tdt)\r\n\t\tvar tdw = document.createElement(\"td\")\r\n\t\ttdw.innerHTML=totalWeight\r\n\t\ttdw.id=\"totalWeaponsWeight\"\r\n\t\ttdw.style.textAlign=\"right\"\r\n\t\ttr.appendChild(tdw)\r\n\t\tvar tdv = document.createElement(\"td\")\r\n\t\ttdv.innerHTML=totalVal\r\n\t\ttdv.id=\"totalWeaponsVal\"\r\n\t\ttdv.style.textAlign=\"right\"\r\n\t\ttr.appendChild(tdv)\r\n\t\t//tr.appendChild(document.createElement(\"td\"))\r\n\t\ttr.style.backgroundColor=\"#DDF\"\r\n\t\ttr.style.fontWeight=\"bold\"\r\n\t\tt.appendChild(tr)\r\n\t}\r\n}", "determinize(battleside) {\n\n _.each(battleside.pokemon, function(pokemon) {\n if(!!pokemon.set.probabilities) {\n var set = pokemon.set\n\n set.item = sample_from(set.probabilities.items, function(e){return e[1]})[0]\n set.evs = _.sample(set.probabilities.evs)\n //set.moves = pokemon.trueMoves + _.map(_.sampleSize(set.probabilities.moves, 4-pokemon.trueMoves.length), function(m){return m[0]})\n\n // Create the new pokemon\n var new_pokemon = new BattlePokemon(set, battleside);\n new_pokemon.trueMoves = pokemon.trueMoves\n new_pokemon.nickname = pokemon.nickname\n pokemon.position = pokemon.position;\n battleside.pokemon[pokemon.position] = new_pokemon;\n\n if (pokemon.position === 0) {\n battleside.active = [new_pokemon];\n new_pokemon.isActive = true;\n }\n }\n })\n \n\n battleside.pokemon = _.sortBy(battleside.pokemon, function(pokemon) { return pokemon.isActive ? 0 : 1 });\n for(var i = 0; i < 6; i++) {\n battleside.pokemon[i].position = i\n }\n }", "_prepareItems(actorData) {\n\n // Inventory\n const inventory = {\n weapon: { label: \"Weapons\", items: [] },\n equipment: { label: \"Equipment\", items: [] },\n consumable: { label: \"Consumables\", items: [] },\n tool: { label: \"Tools\", items: [] },\n backpack: { label: \"Backpack\", items: [] },\n };\n\n // Spellbook\n const spellbook = {};\n\n // Feats\n const feats = [];\n\n // Classes\n const classes = [];\n\n // Iterate through items, allocating to containers\n let totalWeight = 0;\n for ( let i of actorData.items ) {\n i.img = i.img || DEFAULT_TOKEN;\n\n // Inventory\n if ( Object.keys(inventory).includes(i.type) ) {\n i.data.quantity.value = i.data.quantity.value || 1;\n i.data.weight.value = i.data.weight.value || 0;\n i.totalWeight = Math.round(i.data.quantity.value * i.data.weight.value * 10) / 10;\n i.hasCharges = (i.type === \"consumable\") && i.data.charges.max > 0;\n inventory[i.type].items.push(i);\n totalWeight += i.totalWeight;\n }\n\n // Spells\n else if ( i.type === \"spell\" ) this._prepareSpell(actorData, spellbook, i);\n\n // Classes\n else if ( i.type === \"class\" ) {\n classes.push(i);\n classes.sort((a, b) => b.levels > a.levels);\n }\n\n // Feats\n else if ( i.type === \"feat\" ) feats.push(i);\n }\n\n // Assign and return\n actorData.inventory = inventory;\n actorData.spellbook = spellbook;\n actorData.feats = feats;\n actorData.classes = classes;\n\n // Inventory encumbrance\n actorData.data.attributes.encumbrance = this._computeEncumbrance(totalWeight, actorData);\n }", "function C007_LunchBreak_Natalie_GetToys() {\r\n PlayerAddInventory(\"Rope\", 1);\r\n PlayerAddInventory(\"Blindfold\", 1);\r\n PlayerAddInventory(\"Ballgag\", 1);\r\n PlayerAddInventory(\"ClothGag\", 1);\r\n PlayerAddInventory(\"VibratingEgg\", 1);\r\n}", "function MaidQuartersWearMaidUniform() {\n\tMaidQuartersPreviousCloth = InventoryGet(Player, \"Cloth\");\n\tMaidQuartersPreviousHat = InventoryGet(Player, \"Hat\");\n\tInventoryWear(Player, \"MaidOutfit1\", \"Cloth\", \"Default\");\n\tInventoryWear(Player, \"MaidHairband1\", \"Hat\", \"Default\");\n}", "function obtainItem() {\n if (itemObtainingOK) {\n //Is Thor next to an item?\n if (thor.nextToType == \"Item\") {\n //work out which item\n for (var i = 0; i < thor.currentTile.items.length; i++) {\n //find the item within the currentTile.items array\n if (thor.currentTile.items[i].id == thor.nextToID) {\n // increase health to 100 if powerup taken\n if (thor.nextToID == \"powerup\") {\n thor.health = 100;\n console.log(\"Yummy powerup!\");\n\n underText1 = \"Yummy powerup!\";\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n } else {\n //add it to Thors inventory\n thor.items.push(thor.currentTile.items[i]);\n console.log(thor.currentTile.items[i].name + \": added to Thors inventory\");\n underText1 = (thor.currentTile.items[i].name + \": added to Thors inventory\");\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n //change NPC chat if required, loop through each and update a required\n for (var k = 0; k < thor.currentTile.npcs.length; k++) {\n if (typeof thor.currentTile.npcs[k].dialogueList[1] !== 'undefined') {\n thor.currentTile.npcs[k].currentDialogue = thor.currentTile.npcs[k].dialogueList[2];\n thor.currentTile.npcs[k].chatPosition = 0;\n }\n }\n //if its a key, unlock door key is for\n if (thor.currentTile.items[i].id == \"key\") {\n thor.currentTile.items[i].unlocks.locked = false;\n }\n }\n\n //remove it from the current tile\n thor.currentTile.items.splice(i, 1);\n\n //enable inventory to be shown directly after pick up, without need to move\n thor.nextToID = \"nothing\";\n thor.nextToType = \"nothing\";\n\n //No need to complete redundent cycles of for loop\n break;\n\n }\n }\n }\n //Is Thor next to an NPC?\n else if (thor.nextToType == \"NPC\") {\n //work out which NPC\n for (var j = 0; j < thor.currentTile.npcs.length; j++) {\n //find the npc within the currentTile.items array\n if (thor.currentTile.npcs[j].id == thor.nextToID) {\n //does the NPC have a questItem\n\n if (thor.currentTile.npcs[j].questItem === undefined) {\n console.log(thor.currentTile.npcs[j].name.toUpperCase() + \": Sorry, nothing to give you, onwards with your quest!\");\n underText1 = (thor.currentTile.npcs[j].name.toUpperCase() + \": Sorry, nothing to give you, onwards with your quest!\");\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n //NPC - nothing to give convo\n } else if (thor.items.indexOf(thor.currentTile.npcs[j].questItem) == -1) {\n //if Thor doesn't already have item, add the whole object\n thor.items.push(thor.currentTile.npcs[j].questItem);\n console.log(thor.currentTile.npcs[j].questItem.name + \": added to Thors inventory\");\n underText1 = (thor.currentTile.npcs[j].questItem.name + \": added to Thors inventory\");\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n if (thor.currentTile.npcs[j].questItem.id == \"key\") {\n //console.log(\"State 1: \" + thor.currentTile.npcs[j].questItem.id); \t\t\t\t\t\n thor.currentTile.npcs[j].questItem.unlocks.locked = false;\n //console.log(\"State 2: \" + thor.currentTile.items[m].unlocks.locked);\t \n }\n\n\n /*\n \t\t\t\tconsole.log(\"current tile id: \" +thor.currentTile.id + \" length: \" + thor.currentTile.items.length);\n //if thor is being given a key, unlock door{\n \t\t\tfor (var m = 0; m < thor.currentTile.items.length; m++) { \t\n \t\t\t\tconsole.log(\"All items: \" + thor.currentTile.items[m].id);\n \tif (thor.currentTile.items[m].id == \"key\") {\n \t\t\t\t\tconsole.log(\"State 1: \" + thor.currentTile.items[m].unlocks.locked);\n \t thor.currentTile.items[m].unlocks.locked = false;\n \t\t\t\t\tconsole.log(\"State 2: \" + thor.currentTile.items[m].unlocks.locked);\t \n \t }\n }\n */\n\n\n\n //Updating the NPC's conversation array based on\n if (thor.currentTile.npcs[j].convoStatus == \"Initial\") {\n //Make sure the NPC has a secondary conversation set up, if so use it\n if (thor.currentTile.npcs[j].dialogueList.length > 1) {\n //Move the array to point to the next item\n thor.currentTile.npcs[j].currentDialogue = thor.currentTile.npcs[j].dialogueList[1];\n //start at the beginning of the array\n thor.currentTile.npcs[j].chatPosition = 0;\n //Update NPC for next convo\n thor.currentTile.npcs[j].convoStatus = \"Given\";\n }\n }\n /*\n else if (convoStatus == \"Given\" && thor.currentTile.npcs[i].id == <specificNPC> ){\n Specific use cases for setting NPC conversation can be put in here\n }\n */\n } else {\n console.log(thor.currentTile.npcs[j].questItem.name + \": already in Thors inventory\");\n underText1 = (thor.currentTile.npcs[j].questItem.name + \": already in Thors inventory\");\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n }\n\n //No need to complete redundent cycles of for loop\n break;\n }\n }\n } else if (thor.nextToType == \"Obstacle\") {\n //Work out which obstacle\n //The Obstacle array contains wall obstacles as well as game obstacles\n //Need to filter out the wall obstacles\n var replacementObstacleArray = [];\n for (var a = 0; a < thor.currentTile.obstacles.length; a++) {\n if (thor.currentTile.obstacles[a].id != \"wall\") {\n replacementObstacleArray.push(thor.currentTile.obstacles[a]);\n }\n }\n for (var m = 0; m < replacementObstacleArray.length; m++) {\n\n //find the npc within the currentTile.items array\n if (replacementObstacleArray[m].id == thor.nextToID) {\n //does the obstacle have a questItem\n if (replacementObstacleArray[m].questItem === undefined) {\n console.log(\"I'm a mere obstacle, move along!\");\n } else if (thor.items.indexOf(replacementObstacleArray[m].questItem) == -1) {\n //if Thor doesn't already have item, add the whole object\n thor.items.push(replacementObstacleArray[m].questItem);\n console.log(replacementObstacleArray[m].questItem.name + \": added to Thors inventory\");\n underText1 = (replacementObstacleArray[m].questItem.name + \": added to Thors inventory\");\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n } else {\n console.log(replacementObstacleArray[m].questItem.name + \": already in Thors inventory\");\n underText1 = (replacementObstacleArray[m].questItem.name + \": already in Thors inventory\");\n underText2 = \"\";\n underText3 = \"\";\n underText4 = \"\";\n underText5 = \"\";\n underText6 = \"\";\n }\n\n //No need to complete redundent cycles of for loop\n break;\n }\n }\n } else if (thor.nextToType == \"PuzzlePeice\") {\n\n //Is Thor next to an puzzle Obstacle?\n if (thor.nextToType == \"PuzzlePeice\" && !thor.currentTile.PuzzleComplete) {\n //work out which obstacle\n for (var i = 0; i < thor.currentTile.PuzzlePeices.length; i++) {\n //find the item within the currentTile.items array\n if (thor.currentTile.PuzzlePeices[i].id == thor.nextToID) {\n\n //If a colour is defined in original instantiation of object, it is assumed colour is to be cycled\n if (thor.currentTile.PuzzlePeices[i].colour != undefined) {\n thor.currentTile.PuzzlePeices[i].colour = thor.currentTile.PuzzlePeices[i].allPossibleVals[thor.currentTile.PuzzlePeices[i].puzzlePointer];\n } else if (1 === 0) {\n //A deliberate false above as this is just a placeholder for expected future code.\n //This is the code to cater for cycling images if puzzle obstacle instantiated with an image.\n }\n\n\n if (thor.currentTile.PuzzlePeices[i].puzzleCompleteVal == thor.currentTile.PuzzlePeices[i].allPossibleVals[thor.currentTile.PuzzlePeices[i].puzzlePointer]) {\n thor.currentTile.PuzzlePeices[i].puzzleSuccess = true;\n //Now go over all of the title puzzle items, if they are all set correctly then perform action!\n var puzzleCompleted = true;\n for (var j = 0; j < thor.currentTile.PuzzlePeices.length; j++) {\n if (thor.currentTile.PuzzlePeices[j].puzzleSuccess === false) {\n puzzleCompleted = false;\n }\n }\n\n\n if (puzzleCompleted) {\n thor.currentTile.PuzzleComplete = true;\n //console.log(\"PUZZLE COMPLETED! - KICKING OFF SUPPLIED PUZZLE FUNCTION!\");\n\n //Wall alert flash to let player know puzzle complete\n var backgroundAlert = thor.currentTile.colour;\n thor.currentTile.colour = \"#ffff\";\n window.setTimeout(function(){\n thor.currentTile.colour = backgroundAlert;\n }, 250);\n\n //Is an item being placed?\n if (thor.currentTile.hasOwnProperty(\"itemToPlace\")) {\n thor.currentTile.targetMapTile.items.push(thor.currentTile.itemToPlace);\n \n\n } \n //Does NPC chat need to be updated?\n if (thor.currentTile.hasOwnProperty(\"newChatNPC_id\")) {\n //find out which NPC\n for (var k = 0; k < thor.currentTile.npcs.length; k++) {\n if (thor.currentTile.npcs[k].id == thor.currentTile.newChatNPC_id) {\n thor.currentTile.npcs[k].currentDialogue = thor.currentTile.npcs[k].dialogueList[2];\n //start any new dialogue from beginning, irrispective of where last one finished\n thor.currentTile.npcs[k].chatPosition = 0;\n }\n }\n } \n \n //Is key being issued? Then unlock the door on the given tile\n for (var m = 0; m < thor.currentTile.items.length; m++) {\n //if its a key, unlock door key is for\n if (thor.currentTile.items[m].id == \"key\") {\n thor.currentTile.items[m].unlocks.locked = false;\n }\n }\n }\n } else {\n //ensure that value is correct is used if user cycles past correct value\n thor.currentTile.PuzzlePeices[i].puzzleSuccess = false;\n }\n\n //If the puzzle is complete then don't let obstacles cycle through anymore\n if (!thor.currentTile.PuzzleComplete) {\n thor.currentTile.PuzzlePeices[i].puzzlePointer += 1;\n\n //Ensure the pointer doesn't get incremented beyond array length\n if (thor.currentTile.PuzzlePeices[i].puzzlePointer == (thor.currentTile.PuzzlePeices[i].allPossibleVals.length)) {\n thor.currentTile.PuzzlePeices[i].puzzlePointer = 0;\n }\n }\n\n //No need to complete redundent cycles of for loop\n break;\n }\n }\n }\n //Not near anything? Then just list inventory.\n else {\n //As the thor items is list of objects, need to iterate through and add names to a new array to be output\n\n var thorInventoryOutput = [];\n for (var k = 0; k < thor.items.length; k++) {\n thorInventoryOutput.push(thor.items[k].name);\n }\n console.log(\"Thor's Swag Bag: \" + thorInventoryOutput);\n\n }\n }\n itemObtainingOK = false;\n}\n}", "function oneIvITwo (data, pointsMap, item) {\n team.oneIvITwo(data.attacker_character_id, data.character_id, data.attacker_loadout_id, data.attacker_loadout_id, data.character_loadout_id, pointsMap);\n killfeedPlayer({\n winner: teamOneObject.members[data.attacker_character_id].name,\n winner_faction: teamOneObject.faction,\n winner_class_id: data.attacker_loadout_id,\n winner_net_score: teamOneObject.members[data.attacker_character_id].netEventScore,\n loser: teamTwoObject.members[data.character_id].name,\n loser_faction: teamTwoObject.faction,\n loser_class_id: data.character_loadout_id,\n loser_net_score: teamTwoObject.members[data.character_id].eventNetScore,\n weapon: item.name,\n is_kill: true\n });\n}", "function checkForWeaponType(type) {\n for (let slot of Object.values(character.slots)) {\n if (slot && slot.name && G.items[slot.name].wtype && G.items[slot.name].wtype === type) return true;\n }\n}", "function collectItem(player, item) {\n if (item.name == 'gem') {\n item.kill();\n this.gemGrab.play();\n score += 10;\n this.scoreCounter.text = 'Score = ' + score;\n gemCount++;\n this.gemCounter.text = '= ' + gemCount;\n if (gemCount == 40) {\n playerLives++;\n this.livesCounter.text = '= ' + playerLives;\n }\n }\n else if (item.name == 'trident') {\n item.kill();\n this.gemGrab.play();\n score += 50;\n this.scoreCounter.text = 'Score = ' + score;\n }\n else if (item.name == 'bucket') {\n item.kill();\n this.gemGrab.play();\n score += 10;\n this.scoreCounter.text = 'Score = ' + score;\n water += 10;\n this.waterBar.crop(new Phaser.Rectangle(0, 0, this.originalWidth * (water/100), this.waterBar.height));\n }\n else if (item.name == 'life') {\n item.kill();\n this.gemGrab.play();\n playerLives++;\n this.livesCounter.text = '= ' + playerLives;\n score += 50;\n this.scoreCounter.text = 'Score = ' + score;\n }\n }", "static CreateServerWeapons(scene) {\n\t\tlet weapons = {};\n\t\tfor (const weapon in data) {\n\t\t\tweapons[weapon] = new Weapon(weapon, scene);\n\t\t}\n\t\treturn weapons;\n\t}", "function EquipItem(i:Item,slot:int)\n{\n\tif(i.itemType == ArmorSlotName[slot]) //If the item can be equipped there:\n\t{\n\t\tif(CheckSlot(slot)) //If theres an item equipped to that slot we unequip it first:\n\t\t{\n\t\t\tUnequipItem(ArmorSlot[slot]);\n\t\t\tArmorSlot[slot]=null;\n\t\t}\n\t\tArmorSlot[slot]=i; //When we find the slot we set it to the item.\n\t\t\n\t\tgameObject.SendMessage (\"PlayEquipSound\", SendMessageOptions.DontRequireReceiver); //Play sound\n\t\t\n\t\t//We tell the Item to handle EquipmentEffects (if any).\n\t\tif (i.GetComponent(EquipmentEffect) != null)\n\t\t{\n\t\t\tequipmentEffectIs = true;\n\t\t\ti.GetComponent(EquipmentEffect).EquipmentEffectToggle(equipmentEffectIs);\n\t\t}\n\t\t\n\t\t//If the item is also a weapon we call the PlaceWeapon function.\n\t\tif (i.isAlsoWeapon == true)\n\t\t{\n\t\t\tif (i.equippedWeaponVersion != null)\n\t\t\t{\n\t\t\t\tPlaceWeapon(i);\n\t\t\t}\n\t\t\t\n\t\t\telse \n\t\t\t{\n\t\t\t\tDebug.LogError(\"Remember to assign the equip weapon variable!\");\n\t\t\t}\n\t\t}\n\n\t\t\t\tif (i.isAlsoHelmet == true)\n\t\t{\n\t\t\tif (i.equippedHelmetVersion != null)\n\t\t\t{\n\t\t\t\tPlaceHelmet(i);\n\t\t\t}\n\t\t\t\n\t\t\telse \n\t\t\t{\n\t\t\t\tDebug.LogError(\"Remember to assign the equip weapon variable!\");\n\t\t\t}\n\t\t}\n\t\tif (DebugMode)\n\t\t{\n\t\t\tDebug.Log(i.name + \" has been equipped\");\n\t\t}\n\t\t\n\t\tplayersinv.RemoveItem(i.transform); //We remove the item from the inventory\n\t}\n}", "function showWeaponALL(index,target){\n let arma_actual =orderStats[index];\n let nombreArma = Object.entries(arma_actual)[89];\n let nombreImg = Object.entries(arma_actual)[89][1];\n nombreImg = nombreImg.split(\" \");\n \n let atts = nombreImg[nombreImg.length -1 ];\n let ending = nombreImg[nombreImg.length -1 ];\n \n nombreImg = CreateImgName(nombreImg,ending);\n showImg(nombreImg,atts,target);\n \n // Clear divs & show weapon name at footer\n title.innerHTML = \"\" ;\n weapon_stats_0.innerHTML = \"\";\n if(target == 1){\n weapon_stats_1.innerHTML = \"\";\n weapon1.innerHTML = \"<h2>\" + nombreArma[1] + \"&nbsp;&nbsp;VS.&nbsp;&nbsp;</h2>\" ;\n }else\n if(target == 2){\n weapon_stats_2.innerHTML = \"\"; \n weapon2.innerHTML = \"<h2>\" + nombreArma[1] + \"&nbsp;&nbsp;</h2>\" ;\n }\n //Populate divs with stats names & values\n Object.entries(arma_actual).slice(0).forEach(function(stat , index) {\n weapon_stats_0.insertAdjacentHTML('beforeend', \"<span class='s0'><div class='stat_name'>\"+stat[0]+\"</div>\"+ \"</span>\");\n if(target == \"1\"){\n weapon_stats_1.insertAdjacentHTML('beforeend', \"<span class='s1'><div class='stat_value'>\"+stat[1]+\"</div>\"+\"</span>\");\n stats1Array[index] = stat[1];\n }else\n if(target == \"2\"){\n weapon_stats_2.insertAdjacentHTML('beforeend', \"<span class='s2'><div class='stat_value'>\"+stat[1]+\"</div>\"+\"</span>\");\n stats2Array[index] = stat[1];\n }\n });\n compareStats(target);\n}", "function Weapons(server, ship) {\n Entity.apply(this, arguments);\n\n this.id = ship.id;\n this.ship = ship;\n\n var weapons = ship.consoles.weapons;\n\n var self = this;\n weapons.on('fireTube', function(client, packet) {\n server.triggerHook('weapons.fireTube', self, packet.tube);\n });\n\n weapons.on('loadTube', function(client, packet) {\n server.triggerHook('weapons.loadTube', self, packet.tube, packet.ordnance);\n });\n\n weapons.on('unloadTube', function(client, packet) {\n server.triggerHook('weapons.unloadTube', self, packet.tube);\n });\n\n weapons.on('convertTorpedo', function(client, packet) {\n server.triggerHook('weapons.convertTorpedo', self, packet.direction);\n });\n\n // todo: prevent other consoles from getting updates\n\n this.props({\n storesHoming: ship.torpedoStorage[0],\n storesNukes: ship.torpedoStorage[1],\n storesMines: ship.torpedoStorage[2],\n storesEMPs: ship.torpedoStorage[3],\n unknown1: 116,\n unloadTime1: 0,\n unloadTime2: 0,\n unloadTime3: 0,\n unloadTime4: 0,\n unloadTime5: 0,\n unloadTime6: 0,\n tubeUsed1: 0,\n tubeUsed2: 0,\n tubeUsed3: 0,\n tubeUsed4: 0,\n tubeUsed5: 0,\n tubeUsed6: 0,\n tubeContents1: 0,\n tubeContents2: 0,\n tubeContents3: 0,\n tubeContents4: 0,\n tubeContents5: 0,\n tubeContents6: 0\n }, true);\n}", "pickUp(currentPlayer, grabbableName, channel){\n let item = this.utils.resolveNamable(grabbableName, this.maps[currentPlayer.position].userItems)\n let grabbable = this.utils.resolveNamable(grabbableName,this.maps[currentPlayer.position].interactions\n .filter(interaction => {\n return interaction.type === 'grabbable' && !currentPlayer.interactionsDone.includes(interaction.name.name)\n }))\n if(grabbable && !currentPlayer.interactionsDone.includes(grabbable.name.name)){\n currentPlayer.interactionsDone.push(grabbable.name.name)\n grabbable.items.forEach(item => {\n addItem(currentPlayer, item)\n })\n channel.send(grabbable.description).catch(err => {console.error(err);})\n this.utils.saveUniverse(this)\n } else if (item){\n addItem(currentPlayer, item)\n this.maps[currentPlayer.position].userItems = this.maps[currentPlayer.position].userItems.filter(\n currentItem => currentItem !== item)\n channel.send(`Added ${item.name.name} to your inventory.`).catch(err => {console.error(err);})\n this.utils.saveUniverse(this)\n }\n }", "function weaponTileCheck(weapons, player) {\n\n var aPosition = player.currentPos\n var aWeapon = weapons.find(e => e.currentPos.x == aPosition.x && e.currentPos.y == aPosition.y)\n if(aWeapon == undefined) {\n return;\n }\n console.log(\"This tile has a weapon!\", aWeapon);\n \n pickUpWeapon(aWeapon, player);\n\n var anIndex = weapons.indexOf(aWeapon)\n if (anIndex > -1) {\n weapons.splice(anIndex, 1); ///using .splice() to remove the weapon from the array\n }\n}", "async battle_phase_combat() {\n if (!this.turns_actions.length) {\n this.battle_phase = battle_phases.ROUND_END;\n this.check_phases();\n return;\n }\n const action = this.turns_actions.pop();\n if (action.caster.has_permanent_status(permanent_status.DOWNED)) { //check whether this char is downed\n this.check_phases();\n return;\n }\n if (action.caster.is_paralyzed()) { //check whether this char is paralyzed\n if (action.caster.temporary_status.has(temporary_status.SLEEP)) {\n await this.battle_log.add(`${action.caster.name} is asleep!`);\n } else if (action.caster.temporary_status.has(temporary_status.STUN)) {\n await this.battle_log.add(`${action.caster.name} is paralyzed and cannot move!`);\n }\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (action.caster.fighter_type === fighter_types.ENEMY && !abilities_list[action.key_name].priority_move) { //reroll enemy ability\n Object.assign(action, EnemyAI.roll_action(action.caster, party_data.members, this.enemies_info.map(info => info.instance)));\n }\n let ability = abilities_list[action.key_name];\n let item_name = \"\";\n if (action.caster.fighter_type === fighter_types.ALLY && ability !== undefined && ability.can_switch_to_unleash) { //change the current ability to unleash ability from weapon\n if (action.caster.equip_slots.weapon && items_list[action.caster.equip_slots.weapon.key_name].unleash_ability) {\n const weapon = items_list[action.caster.equip_slots.weapon.key_name];\n if (Math.random() < weapon.unleash_rate) {\n item_name = weapon.name;\n action.key_name = weapon.unleash_ability;\n ability = abilities_list[weapon.unleash_ability];\n }\n }\n }\n if (ability === undefined) {\n await this.battle_log.add(`${action.key_name} ability key not registered.`);\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (action.caster.has_temporary_status(temporary_status.SEAL) && ability.ability_category === ability_categories.PSYNERGY) { //check if is possible to cast ability due to seal\n await this.battle_log.add(`But the Psynergy was blocked!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (ability.pp_cost > action.caster.current_pp) { //check if char has enough pp to cast ability\n await this.battle_log.add(`... But doesn't have enough PP!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n } else {\n action.caster.current_pp -= ability.pp_cost;\n }\n let djinn_name = action.djinn_key_name ? djinni_list[action.djinn_key_name].name : undefined;\n await this.battle_log.add_ability(action.caster, ability, item_name, djinn_name);\n if (ability.ability_category === ability_categories.DJINN) {\n if (ability.effects.some(effect => effect.type === effect_types.SET_DJINN)) {\n djinni_list[action.djinn_key_name].set_status(djinn_status.SET, action.caster);\n } else {\n djinni_list[action.key_name].set_status(djinn_status.STANDBY, action.caster);\n }\n } else if (ability.ability_category === ability_categories.SUMMON) { //some summon checks\n const requirements = _.find(this.data.summons_db, {key_name: ability.key_name}).requirements;\n const standby_djinni = Djinn.get_standby_djinni(MainChar.get_active_players(MAX_CHARS_IN_BATTLE));\n const has_available_djinni = _.every(requirements, (requirement, element) => {\n return standby_djinni[element] >= requirement;\n });\n if (!has_available_djinni) { //check if is possible to cast a summon\n await this.battle_log.add(`${action.caster.name} summons ${ability.name} but`);\n await this.battle_log.add(`doesn't have enough standby Djinn!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n } else { //set djinni used in this summon to recovery mode\n Djinn.set_to_recovery(MainChar.get_active_players(MAX_CHARS_IN_BATTLE), requirements);\n }\n }\n this.battle_menu.chars_status_window.update_chars_info();\n if (ability.type === ability_types.UTILITY) {\n await this.wait_for_key();\n }\n if (this.animation_manager.animation_available(ability.key_name)) {\n const caster_sprite = action.caster.fighter_type === fighter_types.ALLY ? this.allies_map_sprite[action.caster.key_name] : this.enemies_map_sprite[action.caster.key_name];\n const target_sprites = action.targets.map(info => info.target.sprite);\n const group_caster = action.caster.fighter_type === fighter_types.ALLY ? this.battle_stage.group_allies : this.battle_stage.group_enemies;\n const group_taker = action.caster.fighter_type === fighter_types.ALLY ? this.battle_stage.group_enemies : this.battle_stage.group_allies;\n await this.animation_manager.play(ability.key_name, caster_sprite, target_sprites, group_caster, group_taker, this.battle_stage);\n this.battle_stage.prevent_camera_angle_overflow();\n this.battle_stage.set_stage_default_position();\n } else {\n await this.battle_log.add(`Animation for ${ability.key_name} not available...`);\n await this.wait_for_key();\n }\n //apply ability damage\n if (![ability_types.UTILITY, ability_types.EFFECT_ONLY].includes(ability.type)) {\n await this.apply_damage(action, ability);\n }\n //apply ability effects\n for (let i = 0; i < ability.effects.length; ++i) {\n const effect = ability.effects[i];\n if (!effect_usages.ON_USE) continue;\n const end_turn = await this.apply_effects(action, ability, effect);\n if (end_turn) {\n this.battle_phase = battle_phases.ROUND_END;\n this.check_phases();\n return;\n }\n }\n //summon after cast power buff\n if (ability.ability_category === ability_categories.SUMMON) {\n const requirements = _.find(this.data.summons_db, {key_name: ability.key_name}).requirements;\n for (let i = 0; i < ordered_elements.length; ++i) {\n const element = ordered_elements[i];\n const power = BattleFormulas.summon_power(requirements[element]);\n if (power > 0) {\n action.caster.add_effect({\n type: \"power\",\n quantity: power,\n operator: \"plus\",\n attribute: element\n }, ability, true);\n await this.battle_log.add(`${action.caster.name}'s ${element_names[element]} Power rises by ${power.toString()}!`);\n await this.wait_for_key();\n }\n }\n }\n //check for poison damage\n const poison_status = action.caster.is_poisoned();\n if (poison_status) {\n let damage = BattleFormulas.battle_poison_damage(action.caster, poison_status);\n if (damage > action.caster.current_hp) {\n damage = action.caster.current_hp;\n }\n action.caster.current_hp = _.clamp(action.caster.current_hp - damage, 0, action.caster.max_hp);\n const poison_name = poison_status === permanent_status.POISON ? \"poison\" : \"venom\";\n await this.battle_log.add(`The ${poison_name} does ${damage.toString()} damage to ${action.caster.name}!`);\n this.battle_menu.chars_status_window.update_chars_info();\n await this.wait_for_key();\n await this.check_downed(action.caster);\n }\n if (action.caster.has_temporary_status(temporary_status.DEATH_CURSE)) {\n const this_effect = _.find(action.caster.effects, {\n status_key_name: temporary_status.DEATH_CURSE\n });\n if (action.caster.get_effect_turns_count(this_effect) === 1) {\n action.caster.current_hp = 0;\n action.caster.add_permanent_status(permanent_status.DOWNED);\n await this.battle_log.add(`The Grim Reaper calls out to ${action.caster.name}`);\n await this.wait_for_key();\n }\n }\n this.check_phases();\n }", "function RemoveWeapon (Item)\n{\tif (Item.equippedWeaponVersion != null)\n\t{\n\t\tDestroy(WeaponSlot.FindChild(\"\"+Item.equippedWeaponVersion.name).gameObject);\n\t\tif (DebugMode)\n\t\t{\n\t\t\tDebug.Log(Item.name + \" has been removed as weapon\");\n\t\t}\n\t}\n}", "function allVariations(shop, player, enemy)\n{\n\tvar best = Number.MAX_VALUE;\n\tvar beste = [];\n\tvar worst = Number.MIN_VALUE;\n\tvar worste = [];\n\tshop.weapons.forEach(function(weapon){\n\t\tshop.armors.forEach(function(armor){\n\t\t\tfor (var l=0;l<shop.rings.length;++l)\n\t\t\t{\n\t\t\t\tvar ringl = shop.rings[l];\n\t\t\t\tfor (var r=0;r<shop.rings.length;++r)\n\t\t\t\t{\n\t\t\t\t\tif (r!=l) {\n\t\t\t\t\t\tvar ringr = shop.rings[r];\n\t\t\t\t\t\tconsole.log(\"weapon: \" + weapon.name\n\t\t\t\t\t\t\t+ \" armor:\" + armor.name + \" left hand:\" + ringl.name\n\t\t\t\t\t\t\t+ \" right hand: \" + ringr.name);\n\t\t\t\t\t\tvar price = weapon.cost + armor.cost + ringl.cost + ringr.cost;\n\t\t\t\t\t\tconsole.log('price:' + price);\n\t\t\t\t\t\tplayer.equipment = [weapon, armor, ringl, ringr];\n\t\t\t\t\t\tif (battle(player, enemy)==player)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (price < best)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbest = price;\n\t\t\t\t\t\t\t\tbeste = player.equipment.map(function(i){return i.name});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (battle(player, enemy)==enemy)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (price > worst)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tworst = price;\n\t\t\t\t\t\t\t\tworste = player.equipment.map(function(i){return i.name});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\t\n\t\t});\n\t});\n console.log(\"===============================\");\n console.log(\"best price win:\" + best);\n console.log(\"equipment:\" + beste);\n console.log(\"worst price lose:\" + worst);\n console.log(\"equipment:\" + worste);\n\n}", "function CalculateAttackBonus(weapon = OPC.mainHand) {\n\tattackBonus = 0;\n\thasFinesse = 0;\n\tif(weapon[0] = \"w\") { // if this is a weapon class item\n\t\tfor(iAB = 0; iAB < weapon[4].length; iAB ++) { // I think there's an easier way to do this using an array method //////////////////////\n\t\t\tif(weapon[4][iAB] == \"finesse\") { // weaopn has finesse property\n\t\t\t\thasFinesse = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// replace with array.includes(\"finesse\");\n\t\tif(hasFinesse > 0) { // weaopn has finesse property, take better between str and dex\n\t\t\tattackBonus += Math.floor(Math.max(OPC.abilityScores[0],OPC.abilityScores[1])/2)-5;\n\t\t}\n\t\telse { // add str mod\n\t\t\tattackBonus += Math.floor(OPC.abilityScores[0]/2)-5;\n\t\t}\n\t}\n\telse { // for all non-weapon classed items\n\t\tattackBonus += Math.floor(OPC.abilityScores[0]/2)-5;\n\t}\n\tattackBonus += OPC.proficiencyBonus;\n\treturn attackBonus;\n}", "bag(currentPlayer, channel, itemName){\n if(itemName){\n let item = this.utils.resolveNamable(itemName, currentPlayer.inventory.items)\n if(item){\n channel.send(`**${item.name.name}:**\\n`+\n `\\`\\`\\`${item.description}\\`\\`\\``\n ).catch(err =>{\n console.error(err);\n })\n return;\n }\n }\n let answer = `You have **${currentPlayer.inventory.gold}** gold in your inventory, as well as:\\n`\n currentPlayer.inventory.items.forEach(item => {\n answer += `*-${item.name.name}*\\n`\n })\n channel.send(answer).catch(err =>{\n console.error(err);\n })\n }", "function Weapon(name, target) {\n this.name = name;\n this.target = target;\n}", "function userGrab(weapon, user, weaponName, cb) {\n //console.log('\\n'+weapon+', '+user+'\\n');\n request(`https://stats.quake.com/api/v2/Player/Stats?name=${user}`, function(error, response, body) {\n if (!error && response.statusCode == 200) {\n var json = JSON.parse(body);\n if (json.code && json.code == 404) {\n cb(`User, ${user}, does not exist`);\n } else {\n delete json.matches;\n if (weapon === 'duel' || weapon === 'tdm') {\n EloGrab(weapon, json, function(res) {\n cb(`User, ${json.name}, ${weaponName} ranking: ${res}`);\n });\n } else {\n accuracyCalculator(weapon, json, weaponName, function(res) {\n cb(res);\n });\n } \n }\n } else {\n cb(`User, ${user}, does not exist`);\n }\n });\n}" ]
[ "0.67575055", "0.66651475", "0.659243", "0.6518746", "0.65130043", "0.6504878", "0.64964586", "0.6477606", "0.64665306", "0.6460312", "0.6445884", "0.64417624", "0.64142144", "0.64136213", "0.63646126", "0.63240844", "0.62791085", "0.6267591", "0.62572294", "0.6245686", "0.6196502", "0.61868995", "0.6157952", "0.61523515", "0.6148974", "0.61484176", "0.6134372", "0.6134169", "0.612447", "0.61228025", "0.61206204", "0.60993534", "0.6098039", "0.6094325", "0.60878783", "0.6085317", "0.607683", "0.606986", "0.606823", "0.60611004", "0.6060196", "0.60571915", "0.6056786", "0.6036664", "0.60334134", "0.60303044", "0.6029058", "0.60183793", "0.6015065", "0.6005957", "0.60011363", "0.5999197", "0.59979665", "0.59974843", "0.598343", "0.597771", "0.5966076", "0.5962114", "0.5962034", "0.59600383", "0.5952889", "0.5944403", "0.59324545", "0.593196", "0.59309834", "0.59276456", "0.5915524", "0.5910781", "0.5900921", "0.589251", "0.58655906", "0.5854717", "0.58523756", "0.58513916", "0.58464885", "0.58415204", "0.5825245", "0.58136654", "0.5813201", "0.58121204", "0.58047897", "0.5803488", "0.58001596", "0.5798137", "0.57973367", "0.5794107", "0.5787727", "0.57780546", "0.57745785", "0.5772081", "0.5765344", "0.57647216", "0.5764308", "0.57558537", "0.5753726", "0.5753003", "0.5748905", "0.574708", "0.57401115", "0.5735094", "0.5731651" ]
0.0
-1
more interesting stuff here later
generateActions(g) { return ["attack", "wait"]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient final protected internal function m174() {}", "static private protected internal function m118() {}", "static transient private protected internal function m55() {}", "static private protected public internal function m117() {}", "transient final private internal function m170() {}", "static final private internal function m106() {}", "obtain(){}", "transient final private protected internal function m167() {}", "static transient final private internal function m43() {}", "_firstRendered() { }", "transient private protected public internal function m181() {}", "static transient final private protected internal function m40() {}", "function _____SHARED_functions_____(){}", "static transient final protected internal function m47() {}", "added() {}", "static transient private internal function m58() {}", "async 'after sunbath' () {\n console.log( 'see? I appear here because of the first custom above' )\n }", "prepare() {}", "static transient private protected public internal function m54() {}", "static protected internal function m125() {}", "transient final private protected public internal function m166() {}", "__previnit(){}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function StupidBug() {}", "function redactInfo (obj) {\n \n}// CODE HERE", "__init3() {this._finished = false;}", "__init3() {this._finished = false;}", "__init3() {this._finished = false;}", "analyze(){ return null }", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "static transient final protected public internal function m46() {}", "apply () {}", "function kp() {\n $log.debug(\"TODO\");\n }", "loaded() {}", "postAnalysis() { }", "addedToWorld() { }", "function oi(){}", "__init3() {this._numProcessing = 0;}", "__init3() {this._numProcessing = 0;}", "__init3() {this._numProcessing = 0;}", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "transient private public function m183() {}", "calcExtraParams () {}", "static final private protected internal function m103() {}", "function inception() {\n \tinception();\n }", "static transient private public function m56() {}", "_postProcessing() {\n // None yet...\n }", "function createInitialStuff() {\n\n\t//Sniðugt að búa til alla units í Levelinu hér og svoleiðis til \n\t// allt sé loadað áðurenn hann byrjar render/update\n\t//AKA það er betra að hafa þetta sem part af \"loading\" frekar en \n\t//byrjunar laggi\n}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "analyze(input){ return null }", "static private public function m119() {}", "function __it() {}", "function setup() {}", "static transient final private protected public internal function m39() {}", "function image_process_streamization() { \r\n\r\n}", "static transient final protected function m44() {}", "static final private protected public internal function m102() {}", "prepare() {\n }", "_generate_postprocessing() {\n console.warn(\"World.postprocessing is not implemented yet\")\n }", "function p(t){return\"[ recycler ] \"+t}", "function wa(){}", "_FBPReady(){super._FBPReady();//this._FBPTraceWires()\n}", "_FBPReady(){super._FBPReady();//this._FBPTraceWires()\n}", "function doOtherStuff() {}", "function o0(o1)\n{\n var o2 = -1;\n try {\nfor (var o259 = 0; o3 < o1.length; function (o502, name, o38, o781, o782, o837, o585, o838, o549) {\n try {\no839.o468();\n}catch(e){}\n // TODO we should allow people to just pass in a complete filename instead\n // of parent and name being that we just join them anyways\n var o840 = name ? o591.resolve(o591.o592(o502, name)) : o502;\n\n function o841(o842) {\n function o843(o842) {\n try {\nif (!o838) {\n try {\no474.o800(o502, name, o842, o781, o782, o549);\n}catch(e){}\n }\n}catch(e){}\n try {\nif (o837) try {\no837();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n }\n var o844 = false;\n try {\nModule['preloadPlugins'].forEach(function (o845) {\n try {\nif (o844) try {\nreturn;\n}catch(e){}\n}catch(e){}\n try {\nif (o845['canHandle'](o840)) {\n try {\no845['handle'](o842, o840, o843, function () {\n try {\nif (o585) try {\no585();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n });\n}catch(e){}\n try {\no844 = true;\n}catch(e){}\n }\n}catch(e){}\n });\n}catch(e){}\n try {\nif (!o844) try {\no843(o842);\n}catch(e){}\n}catch(e){}\n }\n try {\no332('cp ' + o840);\n}catch(e){}\n try {\nif (typeof o38 == 'string') {\n try {\no839.o846(o38, function (o842) {\n try {\no841(o842);\n}catch(e){}\n }, o585);\n}catch(e){}\n } else {\n try {\no841(o38);\n}catch(e){}\n }\n}catch(e){}\n })\n {\n try {\nif (o1[o3] == undefined)\n {\n try {\nif (o2 == -1)\n {\n try {\no2 = o3;\n}catch(e){}\n }\n}catch(e){}\n }\n else\n {\n try {\nif (o2 != -1)\n {\n try {\no4.o5(o2 + \"-\" + (o3-1) + \" = undefined\");\n}catch(e){}\n try {\no2 = -1;\n}catch(e){}\n }\n}catch(e){}\n try {\no4.o5(o3 + \" = \" + o1[o3]);\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n}", "preload () {}", "updated() {}", "_read () {}", "_read () {}", "_read () {}", "static transient final private public function m41() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function hc(){}" ]
[ "0.6807197", "0.6442346", "0.6221956", "0.61659944", "0.6142497", "0.60902244", "0.6063322", "0.58593875", "0.5825794", "0.5702422", "0.5676093", "0.56689405", "0.5661094", "0.565304", "0.5627449", "0.55998325", "0.55659175", "0.5514499", "0.5508515", "0.54884124", "0.5467439", "0.5461814", "0.53928363", "0.53792644", "0.5368568", "0.5364166", "0.5359897", "0.53224456", "0.53109163", "0.52436596", "0.52436596", "0.52436596", "0.5235494", "0.52225566", "0.5213539", "0.5213539", "0.5213539", "0.51971936", "0.5195017", "0.5195017", "0.515313", "0.5140298", "0.5139752", "0.51370585", "0.51341516", "0.51036876", "0.50910014", "0.5090736", "0.5090736", "0.5090736", "0.50887567", "0.50858974", "0.5080986", "0.5063519", "0.50582474", "0.50408345", "0.50351995", "0.50350404", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.50289625", "0.5021572", "0.5007699", "0.49761283", "0.4975059", "0.49728423", "0.49710357", "0.49531233", "0.4949899", "0.49375838", "0.49367598", "0.493441", "0.49230203", "0.49217165", "0.49188808", "0.49188808", "0.49172565", "0.49142593", "0.49090368", "0.4901768", "0.4891495", "0.4891495", "0.4891495", "0.48913768", "0.48904917", "0.48904917", "0.48904917", "0.48904917", "0.48904917", "0.48904917", "0.4889318" ]
0.0
-1
usually used in cutscenes speed: number of frames per tile
moveTo(g, x, y, speed = this.baseMapSpeed*2) { if (this.x == x && this.y == y) return if (Settings.get("cut_skip") == true) { this.teleport(g, x, y); return; } return new Promise( async (resolve) => { let p = await generatePath(g, this.x, this.y, x, y, this.movcost); if (p == null) { throw "Could not find path to (x, y) = (" + this.x + ", " + this.y + ") to (" + x + ", " + y + ")."; } this.path_iter = p.iter(); this.path_iter.onDone = resolve; this.path_iter.counter = speed; this.mapSpeed = speed; this.path_iter.next(); this.moving = true; g.Map.removeUnit(this); g.Map.getTile(x, y).unit = this; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "GetTileCount()\n\t{\n\t\tvar value = this.tileCountPerGrid * this.gridCount * this.tileCountPerGrid * this.gridCount ; \n\t\treturn value;\n\t}", "countFrames() {\nreturn this.fCount;\n}", "async getTotalFrames() {\r\n return this.lottieAnimation.totalFrames;\r\n }", "function GetNumTiles() {\n var tileCount = 0;\n\n for (var key in ScrabbleTiles) {\n tileCount += ScrabbleTiles[key].number_remaining;\n }\n\n return tileCount;\n}", "getFrameCount() {\n return this.frames.length;\n }", "function frames(numFrames, numMins){\n return (numFrames*60) * numMins;\n }", "function getFramesPerInterval() {\n\treturn getInterval()*fps/1000;\n}", "static frameCounter() {\n const time = performance.now()\n\n if (FPS.start === null) {\n FPS.start = time\n FPS.prevFrameTime = time\n } else {\n FPS.frameCount++\n FPS.frames.push(time - FPS.prevFrameTime)\n }\n\n FPS.prevFrameTime = time\n\n if (FPS.running) {\n requestAnimationFrame(FPS.frameCounter)\n }\n }", "minuteCount() {\n let minuteCount = Math.floor(this.frameCount / this.framesPerMin);\n return minuteCount;\n }", "function drawNumber(i){\n ctx_count.drawImage(numbers_img, spritesheet.frames[i].frame.x,\n spritesheet.frames[i].frame.y,\n spritesheet.frames[i].frame.w,\n spritesheet.frames[i].frame.h, 55, 0,\n spritesheet.frames[i].sourceSize.w,\n spritesheet.frames[i].sourceSize.h);\n}", "renderFrame(){\n // calculate fps\n let now = Date.now();\n this.fps = Math.round( 1000/ (now-this.lastFrameTimestamp) );\n this.lastFrameTimestamp = now;\n\n // calculate average fps\n if( this.fpsLast.length < 60 ) this.fpsLast.push( this.fps );\n else{\n let sum = this.fpsLast.reduce(function(a, b) { return a + b }, 0);\n let average = sum / this.fpsLast.length;\n this.fpsAverage = Math.round( average );\n this.fpsLast= [];\n }\n\n if( this.edgeScrolling ) this.__edgeScrollingHandler();\n\n // clear viewport\n this.Context.clearRect(0, 0, this.Canvas.width/this.Scale.current, this.Canvas.height/this.Scale.current);\n //\n // OPTIMIZATIONS TOSO: render only inscreen tiles\n // render in invisible canvas and dumpmcntent whennscene is ready\n //\n // Iterate columns from right to left\n for (var column =this.Map.columns-1; column >=0 ; column--){\n // Iteraterows from top to bottom\n for (var row =0; row < this.Map.rows ; row++){\n // each cell can have multiple sprites, iterate them...\n for (var layer = 0; layer < this.Map.tileData[row][column].length; layer++){\n this.renderTile( this.Map.tileData[row][column][layer], column, row);\n\n //this.Context.globalAlpha = 0.10;\n //this.renderTile( 7, column, row );\n //this.Context.globalAlpha = 1;\n }\n }\n }\n\n if(this.showProfiler) this.renderProfiler();\n\n let focusedTile = this.getTileFromCoords(this.Mouse.x, this.Mouse.y);\n if(focusedTile){\n this.Context.globalAlpha = 0.40;\n this.renderTile( 7, focusedTile.column, focusedTile.row );\n this.Context.globalAlpha = 1;\n }\n }", "getNumberOfOpenTiles() {\n const { gameState } = this.state;\n const openTiles = gameState.filter((tile) => tile.status == 1);\n return openTiles.length;\n }", "function initTileCounters(){\n\tthis.tile_90_counter = 0;\n\tthis.tile_nub_counter = 0;\n\tthis.tile_t_counter = 0; \n\tthis.tile_line_counter = 0; \n\tthis.tile_cross_counter = 0;\n}", "update(delta) {\n this.count += delta / 100;\n\n this.tilingSprite.tileScale.x = 1 + Math.sin(this.count) / 100;\n this.tilingSprite.tileScale.y = 1 + Math.cos(this.count) / 100;\n this.tilingSprite.position.x -= Math.sin(this.count) / 100;\n this.tilingSprite.position.y += Math.cos(this.count) / 100;\n }", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "constructor(){\n this.x = 100;\n this.y = 100;\n this.frameHeight = 53;\n this.frameWidth = 64;\n this.currentFrameX = 23;\n this.currentFrameY = 16;\n this.spriteSheet;\n this.currentFrameNum = 1;\n this.time = 0;\n this.timeUntilLast = 0;\n this.timeFromLast = 0;\n this.animationTime = 50;\n this.maxFrame = 6;\n this.startTime;\n this.lifeTime;\n this.alive = false;\n\n\n \n\n }", "walk(framesCounter) {\n this.ctx.drawImage(\n this.imageInstance,\n this.imageInstance.framesIndex * Math.floor(this.imageInstance.width / this.imageInstance.frames),\n 0,\n Math.floor(this.imageInstance.width / this.imageInstance.frames),\n this.imageInstance.height,\n this.shinobiPos.x,\n this.shinobiPos.y,\n this.shinobiSize.w,\n this.shinobiSize.h\n )\n this.animateSprite(framesCounter)\n }", "function frames(num1,num2) {\r\n\treturn num1*num2*60\r\n}", "animFrame() {\n //\n // !!!! IMPLEMENT ME !!!!\n //\n const cells = this.life.getCells();\n const height = this.props.height;\n const width = this.props.width;\n\n const pixelSize = this.pixelSize; //changes the pixel size\n\n const canvas = this.refs.canvas;\n let ctx = canvas.getContext(\"2d\");\n let imageData = ctx.getImageData(0, 0, width, height);\n\n for (let y = 0; y < height; y+=pixelSize) {\n for (let x = 0; x < width; x+=pixelSize) {\n const state = cells[y][x];\n const index = (y * width + x) * 4;\n const blockIndexArray = [];\n for (let yGrowth = 0; yGrowth < pixelSize; yGrowth++){\n for (let xGrowth = 0; xGrowth < pixelSize; xGrowth++) {\n blockIndexArray.push(((y + yGrowth) * width + (x + xGrowth)) * 4);\n }\n }\n \n const color = state === 1 ? 255 : 0;\n\n blockIndexArray.forEach((pixel) => { // This block prints the selected pixel size as opposed to a single.\n imageData.data[pixel + 0] = color;\n imageData.data[pixel + 1] = color;\n imageData.data[pixel + 2] = color;\n imageData.data[pixel + 3] = 0xff;\n })\n }\n }\n\n ctx.putImageData(imageData, 0, 0);\n\n\n this.life.step(pixelSize);\n\n requestAnimationFrame(() => {\n this.animFrame();\n });\n }", "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "function obtenerSegundos(frame){\r\n return frame/fpsVideo;\r\n}", "loadTiles(tileset) {\n let tileGraphicsLoaded = 0;\n for (let i = 0; i < tileset.length; i++) {\n\n let tileGraphic = new Image();\n tileGraphic.src = tileset[i];\n tileGraphic.onload = (tile) => {\n // Once the image is loaded increment the loaded graphics count and check if all images are ready.\n // console.log(tile, this);\n tileGraphicsLoaded++;\n if (tileGraphicsLoaded === tileset.length) {\n set(this, 'tilesLoaded', MAP);\n // this.drawGrids(MAP);\n this.drawGrid(\n \"gamecanvas-flat\",\n \"hsl(60, 10%, 85%)\",\n true,\n this.currentLayout,\n this.mapService.hexMap,\n this.showTiles\n );\n\n }\n }\n\n this.tileGraphics.pushObject(tileGraphic);\n }\n }", "function calculateTileSize(tileCount, setclassname){\n\t\t//TODO: zwischen ID und class unterscheiden\n\t\tvar percentageTileSize = 1/tileCount * 100;\n\t\t$('.' + setclassname).css({\"width\" : percentageTileSize +'%', \"height\" : percentageTileSize +'%'});\n\t\t\n\t}", "get size() {\n if (this.isEmpty)\n return 0;\n let size = this.nextLayer.size;\n for (let chunk of this.chunk)\n size += chunk.value.length;\n return size;\n }", "function makeTileRender(gl) {\n let currentTile = -1;\n let numTiles = 1;\n let tileWidth;\n let tileHeight;\n let columns;\n let rows;\n\n let firstTileTime = 0;\n\n let width = 0;\n let height = 0;\n\n // initial number of pixels per rendered tile\n // based on correlation between system performance and max supported render buffer size\n // adjusted dynamically according to system performance\n let pixelsPerTile = pixelsPerTileEstimate(gl);\n\n let pixelsPerTileQuantized = pixelsPerTile;\n\n let desiredTimePerTile = 22; // 45 fps\n\n let timePerPixelSum = desiredTimePerTile / pixelsPerTile;\n let samples = 1;\n let resetSum = true;\n\n function addToTimePerPixel(t) {\n if (resetSum) {\n timePerPixelSum = 0;\n samples = 0;\n resetSum = false;\n }\n\n timePerPixelSum += t;\n samples++;\n }\n\n function getTimePerPixel() {\n return timePerPixelSum / samples;\n }\n\n function reset() {\n currentTile = -1;\n firstTileTime = 0;\n resetSum = true;\n }\n\n function setSize(w, h) {\n width = w;\n height = h;\n reset();\n }\n\n function setTileDimensions(pixelsPerTile) {\n const aspectRatio = width / height;\n\n // quantize the width of the tile so that it evenly divides the entire window\n tileWidth = Math.ceil(width / Math.round(width / Math.sqrt(pixelsPerTile * aspectRatio)));\n tileHeight = Math.ceil(tileWidth / aspectRatio);\n pixelsPerTileQuantized = tileWidth * tileHeight;\n\n columns = Math.ceil(width / tileWidth);\n rows = Math.ceil(height / tileHeight);\n numTiles = columns * rows;\n }\n\n function initTiles() {\n if (firstTileTime) {\n const timeElapsed = Date.now() - firstTileTime;\n const timePerTile = timeElapsed / numTiles;\n const error = desiredTimePerTile - timePerTile;\n\n // higher number means framerate converges to targetRenderTime faster\n // if set too high, the framerate fluctuates rapidly with small variations in frame-by-frame performance\n const convergenceStrength = 1000;\n\n pixelsPerTile = pixelsPerTile + convergenceStrength * error;\n addToTimePerPixel(timePerTile / pixelsPerTileQuantized);\n }\n\n firstTileTime = Date.now();\n\n pixelsPerTile = clamp(pixelsPerTile, 8192, width * height);\n\n setTileDimensions(pixelsPerTile);\n }\n\n function nextTile() {\n currentTile++;\n\n if (currentTile % numTiles === 0) {\n initTiles();\n currentTile = 0;\n }\n\n const x = currentTile % columns;\n const y = Math.floor(currentTile / columns) % rows;\n\n return {\n x: x * tileWidth,\n y: y * tileHeight,\n tileWidth,\n tileHeight,\n isFirstTile: currentTile === 0,\n isLastTile: currentTile === numTiles - 1\n };\n }\n\n return {\n setSize,\n reset,\n nextTile,\n getTimePerPixel,\n restartTimer() {\n firstTileTime = 0;\n },\n setRenderTime(time) {\n desiredTimePerTile = time;\n },\n };\n }", "countMocTiles() {\n return this.cells.length;\n }", "function count(playerData, i){\r\n const cards = playerData[`player${i}Data`];\r\n return 40-cards.hand.length-cards.leftPostPile.length-cards.middlePostPile.length-cards.rightPostPile.length-3*cards.blitzPile.length-cards.woodPile.length;\r\n\r\n}", "function drawPlayer() {\n\n /* if the player is not moving he is idling */\n\n if (!player.L &&\n !player.R &&\n !player.T &&\n !player.B && player.currentSprite !== 0) {\n player.currentSprite = 0;\n } /* going down through the sprite frame */\n\n // frame counter counts how many frames are passing, each sprite has its speed based on this\n player.centerX = player.x + (player.w / 2) - mapX / cellSize;\n player.centerY = player.y + 1 + ((player.h - 1) / 2) - mapY / cellSize;\n\n /* if the next frame does not exist return to 0 */\n if (player.currentFrame + 2 > player.sprites[player.currentSprite][0].height / player.sprites[player.currentSprite][0].width / 2) {\n frameCounter = 0;\n }\n /* currentFrame è l'indice dell'altezza della sprite */\n player.currentFrame = Math.floor(frameCounter / player.sprites[player.currentSprite][1]);\n\n\n //console.log(frameCounter)\n printPlayer();\n\n frameCounter++;\n}", "function _sh_workspace_count_changed( windexer, count ){\n\tplane_height = global.stage.height +\n\t\t( (count - 1) * sliding_height );\n\tfor( let i in subplanes )\n\t\tsubplanes[i].set_size( plane_width, plane_height );\n}", "function frames(minute, number) {\n \n let fps = minute * number * 60;\n console.log(\"For \" + minute + \" minutes \" + \" and number \" + number + \"the FPS IS \" + fps);\n return fps;\n }", "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "function drawTiles(){\n for (var i = 0; i < ground.length; i++){\n image(tile, ground[i], 320);\n \n ground[i] -= 1;\n \n if (ground[i] <= -50){\n ground[i] = width;\n }\n }\n\n}", "function countTexts(frameY) {\r totalCAP++;\r panelCAP++;\r\r if(frameY < 3000) {\r topRowCAP++;\r }\r}", "function getFps(){\n\tfps++;\n\tif(Date.now() - lastTime >= 1000){\n\t\tfpsCounter.innerHTML = fps;\n\t\tfps = 0;\n\t\tlastTime = Date.now(); \n\t}\n}", "calculateGameObjectCount() {\n\t\tlet area = window.innerWidth * window.innerHeight;\n\t\tthis.gameObjectCount = Math.floor(area * this.resCoefficient);\n\t\tconsole.log('game object count: ' + this.gameObjectCount);\n\t}", "function frames(minutes, fps) {\n\treturn minutes * 60 * fps;\n}", "function spawnClouds(){\r\n // write your code here \r\n if(frameCount%60===0){\r\n cloud=createSprite(600,100,40,10);\r\n cloud.velocityX=-3;\r\n cloud.addImage(cloudImage)\r\n cloud.scale=0.4\r\n cloud.y=Math.round(random(10,60))\r\n cloud.depth=trex.depth\r\n trex.depth=trex.depth+1\r\n cloud.lifetime=200\r\n\r\n}\r\n}", "function counting(context)\n{\n\t\tif(GameState.Counting>=0)\n\t\t{\n\t\t\tvar countImg = new Image();\n\t\t\tcountImg.src = \"image/\"+GameState.Counting+\".gif\";\n\t\t\tcontext.drawImage(countImg, 400, 200, 100, 100);\n\t\t}\n}", "get queueLength()\n {\n if (this.insert === this.end)\n {\n return 0;\n }\n else\n {//remove layer changes from queueLength as they don't take up a tick\n let _return = 0;\n const queue = this.queue;\n for (let i = this.end, insert = this.insert; i < insert; ++i )\n {\n if (queue[i].type < spriteY)//values above this are instant teleports\n {\n ++_return;\n }\n }\n return _return;\n }\n }", "function calcAnimationLength() {\r\n return data[data.length - 1].time / 1000 + \"s\"\r\n}", "Nr(){\n return this.Lj*12/6+1\n }", "function changeFrames() {\n enemies.map(enemy => enemy.frame = (++enemy.frame) % numberOfFrames);\n }", "getSize() {\n\t\tlet pattern = this.getPattern();\n\t\tlet highestRow = 0;\n\t\tlet highestCol = 0;\n\t\tfor(let block of pattern){\n\t\t\tlet row = block[0] + 1;\n\t\t\tlet col = block[1] + 1;\n\n\t\t\tif(row >= highestRow){\n\t\t\t\thighestRow = row;\n\t\t\t}\n\t\t\tif(col >= highestCol){\n\t\t\t\thighestCol = col;\n\t\t\t}\n\n\t\t}\n\t\tthis.width = highestCol;\n\t\tthis.height = highestRow;\n\t}", "function updateTileNumber(ogNum){\n\treturn ogNum * 1;\n}", "GetClipCount() {}", "getNumCols() {\n return this._tiles[0].length;\n }", "function getColBlockNum()\n {\n return totalTiles;\n }", "function numbers(){\n for(let i=1;i<tileColCount;i++)\n {\n let tmpx= i*(tileW+3);\n let tmpy=0;\n ctx.fillStyle=\"black\";\n ctx.font = \"15px Georgia\";\n ctx.fillText(i,tmpx+3,tmpy+12,20); \n }\n for(let j=1;j<tileRowCount;j++)\n {\n let tmpy= j*(tileW+3);\n let tmpx=0;\n ctx.fillStyle=\"black\";\n ctx.font = \"15px Georgia\";\n ctx.fillText(j,tmpx,tmpy+14,20); \n }\n}", "function makeTileRender(gl) {\n var desiredMsPerTile = 21;\n var currentTile = -1;\n var numTiles = 1;\n var tileWidth;\n var tileHeight;\n var columns;\n var rows;\n var width = 0;\n var height = 0;\n var totalElapsedMs; // initial number of pixels per rendered tile\n // based on correlation between system performance and max supported render buffer size\n // adjusted dynamically according to system performance\n\n var pixelsPerTile = pixelsPerTileEstimate(gl);\n\n function reset() {\n currentTile = -1;\n totalElapsedMs = NaN;\n }\n\n function setSize(w, h) {\n width = w;\n height = h;\n reset();\n calcTileDimensions();\n }\n\n function calcTileDimensions() {\n var aspectRatio = width / height; // quantize the width of the tile so that it evenly divides the entire window\n\n tileWidth = Math.ceil(width / Math.round(width / Math.sqrt(pixelsPerTile * aspectRatio)));\n tileHeight = Math.ceil(tileWidth / aspectRatio);\n columns = Math.ceil(width / tileWidth);\n rows = Math.ceil(height / tileHeight);\n numTiles = columns * rows;\n }\n\n function updatePixelsPerTile() {\n var msPerTile = totalElapsedMs / numTiles;\n var error = desiredMsPerTile - msPerTile; // tweak to find balance. higher = faster convergence, lower = less fluctuations to microstutters\n\n var strength = 5000; // sqrt prevents massive fluctuations in pixelsPerTile for the occasional stutter\n\n pixelsPerTile += strength * Math.sign(error) * Math.sqrt(Math.abs(error));\n pixelsPerTile = clamp(pixelsPerTile, 8192, width * height);\n }\n\n function nextTile(elapsedFrameMs) {\n currentTile++;\n totalElapsedMs += elapsedFrameMs;\n\n if (currentTile % numTiles === 0) {\n if (totalElapsedMs) {\n updatePixelsPerTile();\n calcTileDimensions();\n }\n\n totalElapsedMs = 0;\n currentTile = 0;\n }\n\n var isLastTile = currentTile === numTiles - 1;\n var x = currentTile % columns;\n var y = Math.floor(currentTile / columns) % rows;\n return {\n x: x * tileWidth,\n y: y * tileHeight,\n tileWidth: tileWidth,\n tileHeight: tileHeight,\n isFirstTile: currentTile === 0,\n isLastTile: isLastTile\n };\n }\n\n return {\n nextTile: nextTile,\n reset: reset,\n setSize: setSize\n };\n }", "_incrementFrame() {\n this._elapsedFrameCount += 1;\n }", "update() {\n this.tickCount += 1;\n if (this.tickCount > this.ticksPerFrame) {\n this.tickCount = 0;\n // If the current frame index is in range\n if (this.frameIndex < this.numberOfFrames - 1) {\n // Go to the next frame\n this.frameIndex += 1;\n } else {\n this.frameIndex = 0;\n }\n }\n }", "function CreateTextureSheet() {\n Game.ImagesLoading = 0;\n for (var k = 0; k < 10; k++) {\n LoadImage(k);\n }\n}", "visibleCount() {\n const tileCount = Object.keys(this.vTiles).reduce((prev, order) => {\n set(prev, [order], (this.noTilesAtOrder(order) ? 0 : this.vTiles[order].length));\n\n return prev;\n }, {});\n\n const vCount = Object.keys(this.visibleMap).reduce((prev, order) => {\n set(prev, [order], (has(this.visibleMap, [order])&&this.visibleMap[order] ? this.visibleNpixAt(order).length : 0));\n return prev;\n }, {});\n\n return {tileCount, vCount};\n }", "function blocks(count) {\n return count * 10;\n}", "getLayerTurnCount() {\n return this.current == null ? this.ltm : this.ltm + this.countLayerTurns(this.current);\n }", "_frame () {\n this._drawFrame()\n if (!this.paused) {\n if (this.frameCount % 4 === 0) {\n this._updateGeneration()\n this.matrix = this.nextMatrix\n this.nextMatrix = this._createMatrix()\n this.counter.innerText = 'Generation: ' + this.generationNumber\n }\n }\n this.frameCount++\n requestAnimationFrame(this._frame)\n }", "function tetris(){\n\tif(frameCount % 60 === 0) {\n\t\tvar tetris = createSprite(200,1,50,50);\n\t\ttetris.x = mario.x\n\t\ttetris.scale = 0.3\n\t\ttetris.velocityY = tetris.velocityY + 2\n\n\t\t\n\t\t\n\n\tvar rand = Math.round(random(1,7));\n switch(rand) {\n case 1: tetris.addImage(t1img);\n break;\n case 2: tetris.addImage(t2img);\n break;\n case 3: tetris.addImage(t3img);\n break;\n case 4: tetris.addImage(t4img);\n break;\n case 5: tetris.addImage(t5img);\n break;\n case 6: tetris.addImage(t6img);\n break;\n\t case 7: tetris.addImage(t7img);\n break;\n default: break;\n}\ntgroup.add(tetris)\n}}", "function tileSelector () {\n var i;\n for(i=0; i < 7; i++) {\n tileGenerator(i);\n }\n}", "increaseShotsFired(count) {\n\n const accuracy = Math.floor((this.kills / this.shotsFired) * 100) || 0;\n\n this.shotsFired += count\n this.scene.component.setState({ shotsFired: this.shotsFired, accuracy });\n\n }", "inversionCount() {\n //make array of # of inversions per tile\n var invArray = this.tiles.map((num, i) => {\n var inversions = 0;\n for (let j = i + 1; j < this.tiles.length; j++) {\n if (this.tiles[j] != 0 && this.tiles[j] < num) {\n inversions++;\n }\n }\n return inversions;\n });\n\n //sum up all inversions and return total\n return invArray.reduce(function(a, b) {\n return a + b;\n });\n }", "function numberSteps() {\n\tlet countPlay = numMove + 1; \n\tnumMove = document.getElementById('moveCount').innerHTML = countPlay;\n}", "render() {\n this.steps = this.step_limit - this.playfield.swap_counter;\n \n if (this.steps >= 10) {\n let d1_count = this.getDigit(this.steps, 0);\n let d2_count = this.getDigit(this.steps, 1);\n \n this.d1.frame = d1_count;\n this.d2.frame = d2_count;\n }\n else {\n this.d1.frame = this.steps;\n this.d2.frame = 0;\n }\n }", "function spawnLeaf() {\n\n // to check if the remainder is 0 \n if (World.frameCount % 60 === 0) {\n \n leaf = createSprite(100, 100, 20, 20);\n\n //to move the leaf\n leaf.velocityY = 3;\n\n //to add image for leaf\n leaf.addImage(leafImg);\n\n //to resize the leaf\n leaf.scale = 0.05;\n\n //to display leaf in different positions\n leaf.x = Math.round(random(100, 390));\n }\n}", "getNumRows() {\n return this._tiles.length;\n }", "tileHorizontally(time) {\n const images = [...this.imageUrls];\n\n // Randomize which image is shown first by rotating the array a random\n // number of times.\n randomRotate(images);\n\n const wall = wallGeometry.extents;\n let totalWidth = 0;\n while (totalWidth < wall.w) {\n const image = this.images[images[0]];\n // fit to height\n const scale = wall.h / image.height;\n const x = wall.x + totalWidth;\n // Limit the width to the remaining width on the wall.\n const w = Math.min(\n Math.floor(image.width * scale),\n wall.w - totalWidth /* this is the remaining width */);\n\n const index = this.instances.length;\n this.instances.push({\n url: images[0],\n scale,\n x,\n y: 0,\n });\n debug(\"tile horizontal\", images[0], scale, x, w);\n\n // Make a polygon for the image.\n var poly = new Polygon([\n {x: x, y: 0},\n {x: x + w, y: 0},\n {x: x + w, y: wall.y + wall.h},\n {x: x, y: wall.y + wall.h},\n ]);\n\n this.polygons.push(this.processPolygon(initPolygon(poly, time, index, {\n counted: 1,\n r: 0,\n g: 0,\n b: 0\n })));\n\n // update totalWidth to advance the next image to the right.\n totalWidth += w;\n\n // rotate the images array to cycle through the given images.\n images.push(images.shift());\n }\n }", "function compute_fps() {\n let counter_element = document.querySelector(\"#fps-counter\");\n if (counter_element != null) {\n counter_element.innerText = \"FPS: \" + g_frames_since_last_fps_count;\n }\n g_frames_since_last_fps_count = 0;\n}", "function initTiles(){\n\n let sky = new Image();\n sky.src=\"./imgs/sky-temp.png\";\n tiles.push(sky);\n let ground = new Image();\n ground.src=\"./imgs/ground-tile.png\";\n tiles.push(ground);\n let walk1 = new Image();\n walk1.src=\"./imgs/walk1.png\";\n tiles.push(walk1);\n let walk2 = new Image();\n walk2.src=\"./imgs/walk2.png\";\n tiles.push(walk2);\n let walk3 = new Image();\n walk3.src=\"./imgs/walk3.png\";\n tiles.push(walk3);\n let walk4 = new Image();\n walk4.src=\"./imgs/walk4.png\";\n tiles.push(walk4);\n let moon = new Image();\n moon.src=\"./imgs/moon-temp.png\";\n tiles.push(moon);\n let sun = new Image();\n sun.src=\"./imgs/sun.png\";\n tiles.push(sun);\n let plpic = new Image();\n plpic.src=\"./imgs/abomination.png\";\n tiles.push(plpic);\n let back_new= new Image();\n back_new.src=\"./imgs/tree_70x128.png\";\n tiles.push(back_new);\n let back_cloud= new Image();\n back_cloud.src=\"./imgs/back_proper.png\";\n tiles.push(back_cloud);\n let speed= new Image();\n speed.src=\"./imgs/speed.png\";\n tiles.push(speed);\n\n }", "render() {\n this.context.drawImage(\n this.image,\n (this.frameIndex * this.width) / this.numberOfFrames,\n 0,\n this.width / this.numberOfFrames,\n this.height,\n 0,\n 0,\n this.width / this.numberOfFrames,\n this.height\n );\n }", "function C_FrameCounter ()\n{\n this.FrameCounter = 0 ;\n\n // increment frame rate\n this.M_IncreaseFrameCounter = function ()\n {\n this.FrameCounter ++ ;\n return this.FrameCounter ;\n }\n}", "static get PLAYER_SIZE() {\n return 10;\n }", "count() {\n return this.arrayWidth * this.arrayHeight;\n }", "countBlockTurns(move) {\n let layerCount = move.getLayerCount();\n let layerMask = move.getLayerMask();\n let turns = Math.abs(move.getAngle()) % 4;\n if (turns == 0) {\n return 0;\n } else {\n let previousTurnedLayer = 0;\n let countTurned = 0;\n let previousImmobileLayer = 1;\n let countImmobile = 0;\n for (let i = 0; i < layerCount; i++) {\n let currentLayer = (layerMask >>> i) & 1;\n if (currentLayer == 1 && currentLayer != previousTurnedLayer) {\n countTurned++;\n }\n if (currentLayer == 0 && currentLayer != previousImmobileLayer) {\n countImmobile++;\n }\n previousTurnedLayer = previousImmobileLayer = currentLayer;\n }\n return Math.min(countTurned, countImmobile);\n }\n }", "function displayPlayerCount()\n{\n\tconsole.log(\"FPS: \" + (new Date().getTime() - updateTime) / updateCounter);\n\tupdateTime = new Date().getTime();\n\tupdateCounter = 0;\n\tfor (var mapId in connected)\n\t{\n\t\tvar n = 0;\n\n\t\tfor (var i in connected[mapId])\n\t\t{\n\t\t\tn++;\n\t\t}\n\n\t\tvar currentTime = new Date();\n\t\tvar t = \"\";\n\n\t\tif (currentTime.getHours() < 10)\n\t\t{\n\t\t\tt = \"0\";\n\t\t}\n\n\t\tt += currentTime.getHours() + \":\";\n\n\t\tif (currentTime.getMinutes() < 10)\n\t\t{\n\t\t\tt += \"0\";\n\t\t}\n\n\t\tt += currentTime.getMinutes() + \":\";\n\n\t\tif (currentTime.getSeconds() < 10)\n\t\t{\n\t\t\tt += \"0\";\n\t\t}\n\n\t\tt += currentTime.getSeconds();\n\n\t\tconsole.log(t + \" - \" + n + \" players connected and \" + mapEntities[mapId].length + \" CPUs on map \" + mapId);\n\t}\n}", "function getPlayerXTileIndex()\n{\n var position = player.body.x;\n\n return Math.round(position / TILE_WIDTH);\n}", "minutePosition() {\n return this.frameCount % this.framesPerMin;\n }", "function markerSize(count) {\n return 35000 + count*300;\n}", "get frame() {\n if (this.video.current) {\n return Math.round(this.video.current.currentTime * this.props.fps);\n }\n\n return 0;\n }", "N() {\n return this.maxIteration - this.iteration;\n }", "setInitialTiles(tiles, wallSize) {\n this.tiles = tiles.map(v => parseInt(v));\n this.players.forEach(player => { player.handSize = this.tiles.length; });\n this.checkDealBonus();\n }", "function fpsTick(thisFrame) {\n fpsStart = fpsStart || new Date().getTime();\n if (thisFrame - fpsStart >= 1000) {\n fpsStart += 1000;\n fps = fpsCounting;\n fpsCounting = 0;\n fpsText.innerHTML = fps + \" fps\";\n }\n fpsCounting++;\n if (debug)\n addTaskForFrame(fpsTick);\n }", "getPixelCoordsFromTileIndex(i) {\n return {\n x: (i % this.width.tiles) * this.tileSize,\n y: Math.floor(i / this.width.tiles) * this.tileSize\n };\n }", "function getSpritesSize(data) {\n var heroes = Object.values(data);\n var i = heroes.length;\n var x = (Math.floor(i / rows) + 1) * spriteSize;\n var y = rows * spriteSize;\n return {\n \"x\": x,\n \"y\": y\n };\n}", "countLayerTurns(move) {\n let layerCount = move.getLayerCount();\n let layerMask = move.getLayerMask();\n let turns = Math.abs(move.getAngle()) % 4;\n if (turns == 0) {\n return 0;\n } else {\n let count = 0;\n for (let i = 0; i < layerCount; i++) {\n if (((layerMask >>> i) & 1) == 1) {\n count++;\n }\n }\n return Math.min(count, layerCount - count);\n }\n }", "calculateLevel() {\n if (lines_cleared < 10) {\n if (frames == 53) {\n this.update();\n }\n } else if (lines_cleared < 20) {\n if (frames == 49) {\n this.update();\n }\n } else if (lines_cleared < 30) {\n if (frames == 45) {\n this.update();\n }\n } else if (lines_cleared < 40) {\n if (frames == 41) {\n this.update();\n }\n } else if (lines_cleared < 50) {\n if (frames == 37) {\n this.update();\n }\n } else if (lines_cleared < 60) {\n if (frames == 33) {\n this.update();\n }\n } else if (lines_cleared < 70) {\n if (frames == 28) {\n this.update();\n }\n } else if (lines_cleared < 80) {\n if (frames == 22) {\n this.update();\n }\n } else if (lines_cleared < 90) {\n if (frames == 17) {\n this.update();\n }\n } else if (lines_cleared < 100) {\n if (frames == 11) {\n this.update();\n }\n } else if (lines_cleared < 110) {\n if (frames == 10) {\n this.update();\n }\n } else if (lines_cleared < 120) {\n if (frames == 9) {\n this.update();\n }\n } else if (lines_cleared < 130) {\n if (frames == 8) {\n this.update();\n }\n } else if (lines_cleared < 140) {\n if (frames == 7) {\n this.update();\n }\n } else if (lines_cleared < 160) {\n if (frames == 6) {\n this.update(); \n }\n } else if (lines_cleared < 180) {\n if (frames == 5) {\n this.update();\n }\n } else if (lines_cleared < 200) { \n if (frames == 4) {\n this.update();\n }\n } else {\n if (frames == 3) {\n this.update();\n }\n }\n\n frames++;\n if (frames > 53) { // This is just a failsafe in case something goes wrong and it dosen't switch earlier.\n frames = 0; \n }\n\n level = Math.floor(lines_cleared/10) + 1; // Level up once every 10 lines\n return level;\n }", "constructor() {\n //this.groundColor = color(130, 100, 90);\n //this.skyColor = color(230, 250, 250);\n\n // Tile size actual is the size of the tile images.\n // Tiles may be scaled up to tile size drawn at lower pixel density.\n this.tileSizeActual = 16;\n this.tilePadding = 2;\n this.tileSizeDrawn = 16;\n\n // Frequncies for the noise function. The higher the frequency, the smaller the patches formed.\n this.tileNoiseFrequency = 0.1;\n this.subFromNoise = 0.05;\n this.biomeNoiseFrequency = 0.01;\n\n // Tile names and their row,column indices in the tile set\n this.tileIndex = {\n none: null,\n default: {\n tileset: undefined,\n default: {\n clay: [0, 0],\n concrete: [0, 1]\n },\n building: {\n steel: [1, 0],\n creepyBrick: [1, 1],\n sandstone: [1, 2],\n }\n },\n jungle: {\n tileset: undefined,\n default: {\n grass: [0, 0],\n swamp: [0, 1],\n mud: [0, 2],\n clay: [0, 3],\n ash: [0, 4],\n },\n building: {\n stoneBrick: [1, 0],\n stoneBlock: [1, 1],\n goldBrick: [1, 2]\n }\n }\n };\n\n // Dirty flag to keep track of changes made to the buffer\n // Dirty will be set when a tile is created or destroyed, prompting pixel loads and updates.\n this.dirty = false;\n\n // List of objects in the world to check player for collision against\n this.colliders = [];\n }", "function THREEcapFramePool(width, height, depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.size = width * height * depth;\n this.frames = [];\n this.pending = [];\n this.allocations = 0;\n}", "function THREEcapFramePool(width, height, depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.size = width * height * depth;\n this.frames = [];\n this.pending = [];\n this.allocations = 0;\n}", "function bulletCount(){\n let xPos = width - width/25;\n let yPos = height - height/25;\n for(let i = 0; i < reload; i++){\n fill('rgba(255, 0, 0, 0.5)');\n noStroke();\n ellipse(xPos, yPos, width/100, width/100);\n xPos -= width/50;\n }\n}", "function aniSprite (columnSize : int, rowSize : int, colFrameStart : int, rowFrameStart : int, totalFrames : int, framesPerSecond : float, indexReset : float)// function for animating sprites\n{\n\tvar index : int = (Time.time-indexReset) * framesPerSecond;\t\t\t\t\t\t\t\t\t\t\t\t\t// time control fps\n\tindex = index % totalFrames;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// modulate to total number of frames\n\t\n\tvar size = Vector2 ( 1.0 / columnSize, 1.0 / rowSize);\t\t\t\t\t\t\t\t\t\t\t// scale for column and row size\n\t\n\tvar u = index % columnSize;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// u gets current x coordinate from column size\n\tvar v = index / columnSize;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// v gets current y coordinate by dividing by column size\n\t\n\tvar offset = Vector2 ((u + colFrameStart) * size.x,(1.0 - size.y) - (v + rowFrameStart) * size.y); // offset equals column and row\n\t//var offset = Vector2 ((u + colFrameStart) * size.x, rowFrameStart*size.y);\n\t//var offset = Vector2 ((u + colFrameStart) * size.x, 1 - (v+rowFrameStart)*size.y);\n\t\n\trenderer.material.mainTextureOffset = offset;\t\t\t\t\t\t\t\t\t\t\t\t\t// texture offset for diffuse map\n\trenderer.material.mainTextureScale = size;\t\t\t\t\t\t\t\t\t\t\t\t\t\t// texture scale for diffuse map\n\t\n\t//renderer.material.SetTextureOffset (\"_BumpMap\", offset);\t\t\t\t\t\t\t\t\t\t// texture offset for bump (normal map)\n\t//renderer.material.SetTextureScale (\"_BumpMap\", size);\t\t\t\t\t\t\t\t\t\t\t// texture scale for bump (normal map) \n}", "loop(timeStamp) {\n\n /* timeLastUpdate erhöht sich um den Timestamp. Dabei wird time abgezogen weil ansonsten die bereits \n erfasste Zeit mitaddiert wird und dadurch ein zu hoher Wert entsteht*/\n this.timeLastUpdate += timeStamp - this.time;\n this.time = timeStamp;\n\n /* Sicherheitsvorrichtung um zu verhindern, dass durch zu langsame Rechner die CPU Überlasted wird, weil mehrere tiles geupdated werden*/\n if (this.timeLastUpdate >= this.timeStep * 3) {\n\n this.timeLastUpdate = this.timeStep;\n }\n\n /*Wir wollen für jeden vergangenen Timestep ein Update haben, deshalb wird als Grundlage hier timeLastUpdate genutzt. timeStep wird nach jedem \n Ablauf von timeLastUpdate abgezogen. Sollten durch Geschwindigkeitsprobleme Verzögerungen entstehen werden trotzdem alle Updates durchgeführt. \n */\n while (this.timeLastUpdate >= this.timeStep) {\n\n //Substraktion um zu indizieren, dass das Update für einen Step erfolgt ist\n this.timeLastUpdate -= this.timeStep;\n\n this.update(timeStamp);\n\n // Indikator wird auf true gesetzt damit gerendert werden soll\n this.updated = true;\n\n }\n\n /* Das Spiel soll nur gerendert werden wenn, dass Spiel geupdated wurde */\n if (this.updated) {\n\n //Wird auf false gesetzt damit nicht sofort wieder gerendert wird\n this.updated = false;\n this.render(timeStamp);\n\n }\n\n //Window Funtktion die aufgerufen wird um eine Animation zu updaten\n this.requestAnimationFrame = window.requestAnimationFrame(this.handleLoop);\n\n }", "function animateCount() {\n\n\tif (currentLoopIndex > cycleLoop.length - 1) {\n\t\treturn;//Stops the loop\n\t}\n\telse if(currentLoopIndex >= 10)\n\t{\n\t\tctx_count.clearRect(0, 0, canvas_count.width, canvas_count.height);\n\t\tdrawNumberDouble(1,0);\n\t}\n\telse\n\t{\n\t\tctx_count.clearRect(0, 0, canvas_count.width, canvas_count.height);\n\t\tdrawNumber(cycleLoop[currentLoopIndex]);\n\t}\n\tcurrentLoopIndex++;\n\tsetTimeout(animateCount, delay);\n}", "draw() {\n this.tiles.forEach(t => {\n var tileCoords = {\n x: this.origin.x + (t.x * 8) + 16,\n y: this.origin.y + (t.y * 8)\n }\n this.context.drawImage(RESOURCE.sprites, t.t * 8, 16, 8, 8, tileCoords.x, tileCoords.y, 8, 8);\n });\n }", "function logAverageFrame(times) { // times is the array of User Timing measurements from updatePositions()\n var numberOfEntries = times.length;\n var sum = 0;\n for (var i = numberOfEntries - 1; i > numberOfEntries - 11; i--) {\n sum = sum + times[i].duration;\n }\n console.log('Average time to generate last 10 frames: ' + sum / 10 + 'ms');\n}", "function timeIt() {\n mousePressedDuration++;\n distance = dist( mouseX, mouseY, width / 2, height / 2);\n if (mousePressedDuration == 28) {\n clearInterval(interval);\n }\n pressSize = map(mousePressedDuration, 0, 28, 5, 70);\n if (distance <= canvasDimension && distance >= 50 && uploaded === false) {\n newPlanetPrev.size = pressSize;\n }\n}", "render() {\n ctx.drawImage(Resources.get(this.sprite), (this.col * tileWidth) - tileWidth, this.row * tileHeight - entityOffesetY+10);\n }", "function loadFrames(){\n var newFrames = [];\n for(let i = 0; i < frameNumber ; i++){\n var img = new Image();\n img.src = framePath + frameChoice + i + frameExtension;\n newFrames.push(img);\n }\n frames = newFrames;\n currentFrame = 0;\n currentFrameDrawCount = 0;\n}", "drawScene() {\n const positions = this.getTilePositions();\n this.updateTileSpecs();\n if (debug) {\n this.redrawStarted = Date.now();\n this.redrawnTiles = 0;\n }\n this.drawTiles(positions);\n if (debug) {\n const elapsed = Date.now() - this.redrawStarted;\n if (elapsed > 5) {\n console.log(`Took ${elapsed} msecs to redraw for ${positions.startXTile} ${positions.startYTile} (redrawnTiles: ${this.redrawnTiles})`);\n }\n }\n }", "render(renderParameters) {\r\n\t\t\t\t var tileSize = this.layer.tileInfo.size[0];\r\n\t\t\t\t var state = renderParameters.state;\r\n\t\t\t\t var pixelRatio = state.pixelRatio;\r\n\t\t\t\t var width = state.size[0];\r\n\t\t\t\t var height = state.size[1];\r\n\t\t\t\t var context = renderParameters.context;\r\n\t\t\t\t var coords = [0, 0];\r\n\r\n\t\t\t\t context.fillStyle = \"rgba(0,0,0,0.25)\";\r\n\t\t\t\t context.fillRect(0, 0, width * pixelRatio, height * pixelRatio);\r\n\t\t\t\t }", "step() {\n const backBufferIndex = this.currentBufferIndex === 0 ? 1 : 0;\n const currentBuffer = this.buffer[this.currentBufferIndex];\n const backBuffer = this.buffer[backBufferIndex];\n\n const countNeighbors = (x, y, options={border: 'wrap'}) => {\n let neighborCount = 0;\n\n // Actually count living neighbors\n if (options.border === 'wrap') {\n let north = y - 1;\n let south = y + 1;\n let west = x - 1;\n let east = x + 1;\n\n if (north < 0) north = this.height - 1;\n\n if (south > this.height - 1) south = 0;\n\n if (west < 0) west = this.width - 1;\n\n if (east > this.width - 1) east = 0;\n\n neighborCount = \n currentBuffer[north][west] + \n currentBuffer[north][x] + \n currentBuffer[north][east] + \n currentBuffer[y][west] + \n currentBuffer[y][east] + \n currentBuffer[south][x] + \n currentBuffer[south][east] + \n currentBuffer[south][west];\n\n } else if (options.border === 'nowrap') {\n // Treat out of bounds as zero\n for (let yOffset = -1; yOffset <= 1; yOffset++) {\n let yPos = y + yOffset;\n if (yPos < 0 || yPos >= this.height) continue; // Out of bounds\n\n for (let xOffset = -1; xOffset <= 1; xOffset++) {\n let xPos = x + xOffset;\n if (xPos < 0 || xPos >= this.width) continue; // Out of bounds\n if (yPos === y && xPos === x) continue; // Can't be your own neighbor\n neighborCount += currentBuffer[yPos][xPos];\n }\n }\n } else {\n throw new Error('Unknown border option: ' + options.border);\n }\n return neighborCount;\n }\n\n // Update backBuffer to have the next time state\n for(let y = 0; y < this.height; y++) {\n for (let x = 0; x < this.width; x++) {\n const neighbors = countNeighbors(x, y);\n const thisCell = currentBuffer[y][x];\n\n // Implement GoL rules\n if (thisCell) {\n //Current cell is alive\n if (neighbors < 2 || neighbors > 3) {\n // Death\n backBuffer[y][x] = 0;\n } else {\n // Alive\n backBuffer[y][x] = 1;\n }\n } else {\n // Current cell is dead\n if (neighbors === 3) {\n // A cell is born\n backBuffer[y][x] = 1;\n } else {\n // Still dead\n backBuffer[y][x] = 0;\n }\n }\n }\n }\n\n this.currentBufferIndex = backBufferIndex;\n }", "getNextFrame() {\nvar f;\nf = this.fCur + 1;\nif (this.fCount <= f) {\nf = 0;\n}\nreturn this.setFrameAt(f);\n}", "function render(){\n fc++;\n requestAnimationFrame(render);\n var currentconfig = {\n scale: {_x: stage.scale._x, _y:stage.scale._y},\n position: {_x: stage.position._x, _y:stage.position._y},\n canvasWidth: renderer.view.width,\n canvasHeight: renderer.view.height\n }\n if(fc % 15 === 0)\n util.worker(currentconfig);\n\n //load stage\n renderer.render(stage);\n if(fc > 60) fc=0;\n}" ]
[ "0.69714344", "0.67848927", "0.6593722", "0.649643", "0.6483208", "0.64464253", "0.63163495", "0.62803954", "0.6234065", "0.6233675", "0.6186772", "0.6172054", "0.615826", "0.6126344", "0.6119385", "0.6091285", "0.60773027", "0.6062018", "0.60596883", "0.6020417", "0.5968177", "0.5957227", "0.5952708", "0.59325117", "0.591658", "0.5906302", "0.5905691", "0.58922166", "0.58596146", "0.5850326", "0.5833472", "0.5830414", "0.5820463", "0.58113295", "0.5804538", "0.580396", "0.5802898", "0.58027816", "0.57853144", "0.57606065", "0.5758352", "0.5750845", "0.5740222", "0.5737206", "0.57336986", "0.5729659", "0.57273954", "0.57226175", "0.5721156", "0.5718265", "0.5717969", "0.5712592", "0.5708146", "0.5699488", "0.56983846", "0.5691954", "0.56845003", "0.5680851", "0.5679967", "0.56766707", "0.5663095", "0.5659681", "0.5656902", "0.5656339", "0.5637873", "0.56339693", "0.56339014", "0.56313837", "0.5615793", "0.56138235", "0.56118226", "0.5610468", "0.56031185", "0.5602229", "0.56015706", "0.560125", "0.559824", "0.55839956", "0.5569826", "0.55672604", "0.555824", "0.5554759", "0.5553959", "0.55525106", "0.55481195", "0.5547752", "0.5547752", "0.5547546", "0.55440384", "0.5542602", "0.55407", "0.55395377", "0.5529151", "0.5527649", "0.5521575", "0.55158865", "0.55155414", "0.55144364", "0.55135953", "0.5512981", "0.5510112" ]
0.0
-1
attackable from a certain coordinate ie does not factor in movement
attackableTiles(map, wlist = this.weapons) { let wlist2 = [] for (let w of wlist) { if (this.canUseWeapon(w)) { wlist2.push(w) } } let p = inRange(this, this.getRange(wlist2), "tiles", map); p.setArt("C_atk"); return p; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attackXY(x, y){\n arrow.pos.Vector = x;\n arrow.pos.Vector = y;\n}", "attack(enemyShip) {\n if (this.canAttack(enemyShip)) {\n const hit = Math.round(Math.random() + .3)\n if (hit && !enemyShip.sunk) {\n const damage = this.damage * Math.random()\n enemyShip.hp -= damage\n if (enemyShip.hp <= 0) enemyShip.sunk = true\n } \n }\n return enemyShip\n }", "attack(forwardSteps,rightSteps,damage,type = null,statuses = null){\r\n let attackX = this.x;\r\n let attackY = this.y;\r\n switch (this.direction) {\r\n case 0: attackY -= forwardSteps;\r\n attackX += rightSteps;\r\n break;\r\n case 90: attackX += forwardSteps;\r\n attackY += rightSteps;\r\n break;\r\n case 180: attackY += forwardSteps;\r\n attackX -= rightSteps;\r\n break;\r\n case 270: attackX -= forwardSteps;\r\n attackY -= rightSteps;\r\n break;\r\n }\r\n let attackedTile = this.field.getTile(attackX, attackY);\r\n if(attackedTile) attackedTile.attacked(damage,type,statuses);\r\n }", "attack(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y);\n // if within range, no target acquired, not dead, and the enemy is alive\n // TARGET THE ENEMY\n if (d < 300 && this.targetId < 0 && !this.dead && !enemy.dead) {\n this.targetId = enemy.uniqueId;\n this.obtainedTarget = true;\n }\n let dx = enemy.x - this.x;\n let dy = enemy.y - this.y;\n let angle = atan2(dy, dx);\n\n if (this.targetId === enemy.uniqueId) {\n // get closer to the enemy\n if (d >= 150) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n // also keep a distance from the enemy\n } else {\n this.x -= this.speed * cos(angle);\n this.y -= this.speed * sin(angle);\n }\n // if within range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n this.bullet = new Bullet(this.x, this.y, enemy.x, enemy.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n this.attacking = true;\n Fire.play();\n } else {\n this.attacking = false;\n }\n if (this.bulletFired && !this.dead) {\n this.attacking = true;\n // if the enemy is not attacking, it will fight back\n if (!enemy.attacking) {\n enemy.targetId = this.uniqueId;\n }\n this.bullet.moveTo(enemy);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n if (enemy.dead) {\n // if the targeted enemy is tank / square XL\n // if the tank gets destroyed and this unit is close to it\n // the explosion kills this unit\n if (enemy.uniqueId === 100 && enemy.uniqueId === this.targetId && d < 100){\n this.health -= enemy.damage;\n }\n this.targetId = -1;\n this.obtainedTarget = false;\n this.attacking = false;\n }\n }\n // variation to the movement\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -0.05, 0.05);\n this.vy = map(noise(this.ty), 0, 1, -0.05, 0.05);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.0001;\n this.ty += 0.0001;\n\n this.handleWrapping();\n }", "attack({enemies}, mousePos, mapSize, mapPos, scale, tileSize=32) {\n const tilePos = this.getTilePos(mousePos, mapSize, mapPos, scale, tileSize);\n\n // TODO: Add player attacking later\n // Get the enemy or player at position\n Object.keys(enemies).forEach((id) => {\n if (enemies[id].pos[0] == tilePos[0] && enemies[id].pos[1] == tilePos[1])\n this.socket.emit('attack', id);\n });\n }", "attackOverlap() {\n let a = dist(player.x, player.y, this.x, this.y);\n if (a < this.size / 2 + player.size / 2) {\n state = `endGame`;\n }\n }", "canAttack(enemyShip) {\n const directionOfAttack = this.orientation(enemyShip.x, enemyShip.y, this.x, this.y)\n if (directionOfAttack === 'left' || directionOfAttack === 'right') {\n if (this.direction === 'up' || this.direction === 'down') return true\n else return false\n } else {\n if (this.direction === 'left' || this.direction === 'right') return true\n else return false\n } \n }", "attackTarget(attack) {\n _gameService.attackTarget(attack)\n draw()\n }", "attack(from, to) {\n let attacker = this.current().getBoard(from)\n let defender = this.opponent().getBoard(to)\n attacker.defense -= defender.attack\n defender.defense -= attacker.attack\n this.resolveDamage()\n }", "function monsterAttack(){\n\tif(rleft + mleft === 56){\n\t\t$('#monster').addClass('attack');\n\t}\n\tif(rleft + mleft === 76){\n\t\t$('#monster').css('left', 10+\"em\");\n\t\txleft = 10;\n\t}\n\tif(rleft + mleft === 96){\n\t\t$('#monster').css('left', 20+\"em\");\n\t\txleft = 20;\n\t}\n\tif(rleft + mleft === 116){\n\t\t$('#monster').css('left', 30+\"em\");\n\t\txleft = 30;\n\t}\n}", "attack() {\n var velocity = this.calculateVel();\n var offset = this.face == 0? 100: 0;\n var pp = {sx: 96, sy: 160, size: 16};\n var p = new ScaleBoomerProjectiles(this.game, false, this.x+offset, this.y, velocity, this.projspeed, 2500, this.damage, 0.005, false, pp);\n this.game.entities.splice(this.game.entities.length - 1, 0, p);\n }", "update(dt){\n this.x = this.x + this.speed * dt;\n // starting the enemy again randomly\n if (this.x > 700 ){\n this.x = -10\n }\n\n // Collison with enemy when two objects hit each others\n if (Math.abs(this.x - player.x) < 75 && Math.abs(this.y - player.y) < 77) {\n player.x = 202;\n player.y = 405;\n player.lives -= 1;\n }\n }", "function Attack()\n{\n\tvar speedTowardsPlayer = moveSpeed;\n\t\n\t//if enemy is on the right side of the player move left\n\tif(player.transform.position.x < transform.position.x)\n\t{\n\t\tfacingLeft = true;\n\t\tspeedTowardsPlayer = -speedTowardsPlayer;\n\t\trenderer.material.mainTexture = mainTextures[curFrame]; // Get the current animation frame\n\t}\n\t//if enemy is on the left side of the player move right\n\telse\n\t{\n\t\tfacingLeft = false;\n\t\trenderer.material.mainTexture = altTextures[curFrame]; // Get the current animation frame\n\t}\n\t\t\n\trigidbody.velocity = Vector3(speedTowardsPlayer, rigidbody.velocity.y, 0); // Move to the left\n}", "function checkDirectHit(cx,cy,victim){\n \n \n weapon = curPlayer.getweapon();\n\n //checks if the weapon hits tank directly\n changeDelta(victim);\n if((cx>=victim.getpx() && cx<=victim.getpx()+30 )&&(cy>=terrainY[victim.getpx()]-20 && cy<=terrainY[victim.getpx()])){\n victim.sethealth(victim.gethealth()-weapons[weapon][4]);\n checkEndGame();\n console.log(\"Direct Hit\");\n return true;\n }\n return false;\n\n\n}", "function hunt() {\n\n //Do nothing every fourth step.\n if (steps % 4 == 0) {\n yZombiePos += 0;\n xZombiePos += 0;\n }\n\n //Make the Zombie match the x-axis before trying to match the player's y-axis.\n else if (xZombiePos !== xPosition) {\n\n if (xZombiePos < xPosition) {\n xZombiePos += 1;\n }\n\n else if (xZombiePos > xPosition) {\n xZombiePos -= 1;\n }\n }\n\n //If the x-axis is matched start matching y-Axis.\n else if (xZombiePos == xPosition && yZombiePos !== yPosition) {\n\n if (yZombiePos < yPosition) {\n yZombiePos += 1;\n }\n\n else if (yZombiePos > yPosition) {\n yZombiePos -= 1;\n }\n }\n \n\n}", "constructor(enemy){\n this.height = 10;\n this.width = 10;\n this.dead = false;\n this.x = enemy.x + Math.floor(enemy.width/2) - Math.floor(this.width/2);\n this.y = enemy.y + enemy.abdomen - Math.floor(this.height/2);\n this.dx = Math.floor((bearer.x + Math.floor(bearer.width/2) - (this.x + Math.floor(this.width/2)))/100);\n this.dy = Math.floor((bearer.y + Math.floor(bearer.height/2) - (this.y + Math.floor(this.height/2)))/100);\n this.dmgPlayer = 5;\n }", "function checkFlagpole()\n{\n var d = abs(gameChar_world_x - flagpole.x_pos);\n \n if(d < 50)\n {\n flagpole.isReached = true;\n }\n}", "function Attack (isEnemy: boolean) {\n\tif (CanAttack () ) {\n\t\tshootCooldown = shootingRate;\n\t\t\n\t\t// Create a new shot\n\t\tvar shotTransform = Instantiate(shotPrefab) as Transform;\n\t\t\n\t\t// Assign Position\n\t\tshotTransform.position = transform.position;\n\t\t\n\t\t// The isEnemy Property\n\t\tvar shot : ShotScript = shotTransform.gameObject.GetComponent(ShotScript);\n\t\t\tif (shot != null) \n\t\t\t{\n\t\t\t\tshot.isEnemyShot = isEnemy;\n\t\t\t}\n\t\t\t\n\t\t\t// Make the weapon shot always towards it\n\t\t\tvar move : MoveScript = shotTransform.gameObject.GetComponent(MoveScript);\n\t\t\t\tif (move != null)\n\t\t\t\t{\n\t\t\t\tmove.direction = this.transform.right;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function attackHitTest(obj1, obj2) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.attackPosition.x,obj1.attackPosition.y);\n app.main.ctx.fillStyle = \"green\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tif (obj1.attackPosition.x < obj2.position.x + obj2.size.x && obj1.attackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.attackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.attackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t}\n}", "attackHero(){\n this.attackingDelay = this.setDelay(this.attackingDelaySet);\n this.isAttacking = true;\n //attackingDirection = true is left to right; false is right to left\n this.position.x > this.hero.position.x ? this.attackingDirection = true : this.attackingDirection = false;\n this.attackingDirection ? this.isAttackingFrom = -this.attackSpeed : this.isAttackingFrom = this.attackSpeed;\n this.body.velocity.y = -400;\n this.isAttackingFor = this.setDelay(this.isAttackingSet);\n }", "function hardAttackHitTest(obj1, obj2) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.hardAttackPosition.x,obj1.hardAttackPosition.y);\n app.main.ctx.fillStyle = \"blue\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tif (obj1.attackPosition.x < obj2.position.x + obj2.size.x && obj1.attackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.attackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.attackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t} else if (obj1.hardAttackPosition.x < obj2.position.x + obj2.size.x && obj1.hardAttackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.hardAttackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.hardAttackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t}\n}", "function gm_attack(direction, pow1id, pow2id, zid, room, opponent_team, card1, normal_attack, underdog, tiebreaker, bribe, ambush) { /* (ttt.up, ) */\r\n\tlet spiked = false;\r\n\tlet reach_target = false;\r\n\tlet target_team = null;\r\n\t//if (direction(zid)>=0)\r\n\t\t//console.log(\"0/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\tif (direction(zid)>=0 && room.game.board[direction(zid)][0]!=\"\") { /* has card */\r\n\t\t//console.log(\"1/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\t\tlet target_card_id = null;\r\n\t\tlet target_zone_id = null;\r\n\t\tif (room.game.board[direction(zid)][2]===opponent_team) { /* is enemy card */\r\n\t\t\ttarget_card_id = parseInt(room.game.board[direction(zid)][1])-1;\r\n\t\t\ttarget_zone_id = direction(zid);\r\n\t\t\tif (room.game.board[direction(zid)][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t} else {\r\n\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t}\r\n\t\t} else \r\n\t\tif (room.game.board[direction(zid)][2]===(opponent_team===\"X\"?\"O\":\"X\")) { /* is allied card */\r\n\t\t\tif ((card1[4]===6 || card1[5]===6) && direction(direction(zid))>=0 && room.game.board[direction(direction(zid))][2]===opponent_team) { // [R]each\r\n\t\t\t\ttarget_card_id = parseInt(room.game.board[direction(direction(zid))][1])-1;\r\n\t\t\t\ttarget_zone_id = direction(direction(zid));\r\n\t\t\t\treach_target = true;\r\n\t\t\t\tif (room.game.board[direction(direction(zid))][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (target_card_id!=null) {\r\n\t\t\t//console.log(\"2/2 gm_attack: \",card2);\r\n\t\t\tlet card2 = null; \r\n\t\t\tif (room.game.players[0].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[0].deck[target_card_id]; \r\n\t\t\t}\r\n\t\t\telse if (room.game.players[1].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[1].deck[target_card_id];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconsole.log(\"\\n{we should never get here #1}\\n\");\r\n\t\t\t}\r\n\t\t\tif (card2!=null) { /* we are gm_attacking this card */\r\n\t\t\t\tlet has_chain = (card2[4]==7 || card2[5]==7);\r\n\t\t\t\tlet pow1 = card1[pow1id];\r\n\t\t\t\tlet pow2 = card2[pow2id];\r\n\t\t\t\tlet cost1 = card1[0]+card1[1]+card1[2]+card1[3];\r\n\t\t\t\tlet cost2 = card2[0]+card2[1]+card2[2]+card2[3];\r\n\t\t\t\tif (pow1>pow2) { /* [N]ormal gm_attack */\r\n\t\t\t\t\tnormal_attack[0]+=1;\r\n\t\t\t\t\tnormal_attack[1]+=pow2;\r\n\t\t\t\t\tnormal_attack[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2 && cost1<cost2) { /* [U]nderdog */\r\n\t\t\t\t\tunderdog[0]+=1;\r\n\t\t\t\t\tunderdog[1]+=pow2;\r\n\t\t\t\t\tunderdog[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2) { /* [T]iebreaker */\r\n\t\t\t\t\ttiebreaker[0]+=1;\r\n\t\t\t\t\ttiebreaker[1]+=pow2;\r\n\t\t\t\t\ttiebreaker[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (cost1===cost2) { /* [B]ribe */\r\n\t\t\t\t\tbribe[0]+=1;\r\n\t\t\t\t\tbribe[1]+=pow2;\r\n\t\t\t\t\tbribe[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (true) { /* [A]mbush */\r\n\t\t\t\t\tambush[0]+=1;\r\n\t\t\t\t\tambush[1]+=pow2;\r\n\t\t\t\t\tambush[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif((card2[4]===9 || card2[5]===9) && reach_target===false && pow1<pow2) {\r\n\t\t\t\t\tspiked = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn spiked;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn spiked;\r\n}", "function attack(unit, map) {\n\tlet range = findRange(unit, map)\n\tlet cmd = guard(unit, map, { range })\n\tif (cmd.length) return cmd\n\tlet targets = map.units.filter(other => other.control.faction === \"player\")\n\t\t.sort((a, b) => Cell.steps(a.cell, unit.cell) - Cell.steps(b.cell, unit.cell))\n\tlet target = targets[0]\n\tif (!target) return []\n\tlet moves = range.squares.filter(square => square.type === \"move\")\n\t\t.map(square => square.cell)\n\tlet opts = {\n\t\twidth: map.width,\n\t\theight: map.height,\n\t\tblacklist: unwalkables(map, unit)\n\t}\n\tlet paths = moves.map(cell => astar(target.cell, cell, opts))\n\tlet indices = moves.map((_, i) => i)\n\tindices.sort((a, b) => paths[a].length - paths[b].length)\n\tlet index = indices[0]\n\tlet dest = moves[index]\n\tlet path = pathfind(unit, dest, map)\n\treturn [ { type: \"move\", unit, path } ]\n}", "attack (otherShip)\n { console.log(this.name + \" fires at \" + otherShip.name);\n if (Math.random() < this.accuracy)\n {\n // hit\n console.log (\"It's a hit, doing \" + this.firepower + \" damage \");\n otherShip.hull -= this.firepower;\n if (otherShip.hull <= 0)\n {\n console.log (`${otherShip.name} is destroyed!`);\n return true; // otherShip destroyed\n }\n }\n else{\n console.log (\"It's a miss!!\");\n }\n return false; // otherShip not destroyed\n }", "attack(player) {\r\n player.applyDamage(this.strength);\r\n }", "function attacking(){\n\tif(!this.is_attacking) \n\t\treturn;\n\n\t// la animación para el ataque\n\tthis.animations.play('attack_' + this.direction);\n\n\t// Cuando expira el tiempo del ataque, este se detiene\n\tif(game.time.elapsedSince(this.start_time_attack) > this.timeBetweenAttacks){\n\t\tthis.is_attacking = false;\n\t\tthis.attack.hitEnemy = false;\n\t\tthis.speed = this.SPEED_WALKING;\n\t}\n}", "function movementControlAndLock() {\n offsetX = -player.x + width / 2;\n offsetY = -player.y + height / 2;\n\n\n //ALLOWS USER TO REACH HORIZONTAL EDGE OF SCREEN//\n if (player.x >= worldLimit.w - width / 2) {\n offsetX = -(worldLimit.w - width);\n }\n\n if (player.x <= width / 2) {\n offsetX = 0;\n }\n\n //ALLOWS USER TO REACH VERTICAL EDGE OF SCREEN//\n if (player.y >= worldLimit.h - height / 2) {\n offsetY = -(worldLimit.h - height);\n }\n\n if (player.y <= height / 2) {\n offsetY = 0;\n }\n\n}", "function legalMove(posX, posY)\n{\n //Check within map bounds\n if (posY >= 0 && posY < mapHeight && posX >= 0 && posX < mapWidth)\n {\n //Check if visible tile\n if (map[((posY*mapWidth)+posX)] != 1)\n {\n return true;\n }\n }\n return false;\n}", "checkWarp () {\n this.x = Phaser.Math.Wrap(this.x, 0, levelData.WIDTH)\n this.y = Phaser.Math.Wrap(this.y, 0, levelData.HEIGHT)\n }", "attack (enemy) {\n\n this.moraleBuff ();\n\n var atkRoll = this.atk * Math.random();\n var defRoll = enemy.def * Math.random();\n var dmg = (atkRoll - defRoll);\n\n if (dmg > 0) {\n var rndDmg = Math.floor(dmg);\n window.socket.emit('attack', rndDmg);\n this.armyMorale(3);\n enemy.takeDmg(rndDmg);\n return 1;\n\n } else {\n window.socket.emit('attackMiss');\n console.log('Swing and a miss, morale bar will not change');\n return 0;\n }\n // enemy.troops -= 100;\n\n }", "hit(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y)\n if (d < this.size / 2 + enemy.size / 2) {\n return true;\n } else {\n return false;\n }\n }", "function toAttack(){\n\tthis.is_attacking = true;\n\tthis.attack.hitEnemy = true;\n\tthis.start_time_attack = game.time.time;\n//\tthis.speed = this.SPEED_ATTACKING;\n\tthis.sound_sword_fail.play();\n}", "move(modifier, environmentObjects, player) {\r\n this.x += this.velocity*modifier*this.coeffX;\r\n this.y += this.velocity*modifier*this.coeffY;\r\n if(this.hitSomething(environmentObjects, player)) {\r\n this.live = false;\r\n }\r\n if(this.x < 0 || this.x > 10000 || this.y < 0 || this.y > 5625){\r\n this.live = false;\r\n }\r\n }", "attackHandler(x, y) {\n // check if y is in the right range\n console.log(this.y, this.y + this.height)\n if (y >= this.y & y <= this.y + this.height) {\n // check which x it falls into\n console.log(\"RIGHT RANGE\")\n for (let i = 0; i < this.numAttacks; i++) {\n if (x >= this.attackPositions[i] & x <= this.attackPositions[i]+this.width) {\n console.log(\"THIS ATTACK: \")\n console.log(i)\n // i is the correct location for the attack\n return i\n }\n }\n }\n return 0\n \n }", "findAttackTarget(creep) {\n\n let hostile = creep.pos.findClosestByPath(FIND_HOSTILE_CREEPS, {filter: (enemy) => !global.Friends[enemy.owner.username]}); \n if (!hostile) {\n hostile = creep.pos.findClosestByPath(FIND_HOSTILE_STRUCTURES, {filter: (enemy) => !global.Friends[enemy.owner.username]});\n }\n\n if (hostile){\n creep.memory.attackTarget = hostile.id;\n }\n }", "function attack(move, onlyenemy){\n\tvar encmov = moves[randomelement(encpok.moves)];\n\tvar moveused = moves[move];\n\tif(onlyenemy){\n\t\tencmov.use(encpok, monout, true);\n\t\tif(!checkforfaint(monout, encpok)) backtonormal();\n\t} else {\n\t\toutput(0, \"\");\n\t\tif(monout.spd >= encpok.spd){\n\t\t\tmoveused.use(monout, encpok, false);\n\t\t\tif(!checkforfaint(encpok, monout, true)){ \n\t\t\t\toutput(0, \"<br>\", 1);\n\t\t\t\tencmov.use(encpok, monout, true);\n\t\t\t\tif(!checkforfaint(monout, encpok, false)) backtonormal();\n\t\t\t}\n\t\t} else {\n\t\t\tencmov.use(encpok, monout, true);\n\t\t\tif(!checkforfaint(monout, encpok, false)){\n\t\t\t\toutput(0, \"<br>\", 1);\n\t\t\t\tmoveused.use(monout, encpok, false);\n\t\t\t\tif(!checkforfaint(encpok, monout, true)) backtonormal();\n\t\t\t}\n\t\t}\n\t}\n\tupdate(true);\n}", "function explode(x,y,radius,player){\n x = Math.round(x);\n y = Math.round(y);\n for(i=x-radius;i<x+radius; i++){\n terrainY[i]=Math.max(y+Math.sqrt((radius*radius)-(x-i)*(x-i)),terrainY[i]);\n }\n checkIndirectHit(x,y,radius,player);\n \n}", "attack(input){\n print(\"astral cage!\")\n let w = Vars.world.tiles.width*8\n let h = Vars.world.tiles.height*8\n sfx.barrierflash.at(input.x,input.y)\n effects.astralBarrier.at(input.x,input.y)\n Time.run(30, () => {\n Geometry.iterateLine(0,0,0,0,h,40,(x, y) => {\n effects.astralMarker.at(x, y, 0, {x: w, y:y})\n Time.run(30, () => {\n effects.astralCage.at(x, y, 0, {x: w, y:y})\n Sounds.laserblast.at(Vars.player.x,Vars.player.y)\n });\n })\n Geometry.iterateLine(0,0,0,w,0,40,(x, y) => {\n effects.astralMarker.at(x, y, 0, {x: x, y:h})\n Time.run(90, () => {\n effects.astralCage.at(x, y, 0, {x: x, y:h})\n Sounds.laserblast.at(Vars.player.x,Vars.player.y)\n });\n })\n });\n }", "function checkHit(x,y,which){\n\t//lets change the x and y coords (mouse) to match the transform\n\tx=x-BOARDX;\n\ty=y-BOARDY;\t\n\t//go through ALL of the board\n\tfor(i=0;i<BOARDWIDTH;i++){\n\t\tfor(j=0;j<BOARDHEIGHT;j++){\n\t\t\tvar drop = boardArr[i][j].myBBox;\n\t\t\t//document.getElementById('output2').firstChild.nodeValue+=x +\":\"+drop.x+\"|\";\n\t\t\tif(x>drop.x && x<(drop.x+drop.width) && y>drop.y && y<(drop.y+drop.height) && boardArr[i][j].droppable && boardArr[i][j].occupied == ''){\n\t\t\t\t\n\t\t\t\t//NEED - check is it a legal move???\n\t\t\t\t//if it is - then\n\t\t\t\t//put me to the center....\n\t\t\t\tsetTransform(which,boardArr[i][j].getCenterX(),boardArr[i][j].getCenterY());\n\t\t\t\t//fill the new cell\n\t\t\t\t//alert(parseInt(which.substring((which.search(/\\|/)+1),which.length)));\n\t\t\t\tgetPiece(which).changeCell(boardArr[i][j].id,i,j);\n\t\t\t\t//change other's board\n\t\t\t\tchangeBoardAjax(which,i,j,'changeBoard',gameId);\n\t\t\t\t\n\t\t\t\t//change who's turn it is\n\t\t\t\tchangeTurn();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\t\n\t}\n\treturn false;\n}", "function checkAndAttack(target) {\n // The 'target' parameter is just a variable!\n // It contains the argument when the function was called.\n if(target) {\n hero.attack(target);\n }\n hero.moveXY(43, 34);\n}", "function beAttractedToPlayer() {\n if (currentScene === \"forbiddenFruitScene\") {\n return;\n }\n // calculate something around the player's x, y\n // get the current distance from the player\n let playerPosX = playerX;\n let playerPosY = playerY;\n\n const minDistance = 20;\n const maxDistance = minDistance / 2; // don't get closer than half of the min distance\n\n let currentDistance = dist(playerPosX, otherGenderX, playerPosY, otherGenderY);\n // while it is greater than half of the distance\n if (currentDistance >= minDistance) {\n // Advance to the one-seventh of a distance\n otherGenderVX = currentDistance / 7;\n otherGenderVY = currentDistance / 7;\n\n // Update otherGender position to go towards the player depending on the distance\n // relative to the player at each successive call of this function\n if (otherGenderX < playerX) {\n otherGenderX += otherGenderVX * 0.10;\n } else {\n otherGenderX -= otherGenderVX * 0.10;\n }\n if (otherGenderY < playerY) {\n otherGenderY += otherGenderVY * 0.10;\n } else {\n otherGenderY -= otherGenderVY * 0.10;\n }\n }\n screenWarping(\"nonplayer\");\n}", "function moveEnemy1() {\n posX = parseInt($(\"#enemy1\").css(\"left\"));\n $(\"#enemy1\").css(\"left\", posX - vel);\n $(\"#enemy1\").css(\"top\", posY);\n\n if (posX <= 0) {\n posY = parseInt(Math.random() * 334);\n $(\"#enemy1\").css(\"left\", 634);\n $(\"#enemy1\").css(\"top\", posY);\n }\n }", "attack(attackName) {\n _target.health -= _target.attacks[attackName]\n if (_target.health < 0) {\n _target.health = 0\n }\n }", "attack(target) {\n target.healthPoints -= this.attackPower;\n this.attackPower += this.startAttackPower;\n }", "function checkTooBad() {\n\n if (xPosition === xZombiePos && yPosition === yZombiePos) {\n gameOver();\n }\n}", "function canMove (x,y,dir) {}", "function doAttack(number){\n\tlastAttack = characterAttacks[selectedPlayer.element];\n\tif (turnCounter == 0) {\n\t\tlastAttack.fn(p2Grid, selectedPlayer.square.xIndex, selectedPlayer.square.yIndex);\n\t} else if (turnCounter == 1) {\n\t\tlastAttack.fn(p1Grid, selectedPlayer.square.xIndex, selectedPlayer.square.yIndex);\n\t}\n}", "enemyAttack () {\r\n // declaring variables\r\n let hitRow = 0;\r\n let hitCol = 0;\r\n let $selector; \r\n // Check if the last hit of enemy is on a ship, if it is not call the\r\n // the random atack, else, try to find the rest of the ship.\r\n if (!this.lastEnemyHit.hitted) {\r\n this.enemyRandomAttack ();\r\n }\r\n else {\r\n // Loop to find the rest of the ship\r\n while (true) \r\n {\r\n // Set col and the row to the last enemy hit\r\n hitRow = this.lastEnemyHit.row;\r\n hitCol = this.lastEnemyHit.col;\r\n \r\n // If the test col of lastEnemyhit is true, test for the columns.\r\n // else test for the rows\r\n if (this.lastEnemyHit.testCol == true) {\r\n // if colIncrease from lastEnemyHit is true, text next cols\r\n // else test cols in the \r\n // decresing order.\r\n if (this.lastEnemyHit.colIncrease == true) {\r\n // if the last hitted col is equal the map size set the \r\n // colIncrease to false to test the cols in the \r\n // decresing order.\r\n if (hitCol == MAP_SIZE) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false\r\n };\r\n continue;\r\n }\r\n // increase the col to test the next \r\n hitCol ++;\r\n // Select the next \r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n // test if the next is already hitted.\r\n // Else set increaseCol To false to test the cols in the \r\n // decresing order.\r\n \r\n if (!this.map.isCellHitted($selector)) {\r\n // Check if the enemy hitted the ship, and if it does,\r\n // just keep going.\r\n // Else change to check to test the previous cols\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n };\r\n } \r\n \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false\r\n };\r\n }\r\n break;\r\n }\r\n\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false,\r\n };\r\n }\r\n }\r\n // Does the same logic of the cols, but decreasing the colums.\r\n else {\r\n if (hitCol == 1) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n testRow: true,\r\n testCol: false\r\n };\r\n continue;\r\n }\r\n hitCol--;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n \r\n // If the enemy find something already hitted or\r\n // empty, next time he will try the colums,\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n };\r\n } \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n testRow: true,\r\n testCol: false\r\n };\r\n this.lastEnemyHit.col++;\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol\r\n };\r\n }\r\n }\r\n }\r\n // Does the same logic from the cols to the rows, with a fell changes\r\n // in the next commets\r\n else if (this.lastEnemyHit.testRow == true) {\r\n if (this.lastEnemyHit.rowIncrease == true) {\r\n if (hitRow == MAP_SIZE) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n rowIncrease:false\r\n };\r\n continue;\r\n }\r\n // Increase the rows \r\n hitRow ++;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n // Work the same as the cols increasing.\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n } \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n rowIncrease:false\r\n };\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n }\r\n }\r\n else {\r\n if (hitRow <= 1) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n hitted: false,\r\n testRow: false,\r\n testCol: true,\r\n rowIncrease: true,\r\n colIncrease: true\r\n };\r\n break;\r\n }\r\n hitRow--;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n } \r\n // reset everything if the enemy not find the boat\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n hitted: false,\r\n testRow: false,\r\n testCol: true,\r\n rowIncrease: true,\r\n colIncrease: true\r\n };\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.map.checkVictoryCondition(this.playerShips);\r\n }", "attackBasic(cursor, angle, tempSprite) {\n\n //Call the hero's attackBasic first\n //tempSprite.anims.play(\"shield\",true);\n tempSprite.anims = this.anims;\n //console.log(this.anims);\n\n //this.hero.attackBasic(cursor, angle, tempSprite);\n\n //Rotation of sprite and box\n if (angle > -Math.PI / 4 && angle <= Math.PI / 4) {\n console.log(\"atacked\");\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"rightBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"rightBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"rightBasicAttackMage\"); break;\n }\n } else if (angle > -3 * Math.PI / 4 && angle <= -Math.PI / 4) {\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"upBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"upBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"upBasicAttackMage\"); break;\n }\n } else if ((angle > 3 * Math.PI / 4 && angle <= Math.PI) || (angle <= -3 * Math.PI / 4 && angle >= -Math.PI)) {\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"leftBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"leftBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"leftBasicAttackMage\"); break;\n }\n } else if (angle <= 3 * Math.PI / 4 && angle > Math.PI / 4) {\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"downBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"downBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"downBasicAttackMage\"); break;\n }\n }\n }", "function checkcollectables(t_collectable)\n{\n\tif(dist(gameChar_world_x, gameChar_y -30 , t_collectable.x_pos, t_collectable.y_pos) < 30)\n\t{\n\t\tt_collectable.isFound = true;\n\t\tconsole.log(\"is true statement\", gameChar_world_x)\n\t}\n\t\n\n}", "function attackTheEnemy(enemy) {\n enemy.hitPoints -= Math.floor(Math.random() * 20) + 10;\n stillFighting = true;\n if (enemy.hitPoints <= 0) {\n stillFighting = false;\n player.hitPoints += Math.floor(Math.random() * 50);\n console.log()\n player.enemiesKilled++;\n player.inventory.push(getRandomReward());\n } else {\n stillFighting = enemyAttacks();\n }\n return stillFighting;\n}", "performAttack() {\n return this.attack + Math.floor(this.attackModifier * Math.random());\n }", "survivorAttack() {\n var affectedTiles = []; //An array of tiles affected by the attack.\n var SurvivorTile = this.Survivor.getCurrentTile(); //Survivor's tile.\n var upTile = this.gameBoard[SurvivorTile.getTileX()][SurvivorTile.getTileY() - 1]; //Tile north of survivor.\n var DownTile = this.gameBoard[SurvivorTile.getTileX()][SurvivorTile.getTileY() + 1]; //Tile south of survivor.\n affectedTiles.push(upTile, DownTile); //Add north/south tiles to affected tiles.\n\n //If the survivor is facing right, add the right tile to the array. If not, add the left tile.\n if (this.Survivor.getFacingRight()) {\n var rightTile = this.gameBoard[SurvivorTile.getTileX() + 1][SurvivorTile.getTileY()];\n affectedTiles.push(rightTile);\n } else {\n var leftTile = this.gameBoard[SurvivorTile.getTileX() - 1][SurvivorTile.getTileY()];\n affectedTiles.push(leftTile);\n }\n\n //Have all tiles take damage, if they *can* be damaged.\n for (const t of affectedTiles) {\n t.takeDamage();\n }\n //Have all zombies that may be in those tiles take damage.\n for (const z of this.activeZombies) {\n for (const t of affectedTiles) {\n if (z.getCurrentTile() == t && z.isZombieAlive() === true) {\n this.killZombie(z);\n this.playerScore += 25;\n this.updateUI();\n }\n }\n }\n }", "function checkCanyon(t_canyon)\n{\nif(gameChar_world_x > t_canyon.x_pos && gameChar_world_x < t_canyon.x_pos + t_canyon.width && gameChar_y >= floorPos_y)\n {\n gameChar_y += 5;\n }\n}", "function updatePlayer(){\n\tif(game.physics.arcade.isPaused)\n\t\treturn;\n\n\tif(game.time.elapsedSince(this.start_time_hit) > 1500 ){\n\t\tthis.canMove = true;\n\t\tthis.spiral.visible = false;\n\t}\n\n\tif(this.y < -30 || this.y > 630 || this.x < -30 || this.x > 830){\n\t\tthis.position.setTo(400, 400);\n\t\tthis.body.velocity.setTo(0, 0);\n\t}\n\n\tthis.blood.update();\n\n\tthis.eyes.x = this.x;\n\tthis.eyes.y = this.y;\n\tthis.eyes.frame = this.frame;\n\n\tthis.movePlayer();\n\tthis.attacking();\n\n\tif (game.time.time - this.timeVelocityActivated < this.timeWithVelocity){\n\t\t\n this.speed = this.highSpeed;\n }\n else{\n \tif(!this.is_attacking)\n \tthis.speed = this.SPEED_WALKING;\n else\n \tthis.speed = this.SPEED_ATTACKING;\n gui.changeAbility(false, \"velocity\");\n } \n\n if(this.shield.visible){\n \tvar time = Math.floor((10000 - (game.time.now - this.shield.initTime)) / 1000);\n \tvar scale = ((time * 1000 / 10000) * 1.5) + 0.5;\n \tif(scale > 1)\n \t\tscale = 1;\n \t\n \tthis.shield.scale.setTo(scale, scale);\n\n \tif(game.time.now - this.shield.initTime > 10000)\n \t\tthis.shield.visible = false;\n }\n\n\n if( this.segment ){\n \tthis.segment.x = this.body.x + 15;\n\t\tthis.segment.y = this.body.y - 25;\n }\n\n\t// Cuando se presiona la tecla SPACE, se produce un ataque o se interactúa con un pillar\n\tif(keyboard.spaceKey() && !this.is_attacking && game.time.now - this.start_time_pillar_action > 500){\n\t\tif ( this.overlapPillar() ){\n\t\t\tthis.start_time_pillar_action = game.time.now;\n }\n else if (!this.segment){\n \tthis.toAttack();\n }\n\t}\n\n\t\n}", "detectHit(x, y)\n {\n if(dist(x, y, this.xPos, this.yPos) < 50)\n {\n return true;\n }\n return false;\n }", "function canWalkHere(x, y)\n\n{\n\nreturn ((world[x] != null) &&\n\n(world[x][y] != null) &&\n\n(world[x][y] <= maxWalkableTileNum));\n\n}", "teleportTo(x,y){\r\n // Remove from current tile\r\n let currentTile = this.field.getTile(this.x, this.y);\r\n if (currentTile) currentTile.creature = null;\r\n // Update the stored position\r\n this.x = x;\r\n this.y = y;\r\n // Move the image\r\n let landingTile = this.field.getTile(this.x, this.y);\r\n if(landingTile.image) landingTile.image.append(this.image);\r\n landingTile.creature = this;\r\n }", "hitPacman(ghostPos){//takes in p5.Vector\r\n return (dist(ghostPos.x, ghostPos.y, this.pos.x, this.pos.y)<10);//change to <25 for 1080p\r\n }", "function fnAttackPlayersTurn(event) {\n if (gameState !== PLAYERS_TURN) {\n return;\n }\n\n var { x, y } = getGridCoordinates(event);\n\n if (gridsPlayer[ENEMY][x][y] !== UNEXPLORED) {\n alert(\"You've already attacked these coordinates.\");\n return;\n }\n\n var cellStatus = fnShootAtEnemy(gridsComputer[OWN][x][y]);\n gridsPlayer[ENEMY][x][y] = cellStatus;\n fnColorCells(oCanvas[ENEMY].ctx, gridsPlayer[ENEMY], x, y);\n\n if (cellStatus === MISSED) {\n updateGameState(COMPS_TURN);\n }\n}", "ai_wander() {\n /*\n This will cause the AI to wander around the area.\n */\n const dirs = [ { x: 0, z: 1 }, { x: 1, z: 0 }, { x: 0, z: -1 }, { x: -1, z: 0 } ];\n let options = [ { x: 0, z: 0 } ];\n for(let d of dirs) {\n if(this.grid.can_move_to({x: this.loc.x + d.x, z: this.loc.z + d.z })) {\n options.push(d);\n }\n }\n\n let choice = options[Math.floor(Math.random() * options.length)];\n if(choice.x || choice.z) {\n this.grid.object_move(this, { x: this.loc.x + choice.x, y: this.loc.y, z: this.loc.z + choice.z });\n return true;\n }\n return false; //no action\n }", "fire(Enemy){\n\n if(this.difficulty==1){\n\n let hitFound=false;\n\n while(hitFound!=true){\n\n let col = Math.floor((Math.random()*8)+0);\n let row= Math.floor((Math.random()*8)+0);\n console.log(\"attmepting to hit col: \" + col + \" row: \" + row )\n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n Enemy.hitBoard.attempt[row][col]=true;\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n Enemy.hitBoard.hit[row][col]=true;\n hitFound=true;\n\n }\n }\n }\n\n if(this.difficulty==2){\n //set orthogonal fire once it hits\n if(this.difficulty==2){\n //set orthogonal fire once it hits\n let hitFound=false;\n \n \n while(hitFound!=true){\n\n let col = Math.floor((Math.random()*8)+0);\n let row= Math.floor((Math.random()*8)+0);\n let tempCol=col;\n let tempRow=row; \n \n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n if(Enemy.boatBoard.isAHit(col,row)){\n \n //after hit is found, checks for spaces to the left\n tempCol+1;\n while(Enemy.boatBoard.isAHit(tempCol,row))\n {\n Enemy.boatBoard.hasBeenHit[row][tempCol]=true;\n Enemy.hitBoard.hit[row][tempCol]=true;\n tempCol+1;\n }\n \n //then it checks for spaces to the right of hit\n tempCol=col-1;\n while(Enemy.boatBoard.isAHit(tempCol,row))\n {\n Enemy.boatBoard.hasBeenHit[row][tempCol]=true;\n Enemy.hitBoard.hit[row][tempCol]=true;\n tempCol-1;\n }\n \n //checks for spaces above hit\n tempRow=row+1;\n while(Enemy.boatBoard.isAHit(col,tempRow))\n {\n Enemy.boatBoard.hasBeenHit[tempRow][col]=true;\n Enemy.hitBoard.hit[tempRow][col]=true;\n tempRow+1;\n }\n \n //checks for spaces below hit\n tempRow=row-1;\n \n while(Enemy.boatBoard.isAHit(col,tempRow))\n {\n Enemy.boatBoard.hasBeenHit[tempRow][col]=true;\n Enemy.hitBoard.hit[tempRow][col]=true;\n tempRow-1;\n } \n } \n Enemy.hitBoard.hit[row][col]=true;\n hitFound=true;\n }\n } \n \n \n\n }\n }\n\n if(this.difficulty==3){\n \n let hitFound=false;\n \n for(let row = 0; row<9; row++){\n for(let col =0; col<9; col++){\n\n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n //in isAHit col and row are flipped since that's how it used for p1 and p2 in application.js\n if(Enemy.boatBoard.isAHit(col,row)===true){\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n Enemy.hitBoard.attempt[row][col]=true;\n Enemy.hitBoard.hit[row][col]=true;\n\t\t\t\t\t\t\t\tEnemy.boatCount--;\n hitFound=true;\n }\n }\n if(hitFound===true){\n break;\n }\n }\n if(hitFound===true){\n break;\n }\n }\n \n }\n }", "function PvPattack() {\n var players = Orion.FindType('0x0190|0x0191', '-1', ground, 'near|mobile', '25', 'red|gray|criminal');\n if (players.length) Orion.Attack(players[0]);\n}", "function movePlayer() {\n screenWarping(\"player\");\n playerX += playerVX;\n playerY += playerVY;\n}", "function attackHitTestSmog(attackPosition, attackSize) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.attackPosition.x,obj1.attackPosition.y);\n app.main.ctx.fillStyle = \"Red\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tfor (var i = 0; i < app.main.environment.smogCount; i++) {\n\t\tif (attackPosition.x + 35 < app.main.environment.smogPos[i].x + app.main.environment.smogSize[i].x - 10 && attackPosition.x + 35 + attackSize.x - 70 > app.main.environment.smogPos[i].x && attackPosition.y + 35 < app.main.environment.smogPos[i].y + app.main.environment.smogSize[i].y - 10 && attackSize.y - 70 + attackPosition.y + 35 > app.main.environment.smogPos[i].y) {\n\t\t\tapp.main.environment.smogTarget = i;\n\t\t\treturn true;\n\t\t}\n\t}\n}", "function player_move(dir) {\n player.pos.x += dir;\n if (collide(arena, player)) {\n player.pos.x -= dir;\n }\n}", "dealDamage() {\n let d = dist(this.x, this.y, player.x, player.y);\n if (\n d < this.size / 2 &&\n this.mapX === player.mapX &&\n this.mapY === player.mapY\n ) {\n // if the player touches the projectile, deal damage to them and destroy the projectile to prevent repeating damage\n player.healthTarget -= this.damage;\n sounds.spiritHit.play();\n this.die();\n }\n }", "mouseClickHandler(e) {\n let x = e.clientX\n let y = e.clientY - 100\n console.log(x,y)\n\n // update attack index\n let i = this.attacks.attackHandler(x,y)\n console.log(\"ATTACK INDEX IN MOUSE CLICK:\")\n console.log(i)\n if (i) {\n this.attackIndex = i\n } else {\n this.attackIndex = 0\n }\n // update attacks\n this.attacks.draw(this.ctx, this.attackIndex)\n \n }", "allowMove(x, y, person) {\n let tile = this.getTile(x, y);\n //False for Water and Walls and obstacles.\n if (tile.terrain.canEnter && !tile.object) {\n return {\n allow: true, //allow person to move\n cost: tile.terrain.cost, //cost of movement based on terrain\n object: tile.hasOwnProperty(\"object\") ? tile.object : \"None\"\n }; //^Either send back the object located on a given tile, or \"None\"\n // as a default value\n }\n else if (tile.terrain.name === TERRAIN_MAP[2].name && person.boatStatus()) {\n return {\n allow: true,\n cost: 0, //no movement penalty for water+boat\n object: tile.hasOwnProperty(\"object\") ? tile.object : \"None\"\n };\n }\n else if (tile.object) {\n // If there is an object, allow player to buy it.\n return {\n allow: true,\n cost: tile.terrain.cost,\n object: tile.object\n };\n }\n else {\n return {\n allow: false,\n cost: tile.terrain.cost,//<consume energy if attempting to cross\n object: \"None\" // water without a boat\n }; //^no movement -> don't bother sending any items\n }\n }", "function attack(attacker, defender) {\n return defender - attacker;\n}", "pointingTowards(creature){\r\n let dX = creature.x - this.x;\r\n let dY = creature.y - this.y;\r\n // The \"strongest\" delta gets strength 2, the weakest one\r\n let dXPower = (Math.abs(dX) >= Math.abs(dY)) ? 2 : 1;\r\n let dYPower = (Math.abs(dY) >= Math.abs(dX)) ? 2 : 1;\r\n switch (this.direction) {\r\n case 0: return -dYPower * Math.sign(dY);\r\n case 90: return dXPower * Math.sign(dX);\r\n case 180: return dYPower * Math.sign(dY);\r\n case 270: return -dXPower * Math.sign(dX);\r\n }\r\n }", "attack(youHero) {\n if (this.name === ennemies[0].name) {\n if (Math.floor(Math.random() * Math.floor(9)) / 10 <= this.accuracy) {\n \n console.log(\n youHero.name +\n \" got hit with an alien Z * mizzle, their health is down to\"\n );\n console.log((youHero.hull += -7)); /// had it set to this . mizzle but somehting was not working with it or the random number so I hard coded it... sorry\n defeat(youHero); /// like above -_- but did you die?\n } else {\n console.log(this.name + \" can not hit the side of a barn\"); /// so you know who next target is when they appear but miss\n console.log(\n \"Ha! those aliens shoot like stormtroopers \" +\n youHero.name +\n \"took no damage. Hull power = \" +\n youHero.hull\n ); /// you know they missed\n defeat(youHero); /// no damage awesome but return to your move with this\n }\n } else {\n console.log(\"dead aliens can't shoot\"); // not sure how they would but just in case if simulating in console log with pre typed functions...\n //return to your move\n defeat(youHero);\n }\n }", "function emit_attack() {\n var dir;\n dir = get_my_direction();\n dir.setLength(CONFIG.BULLET_VELOCITY);\n\n game.bullets.push(new TYPE.Bullet(game,\n dir,\n new THREE.Mesh(WORLD.bullet_geometry,\n WORLD.bullet_material))\n );\n\n game.bullets[game.bullets.length-1].mesh.position.copy(WORLD.player.mesh.position);\n WORLD.scene.add(game.bullets[game.bullets.length-1].mesh);\n\n // tell the other plays i fired\n socket.emit(\"new_bullet\", {\"pos\": game.bullets[game.bullets.length-1].mesh.position, \"dir\": dir});\n}", "checkCollision (playerPosition) {\n /*\n if (playerPosition[0] > this.position[0][0] && playerPosition[0] < this.position[0][1]) {\n if (playerPosition[1] > this.position[1][0] && playerPosition[1] < this.position[1][1]) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }\n */\n\n let er = 0;\n let ec = 0;\n let pr = 0;\n let pc = 0;\n\n /* player x position */\n if(player.x < 100){ pc = 0; }\n if(player.x >= 100 && player.x < 200){ pc = 1; } \n if(player.x >= 200 && player.x < 300){ pc = 2; }\n if(player.x >= 300 && player.x < 400){ pc = 3; }\n if(player.x >= 400){ pc = 4; }\n\n /* player y position */\n if(player.y < 72) { pr = 0; } \n if(player.y >= 72 && player.y < 154) { pr = 1; } \n if(player.y >= 154 && player.y < 236) { pr = 2; } \n if(player.y >= 236 && player.y < 318) { pr = 3; } \n if(player.y >= 318 && player.y < 400) { pr = 4; } \n if(player.y >= 400) { pr = 5; } \n\n /* enemy car x position + 10 buffer for easyer gameplay */\n if(this.x < -100){ ec = -1; }\n if(this.x >= -100 && this.x < 0){ ec = 0; } \n if(this.x >= 0 && this.x < 100){ ec = 1; } \n if(this.x >= 100 && this.x < 200){ ec = 2; }\n if(this.x >= 200 && this.x < 300){ ec = 3; }\n if(this.x >= 300 && this.x < 400){ ec = 4; }\n if(this.x >= 400){ ec = 5; }\n\n /* enemy car y position */\n if(this.y < 63) { er = 0; } \n if(this.y >= 63 && this.y < 143) { er = 1; } \n if(this.y >= 143 && this.y < 223) { er = 2; } \n if(this.y >= 223 && this.y < 303) { er = 3; } \n if(this.y >= 303 && this.y < 383) { er = 4; } \n if(this.y >= 383) { er = 5; } \n/*\n if (ec == 2) { \n alert(this.x.toString()); \n }\n*/\n if ((pc == ec) && (pr == er)) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }", "function encloseIsland(){\n if(shipX < width / 2 + 300 && keyIsDown(37)){\n shipX += 4;\n }\n}", "function checkCanyon(t_canyon)\n{\n if(gameChar_world_x <= t_canyon.x_pos + 100 && gameChar_y >= t_canyon.y_pos && gameChar_world_x > t_canyon.x_pos)\n \n {\n isPlummeting = true;\n gameChar_y += 2;\n }\n else \n {\n \n isPlummeting = false;\n \n }\n \n \n}", "update(dt) {\n // multiplying the movements by the dt parameter will\n // ensure the game runs at the same speed for all computers.\n\n this.x += this.enemySpeed * dt ;\n if (this.x > 510 ){\n this.x = -102;\n this.y = posArray[Math.floor(Math.random() * posArray.length)];\n this.enemySpeed = enemySpeed[Math.floor(Math.random() * enemySpeed.length)];\n this.x += this.enemySpeed * dt ; \n }\n }", "function checkCanyon(t_canyon)\n{\n\n if (gameChar_world_x > t_canyon.x_pos + 60 && gameChar_world_x < t_canyon.x_pos + 40 + t_canyon.width && gameChar_y >= floorPos_y)\n {\n isPlummeting = true;\n gameChar_y += 15;\n }\n \n}", "function input() {\n if(65 in keysDown) {\n if (getTile((player.x - player.speed) + 1, player.y + 16) !== \"1\") { //If player runs into a wall, they will not be allowed to go through it.\n player.x -= 3; //when \"A\" is pressed on keyboard, move player 3 pixels to left.\n }\n }\n if(68 in keysDown) {\n if (getTile(((player.x + player.width) + player.speed) - 1, player.y + 16) !== \"1\") { //If player runs into a wall, they will not be allowed to go through it.\n player.x += 3; //when \"D\" is pressed on keyboard, move player 3 pixels to right.\n }\n }\n if(87 in keysDown && player.yke === 0) {\n if(getTile(player.x, player.y -1) !== \"1\" && getTile(player.x + 32, player.y -1) !== \"1\") {\n player.yke += 8;\n }\n } \n}", "function shipHit(ship, meteor){\r\n\tlives = lives - 1;\r\n\tship.position.x = width/2;\r\n\tship.position.y = height/2;\r\n}", "_checkCollision() {\n\n for (let ship of this.ships) {\n let pos = ship.getPosition();\n if (pos.y >= this.canvas.height) {\n // Killed ships are not moved, they stay at their location, but are invisible.\n // I don't want to kill the player with one invisible ship :)\n if (!ship.dead) {\n ship.kill();\n this.score.damage();\n this.base.removeShield();\n }\n }\n }\n }", "setTarget(x, y) {\n this.targetX = x;\n this.targetY = y;\n //Check if the distance is a lot (40 min)\n //console.log(x - this.x);\n // this.setPosition(x, y);\n }", "updateEnemies() {\n this.liveEnemies.forEach(enemy => {\n // If patrolling, just continue to edge of screen before turning around\n if (enemy.enemyAction === EnemyActions.Patrol) {\n //console.log(enemy);\n // These should be changed to not be hard coded eventually\n if (enemy.enemySprite.body.position.x < 50) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.x > 1850) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.y < 50) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n if (enemy.enemySprite.body.position.y > 1000) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n // check if we are near an object, if yes, try and guard it. Not sure if this is working - Disabling for now\n //console.log(this.isNearObject(enemy.enemySprite));\n if (null != null) {\n console.log(\"Is near an object\");\n enemy.enemySprite.body.velocity.y = 0;\n enemy.updateAction(EnemyActions.Guard, null);\n }\n // Otherwise, wait for attack cooldown before attacking the player\n else {\n if (enemy.attackCooldown === 0) {\n enemy.attackCooldown = Math.floor(Math.random() * 2000);\n enemy.updateAction(EnemyActions.Attack, this.level.player);\n }\n else {\n enemy.attackCooldown = enemy.attackCooldown - 1;\n }\n }\n }\n\n // Guard the item\n if (enemy.enemyAction === EnemyActions.Guard) {\n enemy.guard();\n }\n\n // Attack the player\n if (enemy.enemyAction === EnemyActions.Attack) {\n enemy.attack();\n }\n\n // check if animation needs to be flipped\n if (enemy.enemySprite.body.velocity.x < 0) {\n enemy.enemySprite.scale.x = -1;\n }\n else if (enemy.enemySprite.body.velocity.x > 0) enemy.enemySprite.scale.x = 1;\n });\n }", "checkCollision() { \n return (player.x < this.x + 80 &&\n player.x + 80 > this.x &&\n player.y < this.y + 60 &&\n 60 + player.y > this.y)\n }", "attack(target) {\n return (target.res -= this.power);\n }", "function check_move(x, y, newx, newy, dir) {\n // if the map ends in either direction, disallow the desired move\n if (player['x'] === 0 && dir === 2) return false;\n if (player['x'] === MAP_WIDTH-1 && dir === 0) return false;\n if (player['y'] === 0 && dir === 1) return false;\n if (player['y'] === MAP_HEIGHT-1 && dir === 3) return false;\n\n // disallow moves onto lava\n if (map[newy][newx]['type'] === ' ') {\n return false;\n }\n\n // don't allow moves onto tiles that are currently rotating\n if (map[newy][newx]['tweenrot'] !== 0) {\n return false;\n }\n\n // (dir + 2) % 4 checks the side opposite the side we are moving into\n // eg. o if we are moving left ONTO this object, then dir = 2,\n // o o <- so then (dir+2)%4 = 0, meaning the right side must be \n // x open, 0, for us to be able to move onto it, which is true.\n // \n // o if instead we wanted to move up, dir=1, onto this object,\n // o o then (dir+2)%4 = 3, which corrosponds to the bottom, which is\n // x 1 in this case, so we cannot complete this move.\n // ^\n // |\n //\n // the blocked list for this object would be: [right, top, left, bottom] = [0,0,0,1]\n if ( !(is_blocked(newx, newy, (dir + 2) % 4, false))\n && !(is_blocked(x, y, (dir + 2) % 4, true)) ) {\n return true;\n }\n //console.log(\"direction IS blocked\");\n return false;\n}", "update(dt) {\n if (this.x < 505) {//it checks that enemies should not move outside\n this.x += this.speed * dt; // speed muliply by delta time\n }\n else {//this resets enemy's location to -101(initial)\n this.x = -101;\n }\n }", "function checkCollision(enemy) {\n var enemyrange_min = enemy.y - 25;\n var enemyrange_max = enemy.y + 25;\n var playerrange_min = player.x + 83;\n var playerrange_max = player.x - 83;\n\n if ((player.y >= enemyrange_min) && (player.y <= enemyrange_max) && (enemy.x >= playerrange_max) &&(enemy.x <= playerrange_min)) {\n player.x = 202.5;\n player.y = 383;\n }\n}", "function collisionDetection(x, y) {\r\n if (\r\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\r\n x - getShipLocation(angle)[0] <= 35 &&\r\n x - getShipLocation(angle)[0] >= -35 &&\r\n y - getShipLocation(angle)[1] <= 35 &&\r\n y - getShipLocation(angle)[1] >= -35\r\n ) {\r\n // Calls crash screen when a collision is detected\r\n crashScreen();\r\n }\r\n}", "function LockOnEnemy() { \n var checkPos : Vector3 = transform.position + transform.forward * autoLockTarget.lockOnRange;\n var closest : GameObject; \n \n var distance : float = Mathf.Infinity; \n var position : Vector3 = transform.position; \n autoLockTarget.lockTarget = null; // Reset Lock On Target\n var objectsAroundMe : Collider[] = Physics.OverlapSphere(checkPos , autoLockTarget.radius);\n for(var obj : Collider in objectsAroundMe){\n if(obj.CompareTag(\"Enemy\")){\n var diff : Vector3 = (obj.transform.position - position); \n\t\t var curDistance : float = diff.sqrMagnitude; \n\t\t if (curDistance < distance) { \n\t\t //------------\n\t\t closest = obj.gameObject; \n\t\t distance = curDistance;\n\t\t autoLockTarget.target = closest;\n\t\t autoLockTarget.lockTarget = closest.transform;\n\t\t } \n }\n }\n //Face to the target\n if(autoLockTarget.lockTarget){\n\t\t\t\tvar lookOn : Vector3 = autoLockTarget.lockTarget.position;\n\t\t \tlookOn.y = transform.position.y;\n\t\t \t\ttransform.LookAt(lookOn);\n\t\t \t\tif(autoLockTarget.verticalLookAt){\n\t\t \t\t\tvar tar : Vector3 = autoLockTarget.lockTarget.position;\n\t\t \t\t\ttar.y += autoLockTarget.anglePlus;\n\t\t \t\t\tattackPoint.transform.LookAt(tar);\n\t\t \t\t}\n\t\t}else{\n\t\t\tattackPoint.transform.rotation = transform.rotation;\n\t\t}\n \n}", "attackBase(enemyBase) {\n let d = dist(this.x, this.y, this.enemyBaseX, this.enemyBaseY);\n let dx = this.enemyBaseX - this.x;\n let dy = this.enemyBaseY - this.y;\n let angle = atan2(dy, dx);\n if (enemyBase.health>0){\n // move to it\n if (d >= 100) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n }\n // if in range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n // create and store a Bullet object\n this.bullet = new Bullet(this.x, this.y, enemyBase.x, enemyBase.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n Fire.play(); // sound\n // enemy base is under attack\n enemyBase.underAttack = true;\n this.theEnemyBase = enemyBase;\n }\n // make the bullet fly towards the target\n if (this.bulletFired && !this.dead) {\n this.bullet.moveTo(enemyBase);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n }\n this.handleWrapping();\n }", "checkCollisions() {\n allEnemies.forEach(function(enemy) {\n if ( Math.abs(player.x - enemy.x) <= 80 &&\n Math.abs(player.y - enemy.y) <= 30 ) {\n player.x=200;\n player.y=405;\n }\n });\n }", "checkIfUserIsHit(user,myGame){\n if (\n this.x < user.x + user.width &&\n this.x + this.width > user.x &&\n this.y < user.y + user.height &&\n this.y + this.height > user.y\n ) {\n if(myGame.levelWon === false){\n let health = document.getElementById(\"health\")\n health.value -= myGame.enemyStrength;\n user.health -= myGame.enemyStrength;\n }\n }\n if(user.health <= 0 && myGame.levelWon === false){\n myGame.gameOver();\n }\n }", "collision() {\n if (this.y === (player.y - 12) && this.x > player.x - 75 && this.x < player.x + 70) {\n player.collide();\n }\n }", "function checkCollesion(enemy) {\n if (enemy.y == player.y) {\n if (((enemy.x + 70) >= player.x) && ((enemy.x + 70) <= player.x + 100)) {\n restartGame();\n }\n }\n \n \n}", "update (x, y) {\n if (this.x >= 405) {\n this.x = 400;\n } else if (this.x <= -1) {\n this.x = 0;\n } else if (this.y >= 400) {\n this.y = 400;\n } else if (this.y <= -20) {\n this.x = 200;\n this.y = 400;\n gameWon();\n \n }\n }", "function protoOnHit(){\n if (player.currentState == jump && player.controls.transform.position[1] < this.owner.controls.transform.position[1]){\n this.owner.changeState(deadEnemy)\n }\n}", "canAttack() {\n let self = this;\n for (let plant of window._main.plants) {\n if (plant.row === self.row && !plant.isDel) {\n // When zombies and plant are near to each other\n if (self.x - plant.x < -20 && self.x - plant.x > -60) {\n if (self.life > 2) {\n // Save the value of the current attacking plant, when the plant is deleted, then control the current zombie movement\n self.attackPlantID !== plant.id\n ? (self.attackPlantID = plant.id)\n : (self.attackPlantID = self.attackPlantID);\n self.changeAnimation(\"attack\");\n } else {\n self.canMove = false;\n }\n if (self.isAnimeLenMax && self.life > 2) {\n // Every time a zombie animation is executed\n // deduct plant health\n if (plant.life !== 0) {\n plant.life--;\n plant.isHurt = true;\n setTimeout(() => {\n plant.isHurt = false;\n // wallnut animations\n if (\n plant.life <= 8 &&\n plant.section === \"wallnut\"\n ) {\n plant.life <= 4\n ? plant.changeAnimation(\"idleL\")\n : plant.changeAnimation(\"idleM\");\n }\n // Determine if the plant is dead and removed if dead\n if (plant.life <= 0) {\n // Set plant death\n plant.isDel = true;\n // Clear sunlight generation timer for dead sunflowers\n plant.section === \"sunflower\" &&\n plant.clearSunTimer();\n }\n }, 200);\n }\n }\n }\n }\n }\n }", "function checkCollectable(t_collectable)\n{\n \nif(dist(gameChar_world_x, gameChar_y, t_collectable.x_pos, t_collectable.y_pos) < t_collectable.size)\n {\n t_collectable.isFound = true;\n game_score += 1;\n }\n}", "function moveUp() {\n myGamePiece.speedY -= movementSpeed;\n restrictPlayer();\n}" ]
[ "0.7289693", "0.701776", "0.6895369", "0.67279935", "0.6709622", "0.660727", "0.65514874", "0.65250105", "0.6498388", "0.647404", "0.64613736", "0.64321285", "0.63751817", "0.6326892", "0.628847", "0.62724495", "0.6246679", "0.6246571", "0.623883", "0.62380874", "0.6219181", "0.6217191", "0.6212793", "0.621085", "0.6198561", "0.61946964", "0.6175536", "0.61660963", "0.6165701", "0.6131705", "0.61194074", "0.61170864", "0.61109495", "0.60950744", "0.6080633", "0.60764533", "0.60678196", "0.6065944", "0.6063772", "0.6063289", "0.60630137", "0.6062348", "0.60516554", "0.6050905", "0.60456496", "0.60230047", "0.6022248", "0.600652", "0.60036236", "0.6002786", "0.59976083", "0.5984557", "0.59765655", "0.5976249", "0.59600896", "0.59559005", "0.59547484", "0.5946514", "0.59437513", "0.5939558", "0.5938205", "0.5933209", "0.5928271", "0.59278", "0.59257585", "0.59235513", "0.5917664", "0.59169745", "0.59038436", "0.58973646", "0.58793277", "0.58766675", "0.5867473", "0.58632106", "0.5853862", "0.585297", "0.5844654", "0.5844139", "0.5839941", "0.5838313", "0.5834993", "0.58312637", "0.58311605", "0.58204865", "0.58163416", "0.58136714", "0.58128923", "0.58097243", "0.58093584", "0.58079636", "0.5807781", "0.580503", "0.58034813", "0.579902", "0.57988834", "0.57900345", "0.57801104", "0.57778424", "0.57762015", "0.5775537" ]
0.5889322
70
attackable from a certain coordinate ie does not factor in movement
attackableUnits(g, wlist = null) { return this.attackableUnitsFrom(g, null, wlist); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attackXY(x, y){\n arrow.pos.Vector = x;\n arrow.pos.Vector = y;\n}", "attack(enemyShip) {\n if (this.canAttack(enemyShip)) {\n const hit = Math.round(Math.random() + .3)\n if (hit && !enemyShip.sunk) {\n const damage = this.damage * Math.random()\n enemyShip.hp -= damage\n if (enemyShip.hp <= 0) enemyShip.sunk = true\n } \n }\n return enemyShip\n }", "attack(forwardSteps,rightSteps,damage,type = null,statuses = null){\r\n let attackX = this.x;\r\n let attackY = this.y;\r\n switch (this.direction) {\r\n case 0: attackY -= forwardSteps;\r\n attackX += rightSteps;\r\n break;\r\n case 90: attackX += forwardSteps;\r\n attackY += rightSteps;\r\n break;\r\n case 180: attackY += forwardSteps;\r\n attackX -= rightSteps;\r\n break;\r\n case 270: attackX -= forwardSteps;\r\n attackY -= rightSteps;\r\n break;\r\n }\r\n let attackedTile = this.field.getTile(attackX, attackY);\r\n if(attackedTile) attackedTile.attacked(damage,type,statuses);\r\n }", "attack(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y);\n // if within range, no target acquired, not dead, and the enemy is alive\n // TARGET THE ENEMY\n if (d < 300 && this.targetId < 0 && !this.dead && !enemy.dead) {\n this.targetId = enemy.uniqueId;\n this.obtainedTarget = true;\n }\n let dx = enemy.x - this.x;\n let dy = enemy.y - this.y;\n let angle = atan2(dy, dx);\n\n if (this.targetId === enemy.uniqueId) {\n // get closer to the enemy\n if (d >= 150) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n // also keep a distance from the enemy\n } else {\n this.x -= this.speed * cos(angle);\n this.y -= this.speed * sin(angle);\n }\n // if within range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n this.bullet = new Bullet(this.x, this.y, enemy.x, enemy.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n this.attacking = true;\n Fire.play();\n } else {\n this.attacking = false;\n }\n if (this.bulletFired && !this.dead) {\n this.attacking = true;\n // if the enemy is not attacking, it will fight back\n if (!enemy.attacking) {\n enemy.targetId = this.uniqueId;\n }\n this.bullet.moveTo(enemy);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n if (enemy.dead) {\n // if the targeted enemy is tank / square XL\n // if the tank gets destroyed and this unit is close to it\n // the explosion kills this unit\n if (enemy.uniqueId === 100 && enemy.uniqueId === this.targetId && d < 100){\n this.health -= enemy.damage;\n }\n this.targetId = -1;\n this.obtainedTarget = false;\n this.attacking = false;\n }\n }\n // variation to the movement\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -0.05, 0.05);\n this.vy = map(noise(this.ty), 0, 1, -0.05, 0.05);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.0001;\n this.ty += 0.0001;\n\n this.handleWrapping();\n }", "attack({enemies}, mousePos, mapSize, mapPos, scale, tileSize=32) {\n const tilePos = this.getTilePos(mousePos, mapSize, mapPos, scale, tileSize);\n\n // TODO: Add player attacking later\n // Get the enemy or player at position\n Object.keys(enemies).forEach((id) => {\n if (enemies[id].pos[0] == tilePos[0] && enemies[id].pos[1] == tilePos[1])\n this.socket.emit('attack', id);\n });\n }", "attackOverlap() {\n let a = dist(player.x, player.y, this.x, this.y);\n if (a < this.size / 2 + player.size / 2) {\n state = `endGame`;\n }\n }", "canAttack(enemyShip) {\n const directionOfAttack = this.orientation(enemyShip.x, enemyShip.y, this.x, this.y)\n if (directionOfAttack === 'left' || directionOfAttack === 'right') {\n if (this.direction === 'up' || this.direction === 'down') return true\n else return false\n } else {\n if (this.direction === 'left' || this.direction === 'right') return true\n else return false\n } \n }", "attackTarget(attack) {\n _gameService.attackTarget(attack)\n draw()\n }", "attack(from, to) {\n let attacker = this.current().getBoard(from)\n let defender = this.opponent().getBoard(to)\n attacker.defense -= defender.attack\n defender.defense -= attacker.attack\n this.resolveDamage()\n }", "function monsterAttack(){\n\tif(rleft + mleft === 56){\n\t\t$('#monster').addClass('attack');\n\t}\n\tif(rleft + mleft === 76){\n\t\t$('#monster').css('left', 10+\"em\");\n\t\txleft = 10;\n\t}\n\tif(rleft + mleft === 96){\n\t\t$('#monster').css('left', 20+\"em\");\n\t\txleft = 20;\n\t}\n\tif(rleft + mleft === 116){\n\t\t$('#monster').css('left', 30+\"em\");\n\t\txleft = 30;\n\t}\n}", "attack() {\n var velocity = this.calculateVel();\n var offset = this.face == 0? 100: 0;\n var pp = {sx: 96, sy: 160, size: 16};\n var p = new ScaleBoomerProjectiles(this.game, false, this.x+offset, this.y, velocity, this.projspeed, 2500, this.damage, 0.005, false, pp);\n this.game.entities.splice(this.game.entities.length - 1, 0, p);\n }", "update(dt){\n this.x = this.x + this.speed * dt;\n // starting the enemy again randomly\n if (this.x > 700 ){\n this.x = -10\n }\n\n // Collison with enemy when two objects hit each others\n if (Math.abs(this.x - player.x) < 75 && Math.abs(this.y - player.y) < 77) {\n player.x = 202;\n player.y = 405;\n player.lives -= 1;\n }\n }", "function Attack()\n{\n\tvar speedTowardsPlayer = moveSpeed;\n\t\n\t//if enemy is on the right side of the player move left\n\tif(player.transform.position.x < transform.position.x)\n\t{\n\t\tfacingLeft = true;\n\t\tspeedTowardsPlayer = -speedTowardsPlayer;\n\t\trenderer.material.mainTexture = mainTextures[curFrame]; // Get the current animation frame\n\t}\n\t//if enemy is on the left side of the player move right\n\telse\n\t{\n\t\tfacingLeft = false;\n\t\trenderer.material.mainTexture = altTextures[curFrame]; // Get the current animation frame\n\t}\n\t\t\n\trigidbody.velocity = Vector3(speedTowardsPlayer, rigidbody.velocity.y, 0); // Move to the left\n}", "function checkDirectHit(cx,cy,victim){\n \n \n weapon = curPlayer.getweapon();\n\n //checks if the weapon hits tank directly\n changeDelta(victim);\n if((cx>=victim.getpx() && cx<=victim.getpx()+30 )&&(cy>=terrainY[victim.getpx()]-20 && cy<=terrainY[victim.getpx()])){\n victim.sethealth(victim.gethealth()-weapons[weapon][4]);\n checkEndGame();\n console.log(\"Direct Hit\");\n return true;\n }\n return false;\n\n\n}", "function hunt() {\n\n //Do nothing every fourth step.\n if (steps % 4 == 0) {\n yZombiePos += 0;\n xZombiePos += 0;\n }\n\n //Make the Zombie match the x-axis before trying to match the player's y-axis.\n else if (xZombiePos !== xPosition) {\n\n if (xZombiePos < xPosition) {\n xZombiePos += 1;\n }\n\n else if (xZombiePos > xPosition) {\n xZombiePos -= 1;\n }\n }\n\n //If the x-axis is matched start matching y-Axis.\n else if (xZombiePos == xPosition && yZombiePos !== yPosition) {\n\n if (yZombiePos < yPosition) {\n yZombiePos += 1;\n }\n\n else if (yZombiePos > yPosition) {\n yZombiePos -= 1;\n }\n }\n \n\n}", "constructor(enemy){\n this.height = 10;\n this.width = 10;\n this.dead = false;\n this.x = enemy.x + Math.floor(enemy.width/2) - Math.floor(this.width/2);\n this.y = enemy.y + enemy.abdomen - Math.floor(this.height/2);\n this.dx = Math.floor((bearer.x + Math.floor(bearer.width/2) - (this.x + Math.floor(this.width/2)))/100);\n this.dy = Math.floor((bearer.y + Math.floor(bearer.height/2) - (this.y + Math.floor(this.height/2)))/100);\n this.dmgPlayer = 5;\n }", "function Attack (isEnemy: boolean) {\n\tif (CanAttack () ) {\n\t\tshootCooldown = shootingRate;\n\t\t\n\t\t// Create a new shot\n\t\tvar shotTransform = Instantiate(shotPrefab) as Transform;\n\t\t\n\t\t// Assign Position\n\t\tshotTransform.position = transform.position;\n\t\t\n\t\t// The isEnemy Property\n\t\tvar shot : ShotScript = shotTransform.gameObject.GetComponent(ShotScript);\n\t\t\tif (shot != null) \n\t\t\t{\n\t\t\t\tshot.isEnemyShot = isEnemy;\n\t\t\t}\n\t\t\t\n\t\t\t// Make the weapon shot always towards it\n\t\t\tvar move : MoveScript = shotTransform.gameObject.GetComponent(MoveScript);\n\t\t\t\tif (move != null)\n\t\t\t\t{\n\t\t\t\tmove.direction = this.transform.right;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function checkFlagpole()\n{\n var d = abs(gameChar_world_x - flagpole.x_pos);\n \n if(d < 50)\n {\n flagpole.isReached = true;\n }\n}", "function attackHitTest(obj1, obj2) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.attackPosition.x,obj1.attackPosition.y);\n app.main.ctx.fillStyle = \"green\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tif (obj1.attackPosition.x < obj2.position.x + obj2.size.x && obj1.attackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.attackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.attackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t}\n}", "attackHero(){\n this.attackingDelay = this.setDelay(this.attackingDelaySet);\n this.isAttacking = true;\n //attackingDirection = true is left to right; false is right to left\n this.position.x > this.hero.position.x ? this.attackingDirection = true : this.attackingDirection = false;\n this.attackingDirection ? this.isAttackingFrom = -this.attackSpeed : this.isAttackingFrom = this.attackSpeed;\n this.body.velocity.y = -400;\n this.isAttackingFor = this.setDelay(this.isAttackingSet);\n }", "function hardAttackHitTest(obj1, obj2) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.hardAttackPosition.x,obj1.hardAttackPosition.y);\n app.main.ctx.fillStyle = \"blue\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tif (obj1.attackPosition.x < obj2.position.x + obj2.size.x && obj1.attackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.attackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.attackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t} else if (obj1.hardAttackPosition.x < obj2.position.x + obj2.size.x && obj1.hardAttackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.hardAttackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.hardAttackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t}\n}", "function gm_attack(direction, pow1id, pow2id, zid, room, opponent_team, card1, normal_attack, underdog, tiebreaker, bribe, ambush) { /* (ttt.up, ) */\r\n\tlet spiked = false;\r\n\tlet reach_target = false;\r\n\tlet target_team = null;\r\n\t//if (direction(zid)>=0)\r\n\t\t//console.log(\"0/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\tif (direction(zid)>=0 && room.game.board[direction(zid)][0]!=\"\") { /* has card */\r\n\t\t//console.log(\"1/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\t\tlet target_card_id = null;\r\n\t\tlet target_zone_id = null;\r\n\t\tif (room.game.board[direction(zid)][2]===opponent_team) { /* is enemy card */\r\n\t\t\ttarget_card_id = parseInt(room.game.board[direction(zid)][1])-1;\r\n\t\t\ttarget_zone_id = direction(zid);\r\n\t\t\tif (room.game.board[direction(zid)][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t} else {\r\n\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t}\r\n\t\t} else \r\n\t\tif (room.game.board[direction(zid)][2]===(opponent_team===\"X\"?\"O\":\"X\")) { /* is allied card */\r\n\t\t\tif ((card1[4]===6 || card1[5]===6) && direction(direction(zid))>=0 && room.game.board[direction(direction(zid))][2]===opponent_team) { // [R]each\r\n\t\t\t\ttarget_card_id = parseInt(room.game.board[direction(direction(zid))][1])-1;\r\n\t\t\t\ttarget_zone_id = direction(direction(zid));\r\n\t\t\t\treach_target = true;\r\n\t\t\t\tif (room.game.board[direction(direction(zid))][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (target_card_id!=null) {\r\n\t\t\t//console.log(\"2/2 gm_attack: \",card2);\r\n\t\t\tlet card2 = null; \r\n\t\t\tif (room.game.players[0].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[0].deck[target_card_id]; \r\n\t\t\t}\r\n\t\t\telse if (room.game.players[1].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[1].deck[target_card_id];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconsole.log(\"\\n{we should never get here #1}\\n\");\r\n\t\t\t}\r\n\t\t\tif (card2!=null) { /* we are gm_attacking this card */\r\n\t\t\t\tlet has_chain = (card2[4]==7 || card2[5]==7);\r\n\t\t\t\tlet pow1 = card1[pow1id];\r\n\t\t\t\tlet pow2 = card2[pow2id];\r\n\t\t\t\tlet cost1 = card1[0]+card1[1]+card1[2]+card1[3];\r\n\t\t\t\tlet cost2 = card2[0]+card2[1]+card2[2]+card2[3];\r\n\t\t\t\tif (pow1>pow2) { /* [N]ormal gm_attack */\r\n\t\t\t\t\tnormal_attack[0]+=1;\r\n\t\t\t\t\tnormal_attack[1]+=pow2;\r\n\t\t\t\t\tnormal_attack[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2 && cost1<cost2) { /* [U]nderdog */\r\n\t\t\t\t\tunderdog[0]+=1;\r\n\t\t\t\t\tunderdog[1]+=pow2;\r\n\t\t\t\t\tunderdog[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2) { /* [T]iebreaker */\r\n\t\t\t\t\ttiebreaker[0]+=1;\r\n\t\t\t\t\ttiebreaker[1]+=pow2;\r\n\t\t\t\t\ttiebreaker[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (cost1===cost2) { /* [B]ribe */\r\n\t\t\t\t\tbribe[0]+=1;\r\n\t\t\t\t\tbribe[1]+=pow2;\r\n\t\t\t\t\tbribe[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (true) { /* [A]mbush */\r\n\t\t\t\t\tambush[0]+=1;\r\n\t\t\t\t\tambush[1]+=pow2;\r\n\t\t\t\t\tambush[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif((card2[4]===9 || card2[5]===9) && reach_target===false && pow1<pow2) {\r\n\t\t\t\t\tspiked = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn spiked;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn spiked;\r\n}", "function attack(unit, map) {\n\tlet range = findRange(unit, map)\n\tlet cmd = guard(unit, map, { range })\n\tif (cmd.length) return cmd\n\tlet targets = map.units.filter(other => other.control.faction === \"player\")\n\t\t.sort((a, b) => Cell.steps(a.cell, unit.cell) - Cell.steps(b.cell, unit.cell))\n\tlet target = targets[0]\n\tif (!target) return []\n\tlet moves = range.squares.filter(square => square.type === \"move\")\n\t\t.map(square => square.cell)\n\tlet opts = {\n\t\twidth: map.width,\n\t\theight: map.height,\n\t\tblacklist: unwalkables(map, unit)\n\t}\n\tlet paths = moves.map(cell => astar(target.cell, cell, opts))\n\tlet indices = moves.map((_, i) => i)\n\tindices.sort((a, b) => paths[a].length - paths[b].length)\n\tlet index = indices[0]\n\tlet dest = moves[index]\n\tlet path = pathfind(unit, dest, map)\n\treturn [ { type: \"move\", unit, path } ]\n}", "attack (otherShip)\n { console.log(this.name + \" fires at \" + otherShip.name);\n if (Math.random() < this.accuracy)\n {\n // hit\n console.log (\"It's a hit, doing \" + this.firepower + \" damage \");\n otherShip.hull -= this.firepower;\n if (otherShip.hull <= 0)\n {\n console.log (`${otherShip.name} is destroyed!`);\n return true; // otherShip destroyed\n }\n }\n else{\n console.log (\"It's a miss!!\");\n }\n return false; // otherShip not destroyed\n }", "attack(player) {\r\n player.applyDamage(this.strength);\r\n }", "function attacking(){\n\tif(!this.is_attacking) \n\t\treturn;\n\n\t// la animación para el ataque\n\tthis.animations.play('attack_' + this.direction);\n\n\t// Cuando expira el tiempo del ataque, este se detiene\n\tif(game.time.elapsedSince(this.start_time_attack) > this.timeBetweenAttacks){\n\t\tthis.is_attacking = false;\n\t\tthis.attack.hitEnemy = false;\n\t\tthis.speed = this.SPEED_WALKING;\n\t}\n}", "function movementControlAndLock() {\n offsetX = -player.x + width / 2;\n offsetY = -player.y + height / 2;\n\n\n //ALLOWS USER TO REACH HORIZONTAL EDGE OF SCREEN//\n if (player.x >= worldLimit.w - width / 2) {\n offsetX = -(worldLimit.w - width);\n }\n\n if (player.x <= width / 2) {\n offsetX = 0;\n }\n\n //ALLOWS USER TO REACH VERTICAL EDGE OF SCREEN//\n if (player.y >= worldLimit.h - height / 2) {\n offsetY = -(worldLimit.h - height);\n }\n\n if (player.y <= height / 2) {\n offsetY = 0;\n }\n\n}", "function legalMove(posX, posY)\n{\n //Check within map bounds\n if (posY >= 0 && posY < mapHeight && posX >= 0 && posX < mapWidth)\n {\n //Check if visible tile\n if (map[((posY*mapWidth)+posX)] != 1)\n {\n return true;\n }\n }\n return false;\n}", "checkWarp () {\n this.x = Phaser.Math.Wrap(this.x, 0, levelData.WIDTH)\n this.y = Phaser.Math.Wrap(this.y, 0, levelData.HEIGHT)\n }", "attack (enemy) {\n\n this.moraleBuff ();\n\n var atkRoll = this.atk * Math.random();\n var defRoll = enemy.def * Math.random();\n var dmg = (atkRoll - defRoll);\n\n if (dmg > 0) {\n var rndDmg = Math.floor(dmg);\n window.socket.emit('attack', rndDmg);\n this.armyMorale(3);\n enemy.takeDmg(rndDmg);\n return 1;\n\n } else {\n window.socket.emit('attackMiss');\n console.log('Swing and a miss, morale bar will not change');\n return 0;\n }\n // enemy.troops -= 100;\n\n }", "function toAttack(){\n\tthis.is_attacking = true;\n\tthis.attack.hitEnemy = true;\n\tthis.start_time_attack = game.time.time;\n//\tthis.speed = this.SPEED_ATTACKING;\n\tthis.sound_sword_fail.play();\n}", "hit(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y)\n if (d < this.size / 2 + enemy.size / 2) {\n return true;\n } else {\n return false;\n }\n }", "move(modifier, environmentObjects, player) {\r\n this.x += this.velocity*modifier*this.coeffX;\r\n this.y += this.velocity*modifier*this.coeffY;\r\n if(this.hitSomething(environmentObjects, player)) {\r\n this.live = false;\r\n }\r\n if(this.x < 0 || this.x > 10000 || this.y < 0 || this.y > 5625){\r\n this.live = false;\r\n }\r\n }", "attackHandler(x, y) {\n // check if y is in the right range\n console.log(this.y, this.y + this.height)\n if (y >= this.y & y <= this.y + this.height) {\n // check which x it falls into\n console.log(\"RIGHT RANGE\")\n for (let i = 0; i < this.numAttacks; i++) {\n if (x >= this.attackPositions[i] & x <= this.attackPositions[i]+this.width) {\n console.log(\"THIS ATTACK: \")\n console.log(i)\n // i is the correct location for the attack\n return i\n }\n }\n }\n return 0\n \n }", "findAttackTarget(creep) {\n\n let hostile = creep.pos.findClosestByPath(FIND_HOSTILE_CREEPS, {filter: (enemy) => !global.Friends[enemy.owner.username]}); \n if (!hostile) {\n hostile = creep.pos.findClosestByPath(FIND_HOSTILE_STRUCTURES, {filter: (enemy) => !global.Friends[enemy.owner.username]});\n }\n\n if (hostile){\n creep.memory.attackTarget = hostile.id;\n }\n }", "function attack(move, onlyenemy){\n\tvar encmov = moves[randomelement(encpok.moves)];\n\tvar moveused = moves[move];\n\tif(onlyenemy){\n\t\tencmov.use(encpok, monout, true);\n\t\tif(!checkforfaint(monout, encpok)) backtonormal();\n\t} else {\n\t\toutput(0, \"\");\n\t\tif(monout.spd >= encpok.spd){\n\t\t\tmoveused.use(monout, encpok, false);\n\t\t\tif(!checkforfaint(encpok, monout, true)){ \n\t\t\t\toutput(0, \"<br>\", 1);\n\t\t\t\tencmov.use(encpok, monout, true);\n\t\t\t\tif(!checkforfaint(monout, encpok, false)) backtonormal();\n\t\t\t}\n\t\t} else {\n\t\t\tencmov.use(encpok, monout, true);\n\t\t\tif(!checkforfaint(monout, encpok, false)){\n\t\t\t\toutput(0, \"<br>\", 1);\n\t\t\t\tmoveused.use(monout, encpok, false);\n\t\t\t\tif(!checkforfaint(encpok, monout, true)) backtonormal();\n\t\t\t}\n\t\t}\n\t}\n\tupdate(true);\n}", "function explode(x,y,radius,player){\n x = Math.round(x);\n y = Math.round(y);\n for(i=x-radius;i<x+radius; i++){\n terrainY[i]=Math.max(y+Math.sqrt((radius*radius)-(x-i)*(x-i)),terrainY[i]);\n }\n checkIndirectHit(x,y,radius,player);\n \n}", "attack(input){\n print(\"astral cage!\")\n let w = Vars.world.tiles.width*8\n let h = Vars.world.tiles.height*8\n sfx.barrierflash.at(input.x,input.y)\n effects.astralBarrier.at(input.x,input.y)\n Time.run(30, () => {\n Geometry.iterateLine(0,0,0,0,h,40,(x, y) => {\n effects.astralMarker.at(x, y, 0, {x: w, y:y})\n Time.run(30, () => {\n effects.astralCage.at(x, y, 0, {x: w, y:y})\n Sounds.laserblast.at(Vars.player.x,Vars.player.y)\n });\n })\n Geometry.iterateLine(0,0,0,w,0,40,(x, y) => {\n effects.astralMarker.at(x, y, 0, {x: x, y:h})\n Time.run(90, () => {\n effects.astralCage.at(x, y, 0, {x: x, y:h})\n Sounds.laserblast.at(Vars.player.x,Vars.player.y)\n });\n })\n });\n }", "function checkAndAttack(target) {\n // The 'target' parameter is just a variable!\n // It contains the argument when the function was called.\n if(target) {\n hero.attack(target);\n }\n hero.moveXY(43, 34);\n}", "function beAttractedToPlayer() {\n if (currentScene === \"forbiddenFruitScene\") {\n return;\n }\n // calculate something around the player's x, y\n // get the current distance from the player\n let playerPosX = playerX;\n let playerPosY = playerY;\n\n const minDistance = 20;\n const maxDistance = minDistance / 2; // don't get closer than half of the min distance\n\n let currentDistance = dist(playerPosX, otherGenderX, playerPosY, otherGenderY);\n // while it is greater than half of the distance\n if (currentDistance >= minDistance) {\n // Advance to the one-seventh of a distance\n otherGenderVX = currentDistance / 7;\n otherGenderVY = currentDistance / 7;\n\n // Update otherGender position to go towards the player depending on the distance\n // relative to the player at each successive call of this function\n if (otherGenderX < playerX) {\n otherGenderX += otherGenderVX * 0.10;\n } else {\n otherGenderX -= otherGenderVX * 0.10;\n }\n if (otherGenderY < playerY) {\n otherGenderY += otherGenderVY * 0.10;\n } else {\n otherGenderY -= otherGenderVY * 0.10;\n }\n }\n screenWarping(\"nonplayer\");\n}", "function checkHit(x,y,which){\n\t//lets change the x and y coords (mouse) to match the transform\n\tx=x-BOARDX;\n\ty=y-BOARDY;\t\n\t//go through ALL of the board\n\tfor(i=0;i<BOARDWIDTH;i++){\n\t\tfor(j=0;j<BOARDHEIGHT;j++){\n\t\t\tvar drop = boardArr[i][j].myBBox;\n\t\t\t//document.getElementById('output2').firstChild.nodeValue+=x +\":\"+drop.x+\"|\";\n\t\t\tif(x>drop.x && x<(drop.x+drop.width) && y>drop.y && y<(drop.y+drop.height) && boardArr[i][j].droppable && boardArr[i][j].occupied == ''){\n\t\t\t\t\n\t\t\t\t//NEED - check is it a legal move???\n\t\t\t\t//if it is - then\n\t\t\t\t//put me to the center....\n\t\t\t\tsetTransform(which,boardArr[i][j].getCenterX(),boardArr[i][j].getCenterY());\n\t\t\t\t//fill the new cell\n\t\t\t\t//alert(parseInt(which.substring((which.search(/\\|/)+1),which.length)));\n\t\t\t\tgetPiece(which).changeCell(boardArr[i][j].id,i,j);\n\t\t\t\t//change other's board\n\t\t\t\tchangeBoardAjax(which,i,j,'changeBoard',gameId);\n\t\t\t\t\n\t\t\t\t//change who's turn it is\n\t\t\t\tchangeTurn();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\t\n\t}\n\treturn false;\n}", "function moveEnemy1() {\n posX = parseInt($(\"#enemy1\").css(\"left\"));\n $(\"#enemy1\").css(\"left\", posX - vel);\n $(\"#enemy1\").css(\"top\", posY);\n\n if (posX <= 0) {\n posY = parseInt(Math.random() * 334);\n $(\"#enemy1\").css(\"left\", 634);\n $(\"#enemy1\").css(\"top\", posY);\n }\n }", "attack(attackName) {\n _target.health -= _target.attacks[attackName]\n if (_target.health < 0) {\n _target.health = 0\n }\n }", "attack(target) {\n target.healthPoints -= this.attackPower;\n this.attackPower += this.startAttackPower;\n }", "function checkTooBad() {\n\n if (xPosition === xZombiePos && yPosition === yZombiePos) {\n gameOver();\n }\n}", "function doAttack(number){\n\tlastAttack = characterAttacks[selectedPlayer.element];\n\tif (turnCounter == 0) {\n\t\tlastAttack.fn(p2Grid, selectedPlayer.square.xIndex, selectedPlayer.square.yIndex);\n\t} else if (turnCounter == 1) {\n\t\tlastAttack.fn(p1Grid, selectedPlayer.square.xIndex, selectedPlayer.square.yIndex);\n\t}\n}", "function canMove (x,y,dir) {}", "enemyAttack () {\r\n // declaring variables\r\n let hitRow = 0;\r\n let hitCol = 0;\r\n let $selector; \r\n // Check if the last hit of enemy is on a ship, if it is not call the\r\n // the random atack, else, try to find the rest of the ship.\r\n if (!this.lastEnemyHit.hitted) {\r\n this.enemyRandomAttack ();\r\n }\r\n else {\r\n // Loop to find the rest of the ship\r\n while (true) \r\n {\r\n // Set col and the row to the last enemy hit\r\n hitRow = this.lastEnemyHit.row;\r\n hitCol = this.lastEnemyHit.col;\r\n \r\n // If the test col of lastEnemyhit is true, test for the columns.\r\n // else test for the rows\r\n if (this.lastEnemyHit.testCol == true) {\r\n // if colIncrease from lastEnemyHit is true, text next cols\r\n // else test cols in the \r\n // decresing order.\r\n if (this.lastEnemyHit.colIncrease == true) {\r\n // if the last hitted col is equal the map size set the \r\n // colIncrease to false to test the cols in the \r\n // decresing order.\r\n if (hitCol == MAP_SIZE) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false\r\n };\r\n continue;\r\n }\r\n // increase the col to test the next \r\n hitCol ++;\r\n // Select the next \r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n // test if the next is already hitted.\r\n // Else set increaseCol To false to test the cols in the \r\n // decresing order.\r\n \r\n if (!this.map.isCellHitted($selector)) {\r\n // Check if the enemy hitted the ship, and if it does,\r\n // just keep going.\r\n // Else change to check to test the previous cols\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n };\r\n } \r\n \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false\r\n };\r\n }\r\n break;\r\n }\r\n\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false,\r\n };\r\n }\r\n }\r\n // Does the same logic of the cols, but decreasing the colums.\r\n else {\r\n if (hitCol == 1) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n testRow: true,\r\n testCol: false\r\n };\r\n continue;\r\n }\r\n hitCol--;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n \r\n // If the enemy find something already hitted or\r\n // empty, next time he will try the colums,\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n };\r\n } \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n testRow: true,\r\n testCol: false\r\n };\r\n this.lastEnemyHit.col++;\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol\r\n };\r\n }\r\n }\r\n }\r\n // Does the same logic from the cols to the rows, with a fell changes\r\n // in the next commets\r\n else if (this.lastEnemyHit.testRow == true) {\r\n if (this.lastEnemyHit.rowIncrease == true) {\r\n if (hitRow == MAP_SIZE) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n rowIncrease:false\r\n };\r\n continue;\r\n }\r\n // Increase the rows \r\n hitRow ++;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n // Work the same as the cols increasing.\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n } \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n rowIncrease:false\r\n };\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n }\r\n }\r\n else {\r\n if (hitRow <= 1) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n hitted: false,\r\n testRow: false,\r\n testCol: true,\r\n rowIncrease: true,\r\n colIncrease: true\r\n };\r\n break;\r\n }\r\n hitRow--;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n } \r\n // reset everything if the enemy not find the boat\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n hitted: false,\r\n testRow: false,\r\n testCol: true,\r\n rowIncrease: true,\r\n colIncrease: true\r\n };\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.map.checkVictoryCondition(this.playerShips);\r\n }", "attackBasic(cursor, angle, tempSprite) {\n\n //Call the hero's attackBasic first\n //tempSprite.anims.play(\"shield\",true);\n tempSprite.anims = this.anims;\n //console.log(this.anims);\n\n //this.hero.attackBasic(cursor, angle, tempSprite);\n\n //Rotation of sprite and box\n if (angle > -Math.PI / 4 && angle <= Math.PI / 4) {\n console.log(\"atacked\");\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"rightBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"rightBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"rightBasicAttackMage\"); break;\n }\n } else if (angle > -3 * Math.PI / 4 && angle <= -Math.PI / 4) {\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"upBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"upBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"upBasicAttackMage\"); break;\n }\n } else if ((angle > 3 * Math.PI / 4 && angle <= Math.PI) || (angle <= -3 * Math.PI / 4 && angle >= -Math.PI)) {\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"leftBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"leftBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"leftBasicAttackMage\"); break;\n }\n } else if (angle <= 3 * Math.PI / 4 && angle > Math.PI / 4) {\n switch (this.playerType) {\n case HEROES.SHIELD_HERO:\n this.sprite.anims.play(\"downBasicAttackShield\");\n break;\n case HEROES.SWORD_HERO:\n this.sprite.anims.play(\"downBasicAttackSword\");\n break;\n //case HEROES.MAGE_HERO: this.sprite.anims.play(\"downBasicAttackMage\"); break;\n }\n }\n }", "function checkcollectables(t_collectable)\n{\n\tif(dist(gameChar_world_x, gameChar_y -30 , t_collectable.x_pos, t_collectable.y_pos) < 30)\n\t{\n\t\tt_collectable.isFound = true;\n\t\tconsole.log(\"is true statement\", gameChar_world_x)\n\t}\n\t\n\n}", "function attackTheEnemy(enemy) {\n enemy.hitPoints -= Math.floor(Math.random() * 20) + 10;\n stillFighting = true;\n if (enemy.hitPoints <= 0) {\n stillFighting = false;\n player.hitPoints += Math.floor(Math.random() * 50);\n console.log()\n player.enemiesKilled++;\n player.inventory.push(getRandomReward());\n } else {\n stillFighting = enemyAttacks();\n }\n return stillFighting;\n}", "performAttack() {\n return this.attack + Math.floor(this.attackModifier * Math.random());\n }", "survivorAttack() {\n var affectedTiles = []; //An array of tiles affected by the attack.\n var SurvivorTile = this.Survivor.getCurrentTile(); //Survivor's tile.\n var upTile = this.gameBoard[SurvivorTile.getTileX()][SurvivorTile.getTileY() - 1]; //Tile north of survivor.\n var DownTile = this.gameBoard[SurvivorTile.getTileX()][SurvivorTile.getTileY() + 1]; //Tile south of survivor.\n affectedTiles.push(upTile, DownTile); //Add north/south tiles to affected tiles.\n\n //If the survivor is facing right, add the right tile to the array. If not, add the left tile.\n if (this.Survivor.getFacingRight()) {\n var rightTile = this.gameBoard[SurvivorTile.getTileX() + 1][SurvivorTile.getTileY()];\n affectedTiles.push(rightTile);\n } else {\n var leftTile = this.gameBoard[SurvivorTile.getTileX() - 1][SurvivorTile.getTileY()];\n affectedTiles.push(leftTile);\n }\n\n //Have all tiles take damage, if they *can* be damaged.\n for (const t of affectedTiles) {\n t.takeDamage();\n }\n //Have all zombies that may be in those tiles take damage.\n for (const z of this.activeZombies) {\n for (const t of affectedTiles) {\n if (z.getCurrentTile() == t && z.isZombieAlive() === true) {\n this.killZombie(z);\n this.playerScore += 25;\n this.updateUI();\n }\n }\n }\n }", "function checkCanyon(t_canyon)\n{\nif(gameChar_world_x > t_canyon.x_pos && gameChar_world_x < t_canyon.x_pos + t_canyon.width && gameChar_y >= floorPos_y)\n {\n gameChar_y += 5;\n }\n}", "function updatePlayer(){\n\tif(game.physics.arcade.isPaused)\n\t\treturn;\n\n\tif(game.time.elapsedSince(this.start_time_hit) > 1500 ){\n\t\tthis.canMove = true;\n\t\tthis.spiral.visible = false;\n\t}\n\n\tif(this.y < -30 || this.y > 630 || this.x < -30 || this.x > 830){\n\t\tthis.position.setTo(400, 400);\n\t\tthis.body.velocity.setTo(0, 0);\n\t}\n\n\tthis.blood.update();\n\n\tthis.eyes.x = this.x;\n\tthis.eyes.y = this.y;\n\tthis.eyes.frame = this.frame;\n\n\tthis.movePlayer();\n\tthis.attacking();\n\n\tif (game.time.time - this.timeVelocityActivated < this.timeWithVelocity){\n\t\t\n this.speed = this.highSpeed;\n }\n else{\n \tif(!this.is_attacking)\n \tthis.speed = this.SPEED_WALKING;\n else\n \tthis.speed = this.SPEED_ATTACKING;\n gui.changeAbility(false, \"velocity\");\n } \n\n if(this.shield.visible){\n \tvar time = Math.floor((10000 - (game.time.now - this.shield.initTime)) / 1000);\n \tvar scale = ((time * 1000 / 10000) * 1.5) + 0.5;\n \tif(scale > 1)\n \t\tscale = 1;\n \t\n \tthis.shield.scale.setTo(scale, scale);\n\n \tif(game.time.now - this.shield.initTime > 10000)\n \t\tthis.shield.visible = false;\n }\n\n\n if( this.segment ){\n \tthis.segment.x = this.body.x + 15;\n\t\tthis.segment.y = this.body.y - 25;\n }\n\n\t// Cuando se presiona la tecla SPACE, se produce un ataque o se interactúa con un pillar\n\tif(keyboard.spaceKey() && !this.is_attacking && game.time.now - this.start_time_pillar_action > 500){\n\t\tif ( this.overlapPillar() ){\n\t\t\tthis.start_time_pillar_action = game.time.now;\n }\n else if (!this.segment){\n \tthis.toAttack();\n }\n\t}\n\n\t\n}", "detectHit(x, y)\n {\n if(dist(x, y, this.xPos, this.yPos) < 50)\n {\n return true;\n }\n return false;\n }", "function canWalkHere(x, y)\n\n{\n\nreturn ((world[x] != null) &&\n\n(world[x][y] != null) &&\n\n(world[x][y] <= maxWalkableTileNum));\n\n}", "teleportTo(x,y){\r\n // Remove from current tile\r\n let currentTile = this.field.getTile(this.x, this.y);\r\n if (currentTile) currentTile.creature = null;\r\n // Update the stored position\r\n this.x = x;\r\n this.y = y;\r\n // Move the image\r\n let landingTile = this.field.getTile(this.x, this.y);\r\n if(landingTile.image) landingTile.image.append(this.image);\r\n landingTile.creature = this;\r\n }", "hitPacman(ghostPos){//takes in p5.Vector\r\n return (dist(ghostPos.x, ghostPos.y, this.pos.x, this.pos.y)<10);//change to <25 for 1080p\r\n }", "function fnAttackPlayersTurn(event) {\n if (gameState !== PLAYERS_TURN) {\n return;\n }\n\n var { x, y } = getGridCoordinates(event);\n\n if (gridsPlayer[ENEMY][x][y] !== UNEXPLORED) {\n alert(\"You've already attacked these coordinates.\");\n return;\n }\n\n var cellStatus = fnShootAtEnemy(gridsComputer[OWN][x][y]);\n gridsPlayer[ENEMY][x][y] = cellStatus;\n fnColorCells(oCanvas[ENEMY].ctx, gridsPlayer[ENEMY], x, y);\n\n if (cellStatus === MISSED) {\n updateGameState(COMPS_TURN);\n }\n}", "ai_wander() {\n /*\n This will cause the AI to wander around the area.\n */\n const dirs = [ { x: 0, z: 1 }, { x: 1, z: 0 }, { x: 0, z: -1 }, { x: -1, z: 0 } ];\n let options = [ { x: 0, z: 0 } ];\n for(let d of dirs) {\n if(this.grid.can_move_to({x: this.loc.x + d.x, z: this.loc.z + d.z })) {\n options.push(d);\n }\n }\n\n let choice = options[Math.floor(Math.random() * options.length)];\n if(choice.x || choice.z) {\n this.grid.object_move(this, { x: this.loc.x + choice.x, y: this.loc.y, z: this.loc.z + choice.z });\n return true;\n }\n return false; //no action\n }", "fire(Enemy){\n\n if(this.difficulty==1){\n\n let hitFound=false;\n\n while(hitFound!=true){\n\n let col = Math.floor((Math.random()*8)+0);\n let row= Math.floor((Math.random()*8)+0);\n console.log(\"attmepting to hit col: \" + col + \" row: \" + row )\n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n Enemy.hitBoard.attempt[row][col]=true;\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n Enemy.hitBoard.hit[row][col]=true;\n hitFound=true;\n\n }\n }\n }\n\n if(this.difficulty==2){\n //set orthogonal fire once it hits\n if(this.difficulty==2){\n //set orthogonal fire once it hits\n let hitFound=false;\n \n \n while(hitFound!=true){\n\n let col = Math.floor((Math.random()*8)+0);\n let row= Math.floor((Math.random()*8)+0);\n let tempCol=col;\n let tempRow=row; \n \n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n if(Enemy.boatBoard.isAHit(col,row)){\n \n //after hit is found, checks for spaces to the left\n tempCol+1;\n while(Enemy.boatBoard.isAHit(tempCol,row))\n {\n Enemy.boatBoard.hasBeenHit[row][tempCol]=true;\n Enemy.hitBoard.hit[row][tempCol]=true;\n tempCol+1;\n }\n \n //then it checks for spaces to the right of hit\n tempCol=col-1;\n while(Enemy.boatBoard.isAHit(tempCol,row))\n {\n Enemy.boatBoard.hasBeenHit[row][tempCol]=true;\n Enemy.hitBoard.hit[row][tempCol]=true;\n tempCol-1;\n }\n \n //checks for spaces above hit\n tempRow=row+1;\n while(Enemy.boatBoard.isAHit(col,tempRow))\n {\n Enemy.boatBoard.hasBeenHit[tempRow][col]=true;\n Enemy.hitBoard.hit[tempRow][col]=true;\n tempRow+1;\n }\n \n //checks for spaces below hit\n tempRow=row-1;\n \n while(Enemy.boatBoard.isAHit(col,tempRow))\n {\n Enemy.boatBoard.hasBeenHit[tempRow][col]=true;\n Enemy.hitBoard.hit[tempRow][col]=true;\n tempRow-1;\n } \n } \n Enemy.hitBoard.hit[row][col]=true;\n hitFound=true;\n }\n } \n \n \n\n }\n }\n\n if(this.difficulty==3){\n \n let hitFound=false;\n \n for(let row = 0; row<9; row++){\n for(let col =0; col<9; col++){\n\n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n //in isAHit col and row are flipped since that's how it used for p1 and p2 in application.js\n if(Enemy.boatBoard.isAHit(col,row)===true){\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n Enemy.hitBoard.attempt[row][col]=true;\n Enemy.hitBoard.hit[row][col]=true;\n\t\t\t\t\t\t\t\tEnemy.boatCount--;\n hitFound=true;\n }\n }\n if(hitFound===true){\n break;\n }\n }\n if(hitFound===true){\n break;\n }\n }\n \n }\n }", "function PvPattack() {\n var players = Orion.FindType('0x0190|0x0191', '-1', ground, 'near|mobile', '25', 'red|gray|criminal');\n if (players.length) Orion.Attack(players[0]);\n}", "function movePlayer() {\n screenWarping(\"player\");\n playerX += playerVX;\n playerY += playerVY;\n}", "function attackHitTestSmog(attackPosition, attackSize) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.attackPosition.x,obj1.attackPosition.y);\n app.main.ctx.fillStyle = \"Red\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tfor (var i = 0; i < app.main.environment.smogCount; i++) {\n\t\tif (attackPosition.x + 35 < app.main.environment.smogPos[i].x + app.main.environment.smogSize[i].x - 10 && attackPosition.x + 35 + attackSize.x - 70 > app.main.environment.smogPos[i].x && attackPosition.y + 35 < app.main.environment.smogPos[i].y + app.main.environment.smogSize[i].y - 10 && attackSize.y - 70 + attackPosition.y + 35 > app.main.environment.smogPos[i].y) {\n\t\t\tapp.main.environment.smogTarget = i;\n\t\t\treturn true;\n\t\t}\n\t}\n}", "function player_move(dir) {\n player.pos.x += dir;\n if (collide(arena, player)) {\n player.pos.x -= dir;\n }\n}", "dealDamage() {\n let d = dist(this.x, this.y, player.x, player.y);\n if (\n d < this.size / 2 &&\n this.mapX === player.mapX &&\n this.mapY === player.mapY\n ) {\n // if the player touches the projectile, deal damage to them and destroy the projectile to prevent repeating damage\n player.healthTarget -= this.damage;\n sounds.spiritHit.play();\n this.die();\n }\n }", "mouseClickHandler(e) {\n let x = e.clientX\n let y = e.clientY - 100\n console.log(x,y)\n\n // update attack index\n let i = this.attacks.attackHandler(x,y)\n console.log(\"ATTACK INDEX IN MOUSE CLICK:\")\n console.log(i)\n if (i) {\n this.attackIndex = i\n } else {\n this.attackIndex = 0\n }\n // update attacks\n this.attacks.draw(this.ctx, this.attackIndex)\n \n }", "allowMove(x, y, person) {\n let tile = this.getTile(x, y);\n //False for Water and Walls and obstacles.\n if (tile.terrain.canEnter && !tile.object) {\n return {\n allow: true, //allow person to move\n cost: tile.terrain.cost, //cost of movement based on terrain\n object: tile.hasOwnProperty(\"object\") ? tile.object : \"None\"\n }; //^Either send back the object located on a given tile, or \"None\"\n // as a default value\n }\n else if (tile.terrain.name === TERRAIN_MAP[2].name && person.boatStatus()) {\n return {\n allow: true,\n cost: 0, //no movement penalty for water+boat\n object: tile.hasOwnProperty(\"object\") ? tile.object : \"None\"\n };\n }\n else if (tile.object) {\n // If there is an object, allow player to buy it.\n return {\n allow: true,\n cost: tile.terrain.cost,\n object: tile.object\n };\n }\n else {\n return {\n allow: false,\n cost: tile.terrain.cost,//<consume energy if attempting to cross\n object: \"None\" // water without a boat\n }; //^no movement -> don't bother sending any items\n }\n }", "function attack(attacker, defender) {\n return defender - attacker;\n}", "attackableTiles(map, wlist = this.weapons)\n {\n let wlist2 = []\n for (let w of wlist)\n {\n if (this.canUseWeapon(w))\n {\n\twlist2.push(w)\n }\n }\n let p = inRange(this, this.getRange(wlist2), \"tiles\", map);\n p.setArt(\"C_atk\");\n return p;\n }", "pointingTowards(creature){\r\n let dX = creature.x - this.x;\r\n let dY = creature.y - this.y;\r\n // The \"strongest\" delta gets strength 2, the weakest one\r\n let dXPower = (Math.abs(dX) >= Math.abs(dY)) ? 2 : 1;\r\n let dYPower = (Math.abs(dY) >= Math.abs(dX)) ? 2 : 1;\r\n switch (this.direction) {\r\n case 0: return -dYPower * Math.sign(dY);\r\n case 90: return dXPower * Math.sign(dX);\r\n case 180: return dYPower * Math.sign(dY);\r\n case 270: return -dXPower * Math.sign(dX);\r\n }\r\n }", "attack(youHero) {\n if (this.name === ennemies[0].name) {\n if (Math.floor(Math.random() * Math.floor(9)) / 10 <= this.accuracy) {\n \n console.log(\n youHero.name +\n \" got hit with an alien Z * mizzle, their health is down to\"\n );\n console.log((youHero.hull += -7)); /// had it set to this . mizzle but somehting was not working with it or the random number so I hard coded it... sorry\n defeat(youHero); /// like above -_- but did you die?\n } else {\n console.log(this.name + \" can not hit the side of a barn\"); /// so you know who next target is when they appear but miss\n console.log(\n \"Ha! those aliens shoot like stormtroopers \" +\n youHero.name +\n \"took no damage. Hull power = \" +\n youHero.hull\n ); /// you know they missed\n defeat(youHero); /// no damage awesome but return to your move with this\n }\n } else {\n console.log(\"dead aliens can't shoot\"); // not sure how they would but just in case if simulating in console log with pre typed functions...\n //return to your move\n defeat(youHero);\n }\n }", "function emit_attack() {\n var dir;\n dir = get_my_direction();\n dir.setLength(CONFIG.BULLET_VELOCITY);\n\n game.bullets.push(new TYPE.Bullet(game,\n dir,\n new THREE.Mesh(WORLD.bullet_geometry,\n WORLD.bullet_material))\n );\n\n game.bullets[game.bullets.length-1].mesh.position.copy(WORLD.player.mesh.position);\n WORLD.scene.add(game.bullets[game.bullets.length-1].mesh);\n\n // tell the other plays i fired\n socket.emit(\"new_bullet\", {\"pos\": game.bullets[game.bullets.length-1].mesh.position, \"dir\": dir});\n}", "checkCollision (playerPosition) {\n /*\n if (playerPosition[0] > this.position[0][0] && playerPosition[0] < this.position[0][1]) {\n if (playerPosition[1] > this.position[1][0] && playerPosition[1] < this.position[1][1]) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }\n */\n\n let er = 0;\n let ec = 0;\n let pr = 0;\n let pc = 0;\n\n /* player x position */\n if(player.x < 100){ pc = 0; }\n if(player.x >= 100 && player.x < 200){ pc = 1; } \n if(player.x >= 200 && player.x < 300){ pc = 2; }\n if(player.x >= 300 && player.x < 400){ pc = 3; }\n if(player.x >= 400){ pc = 4; }\n\n /* player y position */\n if(player.y < 72) { pr = 0; } \n if(player.y >= 72 && player.y < 154) { pr = 1; } \n if(player.y >= 154 && player.y < 236) { pr = 2; } \n if(player.y >= 236 && player.y < 318) { pr = 3; } \n if(player.y >= 318 && player.y < 400) { pr = 4; } \n if(player.y >= 400) { pr = 5; } \n\n /* enemy car x position + 10 buffer for easyer gameplay */\n if(this.x < -100){ ec = -1; }\n if(this.x >= -100 && this.x < 0){ ec = 0; } \n if(this.x >= 0 && this.x < 100){ ec = 1; } \n if(this.x >= 100 && this.x < 200){ ec = 2; }\n if(this.x >= 200 && this.x < 300){ ec = 3; }\n if(this.x >= 300 && this.x < 400){ ec = 4; }\n if(this.x >= 400){ ec = 5; }\n\n /* enemy car y position */\n if(this.y < 63) { er = 0; } \n if(this.y >= 63 && this.y < 143) { er = 1; } \n if(this.y >= 143 && this.y < 223) { er = 2; } \n if(this.y >= 223 && this.y < 303) { er = 3; } \n if(this.y >= 303 && this.y < 383) { er = 4; } \n if(this.y >= 383) { er = 5; } \n/*\n if (ec == 2) { \n alert(this.x.toString()); \n }\n*/\n if ((pc == ec) && (pr == er)) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }", "function encloseIsland(){\n if(shipX < width / 2 + 300 && keyIsDown(37)){\n shipX += 4;\n }\n}", "function checkCanyon(t_canyon)\n{\n if(gameChar_world_x <= t_canyon.x_pos + 100 && gameChar_y >= t_canyon.y_pos && gameChar_world_x > t_canyon.x_pos)\n \n {\n isPlummeting = true;\n gameChar_y += 2;\n }\n else \n {\n \n isPlummeting = false;\n \n }\n \n \n}", "update(dt) {\n // multiplying the movements by the dt parameter will\n // ensure the game runs at the same speed for all computers.\n\n this.x += this.enemySpeed * dt ;\n if (this.x > 510 ){\n this.x = -102;\n this.y = posArray[Math.floor(Math.random() * posArray.length)];\n this.enemySpeed = enemySpeed[Math.floor(Math.random() * enemySpeed.length)];\n this.x += this.enemySpeed * dt ; \n }\n }", "function checkCanyon(t_canyon)\n{\n\n if (gameChar_world_x > t_canyon.x_pos + 60 && gameChar_world_x < t_canyon.x_pos + 40 + t_canyon.width && gameChar_y >= floorPos_y)\n {\n isPlummeting = true;\n gameChar_y += 15;\n }\n \n}", "function input() {\n if(65 in keysDown) {\n if (getTile((player.x - player.speed) + 1, player.y + 16) !== \"1\") { //If player runs into a wall, they will not be allowed to go through it.\n player.x -= 3; //when \"A\" is pressed on keyboard, move player 3 pixels to left.\n }\n }\n if(68 in keysDown) {\n if (getTile(((player.x + player.width) + player.speed) - 1, player.y + 16) !== \"1\") { //If player runs into a wall, they will not be allowed to go through it.\n player.x += 3; //when \"D\" is pressed on keyboard, move player 3 pixels to right.\n }\n }\n if(87 in keysDown && player.yke === 0) {\n if(getTile(player.x, player.y -1) !== \"1\" && getTile(player.x + 32, player.y -1) !== \"1\") {\n player.yke += 8;\n }\n } \n}", "function shipHit(ship, meteor){\r\n\tlives = lives - 1;\r\n\tship.position.x = width/2;\r\n\tship.position.y = height/2;\r\n}", "_checkCollision() {\n\n for (let ship of this.ships) {\n let pos = ship.getPosition();\n if (pos.y >= this.canvas.height) {\n // Killed ships are not moved, they stay at their location, but are invisible.\n // I don't want to kill the player with one invisible ship :)\n if (!ship.dead) {\n ship.kill();\n this.score.damage();\n this.base.removeShield();\n }\n }\n }\n }", "updateEnemies() {\n this.liveEnemies.forEach(enemy => {\n // If patrolling, just continue to edge of screen before turning around\n if (enemy.enemyAction === EnemyActions.Patrol) {\n //console.log(enemy);\n // These should be changed to not be hard coded eventually\n if (enemy.enemySprite.body.position.x < 50) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.x > 1850) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.y < 50) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n if (enemy.enemySprite.body.position.y > 1000) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n // check if we are near an object, if yes, try and guard it. Not sure if this is working - Disabling for now\n //console.log(this.isNearObject(enemy.enemySprite));\n if (null != null) {\n console.log(\"Is near an object\");\n enemy.enemySprite.body.velocity.y = 0;\n enemy.updateAction(EnemyActions.Guard, null);\n }\n // Otherwise, wait for attack cooldown before attacking the player\n else {\n if (enemy.attackCooldown === 0) {\n enemy.attackCooldown = Math.floor(Math.random() * 2000);\n enemy.updateAction(EnemyActions.Attack, this.level.player);\n }\n else {\n enemy.attackCooldown = enemy.attackCooldown - 1;\n }\n }\n }\n\n // Guard the item\n if (enemy.enemyAction === EnemyActions.Guard) {\n enemy.guard();\n }\n\n // Attack the player\n if (enemy.enemyAction === EnemyActions.Attack) {\n enemy.attack();\n }\n\n // check if animation needs to be flipped\n if (enemy.enemySprite.body.velocity.x < 0) {\n enemy.enemySprite.scale.x = -1;\n }\n else if (enemy.enemySprite.body.velocity.x > 0) enemy.enemySprite.scale.x = 1;\n });\n }", "setTarget(x, y) {\n this.targetX = x;\n this.targetY = y;\n //Check if the distance is a lot (40 min)\n //console.log(x - this.x);\n // this.setPosition(x, y);\n }", "checkCollision() { \n return (player.x < this.x + 80 &&\n player.x + 80 > this.x &&\n player.y < this.y + 60 &&\n 60 + player.y > this.y)\n }", "attack(target) {\n return (target.res -= this.power);\n }", "update(dt) {\n if (this.x < 505) {//it checks that enemies should not move outside\n this.x += this.speed * dt; // speed muliply by delta time\n }\n else {//this resets enemy's location to -101(initial)\n this.x = -101;\n }\n }", "function check_move(x, y, newx, newy, dir) {\n // if the map ends in either direction, disallow the desired move\n if (player['x'] === 0 && dir === 2) return false;\n if (player['x'] === MAP_WIDTH-1 && dir === 0) return false;\n if (player['y'] === 0 && dir === 1) return false;\n if (player['y'] === MAP_HEIGHT-1 && dir === 3) return false;\n\n // disallow moves onto lava\n if (map[newy][newx]['type'] === ' ') {\n return false;\n }\n\n // don't allow moves onto tiles that are currently rotating\n if (map[newy][newx]['tweenrot'] !== 0) {\n return false;\n }\n\n // (dir + 2) % 4 checks the side opposite the side we are moving into\n // eg. o if we are moving left ONTO this object, then dir = 2,\n // o o <- so then (dir+2)%4 = 0, meaning the right side must be \n // x open, 0, for us to be able to move onto it, which is true.\n // \n // o if instead we wanted to move up, dir=1, onto this object,\n // o o then (dir+2)%4 = 3, which corrosponds to the bottom, which is\n // x 1 in this case, so we cannot complete this move.\n // ^\n // |\n //\n // the blocked list for this object would be: [right, top, left, bottom] = [0,0,0,1]\n if ( !(is_blocked(newx, newy, (dir + 2) % 4, false))\n && !(is_blocked(x, y, (dir + 2) % 4, true)) ) {\n return true;\n }\n //console.log(\"direction IS blocked\");\n return false;\n}", "function checkCollision(enemy) {\n var enemyrange_min = enemy.y - 25;\n var enemyrange_max = enemy.y + 25;\n var playerrange_min = player.x + 83;\n var playerrange_max = player.x - 83;\n\n if ((player.y >= enemyrange_min) && (player.y <= enemyrange_max) && (enemy.x >= playerrange_max) &&(enemy.x <= playerrange_min)) {\n player.x = 202.5;\n player.y = 383;\n }\n}", "attackBase(enemyBase) {\n let d = dist(this.x, this.y, this.enemyBaseX, this.enemyBaseY);\n let dx = this.enemyBaseX - this.x;\n let dy = this.enemyBaseY - this.y;\n let angle = atan2(dy, dx);\n if (enemyBase.health>0){\n // move to it\n if (d >= 100) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n }\n // if in range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n // create and store a Bullet object\n this.bullet = new Bullet(this.x, this.y, enemyBase.x, enemyBase.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n Fire.play(); // sound\n // enemy base is under attack\n enemyBase.underAttack = true;\n this.theEnemyBase = enemyBase;\n }\n // make the bullet fly towards the target\n if (this.bulletFired && !this.dead) {\n this.bullet.moveTo(enemyBase);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n }\n this.handleWrapping();\n }", "function LockOnEnemy() { \n var checkPos : Vector3 = transform.position + transform.forward * autoLockTarget.lockOnRange;\n var closest : GameObject; \n \n var distance : float = Mathf.Infinity; \n var position : Vector3 = transform.position; \n autoLockTarget.lockTarget = null; // Reset Lock On Target\n var objectsAroundMe : Collider[] = Physics.OverlapSphere(checkPos , autoLockTarget.radius);\n for(var obj : Collider in objectsAroundMe){\n if(obj.CompareTag(\"Enemy\")){\n var diff : Vector3 = (obj.transform.position - position); \n\t\t var curDistance : float = diff.sqrMagnitude; \n\t\t if (curDistance < distance) { \n\t\t //------------\n\t\t closest = obj.gameObject; \n\t\t distance = curDistance;\n\t\t autoLockTarget.target = closest;\n\t\t autoLockTarget.lockTarget = closest.transform;\n\t\t } \n }\n }\n //Face to the target\n if(autoLockTarget.lockTarget){\n\t\t\t\tvar lookOn : Vector3 = autoLockTarget.lockTarget.position;\n\t\t \tlookOn.y = transform.position.y;\n\t\t \t\ttransform.LookAt(lookOn);\n\t\t \t\tif(autoLockTarget.verticalLookAt){\n\t\t \t\t\tvar tar : Vector3 = autoLockTarget.lockTarget.position;\n\t\t \t\t\ttar.y += autoLockTarget.anglePlus;\n\t\t \t\t\tattackPoint.transform.LookAt(tar);\n\t\t \t\t}\n\t\t}else{\n\t\t\tattackPoint.transform.rotation = transform.rotation;\n\t\t}\n \n}", "function collisionDetection(x, y) {\r\n if (\r\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\r\n x - getShipLocation(angle)[0] <= 35 &&\r\n x - getShipLocation(angle)[0] >= -35 &&\r\n y - getShipLocation(angle)[1] <= 35 &&\r\n y - getShipLocation(angle)[1] >= -35\r\n ) {\r\n // Calls crash screen when a collision is detected\r\n crashScreen();\r\n }\r\n}", "checkCollisions() {\n allEnemies.forEach(function(enemy) {\n if ( Math.abs(player.x - enemy.x) <= 80 &&\n Math.abs(player.y - enemy.y) <= 30 ) {\n player.x=200;\n player.y=405;\n }\n });\n }", "checkIfUserIsHit(user,myGame){\n if (\n this.x < user.x + user.width &&\n this.x + this.width > user.x &&\n this.y < user.y + user.height &&\n this.y + this.height > user.y\n ) {\n if(myGame.levelWon === false){\n let health = document.getElementById(\"health\")\n health.value -= myGame.enemyStrength;\n user.health -= myGame.enemyStrength;\n }\n }\n if(user.health <= 0 && myGame.levelWon === false){\n myGame.gameOver();\n }\n }", "function checkCollesion(enemy) {\n if (enemy.y == player.y) {\n if (((enemy.x + 70) >= player.x) && ((enemy.x + 70) <= player.x + 100)) {\n restartGame();\n }\n }\n \n \n}", "collision() {\n if (this.y === (player.y - 12) && this.x > player.x - 75 && this.x < player.x + 70) {\n player.collide();\n }\n }", "update (x, y) {\n if (this.x >= 405) {\n this.x = 400;\n } else if (this.x <= -1) {\n this.x = 0;\n } else if (this.y >= 400) {\n this.y = 400;\n } else if (this.y <= -20) {\n this.x = 200;\n this.y = 400;\n gameWon();\n \n }\n }", "function protoOnHit(){\n if (player.currentState == jump && player.controls.transform.position[1] < this.owner.controls.transform.position[1]){\n this.owner.changeState(deadEnemy)\n }\n}", "canAttack() {\n let self = this;\n for (let plant of window._main.plants) {\n if (plant.row === self.row && !plant.isDel) {\n // When zombies and plant are near to each other\n if (self.x - plant.x < -20 && self.x - plant.x > -60) {\n if (self.life > 2) {\n // Save the value of the current attacking plant, when the plant is deleted, then control the current zombie movement\n self.attackPlantID !== plant.id\n ? (self.attackPlantID = plant.id)\n : (self.attackPlantID = self.attackPlantID);\n self.changeAnimation(\"attack\");\n } else {\n self.canMove = false;\n }\n if (self.isAnimeLenMax && self.life > 2) {\n // Every time a zombie animation is executed\n // deduct plant health\n if (plant.life !== 0) {\n plant.life--;\n plant.isHurt = true;\n setTimeout(() => {\n plant.isHurt = false;\n // wallnut animations\n if (\n plant.life <= 8 &&\n plant.section === \"wallnut\"\n ) {\n plant.life <= 4\n ? plant.changeAnimation(\"idleL\")\n : plant.changeAnimation(\"idleM\");\n }\n // Determine if the plant is dead and removed if dead\n if (plant.life <= 0) {\n // Set plant death\n plant.isDel = true;\n // Clear sunlight generation timer for dead sunflowers\n plant.section === \"sunflower\" &&\n plant.clearSunTimer();\n }\n }, 200);\n }\n }\n }\n }\n }\n }", "function moveUp() {\n myGamePiece.speedY -= movementSpeed;\n restrictPlayer();\n}", "function checkCollectable(t_collectable)\n{\n \nif(dist(gameChar_world_x, gameChar_y, t_collectable.x_pos, t_collectable.y_pos) < t_collectable.size)\n {\n t_collectable.isFound = true;\n game_score += 1;\n }\n}" ]
[ "0.7288861", "0.7018269", "0.6895771", "0.6729098", "0.6710337", "0.6606484", "0.6551421", "0.65252167", "0.64997894", "0.6474597", "0.6461502", "0.64315295", "0.6376862", "0.63266724", "0.6287607", "0.62723", "0.6247899", "0.624592", "0.6239743", "0.6239565", "0.6219992", "0.6217652", "0.621325", "0.6211642", "0.6199943", "0.61963606", "0.61743224", "0.6164426", "0.6163995", "0.61331767", "0.61189324", "0.6118438", "0.61104876", "0.6093662", "0.6080615", "0.60776716", "0.6067441", "0.6066131", "0.6064266", "0.6063947", "0.6063209", "0.6062106", "0.6053791", "0.6052163", "0.60454905", "0.6022504", "0.60219353", "0.6006103", "0.60043323", "0.60015893", "0.5998525", "0.59858876", "0.59771955", "0.59756833", "0.5960209", "0.5954536", "0.5954042", "0.59456015", "0.5942004", "0.59397614", "0.5937837", "0.59334135", "0.59283364", "0.5927619", "0.5924784", "0.59226745", "0.59182864", "0.5916219", "0.5903698", "0.5898833", "0.58909047", "0.5879321", "0.5877962", "0.58683467", "0.58621556", "0.58534974", "0.58520013", "0.5844025", "0.5843368", "0.5838911", "0.58373713", "0.5835125", "0.5832629", "0.582989", "0.5819198", "0.58173144", "0.5812804", "0.5812426", "0.5809201", "0.580855", "0.58079755", "0.5807536", "0.5804564", "0.58030665", "0.5798657", "0.57979965", "0.57895756", "0.57813644", "0.5779029", "0.5776063", "0.5775271" ]
0.0
-1
will be used later if move is affected by anything. if not, then this will just be a getter
getMov() { let bn = 0 for (let i of this.equipment) { for (let [stat, amt] of Object.entries(i.stats)) { if (stat == "mov") bn += amt } } let ret = this.stats.mov + bn; if (ret < 0) ret = 0 return ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getMove() {\n return this.nextAction;\n }", "get moves() {\n return this._moves;\n }", "move () {\n //console.warn(\"WARNING\" + this + \" : not implemented move method\");\n }", "getMovements() {\n return this.#movements;\n }", "getMovements() {\n return this.#movements;\n }", "_getCurrentMove() {\n const { moves } = this.props;\n const moveIndex = this._getMoveIndex();\n\n if (_.isEmpty(moves) || moveIndex === -1) {\n return {};\n } else {\n return moves[moveIndex];\n }\n }", "get moveDeceleration () {\n if (this.action?.name === 'move') return 0\n return this._moveDeceleration\n }", "move() {\n throw \"Move method not implemented\";\n }", "move(x, y) {\n return this.x(x).y(y);\n }", "getMoveCount() {\n return this.moveCount;\n }", "move() { }", "move() { }", "move() {\n switch (this.machineTable[this.state][this.lastRead].move) {\n case directions.UP:\n return this.moveUp();\n case directions.RIGHT:\n return this.moveRight();\n case directions.DOWN:\n return this.moveDown();\n case directions.LEFT:\n return this.moveLeft();\n default:\n }\n }", "moveIsSmart() {}", "static moves () {\n return Moves.moves()\n }", "getMoveLocation() {\n return this.getLocationConfig(UpdateMode.move);\n }", "move () {\n }", "get position() {\n return {\n x: this.x,\n y: this.y\n };\n }", "move() {\n }", "get movements() {\n console.log(this.#movements)\n }", "get position() {\n return {x: this.x, y: this.y}\n }", "move() {\n this.x = this.x - 7\n }", "straightMoveObj() {\n let obj;\n this.color === 'white'\n ?\n obj = { x : 0, y : 1 }\n :\n obj = { x : 0, y : -1 }\n return obj;\n }", "get isMovingLeft () {\n return this.pointers.reduce((isMovingLeft, pointer) => {return (isMovingLeft || pointer.isMovingLeft)}, false);\n }", "move() {\n this.position = Utils.directionMap[this.orientation].move(this.position)\n this.log(`I moved and now at x: ${this.position.x} y: ${this.position.y}`)\n }", "move() {\n\n }", "unitMovement() {\n return this.constructor._unitMovements[this._clockwiseRightAngles];\n }", "getCamera() {\n return this.ship.getCamera();\n //return this.camera;\n }", "async nextMove(){\n\t\tthrow \"No next Move implemented!\";\n\t}", "onMove() {\n }", "moveRight() {\n dataMap.get(this).moveX = 5;\n }", "move() {\r\n this.x = this.x + this.v;\r\n }", "get left(): number {\n return this.position.x\n }", "move(from, to) {\n // Here is a bunch fo castling logic if there's a castling flag...\n if (this.currentMove.castlingFlag) {\n this.castlingMove(from, to);\n }\n // If it's a capture, handle our special case\n // This won't work for en passant. There are a lot of problems here man.\n else if (this.currentMove.captureSquare) {\n this.capturingMove(from, to);\n }\n else {\n // Handle disabling castling in case they moved a piece that breaks it\n this.handleDisableCastling(from, to);\n // Then do the usual\n super.move(from, to);\n // And also reset our special move data\n this.currentMove.from = undefined;\n this.currentMove.to = undefined;\n this.currentMove.captureSquare = undefined;\n }\n }", "moveForward() {\n switch (this.position.heading) {\n case \"N\":\n return (this.position = { ...this.position, y: this.position.y + 1 });\n case \"E\":\n return (this.position = { ...this.position, x: this.position.x + 1 });\n case \"S\":\n return (this.position = { ...this.position, y: this.position.y - 1 });\n case \"W\":\n return (this.position = { ...this.position, x: this.position.x - 1 });\n default:\n return this.position;\n }\n }", "get position() { return this._position; }", "get position() { return this._position; }", "get x() {return this._x;}", "get true_position() { return this.position.copy().rotateX(Ribbon.LATITUDE).rotateZ(Earth.rotation).rotateZ(Ribbon.LONGITUDE); }", "function computerMove(){\n return bestComputerMove(FIELD, DEPTH);\n}", "get_position() {\r\n return {\r\n x_pos: this.sprite.x_pos,\r\n y_pos: this.sprite.y_pos\r\n };\r\n }", "moveLeft() {\n dataMap.get(this).moveX = -5;\n }", "move(){\r\n this.x += this.dx;\r\n }", "getPos() {\n return {\n x: this.sprite.x,\n y: this.sprite.y\n };\n }", "get position() {\n\t\treturn this.state.sourcePosition;\n\t}", "moveIsValid() {}", "get isMovingUp () {\n return this.pointers.reduce((previous, pointer) => {return (previous || pointer.isMovingUp)}, false);\n }", "MoveRobot() {\n\t\treturn this._executeCommand(Commands.Move);\n\t}", "reflection(ref) {\n return Point.create(ref).move(this, this.distance(ref));\n }", "moveLeft() {\r\n this.actual.moveLeft();\r\n }", "aiMove(state) {\r\n return this.miniMax(state, 2).space;\r\n }", "function getPlayerMove(move) {\n if (move === undefined||null){\n return getInput();\n \n }\n return move;\n}", "get origin() {\n return { x: this.x, y: this.y };\n }", "getLeftUnit(){return this.__leftUnit}", "getMove(move) {\n\t\treturn this.getString(this.moveNames, move);\n\t}", "get x() { return this._x; }", "getLastMove() {\n return this.moveList[moveList.length-1];\n }", "get right(): number {\n return this.position.x + this.width\n }", "move() {\r\n this.x += this.vX;\r\n this.y += this.vY;\r\n }", "get board() {\n return this._board;\n }", "get board() {\n return this._board;\n }", "move() {\n this.x += this.vx;\n this.y += this.vy;\n }", "get posX(){\n return this._posX ;\n }", "move() {\n if (this.isAvailable) {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n // Handle wrapping\n this.handleWrapping();\n }\n }", "get asSetter() {\n return setter(this.over)\n }", "get targetPosition() {}", "get position() {\n\t\treturn this._position.object;\n\t}", "move() {\n this.y -= this.speed;\n }", "get currPlayerTurn(){\n return this.playerTurn;\n }", "get self() {\n return this.isSelf();\n }", "move() {\n // To update the position\n this.x += this.vx;\n this.y += this.vy;\n // Handle wrapping\n this.handleWrapping();\n }", "Move (x, y) {\n this.previous_position = this.copy\n this.vel.x = x \n }", "move() {\n if (!this.isOnTabletop()) return;\n let [dx, dy]=FacingOptions.getFacingMoment(this.facing);\n let nx=this.x+dx;\n let ny=this.y+dy;\n if (this.tabletop.isOutOfBoundary(nx, ny)) return;\n this.x=nx;\n this.y=ny;\n }", "get playerBoard() {\n return this._playerBoard;\n }", "move(x, y) {\n return x !== 0\n ? this.moveVertically(x)\n : this.moveHorizontally(y)\n }", "setMoves(value) {\n this.isMoved = value;\n return this;\n }", "function getPlayerMove(move) {\n return move || getInput();\n}", "move() {\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Handle wrapping\n this.handleWrapping();\n }", "get direction() { return this._direction; }", "get direction() { return this._direction; }", "function getComputerMove(move) {\n return move || randomPlay();\n}", "getTurnover() {\n return this.turnover;\n }", "getBoard() {\n return state.board;\n }", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }", "move(x, y) {\n\n this.tr.x += x;\n this.tr.y += y;\n }", "move(position = Vector.zero) {\n this.x = position.x;\n this.y = position.y;\n }", "getLocation() {\n return this.position;\n }", "get target(){ return this.__target; }", "function movement(move, player) {\n this.player = player;\n if(this.player.idle == true && this.player.isAlive == true){\n if(move == 1){\n if(this.player.position_Y == 0){\n return this.player;\n }else{\n newPosY = Math.sqrt(this.player.position_Y * this.player.position_Y) - Math.sqrt(this.player.speed * this.player.speed);\n newPosX = Math.sqrt(this.player.position_X * this.player.position_X);\n this.player.position_X = newPosX;\n this.player.position_Y = newPosY;\n return this.player;\n }\n }else if(move == 2){\n if(this.player.position_Y == 2){\n return this.player;\n }else{\n newPosY = Math.sqrt(this.player.position_Y * this.player.position_Y) + Math.sqrt(this.player.speed * this.player.speed);\n newPosX = Math.sqrt(this.player.position_X * this.player.position_X);\n this.player.position_X = newPosX;\n this.player.position_Y = newPosY;\n return this.player;\n }\n }else if(move == 3){\n if(this.player.position_X == 0){\n return this.player;\n }else{\n newPosX = Math.sqrt(this.player.position_X * this.player.position_X) - Math.sqrt(this.player.speed * this.player.speed);\n newPosY = Math.sqrt(this.player.position_Y * this.player.position_Y);\n this.player.position_X = newPosX;\n this.player.position_Y = newPosY;\n return this.player;\n }\n }else if(move == 4){\n if(this.player.position_X == 2){\n return this.player;\n }else{\n newPosX = Math.sqrt(this.player.position_X * this.player.position_X) + Math.sqrt(this.player.speed * this.player.speed);\n newPosY = Math.sqrt(this.player.position_Y * this.player.position_Y);\n this.player.position_X = newPosX;\n this.player.position_Y = newPosY;\n return this.player;\n }\n }\n }else{\n return this.player;\n }\n}", "move(predicate) {\n //console.log(predicate);\n const moveBy = this.moveMap[this.state.heading];\n // console.log(moveBy);\n const nextPos = { x: this.state.pos.x, y: this.state.pos.y };\n //console.log(nextPos);\n // Set next position\n nextPos[moveBy.plane] += moveBy.amount;\n\n // Check if move is legal\n const isLegal = predicate(nextPos);\n\n if (isLegal) {\n this.state.pos = nextPos;\n }\n }", "get director() {\n return this._director;\n }", "get position() {\n\t\t\treturn {x: this.x, y: this.y};\n\t\t}", "get removable() { return this._removable; }", "sync() {\n this._left = this._movement_array[0];\n this._through = this._movement_array[1];\n this._right = this._movement_array[2];\n }", "static MoveTowards() {}", "validMove(move, player, board){\n var newBoard = this.copyBoard(board);\n if(newBoard[move] === \" \"){\n newBoard[move] = player;\n return newBoard;\n } else\n return null;\n}", "processMove() {\n let movedPieces = this.gameOrchestrator.gameboard.movePiece(this.firstTile, this.secondTile);\n this.gameMove.setMovedPieces(movedPieces);\n this.gameOrchestrator.gameSequence.addGameMove(this.gameMove);\n }", "isValidMove(){\n\n }", "move(){\n this.x = this.x + this.s;\n if (this.x > width){\n this.x = 0;\n }\n }", "getNewPos(){\n return this.newPos;\n }", "get x() {\n return this._x;\n }" ]
[ "0.7011311", "0.6899151", "0.6733691", "0.66751665", "0.66751665", "0.6539174", "0.6418189", "0.64128286", "0.63664794", "0.63359445", "0.6287659", "0.6287659", "0.6213541", "0.61799604", "0.6143535", "0.6102703", "0.609781", "0.60841054", "0.60810554", "0.6012407", "0.60064363", "0.59669966", "0.5964001", "0.59038055", "0.5890104", "0.58878165", "0.5860986", "0.58515596", "0.58396673", "0.579888", "0.57953745", "0.5795243", "0.5778399", "0.57709616", "0.5768062", "0.5766292", "0.5766292", "0.57603544", "0.57533246", "0.57387197", "0.57336086", "0.5728741", "0.5724408", "0.57102346", "0.57093954", "0.5709168", "0.5697706", "0.56937605", "0.568735", "0.56774735", "0.56751126", "0.5673994", "0.56717855", "0.5671524", "0.5657194", "0.56519544", "0.5650674", "0.56504625", "0.5643412", "0.5640429", "0.5640429", "0.56389296", "0.56375355", "0.5637476", "0.5636608", "0.563428", "0.5625201", "0.5622427", "0.5617734", "0.56122917", "0.5610648", "0.56008065", "0.55925554", "0.55922925", "0.55652595", "0.5535111", "0.55243134", "0.55238235", "0.55145353", "0.55145353", "0.5507632", "0.55061466", "0.55006397", "0.5497075", "0.54957974", "0.54955417", "0.5492535", "0.5492535", "0.5491114", "0.54899967", "0.5488851", "0.5486301", "0.5486169", "0.5485125", "0.54806817", "0.5477889", "0.54734427", "0.54732746", "0.5472176", "0.54719216", "0.5468959" ]
0.0
-1
Construct a generic Request object. The URL is |test_url|. All other fields are defaults.
function new_test_request() { return new Request(test_url) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static request(method, url, config = {}) {\n return Request.make(method, url, config);\n }", "@exposedMethod\n\trequest(options, url=null, json=null) {\n\t\t/*\n\t\t*\tCreate, send, and return a new `Request`. See the `Request`\n\t\t*\tconstructor for the `options` specification.\n\t\t*/\n\t\tif (typeof options == 'string') {\n\t\t\toptions = {url: options};\n\t\t}\n\t\tif (url) {\n\t\t\toptions.method = options.url;\n\t\t\toptions.url = url;\n\t\t}\n\t\tif (json) {\n\t\t\toptions.json = json;\n\t\t}\n\t\treturn new Request(options);\n\t}", "function Request(input, init) {\n if (arguments.length < 1) throw TypeError('Not enough arguments');\n\n Body.call(this, null);\n\n // readonly attribute ByteString method;\n this.method = 'GET';\n\n // readonly attribute USVString url;\n this.url = '';\n\n // readonly attribute Headers headers;\n this.headers = new Headers();\n this.headers._guard = 'request';\n\n // readonly attribute DOMString referrer;\n this.referrer = null; // TODO: Implement.\n\n // readonly attribute RequestMode mode;\n this.mode = null; // TODO: Implement.\n\n // readonly attribute RequestCredentials credentials;\n this.credentials = 'omit';\n\n if (input instanceof Request) {\n if (input.bodyUsed) throw TypeError();\n input.bodyUsed = true;\n this.method = input.method;\n this.url = input.url;\n this.headers = new Headers(input.headers);\n this.headers._guard = input.headers._guard;\n this.credentials = input.credentials;\n this._stream = input._stream;\n } else {\n input = USVString(input);\n this.url = String(new URL(input, self.location));\n }\n\n init = Object(init);\n\n if ('method' in init) {\n var method = ByteString(init.method);\n if (isForbiddenMethod(method)) throw TypeError();\n this.method = normalizeMethod(method);\n }\n\n if ('headers' in init) {\n this.headers = new Headers();\n fill(this.headers, init.headers);\n }\n\n if ('body' in init)\n this._stream = init.body;\n\n if ('credentials' in init &&\n (['omit', 'same-origin', 'include'].indexOf(init.credentials) !== -1))\n this.credentials = init.credentials;\n }", "function MockRequest(method, url) {\n\n return {\n \n 'method': method,\n \n 'url': url\n };\n}", "function Request() {\n var req = this;\n this.url = location;\n }", "function requestObject(iUrl, iMethod, iAsync, iType)\r\n{\r\n\tthis.url = iUrl;\r\n\tthis.method = iMethod;\r\n\tthis.async = iAsync;\r\n\tthis.type = iType;\r\n}", "function dummyRequest() {\n var req = {\n url: 'http://example.com/foo/bar?key=value',\n httpVersion: '1.1',\n method: 'POST',\n connection: {\n remoteAddress: '127.0.0.0'\n },\n headers: {\n 'content-length': '22',\n host: 'localhost:80',\n accept: '*/*'\n }\n };\n\n return req;\n}", "constructor(input, init = {}) {\n // TODO support `input` being a Request\n this[urlSym] = input;\n\n if (!(init.headers instanceof Headers)) {\n this[rawHeadersSym] = init.headers;\n } else {\n this[headersSym] = init.headers;\n }\n this[methodSym] = init.method || 'GET';\n\n if (init.body instanceof ReadableStream || init.body instanceof FormData) {\n this[bodySym] = init.body;\n } else if (typeof init.body === 'string') {\n this[_bodyStringSym] = init.body;\n } else if (isBufferish(init.body)) {\n this[bodySym] = new StringReadable(init.body);\n }\n }", "function Request(method, urlPath, cache) {\n\tthis._method = method;\n\tthis._urlPath = urlPath;\n\tthis._cache = cache;\n\n\tthis._queryParams = [];\n\tthis._postParams = {};\n\tthis._headers = {};\n\tthis._timeout = null;\n\tthis._type = \"json\"; // superagent's default\n\n\t// public field\n\tthis.aborted = undefined; //default to undefined\n}", "constructor(request) {\n this.request = request;\n }", "function GenericRpcRequest(aUrl, aMethod) {\n this.method = aMethod;\n this.url = BaseUrl + aUrl;\n}", "function RemoteRequest(url) {\n _classCallCheck(this, RemoteRequest);\n\n this.cache = require('memory-cache');\n this.url = url;\n this.numNetworkRequests = 0;\n }", "constructor(url, method='POST'){\n this.url = url\n this.method = method \n }", "buildRequestAndParseAsModel(url, requestType, model) {\n return this.buildRequestAndParseAsT(url, requestType, model, this.parser);\n }", "function requestFactory(config){\n\n\tvar req = _.extend({}, config);\n\t\n\treturn req;\n}", "createRequestContext(url) {\n // Fake IncomingRequest\n const req = httpMocks.createRequest({\n method: 'GET',\n url,\n });\n\n // Fake ServerResponse\n const res = httpMocks.createResponse();\n res.__body = '';\n res.write = chunk => {\n res.__body += chunk;\n };\n res.end = data => {\n if (data) {\n res.__body = data;\n }\n };\n\n return {\n url,\n req,\n res,\n redirected: false,\n statusCode: 200,\n bodyAdd: '',\n headAdd: '',\n data: {},\n };\n }", "function initializeRequest(url, method, body, email, password) {\n\tvar options = {\n\t\t\"method\": method,\n\t\t\"uri\": url,\n\t\t\"body\": body,\n\t\t\"headers\": {}\n\t};\n\taddRequestHeaders(options, email, password);\n\treturn options;\n}", "constructor(options) {\n\t\t/*\n\t\t*\tCreate and send a new `Request`. Canonically this is done via the\n\t\t*\texposed `request` method on the global `canvas`/`cv` object.\n\t\t*\t`options` can be either a string containing a URL to send a `GET`\n\t\t*\trequest, or a map containing:\n\t\t*\t\t* `url` - The target URL (required)\n\t\t*\t\t* `method` - The request method (default `GET`)\n\t\t*\t\t* `query` - A map containing the query parameters (optional)\n\t\t*\t\t* `success` - A success callback (optional)\n\t\t*\t\t* `failure` - A failure callback (optional)\n\t\t*\t\t* `json` - A JSON-like object for the request body (optional)\n\t\t*\t\t* `file` - A file object to upload (optional)\n\t\t*\t\t* `headers` - A key, value header map (optional)\n\t\t*/\n\t\t//\tHandle trivial request definition.\n\t\tif (typeof options == 'string') options = {url: options, method: 'get'};\n\t\tthis.options = options;\n\t\t\n\t\t//\tStore callback lists.\n\t\tthis.successCallbacks = options.success ? [options.success] : [];\n\t\tthis.failureCallbacks = options.failure ? [options.failure] : [];\n\n\t\t//\tResolve full URL.\n\t\tlet fullURL = options.url;\n\t\tif (options.query) {\n\t\t\tqueryParts = [];\n\t\t\tfor (let key in options.query) {\n\t\t\t\tqueryParts.push(key + '=' + encodeURIComponent(options.query[key]));\n\t\t\t}\n\t\t\tfullURL = fullURL + '?' + queryParts.join('&');\n\t\t}\n\t\tlet method = options.method || 'get';\n\n\t\t//\tDefine the response holder.\n\t\tthis.response = null;\n\t\t//\tCreate and dispatch the request.\n\t\tthis.xhrObject = new XMLHttpRequest();\n\t\tthis.xhrObject.onreadystatechange = this.checkRequestState.bind(this);\n\t\tthis.xhrObject.open(method.toUpperCase(), fullURL, true);\n\t\tthis.xhrObject.setRequestHeader('X-cv-View', 1);\n\n\t\tthis.logRepr = method + ' ' + fullURL;\n\t\trequestLog.info('Sent ' + this.logRepr);\n\t\tthis.serializeBody(options, (mimetype, data) => {\n\t\t\tthis.xhrObject.setRequestHeader('Content-Type', mimetype);\n\t\t\tthis.xhrObject.send(data);\n\t\t});\n\t}", "function setupMakeTestParams(baseParams) {\n return function makeTestParams(name, url) {\n var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return {\n name: name,\n requestParams: url,\n params: (0, _xtend2.default)(baseParams, params)\n };\n };\n}", "constructor(url, options) {\n if (url === undefined) {\n throw new Error(\"'url' cannot be null\");\n }\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n if (!options.userAgent) {\n const defaultUserAgent = coreHttp__namespace.getDefaultUserAgentValue();\n options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;\n }\n super(undefined, options);\n this.requestContentType = \"application/json; charset=utf-8\";\n this.baseUri = options.endpoint || \"{url}\";\n // Parameter assignments\n this.url = url;\n // Assigning values to Constant parameters\n this.version = options.version || \"2021-08-06\";\n }", "function createRequest() {\n\t\tvar request;\n\t\tif (window.XMLHttpRequest || true) {\n\t\t\trequest = new XMLHttpRequest();\n\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Older Browser\");\n\t\t}\n\t\treturn request;\n\t}", "function createDefaultRequest() {\n // disable ontology\n return {\n solrTestClient: solrClientLib.createClient(SOLR_CLIENT_OPTIONS),\n logger: logger,\n app: {\n config: {\n ontologySuggest: {\n enabled: false,\n baseUrl: 'https://browser-aws-1.ihtsdotools.org',\n url: '/api/snomed',\n database: 'us-edition',\n version: 'v20150901'\n },\n solrClient: {\n core: SOLR_CORE,\n zooKeeperConnection: 'IP '\n },\n }\n },\n query: {\n pid: 'AAAA',\n query: 'pencollin'\n }\n };\n}", "constructor(url, options) {\n if (url === undefined) {\n throw new Error(\"'url' cannot be null\");\n }\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n if (!options.userAgent) {\n const defaultUserAgent = coreHttp__namespace.getDefaultUserAgentValue();\n options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;\n }\n super(undefined, options);\n this.requestContentType = \"application/json; charset=utf-8\";\n this.baseUri = options.endpoint || \"{url}\";\n // Parameter assignments\n this.url = url;\n // Assigning values to Constant parameters\n this.version = options.version || \"2023-01-03\";\n }", "static make(incomingOptions) {\n const test = new Test();\n const options = coolKids_1.ensureObject(incomingOptions);\n test.breadCrumbs = options.suite.breadCrumbs.slice();\n test.breadCrumbs.push(options.command);\n coolKids_1.whenNotString(options.command, `Test command must be of type string`);\n coolKids_1.whenStringVoidOfCharacters(options.command, `Test command can not be an empty string`);\n test.command = options.command;\n test.description = coolKids_1.stringOrNothing(options.description);\n test.handler = coolKids_1.functionOrNothing(options.run);\n test.timeout = coolKids_1.numberOrDefault(options.timeout, 5000);\n return test;\n }", "function RequestOptions(opts) {\n if (opts === void 0) { opts = {}; }\n var method = opts.method, headers = opts.headers, body = opts.body, url = opts.url, search = opts.search, params = opts.params, withCredentials = opts.withCredentials, responseType = opts.responseType;\n this.method = method != null ? normalizeMethodName(method) : null;\n this.headers = headers != null ? headers : null;\n this.body = body != null ? body : null;\n this.url = url != null ? url : null;\n this.params = this._mergeSearchParams(params || search);\n this.withCredentials = withCredentials != null ? withCredentials : null;\n this.responseType = responseType != null ? responseType : null;\n }", "function RequestOptions(opts) {\n if (opts === void 0) { opts = {}; }\n var method = opts.method, headers = opts.headers, body = opts.body, url = opts.url, search = opts.search, params = opts.params, withCredentials = opts.withCredentials, responseType = opts.responseType;\n this.method = method != null ? normalizeMethodName(method) : null;\n this.headers = headers != null ? headers : null;\n this.body = body != null ? body : null;\n this.url = url != null ? url : null;\n this.params = this._mergeSearchParams(params || search);\n this.withCredentials = withCredentials != null ? withCredentials : null;\n this.responseType = responseType != null ? responseType : null;\n }", "function RequestOptions(opts) {\n if (opts === void 0) { opts = {}; }\n var method = opts.method, headers = opts.headers, body = opts.body, url = opts.url, search = opts.search, params = opts.params, withCredentials = opts.withCredentials, responseType = opts.responseType;\n this.method = method != null ? normalizeMethodName(method) : null;\n this.headers = headers != null ? headers : null;\n this.body = body != null ? body : null;\n this.url = url != null ? url : null;\n this.params = this._mergeSearchParams(params || search);\n this.withCredentials = withCredentials != null ? withCredentials : null;\n this.responseType = responseType != null ? responseType : null;\n }", "function HttpRequestArgs() {\n var _this = this;\n var __arguments = new Array(arguments.length);\n for (var __argumentIndex = 0; __argumentIndex < __arguments.length; ++__argumentIndex) {\n __arguments[__argumentIndex] = arguments[__argumentIndex];\n }\n if (__arguments.length == 0) {\n _this = _super.call(this) || this;\n _this.fmliveswitchHttpRequestArgsInit();\n _this.setTimeout(15000);\n _this.setMethod(fm.liveswitch.HttpMethod.Post);\n _this.__headers = new fm.liveswitch.NameValueCollection();\n }\n else {\n throw new fm.liveswitch.Exception('Constructor overload does not exist with specified parameter count/type combination.');\n }\n return _this;\n }", "function makeRequest(method, targeUrl, successFunc, errorFunc) {\n return req = {\n method,\n url: targeUrl,\n beforeSend: function (xhr) {\n xhr.setRequestHeader(getCSRFTheader(), getCSRFToken());\n },\n success: function (data) {\n successFunc(data);\n },\n error: function (data) {\n errorFunc(data);\n }\n };\n }", "function createRequestObject() {\n\ttry {\n\t\treturn new XMLHttpRequest();\n\t} catch (e) {}\n\ttry {\n\t\treturn window.createRequest();\n\t} catch (e) {}\n\ttry {\n\t\treturn new ActiveXObject(\"Msxml2.XMLHTTP\");\n\t} catch (e) {}\n\ttry {\n\t\treturn new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t} catch (e) {}\n\n\treturn null;\n}", "function request(input, options, callback) {\n // Parse parameters\n if (typeof input === \"string\") {\n var urlStr = input;\n try {\n input = urlToOptions(new URL(urlStr));\n }\n catch (err) {\n /* istanbul ignore next */\n input = url.parse(urlStr);\n }\n }\n else if (URL && (input instanceof URL)) {\n input = urlToOptions(input);\n }\n else {\n callback = options;\n options = input;\n input = { protocol: protocol };\n }\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n // Set defaults\n options = Object.assign({\n maxRedirects: exports.maxRedirects,\n maxBodyLength: exports.maxBodyLength,\n }, input, options);\n options.nativeProtocols = nativeProtocols;\n\n assert.equal(options.protocol, protocol, \"protocol mismatch\");\n debug_1$1(\"options\", options);\n return new RedirectableRequest(options, callback);\n }", "constructor(url){\n super();\n this.auth = '?token=' + this.tests.token;\n this.route = '/example';\n }", "function request(input, options, callback) {\n // Parse parameters\n if (typeof input === \"string\") {\n var urlStr = input;\n try {\n input = urlToOptions(new URL(urlStr));\n }\n catch (err) {\n /* istanbul ignore next */\n input = url.parse(urlStr);\n }\n }\n else if (URL && (input instanceof URL)) {\n input = urlToOptions(input);\n }\n else {\n callback = options;\n options = input;\n input = { protocol: protocol };\n }\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n // Set defaults\n options = Object.assign({\n maxRedirects: exports.maxRedirects,\n maxBodyLength: exports.maxBodyLength,\n }, input, options);\n options.nativeProtocols = nativeProtocols;\n\n assert.equal(options.protocol, protocol, \"protocol mismatch\");\n debug_1(\"options\", options);\n return new RedirectableRequest(options, callback);\n }", "function setDefaultRequestOptions (options) {\n var base = request.Request.request.defaults(options);\n request.Request.request = base;\n return request;\n}", "function request(input, options, callback) {\n // Parse parameters\n if (isString(input)) {\n var parsed;\n try {\n parsed = urlToOptions(new URL(input));\n }\n catch (err) {\n /* istanbul ignore next */\n parsed = url.parse(input);\n }\n if (!isString(parsed.protocol)) {\n throw new InvalidUrlError({ input });\n }\n input = parsed;\n }\n else if (URL && (input instanceof URL)) {\n input = urlToOptions(input);\n }\n else {\n callback = options;\n options = input;\n input = { protocol: protocol };\n }\n if (isFunction(options)) {\n callback = options;\n options = null;\n }\n\n // Set defaults\n options = Object.assign({\n maxRedirects: exports.maxRedirects,\n maxBodyLength: exports.maxBodyLength,\n }, input, options);\n options.nativeProtocols = nativeProtocols;\n if (!isString(options.host) && !isString(options.hostname)) {\n options.hostname = \"::1\";\n }\n\n assert.equal(options.protocol, protocol, \"protocol mismatch\");\n debug(\"options\", options);\n return new RedirectableRequest(options, callback);\n }", "static async build(url) {\n let resp = await fetch(url + \"/v1/parameters\");\n let params = await resp.text();\n let client = new Client(url, params, module);\n return client;\n }", "function HttpRequestBuilder(host, port, ip, fingerprint) {\n this.host = host;\n this.port = port;\n this.ip = ip;\n this.fingerprint = fingerprint;\n}", "function request(input, options, callback) {\n // Parse parameters\n if (typeof input === \"string\") {\n var urlStr = input;\n try {\n input = urlToOptions(new URL(urlStr));\n }\n catch (err) {\n /* istanbul ignore next */\n input = url.parse(urlStr);\n }\n }\n else if (URL && (input instanceof URL)) {\n input = urlToOptions(input);\n }\n else {\n callback = options;\n options = input;\n input = { protocol: protocol };\n }\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n // Set defaults\n options = Object.assign({\n maxRedirects: exports.maxRedirects,\n maxBodyLength: exports.maxBodyLength,\n }, input, options);\n options.nativeProtocols = nativeProtocols;\n\n assert.equal(options.protocol, protocol, \"protocol mismatch\");\n debug(\"options\", options);\n return new RedirectableRequest(options, callback);\n }", "function request(input, options, callback) {\n // Parse parameters\n if (typeof input === \"string\") {\n var urlStr = input;\n try {\n input = urlToOptions(new URL(urlStr));\n }\n catch (err) {\n /* istanbul ignore next */\n input = url.parse(urlStr);\n }\n }\n else if (URL && (input instanceof URL)) {\n input = urlToOptions(input);\n }\n else {\n callback = options;\n options = input;\n input = { protocol: protocol };\n }\n if (typeof options === \"function\") {\n callback = options;\n options = null;\n }\n\n // Set defaults\n options = Object.assign({\n maxRedirects: exports.maxRedirects,\n maxBodyLength: exports.maxBodyLength,\n }, input, options);\n options.nativeProtocols = nativeProtocols;\n\n assert.equal(options.protocol, protocol, \"protocol mismatch\");\n debug(\"options\", options);\n return new RedirectableRequest(options, callback);\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "function makeRequestObject() {\r\n\t\t\t/*This function forks for IE and returns the XMLHttpRequest object.*/\r\n\t\t\tif (window.XMLHttpRequest) {\r\n\t\t\t\treturn new XMLHttpRequest();\r\n\t\t\t} else if (window.ActiveXObject) {\r\n\t\t\t\treturn new ActiveXObject(\"Microsoft.XMLHTTP\");\r\n\t\t\t}\r\n\t\t}", "function createGetRequest( url, query, reqMode )\n{\n // Prevent Browser caching page\n var pageRequested = new Date().getTime()\n\n // reqMode = Request Mode (true = Asynchronous, false = Synchronous)\n req.open( \"GET\", url + \"?\" + query + \"&pageRequested=\" + pageRequested, reqMode )\n req.send( null )\n}", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n } else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n } else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n } else {\n params = new HttpParams({\n fromObject: options.params\n });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, options.body !== undefined ? options.body : null, {\n headers,\n context: options.context,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = (0,rxjs__WEBPACK_IMPORTED_MODULE_0__.of)(req).pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_1__.concatMap)(req => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_2__.filter)(event => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "get url () {\n\t if (!(this instanceof Request)) {\n\t throw new TypeError('Illegal invocation')\n\t }\n\n\t // The url getter steps are to return this’s request’s URL, serialized.\n\t return URLSerializer(this[kState].url)\n\t }", "function PromiseRequest() {\n superagent.Request.apply(this, arguments);\n }", "$request(url, fetchConfig, overrideDefaultConfig = false) {\r\n if (!url.match(/^(\\w+:)?\\/\\//)) {\r\n url = this.$baseURL ? new URL(url, this.$baseURL).href : url;\r\n }\r\n return this.$requestFactory(url, overrideDefaultConfig ?\r\n fetchConfig : Object.assign({}, this.$baseClientConfig, fetchConfig, { headers: Object.assign({}, (this.$baseClientConfig.headers || {}), (fetchConfig.headers || {})) }), this.$fetchHandler);\r\n }", "function AjaxUtil_requester() {\n /**\n * @type {String?} url the url of post target\n */\n this.url = null;\n /**\n * @type {String?} type the content-type of http request header\n */\n this.type = null;\n /**\n * @type {Object?} content the content to post\n */\n this.content = null;\n /**\n * @type {Number?}\n */\n this.timeout = null;\n /**\n * @type {Boolean?}\n */\n this.wait = null;\n}", "function createRequest() {\n\t\ttry {\n\t\t\trequest = new XMLHttpRequest();\n\t\t\t} \n\t\tcatch (tryMS) {\n\t\t\ttry {\n\t\t\t\trequest = new ActiveXObject(\"Msxml2.XMLHTTP\");\n\t\t\t\t} \n\t\t\t\tcatch (otherMS) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\trequest = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t\t\t\t\t} \n\t\t\t\t\tcatch (failed) {\n\t\t\t\trequest = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t\treturn request;\n}", "function createRequest(){\n\tvar request;\n\t// IE\n\ttry{\n\t\trequest = new ActiveXObject(\"Msxml2.XMLHTTP\");\n\t}\n\tcatch(e){\n\t\ttry{\n\t\t\trequest = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t} \n\t\tcatch(oc){\n\t\t\trequest = null;\n\t\t}\n\t}\n\t\n\t// Mozilla\n\tif(!request && typeof XMLHttpRequest != \"undefined\"){\n\t\trequest = new XMLHttpRequest();\n\t}\n\t\n\treturn request;\n}", "function _createOptions(method, url) {\n return requestOptions = {\n hostname: url.hostname,\n path: url.path,\n port: url.port,\n method\n };\n}", "function request() {\n var ajax = new _ajaxRequest.default();\n return ajax.request.apply(ajax, arguments);\n }", "function buildSuperagentRequest() {\n\tvar req = superagent(this._method, this._buildUrl());\n\n\tif (this._agent){\n\t\treq.agent(this._agent);\n\t}\n\n\t// superagent has some weird, implicit file upload support\n\t// that only works if you don't set `type`.\n\tif (this._type && this._type !== 'form-data') {\n\t\treq.type(this._type);\n\t}\n\n\treq.set(this._headers);\n\tthis._queryParams.forEach(params => req.query(params));\n\n\tvar postParams = this._postParams;\n\n\t// convert params to FormData if the request type is form-data\n\tif (this._type === \"form-data\") {\n\t\tif (!SERVER_SIDE) {\n\t\t\tvar formData = new FormData();\n\t\t\tif (postParams) {\n\t\t\t\tvar paramKeys = Object.keys(postParams);\n\t\t\t\tparamKeys.forEach(key => {\n\t\t\t\t\tformData.append(key, postParams[key]);\n\t\t\t\t});\n\t\t\t}\n\t\t\tpostParams = formData;\n\t\t} else {\n\t\t\tthrow new Error(`TritonAgent.type(\"form-data\") not allowed server-side`);\n\t\t}\n\t}\n\n\treq.send(postParams);\n\n\tif (this._timeout) {\n\t\treq.timeout(this._timeout);\n\t}\n\n\t// cache the internal request, so that we can cancel it\n\t// if necessary (see: `abort()`)\n\tthis._superagentReq = req;\n\n\treturn req;\n}", "constructor (options = {}) {\n this.url = options.url\n this.token = options.token\n }", "function Url() {\n\t this.protocol = null;\n\t this.slashes = null;\n\t this.auth = null;\n\t this.host = null;\n\t this.port = null;\n\t this.hostname = null;\n\t this.hash = null;\n\t this.search = null;\n\t this.query = null;\n\t this.pathname = null;\n\t this.path = null;\n\t this.href = null;\n\t}", "function Url() {\n\t this.protocol = null;\n\t this.slashes = null;\n\t this.auth = null;\n\t this.host = null;\n\t this.port = null;\n\t this.hostname = null;\n\t this.hash = null;\n\t this.search = null;\n\t this.query = null;\n\t this.pathname = null;\n\t this.path = null;\n\t this.href = null;\n\t}", "function Url() {\n\t this.protocol = null;\n\t this.slashes = null;\n\t this.auth = null;\n\t this.host = null;\n\t this.port = null;\n\t this.hostname = null;\n\t this.hash = null;\n\t this.search = null;\n\t this.query = null;\n\t this.pathname = null;\n\t this.path = null;\n\t this.href = null;\n\t}", "function req(data) {\n return new _Request2.default({\n data: data,\n headers: store.getState().core.auth.requestHeaders\n });\n}", "function urlBuilder(request) {\n const searchTarget = request.query.data;\n const searchType = request.query.url;\n let url = '';\n switch (searchType) {\n case 'movies':\n url = `https://api.themoviedb.org/3/search/movie?api_key=${MOVIE_API_KEY}&query=${searchTarget}`;\n break;\n case 'search':\n url = `https://api.themoviedb.org/3/movie/${searchTarget}?api_key=${MOVIE_API_KEY}&language=en-US`;\n break;\n default:\n url = `https://api.themoviedb.org/3/search/movie?api_key=${MOVIE_API_KEY}&query=${searchTarget}`;\n }\n return url;\n}", "function HttpRequest(method, uri, resource, resPath, headers, body) { /*This is an Object representation of a HttpRequest*/\n\t/*It is simply a container with all the fields being public members*/\n\tthis.method = method;\n\tthis.uri = uri;\n\tthis.resource = resource;\n\tthis.resPath = resPath;\n\tthis.headers = headers;\n\tthis.body = body;\n}", "constructor(url, params, module) {\n this.url = url;\n this.params = params;\n this.module = module;\n }", "function initializeDefaultRequestURLObject() {\n const baseUrl = 'http://api.worldbank.org';\n\n let output = {\n base: baseUrl,\n request: ['countries'],\n options: {\n page: 1,\n format: 'jsonP',\n prefix: 'getdata'\n }\n };\n\n return output;\n}", "function MockHttpRequest () {\n\t// These are internal flags and data structures\n\tthis.error = false;\n\tthis.sent = false;\n\tthis.requestHeaders = {};\n\tthis.responseHeaders = {};\n}", "function WebEntityRequest(webRequest, id, destination) {\n\tif(!webRequest) throw 'Missing required attribute webRequest\\nat: ' + new Error().stack;\n\tif(!id) throw 'Missing required attribute id\\nat: ' + new Error().stack;\n\tif(!destination) throw 'Missing required attribute destination\\nat: ' + new Error().stack;\n\t\n\tPerformance.trace('Initializing ' + this, 'WebEntityRequest ' + id);\n\t\n\tRequest.call(this, webRequest, destination);\n\t\n\tObject.defineProperties(this, {\n\t\t'id': {\n\t\t\tvalue: id\n\t\t}\n\t});\n\t\n\tif(!this.isMultipartRequest()) {\n\t\tvar webRequestBodyParts = $.util.stringify(webRequest.body.asArrayBuffer()).split('\\r\\n\\r\\n');\n\t\tvar parseRegex = /^([A-Z]+)\\s+([^?]+)\\??(\\S+)?\\s+HTTP\\/1\\.1\\s*(((?!\\n\\n)(?!\\r\\r)(?!\\r\\n\\r\\n)[\\s\\S])*)$/;\n\t\t//\t\t\t\t ^method ^path\t ^query\t\t\t\t ^headers\n\t\tvar pieces = webRequestBodyParts[0].match(parseRegex);\n\t\tvar headerLines = pieces[4].split(/\\r\\n?|\\n/).filter(function(pair) { return pair.length; });\n\t\tvar headers = new MultiMap();\n\t\theaderLines.forEach(function(line) {\n\t\t\tvar keyAndValue = line.split(': '),\n\t\t\t\tkey = keyAndValue[0],\n\t\t\t\tvalue = keyAndValue[1];\n\t\t\theaders.set(key, value);\n\t\t});\n\t\theaders.add('Accept', 'application/json;charset=UTF-8;q=0.9,*/*;q=0.8');\n\t\t\n\t\tvar parameterPairs = (pieces[3] || '').split(/&/).filter(function(pair) { return pair.length; });\n\t\tvar parameters = new MultiMap();\n\t\t\n\t\tparameterPairs.forEach(function(pair) {\n\t\t\tvar split = pair.split(/=/);\n\t\t\tparameters.set(split[0], split[1]);\n\t\t});\n\t\t\n\t\tvar parsedBody = {\n\t\t\tmethod: pieces[1],\n\t\t\tpath: pieces[2],\n\t\t\theaders: headers,\n\t\t\tbody: webRequestBodyParts[1] || '',\n\t\t\tparameters: parameters\n\t\t};\n\t\t\n\t\tthis.parsedBody = parsedBody;\n\t\t\n\t\tObject.defineProperties(this, {\n\t\t\t'originalParameters': {\n\t\t\t\tvalue: Object.freeze(this.copyParameters())\n\t\t\t},\n\t\t\t'parameters': {\n\t\t\t\tvalue: this.copyParameters()\n\t\t\t},\n\t\t\t'headers': {\n\t\t\t\tvalue: Object.freeze(this.copyHeaders())\n\t\t\t},\n\t\t\t'methodMap': {\n\t\t\t\tvalue: {\n\t\t\t\t 'OPTIONS': 0,\n\t\t\t\t\t'GET': 1,\n\t\t\t\t\t'HEAD': 2,\n\t\t\t\t\t'POST': 3,\n\t\t\t\t\t'PUT': 4,\n\t\t\t\t\t'DELETE': 5,\n\t\t\t\t\t'TRACE': 6,\n\t\t\t\t\t'CONNECT': 7\n\t\t\t\t}\n\t\t\t},\n\t\t\t'id': {\n\t\t\t\tvalue: id\n\t\t\t}\n\t\t});\n\t\t\n\t\tvar json = this.headers.get('content-type') === 'application/json' ||\n\t\tthis.headers.get('content-type') === 'text/json';\n\t\tvar rawBody = parsedBody.body;\n\t\tvar body = json && rawBody ? JSON.parse(rawBody) : rawBody;\n\t\t\n\t\tObject.defineProperties(this, {\n\t\t\t'json': {\n\t\t\t\tvalue: json && typeof body === 'object'\n\t\t\t},\n\t\t\t'body': { // TODO refactor - remove\n\t\t\t\tvalue: body\n\t\t\t},\n\t\t\t'data': { // Replacement for body in alignment with Response.data\n\t\t\t\tvalue: body\n\t\t\t}\n\t\t\t\n\t\t});\n\t} else {\n\t\tObject.defineProperties(this, {\n\t\t\t'boundary': {\n\t\t\t\tvalue: this.webRequest.headers.get('content-type').match(/boundary=([^;]*)/)[1]\n\t\t\t}\n\t\t});\n\t}\n\t\n\tPerformance.finishStep('WebEntityRequest ' + id);\n}", "function PromiseRequest() {\n\t superagent.Request.apply(this, arguments);\n\t }", "constructor(url) {\n this.url = url;\n }", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n }", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}", "function createRequestObject(){\n\tvar request_o; //declare the variable to hold the object.\n\tvar browser = navigator.appName; //find the browser name\n\tif(browser == \"Microsoft Internet Explorer\"){\n\t\t/* Create the object using MSIE's method */\n\t\trequest_o = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t}else{\n\t\t/* Create the object using other browser's method */\n\t\trequest_o = new XMLHttpRequest();\n\t}\n\treturn request_o; //return the object\n}", "function createRequest() {\n var httpRequest;\n\n if (window.XMLHttpRequest) {\n httpRequest = new XMLHttpRequest;\n } else if (window.ActiveXObject) {\n try {\n httpRequest = new ActiveXObject(\"Asxml12.XMLHTTP\");\n } catch (e) {\n try {\n httpRequest = new ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch(e) {\n httpRequest = null;\n }\n }\n }\n\n return httpRequest;\n}", "constructor(context) {\n this.context = context;\n this._json = this.baseRequest();\n }", "init() {\n\t\tthis.options = urlLib.parse(this.params.url);\n\t\tthis.options.headers = {};\n\t\tif (this.params.headers) {\n\t\t\tthis.options.headers = this.params.headers;\n\t\t}\n\t\tif (this.params.cert && this.params.key) {\n\t\t\tthis.options.cert = this.params.cert;\n\t\t\tthis.options.key = this.params.key;\n\t\t}\n\t\tthis.options.agent = false;\n\t\tif (this.params.body) {\n\t\t\tif (typeof this.params.body == 'string') {\n\t\t\t\tthis.generateMessage = () => this.params.body;\n\t\t\t} else if (typeof this.params.body == 'object') {\n\t\t\t\tthis.generateMessage = () => this.params.body;\n\t\t\t} else if (typeof this.params.body == 'function') {\n\t\t\t\tthis.generateMessage = this.params.body;\n\t\t\t} else {\n\t\t\t\tconsole.error('Unrecognized body: %s', typeof this.params.body);\n\t\t\t}\n\t\t\tthis.options.headers['Content-Type'] = this.params.contentType || 'text/plain';\n\t\t}\n\t\taddUserAgent(this.options.headers);\n\t\tif (this.params.secureProtocol) {\n\t\t\tthis.options.secureProtocol = this.params.secureProtocol;\n\t\t}\n\t}", "request() {\n var self = this;\n var elements = Editable.getAllEditableElement();\n this.Serialize = new Serialize(elements);\n\n var method = self.config.method;\n this.xhr = new XMLHttpRequest();\n\n // open request\n if (method == 'GET') {\n this.xhr.open(method, self.config.url + '?' + this.Serialize.GET(), true);\n this.addHeader([\"Content-Type\", \"application/x-www-form-urlencoded\"]);\n } else if (method == 'POST') {\n this.xhr.open(method, self.config.url, true);\n this.addHeader([\"Content-Type\", \"multipart/form-data\"]);\n }\n\n // headers\n this.header();\n\n // additional params\n this.param();\n\n // send\n if (method == 'GET') {\n this.xhr.send();\n } else if (method == 'POST') {\n this.xhr.send(this.Serialize.POST());\n }\n\n return this;\n }", "static __createUrl(url, base) {\n return new URL(url, base);\n }", "function request() {\n const ajax = new _ajaxRequest.default();\n return ajax.request(...arguments);\n }", "makeRequest(url, options = {}) {\n\t\toptions = deepAssign({\n\t\t\theaders: {\n\t\t\t\t'user-agent': `onionoo-node-client v${pkg.version} (${pkg.homepage})`\n\t\t\t}\n\t\t}, options);\n\n\t\treturn got(url, options)\n\t\t\t.catch(err => {\n\t\t\t\t// Don't throw 304 responses\n\t\t\t\tif (err.statusCode === 304) {\n\t\t\t\t\treturn err.response;\n\t\t\t\t}\n\t\t\t\tthrow err;\n\t\t\t})\n\t\t\t.then(response => {\n\t\t\t\t// Format response\n\t\t\t\tresponse = {\n\t\t\t\t\tstatusCode: response.statusCode,\n\t\t\t\t\tstatusMessage: response.statusMessage,\n\t\t\t\t\theaders: response.headers,\n\t\t\t\t\tbody: response.body && JSON.parse(response.body)\n\t\t\t\t};\n\n\t\t\t\treturn response;\n\t\t\t});\n\t}", "constructor() {\n //https://javascript.info/xmlhttprequest\n\n // var defs\n this.args = {\n url: false,\n method: false,\n data: false,\n dataType: false, // aka requestType this is either form or json xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');\n responseType: false, // for clientside processing response data type\n timeout: 0,\n onComplete: false,\n onError: false, // only triggers if the request couldn't be made at all\n onProgress: false,\n onCancel: false,\n username: false,\n password: false\n };\n\n this.url = false;\n this.urlParams = \"\";\n this.xhr = false;\n\n // Process arguments\n if (arguments[0] && typeof (arguments[0]) === \"object\") {\n for (let key in arguments[0]) {\n if (this.args.hasOwnProperty(key)) {\n this.args[key] = arguments[0][key];\n }\n }\n }\n // console.log(this.args);\n\n // Validate\n let valid = true;\n\n if (this.args.url === false) {\n let msg = `XHR(): Usage error: Option \"url\" has not been set!\nPlease enter a valid url to make a request to!`;\n console.error(msg);\n valid = false;\n return false;\n }\n\n if (this.args.method === false) {\n let msg = `XHR(): Usage error: Option \"method\" has not been set!\nValid options are:\n POST,\n GET`;\n console.error(msg);\n valid = false;\n return false;\n }\n\n\n\n\n // log(this.args);\n let showDataTypeError = false;\n if (this.args.data !== false){\n if (this.args.dataType === false){\n showDataTypeError = true;\n } else {\n if (typeof(this.args.dataType) == \"string\"){\n if (\n this.args.dataType.toLowerCase() !== \"json\" &&\n this.args.dataType.toLowerCase() !== \"form\" &&\n this.args.dataType.toLowerCase() !== \"text\"){\n showDataTypeError = true;\n }\n }\n }\n }\n\n\n if (showDataTypeError) {\n let msg = `XHR(): Usage error: Invalid \"dataType\" has been set!\nValid options are:\n JSON - send json string\n FORM - send form object\n TEXT - send url string\n`;\n console.error(msg);\n valid = false;\n return false;\n }\n\n\n\n\n\n let showResponseTypeError = false;\n if (this.args.responseType === false){\n showResponseTypeError = true;\n } else {\n if (typeof(this.args.dataType) == \"string\"){\n if (\n this.args.responseType.toLowerCase() != \"text\" &&\n this.args.responseType.toLowerCase() != \"document\" &&\n this.args.responseType.toLowerCase() != \"json\" &&\n this.args.responseType.toLowerCase() != \"arraybuffer\" &&\n this.args.responseType.toLowerCase() != \"blob\"){\n showResponseTypeError = true;\n }\n }\n }\n\n\n\n if (showResponseTypeError) {\n let msg =\n `XHR(): Usage warning: Option \"responseType\" not set!\nValid options are:\n json \\t\\t\\t JSON (parsed automatically)\n document \\t\\t XML Document (XPath etc),\n text \\t\\t\\t string,\n arraybuffer \\t ArrayBuffer for binary data,\n blob \\t\\t\\t Blob for binary data,\n`;\n console.error(msg);\n valid = false;\n return false;\n }\n\n\n\n\n\n\n if (this.args.onComplete === false) {\n let msg = `XHR(): Usage error: Option \"onComplete\" has not been set!\nYour making a request but are not doing anything with the response? Make sure to supply an onComplete callback function.`;\n console.error(msg);\n valid = false;\n return false;\n }\n\n\n\n if (valid) {\n this.makeRequest();\n }\n }", "function dataobjToRequestAdapter(obj) {\n let url = '';\n let method = '';\n let headers = {};\n if ('url' in obj && utils.isString(obj.url)) {\n url = obj.url;\n }\n if ('method' in obj && utils.isString(obj.method)) {\n method = obj.method;\n }\n if ('headers' in obj && utils.isObject(obj.headers)) {\n headers = obj.headers;\n }\n return new Request(url, method, headers);\n}", "function agnosticRequest(opt) {\n if (opt.protocol === 'https:') {\n opt.agent = opt.conn || SECURE_AGENT\n return https.request(opt)\n }\n opt.agent = opt.conn || BASIC_AGENT\n return http.request(opt)\n}", "createRequest () {\n try {\n return new XMLHttpRequest ();\n } catch (trymicrosoft) {\n return false;\n }\n }", "function initRequest(url) {\n \n //window.alert(\"initRequest(\" + url + \") is called\");\n //console.log(\"initRequest(%s) is called\", url);\n \n if (window.XMLHttpRequest) {\n req = new XMLHttpRequest(); \n } else if (window.ActiveXObject) {\n isIE = true;\n req = new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n }", "create() {\n const opts = pick$1(\n this.opts,\n \"agent\",\n \"enablesXDR\",\n \"pfx\",\n \"key\",\n \"passphrase\",\n \"cert\",\n \"ca\",\n \"ciphers\",\n \"rejectUnauthorized\"\n );\n opts.xdomain = !!this.opts.xd;\n opts.xscheme = !!this.opts.xs;\n\n const xhr = (this.xhr = new xmlhttprequest(opts));\n const self = this;\n\n try {\n debug$1(\"xhr open %s: %s\", this.method, this.uri);\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.opts.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (let i in this.opts.extraHeaders) {\n if (this.opts.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.opts.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if (\"POST\" === this.method) {\n try {\n xhr.setRequestHeader(\"Content-type\", \"text/plain;charset=UTF-8\");\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader(\"Accept\", \"*/*\");\n } catch (e) {}\n\n // ie6 check\n if (\"withCredentials\" in xhr) {\n xhr.withCredentials = this.opts.withCredentials;\n }\n\n if (this.opts.requestTimeout) {\n xhr.timeout = this.opts.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function() {\n self.onLoad();\n };\n xhr.onerror = function() {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function() {\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function() {\n self.onError(typeof xhr.status === \"number\" ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n debug$1(\"xhr data %s\", this.data);\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly from the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function() {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== \"undefined\") {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n }", "function Request() {\n return {\n result: undefined,\n onsuccess: null,\n onerror: null,\n readyState: IDBRequest.LOADING\n // TODO compvare request interface\n };\n}", "function getRequestObject() {\n \n httpRequest = new XMLHttpRequest();\n return httpRequest;\n}", "static __createUrl(url, base) {\n return new URL(url, base);\n }", "static __createUrl(url, base) {\n return new URL(url, base);\n }", "function requestOptions (requestOptions, options) {\n return {\n url: requestOptions.url,\n method: requestOptions.method,\n body: Object.assign({}, requestOptions.body, options.body),\n query: Object.assign({}, requestOptions.query, options.query),\n headers: Object.assign({}, requestOptions.headers, options.headers)\n }\n}" ]
[ "0.6638846", "0.64101845", "0.6334804", "0.63018996", "0.62438667", "0.6103885", "0.58861715", "0.57570624", "0.5753225", "0.5723475", "0.5692982", "0.56849635", "0.5586672", "0.5580204", "0.55631196", "0.55519205", "0.55082494", "0.5448006", "0.5383356", "0.5369603", "0.53650504", "0.5363515", "0.53354853", "0.53327173", "0.5328767", "0.5328767", "0.5328767", "0.53024256", "0.52860194", "0.5285642", "0.5241809", "0.52417207", "0.5227731", "0.5225371", "0.5206344", "0.5196808", "0.5194843", "0.51876694", "0.51876694", "0.5130564", "0.5130564", "0.5130564", "0.5130564", "0.5130564", "0.5128386", "0.5098094", "0.50934446", "0.50920534", "0.50828916", "0.5075962", "0.5073763", "0.5067819", "0.50562495", "0.5041126", "0.5031011", "0.50145864", "0.50105286", "0.5001314", "0.5001314", "0.5001314", "0.50011045", "0.49871254", "0.49758452", "0.49754664", "0.497175", "0.49696127", "0.49642736", "0.49563202", "0.49560577", "0.49528545", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49380073", "0.49362612", "0.4925591", "0.49164206", "0.49136165", "0.490667", "0.4904847", "0.48933497", "0.4887249", "0.4887117", "0.48848414", "0.48828262", "0.48719764", "0.4869217", "0.4868112", "0.4866286", "0.48630044", "0.48550436", "0.48550436", "0.48549962" ]
0.78611463
0
Construct a generic Response object.
function new_test_response() { return new Response('Hello world!', { status: 200 }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create() {\n return new Response();\n}", "function ResponseBase() {}", "function createResponseObject(status, message, data)\n{\n var object = { status: status, message: message, data: data };\n return object;\n}", "function Response(body, headers, status) {\n if (!(this instanceof Response)) {\n return new Response(body, headers, status);\n }\n\n this.body = body || \"\";\n this.headers = headers || {};\n this.status = status || 200;\n}", "function WrappedResponse(msg, hdr, err, res) {\n this._msg = msg;\n this.headers = hdr;\n this.error = err;\n this.response = res;\n}", "static buildResponse(responses, responseData) {\n // Take the first object from responses array\n const firstResponse = _.isArray(responses) ? responses[0] || {} : {};\n\n const formattedResponse = {\n success: true,\n code: firstResponse.code,\n reason: firstResponse.message,\n data: responseData || {},\n };\n\n return new nomadoResponse(formattedResponse);\n }", "function Response(data, status, message, headers) {\n this.data = data;\n this.status = status;\n this.message = message;\n this.headers = headers;\n }", "function Response(body, init) {\n if (arguments.length < 1)\n body = '';\n\n this.headers = new Headers();\n this.headers._guard = 'response';\n\n // Internal\n if (body instanceof XMLHttpRequest && '_url' in body) {\n var xhr = body;\n this.type = 'basic'; // TODO: ResponseType\n this.url = USVString(xhr._url);\n this.status = xhr.status;\n this.ok = 200 <= this.status && this.status <= 299;\n this.statusText = xhr.statusText;\n xhr.getAllResponseHeaders()\n .split(/\\r?\\n/)\n .filter(function(header) { return header.length; })\n .forEach(function(header) {\n var i = header.indexOf(':');\n this.headers.append(header.substring(0, i), header.substring(i + 2));\n }, this);\n Body.call(this, xhr.responseText);\n return;\n }\n\n Body.call(this, body);\n\n init = Object(init) || {};\n\n // readonly attribute USVString url;\n this.url = '';\n\n // readonly attribute unsigned short status;\n var status = 'status' in init ? ushort(init.status) : 200;\n if (status < 200 || status > 599) throw RangeError();\n this.status = status;\n\n // readonly attribute boolean ok;\n this.ok = 200 <= this.status && this.status <= 299;\n\n // readonly attribute ByteString statusText;\n var statusText = 'statusText' in init ? String(init.statusText) : 'OK';\n if (/[^\\x00-\\xFF]/.test(statusText)) throw TypeError();\n this.statusText = statusText;\n\n // readonly attribute Headers headers;\n if ('headers' in init) fill(this.headers, init);\n\n // TODO: Implement these\n // readonly attribute ResponseType type;\n this.type = 'basic'; // TODO: ResponseType\n }", "function Response(options) {\n options = options || {};\n\n Message.call(this, options.content, options.headers);\n\n this.status = options.status || 200;\n}", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) { defaultStatus = 200; }\n if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function createResponse ({ res, error }) {\n const response = {\n status: error ? error.status : res.status,\n data: res ? res.data : null\n }\n if (error) {\n response.error = error\n }\n return response\n}", "function HttpResponseBase(init, defaultStatus, defaultStatusText) {\n if (defaultStatus === void 0) {\n defaultStatus = 200;\n }\n if (defaultStatusText === void 0) {\n defaultStatusText = 'OK';\n }\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "function createResponse(){\n resp = {success: true}\n return resp\n}", "function HttpResponse() {\n var _this202;\n\n var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, HttpResponse);\n\n _this202 = _super148.call(this, init);\n _this202.type = HttpEventType.Response;\n _this202.body = init.body !== undefined ? init.body : null;\n return _this202;\n }", "function buildResponse(status, data){\n\treturn {\n\t\tstatus: status,\n\t\tresponse: data\n\t};\n}", "function ResponseBase(obj) {\n\t if (obj) return mixin(obj);\n\t}", "function ResponseBase(obj) {\n\t if (obj) return mixin(obj);\n\t}", "function ResponseBase(obj) {\n\t if (obj) return mixin(obj);\n\t}", "function ResponseBase(obj) {\n\t if (obj) return mixin(obj);\n\t}", "function MessagingResponse() {\n this.response = builder.create('Response').dec('1.0', 'UTF-8');\n}", "createResponse(name, handler) { throw new Error('Server is not configured use responses.'); }", "function createResponse (xhr, headers) {\n function response() {\n return {\n ok: xhr.status >= 200 && xhr.status < 300,\n statusText: xhr.statusText || 'OK',\n status: xhr.status || 200,\n url: xhr.responseURL || headers['x-request-url'] || '',\n headers: {\n get(name) {\n return headers[name.toLowerCase()];\n },\n has(name) {\n return name.toLowerCase() in headers;\n }\n },\n body: xhr.response || xhr.responseText,\n text() {\n return xhr.responseText;\n },\n json() {\n return JSON.parse(xhr.responseText);\n },\n blob() {\n return new Blob([xhr.response]);\n },\n clone: response,\n };\n }\n return response;\n}", "function newResponse(bodyBuffer, opts) {\n if (bodyBuffer || typeof window === 'undefined') {\n return new Response(bodyBuffer, opts)\n } else {\n return new Response(null, opts)\n }\n}", "static get baseObject() {\n return Object.assign({}, Response.template);\n }", "function ResponseBase(obj) {\n\t if (obj) return mixin$1(obj);\n\t}", "constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }", "clone () {\n\t if (!(this instanceof Response)) {\n\t throw new TypeError('Illegal invocation')\n\t }\n\n\t // 1. If this is unusable, then throw a TypeError.\n\t if (this.bodyUsed || (this.body && this.body.locked)) {\n\t webidl.errors.exception({\n\t header: 'Response.clone',\n\t message: 'Body has already been consumed.'\n\t });\n\t }\n\n\t // 2. Let clonedResponse be the result of cloning this’s response.\n\t const clonedResponse = cloneResponse(this[kState]);\n\n\t // 3. Return the result of creating a Response object, given\n\t // clonedResponse, this’s headers’s guard, and this’s relevant Realm.\n\t const clonedResponseObject = new Response();\n\t clonedResponseObject[kState] = clonedResponse;\n\t clonedResponseObject[kRealm] = this[kRealm];\n\t clonedResponseObject[kHeaders][kHeadersList] = clonedResponse.headersList;\n\t clonedResponseObject[kHeaders][kGuard] = this[kHeaders][kGuard];\n\t clonedResponseObject[kHeaders][kRealm] = this[kHeaders][kRealm];\n\n\t return clonedResponseObject\n\t }", "function KradResponse(contents) {\r\n this.responseContents = contents;\r\n}", "static makeResponseObject(defaultData) {\n return {\n error: false,\n message: \"\",\n data: defaultData\n }\n }", "constructor(response) {\n this.response = response;\n }", "function HttpResponse(init) {\n if (init === void 0) {\n init = {};\n }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "constructor(init, defaultStatus = 200 /* HttpStatusCode.Ok */, defaultStatusText = 'OK') {\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }", "static initialize(obj, respVersion, responses) { \n obj['resp_version'] = respVersion;\n obj['responses'] = responses;\n }", "createResponse(successful, message){\n const result = this.response;\n result.status = successful ? 'Submitted' : 'Failed';\n result.error = !successful;\n result.message = message;\n result.date = this.date.toString();\n result.timestamp = this.date.getTime();\n result.lastName = this.lastName;\n result.submissionId = this.submissionId;\n return result;\n }", "constructor(response) {\n Object.assign(this, response); //Assign data properties to Class TODO\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function HttpResponse(init) {\n if (init === void 0) { init = {}; }\n var _this = _super.call(this, init) || this;\n _this.type = HttpEventType.Response;\n _this.body = init.body !== undefined ? init.body : null;\n return _this;\n }", "function toJSONResponse(data) {\n const init = {\n headers: { 'content-type': 'application/json' },\n }\n const body = JSON.stringify(data)\n return new Response(body, init)\n}", "function HttpHeaderResponse() {\n var _this201;\n\n var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, HttpHeaderResponse);\n\n _this201 = _super147.call(this, init);\n _this201.type = HttpEventType.ResponseHeader;\n return _this201;\n }", "_createResponseModel() {\n\n }", "constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }", "constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }", "constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }", "constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }", "constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }", "function HttpResponse() {\n var _this9;\n\n var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n Object(C_Users_Abid_Loqmen_Desktop_NGforce_thesis_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this, HttpResponse);\n\n _this9 = _super2.call(this, init);\n _this9.type = HttpEventType.Response;\n _this9.body = init.body !== undefined ? init.body : null;\n return _this9;\n }", "constructor() { \n \n MailServiceBaseResponse.initialize(this);\n }", "function VoiceResponse() {\n this.response = builder.create('Response').dec('1.0', 'UTF-8');\n}", "static fromResponse(responsePath) {\n return new PhysicalResourceId(responsePath, undefined);\n }", "responseGenerator(code, message, data, error) {\n let res = {\n code: code\n };\n\n if (message) {\n res.message = message;\n }\n if (data) {\n res.data = data;\n }\n if (error) {\n res.error = error;\n }\n\n return res;\n }", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function ResponseBase(obj) {\n if (obj) return mixin(obj);\n}", "function myResponse(appId) {\n this._appId = appId;\n}", "function createResponse(message, data = [], status = \"success\") {\n return (res, code) => {\n return res.status(code).json({ status, message, data });\n };\n}", "function ClientResponse() {\n _classCallCheck(this, ClientResponse);\n\n this._response = {};\n }", "createResponseObject(status, success, message, data, token){\n let responseObject = {\n status,\n success,\n message,\n data: null\n }\n if(data != null){\n responseObject.data = data\n }else{\n responseObject = {\n status,\n success,\n message\n }\n }\n if(data != null && token != null){\n responseObject.data = {\n firstName: data.firstName,\n lastName: data.lastName,\n email: data.email,\n token: token\n }\n }\n return responseObject\n }", "function Response(socket) {\n this.socket = socket;\n return this;\n}" ]
[ "0.74712926", "0.6968805", "0.67969537", "0.6745664", "0.6582377", "0.64811665", "0.6448642", "0.6364888", "0.6360363", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.61714923", "0.61647964", "0.61109763", "0.6068812", "0.6045156", "0.60432225", "0.60432225", "0.60432225", "0.60432225", "0.6011762", "0.60044926", "0.5960039", "0.5951711", "0.5876069", "0.58634484", "0.5860515", "0.58493215", "0.58117706", "0.58111274", "0.581037", "0.5786646", "0.57710946", "0.57597744", "0.5757846", "0.57543755", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.57521325", "0.5749348", "0.57390577", "0.57336503", "0.57335633", "0.57335633", "0.57335633", "0.57335633", "0.57335633", "0.56913507", "0.5667467", "0.5638853", "0.5636008", "0.56324625", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.56118214", "0.55980057", "0.5589925", "0.558704", "0.5583775", "0.5544414" ]
0.6348323
9
Return an identifier for the tree expansion state.
function nodeExpansionIdentifier(path) { const splitPath = path.split('/'); if (splitPath.length > 1) { return `G:${splitPath[splitPath.length - 1]}`; } return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getExpandedState() {\n return this.expanded ? 'expanded' : 'collapsed';\n }", "_getExpandedState() {\n return this.expanded ? 'expanded' : 'collapsed';\n }", "function getExpandableTargetElementID()\r\n{\r\n}", "getIdentifier () {\n return (this._identifier);\n }", "getId() {\n const parent = this.getParent();\n return parent ? `${parent.getId()}/${this.getInternalId()}` : this.getInternalId();\n }", "function getIdentifierForSelection(node: Selection): string {\n if (\n node.kind === 'LinkedField' ||\n node.kind === 'ScalarField' ||\n node.kind === 'MatchField'\n ) {\n return node.directives.length === 0\n ? node.alias || node.name\n : (node.alias || node.name) + printDirectives(node.directives);\n } else if (node.kind === 'FragmentSpread') {\n return node.args.length === 0\n ? '...' + node.name\n : '...' + node.name + printArguments(node.args);\n } else if (node.kind === 'MatchBranch') {\n return node.name + '$' + node.module;\n } else if (node.kind === 'InlineFragment') {\n return 'I:' + node.typeCondition.name;\n } else if (node.kind === 'Condition') {\n return (\n 'C:' +\n (node.condition.kind === 'Variable'\n ? '$' + node.condition.variableName\n : String(node.condition.value)) +\n String(node.passingValue)\n );\n } else {\n invariant(\n false,\n 'getIdentifierForSelection: Unexpected kind `%s`.',\n (node.kind: empty),\n );\n }\n}", "getStateInternal(id) {\n var obj = id;\n if (! obj.startsWith(this.namespace + '.'))\n obj = this.namespace + '.' + id;\n return currentStateValues[obj];\n }", "getCurrentIDFromState(state) {\n return this._getSubState(state).currentID || null;\n }", "function getId(d) {\n\n var name = \"\";\n var node = d;\n while (node.parent) {\n if (name == \"\") {\n name = node.name;\n node = node.parent;\n\n }\n else {\n name = node.name + \".\" + name;\n node = node.parent;\n }\n }\n return name = node.name + \".\" + name;\n\n}", "function calcIdentifier(env, name) {\n return env[name];\n}", "static definition() {\n return 'A tree is a perennial plant with an elongated stem, or trunk, supporting branches and leaves.'\n }", "get uniqueIdentifier() { return this._state.uniqueIdentifier; }", "function get_state(id)\n {\n if (p.save_state && window.rcmail) {\n if (!tree_state) {\n tree_state = rcmail.local_storage_get_item('treelist-' + list_id, {});\n }\n return tree_state[id];\n }\n\n return undefined;\n }", "getStateName() {\n return this.currentStateName;\n }", "function getIdentifier(info) {\n return getIdentifierRecursive(info.path);\n}", "function eid(name) {\n return 'Svgjs' + capitalize(name) + did++;\n} // Deep new id assignment", "getExpandedIndex() {\n return this.state.activeSubMenuIndex;\n }", "function getId() {\n idRoot++;\n return idRoot;\n\n }", "tagId(state) {\n return state.tagId;\n }", "get identifier() { return this._identifier; }", "function tree() {\n return containsTree() ? name.split('.')[0] : 'standards';\n }", "function parse_ID() {\n tree.addNode('ID', 'branch');\n parse_char();\n //tree.endChildren();\n tree.endChildren();\n\n}", "function getNodeKey(n) {\r\n return n.tagName + ' ' + $(n).attr('id');\r\n }", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "get identifier() {\n\t\treturn this.__identifier;\n\t}", "__getNodeId() {\n return this.part ? this.part.nodeId : '';\n }", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "get identifier () {\n\t\treturn this._identifier;\n\t}", "function getIdentifierVariableName(path) {\n if (path.isIdentifier() && path.parentPath.isCallExpression() && path.parentPath.parentPath.isVariableDeclarator()) {\n const variableName = path.parentPath.parentPath.node.id.name;\n return variableName;\n }\n\n return '';\n}", "function identifer() {\n\t var result = (0, _parser.repeat1)((0, _parser.choice)((0, _parser.range)('a', 'z'), (0, _parser.range)('A', 'Z'), (0, _parser.ch)('_'), (0, _parser.ch)('$')));\n\t return (0, _parser.action)(result, function (ast) {\n\t return {\n\t type: 'identifer',\n\t value: ast.join('')\n\t };\n\t });\n\t}", "get expanded() {\n return this.data.expanded;\n }", "static get nextId() {\n return TreeChart._nextId++;\n }", "getExpansionIndex(): number {\n if (!(this.assignee instanceof ArrayInitialiserPatcher)) {\n return -1;\n }\n for (let i = 0; i < this.assignee.members.length; i++) {\n if (this.assignee.members[i] instanceof ExpansionPatcher) {\n return i;\n }\n }\n return -1;\n }", "get expanded() { return this._expanded; }", "function Function$id() {\n return identity;\n }", "function Function$id() {\n return identity;\n }", "getTreeID(id) {\n //return this.http.get('/rest/Tree/'+id);\n return this.randomServerAnswer(SampleTree, SampleError);\n }", "idType () {\n const name = this.currentAstNode.value\n const nextResults = this.initialItems.filter(node =>\n (name === node.name) || (name === node.package.name)\n )\n this.processPendingCombinator(nextResults)\n }", "function getFullStateName(state) {\n return stateList[state];\n}", "function visitIdentifier(context, node, scope, state) {\n\t // check if this node matches our function id\n\t if (node.name !== state.name) return;\n\n\t // check that we don't have a local variable declared as that removes the need\n\t // for the wrapper\n\t var localDeclar = scope.getBindingIdentifier(state.name);\n\t if (localDeclar !== state.outerDeclar) return;\n\n\t state.selfReference = true;\n\t context.stop();\n\t}", "function visitIdentifier(context, node, scope, state) {\n\t // check if this node matches our function id\n\t if (node.name !== state.name) return;\n\n\t // check that we don't have a local variable declared as that removes the need\n\t // for the wrapper\n\t var localDeclar = scope.getBindingIdentifier(state.name);\n\t if (localDeclar !== state.outerDeclar) return;\n\n\t state.selfReference = true;\n\t context.stop();\n\t}", "function expandedForm(num) {\n var str = num.toString()\n return str\n}", "function walkIdentifiers(root, onIdentifier) {\n\t const parentStack = [];\n\t const knownIds = Object.create(null);\n\t estreeWalker.walk(root, {\n\t enter(node, parent) {\n\t parent && parentStack.push(parent);\n\t if (node.type === 'Identifier') {\n\t if (!knownIds[node.name] &&\n\t isRefIdentifier(node, parent, parentStack)) {\n\t onIdentifier(node, parent, parentStack);\n\t }\n\t }\n\t else if (isFunction(node)) {\n\t // #3445\n\t // should not rewrite local variables sharing a name with a top-level ref\n\t if (node.body.type === 'BlockStatement') {\n\t node.body.body.forEach(p => {\n\t if (p.type === 'VariableDeclaration') {\n\t for (const decl of p.declarations) {\n\t extractIdentifiers(decl.id).forEach(id => {\n\t markScopeIdentifier(node, id, knownIds);\n\t });\n\t }\n\t }\n\t });\n\t }\n\t // walk function expressions and add its arguments to known identifiers\n\t // so that we don't prefix them\n\t node.params.forEach(p => estreeWalker.walk(p, {\n\t enter(child, parent) {\n\t if (child.type === 'Identifier' &&\n\t // do not record as scope variable if is a destructured key\n\t !isStaticPropertyKey(child, parent) &&\n\t // do not record if this is a default value\n\t // assignment of a destructured variable\n\t !(parent &&\n\t parent.type === 'AssignmentPattern' &&\n\t parent.right === child)) {\n\t markScopeIdentifier(node, child, knownIds);\n\t }\n\t }\n\t }));\n\t }\n\t else if (node.type === 'ObjectProperty' &&\n\t parent.type === 'ObjectPattern') {\n\t node.inPattern = true;\n\t }\n\t },\n\t leave(node, parent) {\n\t parent && parentStack.pop();\n\t if (node.scopeIds) {\n\t node.scopeIds.forEach((id) => {\n\t knownIds[id]--;\n\t if (knownIds[id] === 0) {\n\t delete knownIds[id];\n\t }\n\t });\n\t }\n\t }\n\t });\n\t}", "function expandOid(object, module) {\n var moduleName = module.name;\n var oid = findOid(object.descriptor, moduleName);\n\n if(!oid) {\n throw new Error(`No such descriptor: ${object.descriptor} from ${moduleName}`)\n }\n\n // This oid for this object has already been expanded,\n // so unwind from here.\n if(object.oid) {\n return object.oid;\n }\n\n // If the first sub-id is a number, then we are at root and can unwind.\n // This is the case for mibs that implement a new root.\n if(typeof oid[oid.length - 1] === 'number') {\n object.oid = oid.slice();\n tree.addObject(object);\n return oid;\n }\n\n // If the first sub-id is _root then unwind.\n // This is the case for the well-known objects (iso etc)\n if(oid[oid.length - 1] === '_root') {\n oid.pop();\n object.oid = oid.slice();\n tree.addObject(object);\n return oid;\n }\n\n // The first sub-id is a descriptor. Find the module it is from\n // and expand from there.\n var baseDescriptor = oid.pop();\n var fromModule;\n var fromModuleName;\n var fromObject;\n if(module.importsDescriptor(baseDescriptor)) {\n fromModuleName = module.getExporterForDescriptor(baseDescriptor);\n } else {\n fromModuleName = moduleName;\n }\n fromModule = modules[fromModuleName];\n fromObject = fromModule.objects[baseDescriptor];\n\n // recurse down to expand the next part of the OID.\n oid = expandOid(fromObject, fromModule).concat(oid);\n object.oid = oid.slice();\n tree.addObject(object);\n\n return oid;\n }", "function getRebuildBranchName() {\n var date = new Date();\n var mm = date.getMonth() + 1; // Month, 0-11\n var dd = date.getDate(); // Day of the month, 1-31\n var yyyy = date.getFullYear();\n return 'rebuild_' + mm + '_' + dd + '_' + yyyy;\n}", "_getExpandedState() {\n return this.panel._getExpandedState();\n }", "get expanded() {\n return Object.getOwnPropertyDescriptor(TreeItem.prototype, 'expanded')\n .get.call(this);\n }", "function id(x) { return x; }", "function expandInfo() {\n\n var activePass = app.getPassActive();\n var expandedItem = d3.select('.expanded'); //current open <li>\n var activeItem = d3.select(d3.select(activePass.rootID).node().parentNode); //soon to open <li>\n\n if (expandedItem.empty()) { //no panel expanded\n openExpander(activeItem);\n } else if (isExpanded()) { //a panel is already expanded\n closeExpander(expandedItem);\n } else if (activeItem.node().offsetTop == expandedItem.node().offsetTop) { //selection in same row\n moveExpander(expandedItem, activeItem);\n } else { //selection in new row\n closeExpander(expandedItem);\n openExpander(activeItem);\n }\n\n\n }", "function getIdentifierForRelaySelection(node) {\n\t var obj = void 0;\n\t switch (node.kind) {\n\t case 'LinkedField':\n\t case 'ScalarField':\n\t obj = {\n\t directives: node.directives,\n\t field: node.alias || node.name\n\t };\n\t break;\n\t case 'InlineFragment':\n\t obj = {\n\t inlineFragment: node.typeCondition.toString()\n\t };\n\t break;\n\t case 'Condition':\n\t obj = {\n\t condition: node.condition,\n\t passingValue: node.passingValue\n\t };\n\t break;\n\t case 'FragmentSpread':\n\t obj = {\n\t fragmentSpread: node.name,\n\t args: node.args\n\t };\n\t break;\n\t default:\n\t __webpack_require__(1)(false, 'RelayFlattenTransform: Unexpected kind `%s`.', node.kind);\n\t }\n\t return __webpack_require__(17)(obj);\n\t}", "function stateNameFromID(stateID) {\n switch (stateID) {\n case \"new\" : return \"New\";\n case \"on_hold\" : return \"On Hold\";\n case \"dispatched\": return \"Dispatched\";\n case \"on_scene\" : return \"On Scene\";\n case \"closed\" : return \"Closed\";\n default:\n console.warn(\"Unknown incident state ID: \" + stateID);\n return undefined;\n }\n}", "function Identifier(name, parent_type) {\n this.name = name;\n this.parent_type = parent_type;\n this.prop_name = undefined;\n this.prop_index = undefined;\n}", "function getTreeState() {\n var tree = viewTree.getData().getAllNodes();\n //isc.JSON.encode(\n return { width: viewTree.getWidth(),\n time: isc.timeStamp(),\n pathOfLeafShowing: viewInstanceShowing ? viewInstanceShowing.path : null,\n // selectedPaths: pathShowing, //viewTree.getSelectedPaths(),\n //only store data needed to rebuild the tree \n state: tree.map(function(n) {\n return {\n\t type: n.type,\n\t id: n.id,\n\t parentId: n.parentId,\n\t isFolder: n.isFolder,\n\t name: n.name,\n\t isOpen: n.isOpen,\t\n\t state: n.state,\n icon: n.icon\n };\n\t\t })\n };\n }", "getNodeIDString() {\n return helperfunctions_1.bufferToNodeIDString(this.nodeID);\n }", "isExpanded(dataNode) {\n return this.expansionModel.isSelected(dataNode);\n }", "get expanded() {\n return this.data.expanded;\n }", "static createUniqID(expander) {\n if (!expander.expander.parentElement.classList.contains('cs-expander-init')) {\n expander.id = '#cs-ew-' + expander._uniqCode;\n expander.expander.parentElement.id = 'cs-ew-' + expander._uniqCode;\n expander.expander.parentElement.classList.add('cs-expander-init')\n }\n }", "getId(){\n \tlet id = this.state.lastIndex;\n \treturn this.setState({lastIndex:id++});\n }", "function read_ident() {\n // Get number of characters in identifier\n var id = read_while(is_id);\n // Determine the identifier type and return a token of that type\n return {\n type : is_keyword(id) ? \"kw\" : \"var\",\n value : id,\n };\n }", "function visitIdentifier(context, node, scope, state) {\n // check if this node matches our function id\n if (node.name !== state.name) return;\n\n // check that we don't have a local variable declared as that removes the need\n // for the wrapper\n var localDeclar = scope.getBindingIdentifier(state.name);\n if (localDeclar !== state.outerDeclar) return;\n\n state.selfReference = true;\n context.stop();\n}", "function setID (identifier) {\n if (identifier.longname) {\n identifier.id = identifier.longname\n }\n if (identifier.kind === 'constructor') {\n identifier.id = identifier.longname + '()'\n }\n if (identifier.isExported) {\n identifier.id = identifier.longname + '--' + identifier.codeName\n }\n return identifier\n}", "Identifier(__node) {\n if (!current_function) {\n return;\n }\n __node.inFunction = current_function;\n current_function.identifiers.push(__node);\n }", "get isExpanded() {}", "function getNodeAsString()\n\t{\n\t\treturn this.n;\n\t}", "Identifier(__node) {\n if (!current_function) {\n return;\n }\n __node.inFunction = current_function;\n __node.scope = undefined;\n __node.scopeRef = undefined;\n current_function.identifiers.push(__node);\n }", "function getID(node) {\n var parentID = \"\", nodeIndex = \"\";\n if(node.marktype != undefined && !node.group) {\n // The node is a root node.\n return \"0\";\n } else if(node.marktype != undefined && node.group) {\n // The node is a GROUP mark.\n parentID = getID(node.group);\n if(node.group.items.indexOf(node) != -1) {\n // The node exists in the parent's list of items.\n myIndex = node.group.items.indexOf(node) + \"i\";\n } else if(node.group.axisItems.indexOf(node) != -1) {\n // The node exists in the parent's list of axis items.\n myIndex = node.group.axisItems.indexOf(node) + \"a\";\n } else if(node.group.legendItems.indexOf(node) != -1) {\n // The node exists in the parent's list of legend items.\n myIndex = node.group.legendItems.indexOf(node) + \"l\";\n } else {\n myIndex = \"NaN\";\n }\n } else if(node.mark) {\n // The node is an ITEM.\n parentID = getID(node.mark);\n myIndex = node.mark.items.indexOf(node);\n }\n return parentID + \".\" + myIndex;\n} // end getID", "get STATE_IDX() { return 0; }", "function id(x){ return x; }", "function handleNodeExpansion(objectArg, event, expandId, iconId) {\n stopPropagation(event);\n\n var span = document.getElementById(expandId);\n\n //do not handle leaf nodes\n if(isLeaf(span)) {\n return;\n }\n\n var index = isClassExpanded(span) ? 0 : 1;\n\n var newClassName = expansionArray[1 - index];\n var oldClassName = expansionArray[index];\n\n handleIcons(iconId, newClassName);\n\n var currentClassName = span.className;\n var isLastNode = currentClassName.indexOf(lastNodeString) > 0 ? true : false;\n if(isLastNode) {\n newClassName = newClassName + lastNodeString;\n oldClassName = oldClassName + lastNodeString;\n }\n\n removeClass(span, oldClassName);\n addClass(span, newClassName);\n handleChildMenuIfExists(span, index);\n}", "function getId() {\n\treturn '[' + pad(++testId, 3) + '] ';\n}", "function expand(id, recursive)\n {\n collapse(id, recursive, false);\n }", "constructor(parent, name) {\n super(parent, name);\n const s = Stack.find(this);\n if (!s) {\n throw new Error('The tree root must be derived from \"Stack\"');\n }\n this.stack = s;\n this.addMetadata(LOGICAL_ID_MD, new tokens_1.Token(() => this.logicalId), this.constructor);\n this.logicalId = this.stack.logicalIds.getLogicalId(this);\n }", "static getTypeID(ast) { return ast.typeID }", "function state_to_uniqueid(state) {\n try {\n let id=0;\n for(let j=0;j<3;++j)\n for(let i=0;i<3;++i) {\n id*=9;\n id+=state.grid[j][i];\n }\n return id;\n } catch(e) {\n helper_log_exception(e);\n\t throw e;\n return null;\n }\n}", "function translator_getOutlineId()\n{\n return this.parser.getOutlineId();\n}", "get identifier() {\n return this._researchSubject.researchStudy.identifier.value || \"\";\n }" ]
[ "0.5656337", "0.5656337", "0.5645384", "0.55834687", "0.5345829", "0.53317225", "0.51989716", "0.5192754", "0.5062759", "0.50327003", "0.5027351", "0.50154865", "0.50127435", "0.50047374", "0.5004341", "0.49946573", "0.4952317", "0.4916813", "0.4911228", "0.4900761", "0.48924953", "0.48787102", "0.48693442", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48637044", "0.48560604", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48438942", "0.48437238", "0.48081863", "0.4791613", "0.47876", "0.47757578", "0.47732627", "0.47591648", "0.47591648", "0.47522935", "0.47520846", "0.47485477", "0.47398844", "0.47398844", "0.47302306", "0.4720198", "0.47113156", "0.46972108", "0.46852922", "0.4677279", "0.467296", "0.46709058", "0.46670607", "0.4664449", "0.46615338", "0.46598008", "0.46595302", "0.46560052", "0.4650138", "0.4633907", "0.46324345", "0.46318805", "0.46314743", "0.46312177", "0.46304467", "0.46293014", "0.46284968", "0.46267346", "0.46263275", "0.46161658", "0.46123207", "0.46006584", "0.45975262", "0.4597195", "0.45948765", "0.45946923", "0.45904392", "0.4586892", "0.45858043" ]
0.63093114
0
Expands or shrinks tutorial code blocks
function togglecode(event) { var child = event.currentTarget.parentElement.firstChild; var counter = 0; while(child!= null){ // skip TextNodes if(child.nodeType == Node.TEXT_NODE) { child = child.nextSibling; continue; } if(counter === 0) { toggleclass($(child), 'collapsed'); } else { toggleclass($(child), 'hidden'); } child = child.nextSibling; counter++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setCodeExamples(){\n\n\t\n\n\tvar html=\"\";\n\t$('*[data-language]').each(function(){\n\t\tvar code=$(this).html();\n\t\tcode=code.replace(/</g,\"&lt;\");\n\t \tcode=code.replace(/>/g,\"&gt;\");\n\t \tcode=$.trim(code);\n\n\t \tif(code!==\"\"){\n\t\t \thtml+=\"<h3>\"+$(this).attr('data-language-label')+\"</h3>\";\n\t\t \thtml+='<pre class=\"'+$(this).attr('data-language')+' line-numbers\"><code class=\"'+$(this).attr('data-language')+' line-numbers\">'+code+'</code></pre>';\n\t\t}\n\t});\n\n $('#code_prisim').html(html);\n if(html==\"\"){\n $('#headPreview').hide();\n\t}\n\t\n\tsetTimeout(function(){\n\t\t$('.code-toolbar').attr('tabindex','0').addClass('prismButtonListenerAdded');\n\t\t$(document).on('click','.code-toolbar .toolbar-item a',function(){\n\t\t\t$(this).parents('.code-toolbar:first').focus();\n\t\t})\n\t\t$('.code-toolbar .toolbar-item a').attr('tabindex','0').attr(\"href\",\"javascript:void(0)\").attr('role','button');\n\t\t$('.code-toolbar').focusin(function(){\t\n\t\t\t$(this).find('.toolbar').css('opacity','1')\n\t\t})\n\t\t$('.code-toolbar').focusout(function(){\n\t\t\t$(this).find('.toolbar').removeAttr('style')\n\t\t})\n\t},200)\n\t\n\n}", "function main() {\n addHeadings();\n styleTutorialsAndArticles();\n separateAllTutorials();\n}", "function buckyTutorials() {\n\tbuckyHTML();\n\tbuckyAngularJS();\n}", "function createCodeProgressions(code_block) {\n let code_button_container = $(code_block).find(\".code-buttons\");\n\n $(code_button_container).append(createButton(\"Before\", \"before-button\"));\n $(code_button_container).append(createButton(\"After\", \"after-button\"));\n $(code_button_container).append(createButton(\"Snippets\", \"snippet-button\"));\n\n let code_buttons = $(code_block).find(\".code-buttons\").children();\n let before_code = $(code_block).find(\".before-code\");\n let after_code = $(code_block).find(\".after-code\");\n let snippet_code = $(code_block).find(\".snippet-code\");\n let code_blocks = [before_code, after_code, snippet_code]\n $(code_buttons[2]).addClass(\"selected\");\n $(code_blocks[0]).addClass(\"hidden\");\n $(code_blocks[1]).addClass(\"hidden\");\n\n $(code_buttons).click(function () {\n let button_index = Array.from(code_buttons).indexOf(this);\n let selected = $(code_block).find(\".code-buttons\").find(\".selected\");\n let selected_index = Array.from(code_buttons).indexOf(selected[0]);\n if (button_index != selected_index) {\n $(code_buttons[selected_index]).removeClass(\"selected\");\n $(code_buttons[button_index]).addClass(\"selected\");\n $(code_blocks[selected_index]).addClass(\"hidden\");\n $(code_blocks[button_index]).removeClass(\"hidden\");\n }\n })\n}", "function toggleCodeBlocks() {\n var t = localStorage.getItem(\"toggleCodeStats\")\n t = (t + 1) % 3;\n localStorage.setItem(\"toggleCodeStats\", t);\n var a = $('.content-page article');\n var c = a.children().filter('pre');\n var d = $('.right-column');\n if (d.hasClass('float-view')) {\n d.removeClass('float-view');\n $('#toggleCodeBlockBtn')[0].innerHTML = \"Hide Code Blocks\";\n } else {\n if (c.hasClass('hidden')) {\n d.addClass('float-view');\n c.removeClass('hidden');\n $('#toggleCodeBlockBtn')[0].innerHTML = \"Show Code Blocks Inline\";\n } else {\n c.addClass('hidden');\n $('#toggleCodeBlockBtn')[0].innerHTML = \"Show Code Blocks\";\n }\n }\n}", "function makeBigger() {\n\n}", "onExpanded(name) {\n this._codeView.codeEditor.editorObject.resize()\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 addDescribe() {\n\t\tvar myCode = 'describe(\"\", function() {\\n';\n\t\tmyCode = myCode + '\\n';\n myCode = myCode + '\\t\\t\\tit(\"\", function() {\\n';\n myCode = myCode + '\\t\\t\\t\\t\\n';\n myCode = myCode + '\\t\\t\\t});\\n';\n myCode = myCode + '\\n';\n myCode = myCode + '\\t\\t});\\n';\n\t\t\n var editor = EditorManager.getFocusedEditor();\n if (editor) {\n var insertionPos = editor.getCursorPos();\n editor.document.replaceRange(myCode, insertionPos);\n }\n }", "function previewPerfectProgrammer() {\n //create a playback with all insert/delete pairs within two comments removed\n projectManager.setNextPlaybackPerfectProgrammer();\n startPlayback(false);\n}", "function seperateAllTutorials() {\n const section = document.querySelector(\"div\");\n const tutorials = document.querySelector(\".tutorial\");\n section.removeChild(tutorials)\n \n const newElement = document.createElement(\"div\");\n newElement.classList.add(\".tutorials\")\n \n}", "function initImmersionMore() {\n window.addEventListener(\"resize\", initImmersionMore)\n\n var clickText = document.querySelectorAll(\".click-for-more\")\n\n var isa = document.getElementById(\"isa\")\n var isaClone = isa.cloneNode(true)\n isaClone.style.height = \"auto\"\n isaClone.style.opacity = 0\n isa.parentElement.appendChild(isaClone)\n window.isaHeight = window.getComputedStyle(isaClone).height\n isa.parentElement.removeChild(isaClone)\n\n if (clickText[0].textContent.indexOf(\"less\") === -1) {\n isa.style.height = \"0px\"\n }\n else {\n isa.style.height = isaHeight\n }\n\n var middlebury = document.getElementById(\"middlebury\")\n var middleburyClone = middlebury.cloneNode(true)\n middleburyClone.style.height = \"auto\"\n middleburyClone.style.opacity = 0\n middlebury.parentElement.appendChild(middleburyClone)\n window.middleburyHeight = window.getComputedStyle(middleburyClone).height\n middlebury.parentElement.removeChild(middleburyClone)\n\n if (clickText[1].textContent.indexOf(\"less\") === -1) {\n middlebury.style.height = \"0px\"\n }\n else {\n middlebury.style.height = middleburyHeight\n }\n}", "function makeSmaller() {\n\n}", "displayExamples() {\r\n this.parent.menuPG.removeAllOptions();\r\n\r\n var scripts = this.parent.main.scripts;\r\n\r\n if (!this.examplesLoaded) {\r\n\r\n \r\n function sortScriptsList(a, b) {\r\n if (a.title < b.title) return -1;\r\n else return 1;\r\n }\r\n\r\n for (var i = 0; i < scripts.length; i++) {\r\n scripts[i].samples.sort(sortScriptsList);\r\n\r\n var exampleCategory = document.createElement(\"div\");\r\n exampleCategory.classList.add(\"categoryContainer\");\r\n\r\n var exampleCategoryTitle = document.createElement(\"p\");\r\n exampleCategoryTitle.innerText = scripts[i].title;\r\n exampleCategory.appendChild(exampleCategoryTitle);\r\n\r\n for (var ii = 0; ii < scripts[i].samples.length; ii++) {\r\n var example = document.createElement(\"div\");\r\n example.classList.add(\"itemLine\");\r\n example.id = ii;\r\n\r\n var exampleImg = document.createElement(\"img\");\r\n exampleImg.setAttribute(\"data-src\", scripts[i].samples[ii].icon.replace(\"icons\", \"https://doc.babylonjs.com/examples/icons\"));\r\n exampleImg.setAttribute(\"onClick\", \"document.getElementById('PGLink_\" + scripts[i].samples[ii].PGID + \"').click();\");\r\n\r\n var exampleContent = document.createElement(\"div\");\r\n exampleContent.classList.add(\"itemContent\");\r\n exampleContent.setAttribute(\"onClick\", \"document.getElementById('PGLink_\" + scripts[i].samples[ii].PGID + \"').click();\");\r\n\r\n var exampleContentLink = document.createElement(\"div\");\r\n exampleContentLink.classList.add(\"itemContentLink\");\r\n\r\n var exampleTitle = document.createElement(\"h3\");\r\n exampleTitle.classList.add(\"exampleCategoryTitle\");\r\n exampleTitle.innerText = scripts[i].samples[ii].title;\r\n var exampleDescr = document.createElement(\"div\");\r\n exampleDescr.classList.add(\"itemLineChild\");\r\n exampleDescr.innerText = scripts[i].samples[ii].description;\r\n\r\n var exampleDocLink = document.createElement(\"a\");\r\n exampleDocLink.classList.add(\"itemLineDocLink\");\r\n exampleDocLink.innerText = \"Documentation\";\r\n exampleDocLink.href = scripts[i].samples[ii].doc;\r\n exampleDocLink.target = \"_blank\";\r\n\r\n var examplePGLink = document.createElement(\"a\");\r\n examplePGLink.id = \"PGLink_\" + scripts[i].samples[ii].PGID;\r\n examplePGLink.classList.add(\"itemLinePGLink\");\r\n examplePGLink.innerText = \"Display\";\r\n examplePGLink.href = scripts[i].samples[ii].PGID;\r\n examplePGLink.addEventListener(\"click\", function () {\r\n location.href = this.href;\r\n location.reload();\r\n });\r\n\r\n exampleContentLink.appendChild(exampleTitle);\r\n exampleContentLink.appendChild(exampleDescr);\r\n exampleContent.appendChild(exampleContentLink);\r\n exampleContent.appendChild(exampleDocLink);\r\n exampleContent.appendChild(examplePGLink);\r\n\r\n example.appendChild(exampleImg);\r\n example.appendChild(exampleContent);\r\n\r\n exampleCategory.appendChild(example);\r\n }\r\n\r\n exampleList.appendChild(exampleCategory);\r\n }\r\n }\r\n this.examplesLoaded = true;\r\n\r\n\r\n this.isExamplesDisplayed = true;\r\n this.exampleList.style.display = 'block';\r\n document.getElementsByClassName('wrapper')[0].style.width = 'calc(100% - 400px)';\r\n\r\n this.fpsLabel.style.display = 'none';\r\n this.toggleExamplesButtons.call(this, true);\r\n this.exampleList.querySelectorAll(\"img\").forEach(function (img) {\r\n if (!img.src) {\r\n img.src = img.getAttribute(\"data-src\");\r\n }\r\n })\r\n }", "function toggleHeadingSmaller(editor) {\n _toggleHeading(editor.codemirror, 'smaller');\n}", "function main() {\r\n initFlags();\r\n fixMarkup();\r\n changeLayout();\r\n initConfiguration();\r\n}", "function init() {\n // Blockly.Java.init();\n var expandList = [\n document.getElementById('blockly'),\n // document.getElementById('previewFrame'),\n document.getElementById('languagePre'),\n // document.getElementById('generatorPre')\n ];\n var onresize = function(e) {\n\n for (var i = 0, expand; expand = expandList[i]; i++) {\n // expand.style.width = (expand.parentNode.offsetWidth - 2) + 'px';\n // expand.style.height = (expand.parentNode.offsetHeight - 2) + 'px';\n console.log(\"onresize: \", expand, expand.parentNode.offsetWidth, expand.parentNode.offsetHeight);\n }\n };\n onresize();\n window.addEventListener('resize', onresize);\n\n var toolbox = document.getElementById('toolbox'); //@todo can we lazy load this?\n Blockly.inject(document.getElementById('blockly'),\n {path: BLOCKLYPATH, toolbox: toolbox});\n\n // Create the root block.\n rootBlock = Blockly.Block.obtain(Blockly.mainWorkspace, 'simple_robot');\n rootBlock.initSvg();\n rootBlock.render();\n rootBlock.setMovable(false);\n rootBlock.setDeletable(false);\n\n Blockly.addChangeListener(onchange);\n \n}", "hideExamples() {\r\n this.isExamplesDisplayed = false;\r\n this.exampleList.style.display = 'none';\r\n document.getElementsByClassName('wrapper')[0].style.width = '100%';\r\n\r\n if (this.parent.menuPG && this.parent.menuPG.isMobileVersion && document.getElementById('jsEditor').style.display == 'block') {} else this.fpsLabel.style.display = 'block';\r\n this.toggleExamplesButtons.call(this, false);\r\n }", "function upMain() {\n main.classList.add('expanded');\n const content = get(`#${currentLang}-content`)\n content && content.classList.add('expanded')\n}", "function resize() {}", "function setUpEvents() {\n let content = document.getElementById(\"content\");\n let button = document.getElementById(\"showMore\");\n\n button.onclick = function () {\n if (content.className === \"open\") {\n //shrink the box\n content.className = \"\";\n button.innerHTML = \"show more\";\n } else {\n //expand the box\n content.className = \"open\";\n button.innerHTML = \"show less\";\n }\n };\n}", "function init_resize(){\n\n // add more here\n\n}", "function test(){\r\n alert(\"this is a test\");\r\n\r\n // wanting to add more comments to see gulp in action pretending to be huge file\r\n}", "function resizeIt(magnification)\r\n\r\n{var new_layout_width=(original_size.w*magnification)+layout_width_offset;\r\n layout.style.width=new_layout_width.toString()+\"px\";\r\n embed_tag.setAttribute(\"width\",original_size.w*magnification);\r\n\r\n embed_tag.setAttribute(\"height\",original_size.h*magnification);\r\n\r\n}", "function adjustMarkupTab() {\n var viewportHeight = $(window).height()-130;\n $(\"#definition-column\").height(viewportHeight);\n $(\"#ckeditor-text\").height(viewportHeight-120);\n $(\"#ckeditor-about\").height(viewportHeight-150);\n}", "function OogaahTutorialContent34() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function OogaahTutorialContent34() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function toggleHeadingSmaller(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"smaller\");\n}", "function toggleHeadingSmaller(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"smaller\");\n}", "function toggleHeadingSmaller(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"smaller\");\n}", "function toggleHeadingSmaller(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"smaller\");\n}", "function grow() {\n \n}", "function sample2_5_3() {\n var element = document.getElementById('sample-2-5');\n element.classList.add('sample-content');\n}", "grow() {\n }", "function setup(args, ctx) {\n ctx.worldData.isReset = true;\n setTimeout(() => {\n var toolbox = ctx.worldData.levels[ctx.worldData.currentLevel].toolbox;\n\n workspace = Blockly.inject(\"blocklyDiv\", {\n toolbox: document.getElementById(toolbox)\n });\n\n workspace.addChangeListener(Blockly.Events.disableOrphans);\n Blockly.Xml.domToWorkspace(\n document.getElementById(\"startBlocks\"),\n workspace\n );\n Blockly.JavaScript.STATEMENT_PREFIX = \"highlightBlock(%1);\\n\";\n Blockly.JavaScript.addReservedWords(\"highlightBlock\");\n\n ctx.runCode = function(evt) {\n runCode(ctx);\n };\n ctx.levelChanged = function(evt) {\n levelChanged(ctx);\n };\n ctx.startGame = function(evt) {\n startGame();\n };\n ctx.onChange = function(evt) {\n onChange(ctx);\n };\n ctx.showInstructions = function(evt) {\n showInstructions();\n };\n\n SystemBus.addListener(\"levelChanged\", ctx.levelChanged);\n SystemBus.addListener(\"showInstructions\", ctx.showInstructions);\n\n workspace.addChangeListener(ctx.onChange);\n\n document.addEventListener(\"contextmenu\", event => event.preventDefault());\n document.getElementById(\"btnRun\").addEventListener(\"click\", ctx.runCode);\n document\n .getElementById(\"btnStart\")\n .addEventListener(\"click\", ctx.startGame);\n\n ctx.worldData.numOfBlocks = workspace.getAllBlocks().length - 1;\n document.getElementById(\"numOfBlocks\").innerText =\n ctx.worldData.numOfBlocks;\n document.getElementById(\"maxBlocks\").innerText =\n ctx.worldData.levels[ctx.worldData.currentLevel].blocks;\n\n showCode();\n });\n}", "function doneResizing(){\n //bigGalleryWidth();\n sliderHeight();\n centerVerticalNavigation();\n}", "function kata29() {\r\n // Your Code Here\r\n}", "function biographyExpand(){\n\t$('body').on('click', '.expand.lbb', function(){\n\n\t var img = $(this).find('img'),\n src = img.attr('src').replace(/Thumb/g, ''),\n alt = img.attr('alt'),\n index = alt.split('|'),\n title = index[0],\n text = index[1],\n date = index[2],\n video = index[3]\n el = $(this),\n width = $(window).width(),\n height = $(window).height();\n\n // console.log(src + '/////' + alt + '/////' + title + '/////' + date + '/////' + text + '/////' + video);\n\n $(this).parent().siblings('.lightBox').removeClass('video').addClass('active').find('img').attr('src', src).siblings('.lightboxText').find('.description').text(text).siblings('div').find('h1').text(title).siblings('.date').text(date);\n\n if(video) {\n \t$(this).parent().siblings('.bioLightBox').addClass('video').append('<iframe style=\"min-height:' + height + 'px;\" src=\"' + video + '\" width=\"480\" height=\"270\" frameborder=\"0\" scrolling=\"auto\" allowfullscreen></iframe>');\n }\n\n\t});\n\n\t$('.Lightbox_Close').on('click', function(){\n\n\t\t$('.lightBox').removeClass('active').find('iframe').remove();\n\n\t});\n}", "function startRun()\n{\n initCompSyntaxTools();\n initMemVars();\n cleanShell();\n initializeAgain();\n initCanvas();\n cleanCanvas();\n}", "function deckerStart() {\n fixAutoplayWithStart();\n // makeVertical();\n quizModule.quiz();\n currentDate();\n addSourceCodeLabels();\n}", "function kata27() {\r\n // Your Code Here\r\n}", "function OogaahTutorialContent31() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "setup(parent, id, url, files, config){\n var btn=[ {'plugin':'btn', 'setup':[id+\"run\",\"fa-play\", '', {'client':id, 'method':'run'}]}\t]\n var headercfg = config.header || {}\n var title = {'plugin':'header', 'setup':[id+'title',{'type':'img', 'src':'https://jgomezpe.github.io/konekti/img/python.png'}, headercfg.title || 'Python IDE', headercfg.size || 3, headercfg.style || {'class':'w3-green w3-center'}]}\n var navbar = {'plugin':'navbar', 'setup':[id+'navbar', btn, '', config.navbar || {'class':'w3-blue-grey'}]}\t\t\t\n var acecfg = config.ace || {}\n acecfg.theme = acecfg.theme || ''\n acecfg.style = (acecfg.style || '') + 'width:100%;height:100%;'\n var tabs = []\n for(var i=0; i<files.length; i++){\n tabs[i] = {'plugin':'ace', 'setup':[id+files[i].name, files[i].content, 'python', acecfg.theme, '', {'style':acecfg.style}], \n\t\t\t'label':[\"\", files[i].name]}\n }\n var tercfg = config.terminal || {}\n tercfg.style = (tercfg.style || '') + 'width:100%;height:fit;'\n\t\tvar maincfg = config.main || {'style':'width:100%;height:100%;'}\n var control = {\n 'plugin':'split', 'setup':[\n id+'editcon', config.layout || 'col', 50, \n {'plugin':'tab', 'setup':[id+'editor', tabs, 'main.py', {'style':'width:100%;height:100%;'}]},\n { 'plugin':'raw', 'setup':[id+'right', [ navbar,\n {'plugin':'terminal', 'setup':[id+'console', '', tercfg]} ], {'style':'width:100%;height:100%;'}\n ]}, {'style':'width:100%;height:fit;'}\n ]\n }\n var c = super.setup(parent, id, [title,control], maincfg)\n c.url = url\n c.files = files\n c.greetings = config.greetings || '>>\\n'\n return c\n\t}", "setup(parent, id, url, files, config){\n var btn=[ {'plugin':'btn', 'setup':[id+\"run\",\"fa-play\", '', {'client':id, 'method':'run'}]}\t]\n var headercfg = config.header || {}\n var title = {'plugin':'header', 'setup':[id+'title',{'type':'img', 'src':'https://jgomezpe.github.io/konekti/img/python.png'}, headercfg.title || 'Python IDE', headercfg.size || 3, headercfg.style || {'class':'w3-green w3-center'}]}\n var navbar = {'plugin':'navbar', 'setup':[id+'navbar', btn, '', config.navbar || {'class':'w3-blue-grey'}]}\t\t\t\n var acecfg = config.ace || {}\n acecfg.theme = acecfg.theme || ''\n acecfg.style = (acecfg.style || '') + 'width:100%;height:100%;'\n var tabs = []\n for(var i=0; i<files.length; i++){\n tabs[i] = {'plugin':'ace', 'setup':[id+files[i].name, files[i].content, 'python', acecfg.theme, '', {'style':acecfg.style}], \n\t\t\t'label':[\"\", files[i].name]}\n }\n var tercfg = config.terminal || {}\n tercfg.style = (tercfg.style || '') + 'width:100%;height:fit;'\n\t\tvar maincfg = config.main || {'style':'width:100%;height:100%;'}\n var control = {\n 'plugin':'split', 'setup':[\n id+'editcon', 'col', 50, \n {'plugin':'tab', 'setup':[id+'editor', tabs, 'main.py', {'style':'width:100%;height:100%;'}]},\n { 'plugin':'raw', 'setup':[id+'right', [ navbar,\n {'plugin':'terminal', 'setup':[id+'console', '', tercfg]} ], {'style':'width:100%;height:100%;'}\n ]}, {'style':'width:100%;height:fit;'}\n ]\n }\n var c = super.setup(parent, id, [title,control], maincfg)\n c.url = url\n c.files = files\n c.greetings = config.greetings || '>>\\n'\n return c\n\t}", "function toggleHeadingSmaller(editor) {\n var cm = editor.codemirror;\n _toggleHeading(cm, \"smaller\");\n}", "function OogaahTutorialContent4() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function OogaahTutorialContent35() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function OogaahTutorialContent37() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function main() {\n // Break\n var h1 = document.createElement('h1');\n h1.innerText = 'End of js_css_chooser.js';\n h1.style = 'clear: both;';\n document.body.prepend(h1);\n\n // Font\n prependDiv('font_test');\n prependDiv('font_solarized');\n prependDiv('font_cursive_hard');\n prependDiv('font_cursive_soft');\n prependDiv('font_safe');\n\n // Break\n var h1 = document.createElement('h1');\n h1.innerText = 'Font';\n h1.style = 'clear: both;';\n document.body.prepend(h1);\n\n // Css\n prependDiv('layout');\n prependDiv('color_light');\n prependDiv('color_dark');\n\n // Break\n var h1 = document.createElement('h1');\n h1.innerText = 'Color';\n h1.style = 'clear: both;';\n document.body.prepend(h1);\n}", "function sample2_5_2() {\n var element = document.getElementById('sample-2-5');\n element.classList.remove('sample-content');\n}", "function OogaahTutorialContent39() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "constructor() {\n /**\n * VSCode API object got from acquireVsCodeApi\n */\n this.vscodeAPI = null;\n /**\n * Whether finished loading preview\n */\n this.doneLoadingPreview = false;\n /**\n * Whether to enable sidebar toc\n */\n this.enableSidebarTOC = false;\n /**\n * .sidebar-toc element\n */\n this.sidebarTOC = null;\n /**\n * .sidebar-toc element innerHTML generated by markdown-engine.ts\n */\n this.sidebarTOCHTML = \"\";\n this.refreshingIconTimeout = null;\n /**\n * Scroll map that maps buffer line to scrollTops of html elements\n */\n this.scrollMap = null;\n /**\n * TextEditor total buffer line count\n */\n this.totalLineCount = 0;\n /**\n * TextEditor cursor current line position\n */\n this.currentLine = -1;\n /**\n * TextEditor inital line position\n */\n this.initialLine = 0;\n /**\n * Used to delay preview scroll\n */\n this.previewScrollDelay = 0;\n /**\n * Track the slide line number, and (h, v) indices\n */\n this.slidesData = [];\n /**\n * Current slide offset\n */\n this.currentSlideOffset = -1;\n /**\n * SetTimeout value\n */\n this.scrollTimeout = null;\n /**\n * Configs\n */\n this.config = {};\n /**\n * Markdown file URI\n */\n this.sourceUri = null;\n /**\n * Caches\n */\n this.zenumlCache = {};\n this.wavedromCache = {};\n this.flowchartCache = {};\n this.sequenceDiagramCache = {};\n $ = window[\"$\"];\n /** init preview elements */\n const previewElement = document.getElementsByClassName(\"mume\")[0];\n const hiddenPreviewElement = document.createElement(\"div\");\n hiddenPreviewElement.classList.add(\"mume\");\n hiddenPreviewElement.classList.add(\"markdown-preview\");\n hiddenPreviewElement.classList.add(\"hidden-preview\");\n hiddenPreviewElement.setAttribute(\"for\", \"preview\");\n hiddenPreviewElement.style.zIndex = \"0\";\n previewElement.insertAdjacentElement(\"beforebegin\", hiddenPreviewElement);\n /** init `window` events */\n this.initWindowEvents();\n /** init contextmenu */\n this.initContextMenu();\n /** load config */\n this.config = JSON.parse(document.getElementById(\"mume-data\").getAttribute(\"data-config\"));\n this.sourceUri = this.config[\"sourceUri\"];\n /*\n if (this.config.vscode) { // remove vscode default styles\n const defaultStyles = document.getElementById('_defaultStyles')\n if (defaultStyles) defaultStyles.remove()\n }\n */\n // console.log(\"init webview: \" + this.sourceUri);\n // console.log(document.getElementsByTagName('html')[0].innerHTML)\n // console.log(JSON.stringify(config))\n /** init preview properties */\n (this.previewElement = previewElement),\n (this.hiddenPreviewElement = hiddenPreviewElement),\n (this.currentLine = this.config[\"line\"] || -1);\n this.initialLine = this.config[\"initialLine\"] || 0;\n this.presentationMode = previewElement.hasAttribute(\"data-presentation-mode\");\n (this.toolbar = {\n toolbar: document.getElementById(\"md-toolbar\"),\n backToTopBtn: document.getElementsByClassName(\"back-to-top-btn\")[0],\n refreshBtn: document.getElementsByClassName(\"refresh-btn\")[0],\n sidebarTOCBtn: document.getElementsByClassName(\"sidebar-toc-btn\")[0],\n }),\n (this.refreshingIcon = document.getElementsByClassName(\"refreshing-icon\")[0]),\n /** init toolbar event */\n this.initToolbarEvent();\n /** init image helper */\n this.initImageHelper();\n /** set zoom */\n this.setZoomLevel();\n /**\n * If it's not presentation mode, then we need to tell the parent window\n * that the preview is loaded, and the markdown needs to be updated so that\n * we can update properties like `sidebarTOCHTML`, etc...\n */\n if (!this.presentationMode) {\n previewElement.onscroll = this.scrollEvent.bind(this);\n this.postMessage(\"webviewFinishLoading\", [this.sourceUri]);\n }\n else {\n // TODO: presentation preview to source sync\n this.config.scrollSync = true; // <= force to enable scrollSync for presentation\n this.initPresentationEvent();\n }\n // make it possible for interactive vega to load local data files\n const base = document.createElement(\"base\");\n base.href = this.sourceUri;\n document.head.appendChild(base);\n // console.log(document.getElementsByTagName('html')[0].outerHTML)\n }", "function editor_tools_handle_large() {\n editor_tools_add_tags('[large]', '[/large]');\n editor_tools_focus_textarea();\n}", "function main() {\n var N = 22; //Number of animation frames from 0 e.g. N=1 is the same as having two images which swap...\n Conf.augment ? Conf.animate += 1 : Conf.animate -= 1;\n if(Conf.animate === 0 || Conf.animate === N) {\n Conf.augment ? Conf.augment = false : Conf.augment = true;\n }\n }", "help () {\n console.log(`\n Hello!\n If you want to play around with the imports provided to your WebBS module, or code that uses your module's exports, you need to provide the WebBS editor with a new module dependency provider function.\n The editor is available here as a global variable called \"WebBSEditor\" and you'll want to set the .moduleInstanceProvider field to a function that takes an instance of the editor and returns an object with two fields:\n .imports : An object that contains the imports to be provided to your module.\n .onInit : A function that takes the WebAssembly instance, which is run upon instantiation.\n\n See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance for more information.\n\n The default module dependency provider looks like this:\n\n WebBSEditor.moduleDependencyProvider = ${this.moduleDependencyProvider.toSource()};\n `);\n\n return \"Good Luck!\";\n }", "function toggleHeadingSmaller(editor) {\n\t\t\tvar cm = editor.codemirror;\n\t\t\t_toggleHeading(cm, \"smaller\");\n\t\t}", "function toggleHeadingSmaller(editor) {\n\t\tvar cm = editor.codemirror;\n\t\t_toggleHeading(cm, \"smaller\");\n\t}", "function toggleHeadingSmaller(editor) {\n var cm = editor.codemirror;\n _toggleHeading(cm, 'smaller');\n}", "function expand() {;\n document.getElementById(\"description\").style.width = \"75vw\";\n document.getElementById(\"description\").style.overflow = \"auto\";\n document.getElementById(\"left-arrow\").style.display = \"none\";\n document.getElementById(\"right-arrow\").style.display = \"block\";\n}", "function toggleHeadingBigger(editor) {\n _toggleHeading(editor.codemirror, 'bigger');\n}", "function startLearningModule()\n{\n document.body.innerHTML=\"\";\n //Create the Back button to go back to the Welcome Screen\n learning_module_button=createButton(\"Back\",\"learning_module_button\");\n learning_module_button.onclick=createWelcomeScreen;\n document.body.appendChild(learning_module_button);\n\n //A Complex UI in in ui.js for the header section\n var learning_module_header_section=createComplexDiv(\"\",\"learning_module_div\",\"Learning Modules\",\"learning_module_header\",\"images/learn_icon.jpg\",\"620px\",\"320px\",\"learning_module_image\",\"This is just a short refresher on the concpets being used in the game for the young ones to get what is the concept behind addition,subtraction,multiplication and division. If you have the basic knowledge then you must go through the colours module only to et familiar with the colours being used in the game .Try to follow the sequence below and get your Journey towards being the Master Underway!!!!!!.\",\"learning_module_paragraph\");\n //Appending the element\n document.body.appendChild(learning_module_header_section);\n\n //Create the learn Colours button to get familiar with the colours being used in the game\n learning_module_colors_button=createButton(\"Colours\",\"learning_module_colors_button\");\n //Associaiting the learnColors function with the button.\n learning_module_colors_button.onclick=learnColors;\n\n //Create button to go to the Counting Lesson Module\n learning_module_counting_button=createButton(\"Counting\",\"learning_module_counting_button\");\n //Associating the learnCounting function with the button\n learning_module_counting_button.onclick=learnCounting;\n\n //Addition button creation to go to the Addition Learning Module\n learning_module_addition_button=createButton(\"Addition\",\"learning_module_addition_button\");\n //Associating the learnAddition button with the button click\n learning_module_addition_button.onclick=learnAddition;\n\n //Subtraction button creation to go to the Subtraction Module\n learning_module_subtraction_button=createButton(\"Subtraction\",\"learning_module_subtraction_button\");\n //Associating the learn subtraction button with the button\n learning_module_subtraction_button.onclick=learnSubtraction;\n\n //Multiplication button creation to go to the Multiplication Module\n learning_module_multiplication_button=createButton(\"Multiplication\",\"learning_module_multiplication_button\");\n //Associating the learn Multiplication button with the button\n learning_module_multiplication_button.onclick=learnMultiplication;\n\n //Division button creation to go to the division Module\n learning_module_division_button=createButton(\"Division\",\"learning_module_division_button\");\n //Associating the learn Division button with the button\n learning_module_division_button.onclick=learnDivision;\n\n\n //Appending the buttons to the screen.\n document.body.appendChild(learning_module_colors_button);\n document.body.appendChild(learning_module_counting_button);\n document.body.appendChild(learning_module_addition_button);\n document.body.appendChild(learning_module_subtraction_button);\n document.body.appendChild(learning_module_multiplication_button);\n document.body.appendChild(learning_module_division_button);\n\n}", "function animateHowTo() {\n\tbody.classList.add(\"howto-open\");\n}", "function resize() {\n\t\tpositionExpandedLevels();\n\t}", "function OogaahTutorialContent33() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function ResizeTop50() {\n AlterRatingHeights(top50ArcadeRatings, \"\", \"rating\");\n AlterRatingHeights(top50PinballRatings, \"\", \"rating\");\n}", "function OogaahTutorialContent38() {\n\tOogaahTutorialContent.apply(this, null); // construct the base class\n}", "function hello(){\n//Everything in here is a block\n}", "function initUfsjMore() {\n window.addEventListener(\"resize\", initUfsjMore)\n\n var more = document.getElementById(\"more\")\n var expand = document.getElementById(\"expand\")\n var clone = expand.cloneNode(true)\n clone.style.height = \"auto\"\n clone.style.opacity = 0\n clone.style.position = \"absolute\"\n expand.parentElement.appendChild(clone)\n window.ufsjMoreHeight = window.getComputedStyle(clone).height\n expand.parentElement.removeChild(clone)\n\n if (more.textContent === \"More\") {\n expand.style.height = \"0px\"\n }\n else {\n expand.style.height = ufsjMoreHeight\n }\n}", "function main() {\n addImage();\n hideRules();\n}", "function editor_tools_handle_small() {\n editor_tools_add_tags('[small]', '[/small]');\n editor_tools_focus_textarea();\n}", "function customizeWiki() {\n addCharSubsetMenu();\n addHelpToolsMenu();\n addDigg();\n talkPage();\n}", "function wrapExpandables (sel) {\n // Wrap snippets\n !function () {\n var $snippets = $('.is-snippet-wrapper').filter(':visible');\n\n _.forEach($snippets, function (snippet) {\n var snippetHeight = snippet.clientHeight,\n codeHeight,\n $snippet;\n\n // This snippet is most likely limited via CSS\n // The value we're looking for is 200, but since we're comparing with clientHeight (which doesn't include borders)\n // we're using 198 as the comparison, allowing for a 1px border. We could use offsetHeight instead, but that's\n // considered slower than clientHeight.\n if (snippetHeight >= (200 - 2)) {\n snippet.className.indexOf('is-expandable') === -1 &&\n (snippet.className += ' is-expandable');\n }\n });\n }();\n\n // Wrap tables in the markdown\n !function () {\n var $tables = $('.is-table-wrapper');\n\n _.forEach($tables, function (table) {\n var tableHeight = table.clientHeight,\n tableWidth = $(table).children('table').get(0).clientWidth,\n maxWidth = table.clientWidth,\n codeHeight,\n $table;\n\n // This table is most likely limited via CSS\n if (tableHeight >= 500 || tableWidth > maxWidth) {\n table.className.indexOf('is-expandable') === -1 &&\n (table.className += ' is-expandable');\n }\n });\n }();\n}", "function minimizeAllExpandedBlocks(){\n\tinjector = [];\n\tattachedImages = [];\n\tfilledClusters = [];\n\texpandedImages = 0;\n}", "function toggleHeadingBigger(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"bigger\");\n}", "function toggleHeadingBigger(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"bigger\");\n}", "function toggleHeadingBigger(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"bigger\");\n}", "function toggleHeadingBigger(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleHeading(cm, \"bigger\");\n}", "setSize(width, height) {\n this._codeMirror.setSize(width, height);\n this._codeMirror.refresh();\n }", "function help() {\n\n}", "function DisplayModeFunctions() {\r\n hideAnchorImages();\r\n youtubeLinkReplace();\r\n replaceAudioLinkWithEmbed();\r\n replaceEmbedContainerWithCode();\r\n}", "runAllCodeChunks() {\n if (!this.config.enableScriptExecution) {\n return;\n }\n const codeChunks = this.previewElement.getElementsByClassName(\"code-chunk\");\n for (let i = 0; i < codeChunks.length; i++) {\n codeChunks[i].classList.add(\"running\");\n }\n this.postMessage(\"runAllCodeChunks\", [this.sourceUri]);\n }", "function start_expanding() {\r\n setTimeout(change_cagle_thumbs, wait);\r\n}", "function expandCurrent() {\n var editor = EditorManager.getFocusedEditor();\n if (editor) {\n var cursor = editor.getCursorPos(), cm = editor._codeMirror;\n cm.unfoldCode(cursor.line);\n }\n }", "function parse(){\n var syntax = esprima.parse(editor.getValue());\n codeArray = [];\n expand(syntax.body, codeArray, 0);\n}", "function enlarge()\r\n\t{\r\n\t\t//var portwidth = (gl.viewportWidth-2) * 2 + 2;\r\n\t\t//gl.viewportWidth = portwidth;\r\n\t\tvar canvas = document.getElementById(\"lesson01-canvas\");\r\n\t\tvar cwidth = canvas.width;\r\n\t\tvar cheigth = canvas.heigth;\r\n\t\tcanvas.width = (cwidth-2)*2 + 2;\r\n\t\tdrawScene();\r\n\t}", "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 ManageEmbed(){}", "function showRequestedSnippet(container, requestedSnippetName, toggle) {\n console.log(snippetAndExpansionState);\n const state = snippetAndExpansionState[container];\n const snippetNamesEqual = requestedSnippetName === state.activeSnippetName;\n const snippetNamesDifferent = !snippetNamesEqual;\n if (state.activeSnippetName !== undefined && (snippetNamesDifferent || snippetNamesEqual && toggle))\n $(state.activeSnippetName).removeClass(\"bullet-point-active\");\n const newExpansionTarget = findExpansionTarget(container, requestedSnippetName)\n if (newExpansionTarget !== state.activeExpansionTarget || snippetNamesDifferent) {\n state.activeSnippetName = requestedSnippetName;\n if (state.activeSnippetExplanation !== undefined) {\n state.activeSnippetExplanation.slideUp(\"fast\", () => {\n state.activeSnippetExplanation.remove();\n state.activeSnippetExplanation.empty();\n $(state.activeExpansionTarget).removeClass(\"col-md-12\").removeClass(\"code-snippet\");\n state.activeExpansionTarget = newExpansionTarget;\n $(state.activeSnippetName).addClass(\"bullet-point-active\")\n state.activeSnippetExplanation = $(\"#hidden-\" + state.activeSnippetName.substring(1)).clone(true);\n $(newExpansionTarget).append(state.activeSnippetExplanation);\n $(newExpansionTarget).addClass(\"col-md-12\").addClass(\"code-snippet\");\n state.activeSnippetExplanation.slideDown(\"fast\");\n state.activeSnippetExplanation.css(\"display\", \"flex\");\n });\n } else {\n state.activeExpansionTarget = newExpansionTarget;\n $(state.activeSnippetName).addClass(\"bullet-point-active\")\n state.activeSnippetExplanation =\n $(\"#hidden-\" + state.activeSnippetName.substring(1)).clone(true);\n $(newExpansionTarget).append(state.activeSnippetExplanation);\n $(newExpansionTarget).addClass(\"col-md-12\").addClass(\"code-snippet\");\n state.activeSnippetExplanation.slideDown(\"fast\");\n state.activeSnippetExplanation.css(\"display\", \"flex\");\n }\n } else if (state.activeSnippetName !== undefined && snippetNamesEqual && toggle) {\n state.activeSnippetExplanation.slideUp(\"fast\", () => {\n state.activeSnippetExplanation.remove();\n state.activeSnippetExplanation.empty();\n $(state.activeExpansionTarget).removeClass(\"col-md-12\").removeClass(\"code-snippet\");\n state.activeSnippetName = undefined;\n state.activeSnippetExplanation = undefined;\n state.activeExpansionTarget = undefined;\n });\n }\n}", "function kata23() {\r\n // Your Code Here\r\n}", "function expandAll() {\n var editor = EditorManager.getFocusedEditor();\n if (editor) {\n var cm = editor._codeMirror;\n CodeMirror.commands.unfoldAll(cm);\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 }", "function customizeWiki() {\n addCharSubsetMenu();\n addHelpToolsMenu();\n addDigg();\n}", "function kata25() {\r\n // Your Code Here\r\n}", "function exercise11() {}", "function kata26() {\r\n // Your Code Here\r\n}", "function kata32() {\r\n // Your Code Here\r\n}", "onResize() {\n this.editor.refresh();\n }", "function help(){\r\nalert(\"Pre-Programmed Functions:\\n\\n1. Change Background Color:\\ncolor('red')\\n\\n2. Display (reveal) all embeded objects\\nembed()\");}", "function PREVIEW$static_(){ToolbarSkin.PREVIEW=( new ToolbarSkin(\"preview\"));}", "function increaseEditorFontSize(){\n //Upper limit for the font size\n if(editorFontSize >= 200){\n console.log(\"Can't increase font anymore\");\n return;\n }\n\n editorFontSize++;\n $('.CodeMirror').css('font-size', editorFontSize + 'px');\n\n setTimeout(function() {\n myCodeMirror.refresh();\n }, 1);\n}", "function kata30() {\r\n // Your Code Here\r\n}" ]
[ "0.5884831", "0.5861695", "0.57132167", "0.5552831", "0.55197155", "0.5501783", "0.54489464", "0.54361385", "0.54100937", "0.5300956", "0.527157", "0.5257795", "0.5243929", "0.5239504", "0.51865286", "0.5186303", "0.518126", "0.51614493", "0.51585096", "0.5150986", "0.5141165", "0.513939", "0.5123883", "0.51137924", "0.5106048", "0.51009995", "0.51009995", "0.50962955", "0.50962955", "0.50962955", "0.50962955", "0.50883895", "0.5074774", "0.5069845", "0.50629336", "0.5059709", "0.5059569", "0.50588256", "0.5057701", "0.5045547", "0.5036845", "0.5034586", "0.50207686", "0.50066423", "0.49922287", "0.49888623", "0.4984888", "0.49826053", "0.49667707", "0.49665186", "0.4965127", "0.49590087", "0.49566272", "0.49525413", "0.4952152", "0.49497265", "0.4948293", "0.49476352", "0.4947392", "0.49453756", "0.49448115", "0.49445093", "0.49344352", "0.49147233", "0.49131683", "0.4911865", "0.4907963", "0.4899602", "0.4899272", "0.48927847", "0.48899654", "0.48785716", "0.48784354", "0.487779", "0.487779", "0.487779", "0.487779", "0.4876706", "0.48753983", "0.48695356", "0.48651102", "0.48600265", "0.4859938", "0.48547179", "0.48517767", "0.48494777", "0.4836107", "0.48330653", "0.48305067", "0.48291242", "0.48269364", "0.48247984", "0.4822967", "0.48145244", "0.4813671", "0.48098952", "0.4808922", "0.48070252", "0.47998327", "0.4797667", "0.47969696" ]
0.0
-1
Call this method for tutorials with deprecated content, it will display a message in the beginnig of the page stating that the tutorial is deprecated. Pass a string if you want to display any other text.
function displayDeprecatedWarning(text) { var container = $('<div />', { 'class': 'deprecated-container' }); var cell = $('<div />', { 'class': 'deprecated-cell' }).appendTo(container); var p = $('<p />', { 'text': text != null ? text : 'Functionality explained in this tutorial has been deprecated and should not be used for any new products!' }).appendTo(cell); var header = $('.c1'); if(header.length !== 0) { container.insertAfter(header); } else { container.prependTo($('.body-content')); } var closeSymbol = $('<div />', { 'class': 'close-warning' }); var span = $('<span />', { 'class': 'glyphicon glyphicon-remove' }).appendTo(closeSymbol); closeSymbol.appendTo(container); closeSymbol.click(function() { container.hide(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onTutorialDone() {\n this.show();\n this.app.message('The tutorial is always available in the settings menu at the bottom right.',5000)\n }", "function deprecated(details) {\n console.log('Deprecated API usage: ' + details);\n }", "function showHelp(helpMessage) {\n $(\"#helpBox\").text(helpMessage)\n }", "function deprecated(details) {\n warn('Deprecated API usage: ' + details);\n}", "function OBSOLETE(what,hint) {\r\n Ezer.fce.echo(\"WARNING - \\\"\",what,\"\\\" is OBSOLETE\",(hint ? ` - use \\\"${hint}\\\" instead` : ''));\r\n}", "function warnOnLatestVersion() {\n\n // The warning text and link is really specific to RTD hosting,\n // so we can just check their global to determine version:\n if (!window.READTHEDOCS_DATA || window.READTHEDOCS_DATA.version !== \"latest\") {\n return; // not latest, or not on RTD\n }\n\n var warning = document.createElement('div');\n warning.setAttribute('class', 'admonition danger');\n warning.innerHTML = \"<p class='first admonition-title'>Note</p> \" +\n \"<p class='last'> \" +\n \"This document is for an <strong>unreleased development version</strong>. \" +\n \"Documentation is available for the <a href='/en/stable/'>current stable release</a>, \" +\n \"or for older versions through the &ldquo;v:&rdquo; menu at bottom right.\" +\n \"</p>\";\n warning.querySelector('a').href = window.location.pathname.replace('/latest', '/stable');\n\n // modified from original to work better w/ pydata sphinx theme\n var parent = document.querySelector('main') || document.body;\n parent.insertBefore(warning, parent.firstChild);\n}", "function showHelp() {\n\t$(\"#info\").html(`Search for an artist that has live shows <i>(albums with a full date in the title)</i> available on Spotify, e.g. <a href=\"index.html?q=grateful-dead\">Grateful Dead</a> or <a href=\"index.html?q=the-allman-brothers-band\">The Allman Brothers Band</a>, to see their live shows in chronological order. Looks best on Chrome or Firefox, and designed to work on mobile and tablets as well.`);\n}", "function warn_deprecation(message, untilVersion) {\n console.warn('Deprecation: ' + message + (untilVersion ? '. This feature will be removed in ' + untilVersion + '.' : ' the near future.'));\n console.trace();\n}", "function warn_deprecation(message, untilVersion) {\n console.warn('Deprecation: ' + message + (untilVersion ? '. This feature will be removed in ' + untilVersion + '.' : ' the near future.'));\n console.trace();\n}", "function hideHelpMessage() {\n $('#helpMessage').html('').hidev();\n}", "function introduction() {\n\tconsole.log(\"Welcome to Coding at Philz! Let's get started! \\n . \\n . \\n\");\n\tconsole.log(\"You are going to have to blend in! Let's hit your closet! \\n . \\n . \\n\")\t\n}", "function not_enogh_mony() {\n console.log(\"you dont have enuogh mony to buy that\")\n warningHeader.innerHTML = \"you dont have enuogh to buy that\"\n}", "function showWarningToast(title, body, code = 'warning') {\n showToast(title, body, 'warning', code);\n}", "function deprecateTaskWarning() {\n const pattern = '~ * ';\n log(cyan(pattern.repeat(27)));\n log(red('Attention Please!'));\n log(\n cyan('gulp test [--unit | --integration]'),\n 'has been renamed to new, separate tasks:',\n cyan('gulp unit'),\n 'and',\n cyan('gulp integration.')\n );\n log(\n cyan('--local-changes'),\n 'has been changed to',\n cyan('--local_changes'),\n 'and',\n cyan('--saucelabs-lite'),\n 'has been renamed to',\n cyan('--saucelabs')\n );\n log(\n 'All other flags remain the same and our documentation has been updated to reflect these changes.'\n );\n log('Thanks!', red('<3'), '@ampproject/wg-infra');\n log(cyan(pattern.repeat(27)));\n}", "function displayDescriptionTeddy(teddyDescription) {\n let desc = document.querySelector('#description')\n desc.innerHTML = teddyDescription\n}", "function deprecationWarn(msg) {\n if (environment_1.ENV.getBool('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}", "function help() {\n var helpmsg =\n '!ouste : déconnecte le bot\\n' +\n '!twss : ajoute la dernière phrase dans la liste des TWSS\\n' +\n '!nwss : ajoute la dernière phrase dans la liste des Non-TWSS\\n' +\n '!chut : désactive le bot\\n' +\n '!parle : réactive le bot\\n' +\n '!eval : évalue la commande suivante\\n' +\n '!dbg : met le bot en debug-mode, permettant de logger toute son activité\\n' +\n '!undbg : quitte le debug-mode\\n' +\n '!help : affiche ce message d\\'aide';\n client.say(channel, helpmsg);\n bot.log('message d\\'aide envoyé');\n}", "function about(){\n try {\n if(working){\n errorFiller(\"Sobre la Aplicación\", \"Himnario evangélico y Santa Biblia Reina-Valera 1960 (RV1960). Desarrollado por Marcos Bustos C. para la Gloria de Dios.\", \"ok\");\n }\n } catch (error) {\n errorFiller(\"Error\", \"Ha ocurrido un error fatal en el proceso de visualización del acerca de. No podrá seguir funcionando el sistema. Intente reiniciar la página con la tecla F5. Si el error es continuo, contacte con el administrador del sistema.\", \"error\");\n }\n}", "showAbout() {\n alert(`<img src=\"images\\\\Icon-sm.png\" />&nbsp; &nbsp;\n <strong style=\"color:#000;font-size:1.4em;\">Markdown Viewer</strong>\n <span class =\"small\">&nbsp; ${controller.version()}</span>\n <br />\n <em style=\"font-size:8pt;margin-left:30px;\">... view Markdown as it was meant to be viewed ...</em>\n <blockquote>A clean and quick Markdown file viewer for Windows.</blockquote>\n <div style=\"font-size:7pt;margin-left:10px;\">\n <img src=\"images\\\\ComputeIconSmall.jpg\" style=\"height:20px;\" /> Compute Software Solutions<sup>&copy; </sup></div>`, 'info');\n }", "function updateWarning(display = false) {\n\t\tsetupForm.querySelector(\"[warning-text]\").innerHTML = display\n\t\t\t? text[\"setup\"][\"warning\"][game.getCurrentLang()]\n\t\t\t: \"\";\n\t}", "function helpMeInstructor(err) {\n console.info(\n `\n Did you hit CORRECT the endpoint?\n Did you send the CORRECT data?\n Did you make the CORRECT kind of request [GET/POST/PATCH/DELETE]?\n Check the Kwitter docs 👉🏿 https://kwitter-api.herokuapp.com/docs/#/\n Check the Axios docs 👉🏿 https://github.com/axios/axios\n TODO: troll students\n `,\n err\n );\n}", "get deprecated() {\n return false;\n }", "function deprecationWarn(msg) {\n if (Object(_environment__WEBPACK_IMPORTED_MODULE_1__[\"env\"])().getBool('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}", "_maybeRenderDevelopmentModeWarning() {\n if (__DEV__) {\n const learnMoreButton = (\n <Text onPress={this._handleLearnMorePress} style={styles.helpLinkText}>\n Learn more\n </Text>\n );\n\n return (\n <Text style={styles.developmentModeText}>\n Development mode is enabled, your app will be slower but you can use useful development\n tools. {learnMoreButton}\n </Text>\n );\n } else {\n return (\n <Text style={styles.developmentModeText}>\n You are not in development mode, your app will run at full speed.\n </Text>\n );\n }\n }", "function helpNav(){\n helpBox.innerHTML = \"<h3 style='color: white; font-style: italic'>This is the navigation bar. It displays links to other basic applications on the site. Authentication is also listed.</h3>\";\n showHelp();\n }", "function deprecationWarn(msg) {\n if (exports.ENV.get('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}", "function FreeTextDocumentationView() {\r\n}", "function action_help_texts(section) {\n\t$('div.step1details div.tips').hide();\n\tvar open_section = $('div#sideinfo-'+ section);\n\topen_section.show();\n}", "function showNeedHelpUrl() {\n\tremoveMessageFromDivId();\n\tremoveSuccessOrFailureStrip();\n\tbookmarks.sethash('#moreinfo',showFooterPopup, messages['gettingStartedUrl']);\n\treturn false;\n}", "function fallback() {\n assistant.tell(HELP_MESSAGE);\n }", "function showHelpUsage() {\n let helpString = \"Hei, olen Relluassari! Yritän auttaa sinua relaatioiden ratkonnassa ;) \\n\" +\n \"<<< Koska olen vielä beta, älä pahastu jos en osaa jotain, tai kaadun kesken kaiken >>> \\n\" +\n \" \\n Miten kutsua minut apuun? \\n \" +\n \" TL;DR? Klikkaa tunnettua -> klikkaa tuntematonta -> klikkaa tuntematonta -> ... -> Repeat \\n\" +\n \" \\nEli miten? \\n\" +\n \" 1) Klikkaa graafista tunnettua sanaa \\n\" +\n \" -> Relluassari tekee Wikipediasta, Bingistä, Wiktionarystä ja Ratkojista lähdehaut ko. sanalla. \\n\" +\n \" 2) Kun haku valmis, klikkaa graafista tunnettuun kytkettyä tuntematonta sanaa \\n\" +\n \" -> Relluassari parsii hakutuloksista klikatun pituiset sanat ja brutettaa rellua niillä. \\n\" +\n \" 3) Kun brutetus valmis, klikkaa seuraavaa tunnettuun kytkettyä tuntematonta \\n\" +\n \" -> Relluassari parsii hakutuloksista klikatun pituiset sanat ja brutettaa rellua niillä. \\n\" +\n \" 4) Valitse uusi tunnettu sana lähteeksi ja siirry kohtaan 1) \\n\" +\n \"\\nAdvanced usage: \\n\" +\n \" Menu>Suorita lähdehaku (teemasana) - tekee lähdehaun vain teemasanalla \\n\" +\n \" Menu>Suorita lähdehaku (oma sana) - tekee lähdehaun syöttämälläsi sanalla/sanoilla (esim. usean sanan hakuun Bingistä) \\n\" +\n \" Menu>Parsi hakutulos sanoiksi - parsii hakutuloksesta *kaikkien* näkyvien tuntemattomien pituiset sanat \\n\" +\n \" Menu>Bruteta sanalista - brutettaa rellua sen hetken muistissa olevalla koko sanalistalla \\n\";\n alert(helpString);\n}", "function showAbout(){\n\talert(\"Niven is a browser based text editor.\\n\\nUse and modification of this tool are covered by the APACHE 2 license\\nviewable at http://www.apache.org/licenses/LICENSE-2.0\");\n}", "function showWarningMessage(sMessage) {\n ppsc().showWarningMessagePane(sMessage);\n}", "function StringHelp() {\n}", "function addWarningMessage(warningMessage) {\n let warningHolder = document.getElementById('warnings-holder');\n let warningMessageParagraph = document.createElement('p');\n\n warningMessageParagraph.innerHTML = warningMessage;\n warningHolder.appendChild(warningMessageParagraph);\n}", "function makeWarning(text) {\n let div = document.createElement(\"div\");\n let title = document.createElement(\"h2\");\n title.innerText = \"Information Importante\";\n let p = document.createElement(\"p\");\n p.innerText = text;\n div.append(title, p);\n return div;\n}", "function pickHelp(context) {\n var helpMessage = \"\";\n helpMessage = \"<p>Click on UI elements to find out more about them.<br>Click <b>?</b> to hide this pane.<br>Go <a href='changelog.html' >here</a> to see the list of changes and coming features.</p>\";\n return helpMessage;\n }", "function badUsage(message) {\n console.log(`${message}\nUse -h to get an overview of the command.`);\n}", "function warnBeforeEditing ()\n{\n return confirm( \"!!!!! WARNING !!!!!\\n\\nThis page is a Lurch document, and should not be edited on the wiki.\\n\\nUnless you know the internal format of such documents very well, YOU MAY CORRUPT YOUR DATA. Do you wish to proceed despite the risk?\\n\\nChoose OK to edit anyway.\\nChoose Cancel to cancel the edit action.\" );\n}", "function help() {\n\tvar message;\n\tmessage = \"The following are valid text commands: N or n to move North, S or s to move South, W or w to move West, E or e to move East, or T or t to take an item at a given location.\";\n\tdocument.getElementById(\"Help\").innerHTML = message;\n}", "function deprecatedWarning(oldMethodCall, newMethodCall) {\n\t // eslint-disable-next-line no-console\n\t console.warn('WARNING: ' + oldMethodCall + ' will be deprecated soon! Please use ' + newMethodCall + ' instead.');\n\t}", "function supportWarning() {\n // Checks for support of versions 0 and 1 of custom elements\n const supportsCustomElementsv0 = \"registerElement\" in document;\n const supportsCustomElementsv1 = \"customElements\" in window;\n\n // If not supported, replaces body with warning message\n if (!supportsCustomElementsv0 && !supportsCustomElementsv1) {\n const main = document.getElementsByTagName(\"body\")[0];\n main.innerHTML = \"\";\n\n const div = document.createElement(\"div\");\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n div.style.background = \"#293241\";\n div.style.color = \"#e0fbfc\";\n div.style.display = \"flex\";\n div.style.flexDirection = \"column\";\n div.style.textAlign = \"center\";\n div.style.justifyContent = \"center\";\n div.style.alignItems = \"center\";\n main.appendChild(div);\n\n const h1 = document.createElement(\"h1\");\n h1.innerText = \"Your browser does not support custom elements\";\n div.appendChild(h1);\n\n const p = document.createElement(\"p\");\n p.innerHTML =\n \"This website uses Web Components, which your browser does not support. <br> Are you using <strong>Safari</strong> or <strong>Internet Explorer</strong>? <br> Try using Firefox or a Chromium-based browser instead.\";\n div.appendChild(p);\n\n return false;\n }\n\n return true;\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 onHelpButtonClick() {\n\t\t\talert(\"帮助:\\n\\n\" +\n\t\t\t\t\"##用得开心就好!##\\n\\n\" +\n\t\t\t\t\"\", \"SPRenderQueueTools\"\n\t\t\t);\n\t\t}", "function showHelpMessage(hm) {\n $('#helpMessage').html(hm).showv();\n}", "function deprecatedWarning(oldMethodCall, newMethodCall) {\n // eslint-disable-next-line no-console\n console.warn('WARNING: ' + oldMethodCall + ' will be deprecated soon! Please use ' + newMethodCall + ' instead.');\n}", "function showImportantMessage(sMessage) {\n ppsc().showImportantPane(sMessage);\n}", "function PageDocumentation() {\n\tComponentBase.call(this);\n}", "exampleHelper() {\n this.props.exampleAction(true);\n if (!this.props.exampleVariable) {\n return <Text style={styles.text}>{'My template has been fiddled with'}</Text>;\n }\n return <Text style={styles.text}>{'Hello World! Welcome to my template'}</Text>;\n }", "function showWarning(message){\n\t\n\t// creating warning element\n\tvar warningElement = document.createElement('div')\n\twarningElement.id = 'warning'\n\twarningElement.className = 'warning'\n\t\n\t// creating close button\n\tvar closeButton = document.createElement('img')\n\tcloseButton.className = 'close-button'\n\twarningElement.onclick = function(event){\n\t\tvar warningElement = event.target\n\t\twarningElement.parentNode.removeChild(warningElement)\n\t}\n\t\n\t// appending button and text\n\t// to warning element\n\twarningElement.appendChild(closeButton)\n\twarningElement.textContent = message\n\t\n\t// displaying\n\tvar toolbarElement = document.getElementById('toolbar')\n\ttoolbarElement.parentNode.insertBefore(warningElement, toolbarElement)\n\t\n}", "function displayGuide() {\n my.html.guide.innerHTML = my.current.unit.guide\n }", "function renderIntro (message) {\n\n // Initialize Dompiler.\n let {\n compile\n } = new Dompiler().withBinding();\n\n // Compile markup string into a document fragment.\n let markup = `\n <p>\n ${message}\n </p>\n `,\n compiled = compile(markup);\n\n // Return the document fragment.\n return compiled;\n\n}", "function publicWarning(message) {\n publicMessageLabel.className = 'warning';\n publicMessageLabel.innerHTML = message;\n console.warn(message);\n}", "function S_templateStrings1() {\n // code snippet begin ----\n let firstName = \"Petra\";\n let lastName = \"Grimes\";\n\n /* introduction string, containing single AND\n double quotes, as well as two placeholders */\n let intro = `Let's introduce ${firstName} ${lastName} \"officially\"!`;\n\n console.log(intro); \n // code snippet end ----\n \n setInnerHTML(\"#result-text-1\", intro);\n}", "function sayHello(name, yts){\n console.log(`Hello ${name} you are ${yts} away from success`);\n}", "function displayHelpPage() {\n // Set display to \"no category selected\".\n pageCollection.setCategory('noCat');\n // Display the default page.\n pageCollection.setPage('helpPage');\n}", "function ksfCanvas_toolDescription(msg)\n{\n\tvar tool_description = $(TOOL_DESCRIPTION);\n\tif(tool_description !== null)\n\t{\n\t\ttool_description.text(msg);\n\t}\n}", "function buckyTutorials() {\n\tbuckyHTML();\n\tbuckyAngularJS();\n}", "function displayMessage(message) {\n const warningMessage = (document.querySelector('.warning-message').textContent = message);\n return warningMessage;\n}", "function triggerWarning(){\n let warning = document.getElementById('sl__warning');\n\n warning.style.display = \"block\";\n warning.innerHTML = \"Por favor, insira pelo menos <strong>1</strong> item\";\n}", "function usage(){\n\tmsg.setBodyAsHTML('Bash Help:');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Display a Quote: /bash [integer]');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Display a Random Quote: /bash random');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Display Help: /bash help');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Ex: /bash 5273');\n\tview.echoSentMessageToDisplay(msg);\n}", "function describeMe() {\n\t// var supportMsg = $('.support-msg');\n\tvar describe = $('.describe-me');\n\tvar adjectives = ['a minimalist', 'a female in tech', 'an avid hiker', 'a life-long learner', 'a foodie and traveler', 'a web developer'];\n\t\tvar randomNum = Math.floor(Math.random() * 6);\n\t\tdescribe.html(adjectives[randomNum]);\n}", "function webbnote_error( warning ) {\n\tif ( warning.length === 0 ) return;\n\t\n\tvar error_string = '';\n\t\n\t// Check if\n\tif ( Object.prototype.toString.apply( warning ) === '[object Array]' ) {\n\t\tfor( var i = 0, length = warning.length; i < length; i++ ) {\n\t\t\terror_string += '<li>' + warning[ i ] + '</li>';\n\t\t}\n\t} else {\n\t\terror_string += '<li>' + warning + '</li>';\n\t}\n\t\n\t$( 'body' ).prepend( '<div class=\"page warning\"><h1>Ett fel uppstod</h1><ul>' + error_string + '</ul></div>' );\n}", "function updateTaskDescription(taskIdx) {\n var html = g_lessons[0].tasks[taskIdx][1];\n if (html == '') html = '(none)';\n $('#task_description').html(html);\n}", "function help() {\n swal({\n title: \"Help\",\n text: '<div id=\"placeholder\"></div>',\n showCancelButton: true,\n showConfirmButton: false,\n html: true,\n cancelButtonText: \"Close\"\n });\n $(\"#placeholder\").load(\"popups/help.html\");\n}", "function showFailedMessage() {\n\tlet html = `\n\t\t<div class=\"fail msg\">Sorry! Something went wrong. The API could not load. <br> Please try again later.</div>\n\t`;\n\n\t$('body').append(html);\n\n\t$('.fail').css('left', '10px');\n}", "static about() {\n return \"a vehicle is a means of transportion.\"\n }", "function loadText() {\n vm.aboutTitle = 'About';\n vm.aboutDesc = 'Hi! I\\'m '\n + UserService.getUser()\n + '. This is the about page.';\n }", "function displayWarning() {\n warn(\"block\");\n setTimeout(() => {\n warn(\"none\");\n }, 10000);\n }", "function menuTutorials(heading, unchanged, items) {\n var itemsMatch = items.match(/<li>((?!<\\/li>).)*<\\/li>\\s*/g);\n var itemsNew = items;\n if (itemsMatch) {\n itemsNew = '';\n itemsMatch.forEach(function(item) {\n if (!item.match(/REST_API/)) {\n itemsNew += ' ' + item + '\\n';\n // console.log('tutorials: ',item);\n }\n });\n }\n\n return heading + '\\n' + ' '\n + unchanged + '\\n'\n + itemsNew + ' ';\n}", "function showText() {\n\tfiglet('Twitch', function(err, data) {\n\t if (err) {\n\t console.log('Something went wrong...');\n\t console.dir(err);\n\t return;\n\t }\n\t console.log(data);\n\t console.log(' Twitch streamers status '.inverse + '\\r\\n');\n\t //console.log('loading...');\n\t});\n}", "function displayHelp()\n{\n // Replace the following call if you are modifying this file for your own use.\n dwscripts.displayDWHelp(HELP_DOC);\n}", "function help() {\n\n}", "function formatPlain(msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp\n + ' ' + this._namespace\n + ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain(msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp\n + ' ' + this._namespace\n + ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain(msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp\n + ' ' + this._namespace\n + ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function displayInfoText(newMessage) {\n\tsetupWebKitGlobals();\n\t\n\tif (globals.webKitWin.setString) {\n\tglobals.webKitWin.setString(\"staticTextArea\", newMessage);\n}\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function formatPlain (msg, caller, stack) {\n var timestamp = new Date().toUTCString()\n\n var formatted = timestamp +\n ' ' + this._namespace +\n ' deprecated ' + msg\n\n // add stack trace\n if (this._traced) {\n for (var i = 0; i < stack.length; i++) {\n formatted += '\\n at ' + callSiteToString(stack[i])\n }\n\n return formatted\n }\n\n if (caller) {\n formatted += ' at ' + formatLocation(caller)\n }\n\n return formatted\n}", "function DisplayInfo(){\n\t$(\"#content\").html('');\n\t\n\t$(\"#content\").append(\"<div class='page-header'><h1>\"+Language[\"Hints\"]+\"</h1></div>\");\n\tif (Debug)\n\t\tAddWarning();\n\t$(\"#content\").append(Language[\"WelcomeText\"]);\n\t$(\"#content\").append(\"<a id='startTestButton' class='btn btn-primary btn-lg' role='button'>\"+Language[\"StartTest\"]+\"</a>\");\n\t$(\"#content\").fadeIn();\n\t$(\"#startTestButton\").click(function(){\n\t\tLoadQuestion(-1);\n\t});\n;}", "function deprecated(oldMethod, newMethod) {\n\t if (!deprecationWarnings_) {\n\t return;\n\t }\n\n\t console.warn(oldMethod + ' is deprecated, please use ' + newMethod + ' instead.');\n\t}", "function DisclaimerText() {\r\n\t//if you do not want a disclaimer, comment out the line below, if you want a disclaimer, take out the comment marks and place the text in the \"Disclaimer Text\" area.\r\n\t//alert(\"Disclaimer text.\" + '\\n' + '\\n' + \"More text.\" + '\\n' + '\\n');\r\n}", "function help() {\n console.log(`Today I Learned\n\n Run locally with:\n\n node ./til.js\n\n Usage:\n\n til add \"something cool i learned today\"\n adds an entry to your TIL DB\n til list\n shows all entries, day by day\n til help\n shows this message\n `)\n process.exit(0);\n}", "warning(...parameters)\n\t{\n\t\tconsole.log(colors.yellow(this.preamble, '[warning]', generate_log_message(parameters)))\n\t}" ]
[ "0.6155814", "0.60845333", "0.5817553", "0.57777125", "0.5719948", "0.5641764", "0.5538467", "0.55131286", "0.55131286", "0.54956704", "0.547804", "0.54641485", "0.54181254", "0.5416328", "0.54139847", "0.5406566", "0.540531", "0.5400667", "0.53845036", "0.53598875", "0.5313295", "0.5310758", "0.5297333", "0.5284434", "0.52831715", "0.52779", "0.5252687", "0.52401143", "0.52140236", "0.52121985", "0.5180489", "0.51637703", "0.5143025", "0.51419145", "0.5140993", "0.5132751", "0.51286936", "0.5119884", "0.5111696", "0.5099455", "0.5091361", "0.5089204", "0.5079199", "0.506151", "0.5053554", "0.50497663", "0.50495106", "0.50442815", "0.5043306", "0.5032301", "0.5025969", "0.50254697", "0.50238454", "0.50237757", "0.5021171", "0.5016964", "0.49998304", "0.49991786", "0.49980608", "0.49863854", "0.4982694", "0.4979861", "0.49709508", "0.49704143", "0.4968432", "0.49673173", "0.49652985", "0.4963335", "0.49563164", "0.49539983", "0.4952924", "0.49518907", "0.4944622", "0.4932795", "0.4932795", "0.4932795", "0.49327508", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.4928914", "0.49272", "0.4922947", "0.49223384", "0.4920831", "0.49172273" ]
0.6557683
0
helper function to transform array of answers into radio options for our HTML form
function createQuestionsHTML() { return QUESTIONS[currentQuestionIndex].answers .map((question, index) => { return ` <div class="answer"> <input type="radio" name="answer" value="${index}" id="option${index}" class="pr-2"/> <label for="option${index}">${question.text}</label> </div>` }) .join('\n') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function answers() {\n // for loop through answerlist\n for (var i = 0; i < triviaQuestions[currentQuestion].answerList.length; i++) {\n var choice = $(\"<input>\")\n choice.attr(\"type\", \"radio\")\n choice.attr(\"id\", triviaQuestions[currentQuestion].answerList[i])\n choice.attr(\"name\", triviaQuestions[currentQuestion].answerList)\n choice.attr(\"value\", triviaQuestions[currentQuestion].answerList[i])\n var label = $(\"<label>\")\n label.attr(\"for\", triviaQuestions[currentQuestion].answerList[i])\n label.html(triviaQuestions[currentQuestion].answerList[i])\n $(\".answers\").append(choice, label);\n }\n }", "function multipleChoice(question){\n\t\n\tvar answers = $(\"<div></div>\").addClass(\"answers\");\n\tvar form = $(\"<form></form>\").addClass(\"multipleChoice\");\n\tform.attr(\"id\", question.questionname);\n\t\n\tfor (var j in question.answers){\n\t\tvar name = question.questionname;\n\t\tvar value = question.answers[j];\n\t\tvar ans = $('<input type=\"radio\">');\n\t\tans.attr(\"name\", name);\n\t\tans.attr(\"value\", value);\n\t\tans.attr(\"id\", value);\n\t\tans.appendTo(form).after($(\"<br>\")).after(question.answers[j]);\n\t}\n\t\n\tform.appendTo(answers);\n\t\n\treturn answers;\n}", "function getAnswerHtml (arrAns) {\n\n let ansHtml = arrAns.map( function (item, ind) {\n return `\n <div class='qna_text answer'>\n <label class='custom_radio' for='${ind}'>\n <input type='radio' id='${ind}' name='answer' value='${ind}' required> \n ${item.text}\n </label>\n </div>`;\n });\n\n return `\n <form class='js-submit'>\n <fieldset name='AnswerOption'>\n ${ansHtml.join(\"\")}\n </fieldset>\n </form>`;\n \n}", "function radioButtons(ary, qNum) {\n var answers = [];\n for (i = 0; i < ary.length; i++) {\n answers.push('<label><input type=\"radio\" name=\"' + qNum + '\" value=\"' + ary[i] + '\">' + ary[i] + '</label>');\n }\n return answers.join(\" \");\n }", "createRadioButtonItems(array, index1) {\n let html = '';\n array.forEach((item, index2)=>{\n html += `\n <div class=\"form-check\">\n <input class=\"form-check-input\" type=\"radio\" name=\"answer${index1}\" id=\"${index1}${index2}\" value=\"${item}\" required>\n <label class=\"form-check-label\" for=\"${index1}${index2}\">${item}</label> \n </div> \n `; // this is going to be the html created for the radio buttoms\n });\n return html;\n }", "function generateAnswers() {\r\n let answerList = '';\r\n const answerArray = STORE.questions[STORE.questionNumber].answers\r\n let i = 0;\r\n\r\n answerArray.forEach((answer, index) => {\r\n answerList += `\r\n <div class=\"center\">\r\n <ul>\r\n <li><pre><input type=\"radio\" name=\"choice\" value=\"${index}\" required><label for=\"option\"> ${answer}</label></pre></li>\r\n </ul>\r\n </div>\r\n `;\r\n i++;\r\n });\r\n return answerList;\r\n}", "function showAnswers(answers){\n // console.log(`Function showAnswers Started!`); \n document.getElementById(\"answers\").innerHTML = ``;\n for (var answer of answers) {\n document.getElementById(\"answers\").innerHTML += `<p><input class=\"answers\" type=\"radio\" name=\"ans\" value=\"${answer}\">${answer}</p>`; //display each answer as radiobutton option in the html with += \n }\n}", "function makeQuiz() {\n var output = [];\n possibleQuestions.forEach(\n (currentQuestion, questionNumber) => {\n var answers = [];\n for (letter in currentQuestion.answers) {\n answers.push(`\n <label>\n <input type=\"radio\" name=\"question${questionNumber}\" value=\"${letter}\">\n ${letter} : ${currentQuestion.answers[letter]} \n </label>`);\n }\n output.push(\n `<div class=\"question\">${questionNumber + 1 + \". \"}${currentQuestion.question}</div>\n <div class=\"answers\"> ${answers.join('')}</div>\n <div> </div>\n <hr>`\n );\n }\n );\n quizContainer.innerHTML = (output.join(''));\n}", "function createRadios(index) {\n var radioList = '<ul>';\n var item;\n var input = '';\n for (var i = 0, length = questions[index].choices.length; i < length; i++) {\n item = '<li>';\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item += input;\n radioList += item;\n }\n return radioList;\n}", "function generateAnswerOptions(state) {\n \n let generated = '';\n for (let i = 0; i < 4; i++) {\n generated += `<div class=\"option-div\">\n <input type=\"radio\" name=\"options\" id=\"option${i}\" value=${state.questions[state.questionNumber].answers[i]} required> \n <label for=\"option${i}\">${state.questions[state.questionNumber].answers[i]}</label>\n </div>`\n }\n return generated\n}", "function createRadios(index) {\n var radioList = $('<ul id=\"answers\">');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li class=\"li\">');\n input = '<input id=\"choice_'+i+'\" type=\"radio\" value=\"'+i+'\" name=\"answer\"><label for=\"choice_'+i+'\">'+questions[index].choices[i]+'</label>';\n // input = '<input id=\"choice_'+i+'\" type=\"radio\" name=\"answer\" value=' + i + ' ><label for=\" choice_'+i+'\">'+questions[index].choices[i]+'</label>';\n // input += ;\n item.append(input);\n radioList.append(item);\n\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li class=\"answers\">');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<label><input type=\"radio\" name=\"answer\" value=' + values[i] + ' />';\n input += questions[index].choices[i] +'</label>';\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function addRadio() {\n for (letter in currentQuestion.answers) {\n // ...add an HTML radio button\n answers.push(\n //<label> so that user can click on whole answer text instead of just radio button\n `<label>\n <input type=\"radio\" name=\"question${questionNumber}\" value=\"${letter}\">\n ${letter} :\n ${currentQuestion.answers[letter]}\n </label>`\n );\n }\n }", "function buildQuiz(){\n\n const output = [];\n \n myQuestions.forEach(\n (currentQuestion, questionNumber) => {\n \n const answers = [];\n \n for(letter in currentQuestion.answers){\n \n answers.push(\n `<label>\n <input type='radio' name='question${questionNumber}' value='${letter}'>\n ${letter} :\n ${currentQuestion.answers[letter]}\n </label>`\n );\n }\n\n output.push(\n `<div class='question'> ${currentQuestion.question} </div>\n <div class='answers'> ${answers.join('')} </div>`\n );\n }\n );\n quizContainer.innerHTML = output.join('');\n }", "function createRadios(index) {\r\n var radioList = $('<ul>');\r\n var item;\r\n var input = '';\r\n for (var i = 0; i < questions[index].choices.length; i++) {\r\n item = $('<li>');\r\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\r\n input += questions[index].choices[i];\r\n item.append(input);\r\n radioList.append(item);\r\n }\r\n return radioList;\r\n }", "function createRadios(index) {\r\n var radioList = $('<ul>');\r\n var item;\r\n var input = '';\r\n for (var i = 0; i < questions[index].choices.length; i++) {\r\n item = $('<li>');\r\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\r\n input += questions[index].choices[i];\r\n item.append(input);\r\n radioList.append(item);\r\n }\r\n return radioList;\r\n }", "function createRadios(index) {\r\n var radioList = $('<ul>');\r\n var item;\r\n var input = '';\r\n for (var i = 0; i < questions[index].choices.length; i++) {\r\n item = $('<li>');\r\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\r\n input += questions[index].choices[i];\r\n item.append(input);\r\n radioList.append(item);\r\n }\r\n return radioList;\r\n }", "function createRadios(index) {\r\n var radioList = $('<ul>');\r\n var item;\r\n var input = '';\r\n for (var i = 0; i < questions[index].choices.length; i++) {\r\n item = $('<li>');\r\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\r\n input += questions[index].choices[i];\r\n item.append(input);\r\n radioList.append(item);\r\n }\r\n return radioList;\r\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function addQuestions(arr, quiz) {\n var output = [];\n var choices;\n // for each question...\n for (var i = 0; i < arr.length; i++) {\n // reset the list of choices\n choices = [];\n // for each choice to each question...\n for (letter in arr[i].choices) {\n\n // adds as radio button\n choices.push(\n '<label>'\n + '<input type=\"radio\" name=\"question' + i + '\" value=\"' + letter + '\">'\n + ' '\n + arr[i].choices[letter]\n + '</label>'\n );\n }\n // adds each question and its choices to the output\n output.push(\n '<div class=\"question\">' + arr[i].question + '</div>' + '<br>'\n + '<div class=\"choices\">' + choices.join(' ') + '</div>' + '<hr>'\n );\n\n }\n // Combines output list into one string of html and add to html\n quiz.innerHTML = output.join('');\n\n }", "function createRadios(index) {\n \tvar radioList = $('<ul>');\n \tvar item;\n \tvar input = '';\n \tfor (var i = 0; i < questions[index].choices.length; i++) {\n \t\titem = $('<li>');\n \t\tinput = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n \t\tinput += questions[index].choices[i];\n \t\titem.append(input);\n \t\tradioList.append(item);\n \t}\n \treturn radioList;\n }", "function createRadios(index) {\n var radioList = $(\"<ul>\");\n var item;\n var input = \"\";\n for (var i = 0; i < questions[index].radioChoices.length; i++) {\n item = $(\"<li>\");\n input =\n '<label><input class=\"with-gap\" type=\"radio\" name=\"answer\" value=' +\n i +\n \" /><span>\";\n input += questions[index].radioChoices[i];\n input += \"</span></label>\";\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < gameQuestions[index].questionChoices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += gameQuestions[index].questionChoices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n let radioList = $('<ul>');\n let item;\n let input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\r\n var radioList = $('<ul>');\r\n var item;\r\n var input = '';\r\n for (var i = 0; i < 4; i++) {\r\n item = $('<li>');\r\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\r\n input += questions[index].choices[i];\r\n item.append(input);\r\n radioList.append(item);\r\n }\r\n return radioList;\r\n }", "function displayAnswers() {\n let question = STORE.questions[STORE.progress];\n for(let i=0; i < question.answers.length; i++) {\n $('.js-answers').append(`<input type = \"radio\" name = \"answers\" id = \"answer${i+1}\" value = \"${question.answers[i]}\" tabindex = \"${i+1}\">\n <label for = \"answer${i+1}\"> ${question.answers[i]} </label> <br/> <span id = \"js-r${i+1}\"> </span>`);\n }\n}", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i][0];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function renderChoices(index) {\n choicesDiv.innerHTML = \"\";\n for (i = 0; i < questions[index].choices.length; i++) {\n //var choiceBtn = document.createElement('button');\n var choiceBtn = document.createElement(\"input\");\n choiceBtn.setAttribute(\"type\", \"radio\");\n\n choiceBtn.setAttribute(\"class\", \"answers\");\n choiceBtn.setAttribute(\"value\", questions[index].choices[i]);\n var label = document.createElement(\"label\");\n label.appendChild(choiceBtn);\n label.innerHTML += \"<span> \" + questions[index].choices[i] + \"</span><br>\";\n //--we add the label to the form.\n\n //var choiceBtn = \"<div class='input-group'><div class='input-group-prepend'><div class='input-group-text'><input type='radio' name='answers' value=\"+questions[index].choices[i]+\">\"+questions[index].choices[i]+\"</div></div></div><br/>\";\n /*var radios = document.getElementsByName('answers');\n radios[i].checked)*/\n\n //choiceBtn.textContent = questions[index].choices[i];\n choicesDiv.appendChild(label);\n }\n}", "function createRadios(index) {\n \n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function addRadioToRv(form, amountOfQuestions, q){\n for (i = 0; i <4; i++){ \n var radiobtn = document.createElement(\"INPUT\");\n radiobtn.id = \"Question\"+amountOfQuestions+\"Radio\"+i;\n radiobtn.setAttribute('type', 'radio');\n radiobtn.setAttribute('value', 'Question'+amountOfQuestions+'Answer'+i)\n radiobtn.setAttribute('name','answers'+amountOfQuestions)\n radiobtn.style.marginLeft = \"10vw\"\n \n if(i ==0){\n radiobtn.setAttribute('checked', 'checked')\n }\n form.appendChild(radiobtn);\n\n var input1 = document.createElement(\"label\");\n input1.style.marginLeft = \"1vw\"\n \n input1.id = \"Question\"+amountOfQuestions+\"Answer\"+i;\n if( i == 0){\n input1.innerHTML = q.answer1;\n } else if (i == 1){\n input1.innerHTML = q.answer2;\n } else if (i == 2){\n input1.innerHTML = q.answer3;\n } else if (i == 3){\n input1.innerHTML = q.answer4;\n }\n form.appendChild(input1);\n var br = document.createElement(\"br\");\n form.appendChild(br);\n document.getElementById(\"userForm\").appendChild(form);\n }\n}", "function generateAnswerArray(answer){\n let questionNumber = store.questionNumber;\n let name = store.questions[questionNumber].answers.indexOf(answer);\n return `\n <li>\n <div class=\"answer-container\">\n <input type=\"radio\" name=\"answer\" id=\"answer-${name}\" data-answer=\"${answer}\">\n <label for=\"answer-${name}\"> ${answer}</label>\n </div>\n </li>\n `;\n}", "function printQuestions(preguntas) {\n const tQuestions = document.getElementById(\"t-preguntas\");\n\n let temp = 0;\n const htmlQuestions = preguntas.map(function (pregunta) {\n if (pregunta.type === \"boolean\") {\n temp += 1;\n return `\n <label>Question ${pregunta.type} of ${pregunta.category}:<br><b> ${pregunta.question}</b></label>\n <p>Answer: \n <br>\n <label><input type=\"radio\" name=\"respuesta${temp}\" value=\"true\" required> ${pregunta.correct_answer} </label>\n <br>\n <label><input type=\"radio\" name=\"respuesta${temp}\" value=\"false\" required> ${pregunta.incorrect_answers} </label>\n </p>\n `;\n } else if (pregunta.type === \"multiple\") {\n temp += 1;\n return `\n <label>Question ${pregunta.type} of ${pregunta.category}:<br><b> ${pregunta.question}</b></label>\n <p>Answer: \n <br>\n <label><input type=\"radio\" name=\"respuesta${temp}\" value=\"false\" required> ${pregunta.incorrect_answers[1]} </label>\n <br>\n <label><input type=\"radio\" name=\"respuesta${temp}\" value=\"true\" required> ${pregunta.correct_answer} </label>\n <br>\n <label><input type=\"radio\" name=\"respuesta${temp}\" value=\"false\" required> ${pregunta.incorrect_answers[0]} </label>\n <br>\n <label><input type=\"radio\" name=\"respuesta${temp}\" value=\"false\" required> ${pregunta.incorrect_answers[2]} </label>\n </p>\n `;\n }\n });\n // se imprime el resultado\n const htmlQuestionsJoined = htmlQuestions.join(\"\");\n tQuestions.innerHTML = htmlQuestionsJoined;\n}", "function createRadios(index) {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li id = \"answerlist\">');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function createRadios(index) {\n var radioList = $('<ul class=\"quizList\">');\n var item;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList;\n }", "function displayQuestion() {\n //we need an empty array to hold the \n //content of the array //it will be in html format\n const contents = [];\n\n\n///per each question we want to storage the answer \n questions.forEach((currentQuestion, questionIndex) => {\n //create options array to hold the answers(option)\n\n const options = [];\n \n//per each question we want to create radio \n//we use interpolation to concatenate the radio button question to each letter(questionIndex . I did not use\n//the push method, instead I use interpolation. Reference https://campushippo.com/lessons/how-to-do-string-interpolation-with-javascript-7854ef9d\n// we asign the value of the)\n\n///////////////////////////INFORMATION////////////////////////\n// To build code below I used https://www.sitepoint.com/simple-javascript-quiz/ \n\n//for each answer we add a radio buttom. we use concatenation\n for (var key in currentQuestion.answers) {\n options[options.length] = `<div>\n <input type=\"radio\" name=\"question${questionIndex}\" value=\"${key}\"/>\n <span>${currentQuestion.answers[key]}</span>\n </div>`;\n }\n\n contents[contents.length] = `\n <div class=\"question-wrap\">\n <div class=\"question\"> ${questionIndex + 1}. ${\n currentQuestion.question\n } </div>\n <div class=\"answers\"> ${options.join(\"\")} </div>\n </div>`;\n });\n\n quizContainer.innerHTML = contents.join(\"\");\n}", "function createRadios() {\n var radioList = $('<ul>');\n var item;\n var input = '';\n for (var i = 0; i < questions.length; i++) {\n \tconsole.log(questions[i].choices);\n\n item = $('<li>');\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[i];\n item.append(input);\n radioList.append(item);\n }\n return radioList; // making the function equal to radioList\n \n }", "function renderQuestAns(questions) {\n let showQuestion = $(`\n <form class=\"question-form\">\n <section class=\"quiz-bg\">\n <fieldset name=\"start-quiz\">\n <legend class=\"zzz\">zZz</legend>\n <h2 class=\"question-text\">${STORE[questions].question}</h2>\n </fieldset>\n </section>\n </form>\n `);\n\n let showChoices = $(showQuestion).find(\"fieldset\");\n STORE[questions].answers.forEach(function(ans, qindex) {\n $(`<span class=\"choices\"><input class=\"radio\" type=\"radio\" \n id=\"${qindex}\"\n value=\"${ans}\" \n name=\"answer\" required>${ans}</span>`).appendTo(showChoices);\n });\n $(`<button type=\"button\" class=\"submitButton\">Submit</button>`).appendTo(\n showChoices\n );\n $(\".display\").html(showQuestion);\n}", "function createTriviaDom(trivia) {\n //Form \n var formQuestions = $(\"<form>\");\n formQuestions.attr(\"id\", \"triviaHead\" + trivia.radio);\n $(\".formContainer\").prepend(formQuestions);\n\n var br = $(\"<br>\");\n $(\"#triviaHead\" + trivia.radio).append(br);\n //Question\n var labelQuestion = $(\"<label>\");\n labelQuestion.addClass(\"font-weight-bold\");\n labelQuestion.attr(\"answer\", trivia.answer);\n labelQuestion.attr(\"for\", trivia.radio);\n labelQuestion.text(trivia.question);\n $(\"#triviaHead\" + trivia.radio).append(labelQuestion);\n\n\n\n var br = $(\"<br>\");\n $(\"#triviaHead\" + trivia.radio).append(br);\n\n //Div to hold options\n var divContainer = $(\"<div>\");\n divContainer.addClass(\"form-check form-check-inline\");\n divContainer.attr(\"id\", \"answersOp\" + trivia.radio);\n $(\"#triviaHead\" + trivia.radio).append(divContainer);\n \n //build answer object op name\n var opName = \"op\";\n\n\n //iterate 4 times because there are 4 answers\n for (i = 1; i <= 4; i++) {\n \n //concatenate i and the build the variable name\n var option = opName.concat(i);\n var answerVarName = \"trivia.\" + option;\n\n\n //Create options\n var liAnswer = $(\"<input>\");\n liAnswer.addClass(\"form-check-input\");\n liAnswer.attr(\"id\", \"inlineRadio\" + i);\n liAnswer.attr(\"type\", \"radio\");\n liAnswer.attr(\"name\", \"inlineRadioOptions\");\n liAnswer.attr(\"answer\", eval(answerVarName));\n liAnswer.attr(\"questionContainer\", \"#triviaHead\" + trivia.radio);\n liAnswer.attr(\"correctanswer\", trivia.answer);\n\n liAnswer.attr(\"question\", trivia.question);\n // liAnswer.text(eval(answerVarName));\n $(\"#answersOp\" + trivia.radio).append(liAnswer);\n\n //create labels for options\n var label = $(\"<label>\");\n label.addClass(\"form-check-label\");\n label.attr(\"for\", \"inlineRadio\" + i);\n label.text(eval(answerVarName));\n $(\"#answersOp\" + trivia.radio).append(label);\n\n\n\n\n }\n\n\n\n }", "function updateOptions()\r\n {\r\n let question = STORE.questions[STORE.currentQuestion];\r\n for(let i=0; i<question.options.length; i++)\r\n {\r\n $('.js-options').append(`\r\n <input type = \"radio\" name=\"options\" id=\"option${i+1}\" value= \"${question.options[i]}\" tabindex =\"${i+1}\"> \r\n <label for=\"option${i+1}\"> ${question.options[i]}</label> <br/>\r\n <span id=\"js-r${i+1}\"></span>\r\n `);\r\n }\r\n \r\n }", "function addRadioToQV(form, amountOfQuestions){\n for (i = 0; i <4; i++){ \n var radiobtn = document.createElement(\"INPUT\");\n radiobtn.id = \"Question\"+amountOfQuestions+\"Radio\"+i;\n radiobtn.setAttribute('type', 'radio');\n radiobtn.setAttribute('value', 'Question'+amountOfQuestions+'Answer'+i)\n radiobtn.setAttribute('name','answers'+amountOfQuestions)\n \n if(i ==0){\n radiobtn.setAttribute('checked', 'checked')\n }\n form.appendChild(radiobtn);\n\n var input1 = document.createElement(\"INPUT\");\n input1.id = \"Question\"+amountOfQuestions+\"Answer\"+i;\n input1.setAttribute(\"type\", \"html\")\n form.appendChild(input1);\n var br = document.createElement(\"br\");\n form.appendChild(br);\n }\n}", "function showQuestions(questions, questionContainer) {\n\n//storing output and answer choices\n var output = [];\n var answers;\n\n//looping through questions and setting a variable to hold answers\n for (var i = 0; i < questions.length; i++) {\n answers = [];\n for (letter in questions[i].answers) {\n answers.push('<label>' + '<input id=\"inputData\" type=\"radio\" name=\"question' + i + '\" value=\"' + letter + '\">'\n + questions[i].answers[letter] + '</label>'\n );\n }\n//adding questions and answers to output\n output.push(\n '<div class=\"question\">' + questions[i].question + '</div>'\n + '<div class=\"answers\">' + answers.join() + '</div>'\n );\n }\n//adding output list into string to display\n questionContainer.innerHTML = output.join('');\n }", "function renderQuestions() {\n $(\"#quiz\").empty();\n\n questions.forEach(function (question, index) {\n\n let $question = $(\"<div>\").addClass(\"form-group cm-form-group-fix\");\n let $label = $(\"<h4>\")\n .text(question.question)\n .appendTo($question);\n\n for (let i = 0; i < question.choices.length; i++) {\n let $choice = $('<div>');\n $choice.addClass('form-check form-check-inline');\n\n let $radio = $('<input>');\n\n $radio\n .attr({\n type: \"radio\",\n value: question.choices[i],\n name: index,\n class: \"form-check-input\"\n })\n .appendTo($choice);\n\n let $choiceLabel = $('<label>');\n $choiceLabel\n .text(question.choices[i])\n .addClass('form-check-label')\n .appendTo($choice);\n\n $choice.appendTo($question);\n }\n $(\"#quiz\").append($question);\n });\n}", "function populateForm() {\n for (var i = 0; i < questions.length; i++) {\n $(\"#question-form\").append(\"<div id=\" + \"q\" + i + \"></div>\");\n $(\"#q\" + i).append(\"<div><p>\" + questions[i].question + \"</p></div>\");\n for (var j = 0; j < questions[i].options.length; j++) {\n $(\"#q\" + i).append(\n '<input type=\"radio\" name=q' + i +\n ' value=\"' + questions[i].options[j] + '\">' +\n questions[i].options[j]\n );\n }\n }\n $(\"#question\").append(\"<button id='send' class='btn btn-lg'>Submit</button>\");\n}", "function loadQuestion() {\n\n for (i = 0; i < questionArray.length; i++) {\n $(\"#question1\").append(questionArray[i].q);\n $(\"#question1\").append(\"<br>\");\n for (j = 0; j < 4; j++) {\n $(\"#question1\").append(\"<span class = 'answers ' > <input type= 'radio' value='\" + questionArray[i].answer[j] + \"' name='\" + questionArray[i].divClass + \"'/> <label>\" + questionArray[i].answer[j] + \"<label></span>\");\n }\n $(\"#question1\").append(\"<br><hr>\");\n\n }\n $(\"#question1\").append(\"<button id='submit'>Submit</button>\");\n\n\n}", "function createRadios(index) {\n\tvar radioList = document.createElement(\"ul\"); //make the <ul>\n\tvar item; //marks the items\n\tvar input = '';\n\tfor (var i = 0; i < Quiz[index].choices.length; i++) {\n\t\titem = document.createElement(\"li\");\n\t\tinput = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n\t\tinput += Quiz[index].choices[i]; //choice\n\t\titem.innerHTML = input;\n\t\tradioList.appendChild(item);\n\t}\n\treturn radioList;\n\t}", "function displayAnswers() {\n const answersArray = STORE.questions[STORE.questionNumber].answers\n let answersHtml = '';\n let i=0;\n\n answersArray.forEach (answer => {\n answersHtml += `\n <div id=\"option-container-${i}\">\n <input type=\"radio\" name=\"options\" id=\"option${i+1}\" value=\"${answer}\" tabindex=\"${i+1}\" required>\n <label for=\"option${i+1}\"> ${answer}</label>\n </div>\n `;\n i++;\n });\n return answersHtml;\n }", "function createRadios(index) {\n var radioList = $('<ul>');\n var input = '';// creating space where the choices will go\n for (var i = 0; i < questions[index].choices.length; i++) {\n var item = $('<li>'); //creating each list item\n input = '<input type=\"radio\" name=\"answer\" value=' + i + ' />';\n input += questions[index].choices[i]; //input is equal to input plus questions[index].choices.[i]\n item.append(input); //adding the list item to the space you created on line 145\n radioList.append(item); //adding it to the radio list\n }\n return radioList;\n}", "function generateQuiz() {\n var top = $(\"#questions\");\n\n for (var q = 0; q < questionsArray.length; q++) {\n var qDiv = $(\"<div>\");\n var qName = \"question\" + q;\n qDiv.attr(\"id\", qName);\n var qValue = $(\"<span>\");\n \n qValue.text(questionsArray[q].question);\n qDiv.append(qValue);\n \n\n for (var c = 0; c < 4; c++) {\n var cInput = $(\"<input>\");\n var cValue = questionsArray[q].choices[c];\n cInput.attr(\"name\", qName)\n .attr(\"type\", \"radio\")\n .attr(\"value\", cValue);\n qDiv.append(cValue);\n qDiv.append(cInput);\n }\n top.append(qDiv);\n\n\n }\n\n}", "function showAnswers() {\r\n const answersArray = store.questions[store.questionNumber].answers;\r\n let answersHtml = '';\r\n let index = 0;\r\n\r\n answersArray.forEach(answer => {\r\n answersHtml += `\r\n <div id=\"choice-container-${index}\">\r\n <input type=\"radio\" name=\"choices\" id=\"choice${index + 1}\" value=\"${answer}\" required>\r\n <label for \"choice${index + 1} aria-checked=false> ${answer} </label>\r\n </div>\r\n `;\r\n index++;\r\n });\r\n return answersHtml;\r\n}", "function createRadios(index) {\r\n var radioList = $('<ul>');\r\n var item;\r\n var input = '';\r\n var rand = Math.floor(Math.random() * 1000);\r\n for (var i = 0; i < questions[index].choices.length; i++) {\r\n item = $('<li>');\r\n input = '<input type=\"radio\" class=\"answer\" name=\"answer'+rand+'\" value=' + i + ' />';\r\n input += questions[index].choices[i];\r\n item.append(input);\r\n radioList.append(item);\r\n }\r\n return radioList;\r\n }", "function questionsHtml() {\n let questionNumber = STORE.questionNumber-1;\n let options = STORE.questions[questionNumber-1].answers.map((ansValue, ansIndex) => {\n console.log(ansIndex+1);\n return `<li class='ansVal'>\n <input class=\"radio\" type=\"radio\" tabindex=\"${ansIndex+1}\" id=\"${ansIndex}\" value=\"${ansValue}\" name=\"answer\" required>\n <label class=\"sizeMe\" for=\"${ansIndex}\">${ansValue}</label>\n </li>`\n });\n options = options.join('');\n let questionsHtml2 =\n `<form class=\"test\">\n <fieldset class='questionBorder'>\n <h3>${generateQuestion()}</h3>\n <ul> ${options}</ul>\n <fieldset class='questionBorder'>\n <button type=\"submit\" class=\"submitButton button\">Submit</button>\n </form>`;\n return questionsHtml2;\n}", "function AddHTMLRadioButton(currentQuestion, questionNumber) {\n for (letter in currentQuestion.answers) {\n // ...add an HTML radio button\n answers.push(\n `<label>\n ${currentQuestion.answers[letter]}\n <input type=\"radio\" class=\"questExercices\" name=\"question${questionNumber}\" value=\"${letter}\" onclick=\"CheckIfRadioSelected()\">\n </label>`\n );\n }\n }", "function questionBuildOut() {\n for (i=0; i<=questions.length; i++) {\n var qDivCreate = \"<div class='quiz-questions'>\" + questions[i].question + \"</div>\";\n $(\"#quiz\").append(qDivCreate);\n\n for (o=0; o<=2; o++) {\n var qOptionsCreate = \"<label><input onclick='check()' type='radio' name='\" + questions[i].name + \"' value='\" + questions[i].options[o] + \"'/>\" + questions[i].options[o] + \"</label>\";\n $(\"#quiz\").append(qOptionsCreate);\n }\n }\n }", "function buildQuiz(){\n // variable to store the HTML output\n const output = [];\n \n // for each question...\n myQuestions.forEach(\n (currentQuestion, questionNumber) => {\n \n // variable to store the list of possible answers\n const answers = [];\n \n // and for each available answer...\n for(letter in currentQuestion.answers){\n \n // ...add an HTML radio button\n answers.push(\n `<label>\n <input type=\"radio\" name=\"question${questionNumber}\" value=\"${letter}\">\n ${letter} :\n ${currentQuestion.answers[letter]}\n </label>`\n );\n }\n \n // add this question and its answers to the output and slide on top of each other\n output.push(\n `<div class=\"slide\">\n <div class=\"question\"> ${currentQuestion.question} </div>\n <div class=\"answers\"> ${answers.join(\"\")} </div>\n </div>`\n );\n }\n );\n\n \n\n // finally combine our output list into one string of HTML and put it on the page\n quizContainer.innerHTML = output.join('');\n}", "function aggResp(index) {\n var lista = $('<ul class=\"list-group\">');\n var item;\n var ent = '';\n for (var i = 0; i < preguntas[index].respuestas.length; i++) {\n item = $(`<li class=\"list-group-item\" value=\"${i}\" onclick=\"selecradio(this)\">`);\n ent = `<label><input type=\"radio\" name=\"answer\" value=\"${i}\" /><span class=\"ml-1\">${preguntas[index].respuestas[i]}</span></label>`;\n item.append(ent);\n lista.append(item);\n }\n return lista;\n}", "function doIt() {\n document.getElementById(\"qno\").innerText = parseInt(qno) + 1;\n let q = decodeURIComponent(data.results[qno].question);\n ques.innerText = q;\n let a = decodeURIComponent(data.results[qno].correct_answer);\n ar[qno][0] = q;\n ar[qno][1] = a;\n let b = data.results[qno].incorrect_answers;\n let arr = new Array(b.length + 1);\n //creating a random position for the correct answer and adding it to it\n let rn = Math.floor(Math.random() * (b.length + 1));\n arr[rn] = a;\n let c = 0;\n //adding the other option to the left off spaces\n for (let i = 0; i < b.length + 1; i++) {\n if (i != rn) {\n b[c] = decodeURIComponent(b[c]);\n arr[i] = b[c++];\n }\n }\n\n //creating the containers that store the option\n for (let i = 0; i < b.length + 1; i++) {\n let x = document.createElement(\"div\");\n x.classList.add(\"radio-container\");\n\n let y = document.createElement(\"input\");\n y.setAttribute(\"type\", \"radio\");\n y.setAttribute(\"name\", \"option\");\n y.setAttribute(\"id\", `radio${i}`);\n y.setAttribute(\"class\", \"radio\");\n\n let z = document.createElement(\"label\");\n z.setAttribute(\"for\", `radio${i}`);\n z.innerText = arr[i];\n\n //adding font awesome to correct and inncorrect option\n let w;\n if (i == rn) {\n w = document.createElement(\"i\");\n w.setAttribute(\"class\", \"fas fa-check\");\n } else {\n w = document.createElement(\"i\");\n w.setAttribute(\"class\", \"fas fa-times\");\n }\n\n x.appendChild(y);\n x.appendChild(z);\n x.appendChild(w);\n opc[0].appendChild(x);\n }\n\n //adding a pointer event none ensures that the question is attempted only once\n const radioSelect = document.getElementsByClassName(\"radio-container\");\n for (let i = 0; i < radioSelect.length; i++) {\n radioSelect[i].addEventListener(\"click\", () => {\n radioSelect[i].querySelector(\"input\").checked = true;\n ar[qno][2] = radioSelect[i].querySelector(\"label\").innerText;\n for (let j = 0; j < radioSelect.length; j++) {\n radioSelect[j].style.pointerEvents = \"none\";\n }\n });\n }\n\n // checking the answer and displaying the result accordingly\n for (let i = 0; i < b.length + 1; i++) {\n radioSelect[i].addEventListener(\"click\", () => {\n if (\n radioSelect[i].querySelector(\"input\").checked === true &&\n radioSelect[i].querySelector(\"label\").innerText === a\n ) {\n radioSelect[i].classList.add(\"correct\");\n document.getElementById(\"score\").innerText =\n parseInt(document.getElementById(\"score\").innerText) + 1;\n } else {\n radioSelect[i].classList.add(\"wrong\");\n radioSelect[rn].classList.add(\"correct\");\n }\n });\n }\n c = 0;\n }", "function presentAnswers(){\n\tfor (var s = 0; s < californiaAnswers.stateBird.length; s++){\n\t\t$('#a1').append(`<span id=${'a1'+s}><input type=\"radio\" class=\"stateAnswers1\" name=\"group1\" value=${californiaAnswers.stateBird[s]} id=${s}> ${californiaAnswers.stateBird[s]}</span>`);\n\t\t$('#a2').append(`<span id=${'a2'+s}><input type=\"radio\" class=\"stateAnswers2\" name=\"group2\" value=${californiaAnswers.stateAmphibian[s]} id=${s}> ${californiaAnswers.stateAmphibian[s]}</span>`);\n\t\t$('#a3').append(`<span id=${'a3'+s}><input type=\"radio\" class=\"stateAnswers3\" name=\"group3\" value=${californiaAnswers.stateAnimal[s]} id=${s}> ${californiaAnswers.stateAnimal[s]}</span>`);\n\t\t$('#a4').append(`<span id=${'a4'+s}><input type=\"radio\" class=\"stateAnswers4\" name=\"group4\" value=${californiaAnswers.stateFruit[s]} id=${s}> ${californiaAnswers.stateFruit[s]}</span>`);\n\t\t$('#a5').append(`<span id=${'a5'+s}><input type=\"radio\" class=\"stateAnswers5\" name=\"group5\" value=${californiaAnswers.stateVegetable[s]} id=${s}> ${californiaAnswers.stateVegetable[s]}</span>`);\n\t}\n\t\n}", "function formTemplate(data) {\n // the first variable relates the form field for question with the data in the object for\n // each question so that the questions can be inputed into that form field\n var qString = \"<form id='questionOne'>\"+ data.question + \"<br>\" ;\n // this variable to access the question object's possibles array needed to answer each question\n var possibles = data.possibles;\n // a for loop to go through the possibles array for each question to add the values of each possibles\n // array and using qString, add them as radio buttons to the question to which they are\n // associated\n for (var i = 0; i < possibles.length; i++) {\n var possible = possibles[i];\n console.log(possible);\n qString = qString + \"<input type='radio' name=\"+data.id+\" value=\"+ i +\">\"+possible;\n \n }\n return qString + \"</form> <br>\";\n }", "function showAnswers() {\n choiceDisplay.innerText = \"\";\n for (let i = 0; i < quizBank[questionCounter].answers.length; i++) {\n let buttonInput = document.createElement(\"input\");\n buttonInput.setAttribute(\"type\", \"radio\");\n buttonInput.setAttribute(\"name\", \"answer\");\n buttonInput.setAttribute(\"value\", quizBank[questionCounter].answers[i]);\n buttonInput.setAttribute(\"id\", \"radioId\");\n let label = document.createElement(\"label\");\n label.setAttribute(\"for\", \"radioId\");\n label.innerHTML = quizBank[questionCounter].answers[i];\n choiceDisplay.appendChild(buttonInput);\n choiceDisplay.appendChild(label);\n }\n let submitButton = document.createElement(\"input\");\n submitButton.setAttribute(\"type\", \"submit\");\n submitButton.setAttribute(\"id\", \"submitId\");\n choiceDisplay.appendChild(submitButton);\n submitButton.addEventListener(\"click\", function () {\n let answers = document.getElementsByName(\"answer\");\n answers.forEach(function (answer) {\n if (answer.checked == true) {\n userSelection = answer.value;\n checkAnswers();\n }\n });\n });\n}", "function displayQuestion() {\n for (var i = 0; i < totalQuestions; i++) {\n $(\".form-group\").prepend(\"<div class=\" + questions[i].divClass + \"></div>\");\n var divQuestion = $('<div class=\"statement\">' + questions[i].statement + '</div>');\n $('.' + questions[i].divClass).append(divQuestion);\n\n let answersArrayLen = questions[i].answers.length;\n for (var x = 0; x < answersArrayLen; x++) {\n $(\".\" + questions[i].divClass).append(\"<div class='radio-inline'><input class='form-check-input' type='radio' name=\" + questions[i].divClass + \" value=\" + questions[i].answers[x] + \"><label class='form-check-label' for=\" + labels[x] + \">\" + questions[i].answers[x] + \"</label></div>\");\n }\n }//for i<totalQuestions\n }", "function renderChoices(questionString, song) {\n var randomList = []; // this array will contain 4 numbers(0-3) that are mixed randomly\n randomList = randomPos();\n // show sound controls\n displayAudioPlayer(song);\n // show choices menu\n var genreEl = document.getElementById(questionString);\n for (var i = 0; i < 4; i++) {\n var listEl = document.createElement('input');\n // set attribute of the Input tags that will be created.\n // randomList[i] will make sure the choices are random\n listEl.setAttribute('id', song.id[randomList[i]]);\n listEl.setAttribute('value', song.answers[randomList[i]]);\n listEl.setAttribute('type', 'radio');\n listEl.setAttribute('name', 'songName');\n listEl.setAttribute('checked','');\n listEl.setAttribute('class','tracks');\n genreEl.appendChild(listEl);\n // use JQuery \"after\" method to add text after the \"input\" tag\n $('input#' + song.id[randomList[i]]).after(song.answers[randomList[i]] + '<br>');\n };\n // if a particular form ID is present on the page then execute the particular listener\n if (document.getElementById(song.formId)){\n var formEl = document.getElementById(song.formId).addEventListener('submit', getInput, false);;\n }\n}", "function prepareCustomQuizForDisplay(questionList, answers) {\n var divs = questionList.getElementsByTagName(\"input\");\n var questionNum = 0;\n var nextCorrect = 0;\n for ( var i = 0, t = divs.length; i < t; i++) {\n if (i > 3 && (i % 4) == 0) {\n questionNum++;\n }\n divs[i].disabled = true;\n var choiceThisQuestion = i - (questionNum * 4);\n if (answers[questionNum] == choiceThisQuestion) {\n divs[i].checked = true;\n }\n }\n}", "function createQuizQuestion(questionIndex) {\n // console.log('createQuizQuestion ran');\n let questionForm = $(`<form>\n <fieldset>\n <legend class=\"questionText\">${STORE[questionIndex].question}</legend>\n </fieldset>\n </form>`)\n\n let fieldSelect = $(questionForm).find('fieldset');\n\n STORE[questionIndex].answers.forEach(function(answerValue, answerIndex){\n $(`<label class=\"questionAndScore\" for=\"${answerIndex}\">\n <input class=\"radio\" type=\"radio\" id=\"${answerIndex}\" value=\"${answerValue}\" name=\"answer\" required>\n <span>${answerValue}</span><br>\n </label>\n `).appendTo(fieldSelect);\n });\n\n $(`<button type=\"submit\" class=\"submitButton button\">Check your answer</button > `).appendTo(fieldSelect);\n return questionForm;\n\n}", "function showOptions() {\n let questions = STORE.questions[STORE.currentQuestion];\n for (let i = 0; i < questions.options.length; i++) {\n $('.js-options').append(`\n <li><input type = \"radio\" name=\"options\" id=\"option${i + 1}\" value = \"${questions.options[i]}\" tabIndex=\"${i + 1}\">\n <label for=\"option${i + 1}\"> ${questions.options[i]}</label>\n <span class=\"response\" id=\"js-r${i + 1}\"></span></li>`\n );\n }\n}", "function generateAnswers(question) {\n const answers = question.answers;\n\n const answersHTML = createNode(\"div\", { id: \"answersWrapper\" });\n\n\n const subDivArray = [];\n //para empaquetar las preguntas de dos en dos\n for (let j = 0; j < answers.length / 2; j++) {\n subDivArray[j] = createNode(\"div\", { className: \"answersSubWraper\" });\n }\n\n for (let i = 0; i < answers.length; i++) { //creamos el html de cada pregunta\n //vemos en que subWrapper hay que ponerlo:\n let subWrapper = Math.floor(i / 2);\n\n const answerWrapper = createNode(\"div\", { className: \"answerWrapper btn\" });\n\n //creamos los input\n const answerHTMLinput = createNode(\"input\", {\n className: \"answerInput\",\n type: \"radio\",\n name: `quID_${question.questionID}`,\n id: `answer_${i}`,\n value: i.toString()\n });\n\n\n //creamos las label\n const answerHTMLlabel = createNode(\"label\", {\n innerText: answers[i],\n className: \"answerLabel btn\",\n htmlFor: `answer_${i}`\n });\n\n //los metemos en el wrapper de respuesta\n answerWrapper.appendChild(answerHTMLinput);\n answerWrapper.appendChild(answerHTMLlabel);\n\n //lo metemos en el subWrapper de respuesta que corresponde\n subDivArray[subWrapper].appendChild(answerWrapper);\n\n //unimos los subDivArray en answersHTML\n subDivArray.forEach(subDiv => {\n answersHTML.appendChild(subDiv)\n })\n }\n //devolvemos el nodo con todas las respuestas.\n return answersHTML;\n}", "function renderQuiz(q) {\n const triviaDiv = $(\"#trivia-div\");\n for (let i = 0; i < q.length; i++) {\n const questionDiv = `\n <h3>${q[i].question}</h3>\n <input\n type=\"radio\"\n name=\"question-${i + 1}\"\n class=\"multi-choice\"\n value=\"${q[i].answers[0]}\"\n />${q[i].answers[0]} <br />\n <input\n type=\"radio\"\n name=\"question-${i + 1}\"\n class=\"multi-choice\"\n value=\"${q[i].answers[1]}\"\n />${q[i].answers[1]} <br />\n <input\n type=\"radio\"\n name=\"question-${i + 1}\"\n class=\"multi-choice\"\n value=\"${q[i].answers[2]}\"\n />${q[i].answers[2]} <br />\n <input\n type=\"radio\"\n name=\"question-${i + 1}\"\n class=\"multi-choice\"\n value=\"${q[i].answers[3]}\"\n />${q[i].answers[3]} <br />\n `;\n triviaDiv.append(questionDiv);\n }\n}", "function getResult(data) {\n $('#result-btn').on('click', function(e) {\n // gather all checked radio-button values\n var choices = $(\"input[type='radio']:checked\").map(function(i, radio) {\n return $(radio).val();\n }).toArray();\n\n // now you have an array of choices = [\"valueofradiobox1\", \"valueofradiobox2\", \"valueofradiobox2\"]\n // you'll need to do some calculations with this\n // a naive approachf would be to just choose the most common option - seems reasonable\n\n if (choices.length == data.questions.length){\n let outcome = (mode(choices));\n console.log(outcome);\n \n $(\"#full-phrase\").text(data.outcomes[outcome].text);\n $(\"#result-img\").attr(\"src\", data.outcomes[outcome].img);\n\n // from hardcoded html\n // $(\"#full-phrase\").text(getResultArray(mode(choices))[0]);\n // $(\"#result-img\").attr(\"src\", getResultArray(mode(choices))[1]);\n } else{\n console.log(\"?s answered: \" + choices.length);\n console.log(getResultArray(\"error\"));\n $(\"#full-phrase\").text(getResultArray(\"error\")[0]);\n }\n });\n}", "function display() {\n for (var i = 0; i < game.questions.length; i++) {\n var trivia = game.questions[i].q;\n console.log(trivia);\n $('.allQuestions').append(\"<div><h4>\" + trivia + \"</h4></div>\");\n for (var j = 0; j < game.questions[i].possible.length; j++) {\n var options = game.questions[i].possible[j];\n console.log(options);\n $('.allQuestions').append(\"<div><input type='radio' data-question-index='\" + i + \"' data-index='\" + j + \"' name='question\" + i + \"' value='\" + game.questions[i].possible[j] + \"'>\" + \" \" + options + \" \" + \"</div>\");\n }\n }\n}", "function displayQuestions() {\n // variable to grab our html \n var output = $(\"#questions-box\");\n // updates html with headline to guide users\n output.append('<h2>Answer the following questions:</h2><hr>');\n\n // for loop to construct trivia questions and adds them to the UI \n for(var i = 0; i < myQuestions.length; i++){\n\n // updates our html with the trivia question from our myQuestions object\n output.append('<h5>' + myQuestions[i].question + '</h5>');\n\n // variables to house each question's answer \n var answer1 = myQuestions[i].answers[0];\n var answer2 = myQuestions[i].answers[1];\n var answer3 = myQuestions[i].answers[2];\n var answer4 = myQuestions[i].answers[3];\n\n\n // updates the html with our answers and radio buttons, assign the i value to input name, assign each possible answer a value \n output.append('<div class=\"form-check form-check-inline mb-4\"><input class=\"form-check-input\" type=\"radio\" name=\"radio'+i+'group\" value=\"'+ answer1 +'\" <label class=\"form-check-label\" label\" for=\"radio'+i+'\">' + answer1 + '</label></div>');\n output.append('<div class=\"form-check form-check-inline mb-4\"><input class=\"form-check-input\" type=\"radio\" name=\"radio'+i+'group\" value=\"'+ answer2 +'\" <label class=\"form-check-label\" label\" for=\"radio'+i+'\">' + answer2 + '</label></div>');\n output.append('<div class=\"form-check form-check-inline mb-4\"><input class=\"form-check-input\" type=\"radio\" name=\"radio'+i+'group\" value=\"'+ answer3 +'\" <label class=\"form-check-label\" label\" for=\"radio'+i+'\">' + answer3 + '</label></div>');\n output.append('<div class=\"form-check form-check-inline mb-4\"><input class=\"form-check-input\" type=\"radio\" name=\"radio'+i+'group\" value=\"'+ answer4 +'\" <label class=\"form-check-label\" label\" for=\"radio'+i+'\">' + answer4 + '</label></div>');\n\n output.append('<hr>');\n\n }\n // create new submit button\n var submitBtn = $('<br><button type=\"button\" class=\"btn btn-danger\" id=\"submit-button\">Submit</button>')\n // append the button to the button of the quiz\n output.append(submitBtn);\n // on click event that calls the stopTimer function to end game\n $(\"#submit-button\").on(\"click\", stopTimer);\n }", "function ponerDatosRadioHtml(t,opt){\r\n var radioContainer=document.getElementById('radioDiv');\r\n document.getElementById('preg1').innerHTML = t;\r\n for (i = 0; i < opt.length; i++) { \r\n var input = document.createElement(\"input\");\r\n var label = document.createElement(\"label\");\r\n label.innerHTML=opt[i];\r\n label.setAttribute(\"for\", \"color_\"+i);\r\n input.type=\"radio\";\r\n input.name=\"color\";\r\n input.id=\"color_\"+i;; \r\n radioContainer.appendChild(input);\r\n radioContainer.appendChild(label);\r\n radioContainer.appendChild(document.createElement(\"br\"));\r\n } \r\n}", "function SaveSelectedExerciceRadio() {\n for (var i = 0; i < questExercices.length; i++) {\n if (questExercices[i].checked) {\n rowResult.push(questExercices[i].value); //save answer\n }\n }\n}", "function questionCreator() {\r\n // For every question in the questions array we create a new question\r\n for (let i = 0; i < questions.length; i++) {\r\n var questionRow = $(\"<div>\");\r\n questionRow.addClass(\"row justify-content-center text-center\");\r\n var questionDiv = $(\"<div>\");\r\n questionDiv.addClass(\"col-md-6 text-center\");\r\n var question = $(\"<h4>\");\r\n question.text(questions[i]);\r\n questionDiv.append(question);\r\n questionRow.append(questionDiv);\r\n\r\n // for every question we create 5 radiobuttons\r\n for (let i = 0; i < 5; i++) {\r\n var radioDiv = $(\"<div>\");\r\n radioDiv.addClass(\"form-check form-check-inline\");\r\n var radioButtonInput = $(\"<input>\");\r\n radioButtonInput.addClass(\"form-check-input\");\r\n radioButtonInput.attr(\"type\", \"radio\");\r\n radioButtonInput.attr(\"name\", \"inlineRadioOptions\" + questionCount);\r\n radioButtonInput.attr(\r\n \"id\",\r\n \"question\" + questionCount + \"radio\" + radioCount\r\n );\r\n radioButtonInput.attr(\"value\", radioCount);\r\n radioButtonInput.attr(\"required\", true);\r\n\r\n // For every radiobutton we create a label\r\n var radioButtonLabel = $(\"<label>\");\r\n radioButtonLabel.addClass(\"form-check-label\");\r\n radioButtonLabel.attr(\r\n \"for\",\r\n \"question\" + questionCount + \"radio\" + radioCount\r\n );\r\n\r\n // we append everything onto the page and reset the radiobuttons to the right number\r\n radioButtonLabel.text(radioCount);\r\n radioDiv.append(radioButtonInput, radioButtonLabel);\r\n questionRow.append(radioDiv);\r\n counterCheck();\r\n }\r\n $(\"#survey\").prepend(questionRow);\r\n }\r\n}", "function getinputs(answerset,num1,num2,prefix){\n var i, key, value;\n //loop through the entries, grab value and store in array\n for(i=num1; i<=num2; i++) {\n key = \"'\" + prefix + i +\"'\";\n value = $('input[name = ' + key + ']:checked').val();\n answerset.answers[i] = value;\n }\n \n return answerset;\n}", "function generateQuestion() { //this function is both a template for the questions, and renders questions based on store state. \n let answerString = \"\";\n let questionObject = store.questions[store.questionNumber];\n let questionText = questionObject.question;\n\n questionObject.answers.map((a, i) => { /*using .map to iterate through avalable answers and make a\n string for each answer*/\n answerString += `\n <li>\n <input type=\"radio\" name=\"answer\" id=\"answer-${i}\" data-answer=\"${a}\" value=\"${a}\">\n <label for=\"answer-${i}\"> ${a}</label>\n </li> \n `\n });\n\n return `\n <div class =\"container\">\n <div class=\"question\">\n <form>\n <p>\n Question ${store.questionNumber + 1} out of ${store.questions.length}. <br>\n Current score: ${scorePercentage()}\n <p>\n ${questionText}\n </p>\n <div class=\"answer\">\n <ol type=\"A\">\n ${answerString}\n </ol>\n <div class=\"button-container\">\n <button id=\"check-answer\" onClick=\"checkAnswer(event)\"> \n Check Answer\n </button>\n </div>\n </form> \n </div>\n </div>`\n\n}", "function formTemplate(data) {\n // the first variable relates the form field for question with the data in the object for\n // each question so that the questions can be inputed into that form field\n var qString = \"<form id='q1'><h4>\" + data.question + \"</h4><br>\";\n // this variable to access the question object's possibles array needed to answer each question\n var possibles = data.possibles;\n // $(possibles[i]).addClass(\"choices\");\n\n // a for loop to go through the possibles array for each question to add the values of each possibles\n // array and using qString, add them as radio buttons to the question to which they are\n // associated\n for (var i = 0; i < possibles.length; i++) {\n var possible = possibles[i];\n console.log(possible);\n qString =\n qString +\n \"<input type='radio' name='\" +\n data.id +\n \"' value=\" +\n i +\n \">\" +\n \" \" +\n possible +\n \"<br>\";\n }\n return qString + \"</form><br><br>\";\n }", "function resultOptions(index, value) {\n\tseeOptions = 1;\n\tif(multiple == 0)\n\t\tvar radioHtml = '<input type=\"radio\" name=\"Vote\"';\n\telse\n\t\tvar radioHtml = '<input type=\"checkbox\" name=\"Vote\"';\n\tradioHtml += 'value=\"' + value + '\"'\n\tradioHtml += '/>' + value;\n\tvar radioFragment = document.createElement('div');\n\tradioFragment.setAttribute('class', 'radio');\n\tradioFragment.innerHTML = radioHtml;\n\n\tdocument.getElementById('dynamicOptions').appendChild(radioFragment);\n\n\treturn radioFragment.firstChild;\n}", "function renderAQuestion() {\n const question = STORE.questions[STORE.currentQuestion];\n let options = '';\n for (i = 0; i < question.options.length; i++) {\n options += `<div>\n <input type=\"radio\" name=\"options\" id=\"option${i}\" value=\"${question.options[i]}\" required>\n <label for=\"option${i}\">${question.options[i]}</label>\n </div>`;\n }; \n \n return `\n <div>\n <form id=\"js-questions\" class=\"question-form\">\n <fieldset>\n <div class=\"question\">\n <h3>${question.question}</h3>\n </div>\n <div class=\"options\">\n <div class=\"js-options\">${options}</div>\n </div>\n <div class=\"submit-button\">\n <button id=\"answer\" type=\"submit\">Submit</button>\n </div>\n <div class=\"next-button\">\n <button id=\"next-question\" type=\"button\">Next</button>\n </div>\n </fieldset>\n </form>\n </div>\n `; \n}", "function createRadios(index) {\n var table = $('<table>');\n var tableTr = $('<tr>');\n var tableTd;\n var label;\n var input = '';\n for (var i = 0; i < questions[index].choices.length; i++) {\n if (index == 0 || index == 3 || index == 4 || index == 5) {\n tableTd = $('<td>', {'class': 'roundedOne'});\n label = $('<label for=\"checkboxG' + i + '\"><span><span></span></span></label>');\n input = '<input type=\"radio\" name=\"checkboxG' + i + '\" id=\"checkboxG' + i + '\" class=\"css-checkbox\" value=' + i + ' />';\n input += questions[index].choices[i];\n tableTd.append(input);\n tableTd.append(label);\n tableTr.append(tableTd);\n table.append(tableTr);\n } else {\n tableTd = $('<td>');\n label = $('<label for=\"checkboxG' + i + '\" class=\"css-label\" ></label>');\n input = '<input type=\"checkbox\" name=\"checkboxG' + i + '\" id=\"checkboxG' + i + '\" class=\"css-checkbox\" value=' + i + ' />';\n input += questions[index].choices[i];\n tableTd.append(input);\n tableTd.append(label);\n tableTr.append(tableTd);\n table.append(tableTr);\n }\n }\n return table;\n }", "function loadOptions() {\n const options = parseOptions();\n const optionsHTML = [];\n for (let option of options) {\n optionsHTML.push(`\n <input id=\"${option}\" type=\"radio\" name=\"option\" required>\n <label for=\"${option}\" class=\"quiz-option\">${option}</label>\n <br>\n `);\n }\n return optionsHTML;\n }", "function questionsAnswers (arr) {\n for (i = 0; i < arr.length; i++) {\n var button = $(\"<button>\");;\n button.text(arr[i]);\n button.addClass(\"button\");\n button.attr({\"selection\": arr[i]});\n $(\"#choices\").append(button);\n \n }\n}", "function buildQuiz(){\n\t// variable to store the HTML output\n\tconst output = [];\n \n\t// for each question...\n\tmyQuestions.forEach(\n\t (currentQuestion, questionNumber) => {\n \n\t\t// variable to store the list of possible answers\n\t\tconst answers = [];\n \n\t\t// and for each available answer...\n\t\tfor(letter in currentQuestion.answers){\n \n\t\t // ...add an HTML radio button\n\t\t answers.push(\n\t\t\t`<label>\n\t\t\t <input type=\"radio\" name=\"question${questionNumber}\" value=\"${letter}\">\n\t\t\t ${letter} :\n\t\t\t ${currentQuestion.answers[letter]}\n\t\t\t</label>`\n\t\t );\n\t\t}\n \n\t\t// add this question and its answers to the output\n\t\toutput.push(\n\t\t `<div class=\"question\"> ${currentQuestion.question} </div>\n\t\t <div class=\"answers\"> ${answers.join('')} </div>`\n\t\t);\n\t }\n\t);\n \n\t// finally combine our output list into one string of HTML and put it on the page\n\tquizContainer.innerHTML = output.join('');\n }", "function getQuestionString () {\n const question = getQuestion (questions, questionNumber);\n return `\n <form id='quesiton-form'>\n <fieldset class=\"grey-box\">\n <span class=\"question\">${question.question}</span>\n\n <label for=\"answer1\">\n <input type=\"radio\" id=\"answer1\" class=\"answerOption\" name=\"answerOption\" value=\"${question.answers[0]}\" required>${question.answers[0]}\n </label>\n\n <label for=\"answer2\">\n <input type=\"radio\" id=\"answer2\" class=\"answerOption\" name=\"answerOption\" value=\"${question.answers[1]}\" required>${question.answers[1]}\n </label>\n\n <label for=\"answer3\">\n <input type=\"radio\" id=\"answer3\" class=\"answerOption\" name=\"answerOption\" value=\"${question.answers[2]}\" required>${question.answers[2]}\n </label>\n\n <label for=\"answer4\">\n <input type=\"radio\" id=\"answer4\" class=\"answerOption\" name=\"answerOption\" value=\"${question.answers[3]}\" required>${question.answers[3]}\n </label>\n <button type=\"submit\">Submit</button>\n </fieldset>\n </form>\n `\n\n}", "function saveAnswer(){\n \n var answerArray=new Array(counter)//counter //answerArray=counter,solution,required,degree\n for(var i=0;i<answerArray.length;i++){\n answerArray[i]=new Array(2);\n }\n \n //alert(\"answerArray \"+answerArray.length)\n var questionText=document.getElementsByClassName(\"ques\"); //return all input type text with checkbox\n var radioButton=document.querySelectorAll('input[type=\"radio\"]');\n \n\n // assign the value of textbox to radio valur\n for(var i=0;i<questionText.length;i++){\n questionText[i].previousElementSibling.value=questionText[i].value;\n }\n var j=0;\n /****************** edit 20-12-2020 ************* */\n // //requiredQuestion questionDegree\n // var requiredQuestion=document.getElementsByClassName(\"requiredQuestion\");\n // var questionDegree=document.getElementsByClassName(\"questionDegree\");\n /// save q1,q2 .....q(counter)\n for(var i=0;i<counter;i++){ \n answerArray[i][0] = \"q\"+(i+1);\n }\n \n for(var i=0;i<radioButton.length;i++){ \n if(radioButton[i].checked){\n for(var j=0;j<counter;j++){\n if(answerArray[j][0]==radioButton[i].name){\n answerArray[j][1]=radioButton[i].value;\n // if(requiredQuestion[j].checked){\n // answerArray[j][2]=requiredQuestion[j].value;\n // }else{\n // answerArray[j][2]=\"\";\n // }\n // answerArray[j][3]=questionDegree[j].value;\n }\n }\n }\n }\n //if not choose radio button\n // for(var i=0;i<counter;i++){ \n // if(answerArray[i][1]==null){\n // if(requiredQuestion[i].checked){\n // answerArray[i][2]=requiredQuestion[i].value;\n // }else{\n // answerArray[i][2]=\"\";\n // }\n // answerArray[i][3]=questionDegree[i].value;\n // }\n // }\n \n\n localStorage.setItem(\"answer\",JSON.stringify(answerArray));\n console.log(\"/////////////*******answer*******/////////////////\")\n console.log(JSON.parse(localStorage.getItem(\"answer\")));\n}", "function generateAllQuestions() {\n $('.questionNumber').html(updateQuestionNumber());\n let questions = questionsHtml();\n $('.startQuiz').html(questions);\n\n\n $('.test').submit(function (event) {\n event.preventDefault();\n let ans = $('input[type=radio][name=answer]:checked');\n\n if (ans.length > 0) {\n let ansr = ans.val();\n\n submitAnswer(ansr);\n }\n });\n}", "function setRadioChoice(origAnswer, sBlank, resObj)\n{\n // Finds index number of chosen option.\n var matchIndex = resObj.optionList.indexOf(origAnswer);\n\n if (matchIndex >= 0 && matchIndex < resObj.optionList.length)\n {\n // Known option chosen.\n resObj.chosenOption = matchIndex;\n resObj.enabledFlag = 1;\n }\n else if (origAnswer.length > 0 && resObj.customEnabled === true)\n {\n // Other option entered.\n resObj.customText = origAnswer;\n resObj.enabledFlag = 1;\n }\n else if (sBlank === true)\n {\n // Skip blank answer.\n resObj.customText = \"\";\n resObj.enabledFlag = -1;\n }\n else\n {\n // Include blank answer.\n resObj.chosenOption = -1;\n resObj.enabledFlag = 0;\n }\n}", "function getChoices (question){\n\t$(\"#radioA\").html(question.a.caption);\n\t$(\"#radioB\").html(question.b.caption);\n\t$(\"#radioC\").html(question.c.caption);\n\t$(\"#radioD\").html(question.d.caption); \n\n\tconsole.log(\"a :\" + question.a.caption);\n\tconsole.log(\"b :\" + question.b.caption);\n\tconsole.log(\"c :\" + question.c.caption);\n\tconsole.log(\"d :\" + question.d.caption);\n} //fucntion getChoices", "function showOne(questionsList, questionNum, quizContainer){\n var output =[];\n var answers =[];\n\n for (letter in questionsList[questionNum].answers){\n answers.push( \n '<ul>'\n +'<li> <input id=\"list\" type = \"radio\" name=\"question'+ questionNum +'\"'\n +'value=\"'+letter+ '\">'+ letter + ': '+ questionsList[questionNum].answers[letter]+' </li>'\n +'</ul>'\n \n );\n }\n\n output.push(\n '<div class=\"question\">' + questionsList[questionNum].question+ '</div>'\n + '<div class =\"answers\">' +answers.join('') + '</div>'\n );\n \n output.push(\n ' <button id =\"submit\" onclick = \"checkAnswer(' + questionNum + ')\"> Submit answer</button> '\n );\n quizContainer.innerHTML = output.join('');\n}", "function datosRadio1(t, opt) {\r\n var radioContainer = document.getElementById('radioDiv1');\r\n document.getElementById('tituloRadio1').innerHTML = t;\r\n for (i = 0; i < opt.length; i++) {\r\n var input = document.createElement(\"input\");\r\n var label = document.createElement(\"label\");\r\n label.innerHTML = opt[i];\r\n label.setAttribute(\"for\", \"respuesta_\" + i);\r\n input.type = \"radio\";\r\n input.name = \"año\";\r\n input.id = \"año_\" + i;\r\n ;\r\n radioContainer.appendChild(input);\r\n radioContainer.appendChild(label);\r\n radioContainer.appendChild(document.createElement(\"br\"));\r\n }\r\n}", "function swapUI(obj, options) {\n\n\n //store answers\n $(options.answerElement).children().each(function(e){\n obj.answerArray[e] = this.textContent\n });\n\n if(!options.showAnswerItems){\n $(options.answerElement).hide();\n }\n\n $(obj).find(\".question > ol\").each(function( index ) {\n var olIndex = index;\n $( this ).replaceWith(function(){\n var ele = \"<fieldset><legend>\"+options.groupLabels[index]+\"</legend><div class='radiogroup radiogroup\"+ olIndex +\"'>\";\n $(this).children().each(function(index){\n ele += \"<label><span><input type='radio' name='group\" + olIndex + \"' value='\" + $( this ).text() + \"'></span> <span>\"+ $( this ).text() +\"<span></label>\";\n });\n ele += \"</div></label></fieldset>\";\n return ele\n });\n });\n $(obj).wrap(\"<form></form>\");\n }", "function Multiple(props) {\n return (\n <div className=\"question-container\">\n {/* display the prompt */}\n <div key=\"question\" className=\"prompt-container\">\n {props.num}) {props.data.question}\n </div>\n {/* display the answer choices by iterating through the array*/}\n <div key=\"answer\" className=\"answer-container\">\n {props.data.options.map((val,key)=>{\n return (\n <div>\n <input required type=\"radio\" name={props.num} className=\"radio\" defaultChecked={props.ans === val} onClick={()=>{props.selected(val);}}/>\n <label for=\"option\">{val}</label> <br />\n </div>\n );\n })}\n </div>\n </div>\n );\n}", "function generate(index) {\n let questionItem = jsonData[index];\n let optionsContainer = document.querySelector('.options');\n let htmlString = '';\n\n document.getElementById(\"question\").textContent = questionItem.question;\n\n questionItem.options.forEach((option, index) => {\n htmlString += '<div class=\"options\">';\n htmlString += '<input type=\"radio\" name=\"options\" value=\"' + index + ' \"/>';\n htmlString += '<label>' + option + '</label>';\n htmlString += '</div>';\n })\n\n optionsContainer.innerHTML = htmlString;\n\n}", "function newElement(responseArray)\n{\n // store a processed response \n const array=responseArray;\n //to add questions \n for(var i=0;i<responseArray.length;i++)\n {\n var qdiv=document.createElement('div');\n // set class name\n qdiv.className=\"question \" +responseArray[i].id\n // add div to maindiv\n content.appendChild(qdiv);\n var list=document.createElement('li');\n // store option length from responsearray\n var optLength=responseArray[i].options;\n // set content(question) to list element\n list.innerHTML=(responseArray[i].id+\".\"+responseArray[i].question);\n // set id to list element\n list.id=responseArray[i].id;\n // add child element to div\n qdiv.appendChild(list);\n // console.log(responseArray[i])\n // to add option\n for(j=0;j<optLength.length;j++)\n {\n // create input element to add radio button\n var option=document.createElement('input');\n var br=document.createElement('br');\n var label=document.createElement('label');\n option.id=\"radio\";\n option.name=\"answer\"+i;\n option.type=\"radio\";\n list.appendChild(br)\n var optionValue=optLength[j];\n // set option to radio button\n option.value=optionValue;\n label.innerHTML=optionValue;\n // add option to div element\n list.appendChild(option);\n list.appendChild(label);\n \n }\n // add answer to the array\n answerArray[i]=responseArray[i].answer;\n }\n}", "function radios($radios){return map(_.map(function($el){return{on:$el,show:$('[data-show-on=\"'+$el.attr('value')+'\"]')};},$radios.toArray()));}// This class constructor wraps a mapping definition and lets other methods" ]
[ "0.7307562", "0.72013414", "0.7122605", "0.7078965", "0.7004726", "0.688963", "0.68672985", "0.68615353", "0.6808318", "0.6767966", "0.67205757", "0.66582733", "0.66462916", "0.66335374", "0.6565449", "0.6535975", "0.6535975", "0.6535975", "0.6535975", "0.65352046", "0.65339935", "0.65252835", "0.6523404", "0.6521114", "0.65110624", "0.65110624", "0.65110624", "0.65110624", "0.65110624", "0.65110624", "0.65033424", "0.6486042", "0.64858526", "0.6475762", "0.6473194", "0.64723414", "0.6467411", "0.6464611", "0.64479154", "0.64463305", "0.6405073", "0.6387857", "0.63864434", "0.63645756", "0.63642347", "0.63492656", "0.63243365", "0.63014406", "0.6296646", "0.627903", "0.62786114", "0.6271611", "0.62701684", "0.6264869", "0.62567717", "0.625052", "0.6236642", "0.62311244", "0.6223762", "0.6201098", "0.6192736", "0.61724234", "0.6168314", "0.61683", "0.61382425", "0.61157316", "0.61098397", "0.60976344", "0.6097382", "0.6071661", "0.60693926", "0.60649496", "0.60593563", "0.6039703", "0.6036763", "0.6028216", "0.60265785", "0.6017856", "0.6011513", "0.60103863", "0.6009985", "0.60022837", "0.59862936", "0.5986236", "0.5976886", "0.5974072", "0.59696364", "0.59618706", "0.5953234", "0.5946891", "0.59431094", "0.59342146", "0.5934023", "0.59126925", "0.5912395", "0.5906444", "0.59043604", "0.5897572", "0.58883846", "0.5878274" ]
0.6769052
9
check if the answer is valid
function checkAnswerValid() { let answerIndex = $('input[name=answer]:checked').val() let answerNotSelected = !answerIndex if (answerNotSelected) { alert('Whoever didnt pick an answer...ya moms a h0e') } else { let answer = QUESTIONS[currentQuestionIndex].answers[ Number($('input[name=answer]:checked').val()) ] updateForm({ answer, answerIndex }) // increment correct / incorrect count answer.correct ? numCorrect++ : numIncorrect++ updateCorrectIncorrect() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateAnswer() {\n switch (current_question_number) {\n case 1: {\n return validateQuestion1();\n }\n case 2: {\n return validateQuestion2();\n }\n case 3: {\n return validateQuestion3();\n }\n case 4: {\n return validateQuestion4();\n }\n case 5: {\n return validateQuestion5();\n }\n }\n }", "function checkAnswers(answers){\n var correctAns = model.transition(false);\n var result = []; var sum = 0;\n var allCorrect = 1;\n var error = {errorName:\"none\",badInputs:[]};//[error name, position that error was found]\n \n for (var i = 0; i < answers.length; i++){\n sum += answers[i];\n if(isNaN(answers[i])){\n error.errorName = \"nonnumber_error\";\n error.badInputs.push(i);\n }\n else if(answers[i] <0){\n error.errorName = \"negative_error\";\n error.badInputs.push(i);\n }\n if (round_number(answers[i],3) == round_number(correctAns[i],3)){\n result[i] = \"right\"; \n }\n else {result[i] = \"wrong\"; allCorrect = 0;}\n }\n result[answers.length] = allCorrect;\n if (round_number(sum,3) != round_number(1,3) && error.errorName==\"none\"){ error.errorName = \"sum_error\"; error.badInputs =[]}\n// else {result[answers.length+1] = \"sum_correct\";}\n \n result[answers.length+1] = error;\n return result;\n }", "function answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function verifyInputs() {\n // Creacion de una expresion regular para verificar los inputs\n const reg = /^-?\\d+$/;\n\n // Verificacion de los inputs\n try {\n if (funcion === \"\") {\n throw new Error(\"Por favor escriba una función.\");\n }\n if (!reg.test(x_from)) {\n throw new Error(\n \"Por favor escriba un número entero en el valor de inicio de la integral.\"\n );\n }\n if (!reg.test(x_to)) {\n throw new Error(\n \"Por favor escriba un número entero en el valor final de la integral.\"\n );\n }\n if (!reg.test(cant_points)) {\n throw new Error(\n \"Por favor escriba un número entero para la cantidad de puntos a evaluar.\"\n );\n }\n } catch (error) {\n alert(error);\n return false;\n }\n\n // Pasar los inputs a integer\n x_from = parseInt(x_from);\n x_to = parseInt(x_to);\n cant_points = parseInt(cant_points);\n\n return true;\n }", "function checkAnswer(answer) {\n\t\treturn answer.isCorrect;\n\t}", "checkResult() {\n const MAX_ANSWERS_LENGTH = 10;\n if (this.model.isDead()) {\n this.loose();\n } else if (this.model.defineAnswersLength() === MAX_ANSWERS_LENGTH) {\n this.win();\n } else {\n this.startGame();\n }\n }", "function validateUserResponse() {\n\n console.log('VALIADATION');\n\n // If answer was correct, animate transition to next card\n if (currentcard['french'] === $('#firstField').val()) {\n\n acceptAnswer();\n } else {\n // show solution\n animateShake();\n revealSolution();\n }\n}", "function isAnswerCorrect(answer){\n\n if(correctAnswer === answer){\n return true;\n }\n else{\n return false;\n }\n}", "checkAnswer(answer) {\n let check = false;\n if (answer == this.rightAnswer)\n check = true;\n check ? console.log(`CORRECT`) : console.log(`INCORRECT`);\n return check;\n }", "function checkA() { \n if (ans == \"0\") {\n correct();\n }\n else {\n incorrect();\n }\n}", "function answerQ () {\n let val = document.getElementById('answer');\n \n if (val === '') { alert('Mohon jawab dulu!'); generateAngka(); }\n \n if (val === ops) { alert('Jawaban kamu benar!\\nMembuat pertanyaan baru lagi..'); generateAngka(); }\n}", "function correctAnswer() {\n return $scope.answer.value === $scope.data.solution;\n }", "function isAnswer() {\n var input = document.getElementsByName('number');\n \n for (let x = 0; x < input.length; x++) {\n let li = input[x].parentElement;\n let span = li.getElementsByTagName('span');\n let [number1, number2, symbol] = [\n span[0].innerHTML,\n span[2].innerHTML,\n span[1].innerHTML\n ];\n let math = new mathNumber(number1, number2);\n\n if (input[x].value == '' || input[x].value == null) {\n continue;\n } else {\n switch (symbol) {\n case '+':\n if (parseInt(input[x].value) === math.add()) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n \n case '-':\n if (parseInt(input[x].value) === math.minus()) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n\n case '×':\n if (parseInt(input[x].value) === math.multiplication()) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n\n case '÷':\n if (parseInt(input[x].value) === Math.round(math.division())) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n }\n }\n }\n }", "function checkAnswer() {\r\n // get first factor\r\n var factor1 = document.getElementById('factor1').innerHTML;\r\n console.log(\"factor 1 = \" + factor1);\r\n // get second factor\r\n var factor2 = document.getElementById('factor2').innerHTML;\r\n console.log(\"factor 2 = \" + factor2);\r\n // get answer\r\n var answer = document.getElementById('answer').value;\r\n console.log(\"answer = \" + answer);\r\n console.log((factor1*factor2) == answer);\r\n return (factor1*factor2) == answer;\r\n}", "function checkFormOutcome () {\n\tif (!oneTransactionOutcome.NameOfCountOutcome.length){\n\t\talert(\"Поле \\\"На счет:\\\" пустое или неверное значение!\");\n\t\treturn 0;\n\t} else if (!oneTransactionOutcome.NameOfOutcome.length) {\n\t\talert(\"Поле \\\"Доход от:\\\" пустое!\");\n\t\treturn 0;\n\t} else if (!oneTransactionOutcome.DataOfCountOutcome.length) {\n\t\talert(\"Поле \\\"Дата:\\\" пустое!\");\n\t\treturn 0;\n\t} else if (!oneTransactionOutcome.ValueOfCountOutcome.length) {\n\t\talert(\"Поле \\\"Cумма:\\\" пустое!\");\n\t\treturn 0;\n\t} else if (!/[0-9]{1,8}\\.[0-9]{2}/.test(oneTransactionOutcome.ValueOfCountOutcome)){\n\t\talert(\"В поле \\\"Сумма:\\\" неправильный формат! \\nПравильно 0.00 \");\n\t\treturn 0;\n\t}else {\n\t\treturn 1;\n\t}\n}", "function isCorrect(eu, usd){\r\n \r\n if(eu < 0 || usd < 0 || isNaN(eu) || isNaN(usd))\r\n {\r\n return false;\r\n } \r\n \r\n return true;\r\n}", "function is_correct_answer(answer_text){\n if (answer_text == correctAnswer) {\n return true;\n }\n return false;\n}", "function evaluateAnswer(userAnswer, correctAnswer){\n console.log('evaluating answer');\n if(userAnswer === correctAnswer){\n return true;\n }else {\n return false;\n } \n}", "evaluateAnswer(userAnswer){\n \tconst {value1, value2, value3, proposedAnswer} = this.state;\n \tconst corrAnswer = value1 + value2 + value3;\n \treturn(\n \t\t (corrAnswer === proposedAnswer && userAnswer === 'true') ||\n \t\t (corrAnswer !== proposedAnswer && userAnswer === 'false')\n \t);\n }", "function validateForm() {\r\n let regex = /^\\d*\\.?\\d*$/;\r\n if (\r\n regex.test(people.value) === false ||\r\n regex.test(priceB4Tip.value) === false ||\r\n regex.test(tipChoice.value) === false\r\n ) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "function checkAnswers() {\n\n}", "function isValidCard(){\n\t\n\tvar result=[];\n\tvar result=numbers.reverse();//el reverse lo coloque porque sirve para invertir los elementos\n\t//tngo que multiplicar cada casilla par(luhn)\n\tfor(var i=0; i<numbers.length; i++){ \n\t if(result==\"\"){ // puse \"\", porque el usuario no puede ingresar un campo vacío\n\t alert(\"tarjeta inválida\");\n } else{\n\t return alert(\"tarjeta válida\");\n\n}\n}\n}", "function checkAns(compAns) {\n\t//get value of user input\n\tvar userAns = document.getElementById(\"answer\").value;\n\tif(isNaN(userAns)) {\n\t\t//check if input is valid number\n\t\talert(\"Please enter valid numeric input.\");\n\t\tres();\n\t}\n\telse {\n\t\tuserAns = parseInt(userAns);\n\t\t//check if user answer = correct comp. answer\n\t\tif(userAns == compAns) {\n\t\t\tdocument.getElementById(\"comment\").innerHTML = \"Very good!\";\n\t\t\tdocument.getElementById(\"answer\").value = \"\";\n\t\t\t//delay confirmation statement \n\t\t\tsetTimeout(function() {\n\t\t\t\tvar confirmation = confirm(\"Do you want to answer another problem?\");\n\t\t\t\tif(confirmation == true) {\n\t\t\t\t\tres();\n\t\t\t\t\tgenerateQ();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tres();\n\t\t\t\t}\n\t\t\t}, 1);\n\t\t\n\t\t\t\n\t\t}\n\t\telse {\n\t\t\t//if user answer incorrect, have user input another answer\n\t\t\tdocument.getElementById(\"comment\").innerHTML = \"No. Please try again.\";\n\t\t\tdocument.getElementById(\"answer\").value = \"\";\n\t\t\t\n\t\t}\n\t}\n\t\n}", "validateAnswer(answer){\n \n if(answer === this.rightAnswer){\n \n return true;\n // return imageUrl;\n }\n \n return false;\n }", "function validateInstructionChecks() {\n \n instructionChecks = $('#instr').serializeArray();\n\n var ok = true;\n var allanswers = true;\n if (instructionChecks.length < 2) {\n alert('Please complete all questions.');\n allanswers = false;\n \n \n } else {\n allanswers = true;\n for (var i = 0; i < instructionChecks.length; i++) {\n // check for incorrect responses\n if(instructionChecks[i].value === \"incorrect\") {\n alert('At least one answer was incorrect; please read the instructions and try again.');\n ok = false;\n break;\n }\n }\n }\n \n \n // goes to next section\n if (!allanswers) {\n showInstructionCheck;\n } else if(!ok) {\n showInstructions(); \n } else {\n hideElements();\n showDummyVignette(); \n }\n}", "function validateAnswer(cell) {\n const p = findPosition(cell);\n // since getting html text is string so need to convert into int\n const answer = parseInt(cell.html());\n return (answer === defaultBoard[p.x][p.y]);\n}", "function verifierEquation(item,min,max,numberDisplay) {\n\t\n\tvar reponseUser = item.innerHTML;\n\tvar nbr1 = parseInt(document.getElementById(\"nbr1\").innerHTML);\n\tvar nbr2 = parseInt(document.getElementById(\"nbr2\").innerHTML);\n\tvar signe = document.getElementById(\"signe\").innerHTML;\n\t\n\tclearAnswer(numberDisplay);\n\t\n\tvar reponseEquation = calculEquation(nbr1,nbr2,signe);\n\t\n\tif (reponseUser == reponseEquation) {\n\t\t\n\t\tdisplayAfterGoodAnswer(reponseEquation)\n\t\t\n\t\tnumberGoodAnswer ++; \n\t\tnumberTotalAnswer ++;\n\t\t\n\t\tafficheNumberGoodAnswer();\n\t\t\n\t\tsetTimeout(load_game_mathEquation, 2000, signe,min,max,numberDisplay);\n\t}else {\n\n\t\tdisplayAfterBadAnswer(reponseEquation)\n\t\t \n\t\tnumberTotalAnswer ++;\n\t\t\t\n\t\tafficheNumberGoodAnswer();\n\t\t\n\t\tsetTimeout(load_game_mathEquation, 2000, signe,min,max,numberDisplay);\n\t}\t\n}", "function validateQuestion(body)\r\n {\r\n // return false if there are no question text and image\r\n if (body.body.length == 0 && body.imageUrl.length == 0)\r\n return false;\r\n\r\n // parse answers texts and images\r\n var aTexts = body.answersTexts.split(\",\");\r\n var aImages = body.answersImages.split(\",\");\r\n\r\n // if there are no 4 answers\r\n if (aTexts.length != 4) return false;\r\n if (aImages.length != 4) return false;\r\n\r\n for (var i = 0; i < 4; i++)\r\n // return false if there is an empty answer\r\n if (aTexts[i].length == 0 && aImages[i].length == 0)\r\n return false;\r\n\r\n // return true if everything is okay\r\n return true;\r\n }", "isValid() {\n let value = this.input.value;\n return !isNaN(value);\n }", "function validateAnswer() {\n var question = questions[viewedQuestion];\n if (questions[viewedQuestion] && viewedQuestion < questions.length) {\n if (question.correctAnswer === this.textContent) {\n rightWrong.textContent = \"Correct!\";\n rightWrong.className = \"right\";\n } else {\n rightWrong.textContent = \"Incorrect!\";\n rightWrong.className = \"wrong\";\n timeLeft = timeLeft - 10;\n }\n }\n viewedQuestion++;\n answersUl.innerHTML = \"\";\n showQuestion();\n lastTime();\n}", "function validate (input) {\n \t//ver dps..\n \treturn true;\n }", "function inputLength( ){ \n \n while(goodAnswer === false){\n var lanswer = prompt(\"please enter length between 8 and 128 characters\"); \n var truNum = isNaN(lanswer); \n if(lanswer < 8 || lanswer > 128 || lanswer === null || lanswer === ''){\n alert(\"answer must be greather than or equal to 8 or less than or equal to 128\");\n }else if(truNum) {\n alert(\"input must be nuneric\");\n }else{\n goodAnswer = true;\n return lanswer;\n break;\n }\n } \n }", "function inputCheck(i, firstQuestion, invalidInput) {\n \n let correction;\n\n while (i < (firstQuestion + 5)) { // Only checks validity of 5 questions\n let input = document.querySelector(\"#answer\" + i).value;\n correction = document.querySelector(\"#answer\" + i +\"correction\");\n correction.innerHTML = \"\"; // Resets text to empty \n\n document.querySelector(\"#answer\" + i).style = \"background-color:#fff;\"; // Resets bgc to white\n\n try {\n if(input == \"\") throw \"Please answer the question\"; // If left empty, tell to answer\n if(isNaN(input) && typeof(ANSWERS[(i-1)]) == 'number') throw \"Please answer with a number\"; // If they answer with words but should have with a number, tell to answer with number\n if(isFinite(input) && typeof(ANSWERS[(i-1)]) != 'number') throw \"Please answer with a letter/word\"; // If they answer with a number but should have with a word, tell to answer with a word\n } catch (error) {\n correction.innerHTML = error;\n document.querySelector(\"#answer\" + i).style = \"background-color:#f8fcb0;\"; // Changes bgc to yellow\n\n invalidInput++; // Increase the number of answers invalid\n }\n i++;\n }\n alert(invalidInput);\n return invalidInput;\n}", "function test() {\n function square(x) {\n return Math.pow(x, 2);\n }\n function cube(x) {\n return Math.pow(x, 3);\n }\n function quad(x) {\n return Math.pow(x, 4);\n }\n if (square(2) !== 4 || cube (3) !== 27 || quad(4) !== 256) {\n console.log(\"check question 1\");\n }\n else {\n console.log(\"You are great at math!\");\n }\n}", "function checkAnswer(questionNumber, answer) {\n\n}", "function valid(){return validated}", "function checkAns() {\n\tdocument.getElementById(\"outputyes\").innerHTML = (\"\");\n\tdocument.getElementById(\"outputno\").innerHTML = (\"\");\n\t\n\tnumb1 = parseInt(number1);\n\tnumb2 = parseInt(number2);\n\tansIn = parseInt(document.getElementById(\"check\").value);\n\n\tvar ansCor = numb1 * numb2;\n\n\n\tif (ansCor == ansIn) {\n\t\tdocument.getElementById(\"yes_no\").className = \"block\";\n\t\tdocument.getElementById(\"outputyes\").innerHTML = (\"Very Good! Do you want to try again?\");\n\t\t\t\t$(\"#myform\")[0].reset();\n\t\t\n\n\t\t\n\n\t} else\n\n\t{\t\n\t\tdocument.getElementById(\"yes_no\").className = \"none\";\n\t\tdocument.getElementById(\"outputno\").innerHTML = (\"No. Please try again.\");\n\t\t//document.getElementById(\"ansIn\").innerHTML = ansIn;\n\t\t$(\"#myform\")[0].reset();\n\t\t\n\n\t\t\n\n\t}\n}", "function checkPass(result) {\n let labMarks = result.labMarks ? result.labMarks : 0;\n return result.theoryMarks + labMarks >= 50;\n }", "async function valid (option) {\n return !!(await getBetOption(option))\n }", "function checkUserAnswer(answer) {\n//when the user selects an answer and it is exactly equal to an index in the correctAnswer object key,\n\tif(answer.text() === questionList[getCurrentIndex()].ansArray[questionList[getCurrentIndex()].correctAnswer]) {\n return true;\n console.log(true);\n } else {\n return false;\n console.log(false);\n }\n}", "function ControlData(pu, qte){\n try {\n if(isNaN(pu)) throw \"Entrer un Prix Unitaire correct\";\n if(isNaN(qte)) throw \"Entrer une Quantité correct\";\n if(parseFloat(pu) == NaN) throw \"Le Prix Unitaire n'est pas correct\";\n if(parseFloat(qte) != parseInt(qte)) throw \"La Quantité doit être un nombre entier\";\n \n }\n catch(error){\n alert(error);\n return;\n }\n return true;\n}", "function answerIsCorrect() {\n correctAnswerFeedback();\n nextQuestion();\n addToScore();\n}", "isCorrect(index, answers) {\n if (answers.indexOf(index) != -1) {\n return 100;\n }\n return 0;\n }", "function checkIterationFormInfo(objData){\n\t\n\tif (objData.length < 16) {\n\t\talert(\"Please answer all questions before finishing the experiment\");\n\t\treturn false;\n\t}\n\n\tfor (var i = 0; i < objData.length; i++) {\n\t\tif (objData[i].value == \"\"){\n\t\t\talert(\"Please answer question: \" + objData[i].name);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "function evaluateAnswers(answer) {\n\n\tif(answer === answers[0].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[0].isCorrect;\n\t}\n\n\telse if(answer === answers[1].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[1].isCorrect;\n\t}\n\telse if(answer === answers[2].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[2].isCorrect;\n\t}\n\telse if(answer === answers[3].answer.toUpperCase()) {\n\t\tcorrectAnswer = answers[3].isCorrect;\n\t}\n\n\telse {\n\t\tunanswered = true;\n\t}\n}", "function userInput(){ \n everythingOk = false; \n while(everythingOk === false){\n // answer = inputLength(); \n upCaseRslt = upCase();\n lcase = lowCase(); \n numAnsr = numOpt();\n symbolAnswer = simbl(); \n if(upCaseRslt === false && lcase === false && numAnsr === false && symbolAnswer === false){\n alert(\"at least one option must be checked in order to create password\"); \n }else{ \n everythingOk = true; \n } \n } \n }", "function checkAnswer(choice, answer) {\n if (choice == answer) {\n return true;\n } else {\n return false;\n }\n }", "function checkSign(){\n return result.length === 1 && (result === \"/\" || result === \"*\" || result === \"+\" || result === \"-\");\n }", "function validaruc(){\r\n\t\tvar ruc = document.getElementById('ruc');\r\n\t\tlimpiarError(ruc);\r\n\t\tif(ruc.value ==''){\r\n\t\t\talert ('Completa el campo de ruc o rise');\r\n\t\t\terror(ruc);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if(isNaN(ruc.value)){\r\n\t\t\talert('Formato del RUC o RISE debe ser numeros');\r\n\t\t\terror(ruc);\r\n\t\t\treturn false;\t\r\n\t\t}\r\n\t\telse if(ruc.value.length<13){\r\n\t\t\talert('Error: Solo se debe ingresar minimo 13 digitos');\r\n\t\t\terror(ruc);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if(ruc.value.length>13){\r\n\t\t\talert('Error: solo se debe ingresar maximo 13 digitos');\r\n\t\t\terror(ruc);\r\n\t\t\treturn false;\r\n\t\t}return true;\r\n\t}", "function whatIfInputIsEmptyOrIncorrect(formNum, htmlInputElArea, input, incorrectFeedback, correctFeedback, allGoodFeedback, regexToValidate) {\n // Es valida la info o no\n var infoValida = false;\n if (input === '' || input == \"0\") {\n htmlInputElArea.classList.add(\"is-invalid\");\n incorrectFeedback.innerHTML = \"Data missing.\";\n correctFeedback.innerHTML = \"\";\n }\n else if (formNum == 1 && validation(input, regexToValidate) == false) {\n htmlInputElArea.classList.add(\"is-invalid\");\n incorrectFeedback.innerHTML = \"Please enter valid data.\";\n correctFeedback.innerHTML = \"\";\n }\n else {\n htmlInputElArea.classList.remove('is-invalid');\n htmlInputElArea.classList.add(\"is-valid\");\n incorrectFeedback.innerHTML = \"\";\n correctFeedback.innerHTML = allGoodFeedback;\n infoValida = true;\n }\n return infoValida;\n}", "function checkObs(answers, obs){\n var result = []; var sum = 0;\n var correctAns = model.observe(obs,false);\n var allCorrect = 1;\n var error = [\"\",-1];\n \n for (var i = 0; i < answers.length; i++){\n sum += answers[i];\n if(answers[i] < 0){\n error = [\"negative_error\",i];\n }\n if (answers[i].toFixed(3) == correctAns[i].toFixed(3)){\n result[i] = \"right\"; \n }\n else {result[i] = \"wrong\"; allCorrect = 0;}\n }\n result[answers.length] = allCorrect;\n if (sum != 1){error[0] = \"sum_error\";}\n result[answers.length+1] = error;\n return result;\n }", "function checkAnswer() {\n let userAnswer = parseInt(document.getElementById(\"answer-box\").value);\n let calculatedAnswer = calculateCorrectAnswer();\n let isCorrect = userAnswer === calculatedAnswer[0];\n\n if (isCorrect) {\n alert(\"Hey! You got it right! :D\");\n incrementScore();\n } else {\n alert(`Awwww.....you answered ${userAnswer}. The correct answer was ${calculatedAnswer[0]}!`);\n incrementWrongAnswer();\n }\n\n runGame(calculatedAnswer[1]);\n\n\n}", "function validar_rut()\n{\n var rut = document.getElementById('rut_b');\n var digito = document.getElementById('dv_b');\n var numerico = rut.value.search( /[^0-9]/i );\n \n if(rut.value == \"\" && digito.value == \"\")\n return true\n if( numerico != -1 ) {\n alert(\"El rut contiene un caracter no numerico\")\n return false\n }\n if( digito.value == \"\" && rut.value != \"\") {\n alert(\"No ha ingresado el digito verificador\")\n return false\n }\n if( digito.value != \"K\" && digito.value != \"k\" )\n {\n var numerico1 = digito.value.search( /[^0-9]/i );\n if( numerico1 != -1 )\n {\n alert(\"El digito verificador no es valido\")\n return false\n }\n }\n var rut_aux = rut.value;\n var i = 0;\n var suma = 0;\n var mult = 2;\n var c = 0;\n var modulo11 = 0;\n var largo = rut_aux.length;\n for( i = largo - 1; i >= 0; i-- )\n {\n suma = suma + rut_aux.charAt( i ) * mult;\n mult++;\n if( mult > 7 )\n mult = 2;\n }\n modulo11 = 11 - suma % 11;\n if( modulo11 == 10 )\n modulo11 = \"K\";\n if( modulo11 == 11 )\n modulo11 = \"0\";\n if( modulo11 != digito.value.toUpperCase() )\n {\n alert( \"Rut invalido.\" );\n return false;\n }\n return true;\n}", "function checkAnswer(){\n var sum = operand1 +operand2;\n var userAnswer = document. getElementById(\"answerInput\").value;\n \n if(sum == userAnswer){\n document.getElementById(\"response\").innerHTML=\"Correct!\";\n }\n else{\n document.getElementById(\"response\").innerHTML=\"Congrats, YOU GOT IT WRONG SUCKER!\";\n }\n \n}", "function checkUserInput(){\n\t\t//check if title name is inputted\n\t\tif (!$(element).find('input[id=edit_title_name]').val()){\n\t\t\talert (\"Please input the test's title name\");\t\t\n\t\t\treturn false;\n\t\t}\n\t\t//check if test type is selected\n\t\tif (!$('#edit_test_type').val()){\n\t\t\talert (\"Please choose the test type\");\t\t\n\t\t\treturn false;\n\t\t}\n\t\t//check if total question number is inputted correctly\n\t\tif ( isNaN($(element).find('input[id=edit_total_question]').val()) || !isPositiveInteger($(element).find('input[id=edit_total_question]').val()) ){\n\t\t\talert (\"Please input correct number in total main question number\");\t\t\n\t\t\treturn false;\n\t\t}\n\t\t//check in each question set...\n\t\tnGroups = $(element).find('input[id=edit_total_question]').val();\n\t\tfor (var i=1;i<=nGroups;i++){\n\t\t\t//check if sub question number is inputted correctly\n\t\t\tif (isNaN($(element).find('input[id=edit_total_sub_question_' + i + ']').val()) || !isPositiveInteger($(element).find('input[id=edit_total_sub_question_' + i + ']').val()) ){\n\t\t\t\talert (\"Please input correct number in total sub question number for Q\" + i);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t//check in each question...\n\t\t\tvar total_sub_question = $(element).find('input[id=edit_total_sub_question_' + i + ']').val();\n\t\t\tfor (var j=1;j<=total_sub_question;j++){\n\t\t\t\t//check question content or picture is inputted\n\t\t\t\tif (!$(element).find('input[name=question' + i + '\\\\.'+ j + ']').val() && !$(element).find('input[name=question' + i + '\\\\.'+ j + '_pic]').val()){\n\t\t\t\t\talert (\"Please input a question content or picture on Q\" + i + \".\" + j);\n\t\t\t\t\treturn false;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t//check learning object link and name are inputted.\n\t\t\t\tif (!$(element).find('input[name=lo' + i + '\\\\.' + j + '_link]').val() && $(element).find('input[name=lo' + i + '\\\\.' + j + '_link]').length > 0){\n\t\t\t\t\tif (j==1) {}\n\t\t\t\t\telse {\n\t\t\t\t\t\talert (\"Please input learning object link for Q\" + i + '.' + j);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!$(element).find('input[name=lo' + i + '\\\\.' + j + '_name]').val() && $(element).find('input[name=lo' + i + '\\\\.' + j + '_name]').length > 0){\n\t\t\t\t\tif (j==1) {}\n\t\t\t\t\telse {\n\t\t\t\t\t\talert (\"Please input learning object name for Q\" + i + '.' + j);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//variable to check for checkbox (correct answer)\n\t\t\t\tvar isChecked = false;\t\n\t\t\t\t//check for each answer...\n\t\t\t\tfor (var k=1;k<=4;k++){\n\t\t\t\t\t//check answer content is inputted\n\t\t\t\t\tif (!$(element).find('input[name=answer' + i + '\\\\.'+ j + '_'+ k + ']').val()){\n\t\t\t\t\t\talert (\"Please input an answer for Q\" + i + \".\" + j);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t//check if one of checkboxes is selected \n\t\t\t\t\tif ( $(element).find('input[id=answer' + i + '\\\\.'+ j + '_'+ k + '_cb]').is(':checked')){\n\t\t\t\t\t\tisChecked = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//if no checkbox is selected\n\t\t\t\tif (!isChecked){\n\t\t\t\t\talert (\"Please select one correct answer in Q\" + i + \".\" + j);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\t\t\n }\n\t\treturn true;\n\t}", "function printQuizResult(ans, result){\n if(result == ans){\n console.log(`CORRECT ANSWER 😁\\n`);\n return 1;\n }else{\n console.log(`OOPS!WRONG ANSWER 🙁\\nCORRECT ANSWER IS: ${result}`);\n }\n return 0;\n}", "function checkanswer(){\r\n if (userClickedPattern[currentspot]===gamePattern[currentspot])\r\n {\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n}", "function validatorText(response) {\n // Make sure the response is not a number, and that it exists\n\tlet validation = response && isNaN(response) ? true : 'This response is required but it needs to be text! Try again!'\n\treturn validation;\n}", "function generalChecks(){\n checkSumGenerated = dataConv.generateCheckSum(data.slice(1,-2)); //No tiene en cuenta el caracter inicial ni los 2 finales (estos son el checksum)\n checkSumIncoming = data.substr(data.length - 2); //Toma solo los 2 ultimos caracteres de la respuesta\n if (checkSumGenerated !== checkSumIncoming){\n console.log(\"Checksum validation error, the response is not valid\");\n return false; \n }else{\n return true;\n }\n}", "function confirmValidation(input) {\n if (input !== \"Yes\" || input !== \"No\" || input !== \"y\" || input !== \"n\") {\n return \"Incorrect asnwer\";\n } else if (input === \"No\" || input === \"n\") {\n process.exit();\n } else {\n return true;\n }\n}", "function formIsValid() {\n if (total_loan_box.value === \"\" || isNaN(total_loan_box.value)) {\n speakToUser(\"You must enter a valid decimal number for the <strong>Total Loan Amount</strong>.\");\n focusOnBox(\"total_loan\");\n return false;\n }\n\n if (interest_rate_box.value === \"\" || isNaN(interest_rate_box.value)) {\n speakToUser(\"You must enter a valid decimal number for the <strong>Yearly Interest Rate</strong>.\");\n focusOnBox(\"interest_rate\");\n return false;\n }\n\n if (loan_term_box.value === \"\" || isNaN(loan_term_box.value)) {\n speakToUser(\"You must enter a valid number of years for the <strong>Loan Term</strong>.\");\n focusOnBox(\"loan_term\");\n return false;\n }\n\n return true;\n}", "function checkSum(answer,observation){\n console.log(answer[0]);\n var correctAns = model.prob_OnS()[observation];\n var sum = 0;\n for (var i = 0; i < Object.keys(correctAns).length; i++){\n sum += correctAns[i];\n }\n // console.log(sum);\n if (answer[0].toFixed(3) == sum.toFixed(3)) {return 1;}\n else {return 0;}\n }", "function check(){\n if(trivia.questions.userGuess==trivia.questions.answer){\n \tcorrectAnswer++;\n }\n else if(trivia.questions.userGuess!=trivia.questions.answer){\n \tincorrectAnswer++;\n }\n if(trivia.questions2.userGuess==trivia.questions2.answer){\n \tcorrectAnswer++;\n }\n else if(trivia.questions2.userGuess!=trivia.questions2.answer){\n \tincorrectAnswer++;\n }\n\n if(trivia.questions3.userGuess==trivia.questions3.answer){\n \tcorrectAnswer++;\n }\n else if(trivia.questions3.userGuess!=trivia.questions3.answer){\n \tincorrectAnswer++;\n }\n\n if(trivia.questions4.userGuess==trivia.questions4.answer){\n \tcorrectAnswer++;\n }\n\n else if(trivia.questions4.userGuess!=trivia.questions4.answer){\n \tincorrectAnswer++;\n }\n\n if(trivia.questions5.userGuess==trivia.questions5.answer){\n \tcorrectAnswer++;\n }\n\n else if(trivia.questions5.userGuess!=trivia.questions5.answer){\n \tincorrectAnswer++;\n }\n\nCorrect();\nIncorrect();\n}", "function validChecker(good) {\n if (typeof good == \"number\") {\n // check if we received an integer or string.\n if (good >= 8 && good <= 128) {\n return true; // returns true for good input\n } else return false;\n } else {\n // received a string for (y or n) responses, or NaN in the password length prompt\n if (good == \"y\" || good == \"n\") {\n return true; // good input if only (y or n)\n } else return false;\n }\n}", "function validateform(){\n var contain =[];\n var flag;\n jQuery(\"#all_possible_responses input:text\").each(function(){\n contain.push(jQuery(this).val());\n });\n //~ alert(contain);\n //~ alert(contain.length);\n if (contain.length > 0)\n {\n for (var i = 0; i < contain.length; i++)\n {\n //~ alert(contain[i]);\n if (contain[i]=='')\n {flag =false;}\n else\n {flag=true}\n }\n if (flag == true)\n {return true;}\n else\n {\n //~ alert(\"error\");\n jQuery('.common_valid').text(\"Please enter the answer\");\n jQuery(\".common_valid\").css(\"color\", \"#FF0000\");\n return false;\n }\n }\n else\n {\n //~ alert(\"return\");\n return true;\n }\n }", "function Valida_Rut(Objeto)\n\n{\n\n var tmpstr = \"\";\n\n var intlargo = Objeto.value;\n\n if (intlargo.length > 0)\n\n {\n\n crut = Objeto.value;\n\n largo = crut.length;\n\n if (largo < 2)\n\n {\n\n sweetAlert(\"ERROR\", \"RUN INVALIDO!\", \"error\");\n\n //Objeto.focus();\n\n return false;\n\n }\n\n for (i = 0; i < crut.length; i++)\n if (crut.charAt(i) !== ' ' && crut.charAt(i) !== '.' && crut.charAt(i) !== '-')\n\n {\n\n tmpstr = tmpstr + crut.charAt(i);\n\n }\n\n rut = tmpstr;\n\n crut = tmpstr;\n\n largo = crut.length;\n\n\n\n if (largo > 2)\n rut = crut.substring(0, largo - 1);\n\n else\n rut = crut.charAt(0);\n\n\n\n dv = crut.charAt(largo - 1);\n\n\n\n if (rut === null || dv === null)\n return 0;\n\n\n\n var dvr = '0';\n\n suma = 0;\n\n mul = 2;\n\n\n\n for (i = rut.length - 1; i >= 0; i--)\n\n {\n\n suma = suma + rut.charAt(i) * mul;\n\n if (mul === 7) {\n\n mul = 2;\n\n } else {\n\n mul++;\n }\n\n }\n\n\n\n res = suma % 11;\n\n if (res === 1) {\n dvr = 'k';\n\n } else if (res === 0) {\n dvr = '0';\n\n } else {\n\n {\n\n dvi = 11 - res;\n\n dvr = dvi + \"\";\n\n }\n }\n\n\n\n if (dvr !== dv.toLowerCase())\n\n {\n\n\n sweetAlert(\"ERROR!!!\", \"RUN INCORRECTO!\", \"error\");\n }\n //Objeto.focus();\n\n return false;\n\n }\n\n\n\n // Objeto.focus();\n\n return true;\n\n}", "function validateIDOnList(answer) {\n\n if (isNaN(answer) === false && parseInt(answer) > 0 && parseInt(answer) <= itemList) {\n return true;\n }\n return \"Please input a number that is on the list!\";\n}", "function validatorText(response) {\n\t// Make sure the response is not a number, and that it exists\n\tlet validation = response && isNaN(response) ? true : 'This response is required & it needs to be text! Try again!';\n\treturn validation;\n}", "function validateInput () {\n\torigTestString = userInput.value;\n\tdomElement.innerHTML = `${origTestString} :Your Input`;\n\tvar string = origTestString; //this is defined globally\n\tfunction hasNumber(string) {\n\t return(/[\\]\\\\_+-.,!?@#$%^&*():=;/|<>\"'0-9]+/g.test(string));\n\t}\n\t\tif (!hasNumber(string)) { //BANG is saying \"FALSE\" + \"FALSE\" we'd get from an excluded character above, THUS = TRUE\n\t console.log(\"Valid\");\n\t testString = origTestString; //overwriting our other global value for moving forward\n\t console.log(\">testString : \", testString);\n\t\t\tdocument.getElementById(\"error\").innerHTML = `Excellent phrase!`;\n\t makeItSo ();\n\t} else {\n\t console.log(\"Invalid - No numbers or symbols\");\n\t\t\tdocument.getElementById(\"error\").innerHTML = `Invalid - No numbers or symbols`;\n\t}\n}", "checkAnswers() {\n let gotRight = true;\n // see that they got them all right\n for (var i in this.displayedAnswers) {\n if (\n gotRight != false &&\n this.displayedAnswers[i].correct &&\n this.displayedAnswers[i].userGuess\n ) {\n gotRight = true;\n } else if (\n this.displayedAnswers[i].correct &&\n !this.displayedAnswers[i].userGuess\n ) {\n gotRight = false;\n } else if (\n !this.displayedAnswers[i].correct &&\n this.displayedAnswers[i].userGuess\n ) {\n gotRight = false;\n }\n }\n return gotRight;\n }", "function promptFor(question,valid,people){\n let isValid;\n do{\n var response = prompt(question).trim();\n isValid = valid(response,people);\n } while(response === \"\" || isValid === false)\n return response;\n}", "function valida21(){\t\n\t\n\tvar res = $('input[name=\"optradio\"]:checked').val();\n\t\n\tif (res=='N') {\n\t\tcorrecto(\"Correcto\");\n\t}else if (res == 'S') {\n\t\terror(\"Favor de repetir el ejercicio\");\n\t}\n\t\n\tif (res!='S' && res!='N' ){\n\t\terror(\"Selecciona una de las opciones disponibles.\");\n\t}\n}", "function validateNumber(answer) {\n\n var reg = /^\\d+$/;\n return reg.test(answer) || \"Please input a number!\";\n\n}", "function validateNumber(answer) {\n\n var reg = /^\\d+$/;\n return reg.test(answer) || \"Please input a number!\";\n\n}", "function checkAnswers() {\n console.log(\"Max value is: \", maxValue(firstNum, secondNum));\n console.log(\"Min value is: \", minValue(firstNum, secondNum));\n if (checkParity(num)) console.log(`${num} is even`);\n else console.log(`${num} is odd`);\n}", "function validateAnswer(userSelectedAnswer, currentQuestion) {\n const correctAnswer = currentQuestion.answer;\n if (userSelectedAnswer == correctAnswer) {\n handleCorrectAnswer(userSelectedAnswer);\n //Since the correct answer was selected we increment the users score\n incrementUserScore();\n } else {\n handleIncorrectAnswer(userSelectedAnswer, correctAnswer, score);\n }\n}", "function validation() {\r\n\t\tif ((circleRecipe.checked == true && recipeCircleArea() > 0) || (rectangleRecipe.checked == true && returnValue(lengthARecipe) > 0 && returnValue(lengthBRecipe) > 0)) {\r\n\t\t\tif ((circleUser.checked == true && userCircleArea() > 0) || (rectangleUser.checked == true && returnValue(lengthAUser) > 0 && returnValue(lengthBUser) > 0)) {\r\n\t\t\t\tconvertAlert.innerHTML = '';\r\n\t\t\t\tconvert();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconvertAlert.innerHTML = '<p>You must define what kind of baking mold you use and inscribe its dimensions before convert!</p>';\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconvertAlert.innerHTML = '<p>You must define what kind of baking mold is used in the recipe and inscribe its dimensions before convert!</p>';\r\n\t\t}\r\n\t}", "checkValidate(member){\n\t\tlet a = $('#input_membership').val();\n\t\tlet b = a.toString();\n\t\tlet c = 0;\n\t\n\t\tfor (var i = 0; i < b.length; i++){\n\t\t\tlet l = 6-i;\n\t\t\tc += Number(b[i]) * l ; \n\t\t}\n\t\n\t\tif ((c % 11) !== 0 || b.length !== 6){\n\t\t\t$('#error02').show();\n\t\t\treturn false\n\t\t}\n\t\n\t\telse if ((c % 11) === 0 && b.length === 6){\n\t\t\t$('#error02').hide();\n\t\t\treturn true\n\t\t}\n\n\t}", "verifySolution() {\n // userInput == curr solution\n // alert(userInput)\n \n this.player.prevResponseCorrectness = true\n this.foundSolution = true\n return true\n // console.log(this.input._value)\n // let userInput = this.input._value\n // alert(userInput)\n // let solution = this.player.currSolution\n // // set this to true in order to handle updates when solution is found\n // this.foundSolution = true\n // if (userInput == solution) {\n // this.foundSolution = true\n // }\n // this.player.prevResponseCorrectness = this.foundSolution\n \n // return this.foundSolution\n }", "isValid() {\n return this.hr > 0 && this.hr < 25\n && this.min > -1 && this.min < 60\n && this.slam > -1 && this.slam < 300;\n }", "function validate(dataValidate) {\n let isCorrect = true,isCorrectAnswerCount = 0;\n //show error answer\n for (let i = 0; i < dataValidate.answer.length; i++) {\n let errorAnswerId = $(\"#\" + dataValidate.error_answer[i]);\n if(dataValidate.answer[i]!=undefined){\n if (dataValidate.answer[i].trim() == \"\") {\n errorAnswerId.attr(\"style\", \"display: block\");\n errorAnswerId.prev().removeClass(\"mb-3\");\n errorAnswerId.addClass('mb-3');\n isCorrect = false;\n } else {\n errorAnswerId.attr(\"style\", \"display: none\");\n errorAnswerId.removeClass('mb-3');\n errorAnswerId.prev().addClass('mb-3');\n isCorrectAnswerCount++;\n }\n }\n }\n if(isCorrectAnswerCount>=2){\n //Clear error\n for (let j = 0; j < dataValidate.answer.length; j++) {\n let errorAnswerId = $(\"#\" + dataValidate.error_answer[j]);\n errorAnswerId.attr(\"style\", \"display: none\");\n errorAnswerId.removeClass('mb-3');\n errorAnswerId.prev().addClass('mb-3');\n }\n isCorrect = true;\n }\n\n //show question error\n if (dataValidate.question.trim() === \"\") {\n $(\"#\" + dataValidate.error_question).attr(\"style\", \"display: block\");\n isCorrect = false;\n } else {\n $(\"#\" + dataValidate.error_question).attr(\"style\", \"display: none\");\n }\n\n //show error when no select true answer\n if (isCorrect) {\n let selectCount = 0;\n for (let i = 0; i < dataValidate.select.length; i++) {\n if (dataValidate.select[i] === true && dataValidate.answer[i].trim() !== \"\") {\n selectCount = selectCount + 1;\n }\n }\n if (selectCount < 1) {\n isCorrect = false;\n warningModal(mustCheckCorrectAnswer);\n }\n }\n return isCorrect;\n}", "function validForm(...results) {\n let result = true;\n console.log('checking if the form is valid');\n results.forEach((cur) => {\n // console.log(cur.length);\n if (cur.length < 3) {\n console.log(`${cur} is not valid`);\n result = false;\n }\n });\n return result;\n }", "function validateQuiz() {\n let isValid = true;\n //Check quiz title\n if(!validateQuizTitleOnClick()){\n isValid = false;\n }\n //Check topic\n if(!validateTopicOnClick()){\n isValid = false;\n }\n return isValid;\n}", "function checkUserAnswer(type, userAns, correctAns){\n\tif (count < maxTries) {\n\t\tif(userAns === \"\"){\n\t\t\talert(\"Please enter an answer\");\n\t\t}\n\t\telse if(isNaN(parseInt(userAns))){\n\t\t\talert(\"Please enter a number\");\n\t\t}\n\t\telse if (parseInt(userAns) != correctAns)\n\t\t{\n\t\t\tcount++;\n\t\t\talert(\"That is the incorrect answer\");\n\t\t}\n\t\telse if (parseInt(userAns) === correctAns)\n\t\t{\n\t\t\talert(\"That is the correct answer\");\n\t\t\t document.getElementById(\"answer\").value = \"\";\n\t\t\t generateNumbers();\n\n\t\t\t if(type ===\"add\") {\n\t\t\t\t add();\n\t\t\t }\n\t\t\t else if(type ===\"minus\") {\n\t\t\t\t minus();\n\t\t\t }\n\t\t\t else if(type ===\"multiply\") {\n\t\t\t\t multiply();\n\t\t\t }\n\t\t\t else {\n\t\t\t\t divide();\n\t\t\t }\n\t\t}\n\t}\n\telse {\n\t\talert(\"The correct answer is \"+correctAns);\n\t}\n}", "function check_a(a_nun) {\n\n if (a_nun == answer[q_nun]) {\n score++;\n chance = 1;\n q_finish();\n q_next();\n feed(2);\n } else if (a_nun != answer[q_nun] && chance > \"0\") {\n chance--;\n feed(1);\n } else {\n chance = 1;\n q_finish();\n q_next();\n feed(0);\n }\n}", "function validateBet() {\n let bet = Number(startingBet.value);\n if (bet < 1) {\n displayError();\n } else {\n playSevens(bet);\n }\n return false;\n}", "function validateForm(){\n\tvar horario = $('.horario').val();\n\tvar materia = $('.materia').val();\n\tvar dia = $('.dia').val();\n\tvar hi = $('.horaI').val();\n\tvar hf = $('.horaF').val();\n\tvar res = false;\n\n\tif (horario === 0 || horario == null || materia === 0 || materia == null || dia === 0 || dia == null || hi == \"\" || hf == \"\") {\n\t\tres = true;\n\t}\n\n\treturn res;\n}", "function validar(num1){\n if(isNaN(num1)){\n return false;\n } else {\n return true;\n }\n}", "checkSolution()\n {\n return (this.solutionString == this.givenSolutionString);\n }", "function checkPunten() {\n getPuntenInput = document.querySelector(\"#puntenInput\").value;\n if (/^\\d+$/.test(getPuntenInput) && getPuntenInput !== \"\") {\n passedForm(getPunten);\n return true;\n } else {\n output.innerHTML = \"Vul de punten in met alleen getallen\";\n failedForm(getPunten);\n return false;\n }\n}", "function checkValidityExp(arr) {\r\n\tif (arr.length < 3) {\r\n\t\treturn false; // If expression is incomplete - doesn't have 3 elements (num, sym, num)\r\n\t}\r\n\tif (!/\\d/.test(arr[0]) || !/\\d/.test(arr[2])) {\r\n\t\treturn false; // check that expression starts and ends with numbers\r\n\t}\r\n\treturn true;\r\n}", "function isCorrect(){\n let temp; //used to keep track of the correct answer index\n for (let i =0; i<answerChoices[num-1].length; i++)\n {\n if (answerChoices[num-1][i] === correctAnswers[num-1]){\n temp=i;\n }\n }\n \n if (parseInt(input,10) === temp){ //input = index of correct answer\n console.log('V- Correct answer -V');\n score++;\n }\n else if (parseInt(input, 10) < 7 && parseInt(input, 10) < answerChoices[num-1].length){ //input is any of the other choices, wrong\n console.log('X- Sorry. Wrong answer. -X');\n score--;\n }\n else if(input === 'exit' || input === 'EXIT'){ \n console.log('Thank you for playing.');\n console.log('---Your final score is: '+score+'.---');\n }\n else{\n console.log('You entered the wrong value'); //input is anything but a number\n }\n\n //doesnt appear if user quits game\n if(stillPlaying){ \n console.log('----Your current score is: '+score+'.----');\n }\n }", "function getAnswer(question_no){\n let user_ans;\n \n // user_ans = prompt(\"Enter number of correct answer\");\n user_ans = document.getElementById(\"user_ans\").value;\n \n if(user_ans===null){\n throw new Error('Prompt canceled, terminating Quiz');\n }\n if(user_ans!==\"exit\"){\n user_ans=parseInt(user_ans);\n }\n console.log(\"User Answer: \"+user_ans);\n // console.log(\"user_ans type: \"+typeof(user_ans));\n // console.log(\"q_no: \"+question_no);\n // console.log(\"q_no correct ans: \"+Quiz[question_no].correct);\n if(user_ans===Quiz[question_no].correct){\n return \"correct\";\n }else if(user_ans===\"exit\"){\n return \"exit\";\n }else{\n return \"incorrect\"\n }\n \n}", "function checker () {\n\tfinalResult += exercises[pointer].studentAnswer;\n\t++pointer;\n\tif ( pointer == exercises.length ) {\n\t\talert(\"The exam is finished.\");\n\t\treturn 0;\n\t}\n\tnxtbtnContainer.style.display = \"none\";\n\tbuildAndShow();\n}", "function isValidInput () {\n var hs = $scope.unit.height === 'american' ?\n ($scope.height.ft !== '' || $scope.height.in !== '' ? true : false) :\n ($scope.height.cm !== '' ? true : false);\n var ws = $scope.unit.weight === 'american' ?\n ($scope.weight.lbs !== '' ? true : false) :\n ($scope.weight.kg !== '' ? true : false);\n return hs && ws ? true : false;\n }", "function validity(){\n var num =parseInt( document.getElementById(\"validationCustom06\").value);\n var name= document.getElementById(\"validationCustom01\").value.length;\nvar captcha = parseInt(document.getElementById(\"validationout3\").value);\n alert(( 6<num && num<9 ) && ( 8<name && name<14 ) && ( captcha > 5 && captcha <10 ))\n return( ( 6<num && num<9 ) && ( 8<name && name<14 ) && ( captcha > 5 && captcha <10 ) )\n \n}", "function levelOneValidate() {\n \n // question one\n if (questionOneAnswer === questionOne.correctAnswer) {\n rightAnswers++;\n } else if (questionOneAnswer != questionOne.correctAnswer) {\n wrongAnswers++;\n }\n //question two\n if (questionTwoAnswer === questionTwo.correctAnswer) {\n rightAnswers++;\n } else if (questionTwoAnswer != questionTwo.correctAnswer) {\n wrongAnswers++;\n }\n //question three\n if (questionThreeAnswer === questionThree.correctAnswer) {\n rightAnswers++;\n } else if (questionThreeAnswer != questionThree.correctAnswer) {\n wrongAnswers++;\n }\n}", "function validateaadhar() {\n let aadhar = document.getElementById('txtadhaar');\n if (!isvalidaadhar(aadhar.value.trim())) {\n onerror(aadhar, \"aadhar must be 12 numbers\");\n return false;\n\n }\n else {\n onsuccess(aadhar);\n document.queryselector('#check-success').style.display = \"block\";\n }\n\n}", "function validateNum(numberToBeValidated){\n if (numberToBeValidated % 1 != 0){\n alert(\"Please input an integer\");\n return false; //the function will have false value if the if condition is true\n }\n else if (numberToBeValidated < 0 || numberToBeValidated > 100){\n alert(\"Please input the number between the range of 1 and 100\");\n return false;\n }\n clearText();\n // else if for past guesses ask Casey for help about the past guesses else if \n }", "function checkValid(result) {\n\t\t\tif(!result) {\n\t\t\t\tself.isValid = false;\n\t\t\t} else {\n\t\t\t\tself.isValid = true;\n\t\t\t}\n\t\t}" ]
[ "0.6893438", "0.68778795", "0.65805656", "0.6507202", "0.64984584", "0.6467832", "0.6420612", "0.6392435", "0.6378431", "0.63439465", "0.6311938", "0.6288506", "0.6277815", "0.62592864", "0.6252495", "0.6244372", "0.62287843", "0.6213023", "0.6198579", "0.6187503", "0.61862147", "0.6186074", "0.6185651", "0.61773795", "0.61773115", "0.6174634", "0.6154013", "0.61427075", "0.6131126", "0.61182106", "0.6114536", "0.60859835", "0.6052868", "0.60465264", "0.60343975", "0.60342175", "0.6032489", "0.6025725", "0.6015077", "0.60149145", "0.60105515", "0.6007615", "0.60068", "0.59985435", "0.5996457", "0.5993142", "0.5976088", "0.5970781", "0.595764", "0.5954361", "0.5954167", "0.5952879", "0.59469527", "0.5942529", "0.5937681", "0.5922575", "0.5913383", "0.5907892", "0.5906256", "0.59051365", "0.59038913", "0.5900283", "0.58882207", "0.58856064", "0.5884372", "0.5882208", "0.5879292", "0.5876613", "0.58749276", "0.5874491", "0.5872245", "0.5867033", "0.5866266", "0.5866266", "0.5864002", "0.5863924", "0.5862124", "0.5857524", "0.58569914", "0.5856712", "0.5854421", "0.58520937", "0.58519155", "0.5850674", "0.5849643", "0.5846459", "0.5845095", "0.5835895", "0.5834613", "0.5833727", "0.5827876", "0.5827507", "0.5824342", "0.58216083", "0.5819755", "0.58195126", "0.58181804", "0.5817747", "0.5816396", "0.58151805" ]
0.66034335
2
updates the question form with validation messages / classes
function updateForm({ answer, answerIndex }) { currentState = answer.correct ? STATES.CORRECT : STATES.INCORRECT // add correct/incorrect (stat) class to the form $('form').addClass(currentState) // disable all radios $('input[type=radio]').prop('disabled', true) if (answer.correct) { // add class, success message, and icon to correct answer $('.answer') .eq(answerIndex) .addClass('correct') .append( `<p> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> <path class="heroicon-ui" d="M17.62 10H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H8.5c-1.2 0-2.3-.72-2.74-1.79l-3.5-7-.03-.06A3 3 0 0 1 5 9h5V4c0-1.1.9-2 2-2h1.62l4 8zM16 11.24L12.38 4H12v7H5a1 1 0 0 0-.93 1.36l3.5 7.02a1 1 0 0 0 .93.62H16v-8.76zm2 .76v8h2v-8h-2z"/> </svg>Correct 🥰! Nice job!</p>` ) } else { let correctAnswerIndex = QUESTIONS[currentQuestionIndex].answers.findIndex( answer => answer.correct ) // add class, error, and icon to incorrect answer $('.answer') .eq(answerIndex) .addClass('incorrect') .append( `<p> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> <path class="heroicon-ui" d="M4.93 19.07A10 10 0 1 1 19.07 4.93 10 10 0 0 1 4.93 19.07zm1.41-1.41A8 8 0 1 0 17.66 6.34 8 8 0 0 0 6.34 17.66zM13.41 12l1.42 1.41a1 1 0 1 1-1.42 1.42L12 13.4l-1.41 1.42a1 1 0 1 1-1.42-1.42L10.6 12l-1.42-1.41a1 1 0 1 1 1.42-1.42L12 10.6l1.41-1.42a1 1 0 1 1 1.42 1.42L13.4 12z"/> </svg>Sorry, that's wrong 😭, correct answer was ${QUESTIONS[currentQuestionIndex].answers[correctAnswerIndex].text}` ) // add class to correct answer $('.answer') .eq(correctAnswerIndex) .addClass('correct') } // update button text $('button').html(`Next &raquo;`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate() {\r\n\r\n\r\n \r\n // set the progress of the background\r\n progress.style.width = ++position * 100 / questions.length + 'vw'\r\n\r\n // if there is a new question, hide current and load next\r\n if (questions[position]) hideCurrent(putQuestion)\r\n else hideCurrent(done)\r\n \r\n \r\n\r\n }", "function fillUpdateForm() {\n let questionIndex = document.getElementById(\"ivc-question-select-update\").value;\n let question = ivcQuestionComponentQuestions[questionIndex];\n\n document.getElementById(\"ivc-category-update\").value = question.category;\n document.getElementById(\"ivc-a1-update\").value = question.answers[0].answerText;\n document.getElementById(\"ivc-a2-update\").value = question.answers[1].answerText;\n document.getElementById(\"ivc-a3-update\").value = question.answers[2].answerText;\n document.getElementById(\"ivc-a4-update\").value = question.answers[3].answerText;\n\n for (let i = 0; i < question.answers.length; i++) {\n if (question.answers[i].correct === 1) {\n document.getElementById(\"ivc-select-answer-update\").value = i + 1;\n }\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 >= 5;\n this.$step.parentElement.hidden = this.currentStep >= 5;\n\n // TODO: get data from inputs and show them in summary\n }", "function validateQuestion() {\n\t\tvar valid_entry = true;\n\t\t$(\"#form_question_label\").css(\"color\", \"black\");\n\t\t$(\"#form_answer_label\").css(\"color\", \"black\");\n\t\t$(\"#form_false_label\").css(\"color\", \"black\");\n\t\t\n\t\tif(($(\"#form_false_input_3\").val() == \"\")) {\n\t\t\tvalid_entry = false;\n\t\t\t$(\"#form_false_label\").css(\"color\", \"red\");\n\t\t\t$(\"#form_false_input_3\").focus();\n\t\t}\n\t\tif(($(\"#form_false_input_2\").val() == \"\")) {\n\t\t\tvalid_entry = false;\n\t\t\t$(\"#form_false_label\").css(\"color\", \"red\");\n\t\t\t$(\"#form_false_input_2\").focus();\n\t\t}\n\t\tif(($(\"#form_false_input_1\").val() == \"\")) {\n\t\t\tvalid_entry = false;\n\t\t\t$(\"#form_false_label\").css(\"color\", \"red\");\n\t\t\t$(\"#form_false_input_1\").focus();\n\t\t}\n\t\tif($(\"#form_answer_input\").val() == \"\") {\n\t\t\tvalid_entry = false;\n\t\t\t$(\"#form_answer_label\").css(\"color\", \"red\");\n\t\t\t$(\"#form_answer_input\").focus();\n\t\t}\n\t\tif($(\"#form_question_input\").val() == \"\") {\n\t\t\tvalid_entry = false;\n\t\t\t$(\"#form_question_label\").css(\"color\", \"red\");\n\t\t\t$(\"#form_question_input\").focus();\n\t\t}\n\t\tif (valid_entry == true) {\n\t\t\t$(\"#thanks_crowd_input\").fadeIn(\"slow\", function() {\n\t\t\t\t$(\"#form_question_input\").val(\"\");\n\t\t\t\t$(\"#form_answer_input\").val(\"\");\n\t\t\t\t$(\"#form_false_input_1\").val(\"\");\n\t\t\t\t$(\"#form_false_input_2\").val(\"\");\n\t\t\t\t$(\"#form_false_input_3\").val(\"\");\n\t\t\t\tsetTimeout(function() {$(\"#thanks_crowd_input\").fadeOut(\"slow\");}, 5000);\n\t\t\t});\n\t\t\t\n\t\t\t$.getJSON('php/back.php', {\n\t\t\t\tcomm: 'input_question',\n\t\t\t\ttrivia_question: $(\"#form_question_input\").val(),\n\t\t\t\ttrivia_answer: $(\"#form_answer_input\").val(),\n\t\t\t\ttrivia_false_1: $(\"#form_false_input_1\").val(),\n\t\t\t\ttrivia_false_2: $(\"#form_false_input_2\").val(),\n\t\t\t\ttrivia_false_3: $(\"#form_false_input_3\").val()\n\t\t\t\t}, function(data) {\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t}\n\t}", "function addValidationUI(questionAnswerStatus) {\n // Update 'response-cell's with 'valid' class if questionAnswerStatus===true,\n // or with 'invalid' class if questionAnswerStatus===false.\n $('#numberpad .response-cell')\n .removeClass('invalid valid') // Clear any existing `valid`/`invalid` classes\n .addClass( questionAnswerStatus ? 'valid' : 'invalid');\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 // TODO: get data from inputs and show them in summary\n }", "function updateQuestionCard(q_id,question){\n let componentId = getComponentId(q_id);\n $(\"#\"+componentId.question_id).val(question.title);\n for(let i=0; i<question.answers.length; i++){\n $(\"#\"+componentId.answer_id[i]).val(question.answers[i].option);\n if (question.answers[i].isCorrect) {\n $(\"#\"+componentId.select_id[i]).attr('checked','checked')\n } else {\n $(\"#\"+componentId.select_id[i]).prop('checked', false);\n }\n }\n}", "function updateResponses() {\n\tvar responseForm = rightPane.querySelector('form[id=\"response-form\"]');\n\tvar name = responseForm.querySelector('input[type=\"text\"]');\n\tvar response = responseForm.querySelector('textarea[type=\"text\"]');\n\tif(name.value && response.value) {\n\t\tappendResponseToResponseList(name.value, response.value);\n\t\texpandQuestion();\n\t}\n }", "function updateQuestion(){\n\t\tconsole.log(\"UpdateQuestion: \" + questionCount)\n\t\tquestions[questionCount].updateImages();\n\t\tcorrectCheck();\n\t\timageHover();\n\t\tclicked = false;\n\t}", "function fill_form(data) {\n\n // ******** Cast data to JQuery and get ESMDefinition ********\n\n $data = $(data).children();\n\n // ******** Questionnaire settings ********\n\n $('#name').val($data.find('name').text());\n $('#short_name').val($data.find('short_name').text());\n $('#description').val($data.find('description').text());\n\n // ******** Questions ********\n\n $questions = $data.find('Question');\n for (i = 0; i < $questions.length; i++) { addComponent(); }\n $questions.each(function(i) {\n // Add question\n $q = $(this);\n $block = $('.questionBlock').eq(i);\n\n // Change ESM type\n esm_type = $q.find('ESM_Type').text();\n select = $block.find('select[name=\"questionType\"]');\n select.val(esm_type);\n questionTypeChange(select[0]);\n\n // Question general settings\n $block.find('.questionTitle').val($q.find('Title').text());\n $block.find('.questionInstructions').val($q.find('Instructions').text());\n $block.find('.questionLocale').val($q.find('Locale').text());\n $block.find('.questionSubmitText').val($q.find('SubmitText').text());\n $block.find('.questionCancelText').val($q.find('CancelText').text());\n $block.find('.questionExpiration').val($q.find('ExpirationThreshold').text());\n $block.find('.questionTimeout').val($q.find('NotificationTimeout').text());\n\n // Question type settings\n switch(esm_type) {\n case \"ESM_FreeText\":\n break;\n case \"ESM_Likert\":\n $block.find('.likertMax').val($q.find('LikertMax').text());\n $block.find('.likertStep').val($q.find('LikertStep').text());\n $block.find('.likertMinLabel').val($q.find('LikertMinLabel').text());\n $block.find('.likertMaxLabel').val($q.find('LikertMaxLabel').text());\n break;\n case \"ESM_QuickAnswer\":\n $block.find('.quickAnswers').val($q.find('Option').map( function() { return $(this).text() } ).toArray().join());\n break;\n case \"ESM_Scale\":\n $block.find('.scaleMin').val($q.find('ScaleMin').text());\n $block.find('.scaleMax').val($q.find('ScaleMax').text());\n $block.find('.scaleStep').val($q.find('ScaleStep').text());\n $block.find('.scaleStart').val($q.find('ScaleStart').text());\n $block.find('.scaleMinLabel').val($q.find('ScaleMinLabel').text());\n $block.find('.scaleMaxLabel').val($q.find('ScaleMaxLabel').text());\n break;\n case \"ESM_ScaleImage\":\n if ($q.find('ScaleStartRandom').length > 0) {\n radio = $block.find('input[name^=\"scaleStartType\"][value=\"random\"]');\n radio.prop('checked', true);\n startTypeChange(radio[0]);\n if ($q.find('ScaleStartRandomValues').length > 0) {\n radio = $block.find('input[name^=\"scaleStartRandomType\"][value=\"interval\"]');\n radio.prop('checked', true);\n randomStartTypeChange(radio[0]);\n $block.find('input[name^=\"scaleStartRandomInterval\"]').val($q.find('ScaleStartRandomValues').text());\n }\n } else {\n $block.find('.scaleStartFixed').val($q.find('ScaleStart').text());\n }\n $block.find('.scaleMin').val($q.find('ScaleMin').text());\n $block.find('.scaleMax').val($q.find('ScaleMax').text());\n $block.find('.scaleStep').val($q.find('ScaleStep').text());\n $block.find('.scaleMinLabel').val($q.find('ScaleMinLabel').text());\n $block.find('.scaleMaxLabel').val($q.find('ScaleMaxLabel').text());\n $block.find('.scaleURLleft').val($q.find('LeftImageUrl').text());\n $block.find('.scaleURLright').val($q.find('RightImageUrl').text());\n if ($q.find('ScaleValueVisible').length > 0) {\n $block.find('input[name^=\"scaleValueVisible\"]').prop('checked', 'true');\n }\n break;\n default:\n break;\n }\n });\n\n // ******** Schedules ********\n\n $schedules = $data.find('Schedule');\n for (i = 0; i < $schedules.length; i++) { addSchedule(); }\n $schedules.each(function(i) {\n // Add schedule\n $s = $(this);\n $block = $('.scheduleBlock').eq(i);\n\n // Schedule name\n $block.find('.scheduleName').val($s.find('id').text());\n\n // Random schedule\n if ($s.find('random').length > 0) {\n radio = $block.find('input[name^=\"scheduleType\"][value=\"random\"]');\n radio.prop('checked', true);\n scheduleTypeChange(radio[0]);\n $block.find('.scheduleRandomHours').val($s.find('hour').map( function() { return $(this).text() } ).toArray().join());\n $block.find('.scheduleRandomAmount').val($s.find('amount').text());\n $block.find('.scheduleRandomInterval').val($s.find('interval').text());\n // Fixed schedule\n } else {\n $block.find('.scheduleFixedHours').val($s.find('hour').map( function() { return $(this).text() } ).toArray().join());\n $block.find('.scheduleFixedMinutes').val($s.find('minute').map( function() { return $(this).text() } ).toArray().join());\n $block.find('.scheduleFixedWeekdays').val($s.find('weekday').map( function() { return $(this).text() } ).toArray().join());\n $block.find('.scheduleFixedMonths').val($s.find('month').map( function() { return $(this).text() } ).toArray().join());\n }\n });\n \n}", "function addValidationUI(questionAnswerStatus) { \n\n //If the response is correct, we colour the background of the header (responseRow) green and display a 'Correct' message\n // else we colour the background of the header red and display an 'Incorrect' message.\n \n var messageHTML;\n\n // Remove previous Correct/Incorrect message if it exists\n $('#message').remove();\n\n if (questionAnswerStatus) {\n messageHTML = '<strong id=\"message\" class=\"pull-right\"><span class=\"glyphicon glyphicon-ok correct\">&nbsp;</span>Correct</strong>'\n $('#responseRow').removeClass('row-invalid');\n $('#responseRow').addClass('row-valid');\n } else {\n messageHTML = '<strong id=\"message\" class=\"pull-right\"><span class=\"glyphicon glyphicon-remove incorrect\">&nbsp;</span>Incorrect</strong>';\n $('#responseRow').removeClass('row-valid');\n $('#responseRow').addClass('row-invalid');\n }\n //To enhance the UI a bit, we add a fadeIn animation to distinguish between two Incorrect submissions.\n $(messageHTML).hide().appendTo('.lrn_stimulus_content.lrn_clearfix').fadeIn(2000);\n\n \n }", "function getForm() {\n return questionForm;\n}", "function showQuestionForm()\n {\n $(\"#addQuestionform\").removeClass('hidde');\n $(\"#showQbutton\").addClass('hidde');\n }", "updateForm() {\n this.$step.innerText = this.currentStep;\n if (this.currentStep < 2) this.$prev.forEach(el => el.classList.add(\"hidden\"));\n if (this.currentStep === 2) this.$prev.forEach(el => el.classList.remove(\"hidden\"));\n if (this.currentStep > 4) this.$next.forEach(el => el.classList.add(\"hidden\"));\n if (this.currentStep === 4) this.$next.forEach(el => el.classList.remove(\"hidden\"));\n if (this.currentStep === 5) {\n this.updateSummary();\n this.$stepCounter.classList.add(\"hidden\");\n this.$agreeBtn.classList.remove(\"hidden\");\n\n }\n if (this.currentStep < 5) {\n this.$stepCounter.classList.remove(\"hidden\");\n this.$agreeBtn.classList.add(\"hidden\");\n }\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n }", "function setField(question, value)\n{\n var questionId = question.attr('id').split('-')[1];\n var valid = question.attr('required');\n valid = (valid && value) || !valid;\n validFields[questionId-1] = valid;\n verifyForm();\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 addSiQs(counter, QUESTION, para, form, warning_cont, result) {\n // display question\n para.innerText = QUESTION[counter].question;\n // to append warning msg to warning container\n if (QUESTION[counter].addInfo) {\n warning_cont.appendChild(addInfoMedi(QUESTION[counter].addInfo));\n } else {\n warning_cont.innerHTML = \"\";\n }\n\n // display option for user to chose if exist choices;\n if (QUESTION[counter].choices.length > 0) {\n // for add style for radio btn\n if (QUESTION[counter].choices.length === 4) {\n form.classList.add(\"flex-radio\");\n } else if (form.classList.contains(\"flex-radio\")) {\n form.classList.remove(\"flex-radio\");\n }\n form.innerHTML = \"\";\n for (let i = 0; i < QUESTION[counter].choices.length; i++) {\n let form_control = createElement(\"div\", { class: [\"form-checkbox\"] });\n\n let step = createElement(\"input\", {\n type: \"radio\",\n name: `question${counter}`,\n id: `question${i}`,\n value: QUESTION[counter].choices[i],\n });\n if (QUESTION[counter].choices[i] === result[counter]) {\n step.setAttribute(\"checked\", true);\n }\n let label = createElement(\"label\", { for: `question${counter}` });\n label.innerText = QUESTION[counter].choices[i];\n addToparent(form_control, [label, step]);\n addToparent(form, [form_control]);\n }\n }\n // if question does not contain any choices like input text and number;\n else {\n form.innerHTML = \"\";\n let form_control = createElement(\"div\", { class: [\"form-control\"] });\n let step = createElement(\"input\", {\n type: \"number\",\n name: `question${counter}`,\n id: `question${counter}`,\n value: result[counter] === -1 ? \"\" : result[counter],\n placeholder: ` ${QUESTION[counter].label}`\n });\n let label = createElement(\"label\", { for: `question${counter}` });\n label.innerText = QUESTION[counter].label;\n addToparent(form_control, [step, label]);\n addToparent(form, [form_control]);\n }\n}", "function putQuestion() {\r\n inputLabel.innerHTML = questions[position].question\r\n inputField.value = ''\r\n\tdocument.getElementById('inputField').placeholder = placeholders[position].place\r\n inputField.type = questions[position].type || 'text' \r\n inputField.focus()\r\n showCurrent()\r\n }", "function survey_update() {\n $('#survey_type_input_custom').hide();\n // TODO test\n switch (this.selected) {\n case 'Custom':\n $('#survey_type_input_custom').show();\n $('#resno_input_single').show();\n break;\n }\n }", "function validate()\r\n{\r\n let question1 = document.getElementById(\"cat-software\");\r\n let question2 = document.getElementById(\"same-room-select\");\r\n let question3 = document.getElementById(\"network-select\");\r\n let questionsArray = new Array(question1, question2, question3);\r\n //console.log(questionsArray);\r\n\r\n if (\r\n question1.value !== \"Choose...\" &&\r\n question2.value !== \"Choose...\" &&\r\n question3.value !== \"Choose...\"\r\n )\r\n {\r\n removeErrorMessage();\r\n handleSelections(question1, question2, question3);\r\n } else\r\n {\r\n for (let i = 0; i < questionsArray.length; i++)\r\n {\r\n if (questionsArray[i].value === \"Choose...\")\r\n {\r\n questionsArray[i].style.color = \"red\";\r\n } // end inner if\r\n } // end for\r\n let answerMissing = document.getElementById(\"instructions\");\r\n let h6 = document.createElement(\"h6\");\r\n removeErrorMessage();\r\n answerMissing.appendChild(h6);\r\n h6.innerHTML =\r\n '<h6 id=\"error\" style=\"color:red;\" >Please answer all questions.</h6>';\r\n } // end else\r\n} // end validate", "function renderQuestion() {\n $('.QAform').html(' ');\n if (questionNum < STORE.length) {\n $('.QAform').html(`<p>${STORE[questionNum].question}</p>\n <form>\n <fieldset>\n <label>\n <input type=\"radio\" value=\"${STORE[questionNum].answers[0]}\" name=\"answer\" required>\n <span>${STORE[questionNum].answers[0]}</span>\n </label>\n\n <label>\n <input type=\"radio\" value=\"${STORE[questionNum].answers[1]}\" name=\"answer\" required>\n <span>${STORE[questionNum].answers[1]}</span>\n </label>\n \n <label>\n <input type=\"radio\" value=\"${STORE[questionNum].answers[2]}\" name=\"answer\" required>\n <span>${STORE[questionNum].answers[2]}</span>\n </label>\n\n <label>\n <input type=\"radio\" value=\"${STORE[questionNum].answers[3]}\" name=\"answer\" required>\n <span>${STORE[questionNum].answers[3]}</span>\n </label>\n <button type = \"submit\" class=\"submitButton\">Submit</button>\n </fieldset>\n </form>`)\n }\n else {\n retakeQuiz();\n };\n}", "function setQuestion() {\n h2.innerText = questions[q].question;\n choiceA.innerText = questions[q].choices[0];\n choiceB.innerText = questions[q].choices[1];\n choiceC.innerText = questions[q].choices[2];\n choiceD.innerText = questions[q].choices[3];\n\n q++;\n\n setBG();\n clearAnswer();\n results();\n}", "_updateQuestion(event) {\n let tmpQuestion = this.props.surveyItem.toJS();\n tmpQuestion.text = event.target.value;\n this._informParent(tmpQuestion);\n }", "function submitForm() {\nvar check = document.getElementsByClassName(\"q1\")\n\nvar select = document.getElementsByClassName(\"q2\")\n\nvar radio = document.getElementsByClassName(\"q3\")\n\n//store element by id to display results later\nvar result = document.getElementById(\"result\")\n\n//create array for checkbox answers this will become the value for var answer1\nvar checkboxesArray = []\n//create variables to eventually hold the users answers\nvar answers1, answers2, answers3\n\n//loop through all check boxes\nfor(var i = 0; i < check.length; i++) {\n\n\t//check if the current checkbox has been checked by the user, then do this\n\tif(check[i].checked) {\n\t\t//add item to checkboxesarray\n\t\tcheckboxesArray.push(check[i].value)\n\t}\n\tconsole.log(checkboxesArray)\n\tanswers1 = checkboxesArray\n}\n//stop function if no data for question1\nif(answers1.length == 0) {\n\t//add a class of success/failure to results\n\tresult.className = \"failure\"\n\t//update text content of results\n\tresult.textContent = \"you forgot to answer question 1\"\n\t//stop function if no answer\n\treturn\n}\n\n//confirm answer 1value\nconsole.log(\"answer 1: \" + answers1)\n\n//loop through select options\nfor (var i = 0; i < select.length; i++) {\n\n\t//check which was selected by the user, do this\n\tif(select[i].selected) {\n\t\t//set value of answer 2 to the value in the selected item\n\t\tanswers2 = select[i].value\n\t}\n}\n\n//stop funtion if no data for question 2\n\tif(answers2 == \"\") {\n\t\t//add a class of success/failure to results\n\t\treslut.className = \"failure\"\n\n\t\t//update the text content of results\n\t\tresult.textContent = \"you forgot to answer question 2\"\n\n\t\t//stop function if no answer\n\t\treturn\n\t}\n\n//confirm answer 2 value\nconsole.log(\"answer 2: \" + answers2)\n\n//loop through radio options\nfor (var i = 0; i < radio.length; i++) {\n\n\t//if the radio was selected by the user do this\n\tif(radio[i].checked) {\n\t\t//set value of answer 3 to the value in the radio item\n\t\tanswers3 = radio[i].value\n\t}\n}\n\n\n//stop funtion if no data for question 3\nif(answers3 == undefined) {\n\t\n\t//add a class of success/failure to results\n\tresult.className = \"failure\"\n\t\n\t//update the text content of results\n\tresult.textContent = \"you forgot to answer question 3\"\n\n\t//stop function if no answer\n\treturn\n}\n\n//confirm answer 3 value\nconsole.log(\"answer 3: \" + answers3)\n\n//create an object from user answers\nvar surveyAnswer = {\n\tchecked: answers1,\n\tselect: answers2,\n\tradio: answers3\n}\n\n//add a class of success to results\nresult.className = \"success\"\n\n//update the text content of results upon survey completion\nresult.textContent =\"Thanks for completing the Survey\"\n\n//confirm new objects existence\nconsole.log(\"current survey answers: #1 \" + surveyAnswer.checked + \" #2 \" + surveyAnswer.selected + \" #3 \" + surveyAnswer.radio)\n\n\n//add surveyAnswers to surveyArray\nsurveyArray.push(surveyAnswer)\n\n//check survey array to confirm new object\nconsole.log(surveyArray)\n\n//reset form for next user\nform.reset()\n}", "function renderAQuestion() {\r\n let question = STORE.questions[STORE.currentQuestion];\r\n updateQuestionAndScore();\r\n const questionHtml = $(`\r\n <div>\r\n <form id=\"js-questions\" class=\"question-form\">\r\n \r\n \r\n <div class=\"row question\">\r\n <div class=\"col-12\">\r\n <h2> ${question.question}</h2>\r\n </div>\r\n </div>\r\n \r\n <div class=\"row options\">\r\n <div class=\"answer-options\">\r\n <div class=\"js-options\"> </div>\r\n </div>\r\n </div>\r\n \r\n \r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <button type = \"submit\" id=\"answer\" tabindex=\"5\">Submit</button>\r\n <button type = \"button\" id=\"next-question\" tabindex=\"6\"> Next >></button>\r\n </div>\r\n </div>\r\n \r\n </form>\r\n </div>`);\r\n $(\"main\").html(questionHtml);\r\n updateOptions();\r\n $(\"#next-question\").hide();\r\n }", "function newQuestion(){\r\n\tquesCount++;\r\n\tcurrentQues=questions[index];\r\n\tques.innerHTML=currentQues.question;\r\n\top1.innerHTML=currentQues.option1;\r\n\top2.innerHTML=currentQues.option2;\r\n\top3.innerHTML=currentQues.option3;\r\n\top4.innerHTML=currentQues.option4;\r\n\t\r\n\tclickAns();\r\n\r\n\tif(currentQues.answered){\r\n\t\t\r\n\t\tif(currentQues.check==\"CORRECT\"){\r\n\t\t\tansMessage.innerHTML=\"CORRECT\"\r\n\t\t\tquiz.style.background=\"#76ff03\";\r\n \t\t\t\tbody.style.background=\"green\";\r\n \t\t\t\tansMessage.style.color=\"#76ff03\";\r\n\t\t}\r\n\t\telse{\r\n\t\t\tansMessage.innerHTML=\"WRONG\";\r\n\t\t\tquiz.style.background=\"#ef5350\";\r\n \t\t\t\tbody.style.background=\"#d50000\";\r\n \t\t\t\tansMessage.style.color=\"black\";\r\n\r\n\t\t}\r\n\t}\r\n\telse{\r\n \t\tquiz.style.background=\"white\";\r\n \t\t\t\tbody.style.backgroundImage='url(\"covid.JPG\")';\r\n \t\t\t\tbody.style.backgroundSize='1300px 1000px';\r\n \t\t\t\tansMessage.innerHTML=\"\";\r\n \t\t}\r\n \tif(currentQues.option4==\"T'nia miller\"){\r\n\t\t \t\tsubmit.classList.remove(\"hide\");\r\n\t\t \t\tnext.disabled=true;\r\n\t\t \t\tprev.disabled=true;\r\n\t\t \t}\r\n\r\n}", "function setQuestion() {\n judgeEl.classList.add(\"hide\");\n questionEl.textContent = questionsArr[currentQuestionIndex].question;\n\n for (let j = 0; j < questionsArr[currentQuestionIndex].answers.length; j++) {\n answerbtnEl[j].value = questionsArr[currentQuestionIndex].answers[j];\n answerbtnEl[j].textContent = questionsArr[currentQuestionIndex].answers[j];\n }\n}", "function updateQuestion() {\n //1 - update the question text\n $('#question').text(myQuestions[currentQuestionNumber].questionText);\n //2 - display what are the choices for the current question\n //2.1 - first delete all exisiting choices before populating it with new ones\n $('.options').empty();\n //2.2 - get the total number of choices for the current question\n let totalChoices = myQuestions[currentQuestionNumber].questionChoices.length;\n console.log(totalChoices);\n //2.3 - loop through all the choices and append them to the choices container\n for (var i = 0; i < totalChoices; i++) {\n //2.3.1 - loop through the answer choices and create a dynamically generated row for eaach of them\n let buildEachChoice = \"<input class='answers' name='q1' type='radio' value=\" + i + \">\" + myQuestions[currentQuestionNumber].questionChoices[i] + \"<br>\";\n //2.3.2 - append that row to the choices container in html\n $('.options').append(buildEachChoice);\n }\n //3 - displays the number of the current question\n $('.footer').text(\"Question\" + (currentQuestionNumber + 1) + \"of\" + totalAmountOfQuestions);\n\n\n // display current score\n $('.right').text(\"Current Score: \" + totalNumberOfCorrectAnswers + \"/\" + totalAmountOfQuestions);\n\n}", "function change_question() {\n self.questions[current_question_index].render(question_container);\n $('#prev-question-button').prop('disabled', current_question_index === 0);\n $('#next-question-button').prop('disabled', current_question_index === self.questions.length - 1);\n\n // Determine if all questions have been answered\n var all_questions_answered = true;\n for (var i = 0; i < self.questions.length; i++) {\n if (self.questions[i].user_choice_index === null) {\n all_questions_answered = false;\n break;\n }\n }\n $('#submit-button').prop('disabled', !all_questions_answered);\n }", "function change_question() {\n self.questions[current_question_index].render(question_container);\n $('#prev-question-button').prop('disabled', current_question_index === 0);\n $('#next-question-button').prop('disabled', current_question_index === self.questions.length - 1);\n\n // When the question is changed, update the progress bar\n var barW; //bar width initially 0\n barW = 10 + current_question_index*10;\n progBar.style.width = barW + \"%\";\n\n // Determine if all questions have been answered\n var all_questions_answered = true;\n for (var i = 0; i < self.questions.length; i++) {\n if (self.questions[i].user_choice_index === null) {\n all_questions_answered = false;\n break;\n }\n }\n //$('#submit-button').prop('disabled', !all_questions_answered); //enable the 'submit' button if all of the questions have been answered\n }", "function validateForm(){\n var title = $('input[name=\"title\"]').val();\n var media = $(\"input[name='mediaType']:checked\").val();\n var checkAnswer = $(\"input[name='answerSheet']\").val();\n var answerQuestion = 1;\n if(title.length == 0){\n $('input[name=\"title\"]').css('border','solid 1px red');\n return false;\n }\n if(media == undefined){\n $('input[name=\"mediaType\"]').css('outline','solid 1px red');\n return false;\n }\n $('input.questionAnswer').each(function() {\n var data = $(this);\n if($(this).val() == ''){\n $('#'+data[0]['id']).css('border','solid 1px red');\n // return false;\n answerQuestion = 2;\n }\n });\n if (answerQuestion == 2) {\n return false;\n }\n if(checkAnswer.length == ''){\n alert('!Oops please select any correct answer.');\n return false;\n }\n // return false;\n }", "setNewQuestion() {\n this.currentQuestion = getRandomSyllables(1,\n this.props.allowedSyllables,\n false,\n this.previousQuestion);\n\n // Pick some syllables as options for answers\n this.answerOptions = getRandomSyllables(5,\n this.props.allowedSyllables,\n this.currentQuestion,\n false);\n\n this.setState({\n currentQuestion: this.currentQuestion,\n answerOptions: this.answerOptions\n });\n\n // Determine which of the answer options are acceptable answers\n this.correctAnswers = [];\n if (this.props.stage === 1 || this.props.stage === 3) // Answers for stage 1 and 3 are romanizations\n this.correctAnswers = this.currentQuestion.map(hex => getRomanization(hex));\n else if (this.props.stage === 2) // Answers for stage 2 are Hangeul syllables\n this.correctAnswers = this.currentQuestion.map(hex => String.fromCharCode(parseInt(hex, 16)));\n }", "function change_question() {\n self.questions[current_question_index].render(question_container);\n $('#prev-question-button').prop('disabled', current_question_index === 0);\n $('#next-question-button').prop('disabled', current_question_index === self.questions.length - 1);\n \n \n // Determine if all questions have been answered\n var all_questions_answered = true;\n for (var i = 0; i < self.questions.length; i++) {\n if (self.questions[i].user_choice_index === null) {\n all_questions_answered = false;\n break;\n }\n }\n $('#submit-button').prop('disabled', !all_questions_answered);\n }", "function setupAnswers (question, currentIndex) {\n\n // if first question, show\n let questionClass = '';\n if (currentIndex !== 0){\n questionClass = ' hide';\n }\n else if (currentIndex === 0){\n startHintTimer(currentIndex);\n }\n\n $('.questions-block').append(`\n <form id=\"question${currentIndex}\" class=\"questions-form${questionClass}\">\n\n <div class=\"row question-group\">\n <div class=\"col-lg-6 answer-img\">\n <img src=\"${question.imgSrc}\" alt=\"${question.imgAlt}\">\n <p id=\"js-hint-${currentIndex}\" class=\"hide\"><strong>Hint:</strong> <em>${question.hint}</em></p>\n </div>\n <div class=\"col-lg-6\">\n ${setupAnswerBtns(currentIndex, question.wordOptions)}\n </div>\n </div>\n </form>\n `);\n\n}", "function saveQuestion(ins_id, q_id) {\n let componentId = getComponentId(\"preview_\" + q_id);\n let question = getQuestion(componentId);\n if (validateEditData(question)) {\n $(\"#update_\" + q_id).removeClass('d-block').addClass('d-none');\n disableQuestion(componentId);\n updateQuestion(question, ins_id, q_id)\n }\n}", "function loadSurvey() {\n $(\"#create-survey-h1\").hide();\n\n var survey = JSON.parse($(\"#survey\").val());\n var properties = survey[\"Properties\"];\n var questions = survey[\"Questions\"];\n var qTotal = survey[\"QuestionTotal\"];\n var $questionGroups = $(\".question-group\");\n var qGroupLen = $questionGroups.length;\n\n // set title and date\n $(\"#survey-title\").val(properties[\"title\"]);\n $(\"#survey-due-date\")\n .datepicker()\n .val(properties[\"dueDate\"]);\n\n // set questions and answers\n var qCounter = 0;\n var qGroupCounter = 0;\n while (qCounter < qTotal) {\n var question = questions[qCounter];\n var $qGroup;\n // question ui is available, set question, type, check answers\n if (qGroupCounter < qGroupLen) {\n $qGroup = $questionGroups.eq(qGroupCounter);\n }\n // question ui isn't available, add ui, set fields\n else {\n addQuestion();\n // update the groups\n $questionGroups = $(\".question-group\");\n $qGroup = $questionGroups.last();\n }\n // get question and type\n var qContent = question[\"QuestionProperties\"][\"content\"];\n var qType = question[\"QuestionProperties\"][\"type\"];\n // find input fields\n var $inputQuestion = $qGroup.find(\".input-question\");\n var $inputType = $qGroup.find(\".input-type\");\n // set inputs\n $inputQuestion.val(qContent);\n $inputType.val(qType);\n\n // set answer inputs\n var $aGroups = $qGroup.find(\".answer-row\");\n var aGroupLen = $aGroups.length;\n var aCounter = 0;\n var answers = question[\"Answers\"];\n var aTotal = question[\"AnswerTotal\"];\n while (aCounter < aTotal) {\n var aAnswer = answers[aCounter];\n var $aRow;\n // answer ui available\n if (aCounter < aGroupLen) {\n $aRow = $aGroups.eq(aCounter);\n }\n // add answer ui\n else {\n addAnswer($qGroup);\n // update the groups\n $questionGroups = $(\".question-group\");\n $aGroups = $qGroup.find(\".answer-row\");\n $aRow = $aGroups.last();\n }\n\n // get answer and score\n var answer = aAnswer[\"answer\"];\n var score = aAnswer[\"score\"];\n // find input fields\n var $inputAnswer = $aRow.find(\".input-answer\");\n var $inputScore = $aRow.find(\".input-score\");\n // set input fields\n $inputAnswer.val(answer);\n $inputScore.val(score);\n\n aCounter++;\n }\n\n qCounter++;\n qGroupCounter++;\n }\n\n // change create button to save\n $(\"#survey-submit\").text(\"Save\");\n}", "onNewQuestion() {\n console.log(\"onNewQuestion()::\");\n if(this.inputTag.value !== '') {\n if (!this.feedbackGiven) {\n this.onFeedback(true);\n }\n this.addMessage(this.inputTag.value, true);\n this.getAnswer(this.inputTag.value);\n this.chatMessageContainer.appendChild(this.loadingIcon);\n this.inputTag.value = '';\n }\n }", "function validate(){\r\n\tvar validableForms = $(\".validableForm\");\r\n\tfor(var i=0;i<validableForms.length;i++){\r\n\t\t$(validableForms[i]).validationEngine({promptPosition : \"bottomLeft\"\r\n\t\t\t , scroll: false});\r\n\t}\r\n}", "function populateQuestionTemplate(questionId, questionObj) {\n let questionTemplate = document.getElementById(\"q\" + questionId);\n questionTemplate.getElementsByTagName(\"textarea\")[0].value = questionObj[\"text\"];\n\n // add extra options fields if question contains more than 2\n let numOptions = questionObj[\"options\"].length;\n for (let i = 2; i < numOptions; i++) {\n addOptionField(questionId, i + 1);\n }\n\n // assign appropriate values to radio inputs and check correct answer\n let optionsInputBoxes = questionTemplate.getElementsByClassName(\"options\");\n let radioButtons = questionTemplate.getElementsByClassName(\"radio-values\");\n for (let j = 0; j < numOptions; j++) {\n optionsInputBoxes[j].value = questionObj[\"options\"][j];\n if (questionObj[\"answer\"] == questionObj[\"options\"][j]) {\n radioButtons[j].checked = true;\n }\n }\n\n // enable update and delete buttons for this question\n document.getElementById(\"btn-update\" + (questionId)).disabled = false; \n document.getElementById(\"btn-delete\" + (questionId)).disabled = false; \n}", "performFullValidation() {\r\n const validateCompleted = this.state.pages[this.state.index].questions.map(\r\n (question, index) => {\r\n if (!question.required || question.questionType === \"Label\") {\r\n return true;\r\n }\r\n const answer = this.state.answerIndexes.find(\r\n ans => ans.page === this.state.index && ans.qIndex === index\r\n );\r\n if (!answer || answer.answer === \"\" || answer.answer === \"null\") {\r\n return false;\r\n }\r\n return true;\r\n }\r\n );\r\n this.setState({\r\n questionsAnswered: validateCompleted\r\n });\r\n }", "function newQuestion() {\n scoreText.textContent = `Score: ${score}`\n questionNumber++\n if (questionNumber >= 25) {\n numOfQuestions.textContent = `Question 25 of 25`\n } else {\n numOfQuestions.textContent = `Question ${questionNumber} of 25`\n }\n question.setAttribute(`class`, `d-none`)\n question = document.getElementById(questionNumber);\n question.removeAttribute(`class`, `d-none`);\n answerchoices = question.querySelectorAll('p');\n }", "function clearValidationPrompts() {\n $(\".has-error\").removeClass(\"has-error\");\n $(\".help-block\").remove();\n }", "function loadExistingFormValues() {\n\n // lesion has been found, load data and fill out form\n if( meCompletedLesions[meCurrentLesion] ) {\n\tloadExistingQuestion4();\n\tloadExistingQuestion5();\n\tloadExistingQuestion6();\n\tloadExistingQuestion7();\n\tloadExistingQuestion8();\n\tloadExistingQuestion9();\n\tloadExistingQuestion10();\n loadExistingQuestion11();\n loadExistingComment();\n showSaveButton();\n }\n}", "function showNewQuestion() {\n currentQuestionNumber++;\n\n if (currentQuestionNumber > 5) {\n $(\".questionAndScore\").hide();\n showFinalResults();\n } else {\n $(\".quizForm\").html(`<legend class=\"displayedQuestion\">${STORE.questions[currentQuestionNumber-1].question}</legend><br>`)\n\n displayTestInfo();\n showAnswerChoices();\n }\n}", "set Question(value) {}", "function updateQuestion() {\n let questionIndex = document.getElementById(\"ivc-question-select-update\").value;\n let questionId = ivcQuestionComponentQuestions[questionIndex].questionId;\n let question = ivcQuestionComponentQuestions[questionIndex].questionText;\n let category = document.getElementById(\"ivc-category-update\").value;\n let a1 = document.getElementById(\"ivc-a1-update\").value;\n let a2 = document.getElementById(\"ivc-a2-update\").value;\n let a3 = document.getElementById(\"ivc-a3-update\").value;\n let a4 = document.getElementById(\"ivc-a4-update\").value;\n let correct = document.getElementById(\"ivc-select-answer-update\").value;\n\n //Form Validation for Updatint Questions\n if(!(questionIndex.length > 0) || \n !(question.length > 0) ||\n !(category.length > 0) ||\n !(a1.length > 0) ||\n !(a2.length > 0) ||\n !(a3.length > 0) ||\n !(a4.length > 0) ||\n !(correct.length > 0)) {\n alert(\"All fields must be filled out\");\n return false;\n }\n\n let data = {\n \"questionId\":questionId,\n \"question\":question, \n \"category\":category, \n \"a1\":a1, \n \"a2\":a2,\n \"a3\":a3,\n \"a4\":a4,\n \"correct\":correct\n };\n document.getElementById(\"ivc-update-question-status-message\").innerText = \"Processing...\";\n\n var xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n var res = JSON.parse(this.responseText);\n document.getElementById(\"ivc-update-question-status-message\").innerText = res.message;\n\n if (res.success) {\n document.getElementById(\"ivc-update-question-status-message\").style.color = \"green\";\n getQuestions();\n } else {\n document.getElementById(\"ivc-update-question-status-message\").style.color = \"red\";\n }\n }\n };\n const postURL = `${ivcPathToSrc}api/questions/update.php`;\n xhttp.open(\"POST\", postURL, false);\n xhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xhttp.send(\"data=\" + JSON.stringify(data));\n}", "function showQuestion() {\n showQuizButtons();\n if (index === quizLength) {\n return;\n }\n // display of question at given index:\n formContainer.classList.remove(\"hide\");\n form.innerHTML = \"\";\n var quizItem = allQuestions[index];\n var q = document.createElement(\"h3\");\n var text = document.createTextNode(quizItem.question);\n\n var storedAnswers = actualPlayer.storedAnswers;\n var storedAnswer = storedAnswers[index];\n q.appendChild(text);\n form.appendChild(q);\n\n // display of choices, belonging to the questions at given index:\n choices = allQuestions[index].choices;\n\n for (var i = 0; i < choices.length; i++) {\n var div = document.createElement(\"div\");\n div.classList.add(\"radio\");\n\n\n var input = document.createElement(\"input\");\n input.setAttribute(\"id\", i);\n input.setAttribute(\"type\", \"radio\");\n input.setAttribute(\"name\", \"question\");\n\n\n\n\n if (i === quizItem.correctAnswer) {\n\n input.setAttribute(\"value\", \"1\"); \n } else { \n input.setAttribute(\"value\", \"0\");\n }\n\n\n //if question has been answered already\n if (storedAnswer) {\n var id = storedAnswer.id;\n if (i == id) {\n // if question is already answered, id has a value\n input.setAttribute(\"checked\", \"checked\");\n \n }\n }\n \n //if radiobutton is clicked, the chosen answer is stored in array storedAnswers\n input.addEventListener(\"click\", storeAnswer);\n \n\n var label = document.createElement(\"label\");\n label.setAttribute(\"class\", \"radio-label\") \n label.setAttribute(\"for\", i);\n var choice = document.createTextNode(choices[i]);\n label.appendChild(choice);\n div.appendChild(input);\n div.appendChild(label);\n form.appendChild(div);\n\n }\n}", "function generateQuestionResultsForm(answer) {\n if (answer == store.questions[store.questionNumber].correctAnswer) {\n store.score += 1;\n $('#question-container').append(\n `<p class=\"reply\">Correct!</p>`\n );\n } else {\n $('#question-container').append(\n `<p class=\"reply\">Sorry, the correct answer is: ${store.questions[store.questionNumber].correctAnswer}</p>`\n );\n }\n}", "function submitQuiz(){\n\tvar qAmount = document.getElementsByTagName(\"fieldset\").length;\n\tvar notAnswered = \"\";\n\tvar quizResults = new Array();\n\tvar numCorrect = 0;\n\tfor(i=1; i<=qAmount; i++){\n\t\tvar isChecked = 0;\n\t\tvar Questions = document.getElementById(\"Q\"+i);\n\t\tvar Choices = document.getElementsByName(\"Q\"+i);\n\n//resets Question text color\n\t\tQuestions.className = \"normal\";\n\n//checks if Question is answered\n\t\tfor(a=0; a<Choices.length; a++){\n\t\t\tif(Choices[a].checked){\n\t\t\t\tisChecked = 1;\n\t\t\t\tif(parseInt(Choices[a].value) == 1){\n\t\t\t\t\tquizResults[i] = 1;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tquizResults[i] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n//If Question not answered\n\t\tif(isChecked == 0){\n\t\t\tQuestions.className = \"wrong\";\n\t\t\tnotAnswered = 1;\n\t\t}\n\n\t}\n\n//Output if Questions are Answered or Not\n\tif(notAnswered != \"\"){\n\t\talert(\"Please answer all Questions.\\nThe ones you missed are marked in red.\");\n\t}\n\telse{\n\t\t//colouring the Questions\n\t\tfor(i=1; i<=qAmount; i++){\n\t\t\tvar Questions = document.getElementById(\"Q\"+i);\n\t\t\tif(quizResults[i] == 0){\n\t\t\t\tQuestions.className = \"wrong\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\tQuestions.className = \"correct\";\n\t\t\t\tnumCorrect ++; //Counting correct questions\n\t\t\t}\n\t\t}\n\t\tdocument.getElementById(\"key\").className = \"show\";\n\t\talert(\"Thank you \"+firstName+\". You scored a \"+numCorrect+\"/\"+qAmount+\"!\\nYour results are now shown!\");\n\t}\n}", "function setQuestion(question) {\n $(\"#content\").fadeOut(400, function() {\n document.getElementById(\"question\").innerHTML = question.prompt;\n\n // Update Buttons\n var buttons = $(\".button\")\n for (var i = 0; i<buttons.length - 1; i++) {\n buttons[i].innerHTML = question.answers[i];\n setLight(buttons[i]);\n }\n\n // Display \"Other\" Prompt if Applicable\n if (question.responsePrompt == \"None\") {\n $(\"#other\").hide();\n $(\"#response\").hide();\n }\n else {\n $(\"#other\").show();\n $(\"#response\").hide();\n\n other = document.getElementById(\"other\")\n other.innerHTML = \"Other\";\n setLight(other);\n\n response = document.getElementById(\"response\")\n response.placeholder = question.responsePrompt;\n response.value = \"\"\n }\n\n currentPageNumber = History.length + 1\n totalPageCount = QuestionQueue.length + History.length + 1\n document.getElementById(\"page\").innerHTML = \"Question \" + currentPageNumber.toString() + \" of \" + totalPageCount.toString()\n\n if (QuestionQueue.length == 0) {\n document.getElementById(\"next\").innerHTML = \"Submit\"\n } else {\n document.getElementById(\"next\").innerHTML = \"<i class='fa fa-arrow-right'></i>\"\n }\n\n $(\"#content\").fadeIn(400);\n });\n\n\n}", "function set_answer_state(answer, show_msgs) {\n // If user requested to retype answer, reset the question.\n if (answer.reset) {\n clear_delay();\n if (state === 'second_submit') {\n $.jStorage.set('wrongCount', wrong_cnt);\n $.jStorage.set('questionCount', question_cnt);\n $.jStorage.set('completedCount', completed_cnt);\n $.jStorage.set('activeQueue', active_queue);\n }\n state = 'first_submit';\n\n // If we are resetting due to the user clicking 'retype', then we need to trigger\n // a refresh the input field and stats by updating 'currentItem' in jStorage.\n if (answer.due_to_retype) {\n $.jStorage.set('currentItem', $.jStorage.get('currentItem'));\n return\n }\n\n window.wkRefreshAudio();\n $(\"#answer-exception\").remove();\n $('#option-double-check').addClass('disabled').find('span').attr('title','Mark Right').find('i').attr('class','fa fa-thumbs-up');\n $('#option-retype').addClass('disabled');\n Srs.remove();\n return;\n }\n\n // If answer is invalid for some reason, do the shake thing.\n var dblchk = $('#option-double-check');\n var input = $('#user-response');\n if (answer.exception) {\n $(\"#answer-exception\").remove();\n if (answer.confirming_burn) {\n // NOTE: We can only reach this branch if the current answer is correct, otherwise we wouldn't be burning it.\n dblchk.find('span').attr('title','Mark Wrong').find('i').attr('class','fa fa-thumbs-down');\n setClass(dblchk, 'disabled', !(settings.allow_change_incorrect || !first_answer.passed));\n $(\"#answer-form fieldset\").removeClass('incorrect').removeClass('correct').addClass('confburn');\n $(\"#additional-content\").append($('<div id=\"answer-exception\"><span>'+answer.exception+'</span></div>').addClass(\"animated fadeInUp\"));\n return;\n }\n if (!$(\"#answer-form form\").is(\":animated\")) {\n $(\"#reviews\").css(\"overflow-x\", \"hidden\");\n $(\"#answer-form form\").effect(\"shake\", {}, 300, function() {\n $(\"#reviews\").css(\"overflow-x\", \"visible\");\n if (!answer.accurate && input.val() !== '') {\n if (typeof answer.exception === \"string\") {\n $(\"#answer-form form\").append($('<div id=\"answer-exception\" class=\"answer-exception-form\"><span>' + answer.exception + '</span></div>').addClass(\"animated fadeInUp\"));\n }\n }\n }).find(\"input\").focus();\n }\n return;\n }\n\n // Draw 'correct' or 'incorrect' results, enable Double-Check button, and calculate updated statistics.\n $(\"#user-response\").blur();\n var new_status = Object.assign({},item_status);\n var retype = $('#option-retype');\n setClass(retype, 'disabled', !settings.allow_retyping);\n if (answer.passed) {\n $(\"#answer-form fieldset\").removeClass('incorrect').removeClass('confburn').addClass('correct');\n dblchk.find('span').attr('title','Mark Wrong').find('i').attr('class','fa fa-thumbs-down');\n setClass(dblchk, 'disabled', !(settings.allow_change_incorrect || !first_answer.passed));\n if (qtype === 'meaning') {\n new_status.mc = (new_status.mc || 0) + 1;\n } else {\n new_status.rc = (new_status.rc || 0) + 1;\n if (input.val().slice(-1) === 'n') input.val(input.val().slice(0,-1)+'ん');\n }\n } else {\n $(\"#answer-form fieldset\").removeClass('correct').removeClass('confburn').addClass('incorrect');\n dblchk.find('span').attr('title','Mark Right').find('i').attr('class','fa fa-thumbs-up');\n setClass(dblchk, 'disabled', !(settings.allow_change_correct || first_answer.passed));\n $.jStorage.set('wrongCount', wrong_cnt + 1);\n }\n $.jStorage.set('questionCount', question_cnt + 1);\n\n if (((itype === 'r') || ((new_status.rc || 0) >= 1)) && ((new_status.mc || 0) >= 1)) {\n if (show_srs) {\n if (settings.lightning_enabled) {\n if (settings.srs_msg_period > 0) {\n var status = Object.assign({},new_status);\n var srs = item.srs;\n setTimeout(Srs.load.bind(Srs, status, srs), 100);\n setTimeout(Srs.remove, settings.srs_msg_period * 1000);\n }\n } else {\n Srs.remove();\n Srs.load(new_status,item.srs);\n }\n }\n $.jStorage.set('completedCount', completed_cnt + 1);\n $.jStorage.set('activeQueue', active_queue.slice(1));\n }\n\n $(\"#user-response\").prop(\"disabled\", true);\n\n window.wkRefreshAudio();\n additionalContent.enableButtons();\n lastItems.disableSessionStats();\n $(\"#answer-exception\").remove();\n\n // Open item info, depending on settings.\n var showing_info = false;\n if (answer.passed && !settings.lightning_enabled &&\n (settings.autoinfo_correct ||\n (settings.autoinfo_slightly_off && !answer.accurate) ||\n (settings.autoinfo_multi_meaning && answer.multipleAnswers)\n )) {\n showing_info = true;\n $('#option-item-info').click();\n } else if (!answer.passed && !(settings.lightning_enabled && !settings.delay_wrong) && settings.autoinfo_incorrect) {\n showing_info = true;\n $('#option-item-info').click();\n }\n\n // When user is submitting an answer, display the on-screen message that Wanikani normally shows.\n if (show_msgs) {\n var msg;\n if (answer.passed) {\n if (!answer.accurate) {\n msg = 'Your answer was a bit off. Check the '+qtype+' to make sure you are correct';\n } else if (answer.multipleAnswers) {\n msg = 'Did you know this item has multiple possible '+qtype+'s?';\n }\n } else if (answer.custom_msg) {\n msg = answer.custom_msg;\n } else {\n msg = 'Need help? View the correct '+qtype+' and mnemonic';\n }\n if (msg) {\n if (showing_info) {\n $(\"#information\").prepend($('<div id=\"answer-exception\" style=\"top:0;\"><span>'+msg+'</span></div>').addClass(\"animated fadeInUp\"));\n } else {\n $(\"#additional-content\").append($('<div id=\"answer-exception\"><span>'+msg+'</span></div>').addClass(\"animated fadeInUp\"));\n }\n }\n }\n }", "function NameQuestion() {\n console.log('%c NAME QUESTION ', fct);\n console.log('%cAttribue des id à tous les éléments du form', exp)\n\n for (let x = 0; x < $('#SouvenirsVisuels fieldset').length; x++) {\n \n //* On nomme chaque fieldset avec un numéro de question, idem pour button & canvas\n //todo NB : c'est une class et pas un id car on a des id \"hidden\" pour les toggle btn //Du coup j'ai mis les truc toggle dans des div\n $(`#SouvenirsVisuels fieldset:eq(${x})`).attr('id', `question${x}`);\n $(`#SouvenirsVisuels fieldset:eq(${x}) button`).attr('id', `validerQ${x}`);\n $(`#SouvenirsVisuels fieldset:eq(${x}) button + a`).attr('href', `#collapse${x}`);\n $(`#SouvenirsVisuels fieldset:eq(${x}) + .graph .collapse`).attr('id', `collapse${x}`);\n $(`#SouvenirsVisuels fieldset:eq(${x}) + .graph canvas`).attr('id', `canevas${x}`);\n \n //* On nomme les inputs et les labels de ce fieldset en fonction du numéro de question\n for (let i = 0; i < $(`#question${x} input`).length; i++) {\n $(`#question${x} input:eq(${i})`).attr('id', `q${x}_${i}`);\n $(`#question${x} input:eq(${i})`).attr('name', `q${x}`);\n $(`#question${x} input:eq(${i}) + label`).attr('for', `q${x}.${i}`);\n }\n }\n}", "function ask(question){\n\t\t\tconsole.log(\"ask() called\");\n\t\t\tupdate($question, quiz.question + question);\n\t\t\t$form[0].value = \"\";\n\t\t\t$form[0].focus();\n\t\t}", "function Question(question_string){\n this.text = question_string;\n this.format = \"radio\";\n this.choice_list = [];\n\n Question.prototype.newChoice = function(text_string){\n this.choice_list.push(new Choice(text_string));\n return this.choice_list[this.choice_list.length-1];\n }\n\n Question.prototype.setFormat = function(type){\n this.format = type;\n }\n\n // Outdated, will probably be removed\n Question.prototype.drawChoices = function(type){\n var element = document.createElement(\"input\");\n var c_text = document.createTextNode(\"Test\");\n element.setAttribute(\"type\", type);\n element.setAttribute(\"value\", type);\n element.setAttribute(\"name\", type);\n \n spanner.appendChild(c_text);\n spanner.appendChild(element); \n }\n\n Question.prototype.createElement = function(type){\n var element = document.createElement(\"input\");\n \n element.setAttribute(\"type\", type);\n element.setAttribute(\"value\", i);\n element.setAttribute(\"name\", type+\"_group\");\n\n return element;\n }\n\n // Draws the question and choices in a table\n Question.prototype.drawQuestion = function(){\n // Draw question in upper table\n var tr_q = document.createElement(\"tr\");\n var td_q = document.createElement(\"td\");\n var question_text = document.createTextNode(this.text);\n\n // Use a clean table\n delete question_table;\n question_table = document.createElement(\"table\");\n\n td_q.appendChild(question_text);\n tr_q.appendChild(td_q);\n question_table.appendChild(tr_q);\n \n // Draw choices in lower table\n for(i = 0; i < this.choice_list.length; i++)\n {\n var tr_c = document.createElement(\"tr\");\n var td_c = document.createElement(\"td\");\n var c_text = document.createTextNode(this.choice_list[i].getText());\n var element = this.createElement(this.format);\n \n td_c.appendChild(element);\n td_c.appendChild(c_text);\n if(this.choice_list[i].hasValueField())td_c.appendChild(this.createElement(\"textbox\"));\n tr_c.appendChild(td_c);\n question_table.appendChild(tr_c); \n }\n }\n\n}", "function updateObject() {\n\n let idRadButt = \"\";\n let idSelectChoice = \"\";\n let quest = \"\";\n let placeholderArray = []\n\n for (let ind = 0; ind < questionsArr.length; ind++) {\n placeholderArray.push(Object.keys(questionsArr[ind]).length);\n }\n\n\n let questionSize = questionsArr.length;\n\n while (questionsArr.length > 0) {\n questionsArr.pop();\n }\n\n for (let ind = 0; ind < questionSize; ind++) {\n let questionSize = placeholderArray[ind];\n if (questionSize === 7) {\n optionCount = 4;\n } else if (questionSize === 6) {\n optionCount = 3;\n } else if (questionSize === 5) {\n optionCount = 2;\n }\n\n\n for (let ind2 = 1; ind2 <= optionCount; ind2++) {\n\n\n idRadButt = \"question\" + (ind + 1) + \"choice\" + ind2;\n\n\n if (document.getElementById(idRadButt).checked) {\n\n idSelectChoice = \"question\" + (ind + 1) + \"choiceTextArea\" + ind2;\n\n document.getElementById(idRadButt).setAttribute('value', document.getElementById(idSelectChoice).value);\n }\n }\n\n //for 2 choices\n if (optionCount === 2) {\n\n quest = {\n\n index: (ind + 1),\n question: document.getElementById('question' + (ind + 1) + 'TextArea').value,\n choice1: document.getElementById('question' + (ind + 1) + 'choiceTextArea1').value,\n choice2: document.getElementById('question' + (ind + 1) + 'choiceTextArea2').value,\n answer: document.getElementById(idSelectChoice).value\n };\n\n //for 3 choices\n } else if (optionCount === 3) {\n\n quest = {\n\n index: (ind + 1),\n question: document.getElementById('question' + (ind + 1) + 'TextArea').value,\n choice1: document.getElementById('question' + (ind + 1) + 'choiceTextArea1').value,\n choice2: document.getElementById('question' + (ind + 1) + 'choiceTextArea2').value,\n choice3: document.getElementById('question' + (ind + 1) + 'choiceTextArea3').value,\n answer: document.getElementById(idSelectChoice).value\n };\n\n //for 4 choices\n } else if (optionCount === 4) {\n\n quest = {\n\n index: (ind + 1),\n question: document.getElementById('question' + (ind + 1) + 'TextArea').value,\n choice1: document.getElementById('question' + (ind + 1) + 'choiceTextArea1').value,\n choice2: document.getElementById('question' + (ind + 1) + 'choiceTextArea2').value,\n choice3: document.getElementById('question' + (ind + 1) + 'choiceTextArea3').value,\n choice4: document.getElementById('question' + (ind + 1) + 'choiceTextArea4').value,\n answer: document.getElementById(idSelectChoice).value\n };\n }\n questionsArr.push(quest);\n }\n\n /*\n Make sure to send one per new question\n */\n let xhttpEach = [];\n for (let ind = 0; ind < questionsArr.length; ind++) {\n xhttpEach[ind] = new XMLHttpRequest();\n xhttpEach[ind].open(PUT, endPointRoot + \"update\", true);\n xhttpEach[ind].setRequestHeader(\"Content-type\", \"application/json\");\n xhttpEach[ind].send(JSON.stringify(questionsArr[ind]));\n xhttpEach[ind].onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n console.log(\"Put on the client side is working\");\n }\n };\n }\n}", "constructor() {\n this.questions = [];\n this.validate = {\n notEmpty(value) {\n return (value && value.length && value.length > 0) ?\n true : 'Please enter a value';\n },\n yesNo(value) {\n return (value &&\n ['y', 'n', 'yes', 'no'].indexOf(value.toLowerCase()) !== -1) ?\n true : 'Invalid input to yes/no question';\n }\n };\n }", "function submitQuestionHandler(e) {\n e.preventDefault();\n\n let category = selectCategoryEl.value;\n let dropdown = selectQuestionEl.value;\n let question = removeEnter(e.target.question.value);\n let answer = removeEnter(e.target.answer.value);\n //if new question, add to array of questions, else edit selected\n if(dropdown === 'Add New' && category !== 'All Categories') {\n new Question(question, answer, category);\n console.log('new question submitted!');\n store('questionsKey', allQuestions);\n resetFormValues();\n populateForm();\n } else {\n if(questionFound) {\n allQuestions[questionFoundIndex].question = question;\n allQuestions[questionFoundIndex].answer = answer;\n console.log('question successfully edited');\n selectQuestionEl.value = 'Add New';\n store('questionsKey', allQuestions);\n resetFormValues();\n populateForm();\n }\n }\n\n if(showCards) {\n showAllCards();\n }\n}", "function renderCorrectAnswerResult(){\n $('input[type=\"radio\"]').attr('disabled', 'disabled');\n $('.submit-answer').before('<div class=\"message correct fade-in\"></div>');\n $(\"input[name='option']:checked\").parent().addClass('correct-answer');\n updateScore();\n console.log('correct!');\n}", "function nextQuestion()\n\t\t\t{\n\t\t\t\t$(\"#oneword\").hide();\n\t\t\t\t$(\"#multiple\").hide();\n\n\t\t\t\tif(count >= 10)\n\t\t\t\t{\n\t\t\t\t\tcount = 0;\n\t\t\t\t\tendQuiz();\t\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\n\t\t\t\t\tcount++;\n\n\t\t\t\t\t//get the question object for next question\n\t\t\t\t\tif(day%2 == 0)\n\t\t\t\t\t\tquestion = getQuestion(randomArr[count-1]);\n\t\t\t\t\telse\n\t\t\t\t\t\tquestion = getQuestion(randomArr[count-1]);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif(count > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t//update the progress bar\n\t\t\t\t\t\tprogressBar();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t//update the score\n\t\t\t\t\t\tupdateScore();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t//reset the form values\n\t\t\t\t\t\tdocument.getElementById(\"formName\").reset();\n\t\t\t\t\t}\n\n\t\t\t\t\t\n\t\t\t\t\t//if multiple choice question\n\t\t\t\t\tif(question.questionType == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t$(\"#multiple\").show();\n\n\t\t\t\t\t\tdocument.getElementById(\"question1\").innerHTML = question.question;\n\t\t\t\t\t\tdocument.getElementById(\"label1\").innerHTML = question.choices[0];\n\t\t\t\t\t\tdocument.getElementById(\"label2\").innerHTML = question.choices[1];\n\t\t\t\t\t\tdocument.getElementById(\"label3\").innerHTML = question.choices[2];\n\t\t\t\t\t\tdocument.getElementById(\"label4\").innerHTML = question.choices[3];\n\n\t\t\t\t\t\tdocument.getElementById(\"radio1\").setAttribute(\"value\",question.choices[0]);\n\t\t\t\t\t\tdocument.getElementById(\"radio2\").setAttribute(\"value\",question.choices[1]);\n\t\t\t\t\t\tdocument.getElementById(\"radio3\").setAttribute(\"value\",question.choices[2]);\n\t\t\t\t\t\tdocument.getElementById(\"radio4\").setAttribute(\"value\",question.choices[3]);\n\t\t\t\t\t}\n\t\t\t\t\t//if single line question\n\t\t\t\t\telse if(question.questionType == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\t$(\"#oneword\").show();\n\t\t\t\t\t\tdocument.getElementById(\"question2\").innerHTML = question.question;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "function renderQuestAns(questions) {\n let showQuestion = $(`\n <form class=\"question-form\">\n <section class=\"quiz-bg\">\n <fieldset name=\"start-quiz\">\n <legend class=\"zzz\">zZz</legend>\n <h2 class=\"question-text\">${STORE[questions].question}</h2>\n </fieldset>\n </section>\n </form>\n `);\n\n let showChoices = $(showQuestion).find(\"fieldset\");\n STORE[questions].answers.forEach(function(ans, qindex) {\n $(`<span class=\"choices\"><input class=\"radio\" type=\"radio\" \n id=\"${qindex}\"\n value=\"${ans}\" \n name=\"answer\" required>${ans}</span>`).appendTo(showChoices);\n });\n $(`<button type=\"button\" class=\"submitButton\">Submit</button>`).appendTo(\n showChoices\n );\n $(\".display\").html(showQuestion);\n}", "function resetFieldUpdateMessages() {\n var successMessages = Y.all('.' + CSS_CLASS_UPDATE_SUCCESS);\n successMessages.each(function(node) {\n node.removeClass('hidden');\n node.hide();\n });\n var errorMessages = Y.all('.' + CSS_CLASS_UPDATE_ERROR);\n errorMessages.each(function(node) {\n var message = node.one('.' + CSS_CLASS_MESSAGE);\n if (message) {\n message.setHTML('');\n }\n node.removeClass('hidden');\n node.hide();\n });\n }", "function renderQuestion() {\n $(\".quizForm\").show();\n $(\".quizQuestion\").text(QUIZ[questionNumber].question);\n\n $(\".answer1\").val(QUIZ[questionNumber].answers[0]);\n $(\".spAns1\").text(QUIZ[questionNumber].answers[0]);\n\n $(\".answer2\").val(QUIZ[questionNumber].answers[1]);\n $(\".spAns2\").text(QUIZ[questionNumber].answers[1]);\n\n $(\".answer3\").val(QUIZ[questionNumber].answers[2]);\n $(\".spAns3\").text(QUIZ[questionNumber].answers[2]);\n\n $(\".answer4\").val(QUIZ[questionNumber].answers[3]);\n $(\".spAns4\").text(QUIZ[questionNumber].answers[3]);\n\n console.log(\"renderQuestion() ran\");\n}", "function questionApply() {\n if (index <= (qS.questions.length - 1)) {\n question.innerHTML = qS.questions[0].q;\n ans1.innerHTML = qS.questions[0].inputs[0];\n ans2.innerHTML = qS.questions[0].inputs[1];\n ans3.innerHTML = qS.questions[0].inputs[2];\n ans4.innerHTML = qS.questions[0].inputs[3];\n } else {\n alert(\"Quiz Completed!\")\n }\n}", "function buildQuestions(question, answer) {\n var q = \"\";\n var id = \"q\" + question.id;\n \n switch (question.type) {\n case \"date\" :\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><label for=\"+question.id+\">\"+question.text+\"</label>\";\n q += \"<input type=\"+question.type+\" name=\"+question.id+\" id=\"+question.id+\" value=\"+answer+\" placeholder=\"+question.help+\"></div>\";\n break;\n case \"textbox\" :\n if (question.help === undefined) question.help = \"\";\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><label for=\"+question.id+\">\"+question.text+\"</label>\";\n if (answer !== \"\") {\n q += \"<input type=\\\"text\\\" name=\"+question.id+\" id=\"+question.id+\" value=\"+answer+\"></div>\";\n } else {\n q += \"<input type=\\\"text\\\" name=\"+question.id+\" id=\"+question.id+\" placeholder=\"+question.help+\"></div>\";\n }\n \n if (question.hasOwnProperty(\"validate\")) {\n //TODO validade input\n }\n break;\n case \"textarea\" :\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><label for=\"+question.id+\">\"+question.text+\"</label>\";\n if (answer !== \"\") {\n q += \"<textarea cols=\\\"40\\\" rows=\\\"5\\\" name=\"+question.id+\" id=\"+question.id+\">\"+answer+\"</textarea></div>\";\n } else {\n q += \"<textarea cols=\\\"40\\\" rows=\\\"5\\\" name=\"+question.id+\" id=\"+question.id+\">\"+question.help+\"</textarea></div>\";\n }\n break;\n case \"choice\" :\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><label class=\\\"select\\\" for=\"+question.id+\">\"+question.text+\"</label>\";\n q += \"<select name=\"+question.id+\" id=\"+question.id+\" data-inline=\\\"true\\\">\";\n question.options.forEach(function(a) {\n if (answer === a) {\n q += \"<option value=\"+a+\" selected>\"+a+\"</option>\";\n } else {\n q += \"<option value=\"+a+\">\"+a+\"</option>\";\n } \n });\n q += \"</select></div>\";    \n break;\n case \"slidingoption\" :\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><legend>\"+question.text+\"</legend>\";\n for (var a = 0; a < question.options.length; a++) {\n if (answer === question.options[a] || a + 1 === question.options.length) {\n q += \"<input type=\\\"radio\\\" name=\"+question.id+\" id=\"+question.options[a]+\" value=\"+question.options[a]+\" checked>\";\n } else {\n q += \"<input type=\\\"radio\\\" name=\"+question.id+\" id=\"+question.options[a]+\" value=\"+question.options[a]+\">\";\n }\n q += \"<label for=\"+question.options[a]+\">\"+question.options[a]+\"</label>\";\n }\n \n for (var a = 0; a < question.options.length; a++) {\n if (answer === question.optionVisuals[a] || a + 1 === question.optionVisuals.length) {\n q += \"<input type=\\\"radio\\\" name=\"+question.id+\" id=\"+question.optionVisuals[a]+\" value=\"+question.optionVisuals[a]+\" checked>\";\n } else {\n q += \"<input type=\\\"radio\\\" name=\"+question.id+\" id=\"+question.optionVisuals[a]+\" value=\"+question.optionVisuals[a]+\">\";\n }\n q += \"<label for=\"+question.optionVisuals[a]+\">\"+question.optionVisuals[a]+\"</label>\";\n }\n\n q += \"</div>\";\n break;\n case \"scale\" :\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><label for=\"+question.id+\">\"+question.text+\"</label>\";\n if (answer === \"\") answer = question.start;\n if (question.hasOwnProperty(\"gradientStart\")) {\n q += \"<input type=\\\"range\\\" onchange=\\\"changeBackgroundColor(\"+question.id+\")\\\" name=\"+question.id+\" id=\"+question.id+\" value=\"+answer+\" min=\"+question.start+\" max=\"+question.end+\" step=\"+question.increment+\" data-highlight=\\\"true\\\"></div>\";\n } else {\n q += \"<input type=\\\"range\\\" name=\"+question.id+\" id=\"+question.id+\" value=\"+answer+\" min=\"+question.start+\" max=\"+question.end+\" step=\"+question.increment+\" data-highlight=\\\"true\\\"></div>\";\n }\n break;\n case \"multiplechoice\" :\n q += \"<div class=\\\"ui-field-contain\\\" id=\"+id+\"><legend>\"+question.text+\"</legend>\";\n question.options.forEach(function(a) {\n if (answer.indexOf(a) > -1) {\n q += \"<input type=\\\"checkbox\\\" name=\"+question.id+\" id=\"+a+\" value=\"+a+\" checked>\";\n } else {\n q += \"<input type=\\\"checkbox\\\" name=\"+question.id+\" id=\"+a+\" value=\"+a+\">\";\n } \n q += \"<label for=\"+a+\">\"+a+\"</label>\";\n });\n q += \"</div>\";\n break;\n }\n return q;\n}", "function updateQuizDetails(THIS) {\n\n var form = document.formUpdateQuizDetails;\n\n var quizTitle = form.quizTitle.value;\n if (quizTitle.length < 5 || quizTitle.length > 100) {\n form.quizTitle.focus();\n eNote(\"Quiz title should be 5 to 100 char long\");\n return false;\n }\n\n var level = form.level;\n if (level.value < 1 || level.value > 4) {\n eNote(\"Please select a valid quiz level\");\n level.focus();\n return false;\n }\n\n var lastDate = form.lastDate;\n if (lastDate.value === '') {\n eNote(\"Please enter a valid quiz end date\");\n lastDate.focus();\n return false;\n }\n\n var $form = $(form);\n $.ajax({\n url: $form.attr('action'),\n type: $form.attr('method'),\n data: $form.serialize(),\n beforeSend: function (data) {\n disableButton(THIS);\n hideNote();\n },\n complete: function (cD) {\n enableButton(THIS);\n },\n success: function (data) {\n if (data === 'DONE') {\n iNote('Your quiz has been updated.');\n } else {\n eNote(data);\n }\n },\n error: function (xhr, ajaxOptions, thrownError) {\n eNote(\"Ajax Failed:<br>Status: \" + xhr.status + \"<br>Error: \" + thrownError + \"<br>Message: \" + xhr.responseText);\n }\n });\n return false;\n}", "function updateClasses() {\n\n var formField = formCtrl[scope.fieldName];\n element.toggleClass('isValid', formField.$valid);\n element.toggleClass('error', formField.$invalid && (formField.$dirty || formField.$touched || formCtrl.$submitted));\n element.toggleClass('valueEntered', formField.$dirty || (formField.$viewValue !== undefined && \n formField.$viewValue !== null && formField.$viewValue.length > 0));\n }", "function nextQuestion() {\n\n // If all questions are completed hide end the quiz\n if (currentQuestionNumber == questions.length) {\n endQuiz();\n return;\n }\n // Otherwise update current question\n currentQuestion = questions[currentQuestionNumber];\n // Inject all properties to UI\n $(\"#questionNumber\").text(currentQuestionNumber + 1);\n $(\"#questionText\").text(currentQuestion.question);\n $(\"#answerA\").text(currentQuestion.answers.a);\n $(\"#answerB\").text(currentQuestion.answers.b);\n $(\"#answerC\").text(currentQuestion.answers.c);\n\n\n}", "validate()\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }", "function addQuali(){\n\t//check if the qualification name is blank\n\tif (qualiName.value == \"\"){\n\t\terrorMsg[1].style.display = \"block\";\n\t\tqualiName.style.border = \"1px solid red\";\n\t\tinvalidQualiName = true;\n\t}else\n\t\tinvalidQualiName = false;\n\t\n\t//check if the minimum score is blank\n\tif (minScore.value == \"\"){\n\t\terrorMsg[2].style.display = \"block\";\n\t\tminScore.style.border = \"1px solid red\";\n\t\tinvalidMinScore = true;\n\t}else\n\t\tinvalidMinScore = false;\n\t\n\t//check if the maximum score is blank\n\tif (maxScore.value == \"\"){\n\t\terrorMsg[3].style.display = \"block\";\n\t\tmaxScore.style.border = \"1px solid red\";\n\t\tinvalidMaxScore = true;\n\t}else\n\t\tinvalidMaxScore = false;\n\t\n\t//check if the calculation type is chosen\n\tif (calculationType.value == \"\"){\n\t\terrorMsg[4].style.display = \"block\";\n\t\tcalculationType.style.border = \"1px solid red\";\n\t\tinvalidCalculationType = true;\n\t}else\n\t\tinvalidCalculationType = false;\n\t\n\t//check if the number of subject is blank\n\tif (numOfSubject.value == \"\"){\n\t\terrorMsg[5].style.display = \"block\";\n\t\tnumOfSubject.style.border = \"1px solid red\";\n\t\tinvalidNumOfSubject = true;\n\t}else\n\t\tinvalidNumOfSubject = false;\n\n\t\n\t//alert(\"a\"+ invalidQualiName + \"\" + invalidMinScore + \"\" + invalidMaxScore + \"\" + invalidCalculationType + \"\" + invalidNumOfSubject + \"\" + invalidNumOfGrade + \"\");\n\tinvalid = [invalidQualiName, invalidMinScore, invalidMaxScore, invalidCalculationType, invalidNumOfSubject];\n\tfor ( i = 0 ; i < invalid.length; i++){\n\t\tif (invalid[i]){\n\t\t\tdocument.getElementsByClassName(\"form-control\")[i].focus();\n\t\t\treturn false;\n\t\t}\n\t}\n}", "function updateQuestion(result) {\n answers = result.answers;\n possibleAnswers = result.answers.length\n solutionIndex = result.solution_index;\n var answerString = \"\";\n var j = 0;\n var prev_j = [];\n var temp_j = 0;\n for (var i = 0; i < possibleAnswers; i ++)\n { \n temp_j = getRandomInt(0, possibleAnswers);\n while(prev_j.indexOf(temp_j) != -1)\n {\n temp_j = getRandomInt(0, possibleAnswers);\n }\n prev_j.push(temp_j);\n if (temp_j == solutionIndex)\n {\n answerString += \"<input type='radio' id='sol' name='answerChoice' value='\" + i.toString() + \"'>\" + answers[temp_j] + \"<br>\";\n }\n else\n {\n answerString += \"<input type='radio' name='answerChoice' value='\" + i.toString() + \"'>\" + answers[temp_j] + \"<br>\";\n }\n }\n $('#answerChoices').html(answerString);\n\n\n flag = \"false\";\n $('#question').text(result.question_title);\n $('.score', element).text(result.score);\n }", "function init() {\n //Validator looks to make sure that when you enter in the ID it's 8 characters long and only numbers. It has very specific text to set it up. Just don't touch it. \n var MyTextValidator = (function (_super) {\n Survey.__extends(MyTextValidator, _super);\n function MyTextValidator() {\n _super.call(this);\n }\n MyTextValidator.prototype.getType = function () {\n return \"mytextvalidator\";\n };\n MyTextValidator.prototype.validate = function (value, name) {\n if (isNaN(value)) {//If it's Not a Number (NaN)\n //report an error\n return new Survey.ValidatorResult(null, new Survey.CustomError(this.getErrorText(name)));\n }else if (value.length !== 8){ //If it's not exactly 8 characters long report an error\n return new Survey.ValidatorResult(null, new Survey.CustomError(this.getErrorText(name)));\n }\n //return nothing if there is no any error.\n return null;\n };\n //the default error text. It shows if user do not set the ID text property\n MyTextValidator.prototype.getDefaultErrorText = function (name) {\n return \"Your entry should contain only eight numbers.\";\n }\n return MyTextValidator;\n })(Survey.SurveyValidator);\n Survey.MyTextValidator = MyTextValidator;\n \n //add validator into survey Json metaData\n Survey\n .JsonObject\n .metaData\n .addClass(\"mytextvalidator\", [], function () {\n return new MyTextValidator();\n }, \"surveyvalidator\");\n \n //This is the JSON with all the questions and format in it\n var jsonBegin = {\n \n //These triggers show the right next questions depending on how users respond to the \"Do I have an ID\" question.\n triggers: [\n {\n type: \"visible\",\n name: \"IDCheck\",\n operator: \"equal\",\n value: \"True\",\n questions: [\"ID\"]\n }, {\n type: \"visible\",\n name: \"IDCheck\",\n value: \"False\",\n questions: [\"HowToID\", \"IDName\", \"IDLast\", \"IDNumber\"]\n }],\n \n //Sets a title bar for the whole survey and a progress bar.\n title: \" The BIS-BAS.\",\n showProgressBar: \"top\",\n pages: [\n {questions: [\n //html questions are just information. This is a good way to introduce topics. You can use HTML mark up in these sections.\n { type: \"html\", name: \"introAndDemographics\", html: \"<h2 class=\\\"post-title\\\"> Welcome to the behavioural inhibition system (BIS) and the behavioural activation system (BAS) survey.</h2> <p>General Demographic Questions.</p> <p> Remember: If at any time you feel that the text or options are too small you can hit Ctrl and the + sign in Windows or command and + in Mac on your keyboard to increase the fonts on the screen. This is an accessability feature available on all major browsers and most websites! (Note that ctrl - or command - will reduce the font sizes.) </p>\"},\n \n //Checking if participant has a unique ID\n { type: \"radiogroup\",\n name: \"IDCheck\",\n title: \"I was given a unique ID to take this survey\", isRequired: true,\n choices: [\"True\", \"False\"]\n },\n \n //Text questions take text responses. Here, we want to know the participants ID number.\n { type: \"text\", name: \"ID\", title: \"Please enter your identifying code here.\", isRequired: true,\n visible: false, size: 15, width: \"4\"},\n \n { type: \"html\", name: \"HowToID\", \n visible: false, html: \"This section will ask you a series of questions to create a unique ID for you. None of this information will be saved by the system, but will only be used to create your number. If you give the same info each time, you will always get the same ID number, but it will be impossible for someone who has your ID number to identify you with that number.\"\n },\n \n //Asking various questions that will be used to create an ID\n { type: \"text\", name: \"IDName\", title: \"Please enter your first name.\", isRequired: true,\n visible: false, size: 15, width: \"4\"},\n \n { type: \"text\", name: \"IDLast\", title: \"Please enter your mothers maiden name.\", isRequired: true, visible: false, size: 15, width: \"4\"},\n \n { type: \"text\", name: \"IDNumber\", title: \"Create a large number by entering your date of birth without dashes or spaces. An example would be 01041980. The number can be in whichever order you normally display numbers.\", isRequired: true,\n visible: false, size: 15, width: \"4\", validators: [\n {\n type: \"mytextvalidator\"\n }\n ]},\n \n\n //Radio groups are radio button questions. They accept a single answer. this is the gender question.\n { type: \"radiogroup\", name: \"gender\", title: \"My biological sex is...\", colCount: 0, choices: [\"Male\", \"Female\", \"Intersex\"]}\n ]},\n //By calling \"question\" again, we make the model inside the website page go to the next section of the questionnaire. The above questions will disappear and be replaced by these next questions.\n { questions: [\n \n //Another radio group. This time for age. \n {type: \"radiogroup\", name: \"age\", colCount: 4, title: \"What is your age?\", choices: [\"16-|16 years and below\", \"23-30|23-30 years old\", \"65-74|65-74 years old\", \"17-19|17-19 years old\", \"31-45|31-45 years old\", \"75+|75 years and older\", \"20-22|20-22 years old\", \"46-64|46-64 years old\"]}\n ]},\n \n { questions: [\n \n //Check box questions allow for multiple answers. This one is about race.\n {type: \"checkbox\", name: \"race\", title: \"Choose one or more races that you consider yourself to be:\", colCount: 3, hasOther: true, choices: [\"White\", \"Black or African American\", \"American Indian or Alaska Native\", \"Asian\", \"Native Hawaiian or Pacific Islander\", \"Spanish, Hispanic, or Latino\"]}\n ]},\n \n { questions: [\n \n //Check box about employment status.\n {type: \"checkbox\", name: \"employment\", title: \"Are you currently... ?\", colCount: 3, hasOther: true, choices: [\"A college student\", \"Employed for wages\", \"Self-employed\", \"Out of work and looking for work\", \"Out of work but not currently looking for work\", \"A homemaker\", \"Military\", \"Retired\", \"Unable to work\"]}\n ]},\n \n {questions: [\n \n //This HTML introduces the next section. \n { type: \"html\", name: \"info\", html: \"<p>Each of the items on this page is a statement that a person may either agree with or disagree with. For each item, indicate how much you agree with or disagree with what the item says. Please respond to all the items; do not leave any blank. Choose only one response to each statement. Please be as accurate and honest as you can be. Respond to each item as if it were the only item. That is, don't worry about being \\\"consistent\\\" in your responses.\"}\n ]},\n \n {questions: [\n \n //A matrix question is a set of questions using a likert or likert-like scale. So the scale goes across the top (columns), and the questions allong the side(rows). Values will be useful in the final data set. Text is what is visible to the participant. \n { type: \"matrix\", name: \"Quality\", title: \"Please respond to the following.\",\n columns: [{ value: 1, text: \"Very true for me\" },\n { value: 2, text: \"Somewhat true for me\" },\n { value: 3, text: \"Somewhat false for me\" },\n { value: 4, text: \"Very false for me\" }],\n rows: [{ value: \"filler1\", text: \"A person's family is the most important thing in life.\" },\n { value: \"BIS1\", text: \"Even if something bad is about to happen to me, I rarely experience fear or nervousness.\" },\n { value: \"BASDrive1\", text: \"I go out of my way to get things I want.\" },\n { value: \"BASReward1\", text: \"When I'm doing well at something I love to keep at it.\" },\n { value: \"BASFun1\", text: \"I'm always willing to try something new if I think it will be fun.\" },\n { value: \"filler2\", text: \"How I dress is important to me.\" }]}\n ]},\n \n {questions: [\n \n { type: \"matrix\", name: \"Quality\", title: \"Please respond to the following.\",\n columns: [{ value: 1, text: \"Very true for me\" },\n { value: 2, text: \"Somewhat true for me\" },\n { value: 3, text: \"Somewhat false for me\" },\n { value: 4, text: \"Very false for me\" }],\n rows: [\n { value: \"BASReward2\", text: \"When I get something I want, I feel excited and energized.\" },\n { value: \"BIS2\", text: \"Criticism or scolding hurts me quite a bit.\" },\n { value: \"BASDrive2\", text: \"When I want something I usually go all-out to get it.\" },\n { value: \"BASFun2\", text: \"I will often do things for no other reason than that they might be fun.\" },\n { value: \"filler3\", text: \"It's hard for me to find the time to do things such as get a haircut.\" },\n { value: \"BASDrive3\", text: \"If I see a chance to get something I want I move on it right away.\" }]}\n ]},\n \n {questions: [\n \n \n { type: \"matrix\", name: \"Quality\", title: \"Please respond to the following.\",\n columns: [{ value: 1, text: \"Very true for me\" },\n { value: 2, text: \"Somewhat true for me\" },\n { value: 3, text: \"Somewhat false for me\" },\n { value: 4, text: \"Very false for me\" }],\n rows: [\n { value: \"BIS3\", text: \"I feel pretty worried or upset when I think or know somebody is angry at me.\" },\n { value: \"BASReward3\", text: \"When I see an opportunity for something I like I get excited right away.\" },\n { value: \"BASFun3\", text: \"I often act on the spur of the moment.\" },\n { value: \"BIS4\", text: \"If I think something unpleasant is going to happen I usually get pretty \\\"worked up.\\\"\" },\n { value: \"filler4\", text: \"I often wonder why people act the way they do.\" },\n { value: \"BASReward4\", text: \"When good things happen to me, it affects me strongly.\" }]}\n ]},\n \n {questions: [\n \n \n { type: \"matrix\", name: \"Quality\", title: \"Please respond to the following.\",\n columns: [{ value: 1, text: \"Very true for me\" },\n { value: 2, text: \"Somewhat true for me\" },\n { value: 3, text: \"Somewhat false for me\" },\n { value: 4, text: \"Very false for me\" }],\n rows: [\n { value: \"BIS5\", text: \"I feel worried when I think I have done poorly at something important.\" },\n { value: \"BASFun4\", text: \"I crave excitement and new sensations.\" },\n { value: \"BASDrive4\", text: \"When I go after something I use a \\\"no holds barred\\\" approach.\" },\n { value: \"BIS6\", text: \"I have very few fears compared to my friends.\" },\n { value: \"BASReward5\", text: \"It would excite me to win a contest.\" },\n { value: \"BIS7\", text: \"I worry about making mistakes.\" }]}\n ]}\n ]\n };\n \n //Used for debugging\n console.log(jsonBegin);\n \n //Some Bootstrappy stuff that makes it look better, style choices\n Survey.defaultBootstrapCss.navigationButton = \"btn btn-primary\";\n Survey.Survey.cssType = \"bootstrapmaterial\";\n Survey.Survey.cssType = \"bootstrap\";\n\n //Load the above JSON information into the survey model\n var model = new Survey.Model(jsonBegin);\n window.survey = model;\n \n //When you get results, turn them into a string and submit\n survey.onComplete.add(function (result) {\n document.querySelector('#surveyResult').innerHTML = \"result: \" + JSON.stringify(result.data);\n var surveyResult;\n var surveyString = JSON.stringify(result.data);\n surveyString = CreateAnID(surveyString);\n //Send results to the server, type of content is json\n \n if (surveyString.includes(\"ID\")) {\n //Set a cookie with the user ID\n var pos = surveyString.indexOf(\"ID\");\n pos = pos + \"ID\".length + 3;\n var tempString = surveyString[pos];\n pos++;\n while (surveyString[pos] !== \"\\\"\") {\n tempString += surveyString[pos];\n pos++;\n }\n var d = new Date();\n d.setTime(d.getTime() + (1 * 24 * 60 * 60 * 1000)); //Cookie set to self destruct in a day\n var expires = \"expires=\" + d.toUTCString();\n document.cookie = \"userName=\" + tempString + \";\" + expires;\n }\n //This has to exist, because dataPassed will become undefined once it's outside of the ajax request. This literally just holds the data so that it can be accessed outside of the call.\n var holdMyData;\n var dataPassed;\n //Check to see if this ID has been used before.\n $.ajax({\n type: \"GET\",\n url: \"/BISresult/\" + tempString,\n async: false,\n success: function (dataPassed) {\n holdMyData = dataPassed;\n //verification that the data was retreieved.\n }\n });\n if(holdMyData === '') {//if it's not been used before. Post and move to the results\n postAndMoveOn(surveyString);\n } else {//If it's been used before, show a pop up asking whether the user wants to create a new Unique ID or just retreive the old user data. \n if (confirm(\"You have entered an ID that already exists. Clicking OK will modify your current ID so it can be saved uniquely. If you do not wish to do this, hit Cancel and you will be forwarded to the results page and shown the perviously entered data.\")) {\n //If they want to create a new ID, go to fuction to do that.\n surveyString = fixSurveyString(surveyString);\n //Then post and move on.\n postAndMoveOn(surveyString);\n console.log(\"You pressed OK!\");\n } else {\n //If they want to see the old data, then just move on. Post nothing. \n //For the IRB, you may need to change the below to \"BISBAS.html\" instead of \"BISBASResults.html\"\n window.location.href = \"BISBASResults.html\";\n console.log(\"You pressed Cancel!\");\n }\n }\n });\n //Important survey posting line. Don't touch. \n $(\"#surveyElement\").Survey({model: model});\n \n}", "updateForm() {\n const categories = document.querySelectorAll(\"input[name='categories']\");\n const bags = document.querySelector(\"input[name='bags']\");\n const organization = document.querySelector(\"input[name='organization']:checked\");\n const address = document.querySelector(\"input[name='address']\");\n const city = document.querySelector(\"input[name='city']\");\n const postcode = document.querySelector(\"input[name='postcode']\");\n const phone = document.querySelector(\"input[name='phone']\");\n const date = document.querySelector(\"input[name='data']\");\n const time = document.querySelector(\"input[name='time']\");\n const more_info = document.querySelector(\"textarea[name='more_info']\");\n\n const summary_bags = document.querySelector(\"#summary-bags\");\n const summary_organization = document.querySelector(\"#summary-organization\");\n const summary_address = document.querySelector(\"#summary-address\");\n const summary_date = document.querySelector(\"#summary-date\");\n\n const next4 = document.querySelector(\"div[data-step='4'] button.next-step\");\n\n let formMessages = document.querySelectorAll(\".form-messages\");\n formMessages.forEach(message => {\n message.innerHTML = \"\"\n })\n\n let formErrors = [];\n\n if (this.currentStep === 2) {\n const lngChecked = [...categories].filter(el => el.checked).length;\n if (lngChecked === 0) {\n formErrors.push(\"Wybierz przynajmniej jedną kategorię\");\n }\n } else if (this.currentStep === 3) {\n const bags_reg = /[0-9]/\n if (!bags_reg.test(bags.value)) {\n formErrors.push(\"Wypełnij poprawnie liczbę przekazywanych worków\");\n }\n } else if (this.currentStep === 4) {\n if (!organization) {\n formErrors.push(\"Wybierz jedną z organizacji\");\n }\n } else if (this.currentStep === 5) {\n const postcode_reg = /^[0-9][0-9]-[0-9][0-9][0-9]$/\n const phone_reg = /^[0-9]{9}$/\n // const data_reg = /^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}$/\n const data_reg = /^202[12]-[0-9]{2}-[0-9]{2}$/\n const today = new Date()\n let form_date = date.value.split(\"-\")\n form_date = new Date(form_date[0], form_date[1] - 1, form_date[2])\n const time_reg = /^0[8-9]|1[0-9]|2[0-2]:[0-9]{2}$/\n if (address.value.length <= 3) {\n formErrors.push(\"Wypełnij poprawnie pole z adresem\");\n }\n if (city.value.length <= 3) {\n formErrors.push(\"Wypełnij poprawnie pole z nazwą miasta\");\n }\n if (!postcode_reg.test(postcode.value)) {\n formErrors.push(\"Podaj poprawny kod pocztowy w formacie XX-XXX\");\n }\n if (!phone_reg.test(phone.value)) {\n formErrors.push(\"Podaj poprawny nr telefonu w formacie 123456789\");\n }\n if (!data_reg.test(date.value) || (form_date - today) <= 1) {\n formErrors.push(\"Wypełnij prawidłowo datę odbioru - odbiór możliwy od dnia jutrzejszego\");\n }\n if (!time_reg.test(time.value)) {\n formErrors.push(\"Wypełnij prawidłowo godzinę odbioru - odbiór możliwy w godzinach 8:00 - 22:00\");\n }\n }\n if (formErrors.length) {\n\n formMessages.forEach(message => {\n message.innerHTML = `\n <h3 class=\"form-error-title\">Proszę poprawić następujące błędy: </h3>\n <ul class=\"form-error-list\">\n ${formErrors.map(el => `<li>${el}</li>`).join(\"\")}\n </ul>\n `;\n })\n this.currentStep--;\n } else {\n this.$step.innerText = this.currentStep;\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 next4.addEventListener('click', evt => {\n const category_names = [];\n categories.forEach(el => {\n if (el.checked) {\n category_names.push(el.dataset.category)\n }\n })\n summary_bags.innerText = `Liczba worków: ${bags.value}; Zawartość: ${category_names.join(', ').toLowerCase()}`;\n if (organization !== null) {\n summary_organization.innerText = `Dla: ${organization.dataset.institution}`;\n }\n summary_address.firstElementChild.innerText = `${address.value}`;\n summary_address.children[1].innerText = `${city.value}`;\n summary_address.children[2].innerText = `${postcode.value}`;\n summary_address.lastElementChild.innerText = `tel. ${phone.value}`;\n summary_date.firstElementChild.innerText = `${date.value.toString()}`;\n summary_date.children[1].innerText = `g. ${time.value.toString()}`;\n if (more_info.value) {\n summary_date.lastElementChild.innerText = `Uwagi dla kuriera: \n ${more_info.value}`;\n }\n })\n }\n }", "function validateData() {\n // get the answer from the question textarea\n let multipleChoiceAnswer;\n longAnswer.value;\n\n // loop through all the multiple choice answers and find the selected one\n const array = Array.prototype.slice.call(answersList.querySelectorAll('.form-bottom__item'));\n array.forEach(function(item) {\n\n // get currently selected multiplechoice answeer\n const current = item.querySelector('.form-bottom__item-radio-btn');\n\n // get the element tag\n const currentItemType = item.querySelector('.form-bottom__item-text').tagName;\n\n // if the answer selected in predefined - grab it's text content\n // if the answer is manually entered by the user - grab it's input text value\n if (current.checked && (currentItemType === 'DIV')) {\n multipleChoiceAnswer = current.parentElement.querySelector('.form-bottom__item-text').textContent;\n } else if (current.checked && (currentItemType === 'INPUT')) {\n multipleChoiceAnswer = current.parentElement.querySelector('.form-bottom__item-text').value;\n }\n })\n\n // verify that user has entered an answer into the question box\n if (longAnswer.value === '') {\n const error = document.createElement('span');\n error.textContent = \"Please type an answer to the question!\"\n errors.appendChild(error);\n errorCount += 1;\n }\n\n // verify that at least 1 multiple choice answer was selected or display error\n if (typeof multipleChoiceAnswer === 'undefined') {\n const error = document.createElement('span');\n error.textContent = \"Please select at least 1 answer or type your own!\"\n errors.appendChild(error);\n errorCount += 1;\n }\n\n // return submission data\n return {\n longAnswer: longAnswer,\n multipleChoiceAnswer: multipleChoiceAnswer\n }\n}", "function renderQuiz() {\n // *** Loop through the Length of the quizRes array\n for (let i = 0; i < quizRes.length; i++) {\n // ** Variables\n const resPath = quizRes[i];\n const domPath = $(\".question\")[i].children;\n // *** Update Question\n domPath[1].children[1].children[0].value = decode(resPath.question);\n // *** Update Correct Answer\n domPath[2].children[1].children[0].value = decode(resPath.correct_answer);\n // *** Update Incorrect Answer\n domPath[3].children[1].children[0].value = decode(\n resPath.incorrect_answers[0]\n );\n domPath[3].children[1].children[1].value = decode(\n resPath.incorrect_answers[1]\n );\n domPath[3].children[1].children[2].value = decode(\n resPath.incorrect_answers[2]\n );\n }\n // *** Display Quiz Container, New Q Container Button, and Submit Button\n $(\"#quiz-cont\").removeClass(\"hide\");\n $(\"#btns\").removeClass(\"hide\");\n }", "function handleAddQuestion() {\n\n\n\n\n if (evaluateQuestion()) {\n\n\n let kof = document.querySelector('.kindofquestionType').value;\n let localStatment = statmentTxtArea.value;\n let localJustify;\n let hintText = questionHint.value;\n\n if (yesRdoBtn.checked) {\n localJustify = true;\n } else if (noRdoBtn.checked) {\n localJustify = false;\n }\n\n let valuesCounter = 0;\n let localOptions = [];\n vals = document.querySelectorAll('.values');\n var options = document.querySelectorAll('.option_content');\n\n options.forEach((val, i) => {\n\n\n\n let option = {\n statment: val.value,\n type: vals[i].value\n }\n\n valuesCounter++;\n localOptions.push(option);\n });\n\n\n\n let ref = database.ref('questions/').push();\n\n let activities = [];\n\n\n activitiesCheckBoxs.forEach((p) => {\n\n if (p.checked) {\n activities.push(p.value);\n }\n\n });\n\n let question = {\n id: ref.key,\n kindOfQuestion: kof,\n statment: localStatment,\n justify: localJustify,\n options: localOptions,\n activities,\n info: hintText,\n father: true\n\n }\n\n ref.set(question).then(\n () => {\n clearForm();\n }\n ).catch((error) => {\n console.log(error);\n });\n\n }\n\n}", "function validate(dataValidate) {\n let isCorrect = true,isCorrectAnswerCount = 0;\n //show error answer\n for (let i = 0; i < dataValidate.answer.length; i++) {\n let errorAnswerId = $(\"#\" + dataValidate.error_answer[i]);\n if(dataValidate.answer[i]!=undefined){\n if (dataValidate.answer[i].trim() == \"\") {\n errorAnswerId.attr(\"style\", \"display: block\");\n errorAnswerId.prev().removeClass(\"mb-3\");\n errorAnswerId.addClass('mb-3');\n isCorrect = false;\n } else {\n errorAnswerId.attr(\"style\", \"display: none\");\n errorAnswerId.removeClass('mb-3');\n errorAnswerId.prev().addClass('mb-3');\n isCorrectAnswerCount++;\n }\n }\n }\n if(isCorrectAnswerCount>=2){\n //Clear error\n for (let j = 0; j < dataValidate.answer.length; j++) {\n let errorAnswerId = $(\"#\" + dataValidate.error_answer[j]);\n errorAnswerId.attr(\"style\", \"display: none\");\n errorAnswerId.removeClass('mb-3');\n errorAnswerId.prev().addClass('mb-3');\n }\n isCorrect = true;\n }\n\n //show question error\n if (dataValidate.question.trim() === \"\") {\n $(\"#\" + dataValidate.error_question).attr(\"style\", \"display: block\");\n isCorrect = false;\n } else {\n $(\"#\" + dataValidate.error_question).attr(\"style\", \"display: none\");\n }\n\n //show error when no select true answer\n if (isCorrect) {\n let selectCount = 0;\n for (let i = 0; i < dataValidate.select.length; i++) {\n if (dataValidate.select[i] === true && dataValidate.answer[i].trim() !== \"\") {\n selectCount = selectCount + 1;\n }\n }\n if (selectCount < 1) {\n isCorrect = false;\n warningModal(mustCheckCorrectAnswer);\n }\n }\n return isCorrect;\n}", "function checkNewClassForm () {\n if ($(\"[name='new_class_absClassName']\").val() == '') {\n // Check for redundant name\n createAlert(\"Please enter a valid name for the new abstraction class.\", \"Error:\", 'danger', 2);\n $(\"[name='new_class_absClassName']\").focus()\n return;\n }\n if ($(\"[name='new_class_commandName']\").val() == '') {\n createAlert(\"Please enter a valid name for the first command in the new abstraction class.\", \"Error:\", 'danger', 2);\n $(\"[name='new_class_commandName']\").focus()\n return;\n }\n if ($(\"[name='new_class_commandType']\").val() == '') {\n createAlert(\"Please enter a valid expression for the type specifier of the first command of the new abstraction class.\", \"Error:\", 'danger', 2);\n $(\"[name='new_class_commandType']\").focus()\n return;\n }\n\n var commandArgs, commandArgsType;\n\n if($(\"[name='new_class_addArgList']\").is(\":checked\")) {\n if ($(\"[name='new_class_commandArgs']\").val() == '') {\n createAlert(\"Please enter a valid expression for the argument list of the first command.\", \"Error:\", 'danger', 2);\n $(\"[name='new_class_commandArgs']\").focus()\n return;\n } \n commandArgs = $(\"[name='new_class_commandArgs']\").val();\n if ($(\"[name='new_class_commandArgsType']\").val() == '') {\n createAlert(\"Please enter a valid expression for the type specifier of the argument list of the first command.\", \"Error:\", 'danger', 2);\n $(\"[name='new_class_commandArgsType']\").focus()\n return;\n } \n commandArgsType = $(\"[name='new_class_commandArgsType']\").val();\n }\n\n modalWrapper.className = \"\";\n // CLear form\n createNewAbstractionClass($(\"[name='new_class_absClassName']\").val(), $(\"[name='new_class_commandName']\").val(), $(\"[name='new_class_commandType']\").val(), commandArgs, commandArgsType);\n\n $(\"[name='new_class_absClassName']\").val('');\n $(\"[name='new_class_commandName']\").val('');\n $(\"[name='new_class_commandType']\").val('regEx');\n $(\"[name='new_class_commandArgs']\").val('');\n $(\"[name='new_class_commandArgsType']\").val('regEx');\n }", "function populateQuestion(question) {\n questionOutput.empty();\n questionOutput.text(question.question);\n}", "function build_edit_form(question_data) {\n $(\".edit_container\").append(\"<div class = 'heading'>Edit Question</div>\");\n $(\".edit_container\").append(\"<textarea class = 'major_edit' id = 'edit_concept'>\"+ question_data.concept +\"</textarea>\");\n $(\".edit_container\").append(\"<textarea class = 'major_edit' id = 'edit_question'>\" + question_data.question+ \"</textarea>\");\n\n //Build the container for the answers\n $(\".edit_container\").append(\"<div class = 'answers_edit_container'>\")\n for(var i = 0; i < 4; i++) {\n $(\".answers_edit_container\").append(\"<div class = 'possible_edit_answer' id = 'possible_edit_answer\"+i+\"'>\");\n \n // Build the check box, with a check if highlighted\n var check_box_html = \"<input type = 'checkbox' class = 'check_box' id = 'isCorrect\" + i +\"' \";\n if(question_data.answers[i].isCorrect) check_box_html += \"checked\";\n check_box_html += \">\";\n\n $(\"#possible_edit_answer\"+i).append(\"<textarea class = 'answers_edit' id = 'edit_answer\"+ i +\"'>\" + question_data.answers[i].content+ \"</textarea>\");\n $(\"#possible_edit_answer\"+i).append(check_box_html);\n $(\".answers_edit_container\").append(\"</div>\");\n }\n\n $(\".edit_container\").append(\"</div>\");\n\n $(\".edit_container\").append(\"<textarea class = 'major_edit' id = 'edit_explanation'>\" + question_data.explanation+ \"</textarea>\");\n $(\".edit_container\").append(\"<textarea class = 'major_edit' id = 'edit_hint'>\" + question_data.hint+ \"</textarea>\");\n\n //Super hacky way to add space to the bottom of the view\n $(\".edit_container\").append(\"<div class = 'buffer_space'></div>\");\n}", "function setQuestion(){\n\n $(\"#counter\").html((i+1) + \"/\" + numberOfQuestions);\n $(\"#question\").html(questionsJSON.movies[i].question);\n $(\".movie-img\").attr(\"src\", \"images/oppdrag1/\" + questionsJSON.movies[i].imgSrc);\n $(\".alt1\").val(questionsJSON.movies[i].alt1);\n $(\".alt2\").val(questionsJSON.movies[i].alt2);\n $(\".alt3\").val(questionsJSON.movies[i].alt3);\n $(\".alt4\").val(questionsJSON.movies[i].alt4);\n }", "onSubmit(state) {\n this.status = 'answered';\n var choice = this.opt.choices.where({ value: state.value })[0];\n this.answer = choice.short || choice.name;\n\n // Re-render prompt\n this.render();\n this.screen.done();\n this.done(state.value);\n }", "onSubmit(state) {\n this.status = 'answered';\n var choice = this.opt.choices.where({ value: state.value })[0];\n this.answer = choice.short || choice.name;\n\n // Re-render prompt\n this.render();\n this.screen.done();\n this.done(state.value);\n }", "function validateForm() {\r\n var YES_RADIO_VALUE = 0;\r\n var NO_RADIO_VALUE = 1;\r\n\r\n // check if all fences have been checked yes or no\r\n $(\"input[name^=fence_\").each(function() {\r\n fenceIsChecked = $(this).is(\"checked\"); // is the fence radio button checked?\r\n\r\n // fences are mandatory\r\n if (fenceIsChecked == false) {\r\n $(\"#form_field_error\").html(\"<p style='color:red'>Verður að svara Já eða Nei í öllum girðingum!</p>\");\r\n return false;\r\n }\r\n });\r\n\r\n // all evaluation questions have to be answered but only if all fences have been passed\r\n if(passesFences() == true) {\r\n\r\n var evaluationValue;\r\n $(\"input:hidden[name$='_hidden']\").each(function() {\r\n evaluationValue = $(this).attr(\"value\");\r\n if (evaluationValue == null || evaluationValue == \"\" || evaluationValue == \" \") {\r\n $(\"#form_field_error\").html(\"<p style='color:red'>Verður að svara öllum matsspurningum</p>\");\r\n return false;\r\n }\r\n });\r\n\r\n var review = document.forms[\"EvaluationPaper\"][\"review\"].value;\r\n\r\n // review is mandatory\r\n if (review == null || review == \"\" || review == \" \") {\r\n $(\"#form_field_error\").html(\"<p style='color:red'>Það þarf að skrifa texta í reit fyrir mat!</p>\");\r\n return false;\r\n }\r\n\r\n // propose_acceptance is mandatory\r\n var propose_acceptance = document.forms[\"EvaluationPaper\"][\"propose_acceptance\"].value;\r\n if (propose_acceptance == null || propose_acceptance == \"\" || propose_acceptance == \" \"){\r\n $(\"#form_field_error\").html(\"<p style='color:red'>Verður að svara hvort að mælt sé með að umsókn verði styrkt!</p>\");\r\n return false;\r\n }\r\n\r\n // proposal_discussion is mandatory\r\n var proposal_discussion = document.forms[\"EvaluationPaper\"][\"proposal_discussion\"].value;\r\n if (proposal_discussion == null || proposal_discussion == \"\" || proposal_discussion == \" \"){\r\n $(\"#form_field_error\").html(\"<p style='color:red'>Verður að svara hvort að matsmaður vilji að umsóknin verði rædd á matsfundi</p>\");\r\n return false;\r\n }\r\n }\r\n\r\n $(\"#form_field_error\").html(\" \");\r\n return true;\r\n }", "function incorrectAnswer(questionFeedback){\n questionFeedback.html(\"Incorrect! \");\n questionFeedback.addClass(\"incorrect\");\n questionFeedback.removeClass(\"correct\");\n }", "function resetErrors() {\n$('form input, form select').removeClass('inputTxtError');\n$('label.error').remove();\n\n$('.confirm').css(\"display\",\"hidden\");\n $(\".confirm\").css(\"visibility\", \"hidden\");\n\n}", "function processQuizzAnswer(){\n\t\t//console.log(\"scenarioController.processQuizzAnswer\");\n\t\t\n\t\tvar scenarioPlay=m_scenarioContext.getCurrentScenarioPlay();\n\t\t\n\t\t// Get the current MCQ to be processed\n\t\tvar mcq = scenarioPlay.getMCQ();\n\t\t\n\t\tvar userResponses = new Array();\n\t\tvar validResponses = new Array();\n\t\tvar validAnswer=true;\t\t\n\t\t\n\t\t// Determine it the answer was right\n\t\tfor (var i=0; i < mcq.answers.length; i++ ){\n\t\t\tvar userAnswer=document.getElementById(\"ValpoppMCQanswer\" + (i+1));\n\n\t\t\t// User answers\n\t\t\tif (userAnswer.checked){\n\t\t\t\tuserResponses[i]=true;\n\t\t\t}else{\n\t\t\t\tuserResponses[i]=false;\n\t\t\t}\n\t\t\t\n\t\t\t// Valid answers\n\t\t\tif (mcq.answers[i].valid){\n\t\t\t\tvalidResponses[i]=true;\n\t\t\t}else{\n\t\t\t\tvalidResponses[i]=false;\t\t\t\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\t// Determine if all the user answer is right\n\t\t\tif (userResponses[i]!=validResponses[i]){\n\t\t\t\tvalidAnswer=false;\n\t\t\t}\t\t\t\n\t\t}\n\t\t\n\t\tvar html=htmlBuilder.getMCQResults(mcq, userResponses, validResponses, validAnswer);\n\t\t\n\t\t// Set quiz state to ready because the user already answer the quiz\n\t\tscenarioPlay.setQuizReady(true);\n\t\t\n\t\t// Send to the model the user responses\n\t\tscenarioPlay.setQuizAnswers(userResponses);\n\t\t\n\t\tscenarioView.showQuizCorrections(html);\n\t}", "function changeQuestionType(val, i, prevVal) {\n var plus = i + 1;\n var plusDiv = document.getElementById(plus);\n\n if(val != prevVal) {\n for(var j = 0; j < plusDiv.childNodes.length; j++) {\n if(plusDiv.childNodes[j].className == prevVal) {\n plusDiv.childNodes[j].style.display = \"none\";\n }\n }\n\n if(val == \"mc\") {\n document.getElementsByClassName(\"mc\")[i].style.display = \"initial\";\n }\n else {\n // by removing it twice, it eliminates the checkbox then the text as array position updates\n plusDiv.childNodes[6].childNodes[3].remove(); plusDiv.childNodes[6].childNodes[3].remove();\n if(val == \"fr\") {\n document.getElementsByClassName(\"mc\")[i].style.display = \"none\";\n document.getElementById(plus).appendChild(createFreeResponse());\n }\n if(val == \"tf\") {\n document.getElementsByClassName(\"mc\")[i].style.display = \"none\";\n document.getElementById(plus).appendChild(createTrueFalse());\n }\n if(val == \"matching\") {\n document.getElementsByClassName(\"mc\")[i].style.display = \"none\";\n document.getElementById(plus).appendChild(createMatching());\n }\n }\n }\n}", "function createNewQuestion() {\n if(currentQuestion >= questions.length) {\n createSubmitPage();\n return;\n }\n\n previousState = currentState;\n currentState = appStates.Questioning;\n \n\n $(contEl).empty();\n\n let questionObj = questions[currentQuestion];\n let header = $(`<h1>${questionObj.textContent}</h1>`);\n let unList = $(\"<ul>\");\n\n $(questionObj.options).each(function(index, value){\n let btn = $(`<li><button type=\"button\" class=\"ques-option quizbtn\" data-ques-option=\"${value}\">${index + 1}. ${value}</button></li>`);\n $(unList).append(btn);\n });\n\n $(contEl).append(header, unList);\n\n if(previousState != appStates.Questioning)\n startTimer();\n//adds to score if correct subtracts if wrong \n//display correct or wrong \n $(\".ques-option\").on(\"click\", function(event){\n event.preventDefault();\n lastAnswer = $(this).attr(\"data-ques-option\");\n let isCorrect = lastAnswer === questionObj.answer;\n\n if (isCorrect)\n score += 30;\n else if (!isCorrect) {\n secondsElapsed += 10;\n }\n\n currentQuestion++;\n createNewQuestion();\n\n if (isCorrect)\n displayMessage(\"Correct\");\n else \n displayMessage(\"Wrong\");\n });\n\n function displayMessage(message) {\n let messageText = $(`<div class=\"fader\"><hr><h3>${message}</h3></div>`);\n $(\"#content\").append(messageText);\n }\n }", "function updateFeedbackForm(sessionId) {\n var modal = $(\"#session-detail\");\n var vote = votes[sessionId];\n\n modal.find(\"#vote-comment\").val((vote) ? vote.feedback : \"\");\n if (vote) {\n modal.find(\"#vote-rating\").barrating('set', vote.rating);\n } else {\n modal.find(\"#vote-rating\").barrating('clear');\n }\n\n Materialize.updateTextFields();\n }", "function renderQuestionView () {\n $('.variable-content-container, .instructions, .feedback, .final-view, .js-start-button, .js-next-button, .js-replay-button').addClass('js-hide');\n $('.score-question, .questions, .js-submit-button').removeClass(\"js-hide\");\n $('.questions').empty();\n updateQuestionNum();\n generateQuestion();\n}", "function templateQuestion(questionIndex) {\n // console.log(\"function templateQuestion\", questionIndex);\n updateQuestionAndScore();\n let questionForm = $(`\n <form class=\"form\"> \n <fieldset> \n <legend class=\"question\">${STORE[questionIndex].question}</legend>\n <ul></ul>\n </fieldset> \n </form>\n `)\n\n let formSection = $(questionForm).find('ul');\n\n STORE[questionIndex].answers.forEach(function (answerValue, answerIndex) {\n $(`<li>\n <label class=\"option\" for=\"${answerIndex}\">\n <input class=\"radio\" type=\"radio\" id=\"${answerIndex}\" value=\"${answerValue}\" name=\"answer\" required>\n <span>${answerValue}</span>\n </label>\n </li>`).appendTo(formSection);\n });\n $(`<div class=\"block-button\"><button type=\"submit\" class=\"submit\">Go</button></div>`).appendTo(formSection);\n $('.questions').append(questionForm);\n $('.questions').show();\n $('.result').hide();\n}", "function initialiseQuestion(nextQuestion) {\n var survey = new Survey.Model(nextQuestion);\n\n survey.checkErrorsMode = 'onComplete';\n survey.onUpdateQuestionCssClasses.add(addCustomClasses)\n survey.onAfterRenderQuestionInput.add(afterQuestionRender)\n\n $(`#surveyContainer${questionCount}`).Survey({ model: survey });\n $('.sv_complete_btn').remove();\n $('.sv_prev_btn').remove();\n $('.sv_next_btn').remove();\n $('.sv_preview_btn').remove();\n\n if(survey.textbox) {\n let surveyId = survey.renderedElement.id\n $(`#${surveyId} .sv_header`).after(`\n <div class='textbox'>\n <div class='wrapper'>\n <div class='header'>${survey.textbox.header}</div>\n <div class='body'>${survey.textbox.body}</div>\n </div>\n <div class='scrollbar-container'>\n <div class='scrollbar'></div>\n </div>\n </div>\n `)\n if($(`#${surveyId} .textbox`).height() < 200) {\n $(`#${surveyId} .textbox .scrollbar`).hide()\n }\n $(`#${surveyId} .textbox .wrapper`).scroll(function() { \n let scrollBarHeight = $(`#${surveyId} .textbox .scrollbar`).height()\n let scrollContainerHeight = $(`#${surveyId} .textbox`).height()\n let scrollPos = $(this).scrollTop()\n let scrollHeight = $(`#${surveyId} .textbox .wrapper`).prop('scrollHeight')-scrollContainerHeight\n let scrollPercent = scrollPos/scrollHeight\n let scrollBarPos = (scrollContainerHeight-scrollBarHeight)*scrollPercent\n $(`#${surveyId} .textbox .scrollbar`).css('transform' ,`translateY(${scrollBarPos}px)`)\n })\n }\n}", "function Question(text, choices, answer) { \n this.text=text;\n this.choices=choices;\n this.answer=answer;\n}", "function initializeQuiz () {\n resetScores();\n renderFieldsetForm('initialize', STORE);\n}", "createFormsFromJSON() {\n if(this.qajson) {\n let jsonarr = this.qajson;\n for(var i = 0; i < jsonarr.length; i++) {\n let qdata = jsonarr[i];\n let newform = this.createQuestionForm(qdata[\"question\"], qdata[\"answers\"], qdata[\"correct\"]);\n if(newform) this.questionWrapper.appendChild(newform);\n }\n }\n }", "function generateQuizResultsForm(item) {\n if (item.score == item.questions.length) {\n return `<p class=\"results\">Congratulations, you answered all the questions correctly!</p>`;\n } else if (item.score >= item.questions.length * 0.8 && item.score < item.questions.length) {\n return `<p class=\"results\">Nice job! You answered ${store.score} questions correctly! You should try again for a perfect score!</p>`;\n } else if (item.score < item.questions.length * 0.8) {\n return `<p class=\"results\">You answered ${store.score} questions correctly. You may want to ask your Barista Trainer if you have any questions.</p>`;\n }\n}", "set_errors(errors) {\n var _this = this;\n $.each(errors, function(key, value) {\n _this.modal.find('[name=\"' + key + '\"]').each(function(){\n // have to do this multiple times because of\n // radio buttons\n $(this).addClass('is-invalid');\n $(this).siblings('.invalid-feedback').text(value[0]);\n });\n });\n }", "function questionsValidate(questionsForm){\n\nvar validationVerified=true;\nvar errorMessage=\"\";\n\nif (questionsForm.name.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền câu hỏi!\\n\";\nvalidationVerified=false;\n}\nif (questionsForm.question.selectedIndex==0)\n{\nerrorMessage+=\"Bạn chưa chọn câu hỏi!\\n\";\nvalidationVerified=false;\n}\nif(!validationVerified)\n{\nalert(errorMessage);\n}\nreturn validationVerified;\n}", "function setQuestion(){\n \n\n $(\"#question-field\").empty();\n //Set question\n gameQuestion = questionBank.pop();\n\n //Display question\n displayQuestion(gameQuestion);\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 >= 5;\n this.$step.parentElement.hidden = this.currentStep >= 5;\n\n // TODO: get data from inputs and show them in summary\n var divs = form.querySelectorAll(\"div\");\n var categories = new Array();\n var bags = 0;\n var foundation = \"\";\n var street = \"\";\n var city = \"\";\n var zipCode = \"\";\n var pickDate = \"\";\n var pickTime = \"\";\n var pickComment = \"\";\n var phone = \"\";\n divs.forEach(d=>{\n if (d.dataset.step !== null) {\n if (d.dataset.step == 1) {\n var labels = d.querySelectorAll(\"label\")\n labels.forEach(l=>{\n var input = l.querySelector(\"input\")\n if(input.checked === true){\n categories.push(l.querySelector(\".description\").innerText);\n }\n })\n }\n\n if (d.dataset.step == 2) {\n var input = d.querySelector(\"input\");\n bags = input.value;\n }\n\n if (d.dataset.step == 3) {\n var labels = d.querySelectorAll(\"label\")\n labels.forEach(l=>{\n var input = l.querySelector(\"input\")\n if(input.checked === true){\n foundation = l.querySelector(\".title\")\n .innerText.replace('Fundacja', 'Dla fundacji:');\n }\n })\n }\n\n if (d.dataset.step == 4) {\n street = d.querySelector(\"#street\").value;\n city = d.querySelector(\"#city\").value;\n zipCode = d.querySelector(\"#zipCode\").value;\n // phone = d.querySelector(\"#phone\").value;\n pickDate = d.querySelector(\"#pickUpDate\").value;\n pickTime = d.querySelector(\"#pickUpTime\").value;\n pickComment = d.querySelector(\"#pickUpComment\").value;\n }\n\n if (d.dataset.step == 5) {\n var joinCategories = \"\";\n categories.forEach(c=>{\n joinCategories += c + \", \";\n })\n var bagSpan = d.querySelector(\".icon-bag\").nextElementSibling;\n bagSpan.innerHTML = bags + \" worki: \" + joinCategories.replace(/..$/,\".\");\n d.querySelector(\".icon-hand\").nextElementSibling.innerHTML = foundation;\n d.querySelector(\"#confirm-street\").innerHTML = street;\n d.querySelector(\"#confirm-city\").innerHTML = city;\n d.querySelector(\"#confirm-zipcode\").innerHTML = zipCode;\n d.querySelector(\"#confirm-phone\").innerHTML = \"phone n/a\";\n d.querySelector(\"#confirm-date\").innerHTML = pickDate;\n d.querySelector(\"#confirm-time\").innerHTML = pickTime;\n d.querySelector(\"#confirm-comments\").innerHTML = \"Uwagi: \" + pickComment;\n }\n }\n })\n }" ]
[ "0.6535848", "0.6398047", "0.6312606", "0.62959003", "0.62550265", "0.6219928", "0.6192129", "0.6094662", "0.6065104", "0.6041724", "0.600894", "0.59998304", "0.5971749", "0.5957085", "0.5917785", "0.590533", "0.5903665", "0.58990216", "0.58947426", "0.57842416", "0.5779262", "0.5778578", "0.5773866", "0.5773145", "0.5772526", "0.57707465", "0.57697386", "0.5768153", "0.5761126", "0.57593685", "0.5758965", "0.57482755", "0.57380766", "0.5733036", "0.5722709", "0.5719528", "0.57028973", "0.5698361", "0.56962574", "0.56929684", "0.56847036", "0.568316", "0.5681669", "0.5678488", "0.56540763", "0.5644828", "0.56448", "0.56285554", "0.5628381", "0.562652", "0.56260836", "0.5625878", "0.5623078", "0.5605995", "0.5602985", "0.55998397", "0.5593147", "0.55896187", "0.5574559", "0.5571503", "0.5568642", "0.5565522", "0.55506784", "0.5550482", "0.55484134", "0.5547384", "0.55473065", "0.5544369", "0.5542446", "0.55422205", "0.55408543", "0.5528431", "0.55283076", "0.55282825", "0.55265087", "0.552647", "0.552537", "0.5517527", "0.5510245", "0.5509538", "0.5507491", "0.5507491", "0.5501755", "0.54980975", "0.54885304", "0.54850096", "0.54838765", "0.5482347", "0.5482336", "0.5481777", "0.5480655", "0.54789245", "0.5475461", "0.54735374", "0.5472381", "0.54702276", "0.5470175", "0.54697853", "0.54690707", "0.54676855" ]
0.6516944
1
updates the counter for number of correct/incorrect answers
function updateCorrectIncorrect() { if ($('footer.footer').length) { $('footer.footer').html(`${numCorrect} correct / ${numIncorrect} incorrect`) } else { $('body').append( `<footer class="footer">${numCorrect} correct / ${numIncorrect} incorrect</footer>` ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_question_result(correct) {\n if (correct === true) {\n correct_answers++;\n document.getElementById(\"question_result\").innerText = \"Success!\"\n } else {\n document.getElementById(\"question_result\").innerText = \"Wrong!\"\n }\n}", "function scoreCount() {\n for (var i = 0; i < data.length; i++) {\n\n // If user selected an answer\n if (data[i].checked) {\n\n // check if what the user select is equal to the array answers\n\n if (answers.indexOf(data[i].value) !== -1) {\n correct++;\n } else {\n incorrect++;\n }\n }\n }\n //check how many questions were blank\n //subtracting the if/else values from above from TOTAL Q's\n \n var totalAnswered = correct + incorrect;\n console.log(totalAnswered);\n if (totalAnswered !== totalQuizQuestions) {\n unanswered = totalQuizQuestions - totalAnswered;\n }\n\n $('#correct').html(\" \" + correct);\n $('#incorrect').html(\" \" + incorrect);\n $(\"#unanswered\").html(\" \" + unanswered);\n }", "function scoreKeeper() {\n for (i = 0; i < storeAnswers.length; i++) {\n if (storeAnswers[i] === questionsArray[i].answer) {\n correct++;\n console.log(correct);\n } else {\n incorrect++;\n }\n }\n }", "function scoreCount() {\n for (var i = 0; i < userSelection.length; i++) {\n // If user selected an answer\n if (userSelection[i].checked) {\n // check if what the user select is equal to the array answers\n\n if (answers.indexOf(userSelection[i].value) !== -1) {\n correctAnswer++;\n } else {\n incorrectAnswer++;\n }\n }\n }\n //check how many questions were blank by subtracting the if/else values from above from the total number of questions.\n\n var totalAnswered = correctAnswer + incorrectAnswer;\n\n if (totalAnswered !== totalQuestions) {\n blank = totalQuestions - totalAnswered;\n }\n\n $(\"#correct\").html(\" \" + correctAnswer);\n $(\"#incorrect\").html(\" \" + incorrectAnswer);\n $(\"#blank\").html(\" \" + blank);\n } //end scoreCount", "function countResult () {\n\t\t//display how many questions the user ansswered\n\t\t$(\".question\").text(\"Total \" + allQuestions + \" questions\").append('<br>');\n\t\t//display wrong answer counter\n\t\t$(\".answers\").append(wrongCounter + \" wrong\").append('<br>');\n\t\t//display right answer counter\n\t\t$(\".answers\").append(rightCounter + \" right\").append('<br>');\n\t\t//display time out counter\n\t\t$(\".answers\").append(dontAnswerCounter + \" no answer\");\t\t\n\t}", "function incrementCorrectAnswers(currentScore) {\n let correctAttemptText = currentScore + \" Correct\";\n $('#correct_attempt').text(correctAttemptText);\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 answerIsCorrect() {\n let oldScore = parseInt(document.getElementById('correct').innerText);\n document.getElementById('correct').innerText = ++oldScore;\n}", "function scoreCount() {\n for (var i = 0; i < data.length; i++) {\n \n // If user selected an answer\n if (data[i].checked) {\n \n // check if what the user select is equal to the array answers\n \n if (answers.indexOf(data[i].value) !== -1) {\n correctAnswer++;\n } else {\n incorrectAnswer++;\n }\n }\n }\n\n //check how many questions were blank by subtracting the if/else values from above from the total number of questions.\n\n var totalAnswered = correctAnswer + incorrectAnswer;\n console.log(totalAnswered);\n if (totalAnswered !== totalQuiz) {\n blank = totalQuiz - totalAnswered;\n }\n\n $('#correct').html(\" \" + correctAnswer);\n $('#incorrect').html(\" \" + incorrectAnswer);\n $(\"#blank\").html(\" \" + blank);\n\n } //end scoreCount", "function calcScore(){\n\tfor (var i = 0; i < userPicks.length; i++) {\n\t\tif(userPicks[i] == \"correct\"){\n\t\t\tcounters.updateCorrect();\n\t\t}\n\t\telse{\n\t\t\tcounters.updateIncorrect();\n\t\t}\n\t};\n\n\tif (userPicks.length < 6) {\n\t\tcounters.unanswered = 6 - userPicks.length;\n\t}\n\n}", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function incrementUserScore() {\n score++;\n incrementCorrectAnswers(score);\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 updateGuessCounter() {\n $(\"#guess-counter\").html(getGuessesCount());\n }", "function testResults() {\n\t//store variables to update correct and incorrct totals\n\tvar correct = 0;\n\tvar incorrect = 0;\n\n//loop through questions array\nfor (var i = 0; i < questions.length; i++) {\n\n var answer = questions[i].answer;\n var guess = document.getElementById('answer' + [i].value);\n //store element to add a class if correct or incorrect\n var questionSpot = document.getElementById('question' + [i]);\n\n //check if the user answer matches the correct answer\n if(answer == guess) {\n \t//update class on questionsSpot\n \tquestionSpot.className = questionSpot.className + ' correct';\n \t//add one to correct\n \tcorrect++;\n } else {\n \t//update class on questionsSpot\n \tquestionSpot.className = questionSpot.className + ' incorrect';\n \t//add one to incorrect\n \tincorrect++;\n };\n };\n\n //update correct and incorrect values\n document.getElementById('correct').textContent = correct;\n document.getElementById('incorrect').textContent = incorrect;\n}", "function updateQuestionCounter() {\n\tquestionNumber++; \n\tquestionCounter.textContent = `Question ${questionNumber} of ${totalQuestion}`;\n}", "function resetCounters(){\n correct = 0;\n incorrect = 0;\n unanswered = 0;\n }", "function correctAnswer(){\n\t\tcorrect++;\n\t\talert(\"You are Right! Good job!\");\n\t}", "function totalCorrectAnswers() {\n alert('You answered ' + count + ' questions correctly');\n}", "function answerIsCorrect() {\n correctAnswerFeedback();\n nextQuestion();\n addToScore();\n}", "function updateCount(guess) {\n\t\tcount += 1;\n\t\t$('#count').text(count);\n }", "function userCorrectAnswerSubmitted(answer) {\n store.score++;\n $('.correct-updater').html('Correct!');\n}", "function count(){\n game.correct = 0;\n game.wrong = 0;\n game.unanswered = 0;\n // question 1\n if ($('input:radio[name=\"o1\"]:checked').val() === game.answers.a1) {\n game.correct++;\n console.log(\"this is correct! number:\")\n }\n else if($('input:radio[name=\"o1\"]:checked').val() === undefined){\n game.unanswered++;\n console.log(\"You put nothing...\");\n }\n else{\n game.wrong++;\n console.log(\"this is wrong! number:\");\n };\n\n // question 2\n if ($('input:radio[name=\"o2\"]:checked').val() === game.answers.a2 ) {\n game.correct++;\n console.log(\"this is correct! number:\")\n } \n else if($('input:radio[name=\"o2\"]:checked').val() === undefined){\n game.unanswered++;\n console.log(\"You put nothing...\");\n }\n else{\n game.wrong++;\n console.log(\"this is wrong! number:\");\n };\n\n // question 3\n if ($('input:radio[name=\"o3\"]:checked').val() === game.answers.a3 ) {\n game.correct++;\n console.log(\"this is correct! number:\")\n } \n else if($('input:radio[name=\"o3\"]:checked').val() === undefined){\n game.unanswered++;\n console.log(\"You put nothing...\");\n }\n else{\n game.wrong++;\n console.log(\"this is wrong! number:\");\n };\n \n // question 4\n if ($('input:radio[name=\"o4\"]:checked').val() === game.answers.a4 ) {\n game.correct++;\n console.log(\"this is correct! number:\")\n } \n else if($('input:radio[name=\"o4\"]:checked').val() === undefined){\n game.unanswered++;\n console.log(\"You put nothing...\");\n }\n else{\n game.wrong++;\n console.log(\"this is wrong! number:\");\n };\n }", "function scoreKeeper()\n {\n for (var i = 0; i < quizQuestions.length; i++)\n {\n var checked = $(\"input[name='options\"+i+1+\"']:checked\").val();\n if (checked === undefined)\n {\n noResponse++;\n }\n else if (checked == quizQuestions[i].correctChoice)\n {\n correctAnswerCount++;\n }\n else\n {\n wrongAnswerCount++;\n };\n };\n }", "function answerIsCorrect(){\r\n qscore++;\r\n score.innerHTML = \"<p>Score: \" + qscore + \"</p>\";\r\n}", "function incrementWrongAnswer() {\n\n let oldScore = parseInt(document.getElementById(\"incorrect\").innerText);\n document.getElementById(\"incorrect\").innerText = ++oldScore;\n}", "function testResults() {\n\t// store variables to update correct and incorrect totals\n\tvar correct = 0;\n\tvar incorrect = 0;\n\n\t// loop through questions array\n\tfor(var i = 0; i < questions.length; i++) {\n\t\t// store each correct answer\n\t\tvar answer = questions[i].answer;\n\t\t// store each user answer\n\t\tvar guess = document.getElementById('answer' + [i]).value;\n\t\t// store element to add a class if correct or incorrect\n\t\tvar questionSpot = document.getElementById('question' + [i]);\n\n\t\t// check if the user answer matches the correct answer\n\t\tif(answer == guess) {\n\t\t\t// update class on questionSpot\n\t\t\tquestionSpot.className = 'correct';\n\t\t\t// add one to correct\n\t\t\tcorrect++;\n\t\t} else {\n\t\t\t// update class on questionSpot\n\t\t\tquestionSpot.className = 'incorrect';\n\t\t\t// add one to incorrect\n\t\t\tincorrect++;\n\t\t};\n\t};\n\n\t// update correct and incorrect values\n\tdocument.getElementById('correct').textContent = correct;\n\tdocument.getElementById('incorrect').textContent = incorrect;\n}", "function checkAnswer(response) {\n if (response == question[counter].correctAnswer){\n feedback.innerText = \"Correct\";\n score++;\n } else {\n feedback.innerText = \"Incorrect\";\n decrementTimer (10);\n }\n questionPrep();\n}", "function checkAnswers() {\n\n\t\t$( '.button-question').on('click', function() {\n\t\t\tvar $this = $(this);\n\t\t\tconsole.log($this);\n\t\t\tvar val = $this.attr('value');\n\t\t\t// console.log(val);\n\n\t\t\tif (val === 'true'){\n\t\t\t\trightAnswer ++;\n\t\t\t\tconsole.log(rightAnswer);\n\t\t\t} else {\n\t\t\t\twrongAnswer ++;\n\t\t\t\tconsole.log(wrongAnswer);\n\t\t\t}\n\t\t\tnoAnswer = 5 - (rightAnswer + wrongAnswer);\n\t\t\t// console.log(\"unanswered\" + noAnswer);\n\t\t});\n\n\t}", "function correctAnswers() {\n let correct = parseInt(document.getElementById(\"correct\").innerText);\n document.getElementById(\"correct\").innerText = ++correct;\n\n\n // Prints a message to the user when they are finsh the quiz depending on the number of correct answer they got. \n\n\n if (correct >= 8) {\n document.getElementById(\"end-message\").innerHTML = `Congragulations YOUR A TRUE MARVEL FAN`;\n } else if (correct >= 6) {\n document.getElementById(\"end-message\").innerHTML = `WELL DONE YOUR NEARLY THERE TRY AGAIN`;\n } else if (correct >= 4) {\n document.getElementById(\"end-message\").innerHTML = `HMMMMM ARE YOU SURE YOUR A MARVEL FAN?`;\n } else if (correct >= 2) {\n document.getElementById(\"end-message\").innerHTML = `YOU NEED TO HIT THE COMICS AND FRESHEN UP`;\n }\n}", "function incorrectScore() {\n incorrect++;\n\n $('.incorrect').text(incorrect);\n}", "function checkAnswers() {\n if (userSelection == quizBank[questionCounter].correctAnswer) {\n score++;\n secondsLeft += 10;\n } else {\n secondsLeft -= 10;\n }\n questionCounter++;\n showQuestions();\n}", "function submitAnswers() {\n var correctAnswer1 = document.getElementById(\"1a\");\n if (correctAnswer1.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n\n var correctAnswer2 = document.getElementById(\"2c\");\n if (correctAnswer2.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n\n var correctAnswer3 = document.getElementById(\"3d\");\n if (correctAnswer3.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n\n var correctAnswer4 = document.getElementById(\"4c\");\n if (correctAnswer4.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n\n var correctAnswer5 = document.getElementById(\"5b\");\n if (correctAnswer5.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n\n var correctAnswer6 = document.getElementById(\"6d\");\n if (correctAnswer6.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n\n var correctAnswer7 = document.getElementById(\"7b\");\n if (correctAnswer7.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n var correctAnswer8 = document.getElementById(\"8c\");\n if (correctAnswer8.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n var correctAnswer9 = document.getElementById(\"9d\");\n if (correctAnswer9.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n var correctAnswer10 = document.getElementById(\"10d\");\n if (correctAnswer10.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n var correctAnswer11 = document.getElementById(\"11c\");\n if (correctAnswer11.checked === true) {\n correct++;\n console.log(\"Correct: \" + correct);\n } else {\n incorrect++;\n console.log(\"Incorrect: \" + incorrect);\n }\n\n //alert(\"Correct: \" + correct);\n //alert(\"Incorrect: \" + incorrect);\n //window.location.href = 'results.html';\n\n //Displays results\n $(\"#main-body\").html(\"<h3>\" + \"Correct: \" + correct + \"</h3>\" +\n \"<h3>\" + \"Incorrect: \" + incorrect + \"</h3>\" +\n \"<h3>\" + \"Percentage Correct: \" + Math.floor(correct / (correct + incorrect) * 100) + \"%\" + \"</h3>\");\n $(\"#main-body\").append(\"<br>\" + '<a id=\"start-over\" href=\"index.html\">Start Over</a>')\n\n }", "function displayScore() { \n var numCorrect = 0;\n for (var i = 0, length = selections.length; i < length; i++) {\n if (selections[i] == questions[i].correctAnswer) {\n numCorrect++;\n }\n }\n \n return numCorrect;\n}", "function result() {\n\t//stop counter\n\tclearInterval(counter);\n\n\t\t// question 1 checker\n if ($('input[name=question1]:checked').val() === \"las\") {\n \tcorrect++;\n } \n else {\n \tincorrect++\n }\n\n // question 2 checker\n if ($('input[name=question2]:checked').val() === \"southWest\") {\n \tcorrect++;\n } \n else {\n \tincorrect++\n }\n\n // question 3 checker\n if ($('input[name=question2]:checked').val() === \"unitedAirlines\") {\n \tcorrect++;\n } \n else {\n \tincorrect++\n }\n\n // question 4 checker\n if ($('input[name=question2]:checked').val() === \"alaskaAirlines\") {\n \tcorrect++;\n } \n else {\n \tincorrect++\n }\n\n // question 5 checker\n if ($('input[name=question2]:checked').val() === \"125k\") {\n \tcorrect++;\n } \n else {\n \tincorrect++\n }\n\n //clear the timer and questions\n $('#replace').empty();\n\n //creating p tag correct answers\n var correctAns = $('<p>');\n correctAns.append(\"Number of correct answers: \" + correct);\n\n // creating p tag for incorrect answers\n var incorrectAns = $('<p>');\n incorrectAns.append(\"Number of incorrect answers: \" + incorrect);\n\n correctAns = correctAns.append(incorrectAns)\n\n $('#replace').append(correctAns);\n}", "function correctAnswer() {\n correctAnswers++;\n $('.timeRemaining').text(\"YOU HAVE ANSWERED CORRECTLY!\").css({\n 'color': '#3D414F'\n });\n resetRound();\n}", "function correctResponse() {\n score += 1;\n questionNumber += 1;\n \n // Updates score\n scoreUpdate();\n \n // Checks if this is the final question and runs appropriate function\n if (questionNumber > questions.length) {\n isComplete();\n }\n}", "function checkAnswer () {\n console.log(userSelected.text);\n\n if (userSelected === questions[i].correctAnswer) {\n score ++;\n $(\"#score\").append(score);\n $(\"#answerCheck\").append(questions[i].rightReply);\n i++;\n } else {\n $(\"#answerCheck\").append(questions[i].wrongReply);\n i++;\n } \n }", "computeScore () {\n let rightCnt = 0;\n for (let i=0; i<this.state.answerArray.length; i++) {\n if(this.state.answerArray[i] === this.state.questionArray[i].answer) {\n rightCnt ++;\n }\n }\n return rightCnt;\n }", "handleQuestionAnswer(answer, correctAns) {\n if (answer === correctAns) {\n this.setState({\n numCorrect: ++this.state.numCorrect\n })\n }\n\n this.setState({\n numAnswered: ++this.state.numAnswered\n })\n }", "function correctAnswer(response,answer,correct){\n\t\t//add \"CORRECT\" div\t\t\n\t\tupdateScoreboard(response,answer,correct);\n\t\tscore++;\n\t\tquestionNumber++;\t\n\t\ttoggleLEDCorrect();\n\t\tshowScore();\n\t}", "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 keepingScore() {\n\n var userAnswer1 = $(\"input[name='answer1']:checked\").val();\n var userAnswer2 = $(\"input[name='answer2']:checked\").val();\n var userAnswer3 = $(\"input[name='answer3']:checked\").val();\n var userAnswer4 = $(\"input[name='answer4']:checked\").val();\n var userAnswer5 = $(\"input[name='answer5']:checked\").val();\n var userAnswer6 = $(\"input[name='answer6']:checked\").val();\n var userAnswer7 = $(\"input[name='answer7']:checked\").val();\n var userAnswer8 = $(\"input[name='answer8']:checked\").val();\n var userAnswer9 = $(\"input[name='answer9']:checked\").val();\n var userAnswer10 = $(\"input[name='answer10']:checked\").val();\n \n \n // Question 1\n if (userAnswer1 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer1 == questions[0].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 2\n if (userAnswer2 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer2 == questions[1].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 3\n if (userAnswer3 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer3 == questions[2].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 4\n if (userAnswer4 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer4 == questions[3].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 5\n if (userAnswer5 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer5 == questions[4].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 6\n if (userAnswer6 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer6 == questions[5].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 7\n if (userAnswer7 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer7 == questions[6].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 8\n if (userAnswer8 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer8 == questions[7].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 9\n if (userAnswer9 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer9 == questions[8].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 10\n if (userAnswer10 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer10 == questions[9].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n \n}", "function introvert() {\n introvertScore += 1;\n questionCount += 1;\n //alert(\"yoohoo introvert\");\n if (questionCount >= 4) {\n updateResult();\n }\n}", "function questionCounter() {\n if (counter < 4) {\n counter++;\n startTrivia();\n timer = 10;\n timeHolder();\n } else {\n finishTrivia();\n }\n }", "function counterCheck() {\r\n if (radioCount >= 5) {\r\n radioCount = 1;\r\n questionCount++;\r\n count++;\r\n } else {\r\n radioCount++;\r\n count++;\r\n }\r\n}", "function checkAnswer(answer) {\n var correctAnswer = questions[currentQuestionIndex].correct;\n console.log(correctAnswer);\n\n if (answer === correctAnswer) {\n score++;\n console.log(score)\n currentScore.textContent = score\n alert(\"This is correct! (+1 to score)\");\n currentQuestionIndex++;\n getQuestions();\n } else if (answer !== correctAnswer) {\n secondsLeft -= 10;\n alert(\"This is incorrect! (-10 seconds)\");\n currentQuestionIndex++;\n getQuestions();\n }\n}", "function checkAnswer() {\n\t\tif (answerChoice == currentQuestion.rightAnswer) {\n\t\t\t$(\"#hint\").text(currentQuestion.congratulations);\n\t\t\tcurrentQuestion.correct = true;\n\t\t\tupdateScore();\n\t\t} else {\n\t\t\tconsole.log('incorrect');\n\t\t\t$(\"#hint\").text(currentQuestion.sorry);\n\t\t};\n\t}", "function check(){\n if(trivia.questions.userGuess==trivia.questions.answer){\n \tcorrectAnswer++;\n }\n else if(trivia.questions.userGuess!=trivia.questions.answer){\n \tincorrectAnswer++;\n }\n if(trivia.questions2.userGuess==trivia.questions2.answer){\n \tcorrectAnswer++;\n }\n else if(trivia.questions2.userGuess!=trivia.questions2.answer){\n \tincorrectAnswer++;\n }\n\n if(trivia.questions3.userGuess==trivia.questions3.answer){\n \tcorrectAnswer++;\n }\n else if(trivia.questions3.userGuess!=trivia.questions3.answer){\n \tincorrectAnswer++;\n }\n\n if(trivia.questions4.userGuess==trivia.questions4.answer){\n \tcorrectAnswer++;\n }\n\n else if(trivia.questions4.userGuess!=trivia.questions4.answer){\n \tincorrectAnswer++;\n }\n\n if(trivia.questions5.userGuess==trivia.questions5.answer){\n \tcorrectAnswer++;\n }\n\n else if(trivia.questions5.userGuess!=trivia.questions5.answer){\n \tincorrectAnswer++;\n }\n\nCorrect();\nIncorrect();\n}", "function setScore() {\n let score = $('input:checked[value=correct]').length\n $('#score').text(score);\n }", "function answeredQuestions() {\n let oldScore = parseInt(document.getElementById(\"score\").innerText);\n document.getElementById(\"score\").innerText = ++oldScore;\n\n}", "function keepingScore() {\n\n var userAnswer1 = $(\"input[name='answer1']:checked\").val();\n var userAnswer2 = $(\"input[name='answer2']:checked\").val();\n var userAnswer3 = $(\"input[name='answer3']:checked\").val();\n var userAnswer4 = $(\"input[name='answer4']:checked\").val();\n var userAnswer5 = $(\"input[name='answer5']:checked\").val();\n var userAnswer6 = $(\"input[name='answer6']:checked\").val();\n var userAnswer7 = $(\"input[name='answer7']:checked\").val();\n\n // Q1\n if (userAnswer1 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer1 == questions[0].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q2\n if (userAnswer2 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer2 == questions[1].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q3\n if (userAnswer3 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer3 == questions[2].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q4\n if (userAnswer4 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer4 == questions[3].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q5\n if (userAnswer5 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer5 == questions[4].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q6\n if (userAnswer6 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer6 == questions[5].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q7\n if (userAnswer7 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer7 == questions[6].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n } \n\n}", "function check(){\n\tvar question1 = document.quiz.question1.value;\n\tvar question2 = document.quiz.question2.value;\n\tvar question3 = document.quiz.question3.value;\n\tvar question4 = document.quiz.question4.value;\n\tvar question5 = document.quiz.question5.value;\n\tvar question6 = document.quiz.question6.value;\n\tvar question7 = document.quiz.question7.value;\n\tvar question8 = document.quiz.question8.value;\n\tvar question9 = document.quiz.question9.value;\n\tvar correct = 0;\n\n\tif (question1 == \"Finland\") {\n\t\tcorrect++;\n\t}\n\tif (question2 == \"New York\") {\n\t\tcorrect++;\n\t}\n\tif (question3 == \"Bush Senior\") {\n\t\tcorrect++;\n\t}\n\tif (question4 == \"China\") {\n\t\tcorrect++;\n\t}\n\tif (question5 == \"Yahoo\") {\n\t\tcorrect++;\n\t}\n\tif (question6 == \"David Beckham\") {\n\t\tcorrect++;\n\t}\n\tif (question7 == \"Kyoto Protocol\") {\n\t\tcorrect++;\n\t}\n\tif (question8 == \"Fossiliized dinosaur heart\") {\n\t\tcorrect++;\n\t}\n\tif (question9 == \"His heart\") {\n\t\tcorrect++;\n\t}\n\n\tdocument.getElementById(\"after_submit\").style.visibility = \"visible\";\n\tdocument.getElementById(\"number_correct\").innerHTML = \"You got \" + correct + \" correct.\";\n}", "function checkAnswer(answer){\r\n if( answer === questions[currentQuestion].correct){ \r\n document.getElementById(\"choiceResult\").textContent = \"Correct\";\r\n score++;\r\n }else{\r\n count -= 10;\r\n document.getElementById(\"choiceResult\").innerHTML = \"Incorrect\";\r\n }\r\n\r\n if(currentQuestion < lastQuestion){\r\n currentQuestion++;\r\n askQuestion();\r\n }else{ \r\n scoreRender();\r\n clearInterval(timer);\r\n }\r\n}", "function incorrectAnswer() {\n incorrectAnswers++; \n $('.timeRemaining').text('YOU HAVE ANSWERED INCORRECTLY!').css({\n 'color': '#3D414F'\n });\n resetRound();\n }", "function updateStats(){\r\n $(\" #correct-counter \").text(roundStats.correct);\r\n $(\" #incorrect-counter \").text(roundStats.incorrect);\r\n \r\n }", "function userCorrect(){\n correctAnswer++;\n console.log(correctGuess);\n $(\".timer\").hide();\n $(\".question\").empty();\n $(\".answers\").empty();\n $(\".results\").append(\"<p class='answer-message'>That's correct!</p> + trivia[questionCount].gif\");\n setTimeout(nextQuestion, 1000 * 4);\n }", "function again() {\n result.innerHTML = \"Your result is ...\";\n questionCount = 0;\n athenaScore = 0;\n dionysusScore = 0;\n zeusScore = 0;\n aphroditeScore = 0;\n}", "function process_answer_submission(){\n answer = given_answer();\n correct = is_correct_answer(answer,question_on_screen);\n update_question_result(correct);\n counter++;\n}", "function checkAnswer() {\n if (userAnswer === currentQuestion.correctAnswer) {\n // add to the number of correct answers\n points++;\n\n // color the answers green\n answerContainers[questionNumber].style.color = \"darkgreen\";\n }\n // if answer is wrong or blank\n else {\n // color the answers red\n answerContainers[questionNumber].style.color = \"red\";\n }\n }", "function checkAnswer() {\n\n // get length of radio buttons form - changes dependent on quiz difficulty\n let numOfRadios = document.getElementById(\"mc-form-right\").length;\n\n // get scores\n let oldCorrectTally = parseInt((document.getElementById(\"correct-tally-num\").innerText));\n let oldIncorrectTally = parseInt((document.getElementById(\"incorrect-tally-num\").innerText));\n\n let pickedAnswer;\n\n // Check status of radio buttons\n for (i = 0; i < numOfRadios; i++) {\n\n // if a radio button is picked\n if (document.getElementsByTagName(\"input\")[i].checked) {\n\n // get the user's answer\n pickedAnswer = document.getElementsByTagName(\"label\")[i].innerText;\n\n // if user answer is correct, increment correct tally - if not, increment incorrect tally\n if (pickedAnswer === mcQuestion) {\n document.getElementById(\"correct-tally-num\").innerText = ++oldCorrectTally;\n } else {\n document.getElementById(\"incorrect-tally-num\").innerText = ++oldIncorrectTally;\n }\n\n // increment progress tally, remove old question and answers, and regenerate question\n questionsAnswered++;\n document.getElementsByTagName(\"h1\")[0].remove();\n document.getElementById(\"mc-form-left\").remove();\n document.getElementById(\"mc-form-right\").remove();\n document.getElementsByTagName(\"p\")[1].remove();\n generateQuestion();\n break;\n\n } else {\n if (i === numOfRadios - 1) {\n chooseAnswerPopUp();\n }\n continue;\n }\n }\n\n // add user answer to array for feedback later\n userAnswers.push(pickedAnswer);\n\n // get score\n finalCorrect = parseInt((document.getElementById(\"correct-tally-num\").innerText));\n\n // end game if questions answered = game length\n if (questionsAnswered === parseInt(gameLength)) {\n showAnswers();\n }\n}", "function checkAnswer() {\n $(\".option-button\").click(function() {\n value = $(this).attr(\"correct\");\n if (value === \"true\") {\n correctAnswers++\n $(\"#correct-number-element\").text(\"Correct: \" + correctAnswers);\n } else {\n incorrectAnswers++\n $(\"#correct-number-element\").text(\"Correct: \" + incorrectAnswers);\n }\n });\n}", "function checkResult(){\n\tvar val = \"\";\n\tvar ans = \"\";\n\n\tfor(var i = 0; i < quizList.length; i++){\n\n\t\t//Get the value of checked button and compare it with answer of the question. Update the counters accordingly.\n\t\tval = $(\"input[name='\" + quizList[i].name + \"']:checked\").attr(\"value\");\n\t\tans = quizList[i].answer;\n\n\t\tif(val === ans)\n\t\t\tcorrectCount++;\n\t\telse if (val === undefined)\n\t\t\tunAnsweredCount++;\n\t\telse\n\t\t\tinCorrectCount++;\n\t}\n\n\tdisplayResult(correctCount,inCorrectCount,unAnsweredCount);\n}", "function count() {\n if (timeRemaining > 0) {\n timeRemaining--;\n $(\"#time-display\").text(\"Time Remaining: \" + timeRemaining + \" Seconds\");\n } else {\n unansweredNumber++;\n questionsCompleted++;\n clearInterval(intervalId);\n clearScreen();\n timesUpPrint();\n nextQuestion();\n }\n }", "function rewriteCounts() {\n $(\"#mistakes\").text(\"Mistakes: \" + wrongCount);\n $(\"#remaining\").text(\"Remaining: \" + (tries - wrongCount));\n}", "function calcWrongAnswers(){\n showVariables();\n $(\"#wrongAns\").html(\"Number of wrong answers : \"+wrongAnswers);\n\n }", "function count() {\r\n\r\n \ttargetCount++\r\n \tscoreBox.text(targetCount);\r\n }", "function questionHandler() {\n clearInterval(interval);\n questionChecker();\n console.log(unansweredQuestions)\n console.log(correctAnswers)\n console.log(incorrectAnswers)\n \n if (gameStart === false) {\n return false;\n }\n \n let answerIndex = parseInt($(this).attr(\"value\"));\n \n \n if (answerIndex === triviaQuestions[theQuestion].theAnswer) {\n \n correctAnswers++;\n cutePopUp();\n \n } else {\n \n incorrectAnswers++; \n uglyPopUp();\n \n }\n }", "function checkAnswer() {\r\n STORE.view = 'feedback';\r\n let userSelectedAnswer = STORE.userAnswer;\r\n let correctAnswer = STORE.questions[STORE.questionNumber].correctAnswer;\r\n console.log('Checking answer...');\r\n if (userSelectedAnswer == correctAnswer) {\r\n STORE.score++;\r\n STORE.correctAnswer = true;\r\n }\r\n else {\r\n STORE.correctAnswer = false;\r\n }\r\n}", "function showResults(answer) {\n if (answer === questions[questionIndex].answer) {\n resultsEl.textContent = \"Correct!\";\n count++;\n } else {\n resultsEl.textContent = \"Incorrect!\";\n time = time - 5;\n timerEl.textContent = time;\n }\n setTimeout(nextQuestion, 1000);\n}", "function gryffindor() {\n gryffindorScore += 1;\n questionCount += 1;\n if (questionCount >= 3) {\n updateResult();\n }\n}", "function correct() {\n score +=20\n nextQuestion();\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 isCorrect(){\n score++;\n setScore();\n}", "function results(){\n gameStart=false;\n correct=0;\n //checking if selected answer is correct\n var yes1=$(\"input#qb\").prop(\"checked\");\n var yes2=$(\"input#qf\").prop(\"checked\");\n var yes3=$(\"input#qg\").prop(\"checked\");\n //increase correct total with correct answer\n if(yes1===true){\n correct++;\n }\n if(yes2===true){\n correct++;\n }\n if(yes3===true){\n correct++;\n }\n if (correct===3){\n $(\"#timeRemain\").html(\"<h1>Right. Off you go.</h1>\");\n }\n else{\n $(\"#timeRemain\").html(\"<h1>Auuuuuuuugh!</h1>\"+\"YOU ONlY GOT \"+correct+\" CORRECT!\");\n }\n correct=0;\n clearTimeout(timerEnd);\n clearInterval(timerCount);\n $(\"#start\").prop(\"disabled\",false);\n }", "function checkAnswers() {\n var correctAnswer = 0;\n var incorrectAnswer = 0;\n var noAnswer = 0;\n var arr = $(\".triviaQuestions\");\n for (var i = 0; i < arr.length; i++) {\n var questionDiv = $(arr[i]);\n var answer = questionDiv.find(\"input\").filter(\":checked\");\n if (answer.length != 1) {\n noAnswer++;\n }\n else {\n var isCorrect = $(answer[0]).data(\"answer\");\n if (isCorrect === true) {\n correctAnswer++;\n }\n else {\n incorrectAnswer++;\n }\n }\n }\n\n //print answer scores\n $(\"#correctAnswers\").text(correctAnswer);\n $(\"#incorrectAnswers\").text(incorrectAnswer);\n $(\"#noAnswers\").text(noAnswer);\n\n //hide start, questions, and timer on final score screen\n $(\"#start\").hide();\n $(\"#questions\").hide();\n $(\"#trackTime\").hide();\n\n //show score on final screen\n $(\"#score\").show();\n}", "function checkAnswer() {\n console.log(this.value);\n\n if (this.value !== questions[index].correct) {\n console.log(\"incorrect\");\n console.log(secondsLeft)\n secondsLeft -= 10;\n count.textContent = secondsLeft;\n\n if (secondsLeft <= 0) {\n endGame();\n }\n } else {\n score.textContent++;\n console.log(score);\n }\n\n index++;\n\n if (index === questions.length) {\n endGame();\n } else {\n buildQuestionCard();\n }\n}", "function correct() {\n event.stopPropagation()\n $ (\".list\").hide();\n $ (\".question\").hide();\n $ (\".winOrLose\").html(\"You are correct!\");\n \n correctlyAnswered++;\n console.log(correctlyAnswered);\n notAnswered--;\n console.log(notAnswered);\n \n window.setTimeout(askQuestions, 3000);\n \n}", "function checkAnswer(answer) {\r\n if (answer == questions[runningQuestion].correct) {\r\n // answer is correct\r\n score++;\r\n // change progress color to green\r\n answerIsCorrect();\r\n } else {\r\n // answer is wrong\r\n // change progress color to red\r\n answerIsWrong();\r\n }\r\n count = 0;\r\n if (runningQuestion < lastQuestion) {\r\n runningQuestion++;\r\n renderQuestion();\r\n } else {\r\n // end the quiz and show the score\r\n clearInterval(TIMER);\r\n scoreRender();\r\n }\r\n}", "function questionCounter() {\n if(STORE.currentQuestion <= 4) {\n renderQuiz(STORE.currentQuestion);\n console.log(\"We just passed \" + STORE.currentQuestion + \"to renderQuiz\")\n STORE.currentQuestion++;\n } else {\n showResultsAndRetake();\n }\n\n}", "function correctAnswer() {\n\tclearInterval(intervalId);\n\tresultOfTrivia();\n\t$(\".answer1\").html(\"Correct!\");\n \tquestion++;\n \tcorrect++;\n\tsetTimeout(countdown, 1000 * 5);\n\tsetTimeout(gameOfTrivia, 1000 * 5);\n\tsetTimeout(hoverHighlight, 1000 * 5);\n\ttime = 31;\n}", "function theSelection(){\n \n theSelectionScore +=1;\n //so every time this function is used, it increases the counter by 1\nquestionCount +=1;\n alert(\"The Selection Score went up!\");\n \n //how do we know when to end the quiz and show results? thats what the questionCount variable is for!\n \n if (questionCount >=3){\n \n updateResult();\n \n}\n \n}", "function correct() {\n score += 20;\n next();\n }", "function checkAnswer(answer){\r\n correct = myQuestions[questionIndex].correctAnswer;\r\n\r\n //on correct answer for question that is not final question, takes user to next question\r\n if (answer === correct && questionIndex !== finalQuestion){\r\n score++;\r\n questionIndex++;\r\n displayQuestion();\r\n \r\n // on incorrect answer that is not final question, removes 5 seconds from timer \r\n }else if (answer !== correct && questionIndex !== finalQuestion){\r\n questionIndex++;\r\n displayQuestion();\r\n timeLeft -=5; // takes 5 seconds off of timer for incorrect answer\r\n \r\n // after last question, displays the user's score\r\n }else{\r\n displayScore();\r\n }\r\n}", "scoreQuiz() {\n let numRight = 0; // Number of questions answered correctly\n //Loop through 1-10 and compare user answers with answer key\n for (let i = 1; i <= 10; i++) {\n if (this.state.userAnswers[i] === this.state.answers[i]) {\n numRight += 1;\n }\n }\n const score = numRight * 10; // Score is out of 100\n //Update state\n this.setState({ score: score });\n //Run score posting\n this.postScore(score);\n }", "function checkAnswers (){\n \n // variables needed to hold results\n var correct = 0;\n var incorrect = 0;\n var unAnswered =0\n \n // for loop iterates through each question and passes the questions at each index first into\n // the isCorrect function to see if they match the indices of correct answers, and if they do,\n // increments up the correct score\n for (var i = 0; i<questions.length; i++) {\n if (isCorrect(questions[i])) {\n correct++;\n } else {\n // then this statement runs the questions at each index through the checkAnswered function\n // to determine whether the user clicked an answer, or did not click an answer, so that\n // incorrect and unAnswered scores can be delineated from each other\n if (checkAnswered(questions[i])) {\n incorrect++;\n } else {\n unAnswered++;\n }\n }\n \n }\n // display the results of the function in the results div and use strings of text to relate the\n // results of the for loop with their corresponding values\n $('#results').html('correct: '+correct+ \"<br>\" +'incorrect: '+incorrect+ \"<br>\" +'unanswered: '+unAnswered);\n }", "function answeredCorrectly() {\n $(\"#quiz-area\").html(\"<p class='correct'>Correct!!</p>\");\n correctGuesses++;\n var correctAnswer = questions[questionCounter].correctAnswer;\n $(\"#quiz-area\").append(\"<p>The answer was <span class='answer'><strong>\" + correctAnswer + \"</strong></span></p>\" +\n questions[questionCounter].image);\n setTimeout(nextQuestion, 3000);\n questionCounter++;\n }", "function scoreKeep(){\n var userAnswer1 = $(\"input[name='answer1']:checked\").val();\n var userAnswer2 = $(\"input[name='answer2']:checked\").val();\n var userAnswer3 = $(\"input[name='answer3']:checked\").val();\n var userAnswer4 = $(\"input[name='answer4']:checked\").val();\n var userAnswer5 = $(\"input[name='answer5']:checked\").val();\n var userAnswer6 = $(\"input[name='answer6']:checked\").val();\n var userAnswer7 = $(\"input[name='answer7']:checked\").val();\n\n //now keep score for all questions and answers\n if (userAnswer1 === undefined) {\n\n unanswered++;\n } else if (userAnswer1 == questions[0].answer) {\n\n correctAnswers++;\n } else {\n\n incorrectAnswers++;\n }\n if(userAnswer2 === undefined) {\n unanswered++;\n } else if (userAnswer2 == questions[1].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer3 === undefined) {\n unanswered++;\n } else if (userAnswer3 == questions[2].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer4 === undefined) {\n unanswered++;\n } else if (userAnswer4 == questions[3].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer5 === undefined) {\n unanswered++;\n } else if (userAnswer5 == questions[4].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer6 === undefined) {\n unanswered++;\n } else if (userAnswer6 == questions[5].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer7 === undefined) {\n unanswered++;\n } else if (userAnswer7 == questions[6].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n}", "function wrongAnswer(){\n\t\twrong++;\n\t\talert(\"That is not correct.\");\n\t}", "function updateAnswer(e) {\n var answer = $(\"input[type='radio']:checked\").val();\n if (answer == questions[currentQuestion].correct) {\n numberCorrect++; \n } else if (answer == null) {\n \talert('Please choose an option!');\n e.preventDefault();\n }\n }", "function calcScore(givenAnswers, correctAnswers) {\r\n givenAnswers.forEach((answer, i) => {\r\n if (answer === correctAnswers[i]) {\r\n score++;\r\n }\r\n });\r\n}", "function checkAnswer(answer){\n\n if( answer == questions[runningQuestion].correct){\n score ++;\n // for correct\n answerIsCorrect();\n }else{\n // if the answer is wrong,it's need to change the color in red\n answerIsWrong();\n }\n count = 0;\n if(runningQuestion < lastQuestion){\n runningQuestion++;\n renderQuestion();\n \n }else{\n // end the quiz and show the score\n clearInterval(TIMER);\n scoreRender();\n \n }\n}", "function addLoss() {\n\ttotalIncorrect++;\n\t$(\"#display\").html(\"<h3>Wrong! The correct answer is: <h3 class='green'>\"+ questionList[questionNumber].correctAnswer + \"</h3></h3>\");\n\tsetTimeout(nextQuestion, 3000);\n\n\t//test\n\tconsole.log(\"Incorrect: \" + totalIncorrect);\n}", "function addToScore () {\n score += questionInfo[correspondingQuestion].points\n document.querySelector('#score').innerHTML = `Score: ${score}`\n numberOfCorrectAnswers++\n}", "function result() {\r\n var score = 0;\r\n if (document.getElementById('correct1').checked) {\r\n score++;\r\n }\r\n if (document.getElementById('correct2').checked) {\r\n score++;\r\n }\r\n if (document.getElementById('correct3').checked) {\r\n score++;\r\n }\r\n alert(\"your score is: \"+score)\r\n}", "function UpdateProgressResponseCorrect(array){\n var count = 0;\n for (i = 0; i < array.length; i++){\n if(array[i] === \"Correct\"){\n count++;\n }\n }\n return count;\n}", "function run() {\n if (count <= 2) {\n var ans = document.getElementById(\"ans\").value;\n\n if (questionsArray[random].correct === ans) {\n document.getElementById(\"res\").innerHTML =\n \"<h4>Your answer is \" +\n \"'\" +\n ans +\n \"'\" +\n \"<br />Correct answer</h4>\";\n\n count += 1; //Increasing the value of count by one because we received a correct answer.\n noOfQuestions += 1; //incresing the no of questions by one.\n\n document.getElementById(\"score\").innerHTML =\n \"<h4>Score: \" + count + \"</h4>\"; //displaying the score on the screen.\n document.getElementById(\"ans\").value = \"\";\n\n document.getElementById(\"question\").innerHTML +=\n \"<h3 id=\" + \"correct\" + \">Correct</h3>\";\n } else {\n document.getElementById(\"res\").innerHTML = \"<h4>Wrong Answer.</h4>\";\n\n // document.getElementById(\"ansTextbox\").textContent = \"\";\n\n // document.getElementById(\"answeButton\").textContent = \"\";\n\n document.getElementById(\"score\").innerHTML =\n \"<h4>Score: \" + count + \"</h4>\";\n\n noOfQuestions += 1; //incresing the no of questions by one.\n\n document.getElementById(\"ans\").value = \"\"; //clearing the answer box\n\n document.getElementById(\"question\").innerHTML +=\n \"<h3 id=\" + \"wrong\" + \">Wrong</h3>\";\n\n // play = 1;\n }\n\n if (noOfQuestions == 3) {\n play = 1;\n }\n\n if (play != 1) {\n takeQuiz();\n }\n\n if (noOfQuestions == 3) {\n document.getElementById(\"answeButton\").innerHTML = \"\";\n document.getElementById(\"newGameArea\").innerHTML =\n \"<p>You have completed all the questions in this category!! Congratulations</p>\";\n document.getElementById(\"ansTextbox\").textContent = \"\";\n }\n }\n}", "function timeUp(){\n\n\n\t\t// Which radio buttons are checked \n\t\tvar Q1 = $('#questionForm input:radio[name=\"q1\"]:checked').val();\n\t\tvar Q2 = $('#questionForm input:radio[name=\"q2\"]:checked').val();\n\t\tvar Q3 = $('#questionForm input:radio[name=\"q3\"]:checked').val();\n\t\tvar Q4 = $('#questionForm input:radio[name=\"q4\"]:checked').val();\n\t\tvar Q5 = $('#questionForm input:radio[name=\"q5\"]:checked').val();\n\t\tvar Q6 = $('#questionForm input:radio[name=\"q6\"]:checked').val();\n\n console.log(\n 'Q1', Q1,\n '\\nQ2', Q2,\n '\\nQ3', Q3,\n '\\nQ4', Q4,\n '\\nQ5', Q5,\n '\\nQ6', Q6\n );\n\t\t// right/wrong answers determined here\n\t\tif(Q1 == undefined){\n console.log(\"Q1 == undefined\")\n unansweredCount++;\n\t\t}\n\t\telse if(Q1 == \"Greenland\"){\n console.log('Q1 == \"Greenland\"')\n\t\t\tcorrectCount++;\n\t\t}\n\t\telse{\n console.log(\"else\")\n\t\t\twrongCount++;\n\t\t}\n\n\n\t\tif(Q2 == undefined){\n\t\t\tunansweredCount++;\n\t\t}\n\t\telse if(Q2 == \"8,000\"){\n\t\t\tcorrectCount++;\n\t\t}\n\t\telse{\n\t\t\twrongCount++;\n\t\t}\n\n\n\t\tif(Q3 == undefined){\n\t\t\tunansweredCount++;\n\t\t}\n\t\telse if(Q3 == \"Casablanca\"){\n\t\t\tcorrectCount++;\n\t\t}\n\t\telse{\n\t\t\twrongCount++;\n\t\t}\n\n\n\t\tif(Q4 == undefined){\n\t\t\tunansweredCount++;\n\t\t}\n\t\telse if(Q4 == \"Mona Lisa\"){\n\t\t\tcorrectCount++;\n\t\t}\n\t\telse{\n\t\t\twrongCount++;\n\t\t}\n\n\n\t\tif(Q5 == undefined){\n\t\t\tunansweredCount++;\n\t\t}\n\t\telse if(Q5 == \"1989\"){\n\t\t\tcorrectCount++;\n\t\t}\n\t\telse{\n\t\t\twrongCount++;\n\t\t}\n\n\n\t\tif(Q6 == undefined){\n\t\t\tunansweredCount++;\n\t\t}\n\t\telse if(Q6 == \"50 inches\"){\n\t\t\tcorrectCount++;\n\t\t}\n\t\telse{\n\t\t\twrongCount++;\n\t\t}\n\n\n\t\t// show score results\n\t\t$('#correct_answers').html(correctCount);\n\t\t$('#wrong_answers').html(wrongCount);\n\t\t$('#unanswered').html(unansweredCount);\n\n\n\t\t// Show the end game scores\n\t\t$(\"#end-container\").show();\n\n\n\t}", "function checkAnswer(event){\n if(event.target.id === answers[answerIndex]){\n updatedScore += 10;\n userScore.innerText = \"Score \" + updatedScore;\n feedback.innerHTML = \"Correct! 👍\";\n }\n else{\n timeLeft -= 10;\n feedback.innerHTML = \"Wrong 👎\";\n } \n questionIndex++;\n answerIndex++;\n \n proposedQuestion.innerText = questions[questionIndex].q;\n btn1.innerText = questions[questionIndex].a[0].text;\n btn2.innerText = questions[questionIndex].a[1].text;\n btn3.innerText = questions[questionIndex].a[2].text;\n btn4.innerText = questions[questionIndex].a[3].text; \n if(questionIndex === 5 || answerIndex === 5){\n questionIndex === 0;\n }\n}", "function checkAnswer(answer){\r\n if( answer == questions[runningQuestion].correct){\r\n \r\n answerIsCorrect();\r\n \r\n }else{\r\n \tanswerIsWrong();\r\n }\r\n count = 10;\r\n if(runningQuestion < lastQuestion){\r\n runningQuestion++;\r\n renderQuestion();\r\n // Als ie niet meer naar de volgende index kan springen, dan wordt de timer gestopt en het eindscherm aangeroepen\r\n }else{\r\n // end the quiz and show the score\r\n clearInterval(TIMER);\r\n endScoreRender();\r\n }\r\n}", "function checkAnswer(q_idx) {\n var correctAnswer = document.getElementById(correctAnswerArray[q_idx]);\n if (correctAnswer.checked === true) {\n correctTotal++;\n }\n // Input means input tags only aka the radio buttons\n // name= means the radio button name (q1, q2..)\n // :checked limits to the checked radio buttons\n // .length is the total number of buttons checked within the name group\n // ($'input[name=q1]:checked').length > 0)\n else if ($('input[name=q' + (q_idx + 1) + ']:checked').length > 0) {\n incorrectTotal++;\n }\n else {\n unanswerdTotal++;\n }\n }" ]
[ "0.7561109", "0.7514391", "0.74315643", "0.7414531", "0.73319864", "0.7325884", "0.72810787", "0.72481173", "0.72317797", "0.7213517", "0.720348", "0.7201827", "0.7192578", "0.7182521", "0.71707326", "0.7142154", "0.7116305", "0.71128964", "0.709268", "0.70350134", "0.7032912", "0.7023596", "0.7001221", "0.699529", "0.69564396", "0.6949791", "0.69414425", "0.6921212", "0.69182336", "0.68989116", "0.6889744", "0.68834585", "0.68793803", "0.6856713", "0.6834916", "0.68275905", "0.68275064", "0.6826205", "0.6816233", "0.68136466", "0.6804698", "0.6775496", "0.67726314", "0.6762369", "0.67575955", "0.6749245", "0.6747038", "0.6718561", "0.6691433", "0.66882634", "0.6684788", "0.6684709", "0.66801935", "0.667842", "0.6674158", "0.6670582", "0.66660976", "0.66648555", "0.66550666", "0.6655033", "0.6653178", "0.663254", "0.662783", "0.66201043", "0.6619089", "0.661535", "0.6613176", "0.6611506", "0.66051936", "0.65919554", "0.659105", "0.6586685", "0.65834695", "0.6580547", "0.65708727", "0.6568168", "0.6562891", "0.6554374", "0.655044", "0.6542616", "0.65366256", "0.65336597", "0.6532489", "0.65291077", "0.6522398", "0.65220475", "0.6520364", "0.6517067", "0.6516853", "0.6516528", "0.651619", "0.6514858", "0.65122443", "0.6507509", "0.6500636", "0.6497308", "0.6494251", "0.6494007", "0.64891547", "0.6487912", "0.647986" ]
0.0
-1
listen for button clicks behavior changes based on the current state
function loadButtonListener() { $('main').on('click', 'button', function(event) { event.preventDefault() switch (currentState) { case STATES.START: loadNextQuestion() break case STATES.QUESTION: checkAnswerValid() break case STATES.CORRECT: case STATES.INCORRECT: currentQuestionIndex++ currentQuestionIndex >= QUESTIONS.length ? loadEnd() : loadNextQuestion() break case STATES.END: loadStart() break } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clickHandler() {\n // Activate if not active\n if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // No click 'action' for input - text is removed in visualEffectOnActivation\n }\n }", "setButtonState() {\n // this.view.setButtonState(this.runner.busy,this.synchronizing,this.synchronize_type)\n }", "handleButton() {}", "function setClickBehaviour(){\n\t\t\tbutton.on(\"click\", changeButtonLabelAndSendEvent);\n\t\t}", "_updateStateOnClick() {\n const that = this;\n\n that._changeCheckState();\n that.focus();\n }", "buttonClick(event, type) {\n let self = this;\n if (self.stateService.statusRunning) { // if running disallow interaction with the board\n return false;\n } else if (type === 'go' && self.stateService.statusStart && self.stateService.statusEnd) { // if it's the go button and there are start and end tiles on the board\n self.stateService.statusRunning = true;\n self.stateService.currentSelectedTile = self.stateService.statusStart; // set the currently selected tile to the start tile\n self.stateService.statusPath.push(self.stateService.currentSelectedTile); // mark x,y as part of solution path\n self.setPathClass(self.stateService.currentSelectedTile);\n self.setClass(document.getElementById('go-button'), 'active');\n self.stateService.startTime = moment().format('HH:mm:ss.SSS');\n self.loopDir();// run calculation\n } else { // if start or end buttons\n let otherType = type === 'start' ? 'end' : 'start';\n let buttonFlag = `${type}ButtonFlag`;\n let otherButtonFlag = `${otherType}ButtonFlag`;\n let otherButton = document.getElementById(otherType + '-button');\n let button = event.srcElement;\n \n if (self.stateService[buttonFlag] === true) { // if already clicked\n self.unsetClass(button, 'active');\n } else { // if not clicked\n self.setClass(button, 'active');\n self.unsetClass(otherButton, 'active');\n self.stateService[otherButtonFlag] = false; // reset the other button\n }\n \n self.stateService.currentSelectedTile = null; // set the currently selected tile\n self.stateService[buttonFlag] = !self.stateService[buttonFlag];\n }\n \n }", "function markButton(event){\n// $(\"#qwerty button\").on(\"click\", (event) => {\nevent.target.disabled = true;\nevent.target.classList.add (\"chosen\")\n// if (event.target.tagName === \"BUTTON\")\napp.handleInteraction(event.target.innerHTML.toLowerCase());\n}", "function handleClick() {\n // Show depressed state of button!\n}", "handleClick() {}", "clickHandler(e) {\n // Only activate if there is a buttonHandler\n if (this.buttonHandler !== false) {\n // Activate if not active\n if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // Click action\n this.clickAction();\n }\n }\n }", "clickHandler() {\n // Activate if not active\n if (this.active === 'safety') {\n // Button view press effect\n this.removeSafety();\n } else if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // Click action\n this.clickAction();\n }\n }", "btnClick() {\n\t\tthis.socket.emit(\"btn state\", this.props.btnValue);\n\t}", "function listenForClick() {\n loopThroughGrid();\n clickTurnBtn();\n }", "function clickHandler(){ // declare a function that updates the state\n elementIsClicked = true;\n isElementClicked();\n }", "handleClick( event ){ }", "function buttonClicked(){\n if (isShowingOverlays) {\n removeOverlays();\n isShowingOverlays = false;\n } else {\n isShowingOverlays = true;\n }\n\n button.writeProperty('buttonState', isShowingOverlays ? 0 : 1);\n button.writeProperty('defaultState', isShowingOverlays ? 0 : 1);\n button.writeProperty('hoverState', isShowingOverlays ? 2 : 3);\n}", "function clickHandler() {\n console.log(\"Button 2 Pressed\");\n }", "onClick(event) {\n if (event.button !== 0)\n return;\n\n this.dispatchEvent(new CustomEvent('toggle', {\n detail: !this.on,\n }));\n }", "buttonClicked() {\n alert(\"buttonclicked of button\");\n }", "controlButtonPressed(buttonPressed) {\n if (buttonPressed === 'power') {\n this.togglePowerState();\n } else if (buttonPressed === 'start') {\n this.toggleGameStarted();\n } else if (buttonPressed === 'strict') {\n this.toggleStrictMode();\n } else if (buttonPressed === 'count') {\n // do something?\n }\n }", "_buttonClickHandler() { }", "function watchButton() {\n //check for shannon button \n $('#js-section-one-button').on('click', event => {\n //prevent default form behavior\n event.preventDefault();\n //console.log($('#js-section-one-button').text());\n switchHTML('shannon', $('#js-section-one-button').text(), 'one');\n });\n \n //check for chris button\n $('#js-section-two-button').on('click', event => {\n //prevent default form behavior\n event.preventDefault();\n //console.log($('#js-section-one-button').text());\n switchHTML('chris', $('#js-section-two-button').text(), 'two');\n });\n\n //check for lindy button\n $('#js-section-three-button').on('click', event => {\n //prevent default form behavior\n event.preventDefault();\n //console.log($('#js-section-one-button').text());\n switchHTML('lindy', $('#js-section-three-button').text(), 'three');\n });\n\n //check for jennifer button\n $('#js-section-four-button').on('click', event => {\n //prevent default form behavior\n event.preventDefault();\n //console.log($('#js-section-one-button').text());\n switchHTML('jennifer', $('#js-section-four-button').text(), 'four');\n });\n}", "menuButtonClicked() {}", "toggleButtonA() {}", "handleButtonClick(){\n\t\tconsole.log(\"handleButtonClick\");\n\n\t\teventsActions.createEvent(this.state.event);\n\t}", "clickOnButton() {\n if (!this._disabled) {\n this.cancelBlur();\n this.focusOnButton();\n\n if (this._triggers === 'click') {\n this.toggleMenuVisibility();\n }\n }\n }", "function buttonActions() {\n\t\t$(\".button\").on(\"click\", function() {\n\t\t\tvar routeGiven = $(this).attr(\"id\");\n\t\t\tif ($(this).hasClass(\"clicked\")) {\n\t\t\t\t$(this).removeClass(\"clicked\");\n\t\t\t\troutes[routeGiven][\"vRefresh\"] = false;\n\t\t\t\t$(\".route_\" + routeGiven + \",\" + \".path_\" + routeGiven).css({\n\t\t\t\t\t\"visibility\": \"hidden\"\n\t\t\t\t});\n\t\t\t\t$(\"#\"+routeGiven).css({\n\t\t\t\t\t\"background-color\": \"#fff\",\n\t\t\t\t\t\"color\": \"#000\"\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t$(this).addClass(\"clicked\");\n\t\t\t\troutes[routeGiven][\"vRefresh\"] = true;\n\t\t\t\t$(\".route_\" + routeGiven + \",\" + \".path_\" + routeGiven).css({\n\t\t\t\t\t\"visibility\": \"visible\"\n\t\t\t\t});\n\t\t\t\t$(\"#\"+routeGiven).css({\n\t\t\t\t\t\"background-color\": \"#\" + routes[routeGiven][\"color\"],\n\t\t\t\t\t\"color\": \"#fff\"\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}", "handleToggleClick() {\n this.buttonClicked = !this.buttonClicked; //set to true if false, false if true.\n this.cssClass = this.buttonClicked ? 'slds-button slds-button_outline-brand' : 'slds-button slds-button_neutral';\n this.iconName = this.buttonClicked ? 'utility:check' : '';\n }", "function listenToButtons() {\n\t\tconst currentlyDisplayed = employeesData.find(isDisplayed);\n\t\tif (hasPrevious(currentlyDisplayed.id)) {\n\t\t\tpreviousButton.addEventListener('click', () => {\n\t\t\t\tupdateContactDetails(getAdjacentContactId('previous'));\n\t\t\t});\n\t\t}\n\t\tif (hasNext(currentlyDisplayed.id)) {\n\t\t\tnextButton.addEventListener('click', () => {\n\t\t\t\tupdateContactDetails(getAdjacentContactId('next'));\n\t\t\t});\n\t\t}\n\t}", "componentDidUpdate() {\n this.checkButtonState();\n }", "function updateButtonsState(env){\n\t\t\n\t\tif (getRelativeStep(env, \"prev\") !== false) {\n\t\t\tenv.$elts.prevBtn.trigger(\"enable\");\n\t\t\t\n\t\t} else {\n\t\t\tenv.$elts.prevBtn.trigger(\"disable\");\n\t\t}\n\t\t\n\t\tif (getRelativeStep(env, \"next\") !== false) {\n\t\t\tenv.$elts.nextBtn.trigger(\"enable\");\n\t\t\t\n\t\t} else {\n\t\t\tenv.$elts.nextBtn.trigger(\"disable\");\n\t\t}\n\t\t\n\t\tif (env.params.pagination){\n\t\t\tenv.$elts.paginationBtns.removeClass(\"active\")\n\t\t\t.filter(function(){ \t\t\t\n\t\t\t\treturn ($(this).data(\"firstStep\") == env.steps.first) \n\t\t\t})\n\t\t\t.addClass(\"active\");\n\t\t}\n\t}", "handleSlotClick() {\n if (this.triggers === 'focus') {\n this.focusOnButton();\n }\n if (this.triggers === 'click') {\n this.popoverVisible = true;\n }\n }", "buttonClicked() {\n this.setState({\n button_clicked: true\n })\n }", "function buttonClick(event){\n //Conditional to limit click triggering to the buttons only\n if(event.target.tagName != \"BUTTON\"){\n return\n }\n //Conditional determining the behavior when the correct answer is selected\n else if (event.target.id === \"a\"){\n colorButtons();\n score++;\n // localStorage.setItem(\"score\", score);\n clearDelay()\n }\n //Conditional determining the behavior when the wrong answer is selected\n else if(event.target.id === \"f\"){\n colorButtons();\n score--; \n // localStorage.setItem(\"score\", score);\n secondsLeft -= 10;\n clearDelay();\n }\n}", "function Nimbb_stateChanged(idPlayer, state) {\n\t \t/*Update button text.*/\n\t \tupdateText();\n\t}", "buttonClick(ev) {\n\n\t\t// Get the button using the index\n\t\tvar btn = this.props.buttons[ev.currentTarget.dataset.index];\n\n\t\t// If there's a callback\n\t\tif(typeof btn.callback == 'function') {\n\t\t\tbtn.callback(btn);\n\t\t} else {\n\t\t\tthis.props.close();\n\t\t}\n\t}", "function handleButtons () {\n handleStartButton();\n handleSubmitButton();\n handleNextButton();\n handleShowAllQandA();\n handleRestartButton();\n }", "function setButtonState() {\n let shadowDOM = document.getElementById('gdx-bubble-host').shadowRoot;\n let nextButton = shadowDOM.querySelector(\"#gdx-bubble-next\");\n let backButton = shadowDOM.querySelector(\"#gdx-bubble-back\");\n backButton.style.display = 'inline';\n nextButton.style.display = 'inline';\n nextButton.disabled = false;\n backButton.disabled = false;\n if (currentIndex <= 0) {\n nextButton.disabled = false;\n backButton.disabled = true;\n }\n if (currentIndex >= data.length - 1) {\n nextButton.disabled = true;\n backButton.disabled = false;\n }\n}", "function handleBtnClick(event) {\n handleEvent(event);\n}", "async handleButtonClick() {\n // not_recording to recording\n if (\n this.collectionState === CollectionStates.NOT_RECORDING ||\n this.collectionState === CollectionStates.QC_ERROR\n ) {\n this.handleStartRecording();\n }\n\n // recording to before_upload\n else if (this.collectionState === CollectionStates.RECORDING) {\n this.handleEndRecording();\n }\n\n // before_upload to transition\n else if (this.collectionState === CollectionStates.BEFORE_UPLOAD) {\n this.handleUploadRecording(this.finishedAudio);\n }\n }", "function handleClick(){\n console.log(\"clicked\");\n}", "click3() {\n console.log('click-3');\n this.setState((preVal) => ({\n msg: 'Clicked by button 3'\n }))\n }", "function updateButton(button, clicked) {\n button.innerText = clicked ? \"Pause\" : \"Animate\";\n updateColor(button, button.value);\n}", "makeButtonHandler() {\n\t\tconst filter = (interaction) => true;\n\n\t\tvar collector = this.globalScrollUpdateMessage.createMessageComponentCollector({filter, time: 120000})\n\n\t\tcollector.on(\"collect\", interaction => {\n\t\t\tconsole.log(interaction);\n\n\t\t\tif(interaction.customId == \"next\") {\n\t\t\t\tinteraction.update(this.getOffsetGlobalScrollIndex(1))\n\t\t\t} else if (interaction.customId == \"back\") {\n\t\t\t\tinteraction.update(this.getOffsetGlobalScrollIndex(-1));\n\t\t\t}\n\t\t})\n\t\n\t}", "function changeIsActionChosen(state) {\r\n CanvasManager.isActionChosen = state;\r\n}", "function _buttonListener(event) {\n codeMirror.focus();\n var msgObj;\n try {\n msgObj = JSON.parse(event.data);\n } catch (e) {\n return;\n }\n\n if(msgObj.commandCategory === \"menuCommand\"){\n CommandManager.execute(Commands[msgObj.command]);\n }\n else if (msgObj.commandCategory === \"viewCommand\") {\n ViewCommand[msgObj.command](msgObj.params);\n }\n }", "actionTabClicker() {\r\n \r\n this.setState({actionChecker: \"block\"})\r\n this.setState({casingChecker: \"none\"})\r\n\r\n }", "function commandButtonHandle(){\n\t\tswitch(this.id){\n\t\t\tcase \"commandbutton_1\":\n\t\t\t\tonDealCardsClicked();\n\t\t\t\tbreak;\n\t\t\tcase \"commandbutton_2\":\n\t\t\t\tonMaxBetClicked();\n\t\t\t\tbreak;\n\t\t\tcase \"commandbutton_3\":\n\t\t\t\tonAddFiveClicked();\n\t\t\t\tbreak;\n\t\t\tcase \"commandbutton_4\":\n\t\t\t\tonRemoveFiveClicked();\n\t\t\t\tbreak;\n\t\t}\n\t}", "stateChanged(_state) { }", "blueClick() {\n\t\tthis._actions.onNext('blue');\n\t}", "function buttonClicked(index) {\n var button = vm.buttons[index];\n if (vm.buttons.length > 1) {\n angular.forEach(vm.buttons, function (value) {\n value.selected = false;\n });\n button.selected = true;\n } else {\n button.selected = !button.selected;\n }\n if (button.onClickCallback) {\n button.onClickCallback(button.selected);\n }\n }", "stateChanged(state) { }", "function setButtonStates() {\n var $scanButton = $(instancePage.onDemandScanBtn);\n var $butrButton = $(instancePage.onDemandButrBtn);\n var $saveButton = $('.save-btn');\n var tooltip = \"Save changes to enable\";\n\n $scanButton.removeClass('inactive').prop('disabled', false).removeAttr('title');\n $butrButton.removeClass('inactive').prop('disabled', false).removeAttr('title');\n $saveButton.addClass('inactive').prop('disabled', true);\n\n if (isOAuthPolling ||\n $(instancePage.hiddenIsRenameLocked).val() === \"true\" ||\n $(instancePage.oauthContainer).hasClass('prompting')) {\n $scanButton.addClass('inactive').prop('disabled', true);\n }\n\n if (isOAuthPolling ||\n $(instancePage.oauthContainer).hasClass('prompting')) {\n $butrButton.addClass('inactive').prop('disabled', true);\n }\n\n if (AlmCommon.getHasUnsavedChanges()) {\n $saveButton.removeClass('inactive').prop('disabled', false);\n\n if (getHasActiveJob(scanConfigProperties.container) != scanConfigProperties.previousToolState ||\n scanConfigProperties.hasUnsavedChanges) {\n $scanButton.addClass('inactive').prop('disabled', true).attr('title', tooltip);\n }\n\n if (getHasActiveJob(butrConfigProperties.container) != butrConfigProperties.previousToolState ||\n butrConfigProperties.hasUnsavedChanges) {\n $butrButton.addClass('inactive').prop('disabled', true).attr('title', tooltip);\n }\n }\n }", "function handleClick(){\n // alert(\"tesss\");\n console.log(\"before = \",state1);\n setState1(1);\n console.log(\"after = \",state1);\n }", "function trackButtons () {\n var gamepad = navigator.getGamepads()[ index ];\n var total = gamepad.buttons.length;\n var i, pressed;\n \n for (i = 0; i < total; i++) {\n pressed = self.isButtonPressed(gamepad.buttons[ i ]);\n \n if (pressed != self.isButtonPressed(buttonsLastState[ i ])) {\n if (pressed) {\n if (typeof buttonDownListener == 'function') {\n buttonDownListener(i);\n }\n } else {\n if (typeof buttonUpListener == 'function') {\n buttonUpListener(i);\n }\n }\n }\n }\n \n saveButtonsLastState();\n }", "function handleClick() {\n if (props.buttonType === \"Start\") {\n props.setStatus(\"Pomodoro\");\n }\n if (props.buttonType === \"Stop\") {\n props.setRounds(0);\n props.setStatus(\"Stopped\");\n }\n if (props.buttonType === \"Skip\") {\n if (props.status === \"Pomodoro\") {\n props.setRounds(props.rounds + 1);\n if ((props.rounds + 1) % props.LBInterval === 0) {\n props.setStatus(\"LongBreak\");\n } else {\n props.setStatus(\"ShortBreak\");\n }\n } else if (props.status === \"ShortBreak\") {\n props.setStatus(\"Pomodoro\");\n } else if (props.status === \"LongBreak\") {\n props.setStatus(\"Pomodoro\");\n }\n }\n }", "passPhase1Clicked() {\n \tthis.model.gamePhase = 2;\n \tthis.view.changeButtons(this.model.gamePhase);\n }", "onClick() {\n if (globalMode === 'edit') {\n\n // increment state and change color\n this.state++;\n if (this.state >= buttonStates.length) this.state = 0;\n\n this.changeColor();\n\n } else if (globalMode === 'strike') {\n\n // generate a random number as a unique strike ID, \n // so cells won't keep triggering eachother\n this.strike(Math.floor(Math.random()*100));\n\n }\n }", "_buttonsDownHandler(event) {\n const that = this;\n\n if (that.disabled) {\n return;\n }\n\n if (that.hasRippleAnimation) {\n if (that.dropDownOpenMode === 'dropDownButton') {\n JQX.Utilities.Animation.Ripple.animate(event.target, event.pageX, event.pageY);\n }\n else if(event.target === that.$.dropDownButton || !that.editable) {\n const target = that.$.buttonsContainer;\n\n target.firstElementChild.noRipple = true;\n JQX.Utilities.Animation.Ripple.animate(target, event.pageX, event.pageY);\n target.firstElementChild.noRipple = false;\n }\n }\n\n that._preventsSelectStart = true;\n\n if (that.dropDownOpenMode === 'dropDownButton' && event.target === that.$.actionButton) {\n that.$.actionButton.setAttribute('active', '');\n }\n\n //Used to handle closing after blur event is thrown\n if (that.opened) {\n that._preventDropDownClose = true;\n }\n }", "function bindButtons() {\n $('button', context).click(function() {\n switch(this.name) {\n case 'simple':\n case 'complex':\n applySettings(_.extend({},\n autotrace.defaults,\n autotrace.presets[this.name]\n ));\n break;\n\n case 'import':\n importTrace();\n /* falls through */\n\n case 'cancel':\n mainWindow.overlay.toggleWindow('autotrace', false);\n break;\n\n case 'transparent-pick':\n autotrace.$webview.send.pickColor();\n break;\n\n case 'clone-1':\n case 'clone-2':\n case 'clone-4':\n case 'clone-8':\n autotrace.settings.cloneCount = parseInt(this.name.split('-')[1]);\n\n // Only mixed tracetype needs to re-render the trace.\n if (autotrace.settings.tracetype === 'mixed') {\n autotrace.renderUpdate();\n } else {\n clonePreview();\n }\n break;\n }\n });\n\n // Bind ESC key exit.\n // TODO: Build this off data attr global bind thing.\n $(context).keydown(function(e){\n if (e.keyCode === 27) { // Global escape key exit window\n if (autotrace.pickingColor) {\n // Cancel picking color if escape pressed while picking.\n autotrace.$webview.send.pickColor(true);\n } else {\n $('button[name=cancel]', context).click();\n }\n }\n });\n\n // Bind special action on outline checkbox.\n $('input[name=outline]', context).change(function() {\n if ($(this).prop('checked')) {\n if (autotrace.settings.posterize === '5') {\n autotrace.settings.posterize = 4;\n applySettings(autotrace.settings);\n }\n $('#posterize-4').prop('disabled', true);\n } else {\n $('#posterize-4').prop('disabled', false);\n }\n });\n }", "function updateButtonsState() {\n // Enable/Disable the Monitor This Page button.\n chrome.tabs.getSelected(null, function(tab) {\n isPageMonitored(tab.url, function(monitored) {\n if (monitored || !tab.url.match(/^https?:/)) {\n $('#monitor_page').unbind('click').addClass('inactive');\n $('#monitor_page img').attr('src', 'img/monitor_inactive.png');\n var message = monitored ? 'page_monitored' : 'monitor';\n $('#monitor_page span').text(chrome.i18n.getMessage(message));\n } else {\n // $('#monitor_page').click(monitorCurrentPage).removeClass('inactive');\n $('#monitor_page img').attr('src', 'img/monitor.png');\n $('#monitor_page span').text(chrome.i18n.getMessage('monitor'));\n }\n });\n });\n\n // Enable/Disable the View All button.\n if ($('#notifications .notification').length) {\n $('#view_all').removeClass('inactive');\n $('#view_all img').attr('src', 'img/view_all.png');\n \n } else {\n $('#view_all').addClass('inactive');\n $('#view_all img').attr('src', 'img/view_all_inactive.png');\n }\n \n\n // Enable/disable the Check All Now button.\n getAllPageURLs(function(urls) {\n getAllUpdatedPages(function(updated_urls) {\n if (urls.length == 0) {\n $('#check_now').addClass('inactive');\n $('#check_now img').attr('src', 'img/refresh_inactive.png');\n } else {\n $('#check_now').removeClass('inactive');\n $('#check_now img').attr('src', 'img/refresh.png');\n }\n });\n });\n initializePageCheck();\n}", "buttonHandler(){\n\t\tvar items = this.props.hey.questions.present;\n\t\tlet conditions = this.props.hey.conditions.present;\n\t\tlet counter = this.props.hey.counter.present;\n\t\tconst action = this.props.action;\n\t\tconst increment = this.props.increment;\n\t\tconst hide = this.props.hideState;\n\t\tsendButtonHandler(items,conditions,counter,action,increment,hide);\n\t}", "function updateBtnCanada()\n{\n canadaBtnState = 1;\n}", "function setupButtons(){\n //speak(quiz[currentquestion]['question'])\n\t\t$('.choice').on('click', function(){\n\t\tsynth.cancel();\n is_on = 0;\n\t\tpicked = $(this).attr('data-index');\n\t\tspeak(quiz[currentquestion]['choices'][picked], LINGUA_RISPOSTA);\n\t\tshow_button();\n\t\t// risposte in francese\n\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\n\t\t$(this).css({'font-weight':'900', 'border-color':'#51a351', 'color':'#51a351', 'background' : 'gold'});\n\t\tif(submt){\n\t\t\t\tsubmt=false;\n\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\n\t\t\t\t$('.choice').off('click');\n\t\t\t\t$(this).off('click');\n\t\t\t\tprocessQuestion(picked);\n //\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}", "handleInteraction() {\r\n document.querySelector('button').onclick=function() {\r\n alert('clicked');\r\n }\r\n }", "pressed()\n {\n emitter.emit(this.config.event);\n }", "onInternalClick(event) {\n const me = this,\n bEvent = { event };\n\n if (me.toggleable) {\n // Clicking the pressed button in a toggle group should do nothing\n if (me.toggleGroup && me.pressed) {\n return;\n }\n\n me.toggle(!me.pressed);\n }\n\n /**\n * User clicked button\n * @event click\n * @property {Common.widget.Button} button - Clicked button\n * @property {Event} event - DOM event\n */\n me.trigger('click', bEvent);\n\n /**\n * User performed the default action (clicked the button)\n * @event action\n * @property {Common.widget.Button} button - Clicked button\n * @property {Event} event - DOM event\n */\n // A handler may have resulted in destruction.\n if (!me.isDestroyed) {\n me.trigger('action', bEvent);\n }\n\n // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onClick and onAction\n\n // stop the event since it has been handled\n event.preventDefault();\n event.stopPropagation();\n }", "function listenForButton() {\n\t\ttag.on('simpleKeyChange', function(left, right) {\n\t\t\t// if both buttons are pressed, disconnect:\n\t\t\tif (left && right) {\n\t\t\t\tconsole.log('both');\n\t\t\t\ttag.disconnect();\n\t\t\t} else\t\t\t\t// if left, send the left key\n\t\t\tif (left) {\n\t\t\t\tconsole.log('left: ' + left);\n\t\t\t\trunFile('left.scpt');\n\t\t\t} else\n\t\t\tif (right) {\t\t// if right, send the right key\n\t\t\t\tconsole.log('right: ' + right);\n\t\t\t\trunFile('right.scpt');\n\t\t\t}\n\t });\n\t}", "function handleButtonStateChanged (event) {\n // read variables from the event\n let ev = JSON.parse(event.data);\n let evData = ev.data; // the data from the argon event: \"pressed\" or \"released\"\n let evDeviceId = ev.coreid; // the device id\n let evTimestamp = Date.parse(ev.published_at); // the timestamp of the event\n\n // helper variables that we need to build the message to be sent to the clients\n let sync = false;\n let msg = \"\";\n\n if (evData === \"pressed\") {\n buttonPressCounter++; // increase the buttonPressCounter by 1\n msg = \"pressed\";\n\n // check if the last two button press events were whithin 1 second\n if (evTimestamp - lastButtonPressEvent.timestamp < 1000) {\n if (evDeviceId !== lastButtonPressEvent.deviceId) {\n sync = true;\n }\n }\n\n lastButtonPressEvent.timestamp = evTimestamp;\n lastButtonPressEvent.deviceId = evDeviceId;\n } \n else if (evData === \"released\") {\n msg = \"released\";\n }\n else {\n msg = \"unknown state\";\n }\n\n // the data we want to send to the clients\n let data = {\n message: msg,\n counter: buttonPressCounter,\n pressedSync: sync\n }\n\n // send data to all connected clients\n sendData(\"buttonStateChanged\", data, evDeviceId, evTimestamp );\n}", "_buttonsDownHandler(event) {\n const that = this;\n\n if (that.disabled) {\n return;\n }\n\n if (that.hasRippleAnimation) {\n if (!that.$.buttonsContainer || that.dropDownOpenMode === 'dropDownButton') {\n JQX.Utilities.Animation.Ripple.animate(event.target, event.pageX, event.pageY);\n }\n else {\n const target = that.$.buttonsContainer;\n\n target.firstElementChild.noRipple = true;\n JQX.Utilities.Animation.Ripple.animate(target, event.pageX, event.pageY);\n target.firstElementChild.noRipple = false;\n }\n }\n\n that._preventsSelectStart = true;\n\n if (that.dropDownOpenMode === 'dropDownButton' && event.target === that.$.actionButton) {\n that.$.actionButton.setAttribute('active', '');\n }\n\n //Used to handle closing after blur event is thrown\n if (that.opened) {\n that._preventDropDownClose = true;\n }\n }", "function stateChange(){\n\n}", "buttonHandler(button) {\n console.log(button);\n switch (button) {\n // game buttons\n case 'green':\n this.addToPlayerMoves('g');\n break;\n case 'red':\n this.addToPlayerMoves('r');\n break;\n case 'yellow':\n this.addToPlayerMoves('y');\n break;\n case 'blue':\n this.addToPlayerMoves('b');\n break;\n // control buttons\n case 'c-blue':\n this.controlButtonPressed('power');\n break;\n case 'c-yellow':\n this.controlButtonPressed('start');\n break;\n case 'c-red':\n this.controlButtonPressed('strict');\n break;\n case 'c-green':\n this.controlButtonPressed('count');\n break;\n // default\n default:\n break;\n }\n }", "function handleClick() {\n // retrieve the index of the button in the node list\n const index = [...buttons].findIndex(button => button === this);\n\n // color and rescale every button up to the selected one\n [...buttons].slice(rating, index + 1).forEach((button, i) => {\n // transition delay for the change in color and scale, on the button\n // animation delay inherited by the pseudo elements, to add a small detail\n // both based on the total number of stars\n const stars = (index + 1) - rating;\n button.style.transitionDelay = `${i * duration / stars}s`;\n button.style.animationDelay = `${i * duration / stars}s`;\n // class allowing to style the button and animate the pseudo elements\n button.classList.add('active');\n });\n\n // remove the class allowing the animation from every button after the selected one\n [...buttons].slice(index + 1, rating).forEach((button, i) => {\n // delay on the transition to have the buttons styled progressively and in the opposite order\n const stars = rating - (index + 1);\n button.style.transitionDelay = `${(stars - i - 1) * duration / stars}s`;\n button.classList.remove('active');\n });\n\n // update rating to refer to the new index\n rating = index + 1;\n}", "handleHitBtn () {\n this.setState({\n mode: 'hit'\n })\n }", "@observe(\"activated\")\n activatedChanged(newValue) {\n if (newValue) {\n const btn = this.shadowRoot.querySelector(\"button\");\n\n fromEvent(btn, \"click\")\n .pipe(bufferCount(3))\n .subscribe(() => {\n this.result1 = \"Clicked 3 times!\";\n });\n } else {\n this.result1 = undefined;\n }\n }", "function handleClick() {\n setHam((old) => !old);\n }", "function changeButtonState() {\n\t\t\tif (auto === true) {\n\t\t\t\tbtnList.begin.prop(\"disabled\", auto);\n\t\t\t\tbtnList.backward.prop(\"disabled\", auto);\n\t\t\t\tbtnList.fastBackward.prop(\"disabled\", auto);\n\t\t\t\tbtnList.end.prop(\"disabled\", auto);\n\t\t\t\tbtnList.forward.prop(\"disabled\", auto);\n\t\t\t\tbtnList.fastForward.prop(\"disabled\", auto);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ((goMap.currentMoveIndex === 0) && (exGoMap.currentMoveIndex === 0)) { // Beginning\n\t\t\t\tbtnList.begin.prop(\"disabled\", true);\n\t\t\t\tbtnList.begin.tooltip(\"hide\");\n\t\t\t\tbtnList.backward.prop(\"disabled\", true);\n\t\t\t\tbtnList.backward.tooltip(\"hide\");\n\t\t\t\tbtnList.fastBackward.prop(\"disabled\", true);\n\t\t\t\tbtnList.fastBackward.tooltip(\"hide\");\n\n\t\t\t\tbtnList.end.prop(\"disabled\", false);\n\t\t\t\tbtnList.forward.prop(\"disabled\", false);\n\t\t\t\tbtnList.fastForward.prop(\"disabled\", false);\n\t\t\t\tbtnList.auto.prop(\"disabled\", false);\n\t\t\t} else if ((goMap.currentMoveIndex === goMap.totalMoveCount - 1) || (exGoMap.currentMoveIndex > 0)) {// If at the end or after user put stones\n\t\t\t\tbtnList.begin.prop(\"disabled\", false);\n\t\t\t\tbtnList.backward.prop(\"disabled\", false);\n\t\t\t\tbtnList.fastBackward.prop(\"disabled\", false);\n\n\t\t\t\tbtnList.end.prop(\"disabled\", true);\n\t\t\t\tbtnList.end.tooltip(\"hide\");\n\t\t\t\tbtnList.forward.prop(\"disabled\", true);\n\t\t\t\tbtnList.forward.tooltip(\"hide\");\n\t\t\t\tbtnList.fastForward.prop(\"disabled\", true);\n\t\t\t\tbtnList.fastForward.tooltip(\"hide\");\n\t\t\t\tbtnList.auto.prop(\"disabled\", true);\n\t\t\t\tbtnList.auto.tooltip(\"hide\");\n\t\t\t} else {\n\t\t\t\tbtnList.begin.prop(\"disabled\", false);\n\t\t\t\tbtnList.backward.prop(\"disabled\", false);\n\t\t\t\tbtnList.fastBackward.prop(\"disabled\", false);\n\t\t\t\tbtnList.end.prop(\"disabled\", false);\n\t\t\t\tbtnList.forward.prop(\"disabled\", false);\n\t\t\t\tbtnList.fastForward.prop(\"disabled\", false);\n\t\t\t\tbtnList.auto.prop(\"disabled\", false);\n\t\t\t\tbtnList.auto.tooltip(\"hide\");\n\t\t\t}\n\t\t}", "changeButtonsVisibilityFromState(newStateName) {\n // this is the array where the button is VISIBLE for that state\n // OPTIMIZATION: store this in setup somethwere\n let clickableStateArray = this.clickableTable.getColumn('State');\n for( let i = 0; i < clickableStateArray.length; i++ ) {\n // if there is no column called 'State' then the array is a proper\n // length, but each entry is undefined, just continue then\n if( clickableStateArray[i] === undefined ) {\n continue;\n }\n\n // if an empty string, then we are not binding this button to a state\n if( clickableStateArray[i] === \"\" ) {\n\n }\n\n // Otherwise, we are binding, so turn button on/off accordingly\n if( clickableStateArray[i] === newStateName ) {\n this.clickableArray[i].visible = true;\n //print(\"set to visible\");\n }\n else {\n this.clickableArray[i].visible = false; \n // print(\"set to hide\");\n }\n }\n }", "function triggerToggleButton(e) {\n $(e).parent().children(\"button\").click();\n}", "onInternalClick(event) {\n const me = this,\n bEvent = {\n event\n };\n\n if (me.toggleable) {\n // Clicking the pressed button in a toggle group should do nothing\n if (me.toggleGroup && me.pressed) {\n return;\n }\n\n me.toggle(!me.pressed);\n }\n /**\n * User clicked button\n * @event click\n * @property {Core.widget.Button} button - Clicked button\n * @property {Event} event - DOM event\n */\n\n me.trigger('click', bEvent);\n /**\n * User performed the default action (clicked the button)\n * @event action\n * @property {Core.widget.Button} button - Clicked button\n * @property {Event} event - DOM event\n */\n // A handler may have resulted in destruction.\n\n if (!me.isDestroyed) {\n me.trigger('action', bEvent);\n } // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onClick and onAction\n\n if (!this.href) {\n // stop the event since it has been handled\n event.preventDefault();\n event.stopPropagation();\n }\n }", "buttonTwoClick(evt) {\n alert(\"Button Two Clicked\");\n }", "click4() {\n console.log('click-4');\n\n this.setState((preVal) => ({\n msg: 'Clicked by button 4'\n }))\n }", "function listenForButton() {\n\t\ttag.on('simpleKeyChange', function(left, right) {\n\t\t\tif (left) console.log('left: ' + left);\n\t\t\tif (right) console.log('right: ' + right);\n\t\t\t// if both buttons are pressed, disconnect:\n\t\t\tif (left && right) tag.disconnect();\n });\n }", "activateButton(){\n //If the button already exists, we want to remove and rebuilt it\n if(this.button)\n this.button.dispose();\n\n //Create button called but with Activate SpeedBoost as its text\n this.button = Button.CreateSimpleButton(\"but\", \"Activate\\nSpeedBoost\");\n this.button.width = 0.8;\n this.button.height = 0.8;\n this.button.color = \"white\";\n this.button.background = \"red\";\n this.button.alpha = 0.8;\n this.stackPanel.addControl(this.button);\n //Scope these attributes so they can be used below\n var button = this.button;\n var app = this.app;\n\n //Function for if they click it\n //Function is a member of the button object, not of this class\n this.button.onPointerDownObservable.add(function() {\n if(button.textBlock.text != \"Activate\\nSpeedBoost\")\n return;\n app.buttonPressed(\"speedBoost\");\n button.textBlock.text = \"SpeedBoost\\nActivated\";\n }); \n }", "function buttonStyleHandler(_this) {\r\n\r\n//get all the button elements and their details \r\nconst list = document .getElementsByClassName(\"btn-secondary\"); \r\n //switch the current status of the button that was pressed. \r\n _this.activated = !_this.activated;\r\n \r\n //if the button that was pressed was inactive but is now active.... \r\n if ( _this.activated == 1) {\r\n \r\n if(_this.id == \"button1\"){ \r\n _this.style.backgroundColor = \"#00ba19\";\r\n }\r\n else{\r\n _this.style.backgroundColor =\"#005019\";\r\n } \r\n _this.style.color = \"white\";\r\n }\r\n \r\n //if the button is now inactive \r\n else {\r\n \r\n _this.style.backgroundColor = \"buttonface\";\r\n _this.style.color = \"black\";\r\n \r\n if (buttonStatus[0] == true){\r\n \r\n list[0].activated = false;\r\n list[0].style.backgroundColor = \"buttonface\";\r\n list[0].style.color = \"black\";\r\n \r\n } \r\n \r\n }\r\n \r\n //handle the button All being pressed \r\n if (_this.id == \"button1\"){ \r\n \r\n var i;\r\n \r\n for(i=0;i<list.length;i++){\r\n \r\n if(list[i].id == \"button1\"){\r\n \r\n }\r\n else{ \r\n list[i].activated = _this.activated; \r\n \r\n //turn on all buttons \r\n if (list[i].activated == 1){\r\n \r\n list[i].style.backgroundColor = \"#005019\";\r\n list[i].style.color = \"white\";\r\n \r\n }\r\n \r\n //turn off all buttons if all button is turned off. \r\n else {\r\n \r\n list[i].style.backgroundColor = \"buttonface\";\r\n list[i].style.color = \"black\";\r\n \r\n }\r\n }\r\n } \r\n }\r\n \r\n //update the status of all buttons. \r\n var j;\r\n for(j=0;j<list.length;j++){\r\n\r\n buttonStatus[j] = list[j].activated;\r\n\r\n }\r\n\r\n console.log(buttonStatus); \r\n}", "componentDidUpdate() {\n this.btnClassChange();\n }", "handleInteraction(button) {\n if (button.tagName == 'BUTTON') { //event only listen to `BUTTON` elements on click\n \n let letter = button.textContent\n button.disabled = true;\n \n if (!game.activePhrase.checkLetter(letter)) {\n button.className = 'wrong';\n this.removeLife();\n } else {\n button.className = 'chosen';\n game.activePhrase.showMatchedLetter(letter);\n this.checkForWin(); \n }\n } \n \n if (this.checkForWin() == true) { //check if the user has won\n this.gameOver(true); //call the gamewon is equal to true\n } \n \n console.log(button);\n }", "function clickButton()\n {\n // Update requested value\n var btn = this ;\n var setval = \"\" ;\n if ( btn.toggle )\n {\n switch (btn.request)\n {\n case \"Off\": btn.request = \"On\" ; setval = \"F\" ; break ;\n case \"On\": btn.request = \"Off\" ; setval = \"N\" ; break ;\n }\n }\n logDebug(\"clickButton: \", btn, \n \", target: \", btn.target, \", request: \", btn.request) ;\n // Now proceed to set requested value\n if ( btn.target != null )\n {\n // Send update command, refresh selector state when done\n setButtonState(btn, \"Pending\") ;\n var def = doTimedXMLHttpRequest(btn.target+setval, 4.9) ;\n def.addBoth(pollNow) ;\n }\n else\n {\n logError(\"clickButton (no target)\") ;\n }\n return false ; // Suppresss any default onClick action\n }", "clickHandler(event) {\n\t\tconsole.log(event.target);\n\t\tthis.myBool = !this.myBool;\n\t}", "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}", "handleButtonClick() {\n\t\t// preserve context\n\t\tconst _this = this;\n\n\t\t_this.props.onClick();\n\t\t_this.setState({\n\t\t\tvalue: `X`,\n\t\t});\n\t}", "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 handleButtons(event) {\r\n // the button pressed in found in the click event under the value of event.target.dataset.value\r\n // using the data attribute included for this purpose in the HTML\r\n let buttonPressed = event.target.dataset.value;\r\n\r\n // trigger different functions based on the button pressed\r\n if(buttonPressed == \"ec\") {\r\n clearMainDisplay();\r\n }\r\n else if(buttonPressed == \"ac\") {\r\n clearMainDisplay(); \r\n clearChainDisplay();\r\n }\r\n else if(regexDigits.test(buttonPressed)) {\r\n displayDigit(buttonPressed);\r\n }\r\n else if(buttonPressed == \".\") {\r\n displayDecimalPoint();\r\n }\r\n else if(regexOperators.test(buttonPressed)) {\r\n displayOperator(buttonPressed);\r\n } \r\n else if(buttonPressed == \"=\") {\r\n displayResult();\r\n }\r\n else {\r\n fourOhFour();\r\n }\r\n}", "checkButtonType(event) {\n if (event.target == this) return;\n\n console.log(event.target.className, event.target.innerHTML);\n let content = event.target.className;\n switch (content) {\n case 'buttons operator ac':\n calFunction.clearDisplay();\n break;\n case 'buttons operator ce':\n calFunction.clear();\n break;\n case 'buttons numbers':\n calFunction.addToCurrent(event.target.innerHTML);\n break;\n case 'buttons operator':\n calFunction.addToCurrent(event.target.innerHTML);\n break;\n case 'buttons operator equal':\n calFunction.addToLast(event.target);\n calFunction.current.innerHTML=calFunction.calculate(calFunction.current.innerHTML)\n break;\n }\n return\n }", "function observeButtonClick(element, handler) {\r\n var toolbar = this;\r\n $(element).observe('click', function(event) {\r\n toolbar.hasMouseDown = true;\r\n handler(toolbar.editArea);\r\n toolbar.editArea.fire(\"wysihat:change\");\r\n Event.stop(event);\r\n toolbar.hasMouseDown = false;\r\n });\r\n }", "function addButtonEvent() {\n\t\t\tbtnList.begin.click(API.begin);\n\t\t\tbtnList.fastBackward.click(function () {API.backward(FAST_STEP_NUM); });\n\t\t\tbtnList.backward.click(function () {API.backward(1); });\n\t\t\tbtnList.forward.click(function () {API.forward(1); });\n\t\t\tbtnList.fastForward.click(function () {API.forward(FAST_STEP_NUM); });\n\t\t\tbtnList.end.click(API.end);\n\t\t\tbtnList.flag.click(API.flag);\n\t\t\tbtnList.auto.click(API.setAuto);\n\t\t}", "function handleClick(event)\n{\n}", "handleInteraction(e) {\n // If the event is coming from physical keyboard and catching with 'keydown'\n if (e.type == \"keydown\") {\n const char = qwerty.querySelectorAll(\"button\"); //find all the buttons\n for (let i = 0; i < char.length; i++) {\n const button = char[i];\n const buttonText = button.innerText;\n if (e.key.toLowerCase() == buttonText) {\n // if the buttons has the text of the key pressed\n\n button.disabled = true; //disable the button\n\n if (this.activePhrase.checkLetter(buttonText)) {\n //if active phrase has the button text\n button.className = \"chosen\"; //change the class of button to chosen\n this.activePhrase.showMatchedLetter(buttonText); //display the matched letter\n if (this.checkForWin()) {\n this.gameOver(true); //check if the user is won. then display gameOver\n }\n } else {\n if (button.className != \"wrong\") {\n //if the button class is not already wrong\n button.className = \"wrong\"; //set it to wrong\n this.removeLife(); //remove life\n }\n }\n }\n }\n //If the event is coming the mouse click\n } else if (e.type == \"click\") {\n e.disabled = true;\n const button = e.target;\n\n const buttonText = button.textContent;\n\n if (this.activePhrase.checkLetter(buttonText)) {\n //if active phrase has the button text\n button.className = \"chosen\"; //change the class of button to chosen\n this.activePhrase.showMatchedLetter(buttonText); //display the matched letter\n if (this.checkForWin()) {\n this.gameOver(true); //check if the user is won. then display gameOver\n }\n } else {\n if (button.className != \"wrong\") {\n //if the button class is not already wrong\n button.className = \"wrong\"; //set it to wrong\n this.removeLife(); //remove life\n }\n }\n }\n }", "function buttonClick(){\r\n\r\n var buttonTriggered = this.innerHTML;\r\n clickPress(buttonTriggered);\r\n buttonAnimation(buttonTriggered);\r\n\r\n}", "onToggle() {}", "clicked() {\r\n if (this.life === 0) {\r\n this.status = 1;\r\n this.life = 1;\r\n }else if (this.life === 1) {\r\n this.status = 0;\r\n this.life = 0;\r\n }\r\n }" ]
[ "0.71063447", "0.69722575", "0.69307727", "0.679892", "0.67880434", "0.6735306", "0.6671232", "0.6668437", "0.6642453", "0.6615837", "0.65779763", "0.6566797", "0.64925015", "0.6483799", "0.64733166", "0.6463827", "0.6409078", "0.63712937", "0.63564706", "0.6356108", "0.62798494", "0.62592304", "0.62411815", "0.62405324", "0.62394434", "0.62328964", "0.6212766", "0.6209493", "0.6202172", "0.6200536", "0.6186059", "0.6185095", "0.615622", "0.61450297", "0.614022", "0.6134629", "0.61332536", "0.61184686", "0.6113736", "0.6096706", "0.6078953", "0.6067012", "0.6057916", "0.60571915", "0.6053607", "0.6037676", "0.60310805", "0.60301614", "0.6021619", "0.6015683", "0.600044", "0.5999605", "0.5997542", "0.59953564", "0.5985676", "0.59735656", "0.5968907", "0.596452", "0.59628254", "0.5961002", "0.59592724", "0.59559995", "0.59558713", "0.5955849", "0.59530556", "0.5946392", "0.59457725", "0.59432983", "0.5941874", "0.59366155", "0.59363675", "0.5932711", "0.5931788", "0.59267277", "0.5925037", "0.591896", "0.5917983", "0.59156954", "0.591067", "0.5907352", "0.5907322", "0.59040374", "0.5891953", "0.5887523", "0.5886759", "0.5880392", "0.5880306", "0.5878653", "0.58766425", "0.5871729", "0.58705115", "0.58700097", "0.5869595", "0.5866132", "0.5862326", "0.5858007", "0.5856179", "0.5846013", "0.58416337", "0.5836794", "0.5834057" ]
0.0
-1
cleanup procedures start nodeEnd is the function called when the node instance receives an exit signal it needs to be reset every time the agora process refreshes if killed
function nodeEnd() { // signal all current processing requests that a terminate request has been received isTerminating = true; // if it is processing, ensure all events return before stopping if (processing) { (function wait() { if (processing) { setTimeout(wait, 100); } else { agora_process.kill(); } })() } else { agora_process.kill(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endMonitorProcess( signal, err ) {\n\n if ( err ) {\n \n log.e( 'Received error from ondeath?' + err ); \n\n releaseOracleResources( 2 ); \n\n\n } else {\n\n log.e( 'Node process has died or been interrupted - Signal: ' + signal );\n log.e( 'Normally this would be due to DOCKER STOP command or CTRL-C or perhaps a crash' );\n log.e( 'Attempting Cleanup of Oracle DB resources before final exit' );\n \n releaseOracleResources( 0 ); \n\n }\n\n}", "start() {\n setTimeout(() => {\n if (this.node && this.node.destroy()) {\n console.log('destroy complete');\n }\n }, 5000);\n }", "function end() {\n host.active--;\n //callback(this);\n process(host);\n }", "end() {\n process.exit();\n }", "function graceful_shutdown(){\n process.exit();\n}", "onTerminate() {}", "end() {\n\t\tif (this.process)\n\t\t\tthis.process.kill()\n\t}", "cleanUp() {\n logger.info('server shutting down');\n this.server.close(() => process.exit(0));\n }", "async end() {\n return;\n }", "onDestroy() {}", "end() {\n Object.assign(this.previousState, this.state); // Save the previous state\n this.state.inside = false;\n\n // Notify the nodes\n this.notify();\n }", "shutdown() {\n\n }", "shutdown() {\n\n }", "shutdown() {\n\n }", "shutdown() {\n\n }", "shutdown() {\n\n }", "shutdown() {\n process.exit(0);\n }", "function Graph_teardown () { }", "end(){\n this.request({\"component\":this.component,\"method\":\"end\",\"args\":[\"\"]})\n this.running = false\n }", "cleanup() {\n\n\t}", "function final() { console.log('Done and Final'); process.exit() ; }", "async cleanup() {\n\n }", "function cleanup() {\n res.removeListener('finish', makePoint);\n res.removeListener('error', cleanup);\n res.removeListener('close', cleanup);\n }", "shutdown() {}", "static reset(){\n _NODE_UID = 0;\n }", "shutdown() {\n }", "function dispose(){\n//\tinitNode();\n\tdpost(\"dispose function called\\n\");\n enable(0); // sends enable 0 messages...\n\toutlet(OUTLET_DUMP, \"dispose\");\n\n if(vpl_nodePatcher != 0){\n // calls the parent patcher to dispose this node.\n // it will eventually call the notifydeleted function as well.\n\t\tvpl_nodePatcher.message(\"dispose\");\n }\n}", "end() {\n this.log('end');\n }", "cleanup(cb) {\n if (this.cleanedUp === true) {\n return async.nextTick(cb)\n }\n\n const stages = [\n /*\n * Stop the container\n */\n this.instance.stop.bind(this.instance),\n\n /*\n * Remove the container\n */\n this.instance.remove.bind(this.instance, {force: true}),\n\n /*\n * Mark the container as cleaned up\n */\n (next) => {\n this.cleanedUp = true\n async.nextTick(next)\n }\n ];\n\n async.series(stages, cb)\n }", "cleanup() {}", "cleanup() {}", "async terminate() {\n // chance for any last minute shutdown stuff\n logger.info('Null API Terminate');\n }", "function end() {\n process.exit(0);\n}", "function CleanExit() {\n\tws281x.reset();\n\tprocess.nextTick(function () { process.exit(0); });\n}", "_onExit() {\n super._onExit()\n super.kill()\n }", "function stopNodejsAndUpgrade(){\n logger.log(\"info\", \"Entering stopNodejsAndUpgrade\");\n let stopnodejs = exec(process.cwd() + \"\\\\winstaller\\\\stopnode.bat\", (err, stdout, stderr) => { \n logger.log(\"info\", \"executed:\", process.cwd() + \"\\\\winstaller\\\\stopnode.bat\"); \n }\n );\n stopnodejs.on(\"close\", upgrade);\n logger.log(\"info\", \"Exiting stopNodejsAndUpgrade\");\n}", "shutdown() {\n // this.log.debug(\"shutdown\");\n }", "function exit() {\n sensor.unexport();\n process.exit();\n}", "function appEnding() {\n cleanUpEntities();\n if (coinSpawnTimeout){\n Script.clearTimeout(coinSpawnTimeout);\n coinSpawnTimeout = false;\n }\n if (octreeInterval){\n Script.clearInterval(octreeInterval);\n octreeInterval = false;\n }\n Messages.unsubscribe(MONEY_TREE_CHANNEL);\n Messages.unsubscribe(OPERATOR_CHANNEL);\n Messages.unsubscribe(GIVER_CHANNEL);\n Messages.unsubscribe(RECIPIENT_CHANNEL);\n Messages.messageReceived.disconnect(messageHandler);\n Messages.messageReceived.disconnect(messageHandlerOperator);\n Messages.messageReceived.disconnect(messageHandlerRecipient);\n Messages.messageReceived.disconnect(messageHandlerGiver);\n}", "destroy() { /* There are no resources to clean up on MySQL server */ }", "_destroy() {}", "_destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n this.emit('end');\n }", "_destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n this.emit('end');\n }", "_destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n this.emit('end');\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "function end() {\n task = null;\n stack.ack();\n run.call(self); // restart to high level scope\n }", "end() {\n this.medals();\n this.endMessage();\n this.cleanUp();\n this.gc();\n }", "destroy() {\n this.startNode.setInputState(INPUT_STATE.FREE);\n\n if (this.endNode == null)\n return;\n\n this.endNode.setValue(false);\n this.endNode.setInputState(INPUT_STATE.FREE);\n }", "function terminate() {\n //process.send({pid: process.pid, stats: exports.computeStatistics()})\n exports.dumpVSDs();\n console.log(\"[STATISTICS (mean)]:\", exports.computeStatistics());\n process.exit();\n}", "function cleanup() {\n res.end();\n splitFlaps.forEach((splitFlap, i) => {\n splitFlap.stepper.removeListener('step', listeners[i]);\n });\n }", "function shutdown() { \n console.log('graceful shutdown express');\n\n const exitPayload = {\n\t\"status\": \"outofservice\"\n };\n const config = {\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${token}`,\n },\n };\n\n currentStatus.spotStatus = \"outofservice\";\n try {\n const res = instance.put(\n `/spots/`+robot_credentials.login.id+`/statusUpdate`,\n currentStatus,\n config\n );\n } catch(e) { }\n // /requests/trip_ID/complete\n /*if ( activeTrip ) {\n console.log('shutting down during trip. Sending complete trip request to backend');\n console.log('https://hypnotoad.csres.utexas.edu:8443/requests/'+curTripId+'/complete'); \n request.put('https://hypnotoad.csres.utexas.edu:8443/requests/'+curTripId+'/complete');\n currentStatus.spotStatus = \"available\";\n activeTrip = false;\n }*/\n console.log(\"Exiting..\");\n process.exit();\n}", "function heapEnd(){\n addStep(\"Node 1 is now sorted\");\n setClass(nodes[0], 2, \"Sorted\");\n addStep(\"The List is now sorted\");\n clearInterval(wait);\n randomizeButton.disabled = false;\n sortSelector.disabled = false;\n heapOldPosition = -1;\n}", "function endProcess()\n{\n\tprocess.exit()\n}", "end() {\n\t\tthis.Vars._Status = strings.getString(\"Terms.ShuttingDown\")\n\t\tthis.Vars._event = 'ShuttingDown'\n\t\tthis.Vars._displayStatusMessage = true\n\t\tupdateSession(this.ID)\n\t\tthis.Session.stdin.write('\\nshutdown\\n');\n\t}", "handleServerStop() {\n this.activeStartingResource = null;\n this.activeStartingTime = null;\n }", "_onEnd() {}", "function terminate() {\n\tt.murder(eventHandlers.cb);\n}", "async shutdown() { }", "end() {\n }", "end() {\n }", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "destroy() {}", "exit() {\n this.emit(\"shutdown\", this);\n this.discordCli.destroy();\n process.exit(0);\n }", "onShutdown () {\n unload()\n }", "function shutdown() {\n Object.reset(OPENED);\n Object.reset(NEXT_IDS);\n }", "stop() {\n if ( !cluster.isMaster ) return;\n cluster.removeListener('exit', this.handleWorkerExit);\n cluster.removeListener('disconnect', this.handleWorkerDisconnect);\n cluster.removeListener('listening', this.handleWorkerListening);\n cluster.removeListener('online', this.handleWorkerOnline);\n this.stopExtantTimers()\n }", "async end() { }", "function END() {}", "internalCleanup() {\n\n }", "destroy () {}", "function finishedProcess(){\n console.log('xxxxxxxxxxxxxxxxxxxx process manually terminated xxxxxxxxxxxxxxxxxxxxxx')\n printTotals();\n clearInterval(pound.statusUpdateIntervalId);\n process.exit();\n }", "async prepareForShutdown() {\n\n // This is where you add graceful shutdown handling\n // e.g. this.web.stop(this.shutdown.bind(this));\n // ^ might stop HAPI and then when dead, call shutdown to end the process\n\n this.unbindProcessSignals();\n this.shutdown();\n }", "_end(done){\r\n this.fork.stdout.on('data', data => {\r\n this.stdio.stdout.splitPush(data)\r\n })\r\n\r\n this.fork.stderr.on('data', data => {\r\n this.stdio.stderr.splitPush(data)\r\n })\r\n\r\n this.fork.on('exit', (signal, code) => { \r\n done(null, JSON.stringify({\r\n source: this.source.pathname,\r\n args: this.args,\r\n stdio: this.stdio,\r\n signal,\r\n code\r\n }, null, 2))\r\n })\r\n }", "function exit()\n{\n\tmyFingerprintSensor = null;\n\tfingerprint_lib.cleanUp();\n\tfingerprint_lib = null;\n\tconsole.log(\"Exiting\");\n\tprocess.exit(0);\n}", "function killAndRestart(timeout: number) {\n\n clearTimeout(cache.to);\n cache.to = setTimeout(() => {\n\n const c = cache.k;\n\n gp = gp.then(() => {\n\n let exited = false;\n let timedout = false;\n let callable = true;\n ee.removeAllListeners();\n\n let connCount = 0;\n\n cache.state = 'DEAD';\n stdio.log({state: 'DEAD'});\n\n const listener = () => {\n if (++connCount === 3) {\n onExitOrTimeout();\n }\n };\n\n ee.on('connected', listener);\n\n const to = setTimeout(() => {\n log.warn('wait for exit timed out...');\n timedout = true;\n if (!exited) {\n onExitOrTimeout();\n }\n\n }, 2500);\n\n c.once('exit', (code: any) => {\n exited = true;\n log.info('bash proc exitted with code:', code);\n });\n\n function onExitOrTimeout() {\n if (!callable) {\n return;\n }\n ee.removeListener('connected', listener);\n callable = false;\n clearTimeout(to);\n c.stdout.removeAllListeners();\n c.stderr.removeAllListeners();\n c.removeAllListeners();\n c.unref();\n cache.k = launch();\n\n }\n\n if (mergedroodlesConf.verbosity > 2) {\n log.warn('Killing your process with the \"' + mergedroodlesConf.signal + '\" signal.');\n }\n\n (c as any).isRoodlesKilled = true;\n // process.kill(cache.k.pid, 'SIGINT');\n // cache.k.kill(mergedroodlesConf.signal);\n\n const proms = [];\n\n for (const p of portsToKill) {\n\n proms.push(new Promise((resolve) => {\n\n const killer = cp.spawn('bash');\n\n killer.stdin.end(`\n set +e;\n lsof -ti tcp:${p} | xargs -r kill -INT\n sleep 0.25\n my_pid=\"$(lsof -ti tcp:${p})\"\n if [[ ! -z \"$my_pid\" ]]; then\n sleep 1.5;\n lsof -ti tcp:${p} | xargs -r kill -KILL\n fi\n `);\n\n killer.once('exit', resolve)\n\n }));\n\n }\n\n return Promise.all(proms).then(() => {\n\n onExitOrTimeout();\n c.kill('SIGINT');\n utils.killProcs(c.pid, 'INT', (err, results) => {\n log.info({err, results});\n });\n\n // process.kill(c.pid, 'SIGKILL');\n setTimeout(() => {\n if (!exited) {\n setTimeout(() => {\n c.kill('SIGKILL');\n }, 100);\n utils.killProcs(c.pid, 'KILL', (err, results) => {\n c.kill('SIGKILL');\n log.info({err, results});\n });\n }\n }, 2000);\n });\n })\n }, timeout);\n\n }", "terminating() {}", "function postCleanup() {\n\n }", "end() {\n this._lightProbeRequested = false;\n this._lightProbe = null;\n this._available = false;\n }", "function end() {\n stopProgressInfo();\n cancelAllJobs();\n if (fromDate) {\n clock.uninstall();\n }\n if (!isEnded) {\n isEnded = true;\n emitEnd();\n }\n}", "async shutdown(){}", "destroy() {\n this._end();\n }", "exitNarrator(ctx) {\n\t}", "function endPython(){\n LED_RGBC.end(function (err,code,signal) {\n if (err) throw err;\n console.log('The exit code was: ' + code);\n console.log('The exit signal was: ' + signal);\n console.log('finished');\n });\n}", "function endTest() {\n iterating = false\n // tear down\n for (var i=0; i<numCs; ++i) {\n cachedMgr.removeComponent(compNames[i])\n }\n compNames.length = 0\n for (i=0; i<numEs; ++i) {\n cachedMgr.removeEntity(Es[i])\n }\n Es.length = 0\n while(procs.length) {\n cachedMgr.removeProcessor(procs.pop())\n }\n procs.length = 0\n}", "shutdown() {\n\t\tif (this.terminated) return; // already terminated\n\t\tthis.terminated = true;\n\t\tclearTimeout(this.reconnect_timer);\n\t\tthis.disconnect(new Error(`terminated`), true);\n\t}", "cleanUp() {\n this.log_.info('Clean up ...');\n this.events_.clear();\n }", "function killLogic(){\n log.info( '[Kill] Shutting down' )\n process.exit(0);\n}", "terminate() {\n this.running = false;\n this. data = [];\n }", "function _exit(inst)\n{\n if (inst.server != null) {\n logger.info(\"ROV Module: _exit(\" + inst.id + \") pid = \"\n + inst.server.pid);\n\n /* in case, the target monitor hangs, we kill rather than\n * inst.server.stdin.write(\"exit\" + os.EOL);\n */\n inst.server.kill('SIGTERM');\n inst.server = null;\n }\n else {\n logger.info(\"ROV Module: _exit(\" + inst.id + \") server == null\");\n }\n}" ]
[ "0.66363543", "0.65154916", "0.6301238", "0.62487996", "0.62001604", "0.6180978", "0.6143477", "0.60690796", "0.6034279", "0.6033834", "0.6007936", "0.5979", "0.5979", "0.5979", "0.5979", "0.5979", "0.5974789", "0.5945357", "0.59279394", "0.5925792", "0.5925008", "0.5914519", "0.5894848", "0.58471054", "0.5834404", "0.58335096", "0.58277303", "0.5820547", "0.5790492", "0.57782954", "0.57782954", "0.57763445", "0.57694924", "0.5753227", "0.57475287", "0.5746696", "0.5737623", "0.57266724", "0.571432", "0.5707561", "0.5705772", "0.56942403", "0.56942403", "0.56942403", "0.5693311", "0.5693311", "0.5693311", "0.5693311", "0.56929547", "0.5687331", "0.56865734", "0.5685013", "0.5670382", "0.5670036", "0.5663024", "0.5659405", "0.56562185", "0.56525207", "0.5630594", "0.56290704", "0.5622845", "0.5622845", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.56183934", "0.5608937", "0.55964243", "0.55941504", "0.5588983", "0.5580697", "0.55805033", "0.5578312", "0.5574869", "0.5569732", "0.55585486", "0.55532587", "0.5543835", "0.55396116", "0.5534834", "0.55316454", "0.5528547", "0.5528259", "0.5521996", "0.55219436", "0.5514982", "0.5510972", "0.55085224", "0.5507668", "0.54987264", "0.54912835", "0.5488002", "0.5487028" ]
0.7573604
0
the chained parameter means that this function call is chained from a previous request,
function processNextRequest(chained) { // two conditions where the next request should not be processed // 1. processing is true (a function chain is currently processing) and // chained is false (this function is not part of the current // processing function chain) // 2. requests.length is false (no requests are left to process) if ((processing && !chained) || !requests.length) { // if there are no requests left to process, but we are part of the current // processing function chain, we are done processing. if (chained) { processing = false; } return; } processing = true; var request = requests.shift(); var question = JSON.stringify({ command: request.command, arguments: request.arguments }) + '\n'; try { rl.question(question, (response) => { var res; try { res = JSON.parse(response) } catch (err) { res = { error: 'An error has occurred with the Agora backend.' } console.log(response); } request.callback(res); if (requests.length > 0) { // if there are requests remaining // keep the current processing chain going process.nextTick(function() { processNextRequest(true) }); } else { // else terminate the processing processing = false; } }) } catch (e) { requests.unshift(request); processing = false; // try again if it fails after 200 ms setTimeout(processNextRequest, 200); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "chain (_) {\n return this \n }", "chain(_) {\n return this\n }", "function yelpAPIcall(frmtName,frmtAddr,ratingsarray,chain) {\n\nvar yelptoken = \"Bearer dlVH8b6SrxR8hB3Qt-kp8oNeaDzXSYP5O_pG7Gy6Sm5E7PxMa_6wbrpY88thyflQ3KVJ8xg6eAtGO_oEYRtC8c9oXBTVsCSbJGzV65ohKSdKhEIDxqvvZxGP5X_lWXYx\";\nvar chriskey = \"55d9430e09095b44d75ece0c0380c9daf1946332\";\n\n request(proxyOptions('GET', frmtAddr)) \n .then(function (coordsResponse) {\n var coords = coordinates(coordsResponse);\n if (coords !== undefined) {\n return request({\n method: 'GET',\n url: csProxyUtils.buildProxyUrl(chrisKey, yelpRestaurantSearch(coords, frmtName)),\n headers: {\n \"authorization\": yelptoken\n }\n });\n } else {\n errorfunction();\n }\n })\n .then(function (detailsResponse) {\n var yelpPlace = JSON.parse(detailsResponse).businesses[0];\n // console.log(yelpPlace);\n ratingsarray.push(yelpPlace);\n\n //Calls next API function in the chain\n chain(frmtName,frmtAddr,ratingsarray,googleAPIcall);\n });\n}", "chain(chainFn) {\n return chain(chainFn, this);\n }", "function googleAPIcall (frmtName,frmtAddr,ratingsarray,chain) {\n\n request(proxyOptions('GET', frmtAddr)) \n .then(function (coordsResponse) {\n var coords = coordinates(coordsResponse);\n return request(proxyOptions('GET', googleDetailSearch(coords, frmtName)));\n })\n .then(function (detailsResponse) {\n \n return getRestaurant(frmtName, detailsResponse);\n })\n .then(function(restraurantResponse) {\n ratingsarray.push(restraurantResponse);\n console.log(ratingsarray);\n console.log(\"Google: \" + formatReview(restraurantResponse.rating));\n chain(frmtName,frmtAddr,ratingsarray,runwhendone)\n \n });\n\n\n}", "executeChain(request, lastResponse = null) {\n request = request || this.getNextRequest();\n request.mixWithLastResponse(lastResponse, this.finalResponse);\n\n request = this.applyMiddlewareTo(request);\n\n // If request body is array, we need split it to multiple requests\n if(request.body && request.body.length) {\n const RequestFactoryInstance = new RequestFactory();\n\n const responses = [];\n for(const index in request.body) {\n const CurrentRequest = RequestFactoryInstance.createRequestWith(\n request.alias, \n request.data, \n request.params\n );\n CurrentRequest.setBody(request.body[index]);\n\n // Execute request\n const promise = this.execute(CurrentRequest).then(response => {\n const NextRequest = this.getNextRequest();\n\n // Check for next request and recursively execute it\n if(NextRequest) {\n return this.executeChain(NextRequest, response);\n }\n\n return response;\n });\n\n // Add response to responses\n responses.push(promise);\n }\n\n // If final response there is, return it, if no, return last response\n return this.finalResponse || responses[responses.length - 1];\n }\n\n // If request body is object or just empty, pass it to execute\n const promise = this.execute(request).then(response => {\n const NextRequest = this.getNextRequest();\n\n // console.log(':: next request');\n // console.log(NextRequest);\n\n // Create final response from common response, if \n // in respons is not an array\n if((request.type && request.type !== 'common') && request.type) {\n if(!this.finalResponse) {\n this.finalResponse = {\n responses: {}\n };\n }\n\n this.finalResponse.responses[request.type] = response;\n } else {\n if(typeof response === 'object' && !('length' in response)) {\n if(!this.finalResponse) {\n this.finalResponse = {\n ...response,\n\n responses: {}\n };\n } else {\n this.finalResponse = {\n ... this.finalResponse,\n\n ...response\n }\n }\n }\n }\n\n // Check for next request and for request type\n if(NextRequest) {\n // IF request type is common or no request type, set final response\n if(request.type === 'common' || !request.type) {\n if(!this.finalResponse) {\n this.finalResponse = response;\n this.finalResponse.responses = {};\n } else {\n this.finalResponse = {\n ...this.finalResponse,\n\n ...response\n };\n }\n }\n\n // Pass next request to execute recursively\n return this.executeChain(NextRequest, response);\n }\n\n // Return final response\n return this.finalResponse || response;\n });\n\n return promise;\n }", "function PebbleChain () {}", "function chain( x, y){\r\n\tthis.X = x;\r\n\tthis.Y = y;\r\n\treturn this;\r\n}", "function callme(evt){\r\n console.log('good');\r\n const newWeatherZip = document.querySelector('#zip').value;\r\n const newWeatherFeelings = document.querySelector('#feelings').value;\r\n console.log(newWeatherZip,newWeatherFeelings);\r\n getWeatherData(owUrl,newWeatherZip,apiKey).then(function(weathData){\r\n var prova = {temperature:weathData.main.temp,date:newDate,userRes:newWeatherFeelings};\r\n console.log(prova)\r\n postData('http://localhost:8080/add',prova);\r\n \r\n }).then(updateUI())\r\n\r\n //we add the chained functions here\r\n /*var prova = {temperature:weathData.main.temp,date:newWeatherZip,userRes:newWeatherFeelings};\r\n console.log(prova);*/\r\n //postData('/add',prova);\r\n \r\n}", "function zomatoAPIcall (frmtName,frmtAddr,ratingsarray,chain) {\n\n var zomatokey = \"f73f1e3b1f28a94ae801eb97cf84f822\";\n\n request(proxyOptions('GET', frmtAddr)) \n .then(function (coordsResponse) {\n var coords = coordinates(coordsResponse);\n return request({\n method: 'POST',\n url: zomatoRestaurantSearch(coords, frmtName),\n headers: {\n \"user-key\": zomatokey\n }\n });\n })\n .then(function (detailsResponse) {\n var zomatoPlace = JSON.parse(detailsResponse).restaurants[0];\n if (zomatoPlace !== undefined) {\n ratingsarray.push(zomatoPlace);\n console.log(ratingsarray);\n console.log(\"Zomato: \" + formatReview(zomatoPlace.restaurant.user_rating.aggregate_rating));\n chain(frmtName,frmtAddr,ratingsarray,dbfind)\n }\n else {\n errorfunction();\n }\n\n });\n\n}", "function Chain() {\n var self = this;\n self._options = {\n method: self._ignore,\n name: 'index',\n parent: self._ignore,\n xhr: self._ignore\n };\n self._order = 0;\n}", "function Function$prototype$chain(f) {\n var chain = this;\n return function(x) { return f (chain (x)) (x); };\n }", "chain (fnA) {\n return fnA(this.value)\n }", "requestDidStart () { //to use put as argument -> requestContext\n // console.log('Request started! Query:\\n');\n // console.log(requestContext.request)\n return {\n didEncounterErrors (rc) {\n console.log(rc.errors);\n },\n\n };\n }", "chain() {\n return this.commandManager.chain();\n }", "function chain() {\n var functions = Array.prototype.slice.call(arguments, 0);\n if (functions.length > 0) {\n var firstFunction = functions.shift();\n var firstPromise = firstFunction.call();\n firstPromise.done(function () {\n chain.apply(null, functions);\n });\n }\n }", "function chain() {\n var functions = Array.prototype.slice.call(arguments, 0);\n if (functions.length > 0) {\n var firstFunction = functions.shift();\n var firstPromise = firstFunction.call();\n firstPromise.done(function () {\n chain.apply(null, functions);\n });\n }\n }", "function chain() {\n var functions = Array.prototype.slice.call(arguments, 0);\n if (functions.length > 0) {\n var firstFunction = functions.shift();\n var firstPromise = firstFunction.call();\n firstPromise.done(function () {\n chain.apply(null, functions);\n });\n }\n }", "function Function$prototype$chain(f) {\n var chain = this;\n return function(x) { return f(chain(x))(x); };\n }", "requestObject(request) {\n return request; \n }", "chain(chainFn) {\n return this.andThen(chainFn);\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "function chainResult(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n }", "static get chainErrors () { return 'nonhttp' }", "function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {\n // clang-format off\n return (initialRequest, finalHandlerFn) => injector.runInContext(() => interceptorFn(initialRequest, downstreamRequest => chainTailFn(downstreamRequest, finalHandlerFn)));\n // clang-format on\n}", "function chainMethod() {\n\n calculate(2)\n .then(function (result) {\n console.log(\"Then Here!!! \", result);\n return calculate(result);\n\n console.log(\"Never reach here Then-2 Here!!! \", result);\n })\n .catch(function (result) {\n console.log(\"Catch Here!!! \", result);\n return calculate(result + 1);\n\n console.log(\" Never reach here Catch-2 Here!!! \", result);\n })\n .then(function (result) {\n console.log(\"Finally!!! then \", result);\n })\n .catch(function (result) {\n console.log(\"Finally!!! catch \", result);\n });\n}", "buildChain (chain){ // chain is an array\n chain.forEach(link => this.addLink (link, this));\n }", "redirectChain() {\n throw new Error('Not implemented');\n }", "chain(f) {\n return f(this.value)\n }", "function Chain () {\n // Steps array\n this.stack = []\n this.steps = []\n this.currentStepIndex = 0\n}", "startPromiseChain() {\n this.showSubmit = false;\n this.selectedAccount = true;\n this.foundAccounts = false;\n this.isLoading = true;\n this.rowData.forEach(d => {\n this.SelectedAccId = d.accountId;\n this.SelectedAccName = d.name;\n this.SelectedAccPhone = d.phone;\n });\n // this is pormise chaining. We call the first promise, and in the .then, we return the next promise. This allows us to add another .then AFTER the original .than instead of nesting them. As long as a promise is being returned, you can continue to chain the .then's. Only one .catch is needed, as any errors will leave the promise chain and go into the .catch.\n getRelatedContactList({ id: this.SelectedAccId })\n .then((conResp) => {\n if (conResp && conResp.length > 0) {\n this.foundContacts = true;\n conResp.forEach((d, i) => {\n this.conData.push({\n id: d.Id,\n first: d.FirstName,\n last: d.LastName,\n email: d.Email\n })\n console.log(this.conData[i]);\n })\n }\n return getRelatedOpptyList({ id: this.SelectedAccId });\n })\n .then((oppResp) => {\n if (oppResp && oppResp.length > 0) {\n this.foundOpptys = true;\n oppResp.forEach((d, i) => {\n this.oppData.push({\n id: d.Id,\n stage: d.StageName,\n amount: d.Amount,\n source: d.LeadSource\n })\n console.log(this.oppData[i]);\n })\n }\n this.isLoading = false;\n })\n .catch((err) => {\n this.isLoading = false;\n this.dispatchEvent(\n new ShowToastEvent({\n title: 'Error',\n message: 'Error: ' + err.message,\n variant: 'error'\n })\n );\n });\n }", "function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state)}}", "chain(fn) {\n return fn(this._val);\n }", "ChainSelector() {\n\n }", "['fantasy-land/chain'](f) {\n return this.chain(f);\n }", "function Nothing$prototype$chain(f) {\n return this;\n }", "addRestChain (identifier){\n local_RestChains.push(identifier);\n }", "function chain(f) {\n return self => chain_(self, f);\n}", "request( method, endpoint, query = true, data = {}, loading = this.loading ) { \n\n // Validate the endpoint.\n if( this.utils().validate(method, endpoint) ) {\n\n // Save the endpoint and method.\n this.method = method;\n this.endpoint = endpoint;\n\n // Start loading.\n if( loading ) event.trigger('loading', true);\n \n // Generate a unique ID for the request.\n const pid = this.utils().pid();\n\n // Send the request.\n const request = $.ajax({\n dataType: 'json',\n url: this.utils().url(pid, query),\n method: method,\n data: data,\n context: this,\n cache: false\n }).always((response) => {\n \n // Capture response data.\n if( response.hasOwnProperty('paging') ) {\n \n const paging = {increments: this.paging.increments};\n \n this.$set(this, 'paging', $.extend(true, {}, paging, response.paging));\n \n }\n if( response.hasOwnProperty('filter') ) {\n \n this.$set(this, 'filter', $.extend(true, {}, response.filter));\n \n }\n if( response.hasOwnProperty('sort') ) {\n \n this.$set(this, 'sort', $.extend(true, {}, response.sort));\n \n }\n if( response.hasOwnProperty('index') ) {\n \n this.$set(this, 'indexing', $.extend(true, {}, response.index.data));\n this.index.order = response.index.order;\n \n }\n \n // Add the query string to the response data.\n response.query = query ? this.utils().query() : {};\n \n // End the loading animation.\n if( loading ) setTimeout(() => {\n \n event.trigger('loading', false);\n \n }, 250);\n\n });\n\n // Poll for request progress.\n this.progress(pid);\n \n // Return the request.\n return request;\n\n }\n\n }", "function showLatestRequest(){\n myContract.methods.getRequestCount().call().then(function(totalCount){\n console.log(\"-----------------------------------------------------------------\");\n console.log(\"Total Request count = \",totalCount);\n return totalCount;\n })\n .then(function(totalCount){\n //get Request pool \n myContract.methods.getRequestPool().call().then(function(pool){\n console.log(\"Active Request count = \",pool.length);\n console.log(\"Request Pool: \");\n console.log(pool); \n return totalCount; \n }).then(function(totalCount){\n //print Request detals (object)\n if(argv['debug']){\n myContract.methods.getRequest(totalCount-1).call().then(function(ret){\n console.log(\"-----------------------------------------------------------------\");\n console.log(\"Last Request: \", ret);\n //return ret;\n }).then(function(ret){\n if(argv['nl']) process.exit();\n });\n }\n else if(argv['nl']) process.exit();\n })\n })\n}", "getClientCalls() {\n\n }", "function pipe(context) {\r\n if (context.pipeline.length < 1) {\r\n _pnp_logging__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].write(\"[\" + context.requestId + \"] (\" + (new Date()).getTime() + \") Request pipeline contains no methods!\", 2 /* Warning */);\r\n }\r\n var promise = next(context).then(function (ctx) { return returnResult(ctx); }).catch(function (e) {\r\n _pnp_logging__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].error(e);\r\n throw e;\r\n });\r\n if (context.isBatched) {\r\n // this will block the batch's execute method from returning until the child requets have been resolved\r\n context.batch.addResolveBatchDependency(promise);\r\n }\r\n return promise;\r\n}", "function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(err){var entry=_this.entry;_this.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next;}if(state.corkedRequestsFree){state.corkedRequestsFree.next=_this;}else{state.corkedRequestsFree=_this;}};}", "myFunctions() {\n this.getUserInfo().then( this.getFollowers()).then(this.getFollowing()).then(this.props.route.params.userid=0)\n \n }", "function chain(f, chain_) {\n return Chain.methods.chain(chain_)(f);\n }", "function doRequest( next ) {\n\t jqXHR = $.ajax( ajaxOpts )\n\t .done( dfd.resolve )\n\t .fail( dfd.reject )\n\t .then( next, next );\n\t }", "function chainNext(p) {\n if (tasks.length) {\n const arg = tasks.shift();\n return p.then(() => {\n const operationPromise = self.func(arg.data);\n self.dequeue()\n return chainNext(operationPromise);\n })\n }\n return p;\n }", "function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state);};}", "function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state);};}", "function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state);};}", "function chain(f, chain_) {\n return Chain.methods.chain (chain_) (f);\n }", "_m_exec_http_request(ph_args, pf_process_next_in_queue) {\n const lo_this = this;\n\n const ph_query_opts = ph_args.ph_query_opts;\n\n const pf_json_callback = lo_this.m_pick_option(ph_args, \"pf_json_callback\");\n const pi_timeout_ms = lo_this.m_pick_option(ph_args, \"pi_timeout_ms\");\n const ps_call_context = lo_this.m_pick_option(ph_args, \"ps_call_context\");\n const ps_method = lo_this.m_pick_option(ph_args, \"ps_method\");\n const ps_url_end_point = lo_this.m_pick_option(ph_args, \"ps_url_end_point\");\n const ps_url_path = lo_this.m_pick_option(ph_args, \"ps_url_path\");\n\n const ls_url_full = f_join_non_blank_vals('', f_string_remove_trailing_slash(ps_url_end_point), ps_url_path);\n\n\n // credentials to call our own services\n const ps_http_pass = lo_this.m_pick_option(ph_args, \"ps_http_pass\", true);\n const ps_http_user = lo_this.m_pick_option(ph_args, \"ps_http_user\", true);\n\n /* eslint multiline-ternary:0, no-ternary:0 */\n const lh_auth = (f_string_is_blank(ps_http_pass) ? null : {\n user: ps_http_user,\n pass: ps_http_pass,\n sendImmediately: true\n });\n\n\n // one more call\n lo_this._ai_call_count_exec_total ++;\n f_chrono_start(lo_this._as_queue_chrono_name);\n\n // at first call\n if (lo_this._ab_first_call) {\n lo_this._ab_first_call = false;\n f_console_OUTGOING_CNX(`target=[${ls_url_full}] login=[${ps_http_user}] way=[push] comment=[connection ${lo_this.m_get_context(ps_call_context)}]`);\n }\n\n const ls_full_call_context = lo_this.m_get_context(`[#${lo_this._ai_call_count_exec_total}]`, ps_call_context);\n\n f_console_verbose(1, `${ls_full_call_context} - init`);\n\n // https://github.com/request/request#requestoptions-callback\n const lh_query_opts = f_object_extend({\n method: ps_method,\n url: ls_url_full,\n\n agent: false,\n auth: lh_auth,\n encoding: \"utf8\",\n json: true,\n rejectUnauthorized: false,\n requestCert: false,\n timeout: pi_timeout_ms,\n }, ph_query_opts);\n\n const ls_call_chrono_name = f_digest_md5_hex(f_join_non_blank_vals('~', lo_this._as_queue_chrono_name, lo_this._ai_call_count_exec_total, f_date_format_iso()));\n f_chrono_start(ls_call_chrono_name);\n\n\n // one more pending request in parallel...\n lo_this._ai_parallel_current ++;\n lo_this._ai_parallel_max = f_number_max(lo_this._ai_parallel_max, lo_this._ai_parallel_current);\n\n cm_request(lh_query_opts, function(ps_error, po_response, po_json_response) {\n\n // one less pending request in parallel...\n lo_this._ai_parallel_current --;\n\n const li_call_duration_ms = f_chrono_elapsed_ms(ls_call_chrono_name);\n f_console_verbose(2, `${ls_full_call_context} - call took [${f_human_duration(li_call_duration_ms, true)}]`);\n\n // collect stats\n lo_this._ai_call_duration_total_ms += li_call_duration_ms;\n lo_this._ai_call_duration_max_ms = f_number_max(lo_this._ai_call_duration_max_ms, li_call_duration_ms);\n lo_this._ai_call_duration_min_ms = f_number_min(lo_this._ai_call_duration_min_ms, li_call_duration_ms);\n\n try {\n\n // error ?\n if (f_string_is_not_blank(ps_error)) {\n throw f_console_error(`${ls_full_call_context} - ${ps_error}`);\n }\n\n const li_statusCode = po_response.statusCode;\n if (li_statusCode !== 200) {\n throw f_console_error(`${ls_full_call_context} - call returned statusCode=[${li_statusCode} / ${po_response.statusMessage}] on URL=[${ls_url_full}] - reponse=[${f_console_stringify(po_json_response)}]`);\n }\n\n if (f_is_not_defined(po_json_response)) {\n throw f_console_error(`${ls_full_call_context} - returned an empty body`);\n }\n\n f_console_verbose(3, `${ls_full_call_context} - returned statusCode=[${li_statusCode}] with raw response:`, {\n po_json_response: po_json_response\n });\n\n if (f_is_defined(po_json_response.errors)) {\n throw f_console_error(`${ls_full_call_context} - errors=[${f_console_stringify(po_json_response.errors)}]`);\n }\n\n if (f_is_defined(po_json_response.error)) {\n throw f_console_error(`${ls_full_call_context} - error=[${f_console_stringify(po_json_response.error)}]`);\n }\n\n // give a context to the reply\n po_json_response.as_call_context = ls_full_call_context;\n\n // positive feed-back through the call-back\n pf_json_callback(null, po_json_response);\n }\n\n catch (po_err) {\n f_console_catch(po_err);\n }\n\n // handle the next pending element in the queue\n f_console_verbose(2, `${lo_this.m_get_context()} - next in queue...`);\n pf_process_next_in_queue();\n });\n }", "function initData(data, chain) {\n console.log('initData', chain.getCurrentState());\n var newData = {\n firstName : 'John',\n secondName : 'Doe',\n id : '1',\n data : data\n };\n chain.next(newData);\n}", "function doFirst(request, response, next)\n{\n\tconsole.log(\"Bacon\"); // Whenever they make a request, they get to see bacon in the terminal\n\tnext(); // if this exists, then it will go to the next object in the stack\n}", "function Left$prototype$chain(f) {\n return this;\n }", "adoptedCallback() { }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function chain(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n }", "function createCurrentCallObject() {\n\n}", "setFromRQ(q) {\nRQ.setQV(this.xyzw, q.xyzw);\nreturn this;\n}", "joinCall(step) {\r\n if (step === 'select') {\r\n callOne = firstCallId; //getSelectedCall();\r\n } else if (step === 'join') {\r\n var callTwo = firstCallId; //getSelectedCall();\r\n console.log('Joining callOne (' + callOne + ') to callTwo (' + callTwo + ').');\r\n kandy.joinCall(callOne, callTwo);\r\n callOne = undefined;\r\n }\r\n }", "joinCall(step) {\r\n if (step === 'select') {\r\n callOne = firstCallId; //getSelectedCall();\r\n } else if (step === 'join') {\r\n var callTwo = firstCallId; //getSelectedCall();\r\n console.log('Joining callOne (' + callOne + ') to callTwo (' + callTwo + ').');\r\n kandy.joinCall(callOne, callTwo);\r\n callOne = undefined;\r\n }\r\n }", "function chainOperation(input) {\n opChain.push(input);\n}", "function generatePage(e){\r\n let zip = document.getElementById(\"zip\").value;\r\n let apiURL = baseURL+zip+apiKey+units;\r\n let feelings = document.getElementById(\"feelings\").value;\r\n\r\n //No semi-colon here as it would terminate \"getWeather\" and not allow the chaining to work\r\n getWeather(apiURL)\r\n //Combine it all\r\n .then(function(data){\r\n postData('/add', {temp: data.main.temp , date: today, feelings: feelings})\r\n })\r\n //Update the UI\r\n .then(()=> updateUI());\r\n}", "function pipe(context) {\n if (context.pipes.length < 1) {\n _pnp_logging__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].write(\"[\" + context.requestId + \"] (\" + (new Date()).getTime() + \") Request pipeline contains no methods!\", 3 /* Error */);\n throw Error(\"Request pipeline contains no methods!\");\n }\n var promise = next(context).then(function (ctx) { return returnResult(ctx); }).catch(function (e) {\n _pnp_logging__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].error(e);\n throw e;\n });\n if (context.isBatched) {\n // this will block the batch's execute method from returning until the child requests have been resolved\n context.batch.addResolveBatchDependency(promise);\n }\n return promise;\n}", "backtrackTheChain() {\r\n this.orderQueue.forEach(([waitingPromise, successCallback]) => {\r\n //if the passed arg is not a function simply return the observed value w.out executing\r\n if (typeof successCallback !== 'function') return waitingPromise.onFulfilled(this.val);\r\n const res = successCallback(this.val);\r\n if (res && res.then === 'function') { //check if promise\r\n res.then(val => waitingPromise.onFulfilled(val), val => waitingPromise.onRejected(val));\r\n } else {\r\n waitingPromise.onFulfilled(res);\r\n }\r\n })\r\n this.orderQueue = [];\r\n }", "customRequest(request){\n return this.axios(request)\n }", "function changeData(data, chain) {\n console.log('changeData');\n var newData = {\n user : data,\n posts : [\n 'post1',\n 'post2'\n ]\n };\n // async data flow\n setTimeout(function(){\n chain.next(newData);\n }, 1000);\n}", "async asyncPromiseChain() {\n\n this.showSubmit = false;\n this.selectedAccount = true;\n this.foundAccounts = false;\n this.isLoading = true;\n this.rowData.forEach(d => {\n this.SelectedAccId = d.accountId;\n this.SelectedAccName = d.name;\n this.SelectedAccPhone = d.phone;\n });\n\n let conResp = await getRelatedContactList({ id: this.SelectedAccId });\n if (conResp && conResp.length > 0) {\n conResp.forEach((d, i) => {\n this.conData.push({\n id: d.Id,\n first: d.FirstName,\n last: d.LastName,\n email: d.Email\n })\n console.log(this.conData[i]);\n })\n this.foundContacts = true;\n }\n let oppResp = await getRelatedOpptyList({ id: this.SelectedAccId });\n if (oppResp && oppResp.length > 0) {\n oppResp.forEach((d, i) => {\n this.oppData.push({\n id: d.Id,\n stage: d.StageName,\n amount: '$' + d.Amount,\n source: d.LeadSource\n })\n console.log(this.oppData[i]);\n })\n this.foundOpptys = true;\n }\n this.isLoading = oppResp != null && conResp != null;\n }", "function setThisWithCall(fn,thisValue,arg){\n // console.log(fn) //ƒ (){ return {thisValue: this, arguments: Array.from(arguments)} }\n // console.log(thisValue) //{name:bob}\n // console.log(arg) //18\n setResults= fn.call(thisValue,arg)\n // console.log(setResults)\n return setResults\n}//setThisWithCall", "function chained(functions) {\n // return an anonymous function that takes a value as an argument\n // this allows you to pass a value to reduce's callback function and set it as the initial value\n return function(value){\n // call the reduce method on the array of functions passed into chained and return it\n return functions.reduce(function(previousValue, currentValue, currentIndex, array){\n // evaluate the current function with the answer from the previous\n return currentValue(previousValue);\n //set the initial value to the value you want to call the first function with \n }, value);\n };\n}", "set chain (chain) {\n // Reset the chain\n this._chain.length = 0\n\n // And concat the new one,\n // never re-assign `this._chain`\n // or namespaces will loose reference\n this._chain.push(...chain)\n }", "get request() { return this._request; }", "_request(path, options = {}) {\n return _sendRequest(this.api, path, options);\n }", "function CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function (err) {\n var entry = _this.entry;\n _this.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = _this;\n } else {\n state.corkedRequestsFree = _this;\n }\n };\n }", "firstPass(ledger, { prev_api, curr_api, curr_chat }) {}", "function doRequest( next ) {\n jqXHR = $.ajax( ajaxOpts )\n .done( dfd.resolve )\n .fail( dfd.reject )\n .then( next, next );\n }", "function getChain () {\n\t\t /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected,\n\t\t default to null instead of returning the targeted elements so that utility function's return value is standardized. */\n\t\t if (isUtility) {\n\t\t return promiseData.promise || null;\n\t\t /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */\n\t\t } else {\n\t\t return elementsWrapped;\n\t\t }\n\t\t }", "function completeOutstandingRequest(fn){try{fn.apply(null,sliceArgs(arguments,1));}finally{outstandingRequestCount--;if(outstandingRequestCount===0){while(outstandingRequestCallbacks.length){try{outstandingRequestCallbacks.pop()();}catch(e){$log.error(e);}}}}}", "function completeOutstandingRequest(fn){try{fn.apply(null,sliceArgs(arguments,1));}finally{outstandingRequestCount--;if(outstandingRequestCount===0){while(outstandingRequestCallbacks.length){try{outstandingRequestCallbacks.pop()();}catch(e){$log.error(e);}}}}}", "function chain(list, params) {\n return new Promise(async (resolve, reject) => {\n try {\n const result = await (list.shift())(next, params)\n console.log('result:', result)\n // 如果有 结果返回, 或者 设置 一个标识字段,有了这个返回,就任务想提前终止责任链。\n if (result !== undefined) {\n resolve(result)\n }\n } catch (e) {\n reject(e)\n }\n\n function next(params) {\n if (list.length === 0) {\n console.log('即将 resolve...')\n resolve(params)\n } else {\n resolve(chain(list, params))\n }\n }\n })\n}", "getRestChains (identifier){\n return local_RestChains.slice(); \t\n }", "then (...args) {\n return originalThen.call(this, ...args);\n }", "function chained(ls){\n return _.reduce(ls, function(acc, l){\n return acc.then(l);\n }, identity);\n }", "function EventChain() {\n\tvar events = [];\n\tvar self = this;\n\t\n\t/**\n\t* @param fn - the function to invoke\n\t* @param responseObject - the object on which fn will raise an event when completed\n\t* @param responseEvent - the name of the event on the responseObject that will fire the next in the chain\n\t* @returns - the event chain\n\t*/\n\tthis.add = function(fn, responseObject, responseEvent /*, fn args */) {\n\t\tvar args = Array.prototype.slice.call(arguments).slice(3);\n\t\tevents.push({action: fn, obj: responseObject, evt: responseEvent, args: args});\n\t\treturn self;\n\t};\n\t\n\t/**\n\t* @param {Function} finalFn - optional, a function to execute when the chain is complete\n\t* @param {Array} finalFnArgs - optional, an array of arguments to pass to finalFN\n\t*/\n\tthis.execute = function(/*finalFn, [finalFnArgs]*/) {\n\t\tvar eventCount = events.length\n\t\tfor (var i = 0; i < eventCount - 1; i++) {\n\t\t\tvar event = events[i];\n\t\t\tevent.obj.addEventHandler(event.evt, events[i+1].action);\n\t\t}\n\t\tvar finalFn = arguments.length > 0 ? arguments[0] : null;\n\t\t\t\t\t\t\n\t\tvar lastEvent = events[eventCount - 1];\n\t\tlastEvent.obj.addEventHandler(\n\t\t\tlastEvent.evt, \n\t\t\tfunction() {\n\t\t\t\t//TODO: remove event handlers!\n\t\t\t\t//TODO: should we change the this pointer?\n\t\t\t\tif (finalFn) finalFn.apply(this, Array.prototype.slice.call(arguments).slice(1));\n\t\t\t\tself.raiseEvent(\"done\");\n\t\t\t});\n\t\t\n\t\tvar firstEvent = events[0];\n\t\tfirstEvent.action.apply(this, firstEvent.args);\n\t};\n}", "doRequestBy(alias, params = {}) {\n const RequestFactoryInstance = new RequestFactory();\n\n this.requests = RequestFactoryInstance.createRequestsBy(alias, params);\n\n // console.log(this.requests);\n\n return this.executeChain();\n }" ]
[ "0.6890434", "0.67132396", "0.60674584", "0.59699416", "0.59361625", "0.5879877", "0.5711041", "0.570187", "0.5629198", "0.55755967", "0.5561867", "0.55550146", "0.5540326", "0.55025655", "0.5474994", "0.5472789", "0.5472789", "0.5472789", "0.5466544", "0.5464811", "0.54187196", "0.54177105", "0.54177105", "0.54177105", "0.54177105", "0.54177105", "0.54177105", "0.54177105", "0.54177105", "0.54177105", "0.53857577", "0.5363938", "0.5361773", "0.5361334", "0.5347661", "0.5339179", "0.5326035", "0.5317533", "0.5312952", "0.5293727", "0.52417463", "0.5235439", "0.522628", "0.52060276", "0.5148131", "0.51180273", "0.5110102", "0.5093388", "0.50897616", "0.50786924", "0.5067052", "0.5063744", "0.50533795", "0.50492626", "0.50468487", "0.50468487", "0.50468487", "0.50443304", "0.50364745", "0.5033983", "0.50326014", "0.5021856", "0.5007324", "0.500567", "0.500567", "0.500567", "0.500567", "0.500567", "0.500567", "0.500567", "0.500567", "0.500567", "0.499875", "0.4988405", "0.49861428", "0.49861428", "0.49800214", "0.49779472", "0.49697474", "0.4964473", "0.49493983", "0.49448827", "0.4939354", "0.49277535", "0.49219948", "0.49055573", "0.4903107", "0.49020895", "0.4901827", "0.48963368", "0.4890783", "0.48893702", "0.48882177", "0.48882177", "0.48862973", "0.48846263", "0.48786348", "0.4873211", "0.48701742", "0.48679203" ]
0.56908596
8
prevent default action of these events on the drop area
function preventDefaults (e) { e.preventDefault(); e.stopPropagation(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onDrop() {\n this.disable();\n }", "function drop(ev){\r\n ev.preventDefault(ev);\r\n}", "function presb_allowDrop(ev) {\n\tev.preventDefault();\n}", "function allowDrop(ev) { ev.preventDefault(); }", "function allowDrop(ev){\nev.preventDefault();}", "function allowDrop(event) {\n //console.log(\"lo puedo_dejar_aqui\")\n event.preventDefault();\n}", "function allowDrop(event) {\r\n event.preventDefault();\r\n }", "function allowDrop(event) {\n event.preventDefault();\n }", "onDrop(evt) {\n\t\tevt.preventDefault();\n\t}", "function allowDrop(event) {\n event.preventDefault();\n}", "function allowDrop(event) {\n event.preventDefault();\n}", "function allowDrop(event) {\n event.preventDefault();\n}", "function allowDrop(event) {\n event.preventDefault();\n}", "function allowDrop(ev) {\r\n\tev.preventDefault();\r\n}", "function allowDrop(ev) {\r\n\tev.preventDefault();\r\n }", "function allowDrop(ev){\n\tev.preventDefault();\n}", "function allowDrop(event) {\r\n\tevent.preventDefault();\r\n}", "function drop(e) {\n e.preventDefault();\n}", "function allowDrop(event) {\n event.preventDefault();\n}", "function allowDrop(event) {\n event.preventDefault();\n }", "function allowDrop(ev) {\n\tev.preventDefault();\n}", "function allowDrop(ev) {\n\tev.preventDefault();\n}", "function allowDrop(ev) {\r\n ev.preventDefault();\r\n}", "function allowDrop(e){\n e.preventDefault();\n}", "function allowDrop(e) {\r\n e.preventDefault();\r\n}", "function allowDrop(ev)\n{\n\tev.preventDefault();\n}", "preventUnintendedDropEvents() {\n function preventDefault(e) { e.preventDefault(); }\n window.addEventListener(\"dragover\", preventDefault, false);\n window.addEventListener(\"drop\", preventDefault, false);\n }", "function allowDrop(e){\r\n e.preventDefault();\r\n}", "function allowDrop(e) {\n e.preventDefault();\n}", "function allowDrop(e) {\n e.preventDefault();\n}", "function allowDrop(e) {\n e.preventDefault()\n}", "function widgetAllowDrop(e) {\n e.preventDefault();\n }", "_ignoreDrop(evt) {\n if (!this.isDropTargetEnabled) return;\n if (evt.preventDefault) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n return false;\n }", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(e) {\r\n e.preventDefault();\r\n}", "function allowDrop(ev,idchanger) {\n\t\n ev.preventDefault();\n \n \n}", "function allowDrop (ev) {\n ev.preventDefault ();\n}", "function allowDrop(e) {\n e.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n ev.preventDefault();\n}", "function allowDrop(ev) {\n // Este ccódigo evita el comportamiento por defecto de este evento\n ev.preventDefault();\n}", "function allowDrop(event) {\n \"use strict\";\n event.preventDefault();\n}", "function allowDrop(ev) {// credit to https://www.w3schools.com/HTML/html5_draganddrop.asp\n ev.preventDefault();\n}", "disableItemDropIf(){\n\n }", "function onDragOver (e) {\n e.preventDefault()\n }", "function allowDrop(ev) {\n ev.preventDefault();\n console.log(\"allowDrop\");\n}", "function onDragOver(ev)\n{\n ev.preventDefault();\n}", "onDragOver(event) {\r\n if (this.state.inDropMode)\r\n event.preventDefault(); // Allows for dropping\r\n }", "function allowDropOrderList(event) {\n // Preventing default behaviour allows the ondrop event to fire.\n event.preventDefault();\n}", "function onDragOver(evt) {\n evt.preventDefault();\n}", "function dragOver(e) {\n e.preventDefault()\n }", "onDragOver(e){\n e.preventDefault();\n }", "function onDragOver(event) {\n event.preventDefault();\n}", "onDropHandler() {\n\t\tFSBL.Clients.WindowClient.cancelTilingOrTabbing({});\n\t}", "function dragOverHandler(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "onDragOver(evt) {\n\t\tevt.preventDefault();\n\t}", "function dragover(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "function onDragOver(event) {\n event.preventDefault();\n}", "onInternalInvalidDrop() {\n const me = this,\n { currentOverClient } = me;\n\n if (me.tip) {\n me.tip.hide();\n }\n\n me.drag.abort();\n\n // Documented on EventDrag & TaskDrag features\n currentOverClient.trigger(`after${currentOverClient.capitalizedEventName}Drop`, {\n [currentOverClient.scheduledEventName + 'Records']: me.dragData.draggedRecords,\n valid: false,\n context: me.dragData\n });\n }", "function dragOver(e) {\n e.preventDefault();\n}", "function dragOver(e) {\n e.preventDefault();\n}", "handleDrop(e) {\n e.stopPropagation();\n e.preventDefault();\n\n if (this.isDragInProgress) {\n handleDrop(getBaseComponent(this), this.dragMonitor);\n\n this.isOver = false;\n }\n\n return false;\n }", "function dragOver(e){\n\te.preventDefault();\n}", "function dragover(event) {\n // Prevent default in order to allow/enable the drop event to fire.\n event.preventDefault();\n }", "function onTrashcanDragover(event) {\n if (draggedWidget) {\n // Prevent default, allowing drop.\n event.preventDefault();\n }\n }", "function allow_meal_drop(event) {\n // By default, data/elements cannot be dropped in other elements.\n // To allow a drop, we must prevent the default handling of the element.\n // This is done by calling the event.preventDefault() method for the ondragover event\n event.preventDefault();\n}", "function handleDragOver(event) {\n\t\tevent.preventDefault();\n\t}", "_drop() {\n if (!this.element || !this.$()) { return; }\n\n let element = this.get('handle') ? this.$(this.get('handle')) : this.$();\n this._preventClick(element);\n\n this.set('isDragging', false);\n this.set('isDropping', true);\n\n this._tellGroup('update');\n\n this._waitForTransition()\n .then(run.bind(this, '_complete'));\n }", "onDrop(event) {\r\n event.preventDefault(); // Allows for dropping\r\n const data = event.dataTransfer.getData(\"text\");\r\n if (data == locationAncestor_type_1.dragAndDropName && this.state.inDropMode) {\r\n this.module.onDrop();\r\n }\r\n }", "function dragOver(e) {\n if (_isDraggingFile) {\n e.preventDefault();\n }\n }", "function dragOverHandler(ev) {\n // console.log('File(s) in drop zone');\n\n // Prevent default behavior (Prevent file from being opened)\n ev.preventDefault();\n}", "function editOnDragOver(e){this._internalDrag=false;this.setMode('drag');e.preventDefault();}", "function onWidgetDragover(event) {\n if (canDropOnWidget(this)) {\n // Prevent default, allowing drop.\n event.preventDefault();\n }\n }", "function drag_over(event) { \n event.preventDefault(); \n return false; \n }", "function allowDrop(ev) {\n\tev.preventDefault();\n\tconsole.log(ev.target);\n}", "function onWidgetDrop(event) {\n // Move the widget to the target widget.\n viewmodel.moveWidget(draggedWidget, viewmodel.getWidgetFromElementId(this.id));\n event.preventDefault();\n }", "handleDragOver(event) {\n event.preventDefault();\n }", "function dropper(event) {\n\n// Unregister the event handlers for mouseup and mousemove\n\n document.removeEventListener(\"mouseup\", dropper, true);\n document.removeEventListener(\"mousemove\", mover, true);\n\n// Prevent propagation of the event\n\n event.stopPropagation();\n} //** end of dropper", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function onDocumentDragOver(evt) {\n evt.preventDefault();\n}", "function allowDrop(ev) {\n //console.log(\"dragged id is: \" + draggedItem); // debug log\n let idWithoutNumber = ev.target.id.replace(/[0-9]/g, '');\n if (idWithoutNumber == draggedItem + \"Slot\" || idWithoutNumber == \"inventory\") {\n ev.preventDefault();\n }\n}" ]
[ "0.8396293", "0.8315724", "0.8175456", "0.8124752", "0.8047427", "0.8045716", "0.80389243", "0.80324674", "0.8024054", "0.8021333", "0.8021333", "0.8021333", "0.8021333", "0.8014659", "0.8006463", "0.8005092", "0.7994478", "0.79842836", "0.7974591", "0.7974373", "0.7966192", "0.7966192", "0.7951041", "0.79443073", "0.79408854", "0.7930041", "0.7928096", "0.7927909", "0.7925633", "0.7925633", "0.79220194", "0.79171675", "0.79120004", "0.78848493", "0.78848493", "0.78848493", "0.78848493", "0.78848493", "0.78848493", "0.78848493", "0.78848493", "0.78795946", "0.7866385", "0.7856551", "0.78502905", "0.784549", "0.784549", "0.784549", "0.784549", "0.784549", "0.784549", "0.784549", "0.784549", "0.784549", "0.784549", "0.78204876", "0.7723634", "0.76053846", "0.7546397", "0.75424963", "0.75172323", "0.751213", "0.745128", "0.74378365", "0.7390513", "0.7325349", "0.72994673", "0.7291899", "0.728803", "0.72647536", "0.7261929", "0.7246381", "0.7238423", "0.7209255", "0.72035897", "0.7191019", "0.7185431", "0.71846884", "0.716144", "0.71540946", "0.71456116", "0.7145105", "0.71430594", "0.71126527", "0.70864075", "0.70815676", "0.706041", "0.7040334", "0.70277905", "0.7024459", "0.7018802", "0.7014287", "0.70006907", "0.69899195", "0.69899195", "0.69899195", "0.69899195", "0.69899195", "0.69899195", "0.69899195", "0.6977782" ]
0.0
-1
Add header in statistics table to group metrics by category format
function summaryTableHeader(header) { var newRow = header.insertRow(-1); newRow.className = "tablesorter-no-sort"; var cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 1; cell.innerHTML = "Requests"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 3; cell.innerHTML = "Executions"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 6; cell.innerHTML = "Response Times (ms)"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 1; cell.innerHTML = "Throughput"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 2; cell.innerHTML = "Network (KB/sec)"; newRow.appendChild(cell); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\r\n var newRow = header.insertRow(-1);\r\n newRow.className = \"tablesorter-no-sort\";\r\n var cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 1;\r\n cell.innerHTML = \"Requests\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 3;\r\n cell.innerHTML = \"Executions\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 7;\r\n cell.innerHTML = \"Response Times (ms)\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 1;\r\n cell.innerHTML = \"Throughput\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 2;\r\n cell.innerHTML = \"Network (KB/sec)\";\r\n newRow.appendChild(cell);\r\n}", "function summaryTableHeader(header) {\r\n var newRow = header.insertRow(-1);\r\n newRow.className = \"tablesorter-no-sort\";\r\n var cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 1;\r\n cell.innerHTML = \"Requests\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 3;\r\n cell.innerHTML = \"Executions\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 7;\r\n cell.innerHTML = \"Response Times (ms)\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 1;\r\n cell.innerHTML = \"Throughput\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 2;\r\n cell.innerHTML = \"Network (KB/sec)\";\r\n newRow.appendChild(cell);\r\n}", "function summaryTableHeader(header) {\r\n var newRow = header.insertRow(-1);\r\n newRow.className = \"tablesorter-no-sort\";\r\n var cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 1;\r\n cell.innerHTML = \"Requests\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 3;\r\n cell.innerHTML = \"Executions\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 7;\r\n cell.innerHTML = \"Response Times (ms)\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 1;\r\n cell.innerHTML = \"Throughput\";\r\n newRow.appendChild(cell);\r\n\r\n cell = document.createElement('th');\r\n cell.setAttribute(\"data-sorter\", false);\r\n cell.colSpan = 2;\r\n cell.innerHTML = \"Network (KB/sec)\";\r\n newRow.appendChild(cell);\r\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 6;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 3;\n cell.innerHTML = \"Executions\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 7;\n cell.innerHTML = \"Response Times (ms)\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Throughput\";\n newRow.appendChild(cell);\n\n cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 2;\n cell.innerHTML = \"Network (KB/sec)\";\n newRow.appendChild(cell);\n}", "showSevCatStats() {\n const stats = this.sevcatStats;\n const systems = {};\n for (let severity in stats) {\n for (let category in stats[severity]) {\n for (let system in stats[severity][category]) {\n if (!systems[system]) systems[system] = 0;\n systems[system] += stats[severity][category][system];\n }\n }\n }\n const systemsList = Object.keys(systems);\n const colspan = systemsList.length || 1;\n const th = document.getElementById('marot-sevcat-stats-th');\n th.colSpan = colspan;\n\n systemsList.sort((sys1, sys2) => systems[sys2] - systems[sys1]);\n\n let rowHTML = '<tr><td></td><td></td><td></td>';\n for (const system of systemsList) {\n rowHTML += `<td><b>${system == this.TOTAL ? 'Total' : system}</b></td>`;\n }\n rowHTML += '</tr>\\n';\n this.sevcatStatsTable.insertAdjacentHTML('beforeend', rowHTML);\n\n const sevKeys = Object.keys(stats);\n sevKeys.sort();\n for (const severity of sevKeys) {\n this.sevcatStatsTable.insertAdjacentHTML(\n 'beforeend', `<tr><td colspan=\"${3 + colspan}\"><hr></td></tr>`);\n const sevStats = stats[severity];\n const catKeys = Object.keys(sevStats);\n catKeys.sort(\n (k1, k2) => sevStats[k2][this.TOTAL] - sevStats[k1][this.TOTAL]);\n for (const category of catKeys) {\n const row = sevStats[category];\n let rowHTML = `<tr><td>${severity}</td><td>${category}</td><td></td>`;\n for (const system of systemsList) {\n const val = row.hasOwnProperty(system) ? row[system] : '';\n rowHTML += `<td>${val ? val : ''}</td>`;\n }\n rowHTML += '</tr>\\n';\n this.sevcatStatsTable.insertAdjacentHTML('beforeend', rowHTML);\n }\n }\n }", "function accordionHeader(category, i, filteredEntriesCount, filterString) {\n var hasFilterString = (filterString !== undefined && filterString.length > 0);\n var opened = (hasFilterString && filteredEntriesCount > 0) || filteredEntriesCount == 0;\n\n return '' +\n '<div class=\"panel\">' +\n ' <div class=\"panel-heading collapsed\" data-toggle=\"collapse\" data-target=\"#accordion'+i+'\">' +\n ' <h3 class=\"panel-title\">' +\n '<i class=\"fa\" aria-hidden=\"true\"></i>&nbsp;' + category.title +\n ' </h3>' +\n ' </div>' +\n ' <div id=\"accordion'+i+'\" class=\"panel-collapse collapse ' + ((opened) ? 'in': '') + '\">' +\n ' <div class=\"panel-body\">' +\n ' <div class=\"table-responsive\"><table class=\"table table-hover\" name=\"' + category.short + '\">';\n}", "_configureColumnHeader (column) {\n if (column.action) {\n return column.title;\n }\n var result = [];\n /*var filterView;\n for (var type in this.dataTypeToFilterTypeMapping) {\n if (type === column.dataType) {\n filterView = this.dataTypeToFilterTypeMapping[type];\n }\n }*/\n\n /*if (column.groupText) {\n result[0] = { content:\"columnGroup\", closed:true, batch: column.batch, groupText: column.groupText, colspan:12};\n }*/\n result[result.length] = column.title;\n\n return result;\n }", "getSummaryHeader(){\n\t//=================================\n\t//get contents\n\tvar add_header = Object.keys(this.summaryColumns);\n\t//append the datasource id\n\tadd_header = add_header.map(element => element + \" [\" + this.short_id + \"]\")\n\treturn add_header;\n\t}", "function Header(props) {\r\n\tvar ths = [];\r\n\tfor (var groupName of props.groupNames) {\r\n\t\tths.push(\r\n\t\t\t<th key={groupName}>\r\n\t\t\t\t{showGroupColumnHeader(groupName, props.onDeleteGroup, props.onAddAllMembersToGroup)}\r\n\t\t\t</th>\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<thead>\r\n\t\t\t<tr height=\"30px\" valign=\"middle\">\r\n\t\t\t\t<th width=\"20%\"></th>\r\n\t\t\t\t{ths}\r\n\t\t\t\t<th width=\"5%\"></th>\r\n\t\t\t</tr>\r\n\t\t</thead>\r\n\t);\r\n}", "function createHeader() {\r\n var head = document.querySelector('thead');\r\n newRow = addElement('tr', '', head);\r\n addElement('th', '', newRow);\r\n\r\n for (var i = 0; i < times.length; i++) {\r\n addElement('th', times[i], newRow);\r\n }\r\n\r\n addElement('th', 'Total', newRow);\r\n}", "function appendStatHeader(table, headerText) {\n\tvar thead = document.createElement('thead');\n\tvar row = thead.insertRow(0);\n\tvar cell = row.insertCell(0);\n\tcell.colSpan = '2';\n\tcell.className = 'stats-head';\n\tcell.appendChild(document.createTextNode(headerText));\n\ttable.appendChild(thead);\n}", "function make_headers (table){\n\n var i = 0;\n var headers = d3.select(\"#\" + table).selectAll(\"th\");\n\n var length = headers.nodes().length;\n var lmi = [\"Indicator\", \"Value\"];\n var comm = [\"Commute\", \"Share\", \"\"];\n var edu = [\"Education\", \"Share\", \"\"];\n var occ = [\"National Occupational Classification\", \"Market Population\", \"Public Service\"];\n\n switch (table){\n case \"LMI\":\n for (i = 0; i < length; i++) {\n headers.nodes()[i].innerHTML = lmi[i];\n }\n break;\n\n case \"comm_tbl\":\n for (i = 0; i < length; i++) {\n headers.nodes()[i].innerHTML = comm[i];\n }\n break;\n\n case \"edu_tbl\":\n for (i = 0; i < length; i++) {\n headers.nodes()[i].innerHTML = edu[i];\n }\n break;\n\n case \"LMI_PS\":\n for (i = 0; i < length; i++) {\n headers.nodes()[i].innerHTML = occ[i];\n }\n break;\n }\n}", "function renderHeader() {\n var tableHeader = document.createElement('tr')\n table.append(tableHeader)\n var cityLabel = document.createElement('th');\n cityLabel.textContent = 'Store Location';\n tableHeader.append(cityLabel);\n for (var i = 0; i < hours.length; i++) {\n var headerCellHour = document.createElement('th');\n headerCellHour.textContent = hours[i];\n tableHeader.append(headerCellHour);\n }\n var dailyTotalLabel = document.createElement('th');\n dailyTotalLabel.textContent = 'End of day Sales'\n tableHeader.append(dailyTotalLabel)\n}", "function createHeader(layout) {\n\n\t\tvar columns = [],\n\t\t\t$thead = $('<thead />');\n\n\t\tlayout.qHyperCube.qDimensionInfo.forEach(function(d) {\n\t\t\tcolumns.push(capitalizeFirstLetter(d.qFallbackTitle));\n\t\t})\n\n\t\tcolumns.push(layout.qHyperCube.qMeasureInfo[0].qFallbackTitle);\n\n\t\tcolumns.forEach(function(d, i) {\n\t\t\tif (i == 1) {\n\t\t\t\t$('<th colspan=\"2\" class=\"col col' + (i + 1) + '\">' + d + '</th>').appendTo($thead);\n\t\t\t} else {\n\t\t\t\t$('<th class=\"col col' + (i + 1) + '\">' + d + '</th>').appendTo($thead);\n\t\t\t}\n\t\t})\n\t\treturn $thead;\n\t}", "function categoryTable() { }", "function create_thead() {\n var schema = _store.active_columns();\n var total = _store.active_rows()['total'];\n var html = [ '<tr>' ];\n\n // create header\n schema.forEach( function ( column ) {\n html.push( '<td class=\"', column['key'], ' ' );\n html.push( column['type'], '\">' );\n html.push( column['label'] );\n html.push( '</td>' );\n });\n\n html.push( '</tr>' );\n\n // create total row\n if( !!total ) {\n html.push( '<tr style=\"background-color: #3b3b3b\">' );\n\n schema.forEach( function ( column ) {\n html.push( '<td class=\"', column['key'], ' ' );\n html.push( column['type'], '\">' );\n html.push( total['data'][ column['key'] ] );\n html.push( '</td>' );\n });\n\n html.push( '</tr>' );\n }\n $('#data-table > thead').append( html.join('') );\n }", "function assembleSeriesWithCategoryAxis(groups) {\n\t var tables = [];\n\t each(groups, function (group, key) {\n\t var categoryAxis = group.categoryAxis;\n\t var valueAxis = group.valueAxis;\n\t var valueAxisDim = valueAxis.dim;\n\t var headers = [' '].concat(map(group.series, function (series) {\n\t return series.name;\n\t })); // @ts-ignore TODO Polar\n\t\n\t var columns = [categoryAxis.model.getCategories()];\n\t each(group.series, function (series) {\n\t var rawData = series.getRawData();\n\t columns.push(series.getRawData().mapArray(rawData.mapDimension(valueAxisDim), function (val) {\n\t return val;\n\t }));\n\t }); // Assemble table content\n\t\n\t var lines = [headers.join(ITEM_SPLITER)];\n\t\n\t for (var i = 0; i < columns[0].length; i++) {\n\t var items = [];\n\t\n\t for (var j = 0; j < columns.length; j++) {\n\t items.push(columns[j][i]);\n\t }\n\t\n\t lines.push(items.join(ITEM_SPLITER));\n\t }\n\t\n\t tables.push(lines.join('\\n'));\n\t });\n\t return tables.join('\\n\\n' + BLOCK_SPLITER + '\\n\\n');\n\t }", "function createBulkImportHeader() {\n var caption = '<span class=\"table-caption\">Bulk&nbsp;Import' +\n '&nbsp;Status</span><br>';\n\n $('<caption/>', {\n html: caption\n }).appendTo('#masterBulkImportStatus');\n\n var items = [];\n\n var columns = ['Directory&nbsp;', 'Age&nbsp;', 'State&nbsp;'];\n\n var titles = ['', descriptions['Import Age'], descriptions['Import State']];\n\n /*\n * Adds the columns, add sortTable function on click,\n * if the column has a description, add title taken from the global.js\n */\n for (i = 0; i < columns.length; i++) {\n var first = i == 0 ? true : false;\n items.push(createHeaderCell(first, 'sortTable(1,' + i + ')',\n titles[i], columns[i]));\n }\n\n $('<tr/>', {\n html: items.join('')\n }).appendTo('#masterBulkImportStatus');\n}", "function createHeader() {\n var tr = document.createElement('tr');\n table.appendChild(tr);\n\n for (i = 0; i < 17; i++) {\n var th = document.createElement('th');\n if (i == 0) {\n th.textContent = 'Store Name';\n } else if (i < 16) {\n th.textContent = hoursOpen[i - 1];\n } else {\n th.textContent = 'Daily Location Total';\n }\n tr.appendChild(th);\n }\n}", "renderHeader() {\r\n const hasCustomColumnsWidth = this.columnsWidth.length > 0;\r\n const dataColumns = this.getVisibleColumns().map((column) => {\r\n // filter\r\n let filter = null;\r\n if (this.showFilters) {\r\n let filterValue = '';\r\n if (this.filters && this.filters[column.name]) {\r\n filterValue = this.filters[column.name];\r\n }\r\n filter = (h(\"div\", null,\r\n h(\"kup-text-input\", { class: \"datatable-filter\", initialValue: filterValue, \"data-col\": column.name, onKetchupTextInputUpdated: (e) => {\r\n this.onFilterChange(e, column.name);\r\n } })));\r\n }\r\n // sort\r\n let sort = null;\r\n if (this.sortEnabled) {\r\n sort = (h(\"span\", { class: \"column-sort\" },\r\n h(\"span\", { role: \"button\", \"aria-label\": \"Sort column\" // TODO\r\n , class: 'mdi ' + this.getSortIcon(column.name), onClick: (e) => this.onColumnSort(e, column.name) })));\r\n }\r\n let thStyle = null;\r\n if (hasCustomColumnsWidth) {\r\n for (let i = 0; i < this.columnsWidth.length; i++) {\r\n const currentCol = this.columnsWidth[i];\r\n if (currentCol.column === column.name) {\r\n const width = currentCol.width.toString() + 'px';\r\n thStyle = {\r\n width,\r\n minWidth: width,\r\n maxWidth: width,\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n const columnMenuItems = [];\r\n // adding grouping\r\n const group = this.getGroupByName(column.name);\r\n const groupLabel = group != null\r\n ? 'Disattiva raggruppamento'\r\n : 'Attiva raggruppamento';\r\n columnMenuItems.push(h(\"li\", { role: \"menuitem\", onClick: () => this.switchColumnGroup(group, column.name) },\r\n h(\"span\", { class: \"mdi mdi-book\" }),\r\n groupLabel));\r\n columnMenuItems.push(h(\"li\", { role: \"menuitem\", onClick: () => this.kupAddColumn.emit({ column: column.name }) },\r\n h(\"span\", { class: \"mdi mdi-table-column-plus-after\" }),\r\n \"Aggiungi colonna\"));\r\n let columnMenu = null;\r\n if (columnMenuItems.length !== 0) {\r\n const menuClass = this.openedMenu === column.name ? 'open' : 'closed';\r\n columnMenu = (h(\"div\", { class: `column-menu ${menuClass}` },\r\n h(\"ul\", { role: \"menubar\" }, columnMenuItems)));\r\n }\r\n // Check if columns are droppable and sets their handlers\r\n // TODO set better typing.\r\n let dragHandlers = {};\r\n if (this.enableSortableColumns) {\r\n // Reference for drag events and what they permit or not\r\n // https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-p\r\n dragHandlers = {\r\n draggable: true,\r\n onDragStart: (e) => {\r\n // Sets drag data and the type of drag\r\n e.dataTransfer.setData(KupDataTableColumnDragType, JSON.stringify(column));\r\n e.dataTransfer.effectAllowed = 'move';\r\n // Remember that the current target is different from the one print out in the console\r\n // Sets which element has started the drag\r\n e.target.setAttribute(this.dragStarterAttribute, '');\r\n this.theadRef.setAttribute(this.dragFlagAttribute, '');\r\n this.columnsAreBeingDragged = true;\r\n },\r\n onDragLeave: (e) => {\r\n if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {\r\n e.target.removeAttribute(this.dragOverAttribute);\r\n }\r\n },\r\n onDragOver: (e) => {\r\n if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {\r\n const overElement = e.target;\r\n overElement.setAttribute(this.dragOverAttribute, '');\r\n // If element can have a drop effect\r\n if (!overElement.hasAttribute(this.dragStarterAttribute) &&\r\n this.columnsAreBeingDragged) {\r\n e.preventDefault(); // Mandatory to allow drop\r\n e.dataTransfer.effectAllowed = 'move';\r\n }\r\n else {\r\n e.dataTransfer.effectAllowed = 'none';\r\n }\r\n }\r\n },\r\n onDragEnd: (e) => {\r\n // When the drag has ended, checks if the element still exists or it was destroyed by the JSX\r\n const dragStarter = e.target;\r\n if (dragStarter) {\r\n // IF it still exists, removes the attribute so that it can perform a new drag again\r\n dragStarter.removeAttribute(this.dragStarterAttribute);\r\n }\r\n this.theadRef.removeAttribute(this.dragFlagAttribute);\r\n this.columnsAreBeingDragged = false;\r\n },\r\n onDrop: (e) => {\r\n if (e.dataTransfer.types.indexOf(KupDataTableColumnDragType) >= 0) {\r\n const transferredData = JSON.parse(e.dataTransfer.getData(KupDataTableColumnDragType));\r\n e.preventDefault();\r\n e.target.removeAttribute(this.dragOverAttribute);\r\n // We are sure the tables have been dropped in a valid location -> starts sorting the columns\r\n this.handleColumnSort(column, transferredData);\r\n }\r\n },\r\n };\r\n }\r\n let columnClass = {};\r\n if (column.obj) {\r\n columnClass = {\r\n number: isNumber(column.obj),\r\n };\r\n }\r\n return (h(\"th\", Object.assign({ class: columnClass, style: thStyle, onMouseEnter: () => this.onColumnMouseEnter(column.name), onMouseLeave: () => this.onColumnMouseLeave(column.name) }, dragHandlers),\r\n h(\"span\", { class: \"column-title\" }, column.title),\r\n sort,\r\n filter,\r\n columnMenu));\r\n });\r\n let multiSelectColumn = null;\r\n if (this.multiSelection) {\r\n const style = {\r\n width: '30px',\r\n margin: '0 auto',\r\n };\r\n multiSelectColumn = (h(\"th\", { style: style },\r\n h(\"input\", { type: \"checkbox\", onChange: (e) => this.onSelectAll(e), title: `selectedRow: ${this.selectedRows.length} - renderedRows: ${this.renderedRows.length}`, checked: this.selectedRows.length > 0 &&\r\n this.selectedRows.length ===\r\n this.renderedRows.length })));\r\n }\r\n let groupColumn = null;\r\n if (this.isGrouping() && this.hasTotals()) {\r\n groupColumn = h(\"th\", null);\r\n }\r\n let actionsColumn = null;\r\n if (this.hasRowActions()) {\r\n actionsColumn = h(\"th\", null);\r\n }\r\n return [multiSelectColumn, groupColumn, actionsColumn, ...dataColumns];\r\n }", "function tableHeader() {\n var headerTop = document.getElementById('SalesReport');\n var row = document.createElement('tr');\n headerTop.appendChild(row);\n var tableData = document.createElement('th');\n row.appendChild(tableData);\n for (var i = 0; i < hoursOfOperation.length; i++) {\n var hourHead = document.createElement('th');\n hourHead.innerText = hoursOfOperation[i];\n row.appendChild(hourHead);\n };\n var totalHead = document.createElement('th');\n totalHead.innerText = ('Daily Location Total');\n row.appendChild(totalHead);\n}", "function timeHeader(){\n var trEl = document.createElement('tr');\n var thLocation= document.createElement('th');\n thLocation.textContent='Location';\n trEl.appendChild(thLocation);\n for (var i=0; i<operatingHours.length; i++){\n var thEl=document.createElement('th');\n thEl.textContent = operatingHours[i];\n trEl.appendChild(thEl);\n }\n var totalEachLocation=document.createElement('th');\n totalEachLocation.textContent='Total';\n trEl.appendChild(totalEachLocation);\n report.appendChild(trEl);\n}", "renderHeader(headerContainerElement) {\n const {\n store,\n grid\n } = this;\n\n if (store.isGrouped) {\n // Sorted from start, reflect in rendering\n for (const groupInfo of store.groupers) {\n // Might be grouping by field without column, which is valid\n const column = grid.columns.get(groupInfo.field),\n header = column && grid.getHeaderElement(column.id); // IE11 doesnt support this\n //header && header.classList.add('b-group', groupInfo.ascending ? 'b-asc' : 'b-desc');\n\n if (header) {\n header.classList.add('b-group');\n header.classList.add(groupInfo.ascending ? 'b-asc' : 'b-desc');\n }\n }\n }\n }", "function assembleSeriesWithCategoryAxis(groups) {\n var tables = [];\n util[\"k\" /* each */](groups, function (group, key) {\n var categoryAxis = group.categoryAxis;\n var valueAxis = group.valueAxis;\n var valueAxisDim = valueAxis.dim;\n var headers = [' '].concat(util[\"H\" /* map */](group.series, function (series) {\n return series.name;\n })); // @ts-ignore TODO Polar\n\n var columns = [categoryAxis.model.getCategories()];\n util[\"k\" /* each */](group.series, function (series) {\n var rawData = series.getRawData();\n columns.push(series.getRawData().mapArray(rawData.mapDimension(valueAxisDim), function (val) {\n return val;\n }));\n }); // Assemble table content\n\n var lines = [headers.join(ITEM_SPLITER)];\n\n for (var i = 0; i < columns[0].length; i++) {\n var items = [];\n\n for (var j = 0; j < columns.length; j++) {\n items.push(columns[j][i]);\n }\n\n lines.push(items.join(ITEM_SPLITER));\n }\n\n tables.push(lines.join('\\n'));\n });\n return tables.join('\\n\\n' + BLOCK_SPLITER + '\\n\\n');\n}", "renderHeader() {\n const self = this;\n const headerRows = { left: '', center: '', right: '' };\n let uniqueId;\n\n // Handle Nested Headers\n const colGroups = this.settings.columnGroups;\n if (colGroups) {\n this.element.addClass('has-group-headers');\n\n const columns = this.settings.columns;\n const columnsLen = columns.length;\n const visibleColumnsLen = this.visibleColumns().length;\n const groups = colGroups.map(group => parseInt(group.colspan, 10));\n const getGroupsTotal = () => groups.reduce((a, b) => a + b, 0);\n const getDiff = () => {\n const groupsTotal = getGroupsTotal();\n return groupsTotal > columnsLen ? groupsTotal - columnsLen : columnsLen - groupsTotal;\n };\n\n headerRows.left += '<tr role=\"row\" class=\"datagrid-header-groups\">';\n headerRows.center += '<tr role=\"row\" class=\"datagrid-header-groups\">';\n headerRows.right += '<tr role=\"row\" class=\"datagrid-header-groups\">';\n\n const groupsTotal = getGroupsTotal();\n let diff;\n if (groupsTotal > columnsLen) {\n let move = true;\n for (let i = groups.length - 1; i >= 0 && move; i--) {\n diff = getDiff();\n if (groups[i] >= diff) {\n groups[i] -= diff;\n move = false;\n } else {\n groups[i] = 0;\n }\n }\n }\n\n let i = 0;\n let total = 0;\n groups.forEach((groupColspan, k) => {\n let colspan = groupColspan;\n for (let l = i + groupColspan; i < l; i++) {\n if (i < columnsLen && columns[i].hidden) {\n colspan--;\n }\n }\n const hiddenStr = colGroups[k].hidden || colspan < 1 ? ' class=\"is-hidden\"' : '';\n const colspanStr = ` colspan=\"${colspan > 0 ? colspan : 1}\"`;\n const groupedHeaderAlignmentClass = colGroups[k].align ? `l-${colGroups[k].align}-text` : '';\n uniqueId = self.uniqueId(`-header-group-${k}`);\n if (colspan > 0) {\n total += colspan;\n }\n\n const container = self.getContainer(self.settings.columns[k].id);\n headerRows[container] += `<th${hiddenStr}${colspanStr} id=\"${uniqueId}\" class=\"${groupedHeaderAlignmentClass}\"><div class=\"datagrid-column-wrapper\"><span class=\"datagrid-header-text\">${colGroups[k].name}</span></div></th>`;\n });\n\n if (total < visibleColumnsLen) {\n diff = visibleColumnsLen - total;\n const colspanStr = ` colspan=\"${diff > 0 ? diff : 1}\"`;\n if (self.hasRightPane) {\n headerRows.right += `<th${colspanStr}></th>`;\n } else {\n headerRows.center += `<th${colspanStr}></th>`;\n }\n }\n\n if (this.settings.spacerColumn) {\n headerRows.center += '<th class=\"datagrid-header-groups-spacer-column\"></th>';\n }\n\n headerRows.left += '</tr><tr>';\n headerRows.center += '</tr><tr>';\n headerRows.right += '</tr><tr>';\n } else {\n headerRows.left += '<tr role=\"row\">';\n headerRows.center += '<tr role=\"row\">';\n headerRows.right += '<tr role=\"row\">';\n }\n\n for (let j = 0; j < this.settings.columns.length; j++) {\n const column = self.settings.columns[j];\n const container = self.getContainer(column.id);\n const id = self.uniqueId(`-header-${j}`);\n const isSortable = (column.sortable === undefined ? true : column.sortable);\n const isResizable = (column.resizable === undefined ? true : column.resizable);\n const isExportable = (column.exportable === undefined ? true : column.exportable);\n const isSelection = column.id === 'selectionCheckbox';\n const headerAlignmentClass = this.getHeaderAlignmentClass(column);\n\n // Make frozen columns hideable: false\n if ((self.hasLeftPane || self.hasRightPane) &&\n (self.settings.frozenColumns.left &&\n self.settings.frozenColumns.left.indexOf(column.id) > -1 ||\n self.settings.frozenColumns.right &&\n self.settings.frozenColumns.right.indexOf(column.id) > -1)) {\n column.hideable = false;\n }\n\n // Ensure hidable columns are marked as such\n if (column.hideable === undefined) {\n column.hideable = true;\n }\n\n // Assign css classes\n let cssClass = '';\n cssClass += isSortable ? ' is-sortable' : '';\n cssClass += isResizable ? ' is-resizable' : '';\n cssClass += column.hidden ? ' is-hidden' : '';\n cssClass += column.filterType ? ' is-filterable' : '';\n cssClass += column.textOverflow === 'ellipsis' ? ' text-ellipsis' : '';\n cssClass += column?.headerIcon ? ' header-icon' : '';\n cssClass += column?.headerCssClass ? ` ${column.headerCssClass}` : '';\n cssClass += headerAlignmentClass !== '' ? headerAlignmentClass : '';\n\n // Apply css classes\n cssClass = cssClass !== '' ? ` class=\"${cssClass.substr(1)}\"` : '';\n let ids = utils.stringAttributes(this, this.settings.attributes, `col-${column.id?.toLowerCase()}`);\n\n if (!ids) {\n ids = `id=\"${id}\"`;\n }\n\n headerRows[container] += `<th scope=\"col\" role=\"columnheader\" ${ids} ${isSelection ? ' aria-checked= \"false\"' : ''} data-column-id=\"${column.id}\"${column.field ? ` data-field=\"${column.field}\"` : ''}${column.headerTooltip ? ` title=\"${column.headerTooltip}\"` : ''}${column.headerTooltipCssClass ? ` tooltipClass=\"${column.headerTooltipCssClass}\"` : ''}${column.reorderable === false ? ' data-reorder=\"false\"' : ''}${colGroups ? ` headers=\"${self.getColumnGroup(j)}\"` : ''} data-exportable=\"${isExportable ? 'yes' : 'no'}\"${cssClass}>`;\n\n let sortIndicator = '';\n if (isSortable) {\n sortIndicator = `${'<div class=\"sort-indicator\">' +\n '<span class=\"sort-asc\">'}${$.createIcon({ icon: 'dropdown' })}</span>` +\n `<span class=\"sort-desc\">${$.createIcon({ icon: 'dropdown' })}</div>`;\n }\n\n // If header text is center aligned, for proper styling,\n // place the sortIndicator as a child of datagrid-header-text.\n\n const svgHeaderTooltip = column?.headerIconTooltip !== undefined || column?.headerIconTooltip?.length > 0 ? column?.headerIconTooltip : '';\n const svgHeaderIcon = `\n <svg class=\"icon datagrid-header-icon\" focusable=\"false\" aria-hidden=\"true\" role=\"presentation\" title=\"${svgHeaderTooltip}\">\n <use href=\"#icon-${column.headerIcon}\"></use>\n </svg>\n `;\n\n headerRows[container] += `<div class=\"${isSelection ? 'datagrid-checkbox-wrapper ' : 'datagrid-column-wrapper'}${headerAlignmentClass}\">\n <span class=\"datagrid-header-text${column.required ? ' required' : ''}\">${self.headerText(this.settings.columns[j])}${headerAlignmentClass === ' l-center-text' ? sortIndicator : ''}</span>\n ${this.settings.columns[j]?.headerIcon ? svgHeaderIcon : ''}`;\n\n if (isSelection) {\n if (self.settings.showSelectAllCheckBox) {\n headerRows[container] += '<span class=\"datagrid-checkbox\" aria-label=\"Selection\" role=\"checkbox\" tabindex=\"0\"></span>';\n } else {\n headerRows[container] += '<span class=\"datagrid-checkbox\" aria-label=\"Selection\" role=\"checkbox\" style=\"display:none\" tabindex=\"0\"></span>';\n }\n }\n\n // Note the space in classname.\n // Place sortIndicator via concatenation if\n // header text is not center aligned.\n if (isSortable && headerAlignmentClass !== ' l-center-text') {\n headerRows[container] += sortIndicator;\n }\n\n headerRows[container] += `</div>${self.filterRowHtml(column, j)}</th>`;\n }\n\n // Set Up Spacer column\n if (this.settings.spacerColumn) {\n headerRows.center += '<th class=\"datagrid-header-spacer-column\"></th>';\n }\n\n headerRows.left += '</tr>';\n headerRows.center += '</tr>';\n headerRows.right += '</tr>';\n\n // Set Up Header Panes\n if (self.headerRow === undefined) {\n if (self.hasLeftPane) {\n self.headerRowLeft = $(`<thead class=\"datagrid-header left\" role=\"rowgroup\">${headerRows.left}</thead>`);\n self.tableLeft.find('colgroup').after(self.headerRowLeft);\n }\n\n self.headerRow = $(`<thead class=\"datagrid-header center\"> role=\"rowgroup\"${headerRows.center}</thead>`);\n self.table.find('colgroup').after(self.headerRow);\n\n if (self.hasRightPane) {\n self.headerRowRight = $(`<thead class=\"datagrid-header right\" role=\"rowgroup\">${headerRows.right}</thead>`);\n self.tableRight.find('colgroup').after(self.headerRowRight);\n }\n } else {\n if (self.hasLeftPane) {\n DOM.html(self.headerRowLeft, headerRows.left, '*');\n }\n\n DOM.html(self.headerRow, headerRows.center, '*');\n\n if (self.hasRightPane) {\n DOM.html(self.headerRowRight, headerRows.right, '*');\n }\n }\n\n if (colGroups && self.headerRow) {\n self.colGroups = $.makeArray(this.container.find('.datagrid-header-groups th'));\n }\n\n self.syncHeaderCheckbox(this.settings.dataset);\n self.setScrollClass();\n self.attachFilterRowEvents();\n\n if (self.settings.columnReorder) {\n self.createDraggableColumns();\n }\n\n this.restoreSortOrder = false;\n this.setSortIndicator(this.sortColumn.sortId, this.sortColumn.sortAsc);\n\n if (this.restoreFilter) {\n this.restoreFilter = false;\n this.applyFilter(this.savedFilter, 'restore');\n this.savedFilter = null;\n } else if (this.filterExpr && this.filterExpr.length > 0) {\n this.setFilterConditions(this.filterExpr);\n }\n\n this.activeEllipsisHeaderAll();\n\n // Set the color background header (light and dark)\n (self?.settings?.headerBackgroundColor === 'light') ? //eslint-disable-line\n (self?.headerRowLeft?.addClass('light'), self?.headerRow?.addClass('light'), self?.headerRowRight?.addClass('light')) :\n (self?.headerRow?.addClass('dark'), self?.headerRowRight?.addClass('dark'), self?.headerRowLeft?.addClass('dark'));\n }", "function addColumnHeadings(el, header) {\n var headerRow = $('<tr/>').appendTo(header);\n var breakpointsByIdx = [];\n var srcSettings = el.settings.sourceObject.settings;\n var aggInfo = srcSettings.aggregation;\n if (el.settings.autoResponsiveCols) {\n // Build list of breakpoints to use by column position.\n $.each(el.settings.responsiveOptions.breakpoints, function eachPoint(name, point) {\n var i;\n for (i = Math.round(point / 100); i < el.settings.columns.length; i++) {\n while (breakpointsByIdx.length < i + 1) {\n breakpointsByIdx.push([]);\n }\n breakpointsByIdx[i].push(name);\n }\n });\n }\n if (el.settings.responsive) {\n $('<th class=\"footable-toggle-col\" data-sort-ignore=\"true\"></th>').appendTo(headerRow);\n }\n $.each(el.settings.columns, function eachColumn(idx) {\n var colDef = el.settings.availableColumnInfo[this.field];\n var heading = colDef.caption;\n var footableExtras = '';\n var sortableField = false;\n // Tolerate hyphen or camelCase.\n var hideBreakpoints = colDef.hideBreakpoints || colDef['hide-breakpoints'];\n var dataType = colDef.dataType || colDef['data-type'];\n if (srcSettings.mode === 'docs') {\n // Either a standard field, or a special field which provides an\n // associated sort field.\n sortableField = (indiciaData.esMappings[this.field] && indiciaData.esMappings[this.field].sort_field) ||\n indiciaData.fieldConvertorSortFields[this.field.simpleFieldName()];\n } else if (srcSettings.mode === 'compositeAggregation') {\n // CompositeAggregation can sort on any field column, not aggregations.\n sortableField = !(aggInfo[this.field] || this.field === 'doc_count');\n } else if (srcSettings.mode === 'termAggregation') {\n // Term aggregations allow sort on the aggregation cols, or fields if\n // numeric or date, but not normal text fields.\n sortableField = aggInfo[this.field] || this.field === 'doc_count' ||\n (indiciaData.esMappings[this.field] && !indiciaData.esMappings[this.field].type.match(/^(text|keyword)$/));\n }\n if (el.settings.sortable !== false && sortableField) {\n heading += '<span class=\"sort fas fa-sort\"></span>';\n }\n // Extra data attrs to support footable.\n if (el.settings.autoResponsiveCols) {\n footableExtras = ' data-hide=\"' + breakpointsByIdx[idx].join(',') + '\"';\n } else if (hideBreakpoints) {\n footableExtras = ' data-hide=\"' + hideBreakpoints + '\"';\n }\n if (dataType) {\n footableExtras += ' data-type=\"' + dataType + '\"';\n }\n $('<th class=\"col-' + idx + '\" data-field=\"' + this.field + '\"' + footableExtras + '>' + heading + '</th>')\n .appendTo(headerRow);\n });\n if (el.settings.actions.length) {\n $('<th class=\"col-actions\"></th>').appendTo(headerRow);\n }\n if (el.settings.tbodyHasScrollBar) {\n // Spacer in header to allow for scrollbar in body.\n $('<th class=\"scroll-spacer\"></th>').appendTo(headerRow);\n }\n }", "function buildNewsTableHeader() {\n\n var thead = d3.select(\"#news-header\");\n console.log(\"buildNewsTableHeader:\", thead);\n\n thead.html(\"\");\n var tr = thead.append(\"tr\");\n\n tr.append(\"th\")\n .attr(\"scope\", \"col\")\n .text(\"#\"); \n\n tr.append(\"th\")\n .attr(\"scope\", \"col\")\n .text(\"Source\");\n\n tr.append(\"th\")\n .attr(\"scope\", \"col\")\n .text(\"Title\");\n \n tr.append(\"th\")\n .attr(\"scope\", \"col\") \n .text(\"Image\")\n}", "function generateHeader() {\n var tableRow = document.createElement('tr');\n var blank = document.createElement('th');\n tableRow.appendChild(blank);\n for (var i = 0; i < clock.length; i++) {\n var tableHead = document.createElement('th');\n tableHead.textContent = clock[i];\n tableRow.appendChild(tableHead);\n }\n var total = document.createElement('th');\n total.textContent = 'Daily Location Total';\n tableRow.appendChild(total);\n parentElement.appendChild(tableRow);\n}", "function RenderHeader() {\n var tabletext = AddTableHeader('Name');\n let click_periods = manual_periods.concat(limited_periods);\n let times_shown = GetShownPeriodKeys();\n times_shown.forEach((period)=>{\n let header = period_info.header[period];\n if (click_periods.includes(period)) {\n let is_available = CU.period_available[CU.usertag][CU.current_username][period];\n let link_class = (manual_periods.includes(period) ? 'cu-manual' : 'cu-limited');\n let header_class = (!is_available ? 'cu-process' : '');\n let counter_html = (!is_available ? '<span class=\"cu-display\" style=\"display:none\">&nbsp;(<span class=\"cu-counter\">...</span>)</span>' : '');\n tabletext += AddTableHeader(`<a class=\"${link_class}\">${header}</a>${counter_html}`,`class=\"cu-period-header ${header_class}\" data-period=\"${period}\"`);\n } else {\n tabletext += AddTableHeader(header,`class=\"cu-period-header\" data-period=\"${period}\"`);\n }\n });\n return AddTableHead(AddTableRow(tabletext));\n}", "function createHeader() {\n var caption = [];\n\n caption.push('<span class=\"table-caption\">Master&nbsp;Status</span><br>');\n\n $('<caption/>', {\n html: caption.join('')\n }).appendTo('#masterStatus');\n\n var items = [];\n\n var columns = ['Master&nbsp;', '#&nbsp;Online<br>Tablet&nbsp;Servers&nbsp;',\n '#&nbsp;Total<br>Tablet&nbsp;Servers&nbsp;', 'Last&nbsp;GC&nbsp;',\n '#&nbsp;Tablets&nbsp;', '#&nbsp;Unassigned<br>Tablets&nbsp;',\n 'Entries&nbsp;', 'Ingest&nbsp;', 'Entries<br>Read&nbsp;',\n 'Entries<br>Returned&nbsp;', 'Hold&nbsp;Time&nbsp;',\n 'OS&nbsp;Load&nbsp;'];\n\n var titles = [descriptions['Master'], descriptions['# Online Tablet Servers'],\n descriptions['# Total Tablet Servers'], descriptions['Last GC'],\n descriptions['# Tablets'], '', descriptions['Total Entries'],\n descriptions['Total Ingest'], descriptions['Total Entries Read'],\n descriptions['Total Entries Returned'], descriptions['Max Hold Time'],\n descriptions['OS Load']];\n\n /*\n * Adds the columns, add sortTable function on click,\n * if the column has a description, add title taken from the global.js\n */\n for (i = 0; i < columns.length; i++) {\n var first = i == 0 ? true : false;\n items.push(createHeaderCell(first, 'sortMasterTable(' + i + ')',\n titles[i], columns[i]));\n }\n\n $('<tr/>', {\n html: items.join('')\n }).appendTo('#masterStatus');\n}", "renderHeader(headerContainerElement) {\n let me = this,\n grid = me.grid,\n groupers = me.store.groupers;\n\n // Sorted from start, reflect in rendering\n for (let groupInfo of groupers) {\n // Might be grouping by field without column, which is valid\n const column = grid.columns.get(groupInfo.field),\n header = column && grid.getHeaderElement(column.id);\n // IE11 doesnt support this\n //header && header.classList.add('b-group', groupInfo.ascending ? 'b-asc' : 'b-desc');\n if (header) {\n header.classList.add('b-group');\n header.classList.add(groupInfo.ascending ? 'b-asc' : 'b-desc');\n }\n }\n }", "_createGroupHeader(data, selection, container) {\r\n const that = this,\r\n groupLabel = that.columnByDataField[data.groupDataField].label,\r\n groupHeader = document.createElement('tr'),\r\n cell = document.createElement('td'),\r\n cellInnerContainer = document.createElement('div'),\r\n arrow = document.createElement('div'),\r\n label = document.createElement('div');\r\n\r\n groupHeader.data = data;\r\n arrow.classList.add('hierarchy-arrow', 'smart-arrow', 'smart-arrow-down');\r\n arrow.setAttribute('role', 'button');\r\n arrow.setAttribute('aria-label', 'Toggle row');\r\n label.classList.add('group-label')\r\n label.innerHTML = `${groupLabel}: <span class=\"group-label-value\">${data.label}</span>`;\r\n cell.colSpan = that._columns.length;\r\n cell.classList.add('group-header');\r\n\r\n if (data.level) {\r\n cell.classList.add('outline-level-' + Math.min(data.level, 10));\r\n\r\n if (that._isCollapsed(data)) {\r\n groupHeader.setAttribute('aria-hidden', true);\r\n groupHeader.classList.add('collapsed', 'smart-hidden');\r\n }\r\n }\r\n\r\n groupHeader.setAttribute('row-id', data.$.id);\r\n\r\n cellInnerContainer.appendChild(arrow);\r\n cellInnerContainer.appendChild(label);\r\n cell.appendChild(cellInnerContainer);\r\n\r\n if (selection) {\r\n groupHeader.appendChild(document.createElement('td'));\r\n }\r\n\r\n groupHeader.appendChild(cell);\r\n container.appendChild(groupHeader);\r\n }", "function formatIndexPage() {\r\n\r\n // grab the th header titles\r\n var dev = document.evaluate(\r\n \"//table[3]//th\", \r\n document, \r\n null, \r\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n \r\n // create 3 new holding cells for the titles\r\n var x = document.createElement('td');\r\n x.className = 'thTop';\r\n x.width = '50';\r\n x.height = '28';\r\n x.align = 'center';\r\n//\tx.noWrap = dev.snapshotItem(1).getAttribute('nowrap');\r\n // copy 'Topic' text\r\n // could have just created some text nodes - but the the text \"may\" change in the future??\r\n x.appendChild(dev.snapshotItem(1).firstChild.cloneNode(false));\r\n var y = x.cloneNode(true);\r\n // copy 'Post' text\r\n y.replaceChild(dev.snapshotItem(2).firstChild.cloneNode(false), y.firstChild);\r\n var z = x.cloneNode(true);\r\n // copy 'Last Post' text\r\n z.replaceChild(dev.snapshotItem(3).firstChild.cloneNode(false), z.firstChild);\r\n z.removeAttribute('width');\r\n \r\n // got what we need, remove the last 3 th cells from the header\r\n for (i = 1; i < dev.snapshotLength; i++)\r\n dev.snapshotItem(i).parentNode.removeChild(dev.snapshotItem(i));\r\n // and replace with a full width \"colspan=3\" cell\r\n dev = dev.snapshotItem(0).parentNode.appendChild(document.createElement('th'));\r\n dev.className = 'thTop';\r\n dev.height = '28';\r\n dev.colSpan = '3';\r\n\r\n // now find all the forum category headers\r\n dev = document.evaluate(\r\n \"//table[3]//td[@class='catLeft']/parent::tr\", \r\n document, \r\n null, \r\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n // and insert the created holding cells in place of the original single cells\r\n for (i = 0; i < dev.snapshotLength; i++) {\r\n var c = dev.snapshotItem(i);\r\n c.replaceChild(x.cloneNode(true), c.getElementsByTagName('td')[1]);\r\n c.appendChild(y.cloneNode(true));\r\n c.appendChild(z.cloneNode(true));\r\n }\r\n\r\n // finally create a largish blank row before each category header row - not the first one!\r\n for (i = 1; i < dev.snapshotLength; i++) {\r\n var c = dev.snapshotItem(i).parentNode.insertBefore(document.createElement('tr'),dev.snapshotItem(i));\r\n c = c.appendChild(document.createElement('td'));\r\n c.className = 'spacerow';\r\n c.height = '50';\r\n c.colSpan = '5';\r\n }\r\n}", "function MatSortHeaderColumnDef() {}", "function renderHeader () {\n var trEl = document.createElement('tr');\n\n var headerTitles = ['', 'Daily Location Total'];\n for(var i = 0; i < headerTitles.length; i++) {\n //'for each pass, this code will run'\n var thEl = document.createElement('th');//create\n thEl.textContent = headerTitles[i];//add content\n trEl.appendChild(thEl);//append this table header element into a row\n }\n for(var i = 0; i < openHours.length; i++) {\n var thEl = document.createElement('th');\n thEl.textContent = openHours[i];\n trEl.appendChild(thEl);\n }\n cookiesTable.appendChild(trEl);\n}", "function addHeaders(ranks) {\n\t\tvar row = document.createElement(\"tr\");\n\t\t// Add a header for each year and inject row into graph\n\t\tfor (var i = 0; i < ranks.length; i++) {\n\t\t\tvar header = document.createElement(\"th\");\n\t\t\theader.innerHTML = ranks[i].getAttribute(\"year\");\n\t\t\trow.appendChild(header);\n\t\t}\n\t\tdocument.getElementById(\"graph\").appendChild(row);\n\t}", "function header(){\n var thE1 = document.createElement('th');\n var trE1 = document.createElement('tr');\n thE1.textContent = 'Store Locations';\n trE1.appendChild(thE1);\n\n for (var i = 0; i < hourList.length; i++){\n thE1 = document.createElement('th');\n thE1.textContent = hourList[i];\n trE1.appendChild(thE1);\n }\n thE1 = document.createElement('th');\n thE1.textContent ='Daily location Totals: ';\n trE1.appendChild(thE1);\n var salesTable = document.getElementById('tabl');\n salesTable.appendChild(trE1);\n}", "function renderHeader() {\n\n var headerRow = document.createElement('tr');\ntable.appendChild(headerRow);\n\nvar emptyCell = document.createElement('td');\nheaderRow.appendChild(emptyCell);\n\n\nfor (let i = 0; i < hoursArray.length; i++) {\n var tableHeader = document.createElement('th')\n tableHeader.textContent = hoursArray[i];\n headerRow.appendChild(tableHeader);\n\n\n}\n\nvar totalHeader = document.createElement('th');\ntotalHeader.textContent = 'Daily Location Total';\nheaderRow.appendChild(totalHeader);\n\n \n \n}", "function addAllColumnHeaders(data){\n /* Uses columnSet to create table headers */\n var headerTr$ = $('<tr/>');\n for (var i = 0 ; i < columnSet.length; i++){\n headerTr$.append($('<th/>').html(columnSet[i]));\n }\n $(params.table_name).append(headerTr$);\n }", "function subHeader(schema, concat) {\n colspan = Object.keys(schema.tree).reduce(function(memo, key){\n return memo+addToHeader(key, path+concat+key, schema.tree[key], level+1)\n }, 0);\n if (typeof schema.options.strict === 'boolean' && !schema.options.strict) {\n colspan += 1;\n // add special column for mixed objects\n headers[level+1].push({name: name+concat+'*', colspan: 1, nested:false, path: name+concat+'*'})\n }\n nested = true;\n return colspan;\n }", "function createServerBulkHeader() {\n var caption = [];\n\n caption.push('<span class=\"table-caption\">TabletServer&nbsp;Bulk&nbsp;' +\n 'Import&nbsp;Status</span><br>');\n\n $('<caption/>', {\n html: caption.join('')\n }).appendTo('#bulkImportStatus');\n\n var items = [];\n\n var columns = ['Server&nbsp;', '#&nbsp;', 'Oldest&nbsp;Age&nbsp;'];\n\n var titles = ['', descriptions['# Imports'], descriptions['Oldest Age']];\n\n /*\n * Adds the columns, add sortTable function on click,\n * if the column has a description, add title taken from the global.js\n */\n for (i = 0; i < columns.length; i++) {\n var first = i == 0 ? true : false;\n items.push(createHeaderCell(first, 'sortTable(0,' + i + ')',\n titles[i], columns[i]));\n }\n\n $('<tr/>', {\n html: items.join('')\n }).appendTo('#bulkImportStatus');\n}", "function populateHeadersInGameTable(array) {\n for (let i = 0; i < array.length; i++) {\n let $generatedGameTableCategoriesHTML =\n $(`<td class=\" category-card category ${i}\">${String(array[i].title)}</td>`)\n $gameCategoryRow.append($generatedGameTableCategoriesHTML);\n }\n}", "function createSalesTableHeader() {\n // Create the first header column\n var trEl = document.createElement('tr'); //create the row\n var thEl = document.createElement('th'); //create the first column cell\n thEl.textContent = 'Location';\n trEl.appendChild(thEl);\n\n // Create the header body\n for (var t = 0; t < storeHours.length; t++){\n var tdEl = document.createElement('th'); //create a cell for each column of time\n tdEl.textContent = storeHours[t];\n trEl.appendChild(tdEl);\n }\n\n // Create last header column\n thEl = document.createElement('th');\n thEl.textContent = 'Daily Total';\n trEl.appendChild(thEl);\n\n salesTable.appendChild(trEl);\n}", "function displayHeaderGrid() {\n console.log(`\\n\\n`);\n console.log(`=========================================================================================`);\n console.log(`| # | Product | Category | Price | Qty |`);\n console.log(`=========================================================================================`);\n}", "function makeCatStats() {\n return {\n total: 0, // expected total count\n categorized: 0, // categorized total count\n correct: 0, // categorized correct count\n correctSeenCount: 0, // for OVERALL recall computation\n };\n }", "function list(items) {\r\n\t\t\t\tvar l, j, key, k, col;\r\n\t\t\t\tfor (key in items) { // iterate\r\n\t\t\t\t\tif (items.hasOwnProperty(key)) {\r\n\t\t\t\t\t// write amount of spaces according to level\r\n\t\t\t\t\t// and write name and newline\r\n\t\t\t\t\t\tif(typeof items[key] !== \"object\") {\r\n\t\t\t\t\t\t\t// If not a object build the header of the appropriate level\r\n\t\t\t\t\t\t\tif( key === 'level') {\r\n\t\t\t\t\t\t\t\tif(lastval[items.level] === undefined) {\r\n\t\t\t\t\t\t\t\t\tlastval[items.level] ='';\r\n\t\t\t\t\t\t\t\t\tif(items.level>0 && items.text !== '_r_Totals') {\r\n\t\t\t\t\t\t\t\t\t\theaders[items.level-1] = {\r\n\t\t\t\t\t\t\t\t\t\t\tuseColSpanStyle: false,\r\n\t\t\t\t\t\t\t\t\t\t\tgroupHeaders: []\r\n\t\t\t\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(lastval[items.level] !== items.text && items.children.length && items.text !== '_r_Totals') {\r\n\t\t\t\t\t\t\t\t\tif(items.level>0) {\r\n\t\t\t\t\t\t\t\t\t\theaders[items.level-1].groupHeaders.push({\r\n\t\t\t\t\t\t\t\t\t\t\ttitleText: items.text\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\tvar collen = headers[items.level-1].groupHeaders.length,\r\n\t\t\t\t\t\t\t\t\t\tcolpos = collen === 1 ? swaplen : initColLen+(collen-1)*aggrlen;\r\n\t\t\t\t\t\t\t\t\t\theaders[items.level-1].groupHeaders[collen-1].startColumnName = columns[colpos].name;\r\n\t\t\t\t\t\t\t\t\t\theaders[items.level-1].groupHeaders[collen-1].numberOfColumns = columns.length - colpos;\r\n\t\t\t\t\t\t\t\t\t\tinitColLen = columns.length;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tlastval[items.level] = items.text;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// This is in case when the member contain more than one summary item\r\n\t\t\t\t\t\t\tif(items.level === ylen && key==='level' && ylen >0) {\r\n\t\t\t\t\t\t\t\tif( aggrlen > 1){\r\n\t\t\t\t\t\t\t\t\tvar ll=1;\r\n\t\t\t\t\t\t\t\t\tfor( l in items.fields) {\r\n\t\t\t\t\t\t\t\t\t\tif(ll===1) {\r\n\t\t\t\t\t\t\t\t\t\t\theaders[ylen-1].groupHeaders.push({startColumnName: l, numberOfColumns: 1, titleText: items.text});\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tll++;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\theaders[ylen-1].groupHeaders[headers[ylen-1].groupHeaders.length-1].numberOfColumns = ll-1;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\theaders.splice(ylen-1,1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// if object, call recursively\r\n\t\t\t\t\t\tif (items[key] != null && typeof items[key] === \"object\") {\r\n\t\t\t\t\t\t\tlist(items[key]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Finally build the coulumns\r\n\t\t\t\t\t\tif( key === 'level') {\r\n\t\t\t\t\t\t\tif(items.level >0){\r\n\t\t\t\t\t\t\t\tj=0;\r\n\t\t\t\t\t\t\t\tfor(l in items.fields) {\r\n\t\t\t\t\t\t\t\t\tcol = {};\r\n\t\t\t\t\t\t\t\t\tfor(k in o.aggregates[j]) {\r\n\t\t\t\t\t\t\t\t\t\tif(o.aggregates[j].hasOwnProperty(k)) {\r\n\t\t\t\t\t\t\t\t\t\t\tswitch( k ) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'member':\r\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'label':\r\n\t\t\t\t\t\t\t\t\t\t\t\tcase 'aggregator':\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcol[k] = o.aggregates[j][k];\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(aggrlen>1) {\r\n\t\t\t\t\t\t\t\t\t\tcol.name = l;\r\n\t\t\t\t\t\t\t\t\t\tcol.label = o.aggregates[j].label || l;\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tcol.name = items.text;\r\n\t\t\t\t\t\t\t\t\t\tcol.label = items.text==='_r_Totals' ? o.rowTotalsText : items.text;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tcolumns.push (col);\r\n\t\t\t\t\t\t\t\t\tj++;\r\n\t\t\t\t\t\t\t\t}\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}", "function addAllColumnHeaders(Cases_Status_Information, selector) {\r\n var columnSet = [];\r\n var headerTr$ = $(\"<tr/>\");\r\n\r\n for (var i = 0; i < Cases_Status_Information.length; i++) {\r\n var rowHash = Cases_Status_Information[i];\r\n for (var key in rowHash) {\r\n if ($.inArray(key, columnSet) == -1) {\r\n columnSet.push(key);\r\n headerTr$.append($(\"<th/>\").html(key));\r\n }\r\n }\r\n }\r\n $(selector).append(headerTr$);\r\n\r\n return columnSet;\r\n}", "function header() {\n let tableHeadingRow = document.createElement('tr');\n table.append(tableHeadingRow);\n let tableHeading = document.createElement('th');\n tableHeadingRow.append(tableHeading);\n\n for (let i = 0; i<hours.length; i++){\n tableHeading = document.createElement('th');\n tableHeadingRow.append(tableHeading);\n tableHeading.textContent = ' '+hours[i]+ ' ';\n }\n // last heading\n let tableHeading2 = document.createElement('th');\n tableHeadingRow.append(tableHeading2);\n tableHeading2.textContent = 'Daily Location Total';\n}", "function columnate(...columnGroupOpts) {\n const columnGroups = columnGroupOpts.map(([label, list]) => ({\n label,\n width: 0,\n list: list.reverse(),\n columns: [],\n }))\n\n while (!columnGroups.every(group => !group.list.length)) {\n columnGroups.forEach(group => {\n while (group.list.length) {\n const column = {\n width: 0,\n rows: [],\n }\n group.columns.push(column)\n\n // HEADER + SPACE\n for (let rowIndex = 0; rowIndex < tableHeight - 1 - PADDING_V; rowIndex++) {\n if (!group.list.length) break\n const item = group.list.pop()\n column.rows.push(item)\n if (item.length > column.width) column.width = item.length\n }\n\n group.width += column.width + PADDING_H\n }\n })\n }\n\n // print headers\n columnGroups.forEach(group => {\n // if label is wider than all this group's columns, add some space to the last column\n const labelOverhang = group.label.length + PADDING_H - group.width\n if (labelOverhang > 0) {\n group.width += labelOverhang\n group.columns[group.columns.length - 1].width += labelOverhang\n }\n\n // print label\n process.stdout.write(group.label)\n let remainingSpace = group.width - group.label.length\n while (remainingSpace-- > 0) process.stdout.write(' ')\n })\n const headerHeight = PADDING_V + 1\n for (let i = 0; i < headerHeight; i++) process.stdout.write('\\n')\n\n // print content\n for (let rowIndex = 0; rowIndex < tableHeight - headerHeight; rowIndex++) {\n columnGroups.forEach(group => group.columns.forEach((column, columnIndex) => {\n let remainingSpace = column.width + PADDING_H\n const cell = column.rows[rowIndex]\n if (cell) {\n process.stdout.write(cell || '')\n remainingSpace -= cell.length\n }\n while (remainingSpace-- > 0) process.stdout.write(' ')\n }))\n process.stdout.write('\\n')\n }\n}", "function ReportHeader(){}", "getColumnHeaderData(columns, metadata) {\n let outputHeaderTitles = [];\n this._columnHeaders = this.getColumnHeaders(columns) || [];\n if (this._columnHeaders && Array.isArray(this._columnHeaders) && this._columnHeaders.length > 0) {\n // add the header row + add a new line at the end of the row\n outputHeaderTitles = this._columnHeaders.map((header) => ({ value: header.title, metadata }));\n }\n // do we have a Group by title?\n const groupTitle = this.getGroupColumnTitle();\n if (groupTitle) {\n outputHeaderTitles.unshift({ value: groupTitle, metadata });\n }\n return outputHeaderTitles;\n }", "function renderTableHeader() {\r\n // table top\r\n const tableTop = document.createElement('tr')\r\n const Kleur = document.createElement('th')\r\n Kleur.setAttribute('colspan', '2')\r\n Kleur.classList.add('right')\r\n Kleur.textContent = 'Kleur'\r\n\r\n const Bloeiperiode = document.createElement('th')\r\n Bloeiperiode.textContent = 'Bloeiperiode'\r\n\r\n tableTop.appendChild(Kleur)\r\n tableTop.appendChild(Bloeiperiode)\r\n\r\n tableHead.appendChild(tableTop)\r\n\r\n\r\n // table monthes\r\n const tableMonths = document.createElement('tr')\r\n\r\n const emptyCol = document.createElement('td')\r\n emptyCol.setAttribute('colspan', '2')\r\n\r\n const monthsCol = document.createElement('td')\r\n const monthsDiv = document.createElement('div')\r\n monthsDiv.classList.add('months')\r\n\r\n months.forEach(month => {\r\n const monthBox = document.createElement('span')\r\n monthBox.classList.add('month-box')\r\n monthBox.classList.add('letter')\r\n monthBox.textContent = month\r\n\r\n monthsDiv.appendChild(monthBox)\r\n })\r\n\r\n monthsCol.appendChild(monthsDiv)\r\n\r\n tableMonths.appendChild(emptyCol)\r\n tableMonths.appendChild(monthsCol)\r\n\r\n tableHead.appendChild(tableMonths)\r\n }", "function renderTableHeader(data) {\n console.log(data.page)\n if (data.page == null) {\n return <div>No Data Avialable</div>;\n }\n let header = Object.keys(data.page.results[0])\n return header.map((key, index) => {\n return <th key={index}> {key.toUpperCase()}</th>\n })\n }", "header() {\n const month = this.months[this.monthIndex];\n return {\n month: month,\n year: this.year.toString(),\n shortYear: this.year.toString().substring(2, 4),\n label: month.label + ' ' + this.year,\n };\n }", "function createHeader() {\n var table = gAppState.checkId(\"dbmsTableID\", \"fsTableID\");\n\n var header = table.createTHead(); // creates empty tHead\n var row = header.insertRow(0); // inserts row into tHead\n\n var cell0 = row.insertCell(0); // inserts new cell at position 0 in the row\n var cell1 = row.insertCell(1); // inserts new cell at position 1 in the row\n var cell2 = row.insertCell(2); // inserts new cell at position 2 in the row\n\n cell0.innerHTML = \"<b>Subject</b>\"; // adds bold text\n cell1.innerHTML = \"<b>Predicate</b>\";\n cell2.innerHTML = \"<b>Object</b>\";\n}", "function update_header(type){\n\tvar all = 'all_'+type;\n\n\t// update the headers\n\tvar header_selector = '#'+type+'_header';\n\tvar header = type.charAt(0).toUpperCase() + type.slice(1)+':<i> ';\n\tvar this_all = this[all];\n\t$.each(this[type], function(index, value) {\n\t\theader += this_all[value]['name']+' - ';\n\t});\n\tif (type == 'samples'){\n\t\t$.each(this.require, function(index, value) {\n\t\t\theader = header.replace(\" \"+this_all[value]['name']+\" \", ' <font color=\"green\">'+this_all[value]['name']+'</font> ');\n\t\t});\n\t\t$.each(this.exclude, function(index, value) {\n\t\t\theader = header.replace(\" \"+this_all[value]['name']+\" \", ' <font color=\"red\">'+this_all[value]['name']+'</font> ');\n\t\t});\n\t}\n\tthis[all] = this_all;\n\tif (header.lastIndexOf(\"-\") == -1){\n\t\theader = header.substr(0,header.length-4);\n\t}\n\telse {\n\t\theader = header.substr(0,header.length-3);\n\t}\n\theader += ' </i>';\n\t$(header_selector).html(header);\n}", "function makingHeader() {\n var STDtable = document.getElementById(\"studentinfo\");\n var tr = document.createElement('tr');\n STDtable.appendChild(tr);\n var th = document.createElement(\"th\");\n tr.appendChild(th);\n th.textContent = \"Student Name\";\n var th1 = document.createElement(\"th\");\n tr.appendChild(th1);\n th1.textContent = \"Student ID\";\n var th2 = document.createElement(\"th\");\n tr.appendChild(th2);\n th2.textContent = \"Gender\";\n var th3 = document.createElement(\"th\");\n tr.appendChild(th3);\n th3.textContent = \"Parent ID\";\n var th4 = document.createElement(\"th\");\n th4.setAttribute(\"colspan\", \"3\");\n tr.appendChild(th4);\n th4.textContent = \"Math\";\n var th5 = document.createElement(\"th\");\n th5.setAttribute(\"colspan\", \"3\");\n tr.appendChild(th5);\n th5.textContent = \"English\";\n var th6 = document.createElement(\"th\");\n th6.setAttribute(\"colspan\", \"3\");\n tr.appendChild(th6);\n th6.textContent = \"Science \";\n var th7 = document.createElement(\"th\");\n tr.appendChild(th7);\n th7.textContent = \"Averge\";\n var th8 = document.createElement(\"th\");\n tr.appendChild(th8);\n th8.textContent = \"FeedBack\";\n}", "function addEventTableHeader() {\n var tableHead =\n \"<tr>\" +\n \"<th>Title</th>\" +\n \"<th>Status</th>\" +\n \"<th>Location</th>\" +\n \"<th>Organizer</th>\" +\n \"<th>Date and Time</th>\" +\n \"<th>Webpage</th>\" +\n \"<th>Image</th>\" +\n \"<th>Category</th>\" +\n \"<th>Actions</th>\" +\n \"</tr>\";\n\n return tableHead\n}", "function createTableHeader() {\n var talks = \"<tr><th></th>\";\n var contests = \"<tr><th></th>\";\n\tvar teams = \"<tr><th></th>\";\n\n for (var key in rooms) {\n if (roomType(rooms[key]) == \"contests\") {\n contests += \"<th>\" + rooms[key].name;\n if(rooms[key].link != undefined && rooms[key].link != \"\"){\n contests += \"<br><a href='\" + rooms[key].link + \"' target='_blank'>Join the stream</a>\";\n }\n\n contests += \"</th>\";\n } else {\n\t\tif(roomType(rooms[key]) == \"teams\"){\n \t\tteams += \"<th>\" + rooms[key].name;\n if(rooms[key].link != undefined && rooms[key].link != \"\"){\n teams += \"<br><a href='\" + rooms[key].link + \"' target='_blank'>Join the stream</a>\";\n }\n teams += \"</th>\";\n\t\t} else {\n\t\t talks += \"<th>\" + rooms[key].name;\n if(rooms[key].link != undefined && rooms[key].link != \"\"){\n talks += \"<br><a href='\" + rooms[key].link + \"' target='_blank'>Join the stream</a>\";\n }\n talks += \"</th>\";\n\t\t}\n }\n }\n\n $(\"#talks\").find(\"table.day > thead\").append(talks);\n\n $(\"#contests\").find(\"table.day > thead\").append(contests);\n\n\t$(\"#teams\").find(\"table.day > thead\").append(teams);\n\n }", "function draw_headers() \n{\n stroke(0);\n textSize(17);\n\n // Insertion Sort header\n alg_header(\"Insertion Sort\", 6, colors.Insertion);\n\n // Selection Sort header\n alg_header(\"Selection Sort\", 366, colors.Selection);\n\n // Gold's Poresort header\n alg_header(\"Gold's Poresort\", 723, colors.Poresort);\n\n // Mergesort header\n alg_header(\"Mergesort\", 1083, colors.Mergesort);\n\n // Quicksort header\n alg_header(\"Quicksort\", 1445, colors.Quicksort);\n}", "function addHeader(){\n\t\t\tself.$thead.find('tr').append('<th></th>');\n\t\t}", "function headRender(index, key, label, columns) {\n return $('<div class=\"column col_' + index + ' col_' + key + '\" >' + label + '</div>');\n }", "function createTableHeader() {\n var headerRow = document.createElement(\"tr\");\n var headerInfo = [[\"64%\", \"Item Name\"], [\"12%\", \"Category\"], [\"12%\", \"Price Range\"], [\"12%\", \"Sign-Up\"]];\n for (var i = 0; i < headerInfo.length; i++) {\n data = document.createElement(\"th\");\n data.setAttribute(\"width\", headerInfo[i][0]);\n data.innerHTML = headerInfo[i][1];\n headerRow.appendChild(data);\n }\n return headerRow;\n}", "function simpleHeader( legend ) {\n\treturn function( th ) {\n\t\tth.textContent = legend;\n\t};\n}" ]
[ "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.66302717", "0.66302717", "0.66302717", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.66088974", "0.66088974", "0.66088974", "0.66088974", "0.66088974", "0.66088974", "0.66088974", "0.66088974", "0.66088974", "0.6406188", "0.6011541", "0.59565085", "0.58928466", "0.5870563", "0.5843313", "0.5814847", "0.5801992", "0.5799934", "0.57328886", "0.57059497", "0.5693648", "0.567421", "0.5662074", "0.5660829", "0.5660786", "0.565026", "0.5641626", "0.56251734", "0.56142783", "0.56138104", "0.5608025", "0.5586454", "0.5576381", "0.5569024", "0.55495673", "0.5541343", "0.5527267", "0.5519968", "0.5518913", "0.5511316", "0.55029255", "0.5494997", "0.5494538", "0.54834706", "0.5470561", "0.5452994", "0.54314995", "0.5415333", "0.5401473", "0.53943884", "0.5386051", "0.53660166", "0.5356803", "0.5352625", "0.53458333", "0.5332433", "0.5300408", "0.5298457", "0.5297521", "0.5294391", "0.5286746", "0.52821994", "0.52805287", "0.5276008", "0.5275705", "0.5259903", "0.5259199", "0.5258072", "0.52535886" ]
0.6634643
13
Populates the table identified by id parameter with the specified data and format
function createTable(table, info, formatter, defaultSorts, seriesIndex, headerCreator) { var tableRef = table[0]; // Create header and populate it with data.titles array var header = tableRef.createTHead(); // Call callback is available if(headerCreator) { headerCreator(header); } var newRow = header.insertRow(-1); for (var index = 0; index < info.titles.length; index++) { var cell = document.createElement('th'); cell.innerHTML = info.titles[index]; newRow.appendChild(cell); } var tBody; // Create overall body if defined if(info.overall){ tBody = document.createElement('tbody'); tBody.className = "tablesorter-no-sort"; tableRef.appendChild(tBody); var newRow = tBody.insertRow(-1); var data = info.overall.data; for(var index=0;index < data.length; index++){ var cell = newRow.insertCell(-1); cell.innerHTML = formatter ? formatter(index, data[index]): data[index]; } } // Create regular body tBody = document.createElement('tbody'); tableRef.appendChild(tBody); var regexp; if(seriesFilter) { regexp = new RegExp(seriesFilter, 'i'); } // Populate body with data.items array for(var index=0; index < info.items.length; index++){ var item = info.items[index]; if((!regexp || filtersOnlySampleSeries && !info.supportsControllersDiscrimination || regexp.test(item.data[seriesIndex])) && (!showControllersOnly || !info.supportsControllersDiscrimination || item.isController)){ if(item.data.length > 0) { var newRow = tBody.insertRow(-1); for(var col=0; col < item.data.length; col++){ var cell = newRow.insertCell(-1); cell.innerHTML = formatter ? formatter(col, item.data[col]) : item.data[col]; } } } } // Add support of columns sort table.tablesorter({sortList : defaultSorts}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillTable(id) {\n\n // Pull the metadata\n d3.json(path).then((sampleData) => {\n var data = sampleData.metadata;\n\n // Grab the table element\n var demoInfo = d3.select(\"#sample-metadata\")\n\n // Clear any previous table\n demoInfo.html(\"\"); \n\n // Generate a blank list and pull the data that matches the new id\n var info = [];\n info = data.filter(i => i.id == id)[0];\n\n // Send the info to the panel\n Object.entries(info).forEach(function([key, value]) {\n var row = d3.select(\"#sample-metadata\").append(\"p\");\n row.text(`${key} : ${value}`);\n })\n})\n}", "function fill_table(_data){\n\n\tfor (var i = 0; i < _data.length; i++){\n\t\tvar row = create_row()\n\t\trow.append(\"td\").text(_data[i].datetime);\n\t\trow.append(\"td\").text(_data[i].city.replace( /\\b./g, function(a){ return a.toUpperCase(); } ));\n\t\trow.append(\"td\").text(_data[i].state.toUpperCase());\n\t\trow.append(\"td\").text(_data[i].country.toUpperCase());\n\t\trow.append(\"td\").text(_data[i].shape);\n\t\trow.append(\"td\").text(_data[i].durationMinutes);\n\t\trow.append(\"td\").text(_data[i].comments);\n\n\t}\n\n}", "function fillTable(data) {\n //clear existing table\n tbody.html(\"\")\n\n //loop through 'data.js' for each ufo sighting report object\n data.forEach((ufoSighting) => {\n //append table row 'tr' for each ufo sighting\n var sighting = tbody.append(\"tr\");\n //use Object.entries to console.log each ufo sighting value\n Object.entries(ufoSighting).forEach(([key, value]) => {\n var cell = sighting.append(\"td\");\n cell.text(value);\n }\n );\n });\n}", "function appendTableData(id, data){\r\n\r\nlet newRow = id.insertRow();\r\n//Check column doesn't contain the data\r\nfor(let i=0; i<id.rows.item(0).cells.length; i++){\r\n let cell = newRow.insertCell();\r\n if(i < data.length){\r\n cell.innerHTML = data[i];\r\n }\r\n}\r\n\r\n}", "function poplulateTable(data){\n data.forEach(sightingData=>{\n const trow = tbody.append(\"tr\");\n columns= [\"datetime\", \"city\", \"state\", \"country\", \"shape\", \"durationMinutes\", \"comments\"];\n columns.forEach(key=>{\n trow.append(\"td\").text(sightingData[key]);\n })\n })\n}", "function create_table(data, id) {\r\n var e = \"\";\r\n var headers = data[0];\r\n var k = Object.keys(headers);\r\n e += \"<tr>\"\r\n $.each(k, function (h, j) {\r\n e += \"<th>\" + j + \"</th>\";\r\n })\r\n e += \"</tr>\";\r\n $.each(data, function (i, d) {\r\n e += \"<tr>\";\r\n var v = Object.values(d);\r\n $.each(v, function (h, j) {\r\n e += \"<td>\" + j + \"</td>\";\r\n })\r\n e += \"</tr>\";\r\n })\r\n $(\"#\" + id).html(e);\r\n}", "function fill_students_table( student_id )\r\n{\r\n\tlet url;\r\n\tif ( !student_id )\r\n\t\turl = './api/students/list';\r\n\telse\r\n\t\turl = './api/student/' + student_id;\r\n\tget_data_list( url, build_students_table, show_alert );\r\n}", "function buildTable(data){\n var tableData = data.results;\n\n //Clear the table if it has any records\n if( myTable.data().any() )\n {\n myTable.clear(); \n } \n\n //add dashes to the dates\n angular.forEach(tableData, function(obj, inx){\n if(obj.recall_initiation_date){\n obj.recall_initiation_date = $scope.addDashes(obj.recall_initiation_date);\n }\n });\n\n //Add rows to the table then redraw the table\n myTable.rows.add(tableData).draw();\n resizeTable();\n }", "function populateTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n // Get current sighting object and fields\n var sighting = tableData[i];\n console.log(sighting)\n var fields = Object.keys(sighting);\n // Create new row in tbody, set index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For each field in sighting object, create new cell and set inner text to be current value at current sighting field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "function createAppealsTable(data){\n // Initialize html tables\n var html = \"\";\n\n // Run through data and prep for tables\n data.forEach(function(d,i){\n\n\t\thtml += '<tr><td>'+d['name']+'</td><td>' + d['dtype']['name'];\n\t\thtml += '</td><td>'+getAppealType(d['atype']);\n\t\thtml += '</td><td>'+d['start_date'].substr(0,10)+'</td><td>'+d['end_date'].substr(0,10);\n\t\thtml += '</td><td>'+niceFormatNumber(d['num_beneficiaries'],true)+'</td><td>'+niceFormatNumber(d['amount_requested'],true);\n\t\thtml += '</td><td>'+d['code']+'</td></tr>';\n\n });\n // Send data to appeals or DREFs html tables\n $('#appealstable').append(html);\n\n}", "function loadTable(data){\n\n //create element tbody and append to table\n let tbody = document.createElement(\"tbody\");\n tbody.setAttribute(\"id\",\"tablebody\");\n \n //for each value of data create rows and insert tds with required values in innerHTML and append to tbody\n data.forEach((value)=>{\n\n let tr = document.createElement(\"tr\");\n\n let tdID = document.createElement(\"td\");\n tdID.innerHTML = value.id;\n\n let tdName = document.createElement(\"td\");\n tdName.innerHTML = value.name;\n\n let tdEmail = document.createElement(\"td\");\n tdEmail.innerHTML = value.email;\n\n tr.append(tdID,tdName,tdEmail);\n tbody.append(tr);\n })\n\n table.append(tbody);\n}", "function tableBuild(data) {\n //used to clear current data on table\n tbody.html(\"\");\n //used forEach to itrate through each ro of data\n data.forEach((row) => {\n //created variable to create a new row on the table\n var dataRow = tbody.append('tr');\n //read values from each row of the dataset\n Object.values(row).forEach((value) => {\n //appened the new row in order to accept the values\n var cell = dataRow.append('td');\n //inserted the values into each corresponing cell on the table\n cell.text(value);\n })\n })\n}", "function populateTable(dataset){\n\n //clear out the data that is already in the table\n tbody.html(\"\");\n\n dataset.forEach((record) => {\n var row = tbody.append(\"tr\");\n Object.entries(record).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n })\n });\n}", "function dataTable(table){\n // Reset table\n tbody.text(\"\");\n\n // Populate table\n table.forEach(function(incident) {\n // console.log(incident);\n var row = tbody.append(\"tr\");\n Object.entries(incident).forEach(function([key, value]) {\n // console.log(key, value);\n var cell = row.append(\"td\");\n cell.text(value);\n });\n});\n}", "function renderDataTableData(tableId, data) {\n $(`#${tableId}`).DataTable().clear().rows.add(data).draw();\n}", "static fillRows(table, data, headers) {\n data.forEach(elem => {\n let row = table.insertRow(-1)\n let tds = []\n headers.forEach(el => {\n tds.push(row.insertCell(-1))\n tds[tds.length - 1].innerHTML = elem[el] ? elem[el] : ''\n tds[tds.length - 1].id = el\n })\n })\n }", "function populateRows() {\n for (var key in primary) {\n if (primary.hasOwnProperty(key)) {\n var newRow = document.createElement('TR');\n var sideHeader = document.createElement('TH');\n sideHeader.setAttribute('class', 'leftSideHeader');\n sideHeader.innerHTML = key;\n newRow.appendChild(sideHeader);\n \n for (var innerKey in primary[key]) {\n if (primary[key].hasOwnProperty(innerKey)) {\n var newCell = document.createElement('TD');\n var text = primary[key][innerKey];\n // TODO: format text and stuff\n if (innerKey === 'Percent') {\n text = text.toPercent();\n newCell.setAttribute('class', 'numberFormat');\n }\n else if (innerKey === 'Amount') {\n text = text.toMyCurrencyString();\n if (text.replace(/[,]+/g, \"\") >= 0) {\n newCell.setAttribute('class', 'numberFormat positive');\n }\n else {\n newCell.setAttribute('class', 'numberFormat negative');\n }\n }\n newCell.innerHTML = text;\n newRow.appendChild(newCell);\n \n }\n }\n this.dom.appendChild(newRow);\n \n }\n }\n }", "function updateTable(data) {\n frameworks[data.full_name]['data'] = data\n let name = data.full_name.split('/')[1];\n // From all the data feteched from GitHub, we'll pass the following to be added as a new row\n let dataArray = [name, data.watchers.toLocaleString(),\n data.forks.toLocaleString(),\n data.open_issues.toLocaleString(),\n data.subscribers_count.toLocaleString(),\n filesize(data.size),\n new Date(Date.parse(data.updated_at)).toLocaleString(),\n '<td class=\"icon-delete\"><span fmId=\"'+data.id+'\" class=\"icon-delete glyphicon glyphicon-trash\" aria-hidden=\"true\"></span></td>'\n ]\n // Call this helper function located on table.js\n addRow(dataArray);\n // Update header\n let currentTime = new Date().toLocaleString();\n $('#updateTime').html(currentTime);\n}", "function populateTable (data){\r\n\r\n tbody.html (\"\")\r\n\r\ndata.forEach((weatherReport) => {\r\n\r\n var row = tbody.append(\"tr\");\r\n\r\n Object.entries(weatherReport).forEach(([key, value]) => {\r\n\r\n var cell = row.append(\"td\");\r\n\r\n cell.text(value);\r\n\r\n });\r\n\r\n});\r\n\r\n}", "function populateTable(tableBody, data) {\n\n //Gathers info from Acesss key object\n if (!data) { return null; }\n let tableEntries = $(`#${tableBody}`);\n tableEntries.empty();\n\n //Fills table with new data \n Object.keys(data).forEach((key) => {\n let eventData = data[key];\n let row = document.createElement(\"table-entry\");\n\n let tempElement = document.createElement(\"td\");\n tempElement.innerHTML = eventData[\"name\"];\n row.append(tempElement);\n\n tempElement = document.createElement(\"td\");\n tempElement.innerHTML = eventData[\"region\"];\n row.append(tempElement);\n\n tempElement = document.createElement(\"td\");\n tempElement.innerHTML = new Date() - eventData[\"startDate\"] + \" seconds ago\";\n row.append(tempElement);\n\n tempElement = document.createElement(\"td\");\n let tempButton = document.createElement(\"button\");\n tempButton.innerHTML = \"Link here\";\n tempElement.append(tempButton);\n\n row.append(tempElement);\n tableEntries.append(row);\n })\n\n}", "function updateTableCrate(data){\n var s_table = ' \\\n <tr data-id='+ data.id +'> \\\n <td> '+ data.name +' </td>\\\n <td>' + data.price +'</td>\\\n <td>\\\n <button name=\"edit\" data-id='+data.id+'>Edit</button>\\\n <button name=\"delete\" data-id='+data.id+'>Delete</button>\\\n </td>\\\n </tr>'\n $('.item-list > tbody > tr:first').after(s_table)\n }", "function populateTable() {\n\n\n}", "function populateLanguageTable(data) \n{\n for( i = 0; i < data.length; i++ )\n {\n $('#languagesTable tr:last').after('<tr><td>' + data[i].LANGUAGE + '</td><td>' + data[i].LEVEL + '</td><td>' + data[i].AVERAGE_SOURCE_STATEMENTS_PER_FUNCTION_POINT + '</td></tr>');\n }\n}", "function populateData(what,id) {\n\t\n\t\tvar val=\"https://people.rit.edu/~sarics/web_proxy.php?path=\"+what;\n\t\t$.getJSON(val)\n\t\t.done(function (data) {\n\t\n\t\tvar arrayOfData;\n\t\tvar length;\n\t\tvar trHTML,table;\n\t\n\t\tif(id == 1) {\n\t\t\tarrayOfData = data.coopTable.coopInformation;\n\t\t}\n\t\n\t\telse{\n\t\t\tarrayOfData = data.employmentTable.professionalEmploymentInformation;\n\t\t}\n\t\n\t\tlength = arrayOfData.length; \n\t\n\t\tfor(i=0;i<length;i++) {\n\t\t\t\n\t\t\tif(id == 1) {\n\t\t\t\t\n\t\t\t\ttrHTML += '<tr class=\"row\"><td id=\"dataVal\">' + (arrayOfData[i].employer).trim()+ '</td><td>' + \n\t\t\t\tarrayOfData[i].degree + '</td><td>' + arrayOfData[i].city+ \n\t\t\t\t'</td><td\">' + arrayOfData[i].term+ '</td></tr>';\n\t\t\t}\n\t\n\t\t\telse{\n\t\t\t\ttrHTML += '<tr class=\"row\"><td class=\"dataVal\">' + arrayOfData[i].employer+ '</td><td class=\"dataVal\">' + \n\t\t\t\tarrayOfData[i].degree + '</td><td class=\"dataVal\">' + arrayOfData[i].city+ \n\t\t\t\t'</td><td class=\"dataVal\">' + arrayOfData[i].title+ '</td><td class=\"dataVal\">' + arrayOfData[i].startDate + '</td></tr>';\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tif(id == 1) {\n\t\t\t$('#location').append(trHTML);\n\t\t}\n\t\n\t\telse{\n\t\t\t$('#location2').append(trHTML);\n\t\t}\n \n\t\tif(id == 1) { \n\t\t\t\n\t\t\t$(\"#dialog\" ).dialog({\n\t\t\twidth:\"90%\",\n\t\t\tmodal: true,\n\t\t\ttitle:\"Co-Op Data\"\n\t\t\t})\n\t\t\n\t\t\t$(\"#dialog\").css({\n\t\t\t\"margin\":\"30px\",\n\t\t\t\"padding\":\"10px\",\n\t\t\t})\n\t\t\t\n\t\t\t$(\".row\").css({\n\t\t\t\"margin\":\"20px\",\n\t\t\t\"padding\":\"10px\",\n\t\t\t\"border-bottom\": \"thick solid black\"\n\t\t\t});\n\t\t}\n\t\n\t\telse {\n\t\t\t$(\"#dialog2\" ).dialog({\n\t\t\twidth:\"90%\",\n\t\t\tmodal: true,\n\t\t\ttitle:\"Employer Data\"\n\t\t\t})\n\t\t\t\n\t\t\t$(\"#dialog2\").css({\n\t\t\t\"margin\":\"30px\",\n\t\t\t\"padding\":\"10px\"\n\t\t\t})\n\t\t}\n\t\t\n\t\t$(\".row\").css({\n\t\t\t\"margin\":\"20px\",\n\t\t\t\"padding\":\"10px\",\n\t\t\t\"border-bottom\": \"thick solid black\"\n\t\t});\n\t})\n\t\n\t.fail(function () {\n alert('Some Problem Occured');\n });\n\t}", "function createTableRows(dataFromAPI, tableBody) {\n const tr = document.createElement('tr')\n tr.setAttribute('id', dataFromAPI.name)\n const wantedFields = [emptyHeart, dataFromAPI.logo_url, dataFromAPI.currency,\n dataFromAPI.name, dataFromAPI.price];\n wantedFields.forEach(field => createTableDataCell(field, tr))\n tableBody.appendChild(tr)\n}", "function updateDataToTable() {\n // Get the parameters from HTTP GET\n var parameterID = $.request.parameters.get('id');\n var parameterName = $.request.parameters.get('name');\n var parameterCountry = $.request.parameters.get('country');\n\n var conn = $.db.getConnection(); // SQL Connection\n var pstmt; // Prepare statement\n var rs; // SQL Query results\n var query; // SQL Query statement\n var output = { // Output object\n results: [] // Result array\n };\n var record = {}; // Record object\n try {\n // # might remove hard-coded schema name, and table name\n // conn.prepareStatement('SET SCHEMA \\\"YFF865\\\"').execute();\n query = 'UPDATE \\\"schema_name\\\".\\\"table_name\\\" SET attribute_name = ?, attribute_country = ? WHERE attribute_id = ?';\n pstmt = conn.prepareStatement(query);\n pstmt.setString(1, parameterID);\n pstmt.setString(2, parameterName);\n pstmt.setString(3, parameterCountry);\n rs = pstmt.executeQuery(); // Execute query; Update items into SAP HANA\n\n // Push the updated inputs to Result array\n record = {};\n record.parameterID = parameterID;\n record.parameterName = parameterName;\n record.parameterCountry = parameterCountry;\n output.results.push(record);\n\n conn.commit(); // Prevent deadlock by allowing a cocurrent SQL query to wait until this statement is fully executed\n rs.close(); // Close statements & connections\n pstmt.close();\n conn.close();\n } catch (e) {\n // Catch error if parameters are incorrect\n $.response.status = $.net.http.INTERNAL_SERVER_ERROR;\n $.response.setBody(e.message);\n return;\n }\n // Output respond into JSON body\n var body = JSON.stringify(output);\n $.response.contentType = 'application/json';\n $.response.setBody(body);\n $.response.status = $.net.http.OK;\n}", "make(data, tableName) {\n\t\tlet results = data.results,\n\t\t\tfields = data.fields,\n\t\t\tpks = data.primaryKeys;\n\t\tlog('Fields: ', fields);\n\t\tlet table = $('<table />', {class: 'table table-striped'});\n\t\tlet heading = $('<tr />');\n\t\tfields.forEach(col => {\n\t\t\theading.append(`<th>${col.name}</th>`);\n\t\t});\n\t\theading = $('<thead />').append(heading);\n\t\ttable.append(heading);\n\t\tlet tbody = $('<tbody />');\n\t\tresults.forEach(r => {\n\t\t\tvar row = $('<tr />');\n\t\t\tfields.forEach(fname => {\n\t\t\t\tvar col = $('<td />');\n\t\t\t\tvar input = $('<input />');\n\t\t\t\tinput.val(r[fname.name]);\n\t\t\t\tinput.data({\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcondition: this.generateCondition(pks, r),\n\t\t\t\t\tfield: fname.name\n\t\t\t\t});\n\t\t\t\tlog(input.data());\n\t\t\t\tthis.bindUpdateEvent(input);\n\t\t\t\tcol.append(input);\n\t\t\t\trow.append(col);\n\t\t\t});\n\t\t\ttbody.append(row);\n\t\t});\n\t\ttable.append(tbody);\n\t\treturn table;\n\t}", "function populateTable() {\n tableData.forEach(item => {\n tablerow = d3.select(\"tbody\").append(\"tr\")\n tablerow.append(\"td\").text(item.datetime)\n tablerow.append(\"td\").text(item.city)\n tablerow.append(\"td\").text(item.state)\n tablerow.append(\"td\").text(item.country)\n tablerow.append(\"td\").text(item.shape)\n tablerow.append(\"td\").text(item.durationMinutes)\n tablerow.append(\"td\").text(item.comments)\n });\n}", "function init () {\n data.forEach((tableData) => {\n let row = tbody.append(\"tr\");\n Object.values(tableData).forEach(value => {\n let cell = row.append(\"td\");\n cell.text(value);\n });\n })\n}", "function buildTable(data){\n // Clear tbody variable data\n tbody.html(\"\");\n // Create a loop that iterates through data.js to find each row\n data.forEach((dataRow) => {\n // For each new row found, append row `tr` to the html table body `tbody`\n let row = tbody.append(\"tr\");\n // Apply a value for each data row value found that will correspond to the table body column\n Object.values(dataRow).forEach((val) => {\n // Iterate through and append a cell to the row for each new value to fill out table\n let cell = row.append(\"td\");\n cell.text(val);\n });\n })\n}", "function buildTable(data){\n // Start By Clearing Existing Data\n tbody.html(\"\");\n // Loop Through `data` \n data.forEach((dataRow) => {\n // Append Table Row to the Table Body \n let row = tbody.append(\"tr\");\n // Iterate Through Values\n Object.values(dataRow).forEach((val) => {\n // add a row\n let cell = row.append(\"td\");\n cell.text(val);\n });\n })\n}", "function populateTable(data,val){\n if(val == 1){\n table.row.add(editArray); \n table.draw(); \n }else if(val == 2){\n table.row.add(selectedDataarray); \n table.draw();\n }else{\n alert('There was an error populating table, Please check material balance and material edit table codes');\n }\n}", "function populateTable(data,val){\n if(val == 1){\n table.row.add(editArray); \n table.draw(); \n }else if(val == 2){\n table.row.add(selectedDataarray); \n table.draw();\n }else{\n alert('There was an error populating table, Please check material balance and material edit table codes');\n }\n}", "function populateDataTable(data_obj){\n var tbody = document.getElementById('my_flt_table_body');\n\n\n\n var tr = document.createElement('tr');\n\n // make an element for every prop in obj\n for (var i in data_obj){\n var td = document.createElement('td');\n td.innerHTML = data_obj[i];\n tr.appendChild(td);\n\n }\n\n\n tbody.appendChild(tr);\n }", "function loadTable(newData)\n{\n // Clear all rows\n tbody.html(\"\");\n\n // Enter new data\n newData.forEach(function(line)\n {\n // Create a row\n let row = tbody.append(\"tr\");\n Object.entries(line).forEach(function([key,value])\n {\n // Create a data cell and input the value\n var cell = row.append(\"td\");\n cell.text(value);\n })\n })\n}", "function buildTable(data) {\n // Clears out data table\n tbody.html(\"\");\n // Loop through each row of the data\n data.forEach((dataRow) => {\n // Append a row to the table body\n let row = tbody.append(\"tr\");\n // add code to loop through each field\n Object.values(dataRow).forEach((val) => {\n // create a variable to append data to a table\n let cell = row.append(\"td\");\n // add the values\n cell.text(val);\n });\n });\n }", "function buildTable(data) {\n\n //Clear any existing table\n tbody.html(\"\");\n\n //Iterate through the data to create all necessary rows\n data.forEach((dataRow) => {\n var row = tbody.append(\"tr\");\n Object.entries(dataRow).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n});\n}", "function initTable(meta_id, ethnicity, gender, age, location, bbtype, wfreq) {\n var table = d3.select(\"#sample-metadata\");\n table.append(\"tbody\").text(\"ID: \" + meta_id[0]);\n table.append(\"tbody\").text(\"Ethnicity: \" + ethnicity[0]);\n table.append(\"tbody\").text(\"Gender: \" + gender[0]);\n table.append(\"tbody\").text(\"Age: \" + age[0]);\n table.append(\"tbody\").text(\"Location: \" + location[0]);\n table.append(\"tbody\").text(\"bbtype: \" + bbtype[0]);\n table.append(\"tbody\").text(\"wfreq: \" + wfreq[0])\n }", "function populateDataTable(data) {\n console.log(\"populating data table...\");\n // clear the table before populating it with more data\n\n $(\"#cyber\").DataTable().clear();\n if(0 == data.length) {\n $(\"#cyber\").DataTable().draw();\n }\n for(let i of Object.keys(data)){\n var result = data[i];\n\n $('#cyber').dataTable().fnAddData( [\n i,\n result.Result\n ]);\n }\n }", "function tableFromData(table, data, cols, stat) {\n table.append($('<tbody></tbody>'));\n for (var i = 0; i < data['Pilot'].length; i++) { //loop for each player\n var htmlRow = $('<tr></tr>');\n //console.log('round ' + i);\n for (var col in cols) {\n //console.log('appending stat ' + data[cols[col]][i] + ' into column [' + cols[col] + '] [' + i +']');\n htmlRow.append($('<td></td>').html(\n makeText(data[cols[col]][i], stat)\n ));\n }\n $('.datatable tbody').append(htmlRow);\n }\n }", "function populateTable(tbodyId) \n{\n var tr, td;\n\n tbody = document.getElementById(tbodyId);\n\n // looping through data source\n for (var i = 0; i < sales.length; i++) \n {\n // getting row number\n // tr = reference to the newly generated row object\n // tbody.rows.length = position of the new row within the table\n tr = tbody.insertRow(tbody.rows.length);\n\n // setting up and populating YEAR column\n // invoking insertCell based on the row object\n // tr.cells.length = position of the new cell within the row\n td = tr.insertCell(tr.cells.length); \n td.setAttribute(\"align\", \"center\");\n td.innerHTML = sales[i].year;\n\n // setting up and populating PERIOD column\n td = tr.insertCell(tr.cells.length);\n td.setAttribute(\"align\", \"center\");\n td.innerHTML = sales[i].period;\n\n // setting up and populating REGION team column\n td = tr.insertCell(tr.cells.length);\n td.setAttribute(\"align\", \"center\");\n td.innerHTML = sales[i].region;\n\n // setting up and populating TOTAL TEAM column\n td = tr.insertCell(tr.cells.length);\n td.setAttribute(\"align\", \"center\");\n td.innerHTML = sales[i].total;\n }\n}", "function createtable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < ufoData.length; i++) {\n // Get current fields\n var info = ufoData[i];\n var fields = Object.keys(info);\n // insert new fields in the tbody\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = info[field];\n }\n }\n}", "function fill_model_basis_table(process_basis_info, products_info, factory_id) {\n $table = $(\"#process_input > table\");\n // clear the current table content\n $table.find(\"tr\").remove();\n var days_production = process_basis_info.DOP;\n var hours_production = process_basis_info.HOP;\n var conversion = process_basis_info.conversion;\n var inlet_pressure = process_basis_info.inlet_P;\n var inlet_temperature = process_basis_info.inlet_T;\n $table.append('<thead><tr class=\"table-info\"><th>名称</th><th>数值每年</th><th>单位</th><th>单位价格</th><th>价格单位</th></tr></thead>');\n var tblbody = $table.get(0).appendChild(document.createElement('tbody'));\n for (var i=0; i <products_info.length; ++i) {\n // for multiple products of 1 product line, user can only edit the quantity of 1 product\n // because other products will be change during the calculation and displayed again\n add_a_table_row(tblbody,\n [products_info[i].name, products_info[i].quantity, products_info[i].unit, products_info[i].value_per_unit, products_info[i].currency_value_per_unit],\n [false, i==0?true:false, false, true, false],\n [products_info[i].id, products_info[i].id, '', 'value_per_unit_' + products_info[i].id, ''],\n 'chemical', true\n );\n }\n// add_a_table_row(tblbody,\n// [\"单位成本\", product_info.value_per_unit, product_info.currency_value_per_unit],\n// [false, true, false],\n// ['', 'value_per_unit', '']\n// );\n add_a_table_row(tblbody, [\"年生产天数\", days_production, \"天\"], [false, true, false], ['', 'DOP', ''], null, null);\n add_a_table_row(tblbody, [\"生产小时数/天\", hours_production, \"小时\"], [false, true, false], ['', 'HOP', ''], null, null);\n add_a_table_row(tblbody, [\"转换效率(0~1)\", conversion, \"-\"], [false, true, false], ['', 'conversion', ''], null, null);\n// add_a_table_row(tblbody, [\"入口压力\", inlet_pressure, \"bar\"], [false, true, false]);\n// add_a_table_row(tblbody, [\"入口温度\", inlet_temperature, \"C\"], [false, true, false]);\n // todo: add basic reaction_formula information\n\n}", "function table(data){\n tbody.html(\"\");\n\n\t//append the rows(tr) and cells(td) for returned values\n data.forEach((dataRow) => {\n let row = tbody.append(\"tr\");\n \n Object.values(dataRow).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n });\n })\n}", "function updateTable(){\n id++\n var data = getData()\n if(data.foods.length >1){\nvar tr = document.createElement('tr')\n var tableData = [td(), td(), td(), td(), td(), td(), td(), td(), td()] \n tableData[0].innerHTML = id\n tableData[1].innerHTML = data.firstName\n tableData[2].innerHTML = data.lastName\n tableData[3].innerHTML = data.Gender\n tableData[4].innerHTML = data.foods\n tableData[5].innerHTML = data.address\n tableData[6].innerHTML = data.state\n tableData[7].innerHTML = data.pincode\n tableData[8].innerHTML = data.country\n tr.append(...tableData)\n tbody.append(tr)} else{\n alert(\"You must select minimun two foods\")\n }\n\n}", "function renderData() {\n tableBody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n var data = tableData[i];\n var rows = Object.keys(data);\n var input = tableBody.insertRow(i);\n for (var j = 0; j < rows.length; j++) {\n var field = rows[j];\n var cell = input.insertCell(j);\n cell.innerText = data[field];\n }\n }\n}", "function tablePopulate(tableData) {\n tbody.html(\"\");\n tableData.forEach(function (tableData) {\n var row = tbody.append(\"tr\");\n Object.entries(tableData).forEach(function ([key, value]) {\n // Append a cell to the row for each value\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function createTable (data) {\n tbody.html(\"\");\n data.forEach(function(UFO) {\n var datarow = tbody.append(\"tr\");\n Object.entries(UFO).forEach(([key, value]) => {\n var cell = datarow.append(\"td\");\n cell.text(value)\n })\n })\n}", "function generateTableContent(table, id, stat, cols) {\n var attrs = getRelevantAttrs(stat);\n //console.log('generating placeholder data');\n var data = generateTablePlaceholderData(cols);\n var incrementer = 0;\n //console.log('stats[]'+incrementer);\n //console.log(json[id]);\n for (var pid in json[id]['stats']) { //run through every player node\n //console.log('pid='+pid);\n var name = findOfficialName(json[id]['stats'][pid]['names']);\n //console.log('found official name');\n //console.log(name);\n data['Pilot'][incrementer] = name; //add their name to the list always\n for (var attr in json[id]['stats'][pid]) { //for every name like 'times'\n //console.log('-> '+attr);\n //see if its in attrs\n for (var i in attrs) {\n //console.log('--> '+attrs[i]);\n if (attr == attrs[i]) { //see if we want something from here\n //console.log('we want everything from ' + attr);\n for (var realcol in json[id]['stats'][pid][attr]) { //push 'all' cols\n if (isNaN(realcol)) { //as long as its not a number\n \t\t\t\t if (stat == 'Hours') { //and if its for an hours table\n //console.log(realcol);\n \t\t\t\t\tif (inHelis(realcol)) { //only include whitelisted vehicles\n \t\t\t\t\t\t//console.log('-------> ' + realcol);\n \t\t\t\t\t\tdata[realcol][incrementer] = json[id]['stats'][pid][attr][realcol]; //make it so\n \t\t\t\t\t}\n \t\t\t\t } else {\n \t\t\t\t\t data[realcol][incrementer] = json[id]['stats'][pid][attr][realcol]; //not a number, not for hours, cool with me\n \t\t\t\t }\n }\n }\n }\n }\n }\n incrementer++;\n }\n //console.log(data);\n return tableFromData(table, data, cols, stat);\n }", "function addtable() {\n tbody.html(\"\");\n console.log(`There are ${tableDatashape.length} records in this table.`);\n console.log(\"----------\");\n tableDatashape.forEach(function(sighting) {\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(function([key, value]) {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n }", "function buildTable(data) {\r\n tbody.html(\"\");\r\n//next loop through each object in data and append a row and cells for each value in the row\r\ndata.forEach((dataRow)) => {\r\n //append a row to table body\r\n let row=tbody.append(\"tr\");\r\n //Loop through each field in dataRow and add each value as a table cell (td)\r\n Object.values(dataRow).forEach((val)=> {\r\n let cell = row.append(\"td\");\r\n cell.text(val);\r\n }\r\n );\r\n}", "function tableInit(my_data) {\n // Find the table\n // Use D3 to select the table\n var table = d3.select(\"#ufo-table\");\n //Remove the las tbody to avoid unwanted data\n var my_tbody = table.select('tbody');\n my_tbody.remove();\n //Create e new tbody entity to append the data\n var tbody = table.append(\"tbody\");\n // Build the table\n my_data.forEach((sighting) => {\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function buildTable(dataTable) {\r\n let table = document.getElementById(dataTable);\r\n let row = table.insertRow(-1);\r\n let cell1 = row.insertCell(-1);\r\n let cell2 = row.insertCell(-1);\r\n let cell3 = row.insertCell(-1);\r\n let cell4 = row.insertCell(-1);\r\n\r\n /**Output*/\r\n cell1.innerHTML = year;\r\n cell2.innerHTML = ageInput;\r\n cell3.innerHTML = toDollars(income);\r\n cell4.innerHTML = toDollars(savingsBal);\r\n }", "function renderTable(data){\r\n\tlet table = createEmptyTable(\"tableContainer\");\r\n\tcreateHeaderRow(table, data[0]); // Pass any of the data objects to this function\r\n\tcreateResultRows(table, data); // Pass all of the data objects to this function\r\n}", "function table_Build(data) {\n tableBody.html(\"\");\n data.forEach((row) => {\n const new_row = tableBody.append(\"tr\");\n \n Object.values(row).forEach((value) => {\n let dp = new_row.append(\"td\");\n dp.text(value);\n }\n );\n });\n}", "function populateTable(){\n \ttable.clear();\n \tfor(var a = 0; a < prItems.length; a++){\n \t\tif (prItems[a].disctype == 2) {\n \t\t\tdiscount = prItems[a].discamt + \"%\";\n \t\t}\n \t\telse {\n \t\t\tdiscount = accounting.formatMoney(prItems[a].discamt)\n \t\t}\n\t\t\tselectedDataarray = [\n prItems[a].itemid,\n prItems[a].itemname.toUpperCase(),\n accounting.formatMoney(prItems[a].qty),\n prItems[a].uomid,\n prItems[a].unit,\n accounting.formatMoney(prItems[a].price),\n discount,\n prItems[a].disctype,\n accounting.formatMoney(prItems[a].subtotal),\n accounting.formatMoney(prItems[a].total),\n \"<center><button class='btn btn-danger btnDelete btnTable' data-value='\" + a + \"'><i class='fa fa-trash-o'></i> Delete</button></center>\"\n ];// adding selected data to array \n\n \ttable.row.add(selectedDataarray); \n\t\t} \n table.draw();\n }", "function buildTable(tableData){\n // Clear any data if present\n tbody.html(\"\");\n\n //loop thru data table to place the values\n tableData.forEach(dataEntry =>{\n var row = tbody.append(\"tr\");\n Object.entries(dataEntry).forEach(([key,value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function populateTable(tableData) {\n tbody.innerHTML = (\"\");\n tableData.forEach((datum) => {\n var row = tbody.append(\"tr\");\n console.log(datum);\n\n Object.entries(datum).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n});\n}", "function createTable() {\r\n $tbody.innerHTML = \"\";\r\n \r\n var sighting, sightingKeys;\r\n var dom;\r\n var columnValue;\r\n \r\n for (var i = 0; i < ufoData.length; i++) {\r\n sighting = ufoData[i];\r\n sightingKeys = Object.keys(sighting);\r\n\t\r\n $dom = $tbody.insertRow(i);\r\n\t/* insert the column values: 0=date, 1=city, 2=state, 3=country, 4=shape, 5=duration, 6=comments*/\t\r\n for (var j = 0; j < sightingKeys.length; j++) {\r\n columnValue = sightingKeys[j];\r\n $dom.insertCell(j).innerText = sighting[columnValue];\r\n }\r\n }\r\n}", "function update_table(data){\n // Update the table\n tbody.selectAll('tr').remove();\n var rows = tbody.selectAll('tr')\n .data(data)\n .enter()\n .append('tr');\n // create a cell in each row for each column\n data.forEach((Report) => {\n // // // Step 2: Use d3 to append one table row `tr` for each UFO report object\n var row = tbody.append(\"tr\");\n // // // Step 3: Use `Object.entries` to console.log each UFO report value\n Object.entries(Report).forEach(([key, value]) => {\n var cell = row.append(\"td\"); // // // Step 4: Use d3 to append 1 cell per UFO report value\n cell.text(value); // // Step 5: Use d3 to update each cell's text with\n });\n });\n }", "function update_details(data, $table) {\n $table.api().clear().draw();\n $table.api().rows.add(data);\n $table.api().columns.adjust().draw();\n}", "function buildTable(data){\n\n // clear the current data from the table\n tbody.html(\"\");\n\n // create a forEach loop to loop through the data array\n data.forEach((dataRow)=>{\n\n // add row to body as table row\n let row = tbody.append(\"tr\");\n\n //loop through each object in the data set\n Object.values(dataRow).forEach((val)=>{\n\n // add each object to it's row in table data\n let cell = row.append(\"td\");\n\n // add the values of the key:value pair for each object to the cell\n cell.text(val);\n }\n );\n });\n}", "function data_table(id) {\n d3.json(\"./static/js/samples.json\").then((importedData) => {\n var info_lst = importedData.metadata.filter(item => item.id === parseInt(id));\n \n var table = d3.select(\"#summary-list\");\n var add_t = table.select(\"li\");\n add_t.html(\"\");\n var lst_append;\n lst_append = add_t.append(\"li\").text(`ID: ${info_lst[0].id}`);\n lst_append = add_t.append(\"li\").text(`Age: ${info_lst[0].age}`);\n lst_append = add_t.append(\"li\").text(`Ethnicitiy: ${info_lst[0].ethnicity}`);\n lst_append = add_t.append(\"li\").text(`Gender: ${info_lst[0].gender}`);\n lst_append = add_t.append(\"li\").text(`Location: ${info_lst[0].location}`);\n lst_append = add_t.append(\"li\").text(`BB_Type: ${info_lst[0].bbtype}`);\n lst_append = add_t.append(\"li\").text(`Wfreq: ${info_lst[0].wfreq}`);\n\n });\n}", "function populateTable(dataEntry, tbodyObject) {\n // Use d3 to append one table row `tr` for each ufo observation object\n var row = tbodyObject.append(\"tr\");\n\n // Use `Object.entries` to log each object's value\n Object.entries(dataEntry).forEach(([key, value]) => {\n\n // Step 4: Use d3 to append 1 cell per ufo observation value (Date, City, State, Country, Shape, Duration, Comments)\n var cell = row.append(\"td\");\n\n // Step 5: Use d3 to update each cell's text with\n // ufo observation values (Date, City, State, Country, Shape, Duration, Comments)\n cell.text(value);\n });\n}", "function populateTable(dataObj) {\n\n $(\".container table #appointments\").html(\"\");\n\n for(var i = 0; i< dataObj.length; i++){\n\n var tableRow = $(\"<tr>\");\n var tableID = $(\"<td>\" + dataObj[i].pk + \"</td>\");\n var tableDate = $(\"<td>\" + dataObj[i].fields.date + \"</td>\");\n var tableTime = $(\"<td>\" + dataObj[i].fields.time + \"</td>\");\n var tableDescription = $(\"<td>\" + dataObj[i].fields.description + \"</td>\");\n\n console.log(tableDate);\n tableRow.append(tableID,tableDate,tableTime,tableDescription);\n\n $(\".container table #appointments\").append(tableRow);\n }\n\n}", "function buildTable(tableData){\n // Clear the html table section\n tbody.html(\"\");\n //Loop to append data \n tableData.forEach(dataEntry =>{\n var row = tbody.append(\"tr\");\n Object.entries(dataEntry).forEach(([key,value]) =>{\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function insertDataToTable() {\n // Get the parameters from HTTP GET\n var parameterID = $.request.parameters.get('id');\n var parameterName = $.request.parameters.get('name');\n var parameterCountry = $.request.parameters.get('country');\n\n var conn = $.db.getConnection(); // SQL Connection\n var pstmt; // Prepare statement\n var rs; // SQL Query results\n var query; // SQL Query statement\n var output = { // Output object\n results: [] // Result array\n };\n var record = {}; // Record object\n try {\n // # might remove hard-coded schema name, and table name\n // conn.prepareStatement('SET SCHEMA \\\"YFF865\\\"').execute();\n query = 'INSERT INTO \\\"schema_name\\\".\\\"table_name\\\" values(?,?,?)';\n pstmt = conn.prepareStatement(query);\n pstmt.setString(1, parameterID);\n pstmt.setString(2, parameterName);\n pstmt.setString(3, parameterCountry);\n rs = pstmt.executeQuery(); // Execute query; Insert items into SAP HANA\n\n // Push the new inputs to Result array\n record = {};\n record.parameterID = parameterID;\n record.parameterName = parameterName;\n record.parameterCountry = parameterCountry;\n output.results.push(record);\n\n conn.commit(); // Prevent deadlock by allowing a cocurrent SQL query to wait until this statement is fully executed\n rs.close(); // Close statements & connections\n pstmt.close();\n conn.close();\n } catch (e) {\n // Catch error if parameters are incorrect\n $.response.status = $.net.http.INTERNAL_SERVER_ERROR;\n $.response.setBody(e.message);\n return;\n }\n // Output respond into JSON body\n var body = JSON.stringify(output);\n $.response.contentType = 'application/json';\n $.response.setBody(body);\n $.response.status = $.net.http.OK;\n}", "async function populateData(id) {\n\n // Get defect data.\n const apiString1 = 'getDefects/' + id;\n const response1 = await fetch(apiString1);\n const data1 = await response1.json();\n\n const transformed1 = Object.assign(\n {},\n ...data1.map(({ defectName, defects }) => ({ [defectName]: defects }))\n );\n\n setLoading(false);\n setDefects(transformed1); \n\n // Get plant data.\n const apiString2 = 'getData/' + id;\n const response2 = await fetch(apiString2);\n const data2 = await response2.json();\n\n // Set plant data attributes.\n setTotalPartsMolded(data2.totalPartsMolded);\n setTotalPartsPackaged(data2.totalPartsPackaged);\n setTotalPartsSuccessAssembly(data2.totalPartsSuccessAssembly);\n setTotalPartsSuccessMolded(data2.totalPartsSuccessMolded);\n setTotalPartsSuccessPaint(data2.totalPartsSuccessPaint);\n setTotalYield(data2.totalYield);\n setYieldAtAssembly(data2.yieldAtAssembly);\n setYieldAtMold(data2.yieldAtMold);\n setYieldAtPaint(data2.yieldAtPaint); \n }", "function renderTable() {\n $newDataTable.innerHTML = \"\";\n for (var i = 0; i < ufoData.length; i++) {\n // Get the current ufo sighting and its fields\n var sighting = ufoData[i];\n var fields = Object.keys(sighting);\n // Insert a row into the table at position i\n var $row = $newDataTable.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell \n // at set its inner text to be the current value at the \n // current address's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "function buildTable(data) {\n //clear data\n tbody.html(\"\");\n\n //loop through each data object & append rows & values in each row\n data.forEach((dataRow) => {\n const row = tbody.append(\"tr\");\n\n //loop through each cell in every row to append\n Object.values(dataRow).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n }\n );\n });\n\n}", "function fillTable(base_url, tblname) {\n $.ajax({\n url: base_url,\n type: 'POST',\n data: {param: 'static'},\n success: function(response) {\n //Parseamos el json y lo asignamos a una variable\n $data = jQuery.parseJSON(response);\n //hacemos una llamada a getThead y el resultado, lo colocamos en \n //el thead de la tabla pasada por parametros. \n $( '#' + tblname + ' thead' ).html( getThead( $data.sColumns ) );\n $html = \"\";\n /* Por cada resultado adjunto a el arreglo de datatable aaData, crearemos un \n nuevo TR y lo asignamos a una variable ($html) */\n for ( var x in $data.aaData ) {\n $html += getTBody($data.aaData[x]);\n }\n /* Al finalizar el bucle tendremos todos los rows convertidos en tr, \n ahora lo colocamos en el tbody de la tabla ya creada */\n $( '#' + tblname + ' tbody' ).html($html);\n }\n }); \n}", "function updateOrderTableData (data, table, rowId) {\n if (table.row (rowId).length > 0) {\n var totalColumn = table.columns ().count ();\n for (var i = 0; i < totalColumn - 1; i++) {\n table.cell (rowId, i).data (data[i]);\n }\n // table.row (rowId).data ([data[0],data[1],data[2],data[3]]).invalidate ();\n } else {\n //Add row data if new\n table.row.add (data);\n }\n // }\n //Redraw table maintaining paging\n table.draw (false);\n}", "function createTable(data){\n\n resetTable();\n data.forEach((sighting)=>{\n console.log(sighting);\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(([key, value])=> {\n console.log(key, value);\n var cell = row.append(\"td\");\n cell.text(value);\n});\n});\n}", "function displayData()\n{\n \n createTable(dataBase)\n}", "function reloadDataTable(data) {\n// clear the current data being held in the table if-any\n clearDataTable();\n \n var colrow = thead.append(\"tr\");\n (data.columns).forEach((header)=>{\n var col = colrow.append(\"th\");\n col.text(header);\n col.attr(\"class\", \"table-head\");\n });\n\n (data.data).forEach((yearrow)=>{\n var row = tbody.append(\"tr\");\n yearrow.forEach(value => {\n var cell = row.append(\"td\");\n cell.text(value);\n cell.attr(\"class\", \"table-style\");\n });\n });\n}", "function populateDataTable(dataRow, headerArrays, tableId) {\n\tvar headers = buildDataTableHeaderObject(headerArrays);\n\tvar buttonArray = [ 'csv', 'excel'];\n\tvar table=$(tableId).DataTable({\n\t\tdata : dataRow,\n\t\t lengthChange: false,\n\t\tpaging : true,\n\t\tbSort : true,\n\t\tdom : 'Bfrtip',\n\t \"bDestroy\" : true,\n\t\tbuttons : buttonArray,\n\t\tcolumns : headers,\n\t\t\"bAutoWidth\" : false\n\t})\n\n}", "function init() {\n tableData.forEach((sightings) => {\n var row = tbody.append(\"tr\");\n Object.entries(sightings).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function buildTable(data) {\n // First, clear out any existing data\n tbody.html(\"\");\n \n // Next, loop through each object in the data\n // and append a row and cells for each value in the row\n data.forEach((dataRow) => {\n // Append a row to the table body\n let row = tbody.append(\"tr\");\n \n // Loop through each field in the dataRow and add\n // each value as a table cell (td)\n Object.values(dataRow).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n });\n });\n }", "function tabulate(data) {\n data.forEach((entry) => {\n var tr = tbody.append('tr');\n tr.append('td').attr(\"class\", \"Date\").text(entry.datetime);\n tr.append('td').attr(\"class\", \"City\").text(entry.city);\n tr.append('td').attr(\"class\", \"State\").text(entry.state);\n tr.append('td').attr(\"class\", \"Country\").text(entry.country);\n tr.append('td').attr(\"class\", \"Shape\").text(entry.shape);\n tr.append('td').attr(\"class\", \"Duration\").text(entry.durationMinutes);\n tr.append('td').attr(\"class\", \"Comments\").text(entry.comments);\n });\n}", "function init(){ \n data.forEach((rowData) => {\n var row = tbody.append(\"tr\");\n Object.entries(rowData).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function buildTable(tableData){\n // Dynamically build table\n tableData.forEach(iteams => {\n var row = tbody.append('tr');\n\n Object.values(iteams).forEach(val => {\n row.append('td').text(val); \n });\n })\n}", "function buildTable(localTableDataJson, tagId) {\n console.log('building table for ' + tagId);\n var content = \"\";\n var header = \"<thead><tr>\";\n console.log(localTableDataJson.headers)\n for (var index in localTableDataJson.headers) {\n console.log('added header');\n header += \"<th>\" + localTableDataJson.headers[index] + \"</th>\";\n }\n header += \"</tr></thead>\";\n content += header + \"<tbody>\";\n\n for (var index in localTableDataJson.data) {\n\n content += \"<tr>\";\n jQuery.each(localTableDataJson.data[index], function(index2, dataColumn) {\n content += \"<td>\" + dataColumn + \"</td>\";\n });\n content += \"</tr>\";\n\n }\n\n content += \"</tbody>\"\n\n $('#' + tagId).empty();\n $('#' + tagId).append(content);\n}", "function insertBasicTable(basic_data, insert_id) {\n /* Insert the key/value pairs into a table element on the DOM.\n\n basic_data = object containing key/value pairs\n insert_id = the id on the DOM to insert the table into \n \n Intentionally not including closing tags in the jquery requests;\n http://stackoverflow.com/a/14737115/2355035 */\n\n table_id = '#' + insert_id;\n var array_length = Object.keys(basic_data).length;\n var array_obj_names = Object.keys(basic_data);\n\n // create the table header\n $(table_id).empty();\n $(table_id).append('<thead>');\n $(table_id).append('<tr>')\n $(table_id).find('thead:last').append('<th>Tag');\n $(table_id).find('thead:last').append('<th>Data');\n\n // begin the table body and iterate through key/value pairs\n $(table_id).append('<tbody>');\n for (var i = 0; i < array_length; i++) {\n var attr_name = array_obj_names[i];\n var tag = '<td>' + array_obj_names[i];\n var data = '<td>' + basic_data[attr_name];\n\n $(table_id).find('tbody:last').append('<tr>' + tag + data);\n }\n}", "function createTableBody(table, data) {\n for (let record of data) {\n let row = table.insertRow();\n for (let prop in record) {\n let cell = row.insertCell();\n let text = document.createTextNode(record[prop])\n cell.appendChild(text);\n }\n }\n}", "function buildTable(data) {\n // Clear existing data in table\n tbody.html(\"\");\n // Create forEach function to loop through the table\n data.forEach((dataRow) => {\n // Create a variable to add a row to the table\n let row = tbody.append(\"tr\");\n // Reference an object from the array of UFO sightings and put each sighting in its own row of data\n Object.values(dataRow).forEach((val) => {\n // Create a variable to add data to the row\n let cell = row.append(\"td\");\n // Add values \n cell.text(val);\n });\n });\n}", "function buildtable(table) {\n \n \n \n console.log(table)\n\n // appending data into table\n table.forEach((item) => {\n \n var row = tbody.append(\"tr\");\n row.append(\"td\").text(item.datetime);\n row.append(\"td\").text(item.city);\n row.append(\"td\").text(item.state);\n row.append(\"td\").text(item.country);\n row.append(\"td\").text(item.shape);\n row.append(\"td\").text(item.durationMinutes);\n row.append(\"td\").text(item.comments);\n })\n}", "function tablerow(objtable, datasetname, tabledata, template, update) { // Do each row\n if (!datasetname) datasetname = '';\n\n var TR;\n\n if (!update) { // New Record\n\tTR = objtable.find('.row_tablecontent').last();\n\n\tobjtable.append(template); // Append invisible Template for next record\n TR.attr(\"data-id\", tabledata._id); // assign Data To TR tag attribute data-id=1.2.3...\n }else if(update=='new'){\n objtable.prepend(template); // Template for next record\n TR = objtable.find('.row_tablecontent').first();\n TR.attr(\"data-id\", tabledata._id);\n }else {\n var nameofrow = \"[data-id=\" + tabledata._id + \"]\";\n TR = objtable.find(nameofrow)\n .first();\n }\n\n\n setdatabyclass(TR, datasetname, tabledata);\n\n //TR.show('slow');\n return TR;\n}", "function initFromData(replacements) {\n // put the data into the page\n forEach(replacements, appendRow);\n // make sure we have at least one row in the table\n for (var i = table.children.length; i <= 1; i++) {\n appendEmptyRow();\n }\n}", "function createTable(data){\n const table = document.getElementById('orders-table');\n const tableContent = document.createDocumentFragment();\n let cols = getData('columns');\n //let nrows = data.length;\n\n deleteTableContent(table);\n\n data.forEach(rowData => {\n let row = document.createElement('tr');\n for(let col of cols) {\n let cell = document.createElement('td');\n switch(col){\n case 'total':\n //Set two decimal\n cell.textContent = `$ ${rowData[col].toFixed(2)}`;\n break;\n \n case 'order': \n // Create the link to Orders\n let link = rowData['order_link'];\n let order_number = rowData[col];\n let a = create_link(link, order_number);\n cell.append(a);\n break;\n\n case 'date':\n //Print the Date in Locale Format\n cell.textContent = rowData[col].toLocaleString();\n break;\n \n case 'status':\n let status = create_status(rowData[col]);\n cell.append(status);\n break;\n \n default:\n cell.textContent = rowData[col];\n break;\n }\n row.appendChild(cell);\n }\n tableContent.appendChild(row);\n })\n \n //Add the tableContent Fragment to Table Body\n table.tBodies[0].append(tableContent);\n\n //Show the table\n showTable(table, 1);\n\n //Return the link to Order Number\n function create_link(link, number) {\n let a = document.createElement('a');\n \n a.setAttribute('href', link);\n a.setAttribute('target', 'blank');\n a.innerHTML = `# ${number.toString().padStart(5, '0')}`;\n\n return a;\n }\n //Return a span element to status order\n function create_status(status) {\n let elem = document.createElement('span');\n elem.classList.add(status.toLowerCase(), 'status-order');\n elem.textContent = status.toUpperCase();\n\n return elem;\n }\n}", "function loadTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < ufoData.length; i++) {\n var index = ufoData[i];\n console.log(index)\n var fields = Object.keys(index);\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = index[field];\n }\n }\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 populateTable(){\n // Remove previous tbody\n var tbody = d3.select(\"tbody\");\n tbody.remove();\n var table = d3.select(\"#ufo-table\");\n // Append new tbody\n table.append(\"tbody\");\n tbody = d3.select(\"tbody\");\n tableData.forEach(function(event) {\n // Append row\n var row = tbody.append(\"tr\");\n // Append columns\n Object.entries(event).forEach(function([key, value]) {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function create_table(data){\n data.forEach(function(d){\n\n //create row\n var row = tbody.append(\"tr\");\n \n //unpack each row element into table\n Object.entries(d).forEach(function([key,value]){\n //append a cell to the row for each value\n var cell = tbody.append(\"td\");\n //set cell value\n cell.text(value);\n });\n \n });\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < sightingData.length; i++) { // Loop through the data object items\n var sighting = sightingData[i]; // Get each data item object\n var fields = Object.keys(sighting); // Get the fields in each data item\n var $row = $tbody.insertRow(i); // Insert a row in the table object\n for (var j = 0; j < fields.length; j++) { // Add a cell for each field in the data item object and populate its content\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "function buildTable(data) {\n tbody.html(\"\");\n\n data.forEach((dataRow) => {\n let row = tbody.append(\"tr\");\n // Create list of table values \n Object.values(dataRow).forEach((val) => {\n let cell = row.append('td');\n cell.text(val);\n });\n })\n}", "function createAnzeige(data) {\n var e, i = 0, j, l = data.entries.length,\n lang = data.lang, id,\n barcode_present = ['&#10007;', '&#8730;'];\n createTableHeader(data.fields);\n\n\n\n\tvar tabledata = [];\n for ( var i=0 ; i<l; i++ ) {\n\t e = data.entries[i];\n\t tablerow = {};\n\n\t if (e.barcode != '0') {\n tablerow['DT_RowClass'] = 'has_barcode';\n }\n\n\t for (var j=0; j < data.fields.length; j++) {\n\t\tid = data.fields[j][0];\n\n if (id == 93) {\n tablerow[j] = barcode_present[e.barcode];\n } else if (id == 27) {\n tablerow[j] = e.species;\n } else if (id == 28) {\n tablerow[j] = e.vernacular;\n } else if (id == 19) {\n tablerow[j] = e.taxon;\n } else if (id == 22) {\n tablerow[j] = e.institute;\n } else {\n if (e.data[id]) {\n tablerow[j] = e.data[id];\n } else {\n tablerow[j] = '';\n }\n }\n\t }\n\t tabledata.push(tablerow);\n\t}\n\n\n\tvar tablecolumns = [];\n\n\tfor (var j=0; j < data.fields.length; j++) {\n\t // generate array of {tabledata: 'index'} objects \n\t tablecolumns.push({'data': j})\n\t}\n\n\n if (i > 0) {\n\n\t // set table generation parameters depending on row number\n\t var paging = false;\n\t var defrender = false;\n\t var scroller = false;\n\t if (i > 10000) {\n\t\tpaging = true;\n\t\tdefrender = true;\n\t\t//scroller = {\n\t\t// loadingIndicator: true \n\t\t//}\n\t\t// switch line break off in cells to enable scrollers.js deferred loading capabilities\n\t\t//$('.dataTable').css('white-space', 'nowrap');\n\t }\n\n\n var resulttable = $('#viewTable').DataTable({\n\t\t'data': tabledata,\n\t\t'columns': tablecolumns,\n\t\t// try scroller\n\t\t\"scroller\": scroller,\n\t\t\"deferRender\": defrender,\n \"pagingType\": \"full_numbers\",\n \"scrollX\": true,\n \"scrollY\": 200,\n \"scrollCollapse\": false,\n \"paging\": paging,\n\t\t\"lengthMenu\": [ 10, 50, 100, 500, 1000 ],\n\t\t//wait 400ms between each keypress adding a letter in search field \n\t\t\"searchDelay\": 400,\n\t\t// pageLength is set below because of performance problems when set here\n\t\t//\"pageLength\": \"100\",\n \"language\": {\n \"url\": \"/static/js/DataTables/\" + BOL.get_lang() + \".txt\"\n }\n //\"order\": [[1, \"asc\"]]\n });\n\n\t // setting pageLength in parameters kills performance when loading new pages\n\t resulttable.page.len(1000).draw;\n\n $(\"#viewTable\").removeClass('hidden');\n $(\"#viewCounter\").html(BOL.sentences(0) + i);\n }\n }", "function createReportTable(data, reportId, filter_scale)\r\n{\r\n\t\t\r\n\t\tvar divHtml = \"<table id='table_\"+data.hirarchy+\"' data-scale='\"+filter_scale+\"'>\\\r\n\t\t\t<tr class='tableHead'>\";\r\n\t\tfor(key in data.head)\r\n\t\t\tdivHtml += \"<td>\" + data.head[key] + \"</td>\";\r\n\t\t\r\n\t\tdivHtml += \"</tr>\";\r\n\t\t\r\n\t\t\r\n\t\tfor(var rowid in data.body) {\r\n\t\t\tvar row = data.body[rowid];\r\n\t\t\t\r\n\t\t\tif(row.type && row.type == \"title\")\r\n\t\t\t\tdivHtml += \"<tr class='titleRow'>\";\r\n\t\t\telse if(row.type && row.type == \"midSum\")\r\n\t\t\t\tdivHtml += \"<tr class='midsumRow'>\";\r\n\t\t\telse\r\n\t\t\t\tdivHtml += \"<tr>\";\r\n\t\t\t\r\n\t\t\tfor(key in row) {\r\n\t\t\t\tif(key == \"type\")\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tvar value = 0;\r\n\t\t\t\tswitch(data.format[key])\r\n\t\t\t\t{\r\n\t\t\t\t\tcase \"int\":\r\n\t\t\t\t\t\tvalue = \"<td>\" + row[key].toString().toFaDigit() + \"</td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"char\":\r\n\t\t\t\t\t\tvalue = \"<td><span class='right'>\"+row[key]+\"</span></td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"ebcdic\":\r\n\t\t\t\t\t\t\tvalue = \"<span class='right'>\"+main2win(row[key])+\"</span>\";\r\n\t\t\t\t\t\tvalue = \"<td>\" + value + \"</td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"amount\":\r\n\t\t\t\t\t\tvalue = (row[key] >= 0)? \r\n\t\t\t\t\t\t\t\"<span class='green'> \" + (formatNumber(Math.abs(row[key]/filter_scale), 3, \",\")).toFaDigit() + \" </span>\" : \r\n\t\t\t\t\t\t\t\"<span class='red'> \" + (formatNumber(Math.abs(row[key]/filter_scale), 3, \",\")).toFaDigit() + \" </span>\";\r\n\t\t\t\t\t\tvalue = \"<td class='amount'>\" + value + \"</td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"amountsum\":\r\n\t\t\t\t\t\tvalue = (row[key] >= 0)? \r\n\t\t\t\t\t\t\t\"<span class='green'> \" + (formatNumber(Math.abs(row[key]/filter_scale), 3, \",\")).toFaDigit() + \" </span>\" : \r\n\t\t\t\t\t\t\t\"<span class='red'> \" + (formatNumber(Math.abs(row[key]/filter_scale), 3, \",\")).toFaDigit() + \" </span>\";\r\n\t\t\t\t\t\tvalue = \"<td class='amount'><strong>\"+ value +\"</strong></td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"date\":\r\n\t\t\t\t\t\tvalue = \"<td>\" + (formatNumber(row[key]%1000000, 2, \"/\")).toFaDigit() + \"</td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"zone\":\r\n\t\t\t\t\t\tvalue = \"<td>\" + zoneList[row[key]] + \"</td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"sar\":\r\n\t\t\t\t\t\tif(row.type && row.type == \"midSum\")\r\n\t\t\t\t\t\t\tvalue = \"<td><span class='right'>جمــع \"+zoneList[row[key]]+\"</span></td>\";\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tvalue = \"<td><span class='right'>\"+sarList[row[key]]+\"</span></td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"br\":\r\n\t\t\t\t\t\tvalue = \"<td><span class='right'>\"+row[key]+\" - \"+brList[row[key]]+\"</span></td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"fasl\":\r\n\t\t\t\t\t\tvalue = \"<td><span class='right'>\"+row[key]+\" - \"+sarfaslList[row[key]]+\"</span></td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"link\":\r\n\t\t\t\t\t\tif(row.type && row.type == \"midSum\")\r\n\t\t\t\t\t\t\tvalue = \"<td> </td>\";\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tvalue = \"<td><a href='javascript:loadReport(\\\"\"+reportId+\"\\\", \"+row[key][1]+\");' class='report-link'>\" + row[key][0] + \"</a></td>\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tvalue = \"<td>\" + row[key] + \"</td>\";\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tdivHtml += value;\r\n\t\t\t}\r\n\t\t\tdivHtml += \"</tr>\";\r\n\t\t}\r\n\t\t\r\n\t\tif(data.rowsum != false)\r\n\t\t{\r\n\t\t\tvar rowSum = data.rowsum;\r\n\t\t\tvar dif = data.head.length - rowSum.length;\r\n\t\t\t\r\n\t\t\tdivHtml += \"<tr class='rowsum'>\\\r\n\t\t\t\t\t\t\t<td colspan=\"+dif+\">جمــع</td>\";\r\n\t\t\tfor(key in rowSum)\r\n\t\t\t{\r\n\t\t\t\tvar value = (rowSum[key] === \"\") ? \"\" :\r\n\t\t\t\t\t\t\t\t\t\t\t((rowSum[key] >= 0) ? \r\n\t\t\t\t\t\t\t\t\t\t\t\t(\"<span class='green'> \"+(formatNumber(Math.abs(rowSum[key]/filter_scale), 3, \",\")).toFaDigit()+\" </span>\") :\r\n\t\t\t\t\t\t\t\t\t\t\t\t(\"<span class='red'> \"+(formatNumber(Math.abs(rowSum[key]/filter_scale), 3, \",\")).toFaDigit()+\" </span>\")\r\n\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\tdivHtml += \"<td class='amount'>\" + value + \"</td>\";\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\tdivHtml += \"</tr>\";\r\n\t\t}\r\n\t\tdivHtml += \"</table>\";\r\n\t\t\r\n\t\treturn divHtml;\r\n}", "function initTableData() {\n //get all data to local variable\n getData();\n\n if (!localDb.length) return;\n\n const fragment = document.createDocumentFragment();\n\n localDb.forEach((item) => {\n const row = createTableRow(item);\n fragment.appendChild(row);\n });\n\n tBody.appendChild(fragment);\n }", "function createTable(data) {\n // Parse the json string into the object\n data_obj = JSON.parse(data);\n\n document.getElementById(\"table_container\").innerHTML = '';\n\n // Creation of the table\n var table = document.createElement(\"table\"), rowH, headerA,\n headerB, row, cellA, cellB;\n\n rowH = document.createElement(\"tr\");\n headerA = document.createElement(\"th\");\n headerB = document.createElement(\"th\");\n\n headerA.innerHTML = \"nome\";\n headerB.innerHTML = \"data\";\n\n table.appendChild(rowH);\n rowH.appendChild(headerA);\n rowH.appendChild(headerB);\n\n // Append the table inside parent container\n document.getElementById(\"table_container\").appendChild(table);\n\n for (let key in data_obj) {\n // Create rows and cells with For loop\n row = document.createElement(\"tr\");\n cellA = document.createElement(\"td\");\n cellB = document.createElement(\"td\");\n\n dataTime = new Date(data_obj[key].data);\n\n // Fill with data\n cellA.innerHTML = data_obj[key].nome;\n // Setting european format date\n cellB.innerHTML = dataTime.toLocaleDateString();\n\n // Append rows and cells\n table.appendChild(row);\n row.appendChild(cellA);\n row.appendChild(cellB);\n }\n}", "function buildTable(data) {\n // Remove table if it exists\n var deleteTable = d3.select(\"#table\");\n deleteTable.remove();\n\n var table = d3.select(\"#sample-metadata\").append('table');\n table.attr('class', 'table').attr('class', 'table-condensed');\n table.attr('id', 'table')\n var tbody = table.append(\"tbody\");\n var trow;\n for (const [key, value] of Object.entries(data)) {\n trow = tbody.append(\"tr\");\n var td = trow.append(\"td\").append(\"b\");\n td.text(`${key}:`);\n trow.append(\"td\").text(value);\n\n }\n }", "function theQwertyGrid_reFillTable(data) {\n\t\t\ttheQwertyGrid_clearAllRows();\n\t\t\ttheQwertyGrid_addRows(data, _theQwertyGrid_tableProps);\n\t\t}" ]
[ "0.6686535", "0.6420196", "0.6196701", "0.6184805", "0.61444736", "0.60633874", "0.6031633", "0.596071", "0.58881193", "0.5884037", "0.5879668", "0.5862247", "0.5862149", "0.5843813", "0.5841007", "0.58353907", "0.58286166", "0.5822772", "0.58211654", "0.5819544", "0.5818261", "0.58016247", "0.5799151", "0.5794152", "0.5790778", "0.57710713", "0.5765405", "0.5737214", "0.57329476", "0.5716846", "0.5704676", "0.56991124", "0.56991124", "0.5699007", "0.56952983", "0.56939393", "0.5688629", "0.56719244", "0.5669688", "0.56606776", "0.56581753", "0.5649151", "0.5644842", "0.5644339", "0.5638888", "0.56344014", "0.56308043", "0.5625459", "0.56200236", "0.56179535", "0.56081444", "0.55978775", "0.55958104", "0.5593661", "0.55908453", "0.55826545", "0.5580386", "0.5579497", "0.55564713", "0.5552311", "0.55419606", "0.5540805", "0.55386525", "0.55340534", "0.55320805", "0.55304766", "0.552595", "0.55240667", "0.552342", "0.5522077", "0.55122924", "0.5509083", "0.5503004", "0.55016065", "0.5497895", "0.54978377", "0.54955125", "0.54931074", "0.54925126", "0.54922295", "0.54883367", "0.54879427", "0.54779243", "0.54729813", "0.5468536", "0.5464654", "0.5462576", "0.546218", "0.54592943", "0.54540986", "0.5450046", "0.5442854", "0.54339385", "0.54328054", "0.54304975", "0.541858", "0.5410518", "0.5410497", "0.54104537", "0.540834", "0.5396406" ]
0.0
-1
Initializes the event handeling functions within the program.
constructor(canvas, scene) { this.canvas = canvas; this.scene = scene; _inputHandler = this; // Mouse Events this.canvas.onmousedown = function(ev) { _inputHandler.click(ev) }; this.canvas.onmousemove = function(ev) { }; // Button Events document.getElementById('fileLoad').onclick = function() { _inputHandler.readSelectedFile() }; // HTML Slider Events document.getElementById('exampleSlider').addEventListener('mouseup', function() { console.log(this.value); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initializeEvents () {\n }", "init () {\n const me = this;\n\n if (!me.eventsInitialized) {\n me.events.forEach(event => process.addListener(event, me.exec));\n\n me.eventsInitialized = true;\n }\n }", "function init() {\n\t\tinitEvents();\n\t}", "_initEvents(){\n this._eventInstances.forEach((list,i)=>{\n const hasTargets = list.length,\n isInitialised = this._eventInitialised[i]\n if (hasTargets&&!isInitialised) {\n this._body.addEventListener(this._eventNames[i],this._onEvent.bind(this,list,this._eventHandlers[i]))\n this._eventInitialised[i] = true\n }\n })\n }", "function init() {\n setupListeners();\n }", "function init () {\n bindEventHandlers();\n}", "function _init() {\n addEvent();\n getData();\n }", "function initEventListener() { }", "function init() {\r\n bindEventListeners();\r\n }", "function init() {\n contextListener();\n clickListener();\n keyupListener();\n resizeListener();\n }", "function init() {\n contextListener();\n clickListener();\n keyupListener();\n resizeListener();\n }", "function init() {\r\n contextListener();\r\n clickListener();\r\n keyupListener();\r\n resizeListener();\r\n }", "init() {\n\t\tglobalApplication.events.document();\n\t\tglobalApplication.events.header();\n\t}", "function initEventListener() {\n \n }", "onInit() {\n this.__initEvents();\n }", "function init() {\n loadDependencies();\n attachEventHandlers();\n}", "function init() {\n // initiateSharedFunctions();\n evtListeners();\n}", "function init() {\n // contextListener();\n clickListener();\n // keyupListener();\n // resizeListener();\n}", "function init () {\n\t\t//Get the unique [charity] userId so we know \n\t\t//which url to used for the server-side API\n\t\tvar userId = $('[data-event-config=\"userId\"]').val();\n\t\t\n\t\t//Initialise events collection\n\t\tfunction initCollection () {\n\t\t\tvar evts = new Evts({\n\t\t\t\tuserId: userId\n\t\t\t});\n\n\t\t\tinitFormView(evts);\n\t\t\tinitEventsBoard(evts);\n\t\t}\n\n\t\t//Initialise event form view\n\t\tfunction initFormView (evts) {\n\t\t\tvar $el = $('[data-event=\"configure\"]');\n\t\t\tnew EventForm({\n\t\t\t\tel: $el,\n\t\t\t\tcollection: evts\n\t\t\t});\n\t\t}\n\n\t\t//Initialise events board with persisted events\n\t\tfunction initEventsBoard (evts) {\n\t\t\tvar $el = $('[data-events-board]');\n\t\t\tnew EventBoard({\n\t\t\t\tel: $el,\n\t\t\t\tcollection: evts\n\t\t\t});\n\t\t}\n\n\t\t//Start up everything\n\t\tinitCollection();\n\t}", "__initEvents() {\n if (this.__hasInitEvents) {\n return;\n }\n\n this.__hasInitEvents = true;\n this.$eventHub = eventCenter;\n let events = this.$rawBroadcastEvents;\n if (typeof events === 'function') {\n events = this.$rawBroadcastEvents = events();\n }\n this.__bindBroadcastEvents(events);\n }", "function main() {\n addEventListeners();\n addAdvancedEventListeners();\n}", "function init() {\n\t\tsetOnclicks();\n\t}", "init(){\n this.addEvents(this.keys);\n }", "function event_initialise(){\n\tgcAddListener(capture_events_onCbusMessage);\n}", "function init(){\n calendarStart();\n loadTodos();\n addTodo();\n resizesTodoList();\n\n //Listens for resize event to calculate height of todo list.\n window.addEventListener('resize', resizesTodoList);\n \n //Listens for clicks on calendar days.\n document.querySelector('.calendar-container').addEventListener('click', event => {calendarDayClicked(event);});\n\n //Listens for events on todo list, for when to update number of todos in calendar.\n document.querySelector('.todoContainer').addEventListener('click', event => {todoClick(event);});\n }", "_init() {\n this.start();\n for (let i = 0; i < _activeEvents.length; i++) {\n // useCapture is used so that every event will trigger reset.\n $.on.call(this, _activeEvents[i], () => {this.reset()}, {}, this.target, true);\n }\n }", "function init() {\n _on(\"mouseenter\", _onMouseEnter);\n _on(\"focus\", _onMouseEnter);\n _on(\"mouseleave\", _onMouseLeave); \n _on(\"blur\", _onMouseLeave);\n }", "@autobind\n initEvents() {\n $(document).on('intro', this.triggerIntro);\n $(document).on('instructions', this.triggerInstructions);\n $(document).on('question', this.triggerQuestion);\n $(document).on('submit_query', this.triggerSubmitQuery);\n $(document).on('query_complete', this.triggerQueryComplete);\n $(document).on('bummer', this.triggerBummer);\n }", "function init() {\n \n window.addEventListener('mousemove', function(e) {\n mouseX = e.clientX;\n mouseY = e.clientY;\n });\n\n window.addEventListener('mousedown', function(e){mouseDown =true; if(typeof onMouseDown == 'function') onMouseDown() ;});\n window.addEventListener('mouseup', function(e){mouseDown = false;if(typeof onMouseUp == 'function') onMouseUp() ;});\n window.addEventListener('keydown', function(e){if(typeof onKeyDown == 'function') onKeyDown(e) ;});\n \n // if(typeof window.setup == 'function') window.setup();\n // cjsloop(); \n \n }", "_setupEvents () {\n this._events = {}\n this._setupResize()\n this._setupInput()\n\n // Loop through and add event listeners\n Object.keys(this._events).forEach(event => {\n if (this._events[event].disable) {\n // If the disable property exists, add prevent default to it\n this._events[event].disable.addEventListener(event, this._preventDefault, false)\n }\n this._events[event].context.addEventListener(event, this._events[event].event.bind(this), false)\n })\n }", "function initEvents(){\n\t\t\n\t\tg_ugFunctions.addEvent(g_player, \"play\", function(){\n\t\t\tg_objThis.trigger(t.events.START_PLAYING);\n\t\t});\n\t\t\n\t\tg_ugFunctions.addEvent(g_player, \"pause\", function(){\n\t\t\tg_objThis.trigger(t.events.STOP_PLAYING);\n\t\t});\n\t\t\n\t\tg_ugFunctions.addEvent(g_player, \"ended\", function(){\n\t\t\tg_objThis.trigger(t.events.STOP_PLAYING);\n\t\t});\n\t\t\t\t\t\t\n\t\t\n\t}", "function initEventHandler() {\n // initSortable();\n initFormEvents(fb);\n initListEvents(fb);\n}", "function init() {\n id(\"scroll-btn\").addEventListener(\"click\", scrollDown);\n id(\"top-btn\").addEventListener(\"click\", topOfPage);\n id(\"home-btn\").addEventListener(\"click\", homeView);\n id(\"exp-btn\").addEventListener(\"click\", expView);\n id(\"resume-btn\").addEventListener(\"click\", resumeView);\n id(\"contact-btn\").addEventListener(\"click\", newContact);\n qs(\"#about span\").addEventListener(\"click\", newContact);\n qs(\"#contact form\").addEventListener(\"submit\", submitForm);\n qs(\"form\").addEventListener(\"input\", enableSubmit);\n }", "function main() {\n addEventListeners();\n}", "function init() {\n\t\tbindClickEventsToBulbs();\n\t\tgetBulbsInfo();\n\t\tupdateBulbsStatus();\n\t \t\n initDigitalWatch();\n updateDate(0);\n\n bindEvents();\n }", "function init() {\r\n id(\"start-btn\").addEventListener(\"click\", makeRequest);\r\n id(\"start-btn\").addEventListener(\"click\", switchView);\r\n id(\"start-btn\").addEventListener(\"click\", startTimer);\r\n id(\"skip-btn\").addEventListener(\"click\", getNew);\r\n id(\"quit-btn\").addEventListener(\"click\", exit);\r\n id(\"submit-btn\").addEventListener(\"click\", checkUserAnswer);\r\n id(\"auth\").addEventListener(\"submit\", registerUser);\r\n id(\"register\").addEventListener(\"click\",\r\n () => switchAuth(\"Join!\", submitVerification, registerUser));\r\n id(\"login\").addEventListener(\"click\",\r\n () => switchAuth(\"Let's play!\", registerUser, submitVerification));\r\n }", "function init() {\n setDomEvents();\n }", "function EventManager() {\n}", "_initEvents() {\n Input._init(this, {\n joystick: true\n });\n }", "function initEvents(){\n\t\t\t\t\n\t\t//set navigation buttons events\n\t\tif(g_objNavWrapper){\n\t\t\t\n\t\t\tg_carousel.setScrollLeftButton(g_objButtonRight);\n\t\t\tg_carousel.setScrollRightButton(g_objButtonLeft);\n\t\t\t\n\t\t\tif(g_objButtonPlay)\n\t\t\t\tg_carousel.setPlayPauseButton(g_objButtonPlay);\n\t\t\t\n\t\t}\n\t\t\n\t\tg_objGallery.on(g_gallery.events.SIZE_CHANGE, onSizeChange);\n\t\tg_objGallery.on(g_gallery.events.GALLERY_BEFORE_REQUEST_ITEMS, onBeforeReqestItems);\n\t\t\n\t\t//on click events\n\t\tjQuery(g_objTileDesign).on(g_objTileDesign.events.TILE_CLICK, onTileClick);\n\t\t\n\t\t//init api\n\t\tg_objGallery.on(g_apiDefine.events.API_INIT_FUNCTIONS, initAPIFunctions);\n\t}", "function initApplication() \n{\n var eventInstanceOut = {};\n\n var guid = FMOD.GUID();\n\n\n console.log(\"Loading events\\n\");\n\n loadBank(\"Master Bank.bank\");\n loadBank(\"Master Bank.strings.bank\");\n loadBank(\"Vehicles.bank\");\n \n // Get the Car Engine event\n var eventDescription = {};\n CHECK_RESULT( gSystem.getEvent(\"event:/Vehicles/Basic Engine\", eventDescription) );\n CHECK_RESULT( eventDescription.val.createInstance(eventInstanceOut) );\n gEventInstance = eventInstanceOut.val;\n\n CHECK_RESULT( gEventInstance.setParameterValue(\"RPM\", 1000.0) );\n CHECK_RESULT( gEventInstance.start() );\n\n // Position the listener at the origin\n var attributes = FMOD._3D_ATTRIBUTES();\n\n setVector(attributes.position, 0.0, 0.0, 0.0);\n setVector(attributes.velocity, 0.0, 0.0, 0.0);\n setVector(attributes.forward, 0.0, 0.0, 1.0);\n setVector(attributes.up, 0.0, 1.0, 0.0);\n CHECK_RESULT( gSystem.setListenerAttributes(0, attributes) );\n \n setVector(attributes.position, 0.0, 0.0, 2.0);\n CHECK_RESULT( gEventInstance.set3DAttributes(attributes) );\n\n gLastListenerPos = FMOD.VECTOR();\n gLastEventPos = FMOD.VECTOR();\n\n setVector(gLastListenerPos, 0.0, 0.0, 0.0);\n setVector(gLastEventPos, 0.0, 0.0, 0.0); \n}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function init() {\n console.log('init!');\n setup();\n startTimer();\n }", "function init() {\n // console.log(\"phoneMotion.init()\");\n addEvents();\n}", "function init_event_system(paper,graph,remove_cascade,disableRemove,disableResize)\n{\n $menu_cell = null;\n $mouse_over_menu = false;\n $mouse_clicked_menu = false;\n $mouse_over_cell = false;\n $temp_link = null;\n $edge_menu_shown = false;\n init_edge_eventsystem(paper);\n init_highlighter_eventsystem(paper,graph);\n init_menu_eventsystem(paper,graph,remove_cascade,disableRemove,disableResize);\n}", "function init() {\r\n\t// attach listener to the canvas\r\n\tconsole.log(\"Starting Up Version 1.28\");\r\n\tcanvas.addEventListener('pointermove', rectDrag, false);\r\n\tcanvas.addEventListener('pointerdown', rectDrag, false);\r\n\tcanvas.addEventListener('pointerup', rectDrag, false);\r\n}", "function init() {\n id(\"roll\").addEventListener(\"click\", startGame);\n id(\"stop\").addEventListener(\"click\", endGame);\n }", "ConnectEvents() {\n\n }", "function setDefaultEvents() {\n // Launch the Callee application when the Call button is clicked\n document.querySelector(\"#btn-check\").addEventListener(\"click\", launchApp);\n\n // Add eventListener for tizenhwkey\n document.addEventListener(\"tizenhwkey\", function(e) {\n if (e.keyName === \"back\") {\n try {\n tizen.application.getCurrentApplication().exit();\n } catch (error) {\n console.error(\"getCurrentApplication(): \" + error.message);\n }\n }\n });\n }", "constructor() { \n \n Event.initialize(this);\n }", "function initializeApp () {\n makeQuiz();\n eventHandlers();\n}", "function init() {\n qs(\"body\").addEventListener(\"keydown\", lookUpKey);\n qs(\"body\").addEventListener(\"keydown\", lookUpKey);\n let buttons = qsa(\"section.instruction button\");\n for (let i = 0; i < buttons.length; i++) {\n buttons[i].addEventListener(\"click\", start);\n }\n let options = qsa(\".question-list ul li\");\n for (let i = 0; i < options.length; i++) {\n options[i].addEventListener(\"click\", answer);\n }\n }", "async init() {\n // Initiate classes and wait for async operations here.\n this._addWave();\n this._addEventListener();\n this._addBubbles(this._config.app.bubblesAddedInLoop.count, 1, 8);\n\n this.emit(Application.events.APP_READY);\n }", "initialize() {\n this.listenTo(this.owner, {\n [converter_1.Converter.EVENT_BEGIN]: this.onBegin,\n [converter_1.Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration,\n [converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.onDeclaration,\n [converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,\n [converter_1.Converter.EVENT_RESOLVE]: this.onResolve,\n [converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,\n });\n }", "function setupListeners() {\n setupAppHomeOpenedListener();\n setupClearGoalsButtonListener();\n}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function setup() {\n this.addEventListener(\"mousemove\", resetTimer, false);\n this.addEventListener(\"mousedown\", resetTimer, false);\n this.addEventListener(\"keypress\", resetTimer, false);\n this.addEventListener(\"DOMMouseScroll\", resetTimer, false);\n this.addEventListener(\"mousewheel\", resetTimer, false);\n this.addEventListener(\"touchmove\", resetTimer, false);\n this.addEventListener(\"MSPointerMove\", resetTimer, false);\n\n startTimer();\n}", "function initializeEvents() {\n 'use strict';\n var thumbnails = getThumbnailsArray();\n thumbnails.forEach(addThumbClickHandler);\n}", "function initializeEvents() {\n 'use strict';\n var thumbnails = getThumbnailsArray();\n thumbnails.forEach(addThumbClickHandler);\n}", "function initEventHandlersDev(){\n // Computer user requires keyboard presses\n document.onkeydown = respondToKeyPress;\n document.onkeyup = respondToKeyRelease;\n initTouchEventHandlers();\n // initButtonEventHandlers();\n initMobileEventHandlers();\n}", "function init() {\n // Creating views\n trackBank = host.createMainTrackBank (1, 0, 0), host.createCursorTrack (\"AIIOM_CTRL\", \"Cursor Track\", 0, 0, true);\n cursorTrack = host.createArrangerCursorTrack(1, 1); // Track cursor\n trackBank.followCursorTrack(cursorTrack); // Sync cursor track of view and script\n\n host.getMidiInPort(0).setMidiCallback(onMidi); // Configuring MIDI device\n\n // Initializing controller sections\n midiListeners = [\n initTransport(),\n initTrack(),\n initDevice(),\n initNote(),\n initNavigation(),\n initLoopback()\n ];\n}", "function init() {\r\n reset();\r\n lastTime = Date.now();\r\n main();\r\n }", "function init() {\n\t\tcacheDOM();\n\t\tbindEvents();\n\t}", "function EventDispatcher() {\n this.initialize();\n }", "function init() {\n\n// reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "function _init() {\n\t\t\t// Trigger a few events so the bar looks good on startup.\n\t\t\t_timeHandler({\n\t\t\t\tid: api.id,\n\t\t\t\tduration: api.jwGetDuration(),\n\t\t\t\tposition: 0\n\t\t\t});\n\t\t\t_bufferHandler({\n\t\t\t\tid: api.id,\n\t\t\t\tbufferProgress: 0\n\t\t\t});\n\t\t\t_muteHandler({\n\t\t\t\tid: api.id,\n\t\t\t\tmute: api.jwGetMute()\n\t\t\t});\n\t\t\t_stateHandler({\n\t\t\t\tid: api.id,\n\t\t\t\tnewstate: jwplayer.api.events.state.IDLE\n\t\t\t});\n\t\t\t_volumeHandler({\n\t\t\t\tid: api.id,\n\t\t\t\tvolume: api.jwGetVolume()\n\t\t\t});\n\t\t}", "_events() {\n \tthis._addKeyHandler();\n \tthis._addClickHandler();\n }", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}" ]
[ "0.7819221", "0.7742967", "0.7721209", "0.74809366", "0.74472845", "0.736311", "0.7303603", "0.72342724", "0.72149634", "0.7187284", "0.7175394", "0.71666014", "0.7140642", "0.71191394", "0.70814234", "0.7038503", "0.7002469", "0.69794565", "0.6948371", "0.6899367", "0.6879973", "0.68791574", "0.683218", "0.68203247", "0.68190056", "0.68179435", "0.6815138", "0.68105876", "0.6800782", "0.678991", "0.677372", "0.67661595", "0.6708966", "0.6708003", "0.66945446", "0.6685669", "0.6675768", "0.6675036", "0.6653892", "0.66322833", "0.6630772", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66214174", "0.66073066", "0.6566223", "0.6563339", "0.6562786", "0.6544773", "0.6542119", "0.65421015", "0.6538518", "0.65362203", "0.65317273", "0.65296274", "0.6502863", "0.6492848", "0.6489248", "0.64866966", "0.6486538", "0.6486538", "0.6473805", "0.6470978", "0.6469652", "0.6468935", "0.6465724", "0.64474237", "0.64456695", "0.64456695", "0.64456695", "0.64456695", "0.6443475", "0.6437335", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815", "0.6434815" ]
0.0
-1
Function called upon mouse click.
click(ev) { // Print x,y coordinates. console.log(ev.clientX, ev.clientY); var shape = new Triangle(shader); this.scene.addGeometry(shape); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseClick(p) {\n }", "onClick(event) {\n\t\t// console.log(\"mouse click\");\n\t\tthis.draw(event);\n\t}", "function mouseClicked(){\n sim.checkMouseClick();\n}", "function canvasClick(e) {\n\tblockus.mouseClicked();\n}", "function mouseClicked() {\n // If it has been clicked return true\n return true;\n }", "mouseDown(pt) {}", "mouseDown(pt) {}", "clicked(x, y) {}", "function mouseClicked() {\n fill('#222222');\n rect(300,300,150,150)\n return false;\n }", "function mouseClicked() {\n MouseClickedAtX = mouseX;\n MouseClickedAtY = mouseY;\n}", "function mouseClicked(){\n\tloop()\n}", "function mouseClicked(){\n // the x position will take the value of the horizontal mouse position\n xPos=mouseX;\n // the y position will take the value of the vertical mouse position\n yPos = mouseY;\n}", "mouseClicked() {\n this.inputNode.mouseClicked();\n }", "handleJDotterClick() {}", "function mouseClicked() {\n print(mouseX, mouseY)\n}", "function mouseClicked() {\n if (start.start === false) {\n start.mouseClicked();\n } else {\n handler.mouseClicked();\n }\n if (handler.active === handler.warning && trigger.warning === false) {\n trigger.mouseClicked();\n }\n if (\n handler.active === handler.nameplate &&\n doorbell.ok === false &&\n doorbell.name.length >= 1\n ) {\n doorbell.mouseClicked();\n }\n if (\n handler.active === handler.decisionC1 ||\n handler.active === handler.decisionH3 ||\n handler.active === handler.decisionF1 ||\n handler.active === handler.decisionF3\n ) {\n decision1.mouseClicked();\n decision2.mouseClicked();\n }\n // red flags buttons\n if (handler.active === handler.annegretC1) {\n control.mouseClicked();\n }\n if (handler.active === handler.frankE6) {\n lie.mouseClicked();\n }\n if (handler.active === handler.monologueE3) {\n arm.mouseClicked();\n }\n if (handler.active === handler.annegretF8) {\n victim.mouseClicked();\n }\n if (handler.active === handler.monologueG2) {\n noise.mouseClicked();\n }\n if (handler.active === handler.monologueH8) {\n phone.mouseClicked();\n }\n\n if (handler.active === handler.end) {\n end.mouseClicked();\n }\n}", "function cust_MouseDown() {\n\n}", "function mouseClicked(){\n\tif(clicked){\n\t\tclicked =false; // check clicked status: first click set cy and cx, second click go back to regular mandlebrot. \n\t}\n\telse{\n\t\tclicked=true;\n\t\tcx = map(mouseX,0,width, -1.0, 1.0);\n\t\tcy = map(mouseY,0,height,-1.0,1.0);\n\t}\n}", "onMouseDown(e) {}", "function mouseClicked(){\n\tconsole.log(mouseX, mouseY);\n}", "function on_click(e) {\n cloud.on_click(e.clientX, e.clientY);\n}", "mouseDown(x, y, _isLeftButton) {}", "clicked () {\n\n if ( dist ( mouseX, mouseY, this.xCoord, this.yCoord ) < this.size / 2 ) {\n\n this.isClicked = !this.isClicked;\n }\n }", "function onMouseClick(e) {\n eventHandler.mouseClickHandler(e);\n}", "function mousePressed() {\n session.mousePressed();\n}", "function mouseClickedOnCanvas() {\n game.click = true;\n}", "function mousePressed()\n{\n\tvar page = story.getCurrentPage();\n\tpage.mouseP();\n}", "function mouseDown(x, y, button) {\r\n\tif (button == 0 || button == 2) {\t// If the user clicks the right or left mouse button...\r\n\t\tmouseClick = true;\r\n\t}\r\n\t//*** Your Code Here\r\n}", "click(x, y, _isLeftButton) {}", "function mouseUp() { }", "function OnMouseDown()\n{\n\n\n}", "function mouse_clicked(){\n\t\treturn M.mouse_clicked;\n\t}", "onMouseDown(event) {\n\t\tcurrentEvent = event\n\t\tthis.isClicked = true\n\t\tthis.render()\n\t}", "handleClick() {}", "function mouseDown(e)\n{\n\tmouseClickDown = true;\n\tmouseX = e.clientX;\n\tmouseY = e.clientY;\n}", "function Click() {\n}", "function mouse(kind, pt, id) {\n \n}", "function handleClick(event)\n{\n}", "function mouseDown(e) {\n mousePress(e.button, true);\n}", "function handleMouseDown()\r\n{\r\n _mouse_down = true;\r\n}", "function clickHandler(event){\n\t\t\tif(ignoreClick){\n\t\t\t\tignoreClick = false;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar offset = overlay.cumulativeOffset();\t\t\t\n\t\t\ttarget.fire('flotr:click', [{\n\t\t\t\tx: xaxis.min + (event.pageX - offset.left - plotOffset.left) / hozScale,\n\t\t\t\ty: yaxis.max - (event.pageY - offset.top - plotOffset.top) / vertScale\n\t\t\t}]);\n\t\t}", "function mouseClicked() {\n if (mouseY >= 620 && mouseY <= 720 && mouseX >= 1040 && mouseX <= 1280) {\n aanvalActie = false;\n aanvalKnopStatus = false;\n beweegActie = false;\n beweegKnopStatus = false;\n beurtVeranderen();\n veranderKleur(donkerblauw,wit);\n veranderKleur(lichtblauw,wit);\n }\n}", "function mousedown() {\n \"use strict\";\n mouseclicked = !mouseclicked;\n}", "function mouseDown(mousePos) {\n\t}", "function mouseDown(mousePos) {\n\t}", "handleClick( event ){ }", "function mousePressed(){\n for(var i=0; i<mirnas.length; i++){\n mirnas[i].clicked(mouseX,mouseY);\n }\n}", "function mousePressed() {\n nuova_poesia();\n}", "function onMouseDown(event) { }", "function mousePressed() {\n // the built-in p5.js function mouseClicked() does not work on mobile.\n // must use mousePressed() for all mouse events.\n // mousePressed() is called repeatedly each frame,\n // 'doneOnce' controls which events are called repeatedly (drag events)\n // and which are called once (click events).\n returnValueFromViews = clickRecursive(views[view_i]) || returnValueFromViews\n if (returnValueFromViews){ setTopLevelVariables(returnValueFromViews) }\n if (menuButton.testForClick() && !doneOnce){\n menuButton.performClickFunctionality();\n }\n if (!doneOnce){\n doneOnce = true;\n }\n}", "externalClick() {\n this._strikeClick();\n this._localPointer.x = this.getPointer().x;\n this._localPointer.y = this.getPointer().y;\n }", "function click(){\n rect = leinwand.getBoundingClientRect();\n mouseX = event.clientX - rect.left;\n mouseY = event.clientY - rect.top;\n //draw();\n //context.fillStyle();\n context.fillRect(mouseX, mouseY, 40, 40);\n }", "function mouseClicked() {\n \n rect(Math.floor(Math.floor(mouseX) / scale), Math.floor(Math.floor(mouseY) / scale), scale, scale);\n fill(51);\n}", "on_mousedown(e, localX, localY) {\n\n }", "function clickHandler(e) {\n // Nur bei Linksklick\n if (e.button !== 0) return;\n clickAt(e.offsetX, e.offsetY);\n }", "mousePressed() {\n console.log(\"Mouse pressed\");\n }", "function canvasMouseDown(e) {\n\tblockus.mouseDown();\n}", "mouseClick(ev) {\n // Print x,y coordinates.\n console.log(ev.clientX, ev.clientY);\n }", "function mouseClicked(){\n if(current_img == null) current_img = flowers_img;\n if(mouseX>=0 && mouseX<width && mouseY>=0 && mouseY<height)\n image(current_img, mouseX - 37, mouseY - 50, 75, 100);\n}", "function cb_beforeClick(cb, pos) { }", "click() { }", "function mouseClicked() {\n if (menu == 0) {\n if (mouseX < 509 && mouseX > 425) {\n if (mouseY < 360 && mouseY > 340) {\n menu = 1;\n }\n if (mouseY < 425 && mouseY > 390) {\n menu = 2;\n }\n }\n }\n}", "function click() {\n d3_eventCancel();\n w.on(\"click.drag\", null);\n }", "function mousePressed() {\r\n mouseIsDown = true;\r\n}", "function mousePressed() {\n $(\"#winner-info\").html(\"\");\n for (var i = 0; i < dataPoints.length; i ++) {\n dataPoints[i].clicked();\n }\n}", "function handleClick(){\n console.log(\"clicked\");\n}", "function onCanvasMouseDown(event) {\n window.mouseDown = true;\n clickCell(event.pageX, event.pageY);\n}", "function mouseClicked() {\n dropPoke();\n}", "_evtClick(event) { }", "function mouseClicked() {\n // normalize point\n let x = map(mouseX, 0, width, 0, 1);\n let y = map(mouseY, 0, height, 0, 1);\n pushPoint(x, y);\n}", "function mouseClicked() {\n fill(starColour);\n rect(mouseX, mouseY, 8, 8);\n}", "onMouseClick() {\n Star.last_clicked_star = null;\n if (Star.mouse_line != null)\n {\n Star.mouse_line.Dispose();\n Star.mouse_line = null;\n }\n }", "doubleClick(x, y, _isLeftButton) {}", "function setMouseClick(node) {\n click_active = true; //Disable mouseover events\n\n mouse_zoom_rect.on('mouseout', null); //Send out for pop-up\n\n showTooltip(node); //Find all edges and nodes connected to the \"found\" node\n\n setSelection(node); //Draw the connected edges and nodes\n\n drawSelected(); //Draw the edges on the hidden canvas for edge hover\n\n drawHiddenEdges(node); //Add the extra click icon in the bottom right\n\n renderClickIcon(node); //Draw rotating circle around the hovered node\n\n drawDottedHoverCircle(node); //Set for reference\n\n current_click = node;\n } //function setMouseClick", "function setMouseClick(node) {\n click_active = true; //Disable mouseover events\n\n mouse_zoom_rect.on('mouseout', null); //Send out for pop-up\n\n showTooltip(node); //Find all edges and nodes connected to the \"found\" node\n\n setSelection(node); //Draw the connected edges and nodes\n\n drawSelected(); //Draw the edges on the hidden canvas for edge hover\n\n drawHiddenEdges(node); //Add the extra click icon in the bottom right\n\n renderClickIcon(node); //Draw rotating circle around the hovered node\n\n drawDottedHoverCircle(node); //Set for reference\n\n current_click = node;\n } //function setMouseClick", "function _click(d){\n \n }", "function down(evt){mouseDown(getMousePos(evt));}", "function down(evt){mouseDown(getMousePos(evt));}", "function buthandleclick_this() {\n\tbuthandleclick(this);\n}", "mouseUp(pt) {}", "mouseUp(pt) {}", "function mousePressed() {\n init();\n}", "function MouseListener() {\n}", "function mouseClicked() {\n // Ignore clicks outside window\n if (!window.ev) {\n return;\n }\n \n if (!menu_toggles.forces.parameter) return;\n \n // Delete force\n for (var i = 1; i < forcePoints.length; i++) {\n // Check if hovering over fixed forcePoint\n if (forcePoints[i].hover) {\n forcePoints.splice(i, 1);\n return;\n }\n }\n \n // Create force\n forcePoints.push(new ForcePoint(cursorPoint.center, cursorPoint.forceFactor, cursorPoint.forceExp, cursorPoint.forceIntensity, \"CONTRACTING\"));\n}", "function click() {\r\n\t// if the piece is highlighted, move the piece\r\n\tif(this.className == \"highlight\") {\r\n\t\tmove(this);\r\n\t}\r\n}", "function auxClicked(ev) {\n clicked(ev, dificuldade, score);\n }", "function click(ev, gl, canvas) {\r\n var x = ev.clientX; //x coord of mouse\r\n var y = ev.clientY; //y coord of mouse\r\n var rect = ev.target.getBoundingClientRect();\r\n \r\n x = ((x - rect.left) - canvas.width/2) / (canvas.width/2);\r\n y = (canvas.height/2 - (y - rect.top)) / (canvas.height/2);\r\n \r\n //push coord onto array\r\n points.push(x); points.push(y);\r\n \r\n console.log('Clicked at: (',x,',', y,')'); //prints out clicked points\r\n \r\n draw(gl, canvas); \r\n}", "function mouseDown(event) {\n mouseClicked = true;\n startPoint = new Point(event.offsetX, event.offsetY);\n var figure = getIntersectedFigure();\n\n if (ButtonState === CANVAS_STATE.SELECTED) {//? da se iznesyt\n unselectAllFigure();\n currentFigure = undefined;\n selectedFigure = undefined;\n selectFigure();\n\n }\n\n if (ButtonState === CANVAS_STATE.SELECTED && figure === false) {\n unselectAllFigure();\n }\n}", "function mouseClicked() {\n clickX = mouseX;\n clickY = mouseY;\n\n xMove = round((init_ball_x - clickX) / 10);\n yMove = round((init_ball_y - clickY) / 10);\n}", "function canvasClickEvent(e){\n\t\t\tvar mouseX = $(this).offset().left, mouseY = $(this).offset().top;\n\t\t\tconsole.log(\"clicked the canvas\");\n\t\t\tswitch(Math.floor((e.pageX - mouseX)/(this.width/5)%5)){\n\t\t\tcase 0:\n\t\t\t\t$(\"#holdbutton_1\").trigger(\"click\");\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\t$(\"#holdbutton_2\").trigger(\"click\");\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$(\"#holdbutton_3\").trigger(\"click\");\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$(\"#holdbutton_4\").trigger(\"click\");\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\t$(\"#holdbutton_5\").trigger(\"click\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.log(\"error didn't detect where the click came from\");\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn false;\n\t}", "function click(event){\n\n\t// get the mouse coordinates\n\tlet rect = event.target.getBoundingClientRect();\n\tmouse.x = ((event.clientX - rect.left) / clWidth) * 2 - 1;\n\tmouse.y = - ((event.clientY - rect.top) / clHeight) * 2 + 1;\n\n\t// set raycaster\n\traycaster.setFromCamera(mouse, camera);\n\n\t// check if a new polygon shall be created\n\tif(selectMode == 'Neu'){\n\n\t newPolygon();\n\n // update status\n status = 'Setze neues Objekt';\n\t}\n\n\t// check if an object shall be selected\n\telse if(selectMode == 'Objekt'){\n\n objectSelection();\n\n // update status\n status = 'Objekt ausgewählt';\n\n\t}\n\n\t// check if object selection is set to point\n\telse if(selectMode == 'Punkt'){\n\n pointSelection();\n\n // update status\n status = 'Punkt ausgewählt';\n\n\t}\n\n\t// update scene\n\trender()\n}", "function mouseClickHandler() {\n console.log('pageX is: ' + d3.event.pageX);\n console.log('pageY is: ' + d3.event.pageY);\n\n // get the current mouse position\n const [mx, my] = d3.mouse(this);\n\n // use the new diagram.find() function to find the voronoi site closest to\n // the mouse, limited by max distance defined by voronoiRadius\n //const site = voronoiDiagram.find(mx, my, voronoiRadius);\n const site = voronoiDiagram.find(mx, my);\n\n // 1. highlight the point if we found one, otherwise hide the highlight circle\n highlight(site && site.data);\n\n // 2.\n updateDashboard(site && site.data);\n\n // 3.\n drawMarker(site && site.data)\n\n }", "function mousePressed() {\n\tinit();\n}", "function popup_click(state)\r\n{\r\n\tif (state)\r\n\t{\r\n\t\tpopup_keep_x = popup_mouse_x - popup_left;\r\n\t\tpopup_keep_y = popup_mouse_y - popup_top;\r\n\t}\r\n\tpopup_is_clicked = state;\r\n}", "onMouseDown (e) {\n this.isMouseDown = true;\n\n this.emit('mouse-down', {x: e.offsetX, y: e.offsetY});\n }", "function onClick(ev) {\n var coords = getCanvasXY(ev);\n var x = coords[0];\n var y = coords[1];\n\n//here is the problem....how do we know we clicked on canvas\n /*var fig=STACK.figures[STACK.figureGetMouseOver(x,y,null)];\n if(CNTRL_PRESSED && fig!=null){\n TEMPORARY_GROUP.addPrimitive();\n STACK.figureRemove(fig);\n STACK.figureAdd(TEMPORARY_GROUP);\n }\n else if(STACK.figureGetMouseOver(x,y,null)!=null){\n TEMPORARY_GROUP.primitives=[];\n TEMPORARY_GROUP.addPrimitive(fig);\n STACK.figureRemove(fig);\n }*/\n//draw();\n}", "function mouse_click_gui(mx, my) {\n console.log('Clicked at coords (' + mx + ', ' + my + ').');\n }", "function mouseClicked() {\n //i cant figure out how to do mouse controls\n //player.mouseControls *= -1\n\n for (b = 0; b < buttons.length; b++){\n switch (buttons[b].shape) {\n case \"rect\":\n if (mouseX >= (buttons[b].x + camOffsetX) * canvasScale &&\n mouseX <= (buttons[b].x + camOffsetX + buttons[b].w) * canvasScale &&\n mouseY >= (buttons[b].y + camOffsetY) * canvasScale &&\n mouseY <= (buttons[b].y + camOffsetY + buttons[b].h) * canvasScale){\n if (options.optionsMenuHidden === -1 && buttons[b].tab === options.optionsMenuTab){\n buttons[b].testClick();\n return;\n }\n }\n break;\n case \"circle\":\n if (Math.sqrt(Math.pow(mouseX - ((buttons[b].x + camOffsetX) * canvasScale), 2)+Math.pow(mouseY - ((buttons[b].y + camOffsetY) * canvasScale),2) < buttons[b].w)){\n if (options.optionsMenuHidden === -1 && buttons[b].tab === options.optionsMenuTab){\n buttons[b].testClick();\n return;\n }\n }\n default:\n break;\n }\n \n }\n}", "function mouseEvent(ev) {\n\t\tvar card = $(this).data('card');\n\t\tif (card.container) {\n\t\t\tvar handler = card.container._click;\n\t\t\tif (handler) {\n\t\t\t\thandler.func.call(handler.context||window, card, ev);\n\t\t\t}\n\t\t}\n\t}", "function onMouseClick()\r\n{\r\n\tfor (var i = 0; i < activeBtns.length; i++)\r\n\t{\r\n\t\tif (activeBtns[i].over == true)\r\n\t\t{\t\r\n\t\t\tactiveBtns[i].click();\r\n\t\t\tbreak;\r\n\t\t}\t\t\r\n\t}\r\n}", "handleContextClick(args){\n if(this.shapeSelectionEnabled) {\n this.selectShape(args);\n }\n }" ]
[ "0.77607894", "0.77420837", "0.7663327", "0.7652763", "0.76443285", "0.7640984", "0.7640984", "0.76097023", "0.75493664", "0.7548157", "0.75453013", "0.7483764", "0.74433106", "0.73612285", "0.7358323", "0.7313255", "0.7306813", "0.72917074", "0.72869456", "0.72677", "0.72671336", "0.7241753", "0.72235906", "0.72216743", "0.7218231", "0.7211024", "0.7205062", "0.7189186", "0.71848834", "0.71727854", "0.71714085", "0.7167502", "0.71561116", "0.71335936", "0.71332526", "0.71315616", "0.71250325", "0.70792353", "0.70774525", "0.70704275", "0.70679456", "0.7063923", "0.7063447", "0.7059115", "0.7059115", "0.70569086", "0.70318455", "0.7030631", "0.7018927", "0.7012779", "0.700559", "0.70050424", "0.69929796", "0.6990598", "0.6990153", "0.6987645", "0.69771355", "0.6969915", "0.69685227", "0.69523734", "0.69496983", "0.69387263", "0.6938573", "0.69350207", "0.69281244", "0.69232833", "0.6919053", "0.6915254", "0.69078374", "0.69026256", "0.6899491", "0.6899006", "0.689308", "0.6888214", "0.6888214", "0.6880304", "0.68769175", "0.68769175", "0.6875929", "0.6851494", "0.6851494", "0.6837642", "0.6833671", "0.6828313", "0.6820778", "0.68123806", "0.68089885", "0.6807258", "0.68060243", "0.6793819", "0.67905974", "0.6787144", "0.67857295", "0.67849064", "0.67820007", "0.67549336", "0.6750565", "0.6743961", "0.67432666", "0.67401975", "0.6738176" ]
0.0
-1